summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaskaran Singh <jvsg1303@gmail.com>2016-10-16 19:14:36 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-11-17 02:03:04 +0000
commit08e108996ba8c13aa3d9f07f65b98bd1f01f3459 (patch)
treeaf2049bc28b1ae6f6ea57b4263210b8c80f6a76b
parent703d00e335bf0d38b3019ec2ba095b27a5fdba2d (diff)
Add Skeleton for DataProvider Classfeature/dataprovider
DataProvider class serves as an abstraction of various External Data Importing Techniques we have and the others which could be implemented in the future. Change-Id: I9fc9455f7fbf9025aace4c3248df9b32f522ce52 Reviewed-on: https://gerrit.libreoffice.org/30606 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jaskaran singh <jvsg1303@gmail.com>
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/source/ui/docshell/dataprovider.cxx11
-rw-r--r--sc/source/ui/inc/dataprovider.hxx80
3 files changed, 92 insertions, 0 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 0e2190361554..3714c966a62e 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -427,6 +427,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/docshell/docsh8 \
sc/source/ui/docshell/documentlinkmgr \
sc/source/ui/docshell/editable \
+ sc/source/ui/docshell/dataprovider \
sc/source/ui/docshell/externalrefmgr \
sc/source/ui/docshell/impex \
sc/source/ui/docshell/macromgr \
diff --git a/sc/source/ui/docshell/dataprovider.cxx b/sc/source/ui/docshell/dataprovider.cxx
new file mode 100644
index 000000000000..37b6d53dd18e
--- /dev/null
+++ b/sc/source/ui/docshell/dataprovider.cxx
@@ -0,0 +1,11 @@
+/* -*- 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/.
+ */
+#include <dataprovider.hxx>
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx
new file mode 100644
index 000000000000..162ecbeb5411
--- /dev/null
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -0,0 +1,80 @@
+/* -*- 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_SOURCE_UI_INC_DATAPROVIDER_HXX
+#define INCLUDED_SC_SOURCE_UI_INC_DATAPROVIDER_HXX
+
+#include <salhelper/thread.hxx>
+#include <tools/stream.hxx>
+#include <rtl/ustring.hxx>
+#include <address.hxx>
+
+namespace sc {
+
+class CSVFetchThread : public salhelper::Thread
+{
+ SvStream *mpStream;
+ bool mbTerminate;
+
+ virtual void execute() override;
+
+public:
+ CSVFetchThread();
+ virtual ~CSVFetchThread() override;
+
+ void RequestTerminate();
+ void IsRequestedTerminate();
+ void Terminate();
+ void EndThread();
+};
+
+class DataProvider
+{
+ virtual ~DataProvider() = 0;
+
+ virtual void StartImport() = 0;
+ virtual void StopImport() = 0;
+ virtual void Refresh() = 0;
+ virtual void SetUrl(OUString) = 0;
+ virtual void SetRefreshRate(double) = 0;
+
+ virtual ScRange GetRange() const = 0;
+ virtual const OUString& GetURL() const = 0;
+
+protected:
+ virtual void DecodeURL() = 0;
+};
+
+class CSVDataProvider : public DataProvider
+{
+ OUString maURL;
+ double mnRefreshRate;
+
+ bool mbImportUnderway;
+
+public:
+ CSVDataProvider (OUString& rUrl);
+ virtual ~CSVDataProvider() override;
+
+ virtual void StartImport() override;
+ virtual void StopImport() override;
+ virtual void Refresh() override;
+ virtual void SetUrl(OUString) override;
+ virtual void SetRefreshRate(double mnRefreshRate) override;
+
+ ScRange GetRange() const override;
+ const OUString& GetURL() const override { return maURL; }
+
+private:
+ virtual void DecodeURL() override;
+};
+
+}
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */