include/svl/hint.hxx             |    2 ++
 sw/source/core/inc/attrhint.hxx  |    5 +++++
 sw/source/core/txtnode/ndtxt.cxx |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 7449378435627e466e69c2becd07b17ad7d7ff9b
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue May 28 18:25:47 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed May 29 11:19:41 2024 +0200

    avoid dynamic_cast in SwTextNode
    
    Change-Id: Id7ee5e922b7e99d1f3bade3b94285283eb07ae68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168163
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index fc54ac23fc99..0a7459175905 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -160,6 +160,7 @@ enum class SfxHintId {
     SwFormatField,
     SwFindRedline,
     SwModifyChanged,
+    SwAttr,
 
     ThisIsAnSdrHint,
     ThisIsAnSfxEventHint
@@ -252,6 +253,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
     case SfxHintId::SwFormatField: return stream << "SwFormatField";
     case SfxHintId::SwFindRedline: return stream << "SwFindRedline";
     case SfxHintId::SwModifyChanged: return stream << "SwModifyChanged";
+    case SfxHintId::SwAttr: return stream << "SwAttr";
     case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
     default: return stream << "unk(" << std::to_string(int(id)) << ")";
     }
diff --git a/sw/source/core/inc/attrhint.hxx b/sw/source/core/inc/attrhint.hxx
index e098b2695244..261839c5bbc4 100644
--- a/sw/source/core/inc/attrhint.hxx
+++ b/sw/source/core/inc/attrhint.hxx
@@ -24,6 +24,11 @@
 
 class SwAttrHint final : public SfxHint
 {
+public:
+    SwAttrHint()
+        : SfxHint(SfxHintId::SwAttr)
+    {
+    }
 };
 
 #endif
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 1d71a1cd8169..4cb8534ab205 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5552,7 +5552,7 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, 
const SfxHint& rHint )
         auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
         TriggerNodeUpdate(*pLegacyHint);
     }
-    else if (dynamic_cast<const SwAttrHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwAttr)
     {
         if (&rModify == GetRegisteredIn())
             ChkCondColl();

Reply via email to