summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-28 13:17:50 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-04-08 16:54:28 +0200
commit02b100e8ecbe47bd8d70d81dbefcb24be0501b8b (patch)
treed60fb7b2594d681a07c15b402d2189f5c83d3771
parent8f53eb5dc5cc7f90a2b134c5b5ad66988bcc9842 (diff)
tdf#160399 speed up print preview
takes time from 11s to 5s for me Change-Id: Ic874b9168f9caaf697007e586df8499a849ccfd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165460 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 6931a596350086d52ba32bf8a84cb36fbfdb34d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165617 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/source/core/data/table1.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 93d023f96246..4df5d92ec5e5 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2091,17 +2091,19 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
else
{
// These columns are visible. Check for empty columns.
- for (SCCOL j = i; j <= nLastCol; ++j)
+ SCCOL nEmptyCount = 0;
+ SCCOL j = i;
+ for (; j <= nLastCol; ++j)
{
if ( j >= aCol.size() )
- {
- aSkipCols.setTrue( j, rDocument.MaxCol() );
break;
- }
- if (aCol[j].GetCellCount() == 0)
- // empty
- aSkipCols.setTrue(j,j);
+ if (aCol[j].GetCellCount() == 0) // empty
+ nEmptyCount++;
}
+ if (nEmptyCount)
+ aSkipCols.setTrue(i,i+nEmptyCount);
+ if ( j >= aCol.size() )
+ aSkipCols.setTrue( j, rDocument.MaxCol() );
}
i = nLastCol;
}