Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / datamapper.hxx
blob75b04440153ea6f4e285d866b0d6deed9d8bf55f
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 <vector>
15 #include "scdllapi.h"
17 #include <rtl/ustring.hxx>
19 class ScDocument;
20 class ScDBData;
22 namespace sc {
24 class ScDBDataManager;
25 class DataProvider;
26 class ScDBDataManager;
27 class DataTransformation;
29 class SC_DLLPUBLIC ExternalDataSource
31 private:
33 /**
34 * The URL for the external data provider. The URL
35 * will be passed to the data provider together with
36 * the ID.
38 * A data provider may decide to ignore the URL string.
40 OUString maURL;
42 /**
43 * The data provider is a unique identifier that will
44 * allow to identify and instantiate the required data
45 * provider.
47 * Examples for the internal data providers are:
49 * org.libreoffice.dataprovider.calc.csv
50 * org.libreoffice.dataprovider.calc.json
52 * Only internal data providers should use the:
53 * "org.libreoffice.dataprovider prefix".
55 OUString maProvider;
57 /**
58 * The ID allows the same data provider to support different
59 * data streams.
61 * A data provider may decide to ignore the ID string.
63 OUString maID;
65 double mnUpdateFrequency;
67 std::shared_ptr<DataProvider> mpDataProvider;
68 std::shared_ptr<ScDBDataManager> mpDBDataManager;
70 std::vector<std::shared_ptr<sc::DataTransformation>> maDataTransformations;
72 ScDocument* mpDoc;
74 public:
76 ExternalDataSource(const OUString& rURL,
77 const OUString& rProvider, ScDocument* pDoc);
79 ~ExternalDataSource();
81 void setUpdateFrequency(double nUpdateFrequency);
83 void setID(const OUString& rID);
84 void setURL(const OUString& rURL);
85 void setProvider(const OUString& rProvider);
87 const OUString& getURL() const;
88 const OUString& getProvider() const;
89 const OUString& getID() const;
90 double getUpdateFrequency() const;
91 OUString getDBName() const;
92 void setDBData(const ScDBData* pDBData);
93 ScDBDataManager* getDBManager();
95 void refresh(ScDocument* pDoc, bool bDeterministic = false);
97 void AddDataTransformation(std::shared_ptr<sc::DataTransformation> mpDataTransformation);
98 const std::vector<std::shared_ptr<sc::DataTransformation>>& getDataTransformation() const;
101 class SC_DLLPUBLIC ExternalDataMapper
103 //ScDocument* mpDoc;
104 std::vector<ExternalDataSource> maDataSources;
106 public:
107 ExternalDataMapper(ScDocument* pDoc);
109 ~ExternalDataMapper();
111 void insertDataSource(const ExternalDataSource& rSource);
113 const std::vector<ExternalDataSource>& getDataSources() const;
114 std::vector<ExternalDataSource>& getDataSources();
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */