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

New commits:
commit ee58156c54aa1f4a6bdff655410182076d470115
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Mar 8 19:51:30 2024 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Oct 14 15:07:55 2024 +0200

    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>
    (cherry picked from commit 6a3b20b14d32922c99df4ad65271499d0a8d663e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174887
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/svx/source/sdr/properties/textproperties.cxx 
b/svx/source/sdr/properties/textproperties.cxx
index 17f63d044dcf..b6fc7b7164f4 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 && dynamic_cast<const 
SfxStyleSheet *>(&rBC) != nullptr)
             {
+                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 && dynamic_cast<const 
SfxStyleSheet *>(&rBC) != nullptr)
             {
+                SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
+                if(!rObj.HasText())
+                    return;
+
+                const svx::ITextProvider& rTextProvider(getTextProvider());
                 sal_Int32 nText = rTextProvider.getTextCount();
                 while (nText--)
                 {
@@ -599,6 +604,7 @@ namespace sdr::properties
 
                     if(aOldName != aNewName)
                     {
+                        const svx::ITextProvider& 
rTextProvider(getTextProvider());
                         sal_Int32 nText = rTextProvider.getTextCount();
                         while (nText--)
                         {

Reply via email to