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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 11 09:23:16 PDT 2012


 sc/source/filter/orcus/orcusfiltersimpl.cxx |   20 ++++++++++++++++++++
 sc/source/ui/xmlsource/xmlsourcedlg.cxx     |    2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 94346b67249d9c6920c48a37c12115d82f06ec69
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Oct 11 12:23:28 2012 -0400

    Disable update while populating the tree control.
    
    Change-Id: Ic0f5822072a817addc7d296eceadf59467e5ba0f

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 824eea9..31cd8ba 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -173,6 +173,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
     return true;
 }
 
+namespace {
+
 void populateTree(
    SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
    const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat,
@@ -214,6 +216,23 @@ void populateTree(
     }
 }
 
+class TreeUpdateSwitch
+{
+    SvTreeListBox& mrTreeCtrl;
+public:
+    TreeUpdateSwitch(SvTreeListBox& rTreeCtrl) : mrTreeCtrl(rTreeCtrl)
+    {
+        mrTreeCtrl.SetUpdateMode(false);
+    }
+
+    ~TreeUpdateSwitch()
+    {
+        mrTreeCtrl.SetUpdateMode(true);
+    }
+};
+
+}
+
 bool ScOrcusFiltersImpl::loadXMLStructure(
    SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
    const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const
@@ -235,6 +254,7 @@ bool ScOrcusFiltersImpl::loadXMLStructure(
     {
         aXmlTree.parse(&aStrm[0], aStrm.size());
 
+        TreeUpdateSwitch aSwitch(rTreeCtrl);
         rTreeCtrl.Clear();
         rTreeCtrl.SetDefaultCollapsedEntryBmp(rImgDefaultElem);
         rTreeCtrl.SetDefaultExpandedEntryBmp(rImgDefaultElem);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index cc255b8..5f244f2 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -151,8 +151,8 @@ void ScXMLSourceDlg::SelectSourceFile()
     if (!aFiles.getLength())
         return;
 
-    maSrcPath = aFiles[0];
     // There should only be one file returned from the file picker.
+    maSrcPath = aFiles[0];
     maFtSourceFile.SetText(maSrcPath);
 
     LoadSourceFileStructure(maSrcPath);


More information about the Libreoffice-commits mailing list