summaryrefslogtreecommitdiff
path: root/sc/source/core/data/fillinfo.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-26 12:08:50 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-02-26 22:22:53 +0100
commit17db94f1e8425d6ccd430eeda3ec17b4acd1a3d9 (patch)
tree3ba2102254c822cbea0fb0bbe8c7429fd6881852 /sc/source/core/data/fillinfo.cxx
parentf6a9910623cdeb30b7c0a8dc712153a11658e43d (diff)
do not repeatedly call ColHidden()
The function returns the last column that has the same return value, so reuse the return value until that column. Change-Id: I5d19478ee37068049d4ff035efcacdb5eb724e15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130606 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/core/data/fillinfo.cxx')
-rw-r--r--sc/source/core/data/fillinfo.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index db18514b7120..2dc6fbdb7ebe 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -413,6 +413,8 @@ void ScDocument::FillInfo(
if (pCondFormList)
pCondFormList->startRendering();
+ SCCOL nLastHiddenCheckedCol = -2;
+ bool bColHidden = false;
for (SCCOL nCol=-1; nCol<=nCol2+1; nCol++) // left & right + 1
{
if (ValidCol(nCol))
@@ -420,10 +422,13 @@ void ScDocument::FillInfo(
// #i58049#, #i57939# Hidden columns must be skipped here, or their attributes
// will disturb the output
+ if (nCol > nLastHiddenCheckedCol)
+ bColHidden = ColHidden(nCol, nTab, nullptr, &nLastHiddenCheckedCol);
// TODO: Optimize this loop.
- if (!ColHidden(nCol, nTab))
+ if (!bColHidden)
{
- sal_uInt16 nThisWidth = static_cast<sal_uInt16>(std::clamp(GetColWidth( nCol, nTab ) * fColScale, 1.0, double(std::numeric_limits<sal_uInt16>::max())));
+ sal_uInt16 nColWidth = GetColWidth( nCol, nTab, false ); // false=no need to check for hidden, checked above
+ sal_uInt16 nThisWidth = static_cast<sal_uInt16>(std::clamp(nColWidth * fColScale, 1.0, double(std::numeric_limits<sal_uInt16>::max())));
pRowInfo[0].cellInfo(nCol).nWidth = nThisWidth; //TODO: this should be enough