diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-24 11:41:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-25 08:28:49 +0200 |
commit | c47d0174f2c6c3ebcb3b33276d0277e7aceac330 (patch) | |
tree | 8b616687715719ea44b64b3638f68ea024802b90 | |
parent | 52800731baf9fcb88e54d60de5585640c8f97f7b (diff) |
tdf#94677 Calc is slow opening large CSV, avoid reset SetUpdateMode
Avoid resetting SetUpdateMode in CreateFieldEditEngine while calculating
row height.
This takes the time from 1m25 to 49s for me.
Change-Id: If406eac1a8b031f1734d9c2376c413dfa22d89f8
Reviewed-on: https://gerrit.libreoffice.org/74630
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleText.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 2 |
5 files changed, 7 insertions, 10 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index bebbd4fafb9a..f47177c2bd5e 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -634,7 +634,7 @@ public: void Clear( bool bFromDestructor = false ); - std::unique_ptr<ScFieldEditEngine> CreateFieldEditEngine(); + std::unique_ptr<ScFieldEditEngine> CreateFieldEditEngine(bool bUpdateMode); void DisposeFieldEditEngine(std::unique_ptr<ScFieldEditEngine>& rpEditEngine); /** diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 0a54f877c0b1..b4dfbfac64aa 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -363,9 +363,8 @@ long ScColumn::GetNeededSize( MapMode aHMMMode( MapUnit::Map100thMM, Point(), rZoomX, rZoomY ); // save in document ? - std::unique_ptr<ScFieldEditEngine> pEngine = pDocument->CreateFieldEditEngine(); + std::unique_ptr<ScFieldEditEngine> pEngine = pDocument->CreateFieldEditEngine(/*bUpdateMode*/false); - pEngine->SetUpdateMode( false ); bool bTextWysiwyg = ( pDev->GetOutDevType() == OUTDEV_PRINTER ); EEControlBits nCtrl = pEngine->GetControlWord(); if ( bTextWysiwyg ) @@ -456,7 +455,6 @@ long ScColumn::GetNeededSize( bool bEngineVertical = pEngine->IsVertical(); pEngine->SetVertical( bAsianVertical ); - pEngine->SetUpdateMode( true ); bool bEdWidth = bWidth; if ( eOrient != SvxCellOrientation::Standard && eOrient != SvxCellOrientation::Stacked ) diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index b87d73a8da56..15d95a9f77b3 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1091,7 +1091,7 @@ void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) *pChangeViewSettings=rNew; } -std::unique_ptr<ScFieldEditEngine> ScDocument::CreateFieldEditEngine() +std::unique_ptr<ScFieldEditEngine> ScDocument::CreateFieldEditEngine(bool bUpdateMode) { std::unique_ptr<ScFieldEditEngine> pNewEditEngine; if (!pCacheFieldEditEngine) @@ -1105,8 +1105,7 @@ std::unique_ptr<ScFieldEditEngine> ScDocument::CreateFieldEditEngine() { // #i66209# previous use might not have restored update mode, // ensure same state as for a new EditEngine (UpdateMode = true) - if ( !pCacheFieldEditEngine->GetUpdateMode() ) - pCacheFieldEditEngine->SetUpdateMode(true); + pCacheFieldEditEngine->SetUpdateMode(bUpdateMode); } pNewEditEngine = std::move(pCacheFieldEditEngine); diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index acacc91ba421..c32edc078c31 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1011,7 +1011,7 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder() if ( pDocShell ) { ScDocument& rDoc = pDocShell->GetDocument(); - pEditEngine = rDoc.CreateFieldEditEngine(); + pEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true); } else { @@ -1228,7 +1228,7 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder() if ( mpDocSh ) { ScDocument& rDoc = mpDocSh->GetDocument(); - mpEditEngine = rDoc.CreateFieldEditEngine(); + mpEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true); } else { diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 252a0bfee513..86d304906672 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -812,7 +812,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() if ( pDocShell ) { ScDocument& rDoc = pDocShell->GetDocument(); - pEditEngine = rDoc.CreateFieldEditEngine(); + pEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true); } else { |