[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 28 19:20:32 PDT 2012
sc/inc/filter.hxx | 4 +++-
sc/inc/orcusfilters.hxx | 3 +++
sc/source/filter/inc/orcusfiltersimpl.hxx | 2 ++
sc/source/filter/orcus/orcusfiltersimpl.cxx | 19 ++++++++++++++++---
sc/source/ui/inc/xmlsourcedlg.hxx | 1 +
sc/source/ui/xmlsource/xmlsourcedlg.cxx | 13 +++++++++++++
6 files changed, 38 insertions(+), 4 deletions(-)
New commits:
commit e26535de6ddc467d94eac1c4010e9e7ab55ae283
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Sep 28 22:19:46 2012 -0400
Call orcus filter accessor from the dialog when a new source file is set.
For now it doesn't do anything.
Change-Id: I8e41c7e15c3b99ab0ddec8e68242176c97f368fc
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 2359927..7eef93d 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -32,6 +32,8 @@
#include <tools/string.hxx>
#include <rtl/textenc.h>
+#include "scdllapi.h"
+
class SfxMedium;
class SvStream;
@@ -133,7 +135,7 @@ extern "C" {
class ScFormatFilter {
public:
- static ScFormatFilterPlugin &Get();
+ SC_DLLPUBLIC static ScFormatFilterPlugin &Get();
};
#endif
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index b7e3198..2379c67 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -13,6 +13,7 @@
#include "rtl/ustring.hxx"
class ScDocument;
+class SvTreeListBox;
/**
* Collection of orcus filter wrappers.
@@ -23,6 +24,8 @@ public:
virtual ~ScOrcusFilters() {}
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
+
+ virtual bool loadXMLStructure(const rtl::OUString& rPath, SvTreeListBox& rTree) const = 0;
};
#endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index e349120..f51f00f 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -16,6 +16,8 @@ class ScOrcusFiltersImpl : public ScOrcusFilters
{
public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
+
+ virtual bool loadXMLStructure(const rtl::OUString& rPath, SvTreeListBox& rTree) const;
};
#endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 3c8c211..7152b68 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -7,11 +7,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include "orcusfiltersimpl.hxx"
+
#include "document.hxx"
#include "tools/urlobj.hxx"
-
-#include "orcusfiltersimpl.hxx"
+#include "svtools/svtreebx.hxx"
#define __ORCUS_STATIC_LIB
#include <orcus/spreadsheet/import_interface.hpp>
@@ -143,7 +144,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
{
ScOrcusFactory aFactory(rDoc);
INetURLObject aURL(rPath);
- const char* path = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8).getStr();
+ OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
+ const char* path = aSysPath.getStr();
try
{
@@ -159,4 +161,15 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
return true;
}
+bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& /*rTree*/) const
+{
+ INetURLObject aURL(rPath);
+ OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
+ const char* path = aSysPath.getStr();
+ fprintf(stdout, "ScOrcusFiltersImpl::loadXMLStructure: path = '%s'\n", path);
+
+ // TODO: Load the tree box.
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 5a54c70..44dd44e 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -50,6 +50,7 @@ public:
private:
void SelectSourceFile();
+ void LoadSourceFileStructure(const OUString& rPath);
DECL_LINK(BtnPressedHdl, Button*);
};
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index e44f5c0..e94d132 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -12,6 +12,8 @@
#include "scresid.hxx"
#include "document.hxx"
+#include "orcusfilters.hxx"
+#include "filter.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
@@ -81,6 +83,17 @@ void ScXMLSourceDlg::SelectSourceFile()
// There should only be one file returned from the file picker.
maFtSourceFile.SetText(aFiles[0]);
+
+ LoadSourceFileStructure(aFiles[0]);
+}
+
+void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
+{
+ ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
+ if (!pOrcus)
+ return;
+
+ pOrcus->loadXMLStructure(rPath, maLbTree);
}
IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn)
More information about the Libreoffice-commits
mailing list