From 06d444e9a102569aa6cf429079036fc95482cc7f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 7 Mar 2024 12:23:26 +0200 Subject: tdf#158773 reduce dynamic_cast'ing in TextProperties::Notify Change-Id: If4a68433c57fdf3da56891fa0b4be6f8a991d929 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164528 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/sdr/properties/textproperties.cxx | 4 ++-- svx/source/svdraw/svdotxat.cxx | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 42a71dd3b1fb..220d6a528ef1 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -557,7 +557,7 @@ namespace sdr::properties SfxHintId nId(rHint.GetId()); const svx::ITextProvider& rTextProvider(getTextProvider()); - if(SfxHintId::DataChanged == nId && dynamic_cast(&rBC) != nullptr) + if(SfxHintId::DataChanged == nId && rBC.IsSfxStyleSheet()) { sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) @@ -578,7 +578,7 @@ namespace sdr::properties // #i101556# content of StyleSheet has changed -> new version maVersion++; } - else if(SfxHintId::Dying == nId && dynamic_cast(&rBC) != nullptr) + else if(SfxHintId::Dying == nId && rBC.IsSfxStyleSheet()) { sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index 6b39887d17f9..7e696f6b94cc 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -360,10 +360,13 @@ void SdrTextObj::ImpSetTextStyleSheetListeners() while (nNum>0) { nNum--; SfxBroadcaster* pBroadcast=GetBroadcasterJOE(nNum); - SfxStyleSheet* pStyle=dynamic_cast( pBroadcast ); - if (pStyle!=nullptr && pStyle!=GetStyleSheet()) { // special case for stylesheet of the object - if (aStyleSheets.find(pStyle)==aStyleSheets.end()) { - EndListening(*pStyle); + if (pBroadcast->IsSfxStyleSheet()) + { + SfxStyleSheet* pStyle = static_cast( pBroadcast ); + if (pStyle!=GetStyleSheet()) { // special case for stylesheet of the object + if (aStyleSheets.find(pStyle)==aStyleSheets.end()) { + EndListening(*pStyle); + } } } } -- cgit