sc/source/ui/view/viewdata.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 545622887c55e935be2bb482b838a8fb84a84298 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Feb 7 21:23:30 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Tue Feb 8 12:28:17 2022 +0100 optimize ScViewData::GetScrPos() for many hidden rows/columns With huge sheets checking width of each column may be expensive, and hidden columns have width 0, so if the rest of the columns in a row are hidden, this would check them all. Skip hidden ones at once. Change-Id: I16308e53ce579837fc7e2384919f6cfe04e26c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129647 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0ee8ef57d91e..fa0ab9c868bc 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2451,6 +2451,12 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, tools::Long nSizeXPix = ToPixel( nTSize, nPPTX ); nScrPosX += nSizeXPix; } + else + { // If the width is zero, the column is possibly hidden, skips groups of such columns. + SCCOL lastHidden = -1; + if(mrDoc.ColHidden(nX, nForTab, nullptr, &lastHidden) && lastHidden > nX) + nX = lastHidden - 1; + } } } } @@ -2465,6 +2471,12 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, tools::Long nSizeXPix = ToPixel( nTSize, nPPTX ); nScrPosX -= nSizeXPix; } + else + { // If the width is zero, the column is possibly hidden, skips groups of such columns. + SCCOL firstHidden = -1; + if(mrDoc.ColHidden(nX, nForTab, &firstHidden, nullptr) && firstHidden >= 0) + nX = firstHidden; + } } } @@ -2515,6 +2527,12 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, tools::Long nSizeYPix = ToPixel( nTSize, nPPTY ); nScrPosY -= nSizeYPix; } + else + { // If the height is zero, the row is possibly hidden, skips groups of such rows. + SCROW firstHidden = -1; + if(mrDoc.RowHidden(nY, nForTab, &firstHidden, nullptr) && firstHidden >= 0) + nY = firstHidden; + } } } }