[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 19 14:15:49 PST 2012


 sc/inc/orcusfilters.hxx                   |    4 ++--
 sc/source/filter/inc/orcusfiltersimpl.hxx |    9 +++++++--
 sc/source/filter/orcus/xmlcontext.cxx     |    7 +++----
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 552e40269b8a8c6b3621303f0aa9a71cf44583e3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Nov 19 17:14:43 2012 -0500

    Store the xml namespace repository with the context.
    
    We need persistent xml namespaces between loading the structure and
    importing the content.
    
    Change-Id: I4b56a7e952ab89b93ea2590c8f0d6b5cb141f039

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index ee8d3f8..bcf8881 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -46,9 +46,9 @@ class ScOrcusXMLContext
 public:
     virtual ~ScOrcusXMLContext() {}
 
-    virtual bool loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const = 0;
+    virtual bool loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) = 0;
 
-    virtual bool importXML(const ScOrcusImportXMLParam& rParam) const = 0;
+    virtual bool importXML(const ScOrcusImportXMLParam& rParam) = 0;
 };
 
 #endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 0b6ffa6..673da91 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -12,6 +12,8 @@
 
 #include "orcusfilters.hxx"
 
+#include <orcus/xml_namespace.hpp>
+
 class ScOrcusFiltersImpl : public ScOrcusFilters
 {
 public:
@@ -26,13 +28,16 @@ class ScOrcusXMLContextImpl : public ScOrcusXMLContext
 {
     ScDocument& mrDoc;
     rtl::OUString maPath;
+
+    orcus::xmlns_repository maNsRepo; /// XML namespace repository for this context.
+
 public:
     ScOrcusXMLContextImpl(ScDocument& rDoc, const rtl::OUString& rPath);
     virtual ~ScOrcusXMLContextImpl();
 
-    virtual bool loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const;
+    virtual bool loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam);
 
-    virtual bool importXML(const ScOrcusImportXMLParam& rParam) const;
+    virtual bool importXML(const ScOrcusImportXMLParam& rParam);
 };
 
 #endif
diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
index d32a55c..9e0dbba 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -124,7 +124,7 @@ ScOrcusXMLContextImpl::ScOrcusXMLContextImpl(ScDocument& rDoc, const OUString& r
 
 ScOrcusXMLContextImpl::~ScOrcusXMLContextImpl() {}
 
-bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const
+bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam)
 {
     rParam.maUserDataStore.clear();
 
@@ -138,8 +138,7 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXM
     if (aStrm.empty())
         return false;
 
-    orcus::xmlns_repository repo; // xml namespace repository.
-    orcus::xmlns_context cxt = repo.create_context();
+    orcus::xmlns_context cxt = maNsRepo.create_context();
     orcus::xml_structure_tree aXmlTree(cxt);
     try
     {
@@ -165,7 +164,7 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXM
     return true;
 }
 
-bool ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam) const
+bool ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam)
 {
     ScOrcusFactory aFactory(mrDoc);
     OString aSysPath = ScOrcusFiltersImpl::toSystemPath(maPath);


More information about the Libreoffice-commits mailing list