sw/source/uibase/app/docstyle.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 072bd5d40a149bd50e95d24fc54417094193077e
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon May 27 21:23:21 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue May 28 11:16:27 2024 +0200

    no need to dynamic_cast here
    
    Change-Id: I2a2f6929f3a79dc3209b5dfec7a09b07dd78d267
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168123
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index 7cfd6f24fef1..f71002c09d13 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -136,11 +136,12 @@ public:
 
     void Notify(SfxBroadcaster&, const SfxHint& rHint) override
     {
-        auto pHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
-        if (!pHint)
+        auto nId = rHint.GetId();
+        if (nId != SfxHintId::StyleSheetModified && nId != 
SfxHintId::StyleSheetModifiedExtended
+            && nId != SfxHintId::StyleSheetErased)
             return;
+        auto pHint = static_cast<const SfxStyleSheetHint*>(&rHint);
 
-        auto nId = pHint->GetId();
         auto pDocStyleSheet = pHint->GetStyleSheet();
         const SfxStyleSheetModifiedHint* pExtendedHint = nullptr;
         if (nId == SfxHintId::StyleSheetModifiedExtended)
@@ -3367,10 +3368,9 @@ void SwStyleSheetIterator::InvalidateIterator()
 void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
     // search and remove from View-List!!
-    const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const 
SfxStyleSheetHint*>(&rHint);
-    if( pStyleSheetHint &&
-        SfxHintId::StyleSheetErased == pStyleSheetHint->GetId() )
+    if( SfxHintId::StyleSheetErased == rHint.GetId() )
     {
+        const SfxStyleSheetHint* pStyleSheetHint = static_cast<const 
SfxStyleSheetHint*>(&rHint);
         SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet();
 
         if (pStyle)

Reply via email to