[Libreoffice-commits] core.git: sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 20 06:17:03 UTC 2019


 sc/source/filter/inc/worksheethelper.hxx |    4 ++++
 sc/source/filter/oox/commentsbuffer.cxx  |    7 +++++++
 sc/source/filter/oox/worksheethelper.cxx |    5 +++++
 3 files changed, 16 insertions(+)

New commits:
commit f2f5d74067705b7c64f8fb510952d7cece417627
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Dec 19 15:07:46 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 20 07:16:04 2019 +0100

    tdf#129228 speedup load xls file with lots of comments
    
    by locking the underlying SdrModel while the comments are added, so we
    avoid the reformatting that happends when the model is unlocked
    
    Takes the time from 3m30 to 1m for me.
    
    Change-Id: Ibc3d2b1ded548d5eee7715d9a655a0af61b0eb2b
    Reviewed-on: https://gerrit.libreoffice.org/85523
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 8f135e05ea9c..e3a2a955b22a 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -27,6 +27,7 @@
 #include "formulabase.hxx"
 
 struct ScDataBarFormatData;
+class ScDocument;
 
 namespace com { namespace sun { namespace star {
     namespace awt { struct Point; }
@@ -294,6 +295,9 @@ public:
     void setCellFormulaValue(
         const ScAddress& rAddress, const OUString& rValueStr, sal_Int32 nCellType );
 
+    ScDocument& getScDocument();
+
+
 private:
     WorksheetGlobals&   mrSheetGlob;
 };
diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx
index c3c60c3f5a6d..43b133aad4fe 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -34,6 +34,8 @@
 #include <addressconverter.hxx>
 #include <drawingfragment.hxx>
 #include <svx/sdtaitm.hxx>
+#include <document.hxx>
+#include <drwlayer.hxx>
 
 namespace oox {
 namespace xls {
@@ -221,7 +223,12 @@ CommentRef CommentsBuffer::createComment()
 
 void CommentsBuffer::finalizeImport()
 {
+    // keep the model locked to avoid repeated reformatting in the model
+    auto pModel = getScDocument().GetDrawLayer();
+    bool bWasLocked = pModel->isLocked();
+    pModel->setLock(true);
     maComments.forEachMem( &Comment::finalizeImport );
+    pModel->setLock(bWasLocked);
 }
 
 } // namespace xls
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 7542e545b40f..d390e9c33357 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1363,6 +1363,11 @@ WorksheetHelper::WorksheetHelper( WorksheetGlobals& rSheetGlob ) :
 {
 }
 
+ScDocument& WorksheetHelper::getScDocument()
+{
+    return getDocImport().getDoc();
+}
+
 /*static*/ WorksheetGlobalsRef WorksheetHelper::constructGlobals( const WorkbookHelper& rHelper,
         const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, SCTAB nSheet )
 {


More information about the Libreoffice-commits mailing list