[Libreoffice-commits] core.git: chart2/source include/svl reportdesign/source sc/source sd/source svx/source sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 23 12:11:42 UTC 2019


 chart2/source/view/main/ChartView.cxx                        |    4 
 include/svl/hint.hxx                                         |    3 
 reportdesign/source/ui/report/SectionView.cxx                |   21 +--
 sc/source/ui/Accessibility/AccessibleDocument.cxx            |   66 +++++------
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |   63 ----------
 sc/source/ui/Accessibility/DrawModelBroadcaster.cxx          |    4 
 sc/source/ui/view/drawvie3.cxx                               |    3 
 sc/source/ui/view/prevwsh2.cxx                               |    3 
 sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx   |   12 +-
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx     |    4 
 sd/source/ui/animations/motionpathtag.cxx                    |    2 
 sd/source/ui/app/sdxfer.cxx                                  |    4 
 sd/source/ui/dlg/SpellDialogChildWindow.cxx                  |   10 -
 sd/source/ui/sidebar/MasterPageObserver.cxx                  |    4 
 sd/source/ui/slidesorter/controller/SlsListener.cxx          |    4 
 sd/source/ui/tools/EventMultiplexer.cxx                      |    4 
 sd/source/ui/unoidl/unomodel.cxx                             |   17 +-
 sd/source/ui/unoidl/unopback.cxx                             |   18 +--
 sd/source/ui/view/drawview.cxx                               |    2 
 svx/source/accessibility/GraphCtlAccessibleContext.cxx       |    5 
 svx/source/core/extedit.cxx                                  |    9 -
 svx/source/form/fmundo.cxx                                   |    3 
 svx/source/form/fmvwimp.cxx                                  |    6 -
 svx/source/form/navigatortreemodel.cxx                       |    4 
 svx/source/svdraw/svdedxv.cxx                                |    5 
 svx/source/svdraw/svdmodel.cxx                               |   12 +-
 svx/source/svdraw/svdmrkv.cxx                                |    5 
 svx/source/svdraw/svdpage.cxx                                |    3 
 svx/source/svdraw/svdpntv.cxx                                |    5 
 svx/source/unodraw/UnoNameItemTable.cxx                      |    7 -
 svx/source/unodraw/unomtabl.cxx                              |   10 +
 svx/source/unodraw/unoshape.cxx                              |   17 +-
 svx/source/unodraw/unoshtxt.cxx                              |    3 
 sw/source/core/access/accmap.cxx                             |    9 -
 34 files changed, 150 insertions(+), 201 deletions(-)

New commits:
commit 10c934147d469965dba6abc78efd02759a010b8e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 23 09:26:46 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 23 14:10:38 2019 +0200

    tdf#113266 slow opening XLS with 45 MB drawing
    
    Some hot-spots around dynamic_cast of SdrHint, so avoid that by creating
    special SfxHintId::ThisIsAnSdrHint
    
    The most common CPU hot-spot was in SvxShape::Notify, the other changes
    are just for consistency.
    
    Also remove some dead code in ScShapeChildren, the Notify method was
    doing nothing useful.
    
    Change-Id: I696db1fcafc09bb10bf23ac673de292746141491
    Reviewed-on: https://gerrit.libreoffice.org/71108
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 872406f9f16b..8b0548f909ee 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2610,9 +2610,9 @@ void ChartView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
         }
     }
 
-    const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >(&rHint);
-    if( !pSdrHint )
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
         return;
+    const SdrHint* pSdrHint = static_cast< const SdrHint* >(&rHint);
 
     bool bShapeChanged = false;
     switch( pSdrHint->GetKind() )
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 98d0ca81de55..708986e31631 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -112,6 +112,8 @@ enum class SfxHintId {
     SwDrawViewsCreated,
     SwSplitNodeOperation,
     SwSectionFrameMoveAndDelete,
+
+    ThisIsAnSdrHint // used to avoid dynamic_cast
 };
 
 template< typename charT, typename traits >
@@ -190,6 +192,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
     case SfxHintId::SwDrawViewsCreated: return stream << "SwDrawViewsCreated";
     case SfxHintId::SwSplitNodeOperation: return stream << "SwSplitNodeOperation";
     case SfxHintId::SwSectionFrameMoveAndDelete: return stream << "SwSectionFrameMoveAndDelete";
+    case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
     default: return stream << "unk(" << std::to_string(int(id)) << ")";
     }
 }
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index 1181581737cb..9a23632da48a 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -128,17 +128,16 @@ void OSectionView::MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin
 void OSectionView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
     SdrView::Notify(rBC,rHint);
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if ( pSdrHint )
-    {
-        const SdrObject* pObj = pSdrHint->GetObject();
-        const SdrHintKind eKind = pSdrHint->GetKind();
-        // check for change of selected object
-        if(SdrHintKind::ObjectChange == eKind && pObj && IsObjMarked(pObj))
-            AdjustMarkHdl();
-        else if ( eKind == SdrHintKind::ObjectRemoved )
-            ObjectRemovedInAliveMode(pObj);
-    }
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+    const SdrObject* pObj = pSdrHint->GetObject();
+    const SdrHintKind eKind = pSdrHint->GetKind();
+    // check for change of selected object
+    if(SdrHintKind::ObjectChange == eKind && pObj && IsObjMarked(pObj))
+        AdjustMarkHdl();
+    else if ( eKind == SdrHintKind::ObjectRemoved )
+        ObjectRemovedInAliveMode(pObj);
 }
 
 
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 0c7d06d86352..761ec7849092 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -396,45 +396,45 @@ void ScChildrenShapes::SetDrawBroadcaster()
 
 void ScChildrenShapes::Notify(SfxBroadcaster&, const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint)
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+
+    SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
+    if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->getSdrPageFromSdrObject() == GetDrawPage()) &&
+        (pObj->getSdrPageFromSdrObject() == pObj->getParentSdrObjListFromSdrObject()) ) //only do something if the object lies direct on the page
     {
-        SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
-        if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->getSdrPageFromSdrObject() == GetDrawPage()) &&
-            (pObj->getSdrPageFromSdrObject() == pObj->getParentSdrObjListFromSdrObject()) ) //only do something if the object lies direct on the page
+        switch (pSdrHint->GetKind())
         {
-            switch (pSdrHint->GetKind())
+            case SdrHintKind::ObjectChange :         // object changed
             {
-                case SdrHintKind::ObjectChange :         // object changed
-                {
-                    uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
-                    if (xShape.is())
-                    {
-                        std::sort(maZOrderedShapes.begin(), maZOrderedShapes.end(), ScShapeDataLess()); // sort, because the z index or layer could be changed
-                        CheckWhetherAnchorChanged(xShape);
-                    }
-                }
-                break;
-                case SdrHintKind::ObjectInserted :    // new drawing object inserted
-                {
-                    uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
-                    if (xShape.is())
-                        AddShape(xShape, true);
-                }
-                break;
-                case SdrHintKind::ObjectRemoved :     // Removed drawing object from list
+                uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+                if (xShape.is())
                 {
-                    uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
-                    if (xShape.is())
-                        RemoveShape(xShape);
+                    std::sort(maZOrderedShapes.begin(), maZOrderedShapes.end(), ScShapeDataLess()); // sort, because the z index or layer could be changed
+                    CheckWhetherAnchorChanged(xShape);
                 }
-                break;
-                default :
-                {
-                    // other events are not interesting
-                }
-                break;
             }
+            break;
+            case SdrHintKind::ObjectInserted :    // new drawing object inserted
+            {
+                uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+                if (xShape.is())
+                    AddShape(xShape, true);
+            }
+            break;
+            case SdrHintKind::ObjectRemoved :     // Removed drawing object from list
+            {
+                uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+                if (xShape.is())
+                    RemoveShape(xShape);
+            }
+            break;
+            default :
+            {
+                // other events are not interesting
+            }
+            break;
         }
     }
 }
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 81b8cf79460e..8f21926bec50 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -589,16 +589,10 @@ struct ScShapeRange
 
 typedef std::vector<ScShapeRange> ScShapeRangeVec;
 
-class ScShapeChildren : public SfxListener,
-        public ::accessibility::IAccessibleParent
+class ScShapeChildren : public ::accessibility::IAccessibleParent
 {
 public:
     ScShapeChildren(ScPreviewShell* pViewShell, ScAccessibleDocumentPagePreview* pAccDoc);
-    virtual ~ScShapeChildren() override;
-
-    ///=====  SfxListener  =====================================================
-
-    virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
 
     ///=====  IAccessibleParent  ==============================================
 
@@ -625,7 +619,6 @@ public:
     void DataChanged();
     void VisAreaChanged() const;
 
-    void SetDrawBroadcaster();
 private:
     ScAccessibleDocumentPagePreview* const mpAccDoc;
     ScPreviewShell* mpViewShell;
@@ -648,56 +641,6 @@ ScShapeChildren::ScShapeChildren(ScPreviewShell* pViewShell, ScAccessibleDocumen
     mpViewShell(pViewShell),
     maShapeRanges(SC_PREVIEW_MAXRANGES)
 {
-    if (pViewShell)
-    {
-        SfxBroadcaster* pDrawBC = pViewShell->GetDocument().GetDrawBroadcaster();
-        if (pDrawBC)
-            StartListening(*pDrawBC);
-    }
-}
-
-ScShapeChildren::~ScShapeChildren()
-{
-    if (mpViewShell)
-    {
-        SfxBroadcaster* pDrawBC = mpViewShell->GetDocument().GetDrawBroadcaster();
-        if (pDrawBC)
-            EndListening(*pDrawBC);
-    }
-}
-
-void ScShapeChildren::SetDrawBroadcaster()
-{
-    if (mpViewShell)
-    {
-        SfxBroadcaster* pDrawBC = mpViewShell->GetDocument().GetDrawBroadcaster();
-        if (pDrawBC)
-            StartListening(*pDrawBC, DuplicateHandling::Prevent);
-    }
-}
-
-void ScShapeChildren::Notify(SfxBroadcaster&, const SfxHint& rHint)
-{
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-    if (pSdrHint)
-    {
-        SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
-        if (pObj && (pObj->getSdrPageFromSdrObject() == GetDrawPage()))
-        {
-            switch (pSdrHint->GetKind())
-            {
-                case SdrHintKind::ObjectChange :
-                {
-                }
-                break;
-                default :
-                {
-                    // other events are not interesting
-                }
-                break;
-            }
-        }
-    }
 }
 
 void ScShapeChildren::FindChanged(ScShapeChildVec& rOld, ScShapeChildVec& rNew) const
@@ -1237,10 +1180,6 @@ void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const SfxHint
                 }
             }
         }
-        else if (rHint.GetId() == SfxHintId::ScAccMakeDrawLayer)
-        {
-            GetShapeChildren()->SetDrawBroadcaster();
-        }
         else if (rHint.GetId() == SfxHintId::ScAccVisAreaChanged)
         {
             Size aOutputSize;
diff --git a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
index 61bf52b466f5..52d8c5f1e1b5 100644
--- a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
+++ b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
@@ -52,9 +52,9 @@ void SAL_CALL ScDrawModelBroadcaster::removeEventListener( const uno::Reference<
 void ScDrawModelBroadcaster::Notify( SfxBroadcaster&,
         const SfxHint& rHint )
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if( !pSdrHint )
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
         return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
 
     document::EventObject aEvent;
     if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 84622482d451..6fcf91da5542 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -191,8 +191,9 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         if ( nTab == static_cast<const ScTabSizeChangedHint&>(rHint).GetTab() )
             UpdateWorkArea();
     }
-    else if ( const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ) )
+    else if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
         adjustAnchoredPosition(*pSdrHint, *pDoc, nTab);
         FmFormView::Notify( rBC,rHint );
     }
diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx
index 92c92bd350a8..b1066328816f 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -39,8 +39,9 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 bDataChanged = true;
         }
     }
-    else if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         // SdrHints are no longer used for invalidating, thus react on objectchange instead
         if(SdrHintKind::ObjectChange == pSdrHint->GetKind())
             bDataChanged = true;
diff --git a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
index 030c547dde14..27ac7a54376c 100644
--- a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
+++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
@@ -163,12 +163,14 @@ namespace accessibility
         }
         else
         {
-            const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
-
-            if( pSdrHint && ( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) )
+            if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
             {
-                // model is dying under us, going defunc
-                bDispose = true;
+                const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint );
+                if( pSdrHint->GetKind() == SdrHintKind::ModelCleared )
+                {
+                    // model is dying under us, going defunc
+                    bDispose = true;
+                }
             }
         }
 
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 8a2ad2ee7658..7de687968089 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -809,9 +809,9 @@ void AccessibleSlideSorterView::Implementation::Notify (
     SfxBroadcaster&,
     const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint)
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         switch (pSdrHint->GetKind())
         {
             case SdrHintKind::PageOrderChange:
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 0bfcd2dea135..2c0bb805e493 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -387,7 +387,7 @@ void MotionPathTag::updatePathAttributes()
 
 void MotionPathTag::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    if( !(mpPathObj && !mbInUpdatePath && dynamic_cast< const SdrHint* >( &rHint ) && (mpEffect.get() != nullptr)) )
+    if( !(mpPathObj && !mbInUpdatePath && rHint.GetId() == SfxHintId::ThisIsAnSdrHint && (mpEffect.get() != nullptr)) )
         return;
 
     if( mxPolyPoly != mpPathObj->GetPathPoly() )
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 327bfd8e731f..86c7a2b7b19b 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -763,9 +763,9 @@ SdTransferable* SdTransferable::getImplementation( const Reference< XInterface >
 
 void SdTransferable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
-    const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
-    if( pSdrHint )
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint );
         if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
         {
             EndListening(*mpSourceDoc);
diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx
index febfef0df28d..c87919346322 100644
--- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx
+++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx
@@ -110,12 +110,12 @@ void SpellDialogChildWindow::EndSpellingAndClearOutliner()
 
 void SpellDialogChildWindow::Notify(SfxBroadcaster&, const SfxHint& rHint)
 {
-    if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint))
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+    if (SdrHintKind::ModelCleared == pSdrHint->GetKind())
     {
-        if (SdrHintKind::ModelCleared == pSdrHint->GetKind())
-        {
-            EndSpellingAndClearOutliner();
-        }
+        EndSpellingAndClearOutliner();
     }
 }
 
diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx
index eee288d021c3..232ea0e3c73e 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -222,9 +222,9 @@ void MasterPageObserver::Implementation::Notify(
     SfxBroadcaster& rBroadcaster,
     const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (!pSdrHint)
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
         return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
 
     switch (pSdrHint->GetKind())
     {
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 0971c8ffe60e..0a25ae07c71b 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -267,9 +267,9 @@ void Listener::Notify (
     SfxBroadcaster& rBroadcaster,
     const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint)
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         switch (pSdrHint->GetKind())
         {
             case SdrHintKind::ModelCleared:
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx
index 4184f3ed8dd5..8e44502e341a 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -588,9 +588,9 @@ void EventMultiplexer::Implementation::Notify (
     SfxBroadcaster&,
     const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint)
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         switch (pSdrHint->GetKind())
         {
             case SdrHintKind::ModelCleared:
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5dbde18870a3..91590534edf3 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -175,14 +175,12 @@ SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
 
 void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-
-    if( pSdrHint )
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
+    if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
     {
-        if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
-        {
-            mpModel = nullptr;
-        }
+        mpModel = nullptr;
     }
 }
 
@@ -419,10 +417,9 @@ void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
     if( mpDoc )
     {
-        const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-
-        if( pSdrHint )
+        if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
         {
+            const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
             if( hasEventListeners() )
             {
                 document::EventObject aEvent;
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index e60b495b2855..88c2c6fb5554 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -75,19 +75,17 @@ SdUnoPageBackground::~SdUnoPageBackground() throw()
 
 void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
 
-    if( pSdrHint )
+    // delete item set if document is dying because then the pool
+    // will also die
+    if( pSdrHint->GetKind() == SdrHintKind::ModelCleared )
     {
-        // delete item set if document is dying because then the pool
-        // will also die
-        if( pSdrHint->GetKind() == SdrHintKind::ModelCleared )
-        {
-            mpSet.reset();
-            mpDoc = nullptr;
-        }
+        mpSet.reset();
+        mpDoc = nullptr;
     }
-
 }
 
 void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw()
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index a86f49a010e3..eb5613c1742b 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -376,7 +376,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
 
 void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
 {
-    if ( mpDrawViewShell && dynamic_cast<const SdrHint*>(&rHint) )
+    if ( mpDrawViewShell && rHint.GetId() == SfxHintId::ThisIsAnSdrHint )
     {
         SdrHintKind eHintKind = static_cast<const SdrHint&>(rHint).GetKind();
 
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 7dad181c7d87..23584422480f 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -694,10 +694,9 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox()
 
 void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-
-    if( pSdrHint )
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
         switch( pSdrHint->GetKind() )
         {
             case SdrHintKind::ObjectChange:
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index 492ce525509a..0c95811e744c 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -167,11 +167,12 @@ SdrExternalToolEdit::SdrExternalToolEdit(
 
 void SdrExternalToolEdit::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
 {
-    SdrHint const*const pSdrHint(dynamic_cast<SdrHint const*>(&rHint));
-    if (pSdrHint
-        && (SdrHintKind::ModelCleared == pSdrHint->GetKind()
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    SdrHint const*const pSdrHint(static_cast<SdrHint const*>(&rHint));
+    if (SdrHintKind::ModelCleared == pSdrHint->GetKind()
             || (pSdrHint->GetObject() == m_pObj
-                && SdrHintKind::ObjectRemoved == pSdrHint->GetKind())))
+                && SdrHintKind::ObjectRemoved == pSdrHint->GetKind()))
     {
         m_pView = nullptr;
         m_pObj = nullptr;
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index d89243c6da9e..ee980860b830 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -288,8 +288,9 @@ void FmXUndoEnvironment::ModeChanged()
 
 void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint))
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         switch (pSdrHint->GetKind())
         {
             case SdrHintKind::ObjectInserted:
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 9441bf32fc7d..505efe757f13 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1693,8 +1693,10 @@ FmXFormView::ObjectRemoveListener::ObjectRemoveListener( FmXFormView* pParent )
 
 void FmXFormView::ObjectRemoveListener::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint && pSdrHint->GetKind() == SdrHintKind::ObjectRemoved)
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+    if (pSdrHint->GetKind() == SdrHintKind::ObjectRemoved)
         m_pParent->ObjectRemovedInAliveMode(pSdrHint->GetObject());
 }
 
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 91526fa70238..cdbdeaac4e6b 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -657,9 +657,9 @@ namespace svxform
 
     void NavigatorTreeModel::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
     {
-        const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-        if (pSdrHint)
+        if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
         {
+            const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
             switch( pSdrHint->GetKind() )
             {
                 case SdrHintKind::ObjectInserted:
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index c6106ad321fa..938a8fce0fae 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -227,8 +227,9 @@ void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     SdrGlueEditView::Notify(rBC,rHint);
     if (pTextEditOutliner!=nullptr) {
         // change of printer while editing
-        const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-        if (pSdrHint!=nullptr) {
+        if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
+        {
+            const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
             SdrHintKind eKind=pSdrHint->GetKind();
             if (eKind==SdrHintKind::RefDeviceChange) {
                 pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index da81ce1923f6..d41df0885c57 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2011,28 +2011,32 @@ const css::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImplementationId()
 
 
 SdrHint::SdrHint(SdrHintKind eNewHint)
-:   meHint(eNewHint),
+:   SfxHint(SfxHintId::ThisIsAnSdrHint),
+    meHint(eNewHint),
     mpObj(nullptr),
     mpPage(nullptr)
 {
 }
 
 SdrHint::SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj)
-:   meHint(eNewHint),
+:   SfxHint(SfxHintId::ThisIsAnSdrHint),
+    meHint(eNewHint),
     mpObj(&rNewObj),
     mpPage(rNewObj.getSdrPageFromSdrObject())
 {
 }
 
 SdrHint::SdrHint(SdrHintKind eNewHint, const SdrPage* pPage)
-:   meHint(eNewHint),
+:   SfxHint(SfxHintId::ThisIsAnSdrHint),
+    meHint(eNewHint),
     mpObj(nullptr),
     mpPage(pPage)
 {
 }
 
 SdrHint::SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj, const SdrPage* pPage)
-:   meHint(eNewHint),
+:   SfxHint(SfxHintId::ThisIsAnSdrHint),
+    meHint(eNewHint),
     mpObj(&rNewObj),
     mpPage(pPage)
 {
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 078e6ec644c0..5762ccb8eb77 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -169,11 +169,10 @@ SdrMarkView::~SdrMarkView()
 
 void SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (pSdrHint)
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         SdrHintKind eKind=pSdrHint->GetKind();
-
         if (eKind==SdrHintKind::ObjectChange || eKind==SdrHintKind::ObjectInserted || eKind==SdrHintKind::ObjectRemoved)
         {
             mbMarkedObjRectDirty=true;
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index bcdf677120c6..85b9e79b62b4 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -320,8 +320,7 @@ void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos)
     impChildInserted(*pObj);
 
     if (!mbRectsDirty) {
-        maSdrObjListOutRect.Union(pObj->GetCurrentBoundRect());
-        maSdrObjListSnapRect.Union(pObj->GetSnapRect());
+        mbRectsDirty = true;
     }
     pObj->InsertedStateChange(); // calls the UserCall (among others)
 }
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index f799c3b098cf..cbac5517dfab 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -226,10 +226,9 @@ void SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
         return;
     }
 
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (!pSdrHint)
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
         return;
-
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
     SdrHintKind eKind = pSdrHint->GetKind();
     if (eKind==SdrHintKind::ObjectChange || eKind==SdrHintKind::ObjectInserted || eKind==SdrHintKind::ObjectRemoved)
     {
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
index 64c1a354e982..5a27573e62f2 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -65,9 +65,10 @@ void SvxUnoNameItemTable::dispose()
 
 void SvxUnoNameItemTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-
-    if( pSdrHint && SdrHintKind::ModelCleared == pSdrHint->GetKind() )
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+    if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
         dispose();
 }
 
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index 0dc25307cfaa..e9f821dc5a2e 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -116,10 +116,12 @@ void SvxUnoMarkerTable::dispose()
 // SfxListener
 void SvxUnoMarkerTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 {
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-
-    if( pSdrHint && SdrHintKind::ModelCleared == pSdrHint->GetKind() )
-        dispose();
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
+    {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+        if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
+            dispose();
+    }
 }
 
 sal_Bool SAL_CALL SvxUnoMarkerTable::supportsService( const  OUString& ServiceName )
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 315503fa547b..e62262d6db5f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1018,17 +1018,18 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
         return;
 
     // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
-
-    const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
-    if (!pSdrHint ||
-        ((pSdrHint->GetKind() != SdrHintKind::ModelCleared) &&
-         (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != GetSdrObject() )))
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    SdrObject* pSdrObject(GetSdrObject());
+    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+    if ((pSdrHint->GetKind() != SdrHintKind::ModelCleared) &&
+         (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != pSdrObject ))
         return;
 
-    uno::Reference< uno::XInterface > xSelf( GetSdrObject()->getWeakUnoShape() );
+    uno::Reference< uno::XInterface > xSelf( pSdrObject->getWeakUnoShape() );
     if( !xSelf.is() )
     {
-        EndListening(GetSdrObject()->getSdrModelFromSdrObject());
+        EndListening(pSdrObject->getSdrModelFromSdrObject());
         mpSdrObjectWeakReference.reset(nullptr);
         return;
     }
@@ -1053,8 +1054,6 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 
     if( bClearMe )
     {
-        SdrObject* pSdrObject(GetSdrObject());
-
         if(!HasSdrObjectOwnership())
         {
             if(nullptr != pSdrObject)
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index bc8cb9f657e9..dbfb5a544c6c 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -269,8 +269,9 @@ void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     {
         Broadcast( *pViewHint );
     }
-    else if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
     {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
         switch( pSdrHint->GetKind() )
         {
             case SdrHintKind::ObjectChange:
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 24769f8bc837..6b49f1ca5c55 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -168,12 +168,13 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
 {
     // do not broadcast notifications for writer fly frames, because there
     // are no shapes that need to know about them.
-    const SdrHint *pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-    if ( !pSdrHint ||
-         ( pSdrHint->GetObject() &&
+    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+        return;
+    const SdrHint *pSdrHint = static_cast<const SdrHint*>( &rHint );
+    if (pSdrHint->GetObject() &&
            ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) !=  nullptr ||
               dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) !=  nullptr ||
-             typeid(SdrObject) == typeid(pSdrHint->GetObject()) ) ) )
+             typeid(SdrObject) == typeid(pSdrHint->GetObject()) ) )
     {
         return;
     }


More information about the Libreoffice-commits mailing list