diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-02-26 12:08:50 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-23 09:09:05 +0100 |
commit | aa63f06739cef299be1df4641622a29b5f2faf46 (patch) | |
tree | f3cc63d99f1d0c8b1de0668c3c310b84ae038fb3 | |
parent | 8e8addc6708aca0488d7e61da3d5e0122ccca6a3 (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>
-rw-r--r-- | sc/source/core/data/fillinfo.cxx | 9 |
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 |