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>
This commit is contained in:
Luboš Luňák 2022-03-01 12:55:29 +01:00
parent ffe7850a14
commit a85b647f7b

View file

@ -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);