summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-28 13:17:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-28 17:44:21 +0100
commit6931a596350086d52ba32bf8a84cb36fbfdb34d6 (patch)
treefc1fcbf0dc43e133943a387705cf0c7c613973e9 /sc/source
parent02b5bf515dfc29dc72075d355a07e6497a88b57c (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>
Diffstat (limited to 'sc/source')
-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 0a2fc33df217..1764d400e44a 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;
}