summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-08-31 11:11:00 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-09-07 09:10:36 -0400
commitc28f2fbddaa5c1042d1661125dc64a397e6a65fa (patch)
tree212529e72250890dadf9101452bba6b354fa6664 /sc
parentc8b7e9822257938e9b1d1c6f7d93d085b06d5e96 (diff)
Move the orcus handling code from sc to scfilt.
Then this will be subject to on-demand loading. Change-Id: Ibefcb77b4c8a97707f3ea177a81bd61bdc58fc31
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_sc.mk5
-rw-r--r--sc/Library_scfilt.mk5
-rw-r--r--sc/inc/filter.hxx3
-rw-r--r--sc/inc/orcusfilters.hxx (renamed from sc/inc/orcushandler.hxx)2
-rw-r--r--sc/source/filter/ftools/ftools.cxx8
-rw-r--r--sc/source/filter/inc/ftools.hxx9
-rw-r--r--sc/source/filter/inc/orcusfiltersimpl.hxx18
-rw-r--r--sc/source/filter/orcus/orcusfiltersimpl.cxx (renamed from sc/source/core/tool/orcushandler.cxx)5
-rw-r--r--sc/source/ui/docshell/docsh.cxx8
-rw-r--r--sc/source/ui/docshell/impex.cxx2
10 files changed, 50 insertions, 15 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index f83ba546a5b1..345c7b5a0303 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -90,10 +90,6 @@ $(eval $(call gb_Library_use_libraries,sc,\
$(gb_STDLIBS) \
))
-$(eval $(call gb_Library_use_externals,sc,\
- orcus \
-))
-
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/data/attarray \
sc/source/core/data/attrib \
@@ -214,7 +210,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/navicfg \
sc/source/core/tool/odffmap \
sc/source/core/tool/optutil \
- sc/source/core/tool/orcushandler \
sc/source/core/tool/parclass \
sc/source/core/tool/printopt \
sc/source/core/tool/prnsave \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 7efd7d141035..8816bc3db13a 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -63,6 +63,10 @@ $(eval $(call gb_Library_use_libraries,scfilt,\
$(gb_STDLIBS) \
))
+$(eval $(call gb_Library_use_externals,scfilt,\
+ orcus \
+))
+
$(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/dif/difexp \
sc/source/filter/dif/difimp \
@@ -214,6 +218,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/oox/worksheetfragment \
sc/source/filter/oox/worksheethelper \
sc/source/filter/oox/worksheetsettings \
+ sc/source/filter/orcus/orcusfiltersimpl \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index ac943f5faa79..2359927387ac 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -39,6 +39,7 @@ class ScAddress;
class ScDocument;
class ScRange;
class SvNumberFormatter;
+class ScOrcusFilters;
// return values im-/export filter (sal_uLong)
@@ -119,6 +120,8 @@ class ScFormatFilterPlugin {
const String& rStreamPath, String& rNonConvertibleChars ) = 0;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest ) = 0;
+ virtual ScOrcusFilters* GetOrcusFilters() = 0;
+
protected:
~ScFormatFilterPlugin() {}
};
diff --git a/sc/inc/orcushandler.hxx b/sc/inc/orcusfilters.hxx
index 8ed04a4fc591..5beede2d01e4 100644
--- a/sc/inc/orcushandler.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -39,7 +39,7 @@ class ScDocument;
class ScOrcusFilters
{
public:
- static bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath);
+ virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
};
#endif
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index bbfbe41a2881..352b3ab5a6e4 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -41,6 +41,7 @@
#include "stlpool.hxx"
#include "stlsheet.hxx"
#include "compiler.hxx"
+#include "orcusfiltersimpl.hxx"
#include <stdio.h>
@@ -358,10 +359,13 @@ bool ScfTools::GetHTMLNameFromName( const String& rSource, String& rName )
return rName.Len() > 0;
}
-// ============================================================================
+ScFormatFilterPluginImpl::ScFormatFilterPluginImpl() {}
+ScFormatFilterPluginImpl::~ScFormatFilterPluginImpl() {}
-ScFormatFilterPluginImpl::ScFormatFilterPluginImpl()
+ScOrcusFilters* ScFormatFilterPluginImpl::GetOrcusFilters()
{
+ static ScOrcusFiltersImpl aImpl;
+ return &aImpl;
}
SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * SAL_CALL ScFilterCreate(void)
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 1ffd57f39d36..323586f652cc 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -289,10 +289,11 @@ typedef ::std::vector< ::rtl::OUString > ScfStringVec;
// ----------------------------------------------------------------------------
-class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
- public:
+class ScFormatFilterPluginImpl : public ScFormatFilterPlugin
+{
+public:
ScFormatFilterPluginImpl();
- virtual ~ScFormatFilterPluginImpl() {}
+ virtual ~ScFormatFilterPluginImpl();
// various import filters
virtual FltError ScImportLotus123( SfxMedium&, ScDocument*, CharSet eSrc = RTL_TEXTENCODING_DONTKNOW );
virtual FltError ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc );
@@ -322,6 +323,8 @@ class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
const String& rStreamPath, String& rNonConvertibleChars );
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest );
+
+ virtual ScOrcusFilters* GetOrcusFilters();
};
// ============================================================================
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
new file mode 100644
index 000000000000..090c52f05c9e
--- /dev/null
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -0,0 +1,18 @@
+/* -*- 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 "orcusfilters.hxx"
+
+class ScOrcusFiltersImpl : public ScOrcusFilters
+{
+public:
+ virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/orcushandler.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 3599b27eb7c7..072374480004 100644
--- a/sc/source/core/tool/orcushandler.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -26,11 +26,12 @@
* instead of those above.
*/
-#include "orcushandler.hxx"
#include "document.hxx"
#include "tools/urlobj.hxx"
+#include "orcusfiltersimpl.hxx"
+
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/orcus_csv.hpp>
@@ -150,7 +151,7 @@ void ScOrcusSheet::set_value(row_t /*row*/, col_t /*col*/, double /*value*/)
} // anonymous namespace
-bool ScOrcusFilters::importCSV(ScDocument& rDoc, const OUString& rPath)
+bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) const
{
ScOrcusFactory aFactory(rDoc);
INetURLObject aURL(rPath);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 94e51030b299..26a470c91f98 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -112,7 +112,7 @@
#include "cellsuno.hxx"
#include "dpobject.hxx"
#include "markdata.hxx"
-#include "orcushandler.hxx"
+#include "orcusfilters.hxx"
#ifdef ENABLE_TELEPATHY
#include "sccollaboration.hxx"
@@ -1503,7 +1503,11 @@ bool ScDocShell::LoadExternal(SfxMedium& rMed, const OUString& rProvider)
{
if (rProvider == "orcus")
{
- if (!ScOrcusFilters::importCSV(aDocument, rMed.GetName()))
+ ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
+ if (!pOrcus)
+ return false;
+
+ if (!pOrcus->importCSV(aDocument, rMed.GetName()))
return false;
FinishedLoading(SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index d1104813dfc2..f2b36a474f9a 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2229,6 +2229,8 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
virtual FltError ScExportHTML( SvStream&, const String&, ScDocument*, const ScRange&, const CharSet, bool,
const String&, String& ) RETURN_ERROR
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange&, const CharSet ) RETURN_ERROR
+
+ virtual ScOrcusFilters* GetOrcusFilters() { return NULL; }
};
extern "C" { static void SAL_CALL thisModule() {} }