summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-12-19 15:07:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-12-20 07:16:04 +0100
commitf2f5d74067705b7c64f8fb510952d7cece417627 (patch)
tree4cffb2ddb76d67f8b07cbd344077b02ee8cf572a /sc/source
parent6142062844e6b342d97fd3d0c632a256b6cdfcaa (diff)
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@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/inc/worksheethelper.hxx4
-rw-r--r--sc/source/filter/oox/commentsbuffer.cxx7
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx5
3 files changed, 16 insertions, 0 deletions
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 )
{