diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-08 19:51:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-08 21:38:46 +0100 |
commit | 6a3b20b14d32922c99df4ad65271499d0a8d663e (patch) | |
tree | 37e360f96e2f2a2912de08bbeaf68a6f1d1d4991 | |
parent | 8e5a5b7af90ebe4ad35b89ec30f4f19191d9b1ec (diff) |
tdf#158773 do the cheap checks first
the HasText() call inside TextProperties::Notify is surprisingly
expensive, so only do it when we know we are interested.
Shaves 25% off the load time here
Change-Id: Iab257add7fd56bf405678944ca8a3482c8f7b142
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164596
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/sdr/properties/textproperties.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 220d6a528ef1..90c68df3fa2a 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -550,15 +550,15 @@ namespace sdr::properties // call parent AttributeProperties::Notify(rBC, rHint); - SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); - if(!rObj.HasText()) - return; - SfxHintId nId(rHint.GetId()); - const svx::ITextProvider& rTextProvider(getTextProvider()); if(SfxHintId::DataChanged == nId && rBC.IsSfxStyleSheet()) { + SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); + if(!rObj.HasText()) + return; + + const svx::ITextProvider& rTextProvider(getTextProvider()); sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) { @@ -580,6 +580,11 @@ namespace sdr::properties } else if(SfxHintId::Dying == nId && rBC.IsSfxStyleSheet()) { + SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); + if(!rObj.HasText()) + return; + + const svx::ITextProvider& rTextProvider(getTextProvider()); sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) { @@ -598,6 +603,7 @@ namespace sdr::properties if(aOldName != aNewName) { + const svx::ITextProvider& rTextProvider(getTextProvider()); sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) { |