tdf#158773 reduce cost of TextProperties::Notify

Shaves 30% off the load time here, by re-arranging the logic so we do th
expensive dynamic_cast less often

Change-Id: If7a1605994e620dbdb61010506c624cc738359a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164466
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 55b366b..17f63d0 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -554,50 +554,44 @@ namespace sdr::properties
            if(!rObj.HasText())
                return;

            SfxHintId nId(rHint.GetId());
            const svx::ITextProvider& rTextProvider(getTextProvider());
            if(dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr)

            if(SfxHintId::DataChanged == nId && dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr)
            {
                SfxHintId nId(rHint.GetId());

                if(SfxHintId::DataChanged == nId)
                sal_Int32 nText = rTextProvider.getTextCount();
                while (nText--)
                {
                    sal_Int32 nText = rTextProvider.getTextCount();
                    while (nText--)
                    {
                        OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                        if( pParaObj )
                            pParaObj->ClearPortionInfo();
                    }
                    rObj.SetTextSizeDirty();
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                    if( pParaObj )
                        pParaObj->ClearPortionInfo();
                }
                rObj.SetTextSizeDirty();

                    if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
                    {
                        // here only repaint wanted
                        rObj.ActionChanged();
                        //rObj.BroadcastObjectChange();
                    }

                    // #i101556# content of StyleSheet has changed -> new version
                    maVersion++;
                if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
                {
                    // here only repaint wanted
                    rObj.ActionChanged();
                    //rObj.BroadcastObjectChange();
                }

                if(SfxHintId::Dying == nId)
                // #i101556# content of StyleSheet has changed -> new version
                maVersion++;
            }
            else if(SfxHintId::Dying == nId && dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr)
            {
                sal_Int32 nText = rTextProvider.getTextCount();
                while (nText--)
                {
                    sal_Int32 nText = rTextProvider.getTextCount();
                    while (nText--)
                    {
                        OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                        if( pParaObj )
                            pParaObj->ClearPortionInfo();
                    }
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                    if( pParaObj )
                        pParaObj->ClearPortionInfo();
                }
            }
            else if(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr)
            else if (nId == SfxHintId::StyleSheetModified && dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr)
            {
                const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint);

                if(pExtendedHint
                    && SfxHintId::StyleSheetModified == pExtendedHint->GetId())
                if (pExtendedHint)
                {
                    const OUString& aOldName(pExtendedHint->GetOldName());
                    OUString aNewName(pExtendedHint->GetStyleSheet()->GetName());