LOK: tilebench improvements
[LibreOffice.git] / sc / inc / datamapper.hxx
blobb935e2ac36ccdcd3cd4088a405d364c8147e2f65
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_SC_INC_EXTERNALDATAMAPPER_HXX
11 #define INCLUDED_SC_INC_EXTERNALDATAMAPPER_HXX
13 #include <memory>
14 #include <vector>
16 #include "scdllapi.h"
18 #include <rtl/ustring.hxx>
20 class ScDocument;
21 class ScDBData;
23 namespace sc {
25 class ScDBDataManager;
26 class DataProvider;
27 class ScDBDataManager;
28 class DataTransformation;
30 class SC_DLLPUBLIC ExternalDataSource
32 private:
34 /**
35 * The URL for the external data provider. The URL
36 * will be passed to the data provider together with
37 * the ID.
39 * A data provider may decide to ignore the URL string.
41 OUString maURL;
43 /**
44 * The data provider is a unique identifier that will
45 * allow to identify and instantiate the required data
46 * provider.
48 * Examples for the internal data providers are:
50 * org.libreoffice.dataprovider.calc.csv
51 * org.libreoffice.dataprovider.calc.json
53 * Only internal data providers should use the:
54 * "org.libreoffice.dataprovider prefix".
56 OUString maProvider;
58 /**
59 * The ID allows the same data provider to support different
60 * data streams.
62 * A data provider may decide to ignore the ID string.
64 OUString maID;
66 double mnUpdateFrequency;
68 std::shared_ptr<DataProvider> mpDataProvider;
69 std::shared_ptr<ScDBDataManager> mpDBDataManager;
71 std::vector<std::shared_ptr<sc::DataTransformation>> maDataTransformations;
73 ScDocument* mpDoc;
75 public:
77 ExternalDataSource(const OUString& rURL,
78 const OUString& rProvider, ScDocument* pDoc);
80 ~ExternalDataSource();
82 void setUpdateFrequency(double nUpdateFrequency);
84 void setID(const OUString& rID);
85 void setURL(const OUString& rURL);
86 void setProvider(const OUString& rProvider);
88 const OUString& getURL() const;
89 const OUString& getProvider() const;
90 const OUString& getID() const;
91 double getUpdateFrequency() const;
92 OUString getDBName() const;
93 void setDBData(const ScDBData* pDBData);
94 ScDBDataManager* getDBManager();
96 void refresh(ScDocument* pDoc, bool bDeterministic = false);
98 void AddDataTransformation(std::shared_ptr<sc::DataTransformation> mpDataTransformation);
99 const std::vector<std::shared_ptr<sc::DataTransformation>>& getDataTransformation() const;
102 class SC_DLLPUBLIC ExternalDataMapper
104 //ScDocument* mpDoc;
105 std::vector<ExternalDataSource> maDataSources;
107 public:
108 ExternalDataMapper(ScDocument* pDoc);
110 ~ExternalDataMapper();
112 void insertDataSource(const ExternalDataSource& rSource);
114 const std::vector<ExternalDataSource>& getDataSources() const;
115 std::vector<ExternalDataSource>& getDataSources();
120 #endif
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */