diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-07 12:23:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-07 16:49:52 +0100 |
commit | 06d444e9a102569aa6cf429079036fc95482cc7f (patch) | |
tree | 7c57723581c380d8e45046c5b258a9722dcbdeb2 /svx | |
parent | 241d855f79d4e4b560a127ccdbcaa6b32297f52d (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/properties/textproperties.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotxat.cxx | 11 |
2 files changed, 9 insertions, 6 deletions
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<const SfxStyleSheet *>(&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<const SfxStyleSheet *>(&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<SfxStyleSheet*>( 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<SfxStyleSheet*>( pBroadcast ); + if (pStyle!=GetStyleSheet()) { // special case for stylesheet of the object + if (aStyleSheets.find(pStyle)==aStyleSheets.end()) { + EndListening(*pStyle); + } } } } |