[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/source
Serge Krot (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 13 11:32:18 UTC 2020
sc/source/core/data/table1.cxx | 21 +++++++++++++++++----
sc/source/ui/view/printfun.cxx | 6 +++---
2 files changed, 20 insertions(+), 7 deletions(-)
New commits:
commit 66c3b56a2a635aa2ae3779e8575db83400c119c4
Author: Serge Krot <Serge.Krot at cib.de>
AuthorDate: Fri Feb 7 18:16:49 2020 +0100
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Feb 13 12:31:48 2020 +0100
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 at CIB.de>
(cherry picked from commit 153c4c7e6ab066c6b1c06704e08e5be815cfc024)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88302
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
old mode 100644
new mode 100755
index 7a2e740bb721..fea4dbcc66c3
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2038,11 +2038,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 )
@@ -2053,10 +2066,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 18be8420c7ee..8c6231544659 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;
}
}
}
More information about the Libreoffice-commits
mailing list