svx/source/sdr/properties/textproperties.cxx |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 6a3b20b14d32922c99df4ad65271499d0a8d663e
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Mar 8 19:51:30 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 8 21:38:46 2024 +0100

    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.gran...@collabora.co.uk>

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--)
                     {

Reply via email to