diff options
Diffstat (limited to 'sc')
-rwxr-xr-x[-rw-r--r--] | sc/source/core/data/table1.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/view/printfun.cxx | 6 |
2 files changed, 20 insertions, 7 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 7a2e740bb721..fea4dbcc66c3 100644..100755 --- 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; } } } |