Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / inc / datamapper.hxx
blob984e6cc8121957dcab42fb17c83ed0573eb79122
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 #pragma once
12 #include <vector>
14 #include "scdllapi.h"
16 #include <rtl/ustring.hxx>
18 #include "orcusxml.hxx"
20 class ScDocument;
22 namespace sc
24 class ScDBDataManager;
25 class DataProvider;
26 class DataTransformation;
28 class SC_DLLPUBLIC ExternalDataSource
30 private:
31 /**
32 * The URL for the external data provider. The URL
33 * will be passed to the data provider together with
34 * the ID.
36 * A data provider may decide to ignore the URL string.
38 OUString maURL;
40 /**
41 * The data provider is a unique identifier that will
42 * allow to identify and instantiate the required data
43 * provider.
45 * Examples for the internal data providers are:
47 * org.libreoffice.dataprovider.calc.csv
48 * org.libreoffice.dataprovider.calc.json
50 * Only internal data providers should use the:
51 * "org.libreoffice.dataprovider prefix".
53 OUString maProvider;
55 /**
56 * The ID allows the same data provider to support different
57 * data streams.
59 * A data provider may decide to ignore the ID string.
61 OUString maID;
63 ScOrcusImportXMLParam maParam;
65 std::shared_ptr<DataProvider> mpDataProvider;
66 std::shared_ptr<ScDBDataManager> mpDBDataManager;
68 std::vector<std::shared_ptr<sc::DataTransformation>> maDataTransformations;
70 ScDocument* mpDoc;
72 public:
73 ExternalDataSource(OUString aURL, OUString aProvider, ScDocument* pDoc);
75 void setUpdateFrequency(double nUpdateFrequency);
77 void setID(const OUString& rID);
78 void setURL(const OUString& rURL);
79 void setProvider(const OUString& rProvider);
80 void setXMLImportParam(const ScOrcusImportXMLParam& rParam);
82 const OUString& getURL() const;
83 const OUString& getProvider() const;
84 const OUString& getID() const;
85 const ScOrcusImportXMLParam& getXMLImportParam() const;
86 static double getUpdateFrequency();
87 OUString getDBName() const;
88 void setDBData(const OUString& rDBName);
89 ScDBDataManager* getDBManager();
91 void refresh(ScDocument* pDoc, bool bDeterministic = false);
93 void AddDataTransformation(const std::shared_ptr<sc::DataTransformation>& mpDataTransformation);
94 const std::vector<std::shared_ptr<sc::DataTransformation>>& getDataTransformation() const;
97 class SC_DLLPUBLIC ExternalDataMapper
99 //ScDocument& mrDoc;
100 std::vector<ExternalDataSource> maDataSources;
102 public:
103 ExternalDataMapper(ScDocument& rDoc);
105 ~ExternalDataMapper();
107 void insertDataSource(const ExternalDataSource& rSource);
109 const std::vector<ExternalDataSource>& getDataSources() const;
110 std::vector<ExternalDataSource>& getDataSources();
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */