basctl/source/accessibility/accessibledialogwindow.cxx   |    3 -
 basctl/source/dlged/dlged.cxx                            |    6 +-
 editeng/source/uno/unoedhlp.cxx                          |    2 
 include/svl/hint.hxx                                     |   43 +++++++++++++++
 include/svl/inethist.hxx                                 |    2 
 include/svl/poolitem.hxx                                 |    2 
 include/svl/style.hxx                                    |    2 
 include/svx/galmisc.hxx                                  |    2 
 reportdesign/source/core/sdr/RptObjectListener.cxx       |    2 
 reportdesign/source/ui/report/ReportController.cxx       |    6 +-
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx |    3 -
 sd/source/ui/slidesorter/controller/SlsListener.cxx      |    3 -
 sd/source/ui/view/ViewShellHint.cxx                      |    3 -
 sfx2/source/appl/sfxpicklist.cxx                         |    4 -
 sfx2/source/dialog/StyleList.cxx                         |    5 -
 sfx2/source/notify/openurlhint.cxx                       |    1 
 svx/source/form/filtnav.cxx                              |   25 ++++----
 svx/source/form/fmexpl.cxx                               |   11 ++-
 svx/source/form/navigatortree.cxx                        |   19 ++++--
 svx/source/form/navigatortreemodel.cxx                   |    3 -
 svx/source/inc/fmexpl.hxx                                |    6 +-
 svx/source/tbxctrls/colrctrl.cxx                         |    6 +-
 sw/inc/ddefld.hxx                                        |    5 +
 sw/inc/fmtfld.hxx                                        |    2 
 sw/inc/hints.hxx                                         |   16 +++--
 sw/inc/pagedesc.hxx                                      |    6 +-
 sw/inc/tox.hxx                                           |    3 -
 sw/inc/unocrsr.hxx                                       |    4 -
 sw/source/core/doc/doctxm.cxx                            |    3 -
 sw/source/core/doc/notxtfrm.cxx                          |    2 
 sw/source/core/docnode/node.cxx                          |    3 -
 sw/source/core/fields/ddetbl.cxx                         |   10 ++-
 sw/source/core/inc/pagedeschint.hxx                      |    2 
 sw/source/core/layout/atrfrm.cxx                         |    3 -
 sw/source/core/layout/pagechg.cxx                        |    2 
 sw/source/core/layout/tabfrm.cxx                         |   13 ++--
 sw/source/core/unocore/unotbl.cxx                        |   26 +++++----
 sw/source/uibase/wrtsh/navmgr.cxx                        |    2 
 38 files changed, 179 insertions(+), 82 deletions(-)

New commits:
commit 5e70ede56af526fce71672a120e5e9cea6e3365b
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Sep 3 15:45:37 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Sep 3 21:41:19 2024 +0200

    use less dynamic_cast when broadcasting SfxHint in sw
    
    Change-Id: I308887f377b6b97b4949ab3a8815d3d423806e0b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172827
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index bfd08eb17b32..c0a927a1c954 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -195,6 +195,21 @@ enum class SfxHintId {
     SwRedlineUnDelText,
     SwMoveText,
     SwRedlineContentAtPos,
+    SwTableBoxFormatChanged,
+    SwFindContentFrame,
+    SwTableLineFormatChanged,
+    SwMoveTableBox,
+    SwMoveTableLine,
+    SwCondCollCondChg,
+    SwGatherDdeTables,
+    SwUnoCursorHint,
+    SwPageDesc,
+    SwPageFootnote,
+    SwLinkAnchorSearch,
+    SwInRangeSearch,
+    SwGrfRereadAndInCache,
+    SwFindUnoTextTableRowInstance,
+    SwFindUnoCellInstance,
 
     ThisIsAnSdrHint,
     ThisIsAnSfxEventHint
diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
index 3e37716b675a..233899b8e28b 100644
--- a/sw/inc/ddefld.hxx
+++ b/sw/inc/ddefld.hxx
@@ -34,7 +34,8 @@ namespace sw
     {
         SwNodes& m_rNodes;
         const SwNode*& m_rpFoundNode;
-        LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) : 
m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {};
+        LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode)
+            : SfxHint(SfxHintId::SwLinkAnchorSearch), m_rNodes(rNodes), 
m_rpFoundNode(rpFoundNode) {};
         virtual ~LinkAnchorSearchHint() override;
     };
     struct InRangeSearchHint final : public SfxHint
@@ -42,7 +43,7 @@ namespace sw
         const SwNodeOffset m_nSttNd, m_nEndNd;
         bool& m_rIsInRange;
         InRangeSearchHint(const SwNodeOffset nSttNd, const SwNodeOffset 
nEndNd, bool& rIsInRange)
-            : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {}
+            : SfxHint(SfxHintId::SwInRangeSearch), m_nSttNd(nSttNd), 
m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {}
     };
 }
 
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 5df4f0beaf57..3976152b5822 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -90,7 +90,7 @@ namespace sw {
     };
     struct GatherDdeTablesHint final : SfxHint {
         std::vector<SwDDETable*>& m_rvTables;
-        GatherDdeTablesHint(std::vector<SwDDETable*>& rvTables) : 
m_rvTables(rvTables) {};
+        GatherDdeTablesHint(std::vector<SwDDETable*>& rvTables) : 
SfxHint(SfxHintId::SwGatherDdeTables), m_rvTables(rvTables) {};
     };
 }
 
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index a05d63dfe135..19fe86e95c5c 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -172,11 +172,13 @@ class CondCollCondChg final : public SfxHint
 {
 public:
     const SwTextFormatColl& m_rColl;
-    CondCollCondChg(const SwTextFormatColl& rColl) : m_rColl(rColl) {};
+    CondCollCondChg(const SwTextFormatColl& rColl) : 
SfxHint(SfxHintId::SwCondCollCondChg), m_rColl(rColl) {};
 };
 
 class GrfRereadAndInCacheHint final : public SfxHint
 {
+public:
+    GrfRereadAndInCacheHint() : SfxHint(SfxHintId::SwGrfRereadAndInCache) {}
 };
 
 class PreGraphicArrivedHint final : public SfxHint
@@ -208,7 +210,8 @@ class MoveTableLineHint final : public SfxHint
 public:
     const SwFrameFormat& m_rNewFormat;
     const SwTableLine& m_rTableLine;
-    MoveTableLineHint(const SwFrameFormat& rNewFormat, const SwTableLine& 
rTableLine): m_rNewFormat(rNewFormat), m_rTableLine(rTableLine) {};
+    MoveTableLineHint(const SwFrameFormat& rNewFormat, const SwTableLine& 
rTableLine)
+        : SfxHint(SfxHintId::SwMoveTableLine), m_rNewFormat(rNewFormat), 
m_rTableLine(rTableLine) {};
 };
 
 class MoveTableBoxHint final : public SfxHint
@@ -216,7 +219,8 @@ class MoveTableBoxHint final : public SfxHint
 public:
     const SwFrameFormat& m_rNewFormat;
     const SwTableBox& m_rTableBox;
-    MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& 
rTableBox): m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
+    MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& 
rTableBox)
+        : SfxHint(SfxHintId::SwMoveTableBox), m_rNewFormat(rNewFormat), 
m_rTableBox(rTableBox) {};
 };
 
 class DocumentDyingHint final : public SfxHint
@@ -230,14 +234,16 @@ class TableLineFormatChanged final : public SfxHint
 public:
     const SwTableLineFormat& m_rNewFormat;
     const SwTableLine& m_rTabLine;
-    TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const 
SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
+    TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const 
SwTableLine& rTabLine)
+        : SfxHint(SfxHintId::SwTableLineFormatChanged), 
m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
 };
 class TableBoxFormatChanged final : public SfxHint
 {
 public:
     const SwTableBoxFormat& m_rNewFormat;
     const SwTableBox& m_rTableBox;
-    TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const 
SwTableBox& rTableBox) : m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
+    TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const 
SwTableBox& rTableBox)
+        : SfxHint(SfxHintId::SwTableBoxFormatChanged), 
m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
 };
 class NameChanged final : public SfxHint
 {
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 205848fe2f2d..7ae59362cb42 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -399,7 +399,11 @@ public:
 };
 
 namespace sw {
-    class PageFootnoteHint final : public SfxHint {};
+    class PageFootnoteHint final : public SfxHint
+    {
+    public:
+        PageFootnoteHint() : SfxHint(SfxHintId::SwPageFootnote) {}
+    };
 
     SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwDoc& rDoc, 
SwPageFootnoteInfo const&);
 }
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index ee0b0385599c..99e91250c48e 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -56,7 +56,8 @@ namespace sw {
         SwContentFrame*& m_rpContentFrame;
         const SwRootFrame& m_rLayout;
         FindContentFrameHint(SwContentFrame*& rpContentFrame,const 
SwRootFrame& rLayout)
-            : m_rpContentFrame(rpContentFrame)
+            : SfxHint(SfxHintId::SwFindContentFrame)
+            , m_rpContentFrame(rpContentFrame)
             , m_rLayout(rLayout)
         {}
     };
diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
index 08ca12fb28e7..eea78fe54b72 100644
--- a/sw/inc/unocrsr.hxx
+++ b/sw/inc/unocrsr.hxx
@@ -28,7 +28,7 @@ namespace sw
 {
     struct SW_DLLPUBLIC UnoCursorHint final : public SfxHint
     {
-        UnoCursorHint() {}
+        UnoCursorHint() : SfxHint(SfxHintId::SwUnoCursorHint) {}
         virtual ~UnoCursorHint() override;
     };
 }
@@ -130,7 +130,7 @@ namespace sw
             {
                 if(m_pCursor)
                 {
-                    if(typeid(rHint) == typeid(UnoCursorHint))
+                    if(rHint.GetId() == SfxHintId::SwUnoCursorHint)
                         EndListening(rBC);
                 }
                 if(!GetBroadcasterCount())
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e90b289e4fba..7985233d1f9c 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1282,8 +1282,9 @@ SwTextFormatColl* SwTOXBaseSection::GetTextFormatColl( 
sal_uInt16 nLevel )
 
 void SwTOXBaseSection::SwClientNotify(const SwModify& rModify, const SfxHint& 
rHint)
 {
-    if (auto pFindHint = dynamic_cast<const sw::FindContentFrameHint*>(&rHint))
+    if (rHint.GetId() == SfxHintId::SwFindContentFrame)
     {
+        auto pFindHint = static_cast<const sw::FindContentFrameHint*>(&rHint);
         if(pFindHint->m_rpContentFrame)
             return;
         auto pSectFormat = GetFormat();
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 946fa5e4e48d..fbbcc035b118 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -746,7 +746,7 @@ void SwNoTextFrame::OnGraphicArrived()
 
 void SwNoTextFrame::SwClientNotify(const SwModify& rModify, const SfxHint& 
rHint)
 {
-    if(dynamic_cast<const sw::GrfRereadAndInCacheHint*>(&rHint))
+    if(rHint.GetId() == SfxHintId::SwGrfRereadAndInCache)
     {
         if(SwNodeType::Grf != GetNode()->GetNodeType())
         {
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 3f1ebd5b72d4..7e114cb3da56 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1193,8 +1193,9 @@ void SwContentNode::SwClientNotify( const SwModify&, 
const SfxHint& rHint)
         auto pModifyChangedHint = static_cast<const 
sw::ModifyChangedHint*>(&rHint);
         m_pCondColl = const_cast<SwFormatColl*>(static_cast<const 
SwFormatColl*>(pModifyChangedHint->m_pNew));
     }
-    else if(auto pCondCollCondChgHint = dynamic_cast<const 
sw::CondCollCondChg*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwCondCollCondChg)
     {
+        auto pCondCollCondChgHint = static_cast<const 
sw::CondCollCondChg*>(&rHint);
         ChkCondColl(&pCondCollCondChgHint->m_rColl);
     }
 }
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 7a93abe3108e..b47524ec9a37 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -96,16 +96,18 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
         // replace DDETable by real table
         NoDDETable();
     }
-    else if(const auto pLinkAnchorHint = dynamic_cast<const 
sw::LinkAnchorSearchHint*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwLinkAnchorSearch)
     {
+        const auto pLinkAnchorHint = static_cast<const 
sw::LinkAnchorSearchHint*>(&rHint);
         if(pLinkAnchorHint->m_rpFoundNode)
             return;
         const auto pNd = GetTabSortBoxes()[0]->GetSttNd();
         if( pNd && &pLinkAnchorHint->m_rNodes == &pNd->GetNodes() )
             pLinkAnchorHint->m_rpFoundNode = pNd;
     }
-    else if(const sw::InRangeSearchHint* pInRangeHint = dynamic_cast<const 
sw::InRangeSearchHint*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwInRangeSearch)
     {
+        const sw::InRangeSearchHint* pInRangeHint = static_cast<const 
sw::InRangeSearchHint*>(&rHint);
         if(pInRangeHint->m_rIsInRange)
             return;
         const SwTableNode* pTableNd = 
GetTabSortBoxes()[0]->GetSttNd()->FindTableNode();
@@ -113,8 +115,10 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
                 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
                 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
             pInRangeHint->m_rIsInRange = true;
-    } else if (const auto pGatherDdeTablesHint = dynamic_cast<const 
sw::GatherDdeTablesHint*>(&rHint))
+    }
+    else if (rHint.GetId() == SfxHintId::SwGatherDdeTables)
     {
+        const auto pGatherDdeTablesHint = static_cast<const 
sw::GatherDdeTablesHint*>(&rHint);
         pGatherDdeTablesHint->m_rvTables.push_back(this);
     }
     else if (rHint.GetId() == SfxHintId::SwModifyChanged)
diff --git a/sw/source/core/inc/pagedeschint.hxx 
b/sw/source/core/inc/pagedeschint.hxx
index 2dbfec18dabe..7ae4a37dac82 100644
--- a/sw/source/core/inc/pagedeschint.hxx
+++ b/sw/source/core/inc/pagedeschint.hxx
@@ -29,7 +29,7 @@ class SwPageDescHint final : public SfxHint
     SwPageDesc* m_pPageDesc;
 public:
     SwPageDescHint( SwPageDesc* p )
-        : m_pPageDesc(p)
+        : SfxHint(SfxHintId::SwPageDesc), m_pPageDesc(p)
     {}
 
     SwPageDesc* GetPageDesc() const { return m_pPageDesc; }
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index b24905273b29..58b48777d1ef 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -731,8 +731,9 @@ void SwFormatPageDesc::SwClientNotify(const SwModify&, 
const SfxHint& rHint)
         if(GetRegisteredIn())
             static_cast<const sw::AutoFormatUsedHint&>(rHint).SetUsed(); 
//TODO: recheck if this is really the right way to check for use
     }
-    else if (const SwPageDescHint* pHint = dynamic_cast<const 
SwPageDescHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwPageDesc)
     {
+        const SwPageDescHint* pHint = static_cast<const 
SwPageDescHint*>(&rHint);
         // mba: shouldn't that be broadcasted also?
         SwFormatPageDesc aDfltDesc(pHint->GetPageDesc());
         SwPageDesc* pDesc = pHint->GetPageDesc();
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 379f0cc16631..d086166caaef 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -515,7 +515,7 @@ void SwPageFrame::PreparePage( bool bFootnote )
 
 void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
 {
-    if(typeid(sw::PageFootnoteHint) == typeid(rHint))
+    if(rHint.GetId() == SfxHintId::SwPageFootnote)
     {
         // currently the savest way:
         static_cast<SwRootFrame*>(GetUpper())->SetSuperfluous();
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 413fe460cb9e..77e5abd83a86 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4507,8 +4507,9 @@ void SwRowFrame::OnFrameSize(const SfxPoolItem& rSize)
 
 void SwRowFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
 {
-    if(auto pNewFormatHint = dynamic_cast<const 
sw::TableLineFormatChanged*>(&rHint))
+    if(rHint.GetId() == SfxHintId::SwTableLineFormatChanged)
     {
+        auto pNewFormatHint = static_cast<const 
sw::TableLineFormatChanged*>(&rHint);
         if(GetTabLine() != &pNewFormatHint->m_rTabLine)
             return;
         
RegisterToFormat(const_cast<SwTableLineFormat&>(pNewFormatHint->m_rNewFormat));
@@ -4534,9 +4535,9 @@ void SwRowFrame::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
             pTab->InvalidatePos();
         }
     }
-    else if(auto pMoveTableLineHint = dynamic_cast<const 
sw::MoveTableLineHint*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwMoveTableLine)
     {
-
+        auto pMoveTableLineHint = static_cast<const 
sw::MoveTableLineHint*>(&rHint);
         if(GetTabLine() != &pMoveTableLineHint->m_rTableLine)
             return;
         
const_cast<SwFrameFormat*>(&pMoveTableLineHint->m_rNewFormat)->Add(*this);
@@ -6102,8 +6103,9 @@ void SwCellFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBorder
 
 void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
-    if(auto pNewFormatHint = dynamic_cast<const 
sw::TableBoxFormatChanged*>(&rHint))
+    if(rHint.GetId() == SfxHintId::SwTableBoxFormatChanged)
     {
+        auto pNewFormatHint = static_cast<const 
sw::TableBoxFormatChanged*>(&rHint);
         if(GetTabBox() != &pNewFormatHint->m_rTableBox)
             return;
         
RegisterToFormat(const_cast<SwTableBoxFormat&>(pNewFormatHint->m_rNewFormat));
@@ -6125,8 +6127,9 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
             pRow->InvalidatePrt_();
         }
     }
-    else if(auto pMoveTableBoxHint = dynamic_cast<const 
sw::MoveTableBoxHint*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwMoveTableBox)
     {
+        auto pMoveTableBoxHint = static_cast<const 
sw::MoveTableBoxHint*>(&rHint);
         if(GetTabBox() != &pMoveTableBoxHint->m_rTableBox)
             return;
         
const_cast<SwFrameFormat*>(&pMoveTableBoxHint->m_rNewFormat)->Add(*this);
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index d5502de3a7d0..fb02ad9a0cd3 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -115,12 +115,17 @@ using ::editeng::SvxBorderLine;
 
 namespace
 {
-    template<typename Tcoretype, typename Tunotype>
-    struct FindUnoInstanceHint final : SfxHint
+    struct FindUnoCellInstanceHint final : SfxHint
     {
-        FindUnoInstanceHint(Tcoretype* pCore) : m_pCore(pCore), 
m_pResult(nullptr) {};
-        const Tcoretype* const m_pCore;
-        mutable rtl::Reference<Tunotype> m_pResult;
+        FindUnoCellInstanceHint(SwTableBox* pCore) : 
SfxHint(SfxHintId::SwFindUnoCellInstance), m_pCore(pCore) {};
+        const SwTableBox* const m_pCore;
+        mutable rtl::Reference<SwXCell> m_pResult;
+    };
+    struct FindUnoTextTableRowInstanceHint final : SfxHint
+    {
+        FindUnoTextTableRowInstanceHint(SwTableLine* pCore) : 
SfxHint(SfxHintId::SwFindUnoTextTableRowInstance), m_pCore(pCore) {};
+        const SwTableLine* const m_pCore;
+        mutable rtl::Reference<SwXTextTableRow> m_pResult;
     };
     SwFrameFormat* lcl_EnsureCoreConnected(SwFrameFormat* pFormat, 
cppu::OWeakObject* pObject)
     {
@@ -1123,8 +1128,9 @@ void SwXCell::Notify(const SfxHint& rHint)
     {
         m_pTableFormat = nullptr;
     }
-    else if(auto pFindHint = dynamic_cast<const 
FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
+    else if(rHint.GetId() == SfxHintId::SwFindUnoCellInstance)
     {
+        auto pFindHint = static_cast<const FindUnoCellInstanceHint*>(&rHint);
         if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox())
             pFindHint->m_pResult = this;
     }
@@ -1140,7 +1146,7 @@ rtl::Reference<SwXCell> 
SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTabl
     if(it == pTable->GetTabSortBoxes().end())
         return nullptr;
     size_t const nPos = it - pTable->GetTabSortBoxes().begin();
-    FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox};
+    FindUnoCellInstanceHint aHint{pBox};
     pTableFormat->GetNotifier().Broadcast(aHint);
     return aHint.m_pResult ? aHint.m_pResult.get() : new SwXCell(pTableFormat, 
pBox, nPos);
 }
@@ -1400,8 +1406,10 @@ void SwXTextTableRow::Notify(const SfxHint& rHint)
     if(rHint.GetId() == SfxHintId::Dying)
     {
         m_pFormat = nullptr;
-    } else if(auto pFindHint = dynamic_cast<const 
FindUnoInstanceHint<SwTableLine, SwXTextTableRow>*>(&rHint))
+    }
+    else if(rHint.GetId() == SfxHintId::SwFindUnoTextTableRowInstance)
     {
+        auto pFindHint = static_cast<const 
FindUnoTextTableRowInstanceHint*>(&rHint);
         if(!pFindHint->m_pCore && pFindHint->m_pCore == m_pLine)
             pFindHint->m_pResult = this;
     }
@@ -3892,7 +3900,7 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
     if(o3tl::make_unsigned(nIndex) >= pTable->GetTabLines().size())
         throw lang::IndexOutOfBoundsException();
     SwTableLine* pLine = pTable->GetTabLines()[nIndex];
-    FindUnoInstanceHint<SwTableLine,SwXTextTableRow> aHint{pLine};
+    FindUnoTextTableRowInstanceHint aHint{pLine};
     pFrameFormat->GetNotifier().Broadcast(aHint);
     if(!aHint.m_pResult)
         aHint.m_pResult = new SwXTextTableRow(pFrameFormat, pLine);
diff --git a/sw/source/uibase/wrtsh/navmgr.cxx 
b/sw/source/uibase/wrtsh/navmgr.cxx
index eea6cda7dce0..cc8ee3fb28d7 100644
--- a/sw/source/uibase/wrtsh/navmgr.cxx
+++ b/sw/source/uibase/wrtsh/navmgr.cxx
@@ -60,7 +60,7 @@ void SwNavigationMgr::Notify(SfxBroadcaster& rBC, const 
SfxHint& rHint)
 {
     // our cursors may now spontaneously self-destruct: remove from
     // m_entries if that happens
-    if (typeid(rHint) == typeid(sw::UnoCursorHint))
+    if (rHint.GetId() == SfxHintId::SwUnoCursorHint)
     {
         auto it = std::find_if(m_entries.begin(), m_entries.end(),
             [&rBC](const sw::UnoCursorPointer& rItem) { return !rItem || &rBC 
== &rItem->m_aNotifier; });
commit b7a32682f650a2a0f59ce52c91b30640d07e0a6a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Sep 3 16:13:47 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Sep 3 21:41:08 2024 +0200

    use less dynamic_cast when broadcasting SfxHint
    
    Change-Id: I24c947c20afeffffebe5ac794108c4ccecb680f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172828
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx 
b/basctl/source/accessibility/accessibledialogwindow.cxx
index def3a8fdede0..8f43fa4b2556 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -444,8 +444,9 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
             default: ;
         }
     }
-    else if (DlgEdHint const* pDlgEdHint = dynamic_cast<DlgEdHint 
const*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::BasCtlDlgEd)
     {
+        DlgEdHint const* pDlgEdHint = static_cast<DlgEdHint const*>(&rHint);
         switch (pDlgEdHint->GetKind())
         {
             case DlgEdHint::WINDOWSCROLLED:
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index c1e9a28b2c61..7d5b34b2d344 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -66,13 +66,15 @@ constexpr OUString aDecorationPropName = u"Decoration"_ustr;
 
 
 DlgEdHint::DlgEdHint(Kind eHint)
-    : eKind(eHint)
+    : SfxHint(SfxHintId::BasCtlDlgEd)
+    , eKind(eHint)
     , pDlgEdObj(nullptr)
 {
 }
 
 DlgEdHint::DlgEdHint(Kind eHint, DlgEdObj* pObj)
-    : eKind(eHint)
+    : SfxHint(SfxHintId::BasCtlDlgEd)
+    , eKind(eHint)
     , pDlgEdObj(pObj)
 {
 }
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 2a1b1e2bd54f..304acd50de13 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -79,7 +79,7 @@ std::unique_ptr<SfxHint> 
SvxEditSourceHelper::EENotification2Hint( EENotify cons
         }
     }
 
-    return std::make_unique<SfxHint>( );
+    return std::make_unique<SfxHint>( SfxHintId::NONE );
 }
 
 void SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& 
nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool 
bInCell )
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index fe636a89ec55..bfd08eb17b32 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -40,6 +40,26 @@ enum class SfxHintId {
     RedlineChanged,
     DocumentRepair,
     SvxViewChanged,
+    PoolItem,
+    SfxStyleSheetPool,
+    INetURLHistory,
+    SfxOpenUrl,
+
+// svx navigator tree
+    FmNavViewMarksChanged,
+    FmNavRequestSelect,
+    FmNavInserted,
+    FmNavModelReplaced,
+    FmNavRemoved,
+    FmNavNameChanged,
+    FmNavCleared,
+
+// svx filter navigator
+    FmFilterInserted,
+    FilterClearing,
+    FmFilterRemoved,
+    FmFilterTextChanged,
+    FmFilterCurrentChanged,
 
 // VCL text hints
     TextParaInserted,
@@ -61,6 +81,12 @@ enum class SfxHintId {
     BasicStart,
     BasicStop,
 
+// basctl
+    BasCtlDlgEd,
+
+// reportdesign
+    ReportDesignDlgEd,
+
 // SVX
     FmDesignModeChanged,
 // SVX edit source
@@ -102,6 +128,8 @@ enum class SfxHintId {
     ScAccMakeDrawLayer,
     ScAccWindowResized,
 
+// sd hints
+    SdViewShell,
 
 // SFX stylesheet
     StyleSheetCreated,  // new
diff --git a/include/svl/inethist.hxx b/include/svl/inethist.hxx
index a04a907d4beb..ea317bac45e6 100644
--- a/include/svl/inethist.hxx
+++ b/include/svl/inethist.hxx
@@ -90,7 +90,7 @@ class SVL_DLLPUBLIC INetURLHistoryHint final : public SfxHint
 {
     const INetURLObject* pObj;
 public:
-    explicit INetURLHistoryHint( const INetURLObject* Object ) : pObj(Object) 
{}
+    explicit INetURLHistoryHint( const INetURLObject* Object ) : 
SfxHint(SfxHintId::INetURLHistory), pObj(Object) {}
     const INetURLObject* GetObject() const { return pObj; }
 };
 
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 4c69c0c9053d..dcf1a449eeb5 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -861,7 +861,7 @@ class SVL_DLLPUBLIC SfxPoolItemHint final : public SfxHint
 {
     SfxPoolItem* pObj;
 public:
-    explicit SfxPoolItemHint( SfxPoolItem* Object ) : pObj(Object) {}
+    explicit SfxPoolItemHint( SfxPoolItem* Object ) : 
SfxHint(SfxHintId::PoolItem), pObj(Object) {}
     SfxPoolItem* GetObject() const { return pObj; }
 };
 
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 522ef2437c60..9f765bcaf1b0 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -316,7 +316,7 @@ public:
 class SVL_DLLPUBLIC SfxStyleSheetPoolHint final : public SfxHint
 {
 public:
-                         SfxStyleSheetPoolHint() {}
+    SfxStyleSheetPoolHint() : SfxHint(SfxHintId::SfxStyleSheetPool) {}
 };
 
 
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index 33a4425b03e7..3403b4e32db6 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -183,9 +183,11 @@ private:
 public:
 
                      GalleryHint( GalleryHintType nType, OUString aThemeName, 
void* nData1 = nullptr ) :
+                        SfxHint(SfxHintId::NONE),
                         mnType( nType ), maThemeName(std::move( aThemeName )), 
mnData1( nData1 ) {}
 
                      GalleryHint( GalleryHintType nType, OUString aThemeName, 
OUString aStringData ) :
+                        SfxHint(SfxHintId::NONE),
                         mnType( nType ), maThemeName(std::move( aThemeName )), 
maStringData(std::move( aStringData )), mnData1( nullptr ) {}
 
     GalleryHintType  GetType() const { return mnType; }
diff --git a/reportdesign/source/core/sdr/RptObjectListener.cxx 
b/reportdesign/source/core/sdr/RptObjectListener.cxx
index 0cc6a42b2f35..2ed128093bc6 100644
--- a/reportdesign/source/core/sdr/RptObjectListener.cxx
+++ b/reportdesign/source/core/sdr/RptObjectListener.cxx
@@ -55,7 +55,7 @@ void SAL_CALL OObjectListener::propertyChange( const  
css::beans::PropertyChange
 
 
 DlgEdHint::DlgEdHint(DlgEdHintKind eHint)
-    : eHintKind(eHint)
+    : SfxHint(SfxHintId::ReportDesignDlgEd), eHintKind(eHint)
 {
 }
 
diff --git a/reportdesign/source/ui/report/ReportController.cxx 
b/reportdesign/source/ui/report/ReportController.cxx
index e616cd859eab..d21e40262464 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2550,8 +2550,10 @@ sal_Int32 OReportController::getGroupPosition(const 
uno::Reference< report::XGro
 
 void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & 
_rHint)
 {
-    const DlgEdHint* pDlgEdHint = dynamic_cast<const DlgEdHint*>(&_rHint);
-    if (!(pDlgEdHint && pDlgEdHint->GetKind() == RPTUI_HINT_SELECTIONCHANGED))
+    if (_rHint.GetId() != SfxHintId::ReportDesignDlgEd)
+        return;
+    const DlgEdHint* pDlgEdHint = static_cast<const DlgEdHint*>(&_rHint);
+    if (pDlgEdHint->GetKind() != RPTUI_HINT_SELECTIONCHANGED)
         return;
 
     const sal_Int32 nSelectionCount = getDesignView()->getMarkedObjectCount();
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx 
b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 2fc11d1a537a..ac5d06f9a1ee 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -833,8 +833,9 @@ void AccessibleSlideSorterView::Implementation::Notify (
                 break;
         }
     }
-    else if (auto pViewShellHint = dynamic_cast<const 
sd::ViewShellHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SdViewShell)
     {
+        auto pViewShellHint = static_cast<const sd::ViewShellHint*>(&rHint);
         switch (pViewShellHint->GetHintId())
         {
             case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx 
b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index dd7ef94de5d5..22e6dda70200 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -279,8 +279,9 @@ void Listener::Notify (
         mrController.CheckForMasterPageAssignment();
         mrController.CheckForSlideTransitionAssignment();
     }
-    else if (auto pViewShellHint = dynamic_cast<const ViewShellHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SdViewShell)
     {
+        auto pViewShellHint = static_cast<const ViewShellHint*>(&rHint);
         switch (pViewShellHint->GetHintId())
         {
             case ViewShellHint::HINT_PAGE_RESIZE_START:
diff --git a/sd/source/ui/view/ViewShellHint.cxx 
b/sd/source/ui/view/ViewShellHint.cxx
index b86cbaa325d7..209db9856d7d 100644
--- a/sd/source/ui/view/ViewShellHint.cxx
+++ b/sd/source/ui/view/ViewShellHint.cxx
@@ -22,7 +22,8 @@
 namespace sd
 {
 ViewShellHint::ViewShellHint(HintId eHintId)
-    : meHintId(eHintId)
+    : SfxHint(SfxHintId::SdViewShell)
+    , meHintId(eHintId)
 {
 }
 
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index bd7a0a091189..84903f800ca8 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -153,9 +153,9 @@ SfxPickListImpl::SfxPickListImpl(SfxApplication& rApp)
 
 void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    const SfxOpenUrlHint* pOpenUrlHint = dynamic_cast<const 
SfxOpenUrlHint*>(&rHint);
-    if ( pOpenUrlHint )
+    if (rHint.GetId() == SfxHintId::SfxOpenUrl)
     {
+        const SfxOpenUrlHint* pOpenUrlHint = static_cast<const 
SfxOpenUrlHint*>(&rHint);
         INetURLHistory::GetOrCreate()->PutUrl( INetURLObject( 
pOpenUrlHint->GetDocumentURL() ));
     }
 
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index f7bafd382469..b968dc252f0d 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -1593,9 +1593,8 @@ void StyleList::Notify(SfxBroadcaster& /*rBC*/, const 
SfxHint& rHint)
     // works bad in UpdateStyles_Impl ()!
 
     if (!m_bDontUpdate && nId != SfxHintId::Dying
-        && (dynamic_cast<const SfxStyleSheetPoolHint*>(&rHint)
-            || dynamic_cast<const SfxStyleSheetHint*>(&rHint)
-            || dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint)))
+        && (nId == SfxHintId::SfxStyleSheetPool || dynamic_cast<const 
SfxStyleSheetHint*>(&rHint)
+            || nId == SfxHintId::StyleSheetModifiedExtended)) // ie. 
SfxStyleSheetModifiedHint
     {
         if (!pIdle)
         {
diff --git a/sfx2/source/notify/openurlhint.cxx 
b/sfx2/source/notify/openurlhint.cxx
index 539d28b899e1..0d9742a124fd 100644
--- a/sfx2/source/notify/openurlhint.cxx
+++ b/sfx2/source/notify/openurlhint.cxx
@@ -21,6 +21,7 @@
 #include <utility>
 
 SfxOpenUrlHint::SfxOpenUrlHint( OUString sDocumentURL ) :
+    SfxHint(SfxHintId::SfxOpenUrl),
     msDocumentURL(std::move(sDocumentURL)) { }
 
 const OUString& SfxOpenUrlHint::GetDocumentURL() const
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index fe633e9fdd20..add4fc49306f 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -163,7 +163,7 @@ class FmFilterHint : public SfxHint
     FmFilterData*   m_pData;
 
 public:
-    explicit FmFilterHint(FmFilterData* pData):m_pData(pData){}
+    explicit FmFilterHint(SfxHintId nHintId, FmFilterData* pData) : 
SfxHint(nHintId), m_pData(pData) {}
     FmFilterData* GetData() const { return m_pData; }
 };
 
@@ -173,7 +173,7 @@ class FmFilterInsertedHint : public FmFilterHint
 
 public:
     FmFilterInsertedHint(FmFilterData* pData, size_t nRelPos)
-        :FmFilterHint(pData)
+        :FmFilterHint(SfxHintId::FmFilterInserted, pData)
         ,m_nPos(nRelPos){}
 
     size_t GetPos() const { return m_nPos; }
@@ -183,7 +183,7 @@ class FmFilterRemovedHint : public FmFilterHint
 {
 public:
     explicit FmFilterRemovedHint(FmFilterData* pData)
-        :FmFilterHint(pData){}
+        :FmFilterHint(SfxHintId::FmFilterRemoved, pData){}
 };
 
 
@@ -191,19 +191,19 @@ class FmFilterTextChangedHint : public FmFilterHint
 {
 public:
     explicit FmFilterTextChangedHint(FmFilterData* pData)
-        :FmFilterHint(pData){}
+        :FmFilterHint(SfxHintId::FmFilterTextChanged, pData){}
 };
 
 class FilterClearingHint : public SfxHint
 {
 public:
-    FilterClearingHint(){}
+    FilterClearingHint() : SfxHint(SfxHintId::FilterClearing) {}
 };
 
 class FmFilterCurrentChangedHint : public SfxHint
 {
 public:
-    FmFilterCurrentChangedHint(){}
+    FmFilterCurrentChangedHint() : SfxHint(SfxHintId::FmFilterCurrentChanged) 
{}
 };
 
 }
@@ -1278,25 +1278,28 @@ IMPL_LINK_NOARG(FmFilterNavigator, SelectHdl, 
weld::TreeView&, void)
 
 void FmFilterNavigator::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    if (const FmFilterInsertedHint* pInsertHint = dynamic_cast<const 
FmFilterInsertedHint*>(&rHint))
+    if (rHint.GetId() == SfxHintId::FmFilterInserted)
     {
+        const FmFilterInsertedHint* pInsertHint = static_cast<const 
FmFilterInsertedHint*>(&rHint);
         Insert(pInsertHint->GetData(), pInsertHint->GetPos());
     }
-    else if( dynamic_cast<const FilterClearingHint*>(&rHint) )
+    else if( rHint.GetId() == SfxHintId::FilterClearing )
     {
         m_xTreeView->clear();
     }
-    else if (const FmFilterRemovedHint* pRemoveHint = dynamic_cast<const 
FmFilterRemovedHint*>(&rHint))
+    else if ( rHint.GetId() == SfxHintId::FmFilterRemoved )
     {
+        const FmFilterRemovedHint* pRemoveHint = static_cast<const 
FmFilterRemovedHint*>(&rHint);
         Remove(pRemoveHint->GetData());
     }
-    else if (const FmFilterTextChangedHint *pChangeHint = dynamic_cast<const 
FmFilterTextChangedHint*>(&rHint))
+    else if ( rHint.GetId() == SfxHintId::FmFilterTextChanged )
     {
+        const FmFilterTextChangedHint *pChangeHint = static_cast<const 
FmFilterTextChangedHint*>(&rHint);
         std::unique_ptr<weld::TreeIter> xEntry = 
FindEntry(pChangeHint->GetData());
         if (xEntry)
             m_xTreeView->set_text(*xEntry, pChangeHint->GetData()->GetText());
     }
-    else if( dynamic_cast<const FmFilterCurrentChangedHint*>(&rHint) )
+    else if( rHint.GetId() == SfxHintId::FmFilterCurrentChanged )
     {
         m_xTreeView->queue_draw();
     }
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 1efbac251654..59fa0f638188 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -47,7 +47,8 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::container;
 
 FmNavInsertedHint::FmNavInsertedHint( FmEntryData* pInsertedEntryData, 
sal_uInt32 nRelPos )
-    :pEntryData( pInsertedEntryData )
+    :SfxHint(SfxHintId::FmNavInserted)
+    ,pEntryData( pInsertedEntryData )
     ,nPos( nRelPos )
 
 {
@@ -61,7 +62,7 @@ FmNavInsertedHint::~FmNavInsertedHint()
 
 
 FmNavModelReplacedHint::FmNavModelReplacedHint( FmEntryData* 
pAffectedEntryData )
-    :pEntryData( pAffectedEntryData )
+    :SfxHint(SfxHintId::FmNavModelReplaced), pEntryData( pAffectedEntryData )
 {
 }
 
@@ -71,7 +72,7 @@ FmNavModelReplacedHint::~FmNavModelReplacedHint()
 }
 
 FmNavRemovedHint::FmNavRemovedHint( FmEntryData* pRemovedEntryData )
-    :pEntryData( pRemovedEntryData )
+    :SfxHint(SfxHintId::FmNavRemoved), pEntryData( pRemovedEntryData )
 {
 }
 
@@ -81,7 +82,7 @@ FmNavRemovedHint::~FmNavRemovedHint()
 }
 
 FmNavNameChangedHint::FmNavNameChangedHint( FmEntryData* pData, OUString 
_aNewName )
-    :pEntryData( pData )
+    :SfxHint(SfxHintId::FmNavNameChanged), pEntryData( pData )
     ,aNewName(std::move( _aNewName ))
 {
 }
@@ -91,7 +92,7 @@ FmNavNameChangedHint::~FmNavNameChangedHint()
 {
 }
 
-FmNavClearedHint::FmNavClearedHint()
+FmNavClearedHint::FmNavClearedHint() : SfxHint(SfxHintId::FmNavCleared)
 {
 }
 
diff --git a/svx/source/form/navigatortree.cxx 
b/svx/source/form/navigatortree.cxx
index 5f8a6e9d1132..81402c608fd7 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -555,19 +555,22 @@ namespace svxform
 
     void NavigatorTree::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
     {
-        if( auto pRemovedHint = dynamic_cast<const FmNavRemovedHint*>(&rHint) )
+        if( rHint.GetId() == SfxHintId::FmNavRemoved )
         {
+            auto pRemovedHint = static_cast<const FmNavRemovedHint*>(&rHint);
             FmEntryData* pEntryData = pRemovedHint->GetEntryData();
             Remove( pEntryData );
         }
-        else if( auto pInsertedHint = dynamic_cast<const 
FmNavInsertedHint*>(&rHint) )
+        else if( rHint.GetId() == SfxHintId::FmNavInserted )
         {
+            auto pInsertedHint = static_cast<const FmNavInsertedHint*>(&rHint);
             FmEntryData* pEntryData = pInsertedHint->GetEntryData();
             sal_uInt32 nRelPos = pInsertedHint->GetRelPos();
             Insert( pEntryData, nRelPos );
         }
-        else if( auto pReplacedHint = dynamic_cast<const 
FmNavModelReplacedHint*>(&rHint) )
+        else if( rHint.GetId() == SfxHintId::FmNavModelReplaced )
         {
+            auto pReplacedHint = static_cast<const 
FmNavModelReplacedHint*>(&rHint);
             FmEntryData* pData = pReplacedHint->GetEntryData();
             std::unique_ptr<weld::TreeIter> xEntry = FindEntry(pData);
             if (xEntry)
@@ -576,13 +579,14 @@ namespace svxform
                 m_xTreeView->set_image(*xEntry, pData->GetNormalImage());
             }
         }
-        else if( auto pNameChangedHint = dynamic_cast<const 
FmNavNameChangedHint*>(&rHint) )
+        else if( rHint.GetId() == SfxHintId::FmNavNameChanged )
         {
+            auto pNameChangedHint = static_cast<const 
FmNavNameChangedHint*>(&rHint);
             std::unique_ptr<weld::TreeIter> xEntry = 
FindEntry(pNameChangedHint->GetEntryData());
             if (xEntry)
                 m_xTreeView->set_text(*xEntry, pNameChangedHint->GetNewName());
         }
-        else if( dynamic_cast<const FmNavClearedHint*>(&rHint) )
+        else if( rHint.GetId() == SfxHintId::FmNavCleared )
         {
             m_aCutEntries.clear();
             if (m_aControlExchange.isDataExchangeActive())
@@ -597,9 +601,10 @@ namespace svxform
             m_xTreeView->set_image(*m_xRootEntry, RID_SVXBMP_FORMS);
             m_xTreeView->set_sensitive(*m_xRootEntry, true);
         }
-        else if (auto pSelectHint = 
dynamic_cast<FmNavRequestSelectHint*>(const_cast<SfxHint*>(&rHint)))
+        else if (rHint.GetId() == SfxHintId::FmNavRequestSelect)
         {
-            FmEntryDataArray& arredToSelect = pSelectHint->GetItems();
+            auto pSelectHint = static_cast<const 
FmNavRequestSelectHint*>(&rHint);
+            FmEntryDataArray& arredToSelect = 
const_cast<FmNavRequestSelectHint*>(pSelectHint)->GetItems();
             SynchronizeSelection(arredToSelect);
 
             if (pSelectHint->IsMixedSelection())
diff --git a/svx/source/form/navigatortreemodel.cxx 
b/svx/source/form/navigatortreemodel.cxx
index e962f13f57c8..0a0e014842f6 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -675,8 +675,9 @@ namespace svxform
             UpdateContent(nullptr);
         }
         // changed mark of controls?
-        else if (const FmNavViewMarksChanged* pvmcHint = dynamic_cast<const 
FmNavViewMarksChanged*>(&rHint))
+        else if (rHint.GetId() == SfxHintId::FmNavViewMarksChanged)
         {
+            const FmNavViewMarksChanged* pvmcHint = static_cast<const 
FmNavViewMarksChanged*>(&rHint);
             
BroadcastMarkedObjects(pvmcHint->GetAffectedView()->GetMarkedObjectList());
         }
     }
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index c5d40e73b489..ca69f4de3ff4 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -116,7 +116,8 @@ class FmNavViewMarksChanged final : public SfxHint
 {
     FmFormView* pView;
 public:
-    FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; }
+    FmNavViewMarksChanged(FmFormView* pWhichView)
+        : SfxHint(SfxHintId::FmNavViewMarksChanged) { pView = pWhichView; }
 
     const FmFormView* GetAffectedView() const { return pView; }
 };
@@ -207,7 +208,8 @@ class FmNavRequestSelectHint final : public SfxHint
     bool                m_bMixedSelection;
 public:
     FmNavRequestSelectHint()
-        : m_bMixedSelection(false)
+        : SfxHint(SfxHintId::FmNavRequestSelect),
+          m_bMixedSelection(false)
     {
     }
 
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 22bd359d7de5..80035c8cd2fa 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -244,14 +244,16 @@ void SvxColorDockingWindow::dispose()
 
 void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint )
 {
-    const SfxPoolItemHint* pPoolItemHint = dynamic_cast<const 
SfxPoolItemHint*>(&rHint);
-    if ( pPoolItemHint )
+    if (rHint.GetId() == SfxHintId::PoolItem)
+    {
+        const SfxPoolItemHint* pPoolItemHint = static_cast<const 
SfxPoolItemHint*>(&rHint);
         if (auto pColorListItem = dynamic_cast<const 
SvxColorListItem*>(pPoolItemHint->GetObject()))
         {
             // The list of colors has changed
             pColorList = pColorListItem->GetColorList();
             FillValueSet();
         }
+    }
 }
 
 void SvxColorDockingWindow::FillValueSet()

Reply via email to