sc/source/core/data/docpool.cxx | 2 +- sc/source/core/data/document.cxx | 31 ------------------------------- sc/source/core/data/fillinfo.cxx | 12 +----------- 3 files changed, 2 insertions(+), 43 deletions(-)
New commits: commit 2cffccbf61a67cfdece6767856d2fceb2e04cf64 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jun 20 14:01:11 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 2 12:02:56 2025 +0200 cool: reduce time spent in FillInfo when rendering large sheets, we spend a lot of time traversing the surrogates because, for complex documents, we end up with a lot of surrogates that are unrelated to the one we are actually interested in. This was probably done as a performance optimisation, and is probably a good idea for very specific documents ie. ones that ONLY have a single kind of surrogates. It makes much less sense for more general documents. Also, we are trying to get away from surrogates, so drop ATTR_ROTATE_VALUE as a surrogate, and rely on scanning the ScAttrArray. This reduces the time spent scanning surrogates in favour of scanning ScAttrArray, which improves performance for more complex documents. Change-Id: I8a1cb634185065ba4d6b9b7682fcd9e2a33fe965 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186765 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 7a1000ca3cce..4d69a6ffa2d7 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -127,7 +127,7 @@ static ItemInfoPackage& getItemInfoPackageScDocument() { ATTR_VER_JUSTIFY, new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY), SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, { ATTR_VER_JUSTIFY_METHOD, new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD), SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, { ATTR_STACKED, new ScVerticalStackCell(false), SID_ATTR_ALIGN_STACKED, SFX_ITEMINFOFLAG_NONE }, - { ATTR_ROTATE_VALUE, new ScRotateValueItem( 0_deg100 ), SID_ATTR_ALIGN_DEGREES, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_ROTATE_VALUE, new ScRotateValueItem( 0_deg100 ), SID_ATTR_ALIGN_DEGREES, SFX_ITEMINFOFLAG_NONE }, { ATTR_ROTATE_MODE, new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE ), SID_ATTR_ALIGN_LOCKPOS, SFX_ITEMINFOFLAG_NONE }, { ATTR_VERTICAL_ASIAN, new SfxBoolItem( ATTR_VERTICAL_ASIAN ), SID_ATTR_ALIGN_ASIANVERTICAL, SFX_ITEMINFOFLAG_NONE }, diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 650d7e23b3d6..aadda2997080 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5180,38 +5180,9 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark, rLineInner.SetValid( SvxBoxInfoItemValidFlags::VERT, ( aFlags.nVert != SC_LINE_DONTCARE ) ); } -static HasAttrFlags OptimizeHasAttrib( HasAttrFlags nMask, const ScDocumentPool* pPool ) -{ - if ( nMask & HasAttrFlags::Rotate ) - { - // Is attribute used in document? - // (as in fillinfo) - - bool bAnyItem = false; - ItemSurrogates aSurrogates; - pPool->GetItemSurrogates(aSurrogates, ATTR_ROTATE_VALUE); - for (const SfxPoolItem* pItem : aSurrogates) - { - // 90 or 270 degrees is former SvxOrientationItem - only look for other values - // (see ScPatternAttr::GetCellOrientation) - Degree100 nAngle = static_cast<const ScRotateValueItem*>(pItem)->GetValue(); - if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 ) - { - bAnyItem = true; - break; - } - } - if (!bAnyItem) - nMask &= ~HasAttrFlags::Rotate; - } - return nMask; -} - bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask ) const { - nMask = OptimizeHasAttrib( nMask, mxPoolHelper->GetDocPool()); - if (nMask == HasAttrFlags::NONE) return false; @@ -5237,8 +5208,6 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, bool ScDocument::HasAttrib( SCCOL nCol, SCROW nRow, SCTAB nTab, HasAttrFlags nMask, SCROW* nStartRow, SCROW* nEndRow ) const { - nMask = OptimizeHasAttrib( nMask, mxPoolHelper->GetDocPool()); - if (nMask == HasAttrFlags::NONE || nTab >= GetTableCount()) { if( nStartRow ) diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index d3739b2878ef..ef5e3444001d 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -184,13 +184,6 @@ public: } }; -bool isRotateItemUsed(const ScDocumentPool *pPool) -{ - ItemSurrogates aSurrogates; - pPool->GetItemSurrogates(aSurrogates, ATTR_ROTATE_VALUE); - return aSurrogates.size() > 0; -} - void initRowInfo(const ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow, double fRowScale, SCROW nRow1, SCTAB nTab, SCROW& rYExtra, SCSIZE& rArrRow, SCROW& rRow2) { @@ -388,11 +381,8 @@ void ScDocument::FillInfo( // Rotated text... - // Is Attribute really used in document? - bool bAnyItem = isRotateItemUsed(pPool); - SCCOL nRotMax = nCol2; - if ( bAnyItem && HasAttrib( 0, nRow1, nTab, MaxCol(), nRow2+1, nTab, + if ( HasAttrib( 0, nRow1, nTab, MaxCol(), nRow2+1, nTab, HasAttrFlags::Rotate | HasAttrFlags::Conditional ) ) { //TODO: check Conditionals also for HasAttrFlags::Rotate ????