From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- sc/inc/datamapper.hxx | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sc/inc/datamapper.hxx (limited to 'sc/inc/datamapper.hxx') diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx new file mode 100644 index 000000000..2f8e51d50 --- /dev/null +++ b/sc/inc/datamapper.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SC_INC_EXTERNALDATAMAPPER_HXX +#define INCLUDED_SC_INC_EXTERNALDATAMAPPER_HXX + +#include + +#include "scdllapi.h" + +#include + +#include "orcusxml.hxx" + +class ScDocument; + +namespace sc { + +class ScDBDataManager; +class DataProvider; +class DataTransformation; + +class SC_DLLPUBLIC ExternalDataSource +{ +private: + + /** + * The URL for the external data provider. The URL + * will be passed to the data provider together with + * the ID. + * + * A data provider may decide to ignore the URL string. + */ + OUString maURL; + + /** + * The data provider is a unique identifier that will + * allow to identify and instantiate the required data + * provider. + * + * Examples for the internal data providers are: + * + * org.libreoffice.dataprovider.calc.csv + * org.libreoffice.dataprovider.calc.json + * + * Only internal data providers should use the: + * "org.libreoffice.dataprovider prefix". + */ + OUString maProvider; + + /** + * The ID allows the same data provider to support different + * data streams. + * + * A data provider may decide to ignore the ID string. + */ + OUString maID; + + ScOrcusImportXMLParam maParam; + + std::shared_ptr mpDataProvider; + std::shared_ptr mpDBDataManager; + + std::vector> maDataTransformations; + + ScDocument* mpDoc; + +public: + + ExternalDataSource(const OUString& rURL, + const OUString& rProvider, ScDocument* pDoc); + + void setUpdateFrequency(double nUpdateFrequency); + + void setID(const OUString& rID); + void setURL(const OUString& rURL); + void setProvider(const OUString& rProvider); + void setXMLImportParam(const ScOrcusImportXMLParam& rParam); + + const OUString& getURL() const; + const OUString& getProvider() const; + const OUString& getID() const; + const ScOrcusImportXMLParam& getXMLImportParam() const; + static double getUpdateFrequency(); + OUString getDBName() const; + void setDBData(const OUString& rDBName); + ScDBDataManager* getDBManager(); + + void refresh(ScDocument* pDoc, bool bDeterministic = false); + + void AddDataTransformation(const std::shared_ptr& mpDataTransformation); + const std::vector>& getDataTransformation() const; +}; + +class SC_DLLPUBLIC ExternalDataMapper +{ + //ScDocument* mpDoc; + std::vector maDataSources; + +public: + ExternalDataMapper(ScDocument* pDoc); + + ~ExternalDataMapper(); + + void insertDataSource(const ExternalDataSource& rSource); + + const std::vector& getDataSources() const; + std::vector& getDataSources(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3