sc/source/core/data/table1.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 1bc4835bd00d12bee93671a01423f4646f4622f0 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Nov 19 14:00:59 2024 -0500 Commit: Justin Luth <justin.l...@collabora.com> CommitDate: Thu Nov 21 02:37:15 2024 +0100 tdf#163872 ScTable::SetOptimalHeight: optimize if all rows ManualSize SetOptimalHeightsToRows does nothing if all the rows are manualsize. GetOptimalHeightsInColumn can be extremely expensive to run, so exit early if all the processing will have been for nothing. This doesn't solve bug 163872, but it does help with some of the sheets. Change-Id: I425bbd4f181058aa637c92f2abccf7c27dcf607d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176808 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index d6f910d9867d..b61701ecb2db 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -475,6 +475,24 @@ bool ScTable::SetOptimalHeight( return false; } + if (!rCxt.isForceAutoSize()) + { + // Optimize - exit early if all rows have defined height - super expensive GetOptimalHeight + bool bAllRowsAreManualHeight = true; + for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow) + { + size_t nDummy; + CRFlags nRowFlags = pRowFlags->GetValue(nRow, nDummy, nRow); // NOTE: nRow might change + if (!(nRowFlags & CRFlags::ManualSize)) + { + bAllRowsAreManualHeight = false; + break; + } + } + if (bAllRowsAreManualHeight) + return false; + } + SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1); ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, &rDocument);