sc/source/core/data/column2.cxx | 4 ++++ sc/source/ui/view/output2.cxx | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
New commits: commit 18c2358d3b0658b20daa045a8950cb2bfb15bd7b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Oct 22 21:25:15 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Oct 24 12:54:10 2023 +0200 cool#7332 calc perf: GetEmptyLinesInBlock reuse existing method to find area of sheet which contains data - this method already caches the necessary data. Also add a shortcut for the common case in ScColumn::IsEmptyData to avoid performing more expensive lookup operation. Change-Id: I24c7466d804ffc53cb2568923717f60ff4bc5186 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158276 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index e01a3458f6fc..3abb568befbc 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1318,6 +1318,10 @@ bool ScColumn::HasVisibleDataAt(SCROW nRow) const bool ScColumn::IsEmptyData(SCROW nStartRow, SCROW nEndRow) const { + // simple case + if (maCells.block_size() == 1 && maCells.begin()->type == sc::element_type_empty) + return true; + std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nStartRow); sc::CellStoreType::const_iterator it = aPos.first; if (it == maCells.end()) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 3887f19b3d5c..9b325a5dbe82 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1517,8 +1517,11 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co SCCOL nLastContentCol = mpDoc->MaxCol(); if ( nX2 < mpDoc->MaxCol() ) - nLastContentCol = sal::static_int_cast<SCCOL>( - nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) ); + { + SCROW nEndRow; + mpDoc->GetCellArea(nTab, nLastContentCol, nEndRow); + } + SCCOL nLoopStartX = nX1; if ( nX1 > 0 ) --nLoopStartX; // start before nX1 for rest of long text to the left @@ -4319,11 +4322,12 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) } tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; - //! store nLastContentCol as member! SCCOL nLastContentCol = mpDoc->MaxCol(); if ( nX2 < mpDoc->MaxCol() ) - nLastContentCol = sal::static_int_cast<SCCOL>( - nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) ); + { + SCROW nEndRow; + mpDoc->GetCellArea(nTab, nLastContentCol, nEndRow); + } tools::Long nRowPosY = nScrY; for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 of the rest of the merged