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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 3 06:51:33 PDT 2012


 sc/source/filter/orcus/orcusfiltersimpl.cxx |   32 ++++++++++++++--------------
 1 file changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 5ccf7847b43018e4afdbac1c94dffe22ab1dabc5
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Oct 3 09:51:52 2012 -0400

    A little cleanup.
    
    Change-Id: I04ac6b95fec116f13507f8f012320d522120fef3

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 0afaee4..b07647b 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -173,12 +173,14 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
     return true;
 }
 
-void populateTree(SvTreeListBox& rTree, orcus::xml_structure_tree::walker& rWalker, const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
+void populateTree(
+   SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
+   const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
 {
     OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
-    SvLBoxEntry* pEntry = rTree.InsertEntry(aName, pParent);
+    SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
     if (pParent)
-        rTree.Expand(pParent);
+        rTreeCtrl.Expand(pParent);
 
     orcus::xml_structure_tree::element_names_type aChildElements;
     rWalker.get_children(aChildElements);
@@ -188,12 +190,12 @@ void populateTree(SvTreeListBox& rTree, orcus::xml_structure_tree::walker& rWalk
     for (; it != itEnd; ++it)
     {
         rWalker.descend(*it);
-        populateTree(rTree, rWalker, *it, pEntry);
+        populateTree(rTreeCtrl, rWalker, *it, pEntry);
         rWalker.ascend();
     }
 }
 
-bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTree) const
+bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTreeCtrl) const
 {
     INetURLObject aURL(rPath);
     OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
@@ -207,10 +209,18 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
         return false;
 
     orcus::xmlns_repository aNsRepo; // xml namespace repository.
-    orcus::xml_structure_tree aTree(aNsRepo);
+    orcus::xml_structure_tree aXmlTree(aNsRepo);
     try
     {
-        aTree.parse(&aStrm[0], aStrm.size());
+        aXmlTree.parse(&aStrm[0], aStrm.size());
+
+        rTreeCtrl.Clear();
+
+        orcus::xml_structure_tree::walker aWalker = aXmlTree.get_walker();
+
+        // Root element.
+        orcus::xml_structure_tree::element aElem = aWalker.root();
+        populateTree(rTreeCtrl, aWalker, aElem.name, NULL);
     }
     catch (const std::exception&)
     {
@@ -218,14 +228,6 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
         return false;
     }
 
-    rTree.Clear();
-
-    orcus::xml_structure_tree::walker aWalker = aTree.get_walker();
-
-    // Root element.
-    orcus::xml_structure_tree::element aElem = aWalker.root();
-    populateTree(rTree, aWalker, aElem.name, NULL);
-
     return true;
 }
 


More information about the Libreoffice-commits mailing list