tdf#133808 - Use cell counts in order to shrink entire columns/rows

Otherwise, entire ranges will never be shrunk leading to performance
issues.

Change-Id: If0c1d482ccaffd9446f0321782e3c0963514135f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211472
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
This commit is contained in:
DrRobotto
2026-09-26 02:35:03 +02:00
committed by Andreas Heinisch
parent e43ac28d22
commit 3ca06ba114
+4 -1
View File
@@ -1381,7 +1381,10 @@ public:
ScSingleRefData& s = rData.Ref1;
ScSingleRefData& e = rData.Ref2;
if(abs((e.Col()-s.Col())*(e.Row()-s.Row())) < SHRINK_RANGE_THRESHOLD)
// tdf#133808 - use cell counts in order to shrink entire columns/rows
const sal_Int64 nCells = (static_cast<sal_Int64>(std::abs(e.Col() - s.Col())) + 1)
* (static_cast<sal_Int64>(std::abs(e.Row() - s.Row())) + 1);
if (nCells < SHRINK_RANGE_THRESHOLD)
return;
SCCOL nMinCol = mpDoc->MaxCol(), nMaxCol = 0;