summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-01 12:55:29 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-03-01 18:02:11 +0100
commita85b647f7bb6cb869abf22ab9ecce419ad5083e0 (patch)
tree21b3b7cfdee393422113a929060c4edcc0cb68a2
parentffe7850a1449c43dd077c5cb073d8eee178f7099 (diff)
compress calls to AdjustRowHeight() to just one call (tdf#94677)
This function imports only text, so I think doing one big call at the end should be fine. Change-Id: I267f5857ac11cfb95245434333f2ca5fa7e662cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130789 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/source/ui/docshell/impex.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 5ff892fe19ca..c6760535ef30 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1530,7 +1530,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
SCCOL nStartCol = aRange.aStart.Col();
SCCOL nEndCol = aRange.aEnd.Col();
SCROW nStartRow = aRange.aStart.Row();
- SCTAB nTab = aRange.aStart.Tab();
+ const SCTAB nTab = aRange.aStart.Tab();
bool bFixed = pExtOptions->IsFixedLen();
OUString aSeps = pExtOptions->GetFieldSeps(); // Need non-const for ReadCsvLine(),
@@ -1593,6 +1593,9 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
sal_uInt64 nOriginalStreamPos = rStrm.Tell();
+ SCROW nFirstUpdateRowHeight = SCROW_MAX;
+ SCROW nLastUpdateRowHeight = -1;
+
ScDocumentImport aDocImport(rDoc);
do
{
@@ -1706,7 +1709,10 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
if (!bDetermineRange)
{
if (bMultiLine && !bRangeIsDetermined && pDocSh)
- pDocSh->AdjustRowHeight( nRow, nRow, nTab);
+ { // Adjust just once at the end for a whole range.
+ nFirstUpdateRowHeight = std::min( nFirstUpdateRowHeight, nRow );
+ nLastUpdateRowHeight = std::max( nLastUpdateRowHeight, nRow );
+ }
xProgress->SetStateOnPercent( rStrm.Tell() - nOldPos );
}
++nRow;
@@ -1743,10 +1749,15 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
bDetermineRange = !bDetermineRange; // toggle
} while (!bDetermineRange);
+
if ( !mbOverwriting )
aDocImport.finalize();
xProgress.reset(); // make room for AdjustRowHeight progress
+
+ if( nFirstUpdateRowHeight < nLastUpdateRowHeight && pDocSh )
+ pDocSh->AdjustRowHeight( nFirstUpdateRowHeight, nLastUpdateRowHeight, nTab);
+
if (bRangeIsDetermined)
EndPaste(false);