include/svl/hint.hxx                                         |   15 +
 sc/source/core/data/drwlayer.cxx                             |    2 
 sc/source/core/tool/hints.cxx                                |    9 
 sc/source/ui/Accessibility/AccessibilityHints.cxx            |   10 
 sc/source/ui/Accessibility/AccessibleDocument.cxx            |  139 +++++------
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |  111 ++++----
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx         |    3 
 sc/source/ui/app/uiitems.cxx                                 |    2 
 sc/source/ui/docshell/docsh.cxx                              |    7 
 sc/source/ui/inc/AccessibilityHints.hxx                      |   14 -
 sc/source/ui/inc/uiitems.hxx                                 |    4 
 sc/source/ui/unoobj/PivotTableDataProvider.cxx               |    3 
 sc/source/ui/unoobj/cellsuno.cxx                             |   21 -
 sc/source/ui/unoobj/chart2uno.cxx                            |    5 
 sc/source/ui/unoobj/dapiuno.cxx                              |    3 
 sc/source/ui/unoobj/datauno.cxx                              |    3 
 sc/source/ui/unoobj/docuno.cxx                               |    6 
 sc/source/ui/unoobj/editsrc.cxx                              |    2 
 sc/source/ui/unoobj/fielduno.cxx                             |    2 
 sc/source/ui/unoobj/linkuno.cxx                              |   23 -
 sc/source/ui/unoobj/unoreflist.cxx                           |    2 
 sc/source/ui/view/drawvie3.cxx                               |    6 
 sc/source/ui/view/prevwsh2.cxx                               |    3 
 sc/source/ui/view/tabvwsh5.cxx                               |    9 
 sw/source/core/doc/visiturl.cxx                              |    2 
 25 files changed, 218 insertions(+), 188 deletions(-)

New commits:
commit f2d096099a220e4caa2d532a5230785cbdb91eed
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Sep 3 15:46:08 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Sep 4 13:02:56 2024 +0200

    use less dynamic_cast when broadcasting SfxHint in sc
    
    Change-Id: I25ee079b5b14f82012f868ae6b348fa6982571a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172853
    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 c0a927a1c954..81600f610484 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -118,6 +118,17 @@ enum class SfxHintId {
     ScHiddenRowsChanged,
     ScSelectionChanged,
     ScClearCache,
+    ScTabDeleted,
+    ScTabSizeChanged,
+    ScPaint,
+    ScUpdateRef,
+    ScLinkRefreshed,
+    ScAutoStyle,
+    ScDBRangeRefreshed,
+    ScDataPilotModified,
+    ScTables,
+    ScEditView,
+    ScUnoRefUndo,
 
 // SC accessibility hints
     ScAccTableChanged,
@@ -127,6 +138,10 @@ enum class SfxHintId {
     ScAccLeaveEditMode,
     ScAccMakeDrawLayer,
     ScAccWindowResized,
+    ScAccGridWinFocusLost,
+    ScAccGridWinFocusGot,
+    ScAccWinFocusGot,
+    ScAccWinFocusLost,
 
 // sd hints
     SdViewShell,
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 9db9e653677e..95463a9c6d2d 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -203,6 +203,7 @@ void ScUndoAnchorData::Redo()
 }
 
 ScTabDeletedHint::ScTabDeletedHint( SCTAB nTabNo ) :
+    SfxHint(SfxHintId::ScTabDeleted),
     nTab( nTabNo )
 {
 }
@@ -212,6 +213,7 @@ ScTabDeletedHint::~ScTabDeletedHint()
 }
 
 ScTabSizeChangedHint::ScTabSizeChangedHint( SCTAB nTabNo ) :
+    SfxHint(SfxHintId::ScTabSizeChanged),
     nTab( nTabNo )
 {
 }
diff --git a/sc/source/core/tool/hints.cxx b/sc/source/core/tool/hints.cxx
index a3be243750a4..728fe27855b3 100644
--- a/sc/source/core/tool/hints.cxx
+++ b/sc/source/core/tool/hints.cxx
@@ -23,6 +23,7 @@
 // ScPaintHint - info what has to be repainted
 
 ScPaintHint::ScPaintHint( const ScRange& rRng, PaintPartFlags nPaint, 
tools::Long nMaxWidthAffectedHint ) :
+    SfxHint( SfxHintId::ScPaint ),
     aRange( rRng ),
     nParts( nPaint ),
     nWidthAffectedHint(nMaxWidthAffectedHint)
@@ -37,6 +38,7 @@ ScPaintHint::~ScPaintHint()
 
 ScUpdateRefHint::ScUpdateRefHint( UpdateRefMode eMode, const ScRange& rR,
                                     SCCOL nX, SCROW nY, SCTAB nZ ) :
+    SfxHint(SfxHintId::ScUpdateRef),
     eUpdateRefMode( eMode ),
     aRange( rR ),
     nDx( nX ),
@@ -52,7 +54,7 @@ ScUpdateRefHint::~ScUpdateRefHint()
 //      ScLinkRefreshedHint - a link has been refreshed
 
 ScLinkRefreshedHint::ScLinkRefreshedHint() :
-    nLinkType( ScLinkRefType::NONE )
+    SfxHint(SfxHintId::ScLinkRefreshed), nLinkType( ScLinkRefType::NONE )
 {
 }
 
@@ -85,6 +87,7 @@ void ScLinkRefreshedHint::SetAreaLink( const ScAddress& rPos )
 
 ScAutoStyleHint::ScAutoStyleHint( const ScRange& rR, OUString aSt1,
                                         sal_uLong nT, OUString aSt2 ) :
+    SfxHint(SfxHintId::ScAutoStyle),
     aRange( rR ),
     aStyle1(std::move( aSt1 )),
     aStyle2(std::move( aSt2 )),
@@ -97,7 +100,7 @@ ScAutoStyleHint::~ScAutoStyleHint()
 }
 
 ScDBRangeRefreshedHint::ScDBRangeRefreshedHint( const ScImportParam& rP )
-    : aParam(rP)
+    : SfxHint(SfxHintId::ScDBRangeRefreshed), aParam(rP)
 {
 }
 ScDBRangeRefreshedHint::~ScDBRangeRefreshedHint()
@@ -105,7 +108,7 @@ ScDBRangeRefreshedHint::~ScDBRangeRefreshedHint()
 }
 
 ScDataPilotModifiedHint::ScDataPilotModifiedHint( OUString aName )
-    : maName(std::move(aName))
+    : SfxHint(SfxHintId::ScDataPilotModified), maName(std::move(aName))
 {
 }
 ScDataPilotModifiedHint::~ScDataPilotModifiedHint()
diff --git a/sc/source/ui/Accessibility/AccessibilityHints.cxx 
b/sc/source/ui/Accessibility/AccessibilityHints.cxx
index 9e0ec879812e..893f45de5111 100644
--- a/sc/source/ui/Accessibility/AccessibilityHints.cxx
+++ b/sc/source/ui/Accessibility/AccessibilityHints.cxx
@@ -33,10 +33,8 @@ ScAccWinFocusGotHint::~ScAccWinFocusGotHint()
 
 //      ScAccGridWinFocusLostHint - the current grid window lost its focus (to 
another application, view or document)
 
-ScAccGridWinFocusLostHint::ScAccGridWinFocusLostHint(ScSplitPos eOld )
-    :
-    ScAccWinFocusLostHint(),
-    eOldGridWin(eOld)
+ScAccGridWinFocusLostHint:: ScAccGridWinFocusLostHint(ScSplitPos eOld )
+    : SfxHint(SfxHintId::ScAccGridWinFocusLost), eOldGridWin(eOld)
 {
 }
 
@@ -47,9 +45,7 @@ ScAccGridWinFocusLostHint::~ScAccGridWinFocusLostHint()
 //      ScAccGridWinFocusGotHint - the grid window got the focus (from another 
application, view or document)
 
 ScAccGridWinFocusGotHint::ScAccGridWinFocusGotHint(ScSplitPos eNew )
-    :
-    ScAccWinFocusGotHint(),
-    eNewGridWin(eNew)
+    : SfxHint(SfxHintId::ScAccGridWinFocusGot), eNewGridWin(eNew)
 {
 }
 
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 4ab426a2c36a..38d0665d97c7 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1424,8 +1424,9 @@ IMPL_LINK( ScAccessibleDocument, 
WindowChildEventListener, VclWindowEvent&, rEve
 
 void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
-    if (auto pFocusLostHint = dynamic_cast<const 
ScAccGridWinFocusLostHint*>(&rHint) )
+    if (rHint.GetId() == SfxHintId::ScAccGridWinFocusLost )
     {
+        auto pFocusLostHint = static_cast<const 
ScAccGridWinFocusLostHint*>(&rHint);
         if (pFocusLostHint->GetOldGridWin() == meSplitPos)
         {
             if (mxTempAcc.is() && mpTempAccEdit)
@@ -1436,8 +1437,9 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
                 CommitFocusLost();
         }
     }
-    else if (auto pFocusGotHint = dynamic_cast<const 
ScAccGridWinFocusGotHint*>(&rHint) )
+    else if (rHint.GetId() == SfxHintId::ScAccGridWinFocusGot)
     {
+        auto pFocusGotHint = static_cast<const 
ScAccGridWinFocusGotHint*>(&rHint);
         if (pFocusGotHint->GetNewGridWin() == meSplitPos)
         {
             uno::Reference<XAccessible> xAccessible;
@@ -1466,11 +1468,10 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
             }
         }
     }
-    else
+    else if (rHint.GetId() == SfxHintId::ScAccTableChanged)
     {
         // only notify if child exist, otherwise it is not necessary
-        if ((rHint.GetId() == SfxHintId::ScAccTableChanged) &&
-            mpAccessibleSpreadsheet.is())
+        if (mpAccessibleSpreadsheet.is())
         {
             FreeAccessibleSpreadsheet();
 
@@ -1486,86 +1487,86 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
             if (mpAccessibleSpreadsheet.is())
                 mpAccessibleSpreadsheet->FireFirstCellFocus();
         }
-        else if (rHint.GetId() == SfxHintId::ScAccMakeDrawLayer)
-        {
-            if (mpChildrenShapes)
-                mpChildrenShapes->SetDrawBroadcaster();
-        }
-        else if (rHint.GetId() == SfxHintId::ScAccEnterEditMode) // this event 
comes only on creating edit field of a cell
+    }
+    else if (rHint.GetId() == SfxHintId::ScAccMakeDrawLayer)
+    {
+        if (mpChildrenShapes)
+            mpChildrenShapes->SetDrawBroadcaster();
+    }
+    else if (rHint.GetId() == SfxHintId::ScAccEnterEditMode) // this event 
comes only on creating edit field of a cell
+    {
+        if (mpViewShell->GetViewData().GetEditActivePart() == meSplitPos)
         {
-            if (mpViewShell->GetViewData().GetEditActivePart() == meSplitPos)
+            ScViewData& rViewData = mpViewShell->GetViewData();
+            EditEngine const& rEditEng = 
rViewData.GetEditView(meSplitPos)->getEditEngine();
+            if (rEditEng.IsUpdateLayout())
             {
-                ScViewData& rViewData = mpViewShell->GetViewData();
-                EditEngine const& rEditEng = 
rViewData.GetEditView(meSplitPos)->getEditEngine();
-                if (rEditEng.IsUpdateLayout())
-                {
-                    mpTempAccEdit = new ScAccessibleEditObject(this, 
rViewData.GetEditView(meSplitPos),
-                        mpViewShell->GetWindowByPos(meSplitPos), 
GetCurrentCellName(),
-                        ScResId(STR_ACC_EDITLINE_DESCR), 
ScAccessibleEditObject::CellInEditMode);
-                    uno::Reference<XAccessible> xAcc = mpTempAccEdit;
+                mpTempAccEdit = new ScAccessibleEditObject(this, 
rViewData.GetEditView(meSplitPos),
+                    mpViewShell->GetWindowByPos(meSplitPos), 
GetCurrentCellName(),
+                    ScResId(STR_ACC_EDITLINE_DESCR), 
ScAccessibleEditObject::CellInEditMode);
+                uno::Reference<XAccessible> xAcc = mpTempAccEdit;
 
-                    AddChild(xAcc, true);
+                AddChild(xAcc, true);
 
-                    if (mpAccessibleSpreadsheet.is())
-                        mpAccessibleSpreadsheet->LostFocus();
-                    else
-                        CommitFocusLost();
+                if (mpAccessibleSpreadsheet.is())
+                    mpAccessibleSpreadsheet->LostFocus();
+                else
+                    CommitFocusLost();
 
-                    mpTempAccEdit->GotFocus();
-                }
+                mpTempAccEdit->GotFocus();
             }
         }
-        else if (rHint.GetId() == SfxHintId::ScAccLeaveEditMode)
+    }
+    else if (rHint.GetId() == SfxHintId::ScAccLeaveEditMode)
+    {
+        if (mxTempAcc.is())
         {
-            if (mxTempAcc.is())
+            if (mpTempAccEdit)
             {
-                if (mpTempAccEdit)
-                {
-                    mpTempAccEdit->LostFocus();
-                }
-                RemoveChild(mxTempAcc, true);
-                if (mpTempAccEdit)
-                {
-                    // tdf#125982 a11y use-after-free of editengine by
-                    // ScAccessibleEditObjectTextData living past the
-                    // the editengine of the editview passed in above
-                    // in ScAccEnterEditMode
-                    mpTempAccEdit->dispose();
-                    mpTempAccEdit = nullptr;
-                }
-                if (mpAccessibleSpreadsheet.is() && mpViewShell && 
mpViewShell->IsActive())
-                    mpAccessibleSpreadsheet->GotFocus();
-                else if( mpViewShell && mpViewShell->IsActive())
-                    CommitFocusGained();
+                mpTempAccEdit->LostFocus();
+            }
+            RemoveChild(mxTempAcc, true);
+            if (mpTempAccEdit)
+            {
+                // tdf#125982 a11y use-after-free of editengine by
+                // ScAccessibleEditObjectTextData living past the
+                // the editengine of the editview passed in above
+                // in ScAccEnterEditMode
+                mpTempAccEdit->dispose();
+                mpTempAccEdit = nullptr;
             }
+            if (mpAccessibleSpreadsheet.is() && mpViewShell && 
mpViewShell->IsActive())
+                mpAccessibleSpreadsheet->GotFocus();
+            else if( mpViewShell && mpViewShell->IsActive())
+                CommitFocusGained();
         }
-        else if ((rHint.GetId() == SfxHintId::ScAccVisAreaChanged) || 
(rHint.GetId() == SfxHintId::ScAccWindowResized))
-        {
-            tools::Rectangle aOldVisArea(maVisArea);
-            maVisArea = GetVisibleArea_Impl();
+    }
+    else if ((rHint.GetId() == SfxHintId::ScAccVisAreaChanged) || 
(rHint.GetId() == SfxHintId::ScAccWindowResized))
+    {
+        tools::Rectangle aOldVisArea(maVisArea);
+        maVisArea = GetVisibleArea_Impl();
 
-            if (maVisArea != aOldVisArea)
+        if (maVisArea != aOldVisArea)
+        {
+            if (maVisArea.GetSize() != aOldVisArea.GetSize())
             {
-                if (maVisArea.GetSize() != aOldVisArea.GetSize())
-                {
-                    AccessibleEventObject aEvent;
-                    aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
-                    aEvent.Source = uno::Reference< XAccessibleContext >(this);
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
+                aEvent.Source = uno::Reference< XAccessibleContext >(this);
 
-                    CommitChange(aEvent);
+                CommitChange(aEvent);
 
-                    if (mpAccessibleSpreadsheet.is())
-                        mpAccessibleSpreadsheet->BoundingBoxChanged();
-                    if (mpAccessibleSpreadsheet.is() && mpViewShell && 
mpViewShell->IsActive())
-                        mpAccessibleSpreadsheet->FireFirstCellFocus();
-                }
-                else if (mpAccessibleSpreadsheet.is())
-                {
-                    mpAccessibleSpreadsheet->VisAreaChanged();
-                }
-                if (mpChildrenShapes)
-                    mpChildrenShapes->VisAreaChanged();
+                if (mpAccessibleSpreadsheet.is())
+                    mpAccessibleSpreadsheet->BoundingBoxChanged();
+                if (mpAccessibleSpreadsheet.is() && mpViewShell && 
mpViewShell->IsActive())
+                    mpAccessibleSpreadsheet->FireFirstCellFocus();
             }
+            else if (mpAccessibleSpreadsheet.is())
+            {
+                mpAccessibleSpreadsheet->VisAreaChanged();
+            }
+            if (mpChildrenShapes)
+                mpChildrenShapes->VisAreaChanged();
         }
     }
 
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx 
b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index cddf1c24237f..bed4ddb69669 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1193,90 +1193,87 @@ void SAL_CALL 
ScAccessibleDocumentPagePreview::disposing()
 
 void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScAccWinFocusLostHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScAccWinFocusLost )
     {
         CommitFocusLost();
     }
-    else if ( dynamic_cast<const ScAccGridWinFocusLostHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScAccGridWinFocusLost )
     {
         CommitFocusLost();
     }
-    else if ( dynamic_cast<const ScAccWinFocusGotHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScAccWinFocusGot )
     {
         CommitFocusGained();
     }
-    else if ( dynamic_cast<const ScAccGridWinFocusGotHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScAccGridWinFocusGot )
     {
         CommitFocusGained();
     }
-    else
+    else if (rHint.GetId() == SfxHintId::ScDataChanged)
     {
         // only notify if child exist, otherwise it is not necessary
-        if (rHint.GetId() == SfxHintId::ScDataChanged)
+        if (mpTable.is()) // if there is no table there is nothing to notify, 
because no one recognizes the change
         {
-            if (mpTable.is()) // if there is no table there is nothing to 
notify, because no one recognizes the change
             {
-                {
-                    uno::Reference<XAccessible> xAcc = mpTable;
-                    AccessibleEventObject aEvent;
-                    aEvent.EventId = AccessibleEventId::CHILD;
-                    aEvent.Source = uno::Reference< XAccessibleContext >(this);
-                    aEvent.OldValue <<= xAcc;
-                    aEvent.IndexHint = -1;
-                    CommitChange(aEvent);
-                }
-
-                mpTable->dispose();
-                mpTable.clear();
+                uno::Reference<XAccessible> xAcc = mpTable;
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::CHILD;
+                aEvent.Source = uno::Reference< XAccessibleContext >(this);
+                aEvent.OldValue <<= xAcc;
+                aEvent.IndexHint = -1;
+                CommitChange(aEvent);
             }
 
-            Size aOutputSize;
-            vcl::Window* pSizeWindow = mpViewShell->GetWindow();
-            if ( pSizeWindow )
-                aOutputSize = pSizeWindow->GetOutputSizePixel();
-            tools::Rectangle aVisRect( Point(), aOutputSize );
-            GetNotesChildren()->DataChanged(aVisRect);
+            mpTable->dispose();
+            mpTable.clear();
+        }
 
-            GetShapeChildren()->DataChanged();
+        Size aOutputSize;
+        vcl::Window* pSizeWindow = mpViewShell->GetWindow();
+        if ( pSizeWindow )
+            aOutputSize = pSizeWindow->GetOutputSizePixel();
+        tools::Rectangle aVisRect( Point(), aOutputSize );
+        GetNotesChildren()->DataChanged(aVisRect);
 
-            const ScPreviewLocationData& rData = 
mpViewShell->GetLocationData();
-            ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), 
GetNotesChildren(), GetShapeChildren() );
+        GetShapeChildren()->DataChanged();
 
-            if (aCount.nTables > 0)
-            {
-                //! order is background shapes, header, table or notes, 
footer, foreground shapes, controls
-                sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
+        const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+        ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), 
GetNotesChildren(), GetShapeChildren() );
 
-                mpTable = new ScAccessiblePreviewTable( this, mpViewShell, 
nIndex );
-                mpTable->Init();
+        if (aCount.nTables > 0)
+        {
+            //! order is background shapes, header, table or notes, footer, 
foreground shapes, controls
+            sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
 
-                {
-                    uno::Reference<XAccessible> xAcc = mpTable;
-                    AccessibleEventObject aEvent;
-                    aEvent.EventId = AccessibleEventId::CHILD;
-                    aEvent.Source = uno::Reference< XAccessibleContext >(this);
-                    aEvent.NewValue <<= xAcc;
-                    aEvent.IndexHint = -1;
-                    CommitChange(aEvent);
-                }
+            mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex 
);
+            mpTable->Init();
+
+            {
+                uno::Reference<XAccessible> xAcc = mpTable;
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::CHILD;
+                aEvent.Source = uno::Reference< XAccessibleContext >(this);
+                aEvent.NewValue <<= xAcc;
+                aEvent.IndexHint = -1;
+                CommitChange(aEvent);
             }
         }
-        else if (rHint.GetId() == SfxHintId::ScAccVisAreaChanged)
-        {
-            Size aOutputSize;
-            vcl::Window* pSizeWindow = mpViewShell->GetWindow();
-            if ( pSizeWindow )
-                aOutputSize = pSizeWindow->GetOutputSizePixel();
-            tools::Rectangle aVisRect( Point(), aOutputSize );
-            GetNotesChildren()->DataChanged(aVisRect);
+    }
+    else if (rHint.GetId() == SfxHintId::ScAccVisAreaChanged)
+    {
+        Size aOutputSize;
+        vcl::Window* pSizeWindow = mpViewShell->GetWindow();
+        if ( pSizeWindow )
+            aOutputSize = pSizeWindow->GetOutputSizePixel();
+        tools::Rectangle aVisRect( Point(), aOutputSize );
+        GetNotesChildren()->DataChanged(aVisRect);
 
-            GetShapeChildren()->VisAreaChanged();
+        GetShapeChildren()->VisAreaChanged();
 
-            AccessibleEventObject aEvent;
-            aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
-            aEvent.Source = uno::Reference< XAccessibleContext >(this);
-            CommitChange(aEvent);
-        }
+        AccessibleEventObject aEvent;
+        aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
+        aEvent.Source = uno::Reference< XAccessibleContext >(this);
+        CommitChange(aEvent);
     }
     ScAccessibleDocumentBase::Notify(rBC, rHint);
 }
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index ae88d761dfed..6b7162718225 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -411,8 +411,9 @@ void ScAccessibleSpreadsheet::VisAreaChanged()
 
 void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& 
rHint )
 {
-    if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
+        auto pRefHint = static_cast<const ScUpdateRefHint*>(&rHint);
         if (pRefHint->GetMode() == URM_INSDEL && pRefHint->GetDz() == 0) 
//test whether table is inserted or deleted
         {
             if (((pRefHint->GetRange().aStart.Col() == maRange.aStart.Col()) &&
diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx
index c163582d4a8e..a22afdbf16d5 100644
--- a/sc/source/ui/app/uiitems.cxx
+++ b/sc/source/ui/app/uiitems.cxx
@@ -85,6 +85,7 @@ void ScInputStatusItem::SetMisspellRanges( const 
std::vector<editeng::MisspellRa
  * Adapt Views when inserting/deleting a table
  */
 ScTablesHint::ScTablesHint(sal_uInt16 nNewId, SCTAB nTable1, SCTAB nTable2) :
+    SfxHint(SfxHintId::ScTables),
     nId( nNewId ),
     nTab1( nTable1 ),
     nTab2( nTable2 )
@@ -109,6 +110,7 @@ ScIndexHint::~ScIndexHint()
  * Create new EditView for Cursorposition
  */
 ScEditViewHint::ScEditViewHint( ScEditEngineDefaulter* pEngine, const 
ScAddress& rCurPos ) :
+    SfxHint(SfxHintId::ScEditView),
     pEditEngine( pEngine ),
     aCursorPos( rCurPos )
 {
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 6250ca15b24e..5ece608a0766 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -736,9 +736,9 @@ bool ScDocShell::Load( SfxMedium& rMedium )
 
 void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    const ScTablesHint* pScHint = dynamic_cast< const ScTablesHint* >( &rHint 
);
-    if (pScHint)
+    if (rHint.GetId() == SfxHintId::ScTables)
     {
+        const ScTablesHint* pScHint = static_cast< const ScTablesHint* >( 
&rHint );
         if (pScHint->GetTablesHintId() == SC_TAB_INSERTED)
         {
             uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = 
m_pDocument->GetVbaEventProcessor();
@@ -755,8 +755,9 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
 
     if ( auto pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint) 
) // Template changed
         NotifyStyle( *pStyleSheetHint );
-    else if ( auto pStlHint = dynamic_cast<const ScAutoStyleHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScAutoStyle )
     {
+        auto pStlHint = static_cast<const ScAutoStyleHint*>(&rHint);
         //! direct call for AutoStyles
 
         //  this is called synchronously from ScInterpreter::ScStyle,
diff --git a/sc/source/ui/inc/AccessibilityHints.hxx 
b/sc/source/ui/inc/AccessibilityHints.hxx
index 41b8415a65dc..cae2270a81dd 100644
--- a/sc/source/ui/inc/AccessibilityHints.hxx
+++ b/sc/source/ui/inc/AccessibilityHints.hxx
@@ -22,19 +22,21 @@
 #include "viewdata.hxx"
 #include <svl/hint.hxx>
 
-class ScAccWinFocusLostHint : public SfxHint
+class ScAccWinFocusLostHint final : public SfxHint
 {
 public:
-                virtual ~ScAccWinFocusLostHint() override;
+    ScAccWinFocusLostHint() : SfxHint(SfxHintId::ScAccWinFocusLost) {}
+    virtual ~ScAccWinFocusLostHint() override;
 };
 
-class ScAccWinFocusGotHint : public SfxHint
+class ScAccWinFocusGotHint final : public SfxHint
 {
 public:
-                virtual ~ScAccWinFocusGotHint() override;
+    ScAccWinFocusGotHint() : SfxHint(SfxHintId::ScAccWinFocusGot) {}
+    virtual ~ScAccWinFocusGotHint() override;
 };
 
-class ScAccGridWinFocusLostHint : public ScAccWinFocusLostHint
+class ScAccGridWinFocusLostHint final : public SfxHint
 {
     ScSplitPos  eOldGridWin;
 public:
@@ -44,7 +46,7 @@ public:
     ScSplitPos  GetOldGridWin() const { return eOldGridWin; }
 };
 
-class ScAccGridWinFocusGotHint : public ScAccWinFocusGotHint
+class ScAccGridWinFocusGotHint final : public SfxHint
 {
     ScSplitPos  eNewGridWin;
 public:
diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx
index 71216eb687b9..84625b899f7b 100644
--- a/sc/source/ui/inc/uiitems.hxx
+++ b/sc/source/ui/inc/uiitems.hxx
@@ -80,7 +80,7 @@ public:
 #define SC_TABS_INSERTED    6
 #define SC_TABS_DELETED     7
 
-class ScTablesHint : public SfxHint
+class ScTablesHint final : public SfxHint
 {
     sal_uInt16 nId;
     SCTAB nTab1;
@@ -95,7 +95,7 @@ public:
     SCTAB           GetTab2() const         { return nTab2; }
 };
 
-class ScEditViewHint : public SfxHint
+class ScEditViewHint final : public SfxHint
 {
     ScEditEngineDefaulter*  pEditEngine;
     ScAddress                   aCursorPos;
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx 
b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 16a8237e391b..5dc82b93bff0 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -160,8 +160,9 @@ void PivotTableDataProvider::Notify(SfxBroadcaster& 
/*rBroadcaster*/, const SfxH
     }
     else if (m_pDocument)
     {
-        if (auto pDataPilotHint = dynamic_cast<const 
ScDataPilotModifiedHint*>(&rHint))
+        if (rHint.GetId() == SfxHintId::ScDataPilotModified)
         {
+            auto pDataPilotHint = static_cast<const 
ScDataPilotModifiedHint*>(&rHint);
             if (pDataPilotHint->GetName() == m_sPivotTableName)
             {
                 m_bNeedsUpdate = true;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2c777b43178b..4d4bf1a03c5a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1531,8 +1531,9 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
         if ( !aValueListeners.empty() )
             bGotDataChangedHint = true;
     }
-    else if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
+        auto pRefHint = static_cast<const ScUpdateRefHint*>(&rHint);
         ScDocument& rDoc = pDocShell->GetDocument();
         std::unique_ptr<ScRangeList> pUndoRanges;
         if ( rDoc.HasUnoRefUndo() )
@@ -1563,8 +1564,9 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
                 rDoc.AddUnoRefChange( nObjectId, *pUndoRanges );
         }
     }
-    else if ( auto pUndoHint = dynamic_cast<const ScUnoRefUndoHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScUnoRefUndo )
     {
+        auto pUndoHint = static_cast<const ScUnoRefUndoHint*>(&rHint);
         if ( pUndoHint->GetObjectId() == nObjectId )
         {
             // restore ranges from hint
@@ -8584,8 +8586,9 @@ ScCellsObj::~ScCellsObj()
 
 void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
+        auto pRefHint = static_cast<const ScUpdateRefHint*>(&rHint);
         aRanges.UpdateReference( pRefHint->GetMode(), 
&pDocShell->GetDocument(), pRefHint->GetRange(),
                                         pRefHint->GetDx(), pRefHint->GetDy(), 
pRefHint->GetDz() );
     }
@@ -8695,9 +8698,9 @@ void ScCellsEnumeration::Advance_Impl()
 
 void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    const ScUpdateRefHint* pRefHint = dynamic_cast<const 
ScUpdateRefHint*>(&rHint);
-    if ( pRefHint )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
+        const ScUpdateRefHint* pRefHint = static_cast<const 
ScUpdateRefHint*>(&rHint);
         if (pDocShell)
         {
             aRanges.UpdateReference( pRefHint->GetMode(), 
&pDocShell->GetDocument(), pRefHint->GetRange(),
@@ -8767,7 +8770,7 @@ ScCellFormatsObj::~ScCellFormatsObj()
 
 void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! aTotalRange...
     }
@@ -8929,7 +8932,7 @@ rtl::Reference<ScCellRangeObj> 
ScCellFormatsEnumeration::NextObject_Impl()
 
 void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! and now???
     }
@@ -8978,7 +8981,7 @@ ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
 
 void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! aTotalRange...
     }
@@ -9234,7 +9237,7 @@ 
ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
 
 void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! and now ???
     }
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index dbfd8887d810..8957416e4025 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2802,7 +2802,7 @@ void 
ScChart2DataSequence::StopListeningToAllExternalRefs()
 
 void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& 
rHint)
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         // Create a range list from the token list, have the range list
         // updated, and bring the change back to the token list.
@@ -2846,8 +2846,9 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& 
/*rBC*/, const SfxHint& rHint
                 m_pDocument->AddUnoRefChange(m_nObjectId, *pUndoRanges);
         }
     }
-    else if ( auto pUndoHint = dynamic_cast<const ScUnoRefUndoHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScUnoRefUndo )
     {
+        auto pUndoHint = static_cast<const ScUnoRefUndoHint*>(&rHint);
         do
         {
             if (pUndoHint->GetObjectId() != m_nObjectId)
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index dde9fded610f..5e3871481456 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1219,8 +1219,9 @@ void ScDataPilotTableObj::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
         if (pDataPilotHint->GetName() == aName)
             Refreshed_Impl();
     }
-    else if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
+        auto pRefHint = static_cast<const ScUpdateRefHint*>(&rHint);
         ScRange aRange( 0, 0, nTab );
         ScRangeList aRanges( aRange );
         if ( aRanges.UpdateReference( pRefHint->GetMode(), 
&GetDocShell()->GetDocument(), pRefHint->GetRange(),
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 839e328b420f..bb31d5f9e7fc 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1592,8 +1592,9 @@ void ScDatabaseRangeObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
     if ( rHint.GetId() == SfxHintId::Dying )
         pDocShell = nullptr;
-    else if ( auto pRefreshHint = dynamic_cast<const 
ScDBRangeRefreshedHint*>(&rHint) )
+    else if ( rHint.GetId() == SfxHintId::ScDBRangeRefreshed )
     {
+        auto pRefreshHint = static_cast<const ScDBRangeRefreshedHint*>(&rHint);
         ScDBData* pDBData = GetDBData_Impl();
         ScImportParam aParam;
         pDBData->GetImportParam(aParam);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 9ace7d808b48..e1a4fdb9ec14 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4527,7 +4527,7 @@ ScTableColumnsObj::~ScTableColumnsObj()
 
 void ScTableColumnsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! update of references for sheet and its start/end
     }
@@ -4782,7 +4782,7 @@ ScTableRowsObj::~ScTableRowsObj()
 
 void ScTableRowsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! update of references for sheet and its start/end
     }
@@ -5201,7 +5201,7 @@ ScScenariosObj::~ScScenariosObj()
 
 void ScScenariosObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! update of references for sheet and its start/end
     }
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index d39358e61f7d..5bedf4ece637 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -183,7 +183,7 @@ void ScAnnotationEditSource::UpdateData()
 
 void ScAnnotationEditSource::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! reference update
     }
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index e3359d02d0e4..e14cfaa4cfcb 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -299,7 +299,7 @@ ScCellFieldsObj::~ScCellFieldsObj()
 
 void ScCellFieldsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScUpdateRef )
     {
         //! update of references
     }
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 33d27d8c8f8d..53e34a58a059 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -94,8 +94,9 @@ void ScSheetLinkObj::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
     //! notify if links in document are changed
     //  UpdateRef is not needed here
 
-    if ( auto pRefreshHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScLinkRefreshed )
     {
+        auto pRefreshHint = static_cast<const ScLinkRefreshedHint*>(&rHint);
         if ( pRefreshHint->GetLinkType() == ScLinkRefType::SHEET && 
pRefreshHint->GetUrl() == aFileName )
             Refreshed_Impl();
     }
@@ -590,8 +591,9 @@ void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
     //! notify if links in document are changed
     //  UpdateRef is not needed here
 
-    if ( auto pRefreshedHint = dynamic_cast<const 
ScLinkRefreshedHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScLinkRefreshed )
     {
+        auto pRefreshedHint = static_cast<const ScLinkRefreshedHint*>(&rHint);
         if ( pRefreshedHint->GetLinkType() == ScLinkRefType::AREA )
         {
             //  get this link to compare dest position
@@ -600,11 +602,8 @@ void ScAreaLinkObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
                 Refreshed_Impl();
         }
     }
-    else
-    {
-        if ( rHint.GetId() == SfxHintId::Dying )
-            pDocShell = nullptr;       // pointer is invalid
-    }
+    else if ( rHint.GetId() == SfxHintId::Dying )
+        pDocShell = nullptr;       // pointer is invalid
 }
 
 // XFileLink
@@ -1010,19 +1009,17 @@ void ScDDELinkObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
     //! notify if links in document are changed
     //  UpdateRef is not needed here
 
-    if ( auto pRefreshedHint = dynamic_cast<const 
ScLinkRefreshedHint*>(&rHint) )
+    if ( rHint.GetId() == SfxHintId::ScLinkRefreshed )
     {
+        auto pRefreshedHint = static_cast<const ScLinkRefreshedHint*>(&rHint);
         if ( pRefreshedHint->GetLinkType() == ScLinkRefType::DDE &&
              pRefreshedHint->GetDdeAppl()  == aAppl &&
              pRefreshedHint->GetDdeTopic() == aTopic &&
              pRefreshedHint->GetDdeItem()  == aItem )       //! mode is ignored
             Refreshed_Impl();
     }
-    else
-    {
-        if ( rHint.GetId() == SfxHintId::Dying )
-            pDocShell = nullptr;       // pointer is invalid
-    }
+    else if ( rHint.GetId() == SfxHintId::Dying )
+        pDocShell = nullptr;       // pointer is invalid
 }
 
 // XNamed
diff --git a/sc/source/ui/unoobj/unoreflist.cxx 
b/sc/source/ui/unoobj/unoreflist.cxx
index fff4d0fd9d08..101d0c9995fa 100644
--- a/sc/source/ui/unoobj/unoreflist.cxx
+++ b/sc/source/ui/unoobj/unoreflist.cxx
@@ -44,7 +44,7 @@ void ScUnoRefList::Undo( ScDocument* pDoc )
 }
 
 ScUnoRefUndoHint::ScUnoRefUndoHint( ScUnoRefEntry aRefEntry ) :
-    aEntry(std::move( aRefEntry ))
+    SfxHint(SfxHintId::ScUnoRefUndo), aEntry(std::move( aRefEntry ))
 {
 }
 
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index dfb77ccc9fd0..f5fba7aa5587 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -207,8 +207,9 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
         adjustAnchoredPosition(*pSdrHint, rDoc, nTab);
         FmFormView::Notify( rBC,rHint );
     }
-    else if (auto pDeletedHint = dynamic_cast<const 
ScTabDeletedHint*>(&rHint))                        // Sheet has been deleted
+    else if (rHint.GetId() == SfxHintId::ScTabDeleted) // Sheet has been 
deleted
     {
+        auto pDeletedHint = static_cast<const ScTabDeletedHint*>(&rHint);
         SCTAB nDelTab = pDeletedHint->GetTab();
         if (ValidTab(nDelTab))
         {
@@ -217,8 +218,9 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
                 HideSdrPage();
         }
     }
-    else if (auto pChangedHint = dynamic_cast<const 
ScTabSizeChangedHint*>(&rHint))               // Size has been changed
+    else if (rHint.GetId() == SfxHintId::ScTabSizeChanged) // Size has been 
changed
     {
+        auto pChangedHint = static_cast<const ScTabSizeChangedHint*>(&rHint);
         if ( nTab == pChangedHint->GetTab() )
             UpdateWorkArea();
     }
diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx
index bb15ac24ad33..ab7f3f1c3c65 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -36,8 +36,9 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
         if(SdrHintKind::ObjectChange == pSdrHint->GetKind())
             bDataChanged = true;
     }
-    else if (const ScPaintHint* pPaintHint = dynamic_cast<const 
ScPaintHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::ScPaint)
     {
+        const ScPaintHint* pPaintHint = static_cast<const 
ScPaintHint*>(&rHint);
         PaintPartFlags nParts = pPaintHint->GetParts();
         if (nParts & ( PaintPartFlags::Grid | PaintPartFlags::Left | 
PaintPartFlags::Top | PaintPartFlags::Size ))
             bDataChanged = true;
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 0cd44d2caf7e..43d889dc5f64 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -41,8 +41,9 @@
 
 void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
-    if (const ScPaintHint* pPaintHint = dynamic_cast<const 
ScPaintHint*>(&rHint))                    // draw new
+    if (rHint.GetId() == SfxHintId::ScPaint) // draw new
     {
+        const ScPaintHint* pPaintHint = static_cast<const 
ScPaintHint*>(&rHint);
         PaintPartFlags nParts = pPaintHint->GetParts();
         SCTAB nTab = GetViewData().GetTabNo();
         if (pPaintHint->GetStartTab() <= nTab && pPaintHint->GetEndTab() >= 
nTab)
@@ -78,9 +79,10 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
             HideNoteMarker();
         }
     }
-    else if (auto pEditViewHint = dynamic_cast<const ScEditViewHint*>(&rHint)) 
                // create Edit-View
+    else if (rHint.GetId() == SfxHintId::ScEditView) // create Edit-View
     {
         //  ScEditViewHint is only received at active view
+        auto pEditViewHint = static_cast<const ScEditViewHint*>(&rHint);
 
         SCTAB nTab = GetViewData().GetTabNo();
         if ( pEditViewHint->GetTab() == nTab )
@@ -108,8 +110,9 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
             }
         }
     }
-    else if (auto pTablesHint = dynamic_cast<const ScTablesHint*>(&rHint))     
          // table insert / deleted
+    else if (rHint.GetId() == SfxHintId::ScTables) // table insert / deleted
     {
+        auto pTablesHint = static_cast<const ScTablesHint*>(&rHint);
         // first fetch current table (can be changed during DeleteTab on 
ViewData)
         SCTAB nActiveTab = GetViewData().GetTabNo();
 
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index a12543a4ef55..fa89ec4f7c2c 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -42,7 +42,7 @@ SwURLStateChanged::~SwURLStateChanged()
 
 void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
 {
-    if( !(dynamic_cast<const INetURLHistoryHint*>(&rHint) && 
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) )
+    if( rHint.GetId() != SfxHintId::INetURLHistory || 
!m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() )
         return;
 
     // This URL has been changed:

Reply via email to