diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-06 09:43:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-06 13:00:19 +0100 |
commit | 6f8073caf0d6b331232f6edb5f18d14ddefdb465 (patch) | |
tree | 3c3810eda264cfde3db552727b80e4567110e815 /sc/source | |
parent | 94113c523865c3162ffd9a5a76bebeb61d652399 (diff) |
tdf#158773 reduce cost of ContentInfo::GetText
The specific path that is showing up on the perf profile is
SdrTextObj::HasText -> EditTextObjectImpl::GetText ->
ContentInfo::GetText
Reduce the cost by 10% there by adding a method to check if we have text, and
avoid the cost of constructing an OUString from an svl::SharedString.
Also make use of the new method in places.
Change-Id: Ibc2e0f61c4a2a6c33eea7f2cce09d692d82fd2b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164449
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/Accessibility/AccessiblePageHeader.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 65facba4b739..8abe7dc68372 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -921,8 +921,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje // Excel has one alignment per NoteObject while Calc supports // one alignment per paragraph - use the first paragraph // alignment (if set) as our overall alignment. - OUString aParaText( rEditObj.GetText( 0 ) ); - if( !aParaText.isEmpty() ) + if( rEditObj.HasText( 0 ) ) { const SfxItemSet& aSet( rEditObj.GetParaAttribs( 0)); if( const SvxAdjustItem* pItem = aSet.GetItemIfSet( EE_PARA_JUST ) ) diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx index a79017276b36..1c82cfac7542 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx @@ -348,7 +348,7 @@ bool ScAccessiblePageHeader::IsDefunc( sal_Int64 nParentStates ) void ScAccessiblePageHeader::AddChild(const EditTextObject* pArea, sal_uInt32 nIndex, SvxAdjust eAdjust) { - if (pArea && (!pArea->GetText(0).isEmpty() || (pArea->GetParagraphCount() > 1))) + if (pArea && ((pArea->GetParagraphCount() > 1) || pArea->HasText(0))) { if (maAreas[nIndex].is()) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 21c2a9c3d44f..e4153cb0d826 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -921,7 +921,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, pDocSh->UpdateOle(GetViewData()); bool bIsEmpty = rData.GetParagraphCount() == 0 - || (rData.GetParagraphCount() == 1 && rData.GetText(0).isEmpty()); + || (rData.GetParagraphCount() == 1 && !rData.HasText(0)); const OUString aType(bIsEmpty ? u"delete-content" : u"cell-change"); HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow, aType); |