summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-30 19:59:50 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-31 04:30:23 +0200
commitce1b56ae4ad35fbb5e2f5cc6f4b7ce4839f4e285 (patch)
tree2ec14ff8cb6eb81ac9fbfa8f3f19e986e65fe8ac /sc/inc
parent20ecb4b7b807b63d25195c44c02cb5bf0624ab7a (diff)
add initial file format representation for data import feature
Change-Id: I51143ecfe4eb1584f13bd1590f927743de8fa91e Reviewed-on: https://gerrit.libreoffice.org/40572 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/datamapper.hxx106
-rw-r--r--sc/inc/document.hxx3
2 files changed, 109 insertions, 0 deletions
diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx
new file mode 100644
index 000000000000..28476df8d8dd
--- /dev/null
+++ b/sc/inc/datamapper.hxx
@@ -0,0 +1,106 @@
+/* -*- 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 <memory>
+
+#include <rtl/ustring.hxx>
+
+class ScDocument;
+class ScDBData;
+
+namespace sc {
+
+class ScDBDataManager;
+class DataProvider;
+class ScDBDataManager;
+
+class 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;
+
+ double mnUpdateFrequency;
+
+ std::shared_ptr<DataProvider> mpDataProvider;
+ std::shared_ptr<ScDBDataManager> mpDBDataManager;
+
+public:
+
+ ExternalDataSource(const OUString& rURL,
+ const OUString& rProvider);
+
+ void setUpdateFrequency(double nUpdateFrequency);
+
+ void setID(const OUString& rID);
+
+ const OUString& getURL() const;
+ const OUString& getProvider() const;
+ const OUString& getID() const;
+ double getUpdateFrequency() const;
+ OUString getDBName() const;
+ void setDBData(ScDBData* pDBData);
+
+ void refresh(ScDocument* pDoc);
+};
+
+class SC_DLLPUBLIC ExternalDataMapper
+{
+ //ScDocument* mpDoc;
+ std::vector<ExternalDataSource> maDataSources;
+
+public:
+ ExternalDataMapper(ScDocument* pDoc);
+
+ ~ExternalDataMapper();
+
+ void insertDataSource(const ExternalDataSource& rSource);
+
+ const std::vector<ExternalDataSource>& getDataSources() const;
+ std::vector<ExternalDataSource>& getDataSources();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bf5934381e92..2cc5f02ed70e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -86,6 +86,7 @@ class ColumnSet;
class UpdatedRangeNames;
class TableColumnBlockPositionSet;
class ColumnIterator;
+class ExternalDataMapper;
}
@@ -350,6 +351,7 @@ private:
ScRefreshTimerControl* pRefreshTimerControl;
std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenCharacters;
ScDBData* mpAnonymousDBData;
+ std::unique_ptr<sc::ExternalDataMapper> mpDataMapper;
ScFieldEditEngine* pCacheFieldEditEngine;
@@ -708,6 +710,7 @@ public:
const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
void RefreshDirtyTableColumnNames();
+ sc::ExternalDataMapper& GetExternalDataMapper();
SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName ) const;