summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-02-07 18:16:49 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-02-08 18:09:59 +0100
commit153c4c7e6ab066c6b1c06704e08e5be815cfc024 (patch)
tree304348361602f3725a34b77807a32dc0736ac37f /sc/source
parent52292c374c3a6a5b4d9c6ced616b0ddd505a5298 (diff)
tdf#128873 speed up switching into page layout
Change-Id: I993fdafe226680ac718f4611cfb1f842bc99f385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88231 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sc/source')
-rwxr-xr-x[-rw-r--r--]sc/source/core/data/table1.cxx21
-rw-r--r--sc/source/ui/view/printfun.cxx6
2 files changed, 20 insertions, 7 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7b6f1f771eb8..0b25f838d676 100644..100755
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2039,11 +2039,24 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY)
{
- ScRefCellValue aCell = aCol[rCol].GetCellValue(nRow);
+ // tdf#128873 we do not need to calculate text width (heavy operation)
+ // when we for sure know that an additional column will not be added
+ if (GetAllocatedColumnsCount() > rCol + 1)
+ {
+ ScRefCellValue aNextCell = aCol[rCol + 1].GetCellValue(nRow);
+ if (!aNextCell.isEmpty())
+ {
+ // return rCol as is
+ return;
+ }
+ }
+
+ ScColumn& rColumn = aCol[rCol];
+ ScRefCellValue aCell = rColumn.GetCellValue(nRow);
if (!aCell.hasString())
return;
- long nPixel = aCol[rCol].GetTextWidth(nRow);
+ long nPixel = rColumn.GetTextWidth(nRow);
// Width already calculated in Idle-Handler ?
if ( TEXTWIDTH_DIRTY == nPixel )
@@ -2054,10 +2067,10 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
aOptions.bSkipMerged = false;
Fraction aZoom(1,1);
- nPixel = aCol[rCol].GetNeededSize(
+ nPixel = rColumn.GetNeededSize(
nRow, pDev, nPPTX, nPPTY, aZoom, aZoom, true, aOptions, nullptr );
- aCol[rCol].SetTextWidth(nRow, static_cast<sal_uInt16>(nPixel));
+ rColumn.SetTextWidth(nRow, static_cast<sal_uInt16>(nPixel));
}
long nTwips = static_cast<long>(nPixel / nPPTX);
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index dc1930baff27..799f5fa3ae0c 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -421,13 +421,13 @@ static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 )
RowInfo* pThisRowInfo = &rTabInfo.mpRowInfo[nArrY];
for (SCCOL nX=nX1; nX<=nX2; nX++)
{
- const CellInfo& rCellInfo = pThisRowInfo->pCellInfo[nX+1];
+ CellInfo& rCellInfo = pThisRowInfo->pCellInfo[nX+1];
if (!rCellInfo.bEmptyCellText)
if (rCellInfo.pPatternAttr->
GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet).GetHidePrint())
{
- pThisRowInfo->pCellInfo[nX+1].maCell.clear();
- pThisRowInfo->pCellInfo[nX+1].bEmptyCellText = true;
+ rCellInfo.maCell.clear();
+ rCellInfo.bEmptyCellText = true;
}
}
}