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@collabora.co.uk>
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 872406f9..8b0548f 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2610,9 +2610,9 @@
}
}
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 98d0ca8..708986e 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -112,6 +112,8 @@
SwDrawViewsCreated,
SwSplitNodeOperation,
SwSectionFrameMoveAndDelete,
ThisIsAnSdrHint // used to avoid dynamic_cast
};
template< typename charT, typename traits >
@@ -190,6 +192,7 @@
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 1181581..9a23632 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -128,17 +128,16 @@
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 0c7d06d..761ec78 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -396,45 +396,45 @@
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())
{
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);
}
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())
RemoveShape(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 81b8cf7..8f21926 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -589,16 +589,10 @@
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 @@
void DataChanged();
void VisAreaChanged() const;
void SetDrawBroadcaster();
private:
ScAccessibleDocumentPagePreview* const mpAccDoc;
ScPreviewShell* mpViewShell;
@@ -648,56 +641,6 @@
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 @@
}
}
}
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 61bf52b..52d8c5f 100644
--- a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
+++ b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
@@ -52,9 +52,9 @@
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 84622482..6fcf91d 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -191,8 +191,9 @@
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 92c92bd..b106632 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -39,8 +39,9 @@
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 030c547..27ac7a5 100644
--- a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
+++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
@@ -163,12 +163,14 @@
}
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 8a2ad2e..7de6879 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -809,9 +809,9 @@
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 0bfcd2d..2c0bb80 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -387,7 +387,7 @@
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 327bfd8..86c7a2b 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -763,9 +763,9 @@
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 febfef0..c879193 100644
--- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx
+++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx
@@ -110,12 +110,12 @@
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 eee288d..232ea0e 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -222,9 +222,9 @@
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 0971c8f..0a25ae0 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -267,9 +267,9 @@
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 4184f3e..8e44502 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -588,9 +588,9 @@
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 5dbde18..9159053 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -175,14 +175,12 @@
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 @@
{
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 e60b495..88c2c6f 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -75,19 +75,17 @@
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 a86f49a..eb5613c 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -376,7 +376,7 @@
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 7dad181..2358442 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -694,10 +694,9 @@
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 492ce52..0c95811 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -167,11 +167,12 @@
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 d89243c..ee98086 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -288,8 +288,9 @@
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 9441bf3..505efe75 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1693,8 +1693,10 @@
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 91526fa..cdbdeaa 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -657,9 +657,9 @@
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 c6106ad..938a8fc 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -227,8 +227,9 @@
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 da81ce1..d41df088 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2011,28 +2011,32 @@
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 078e6ec..5762ccb 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -169,11 +169,10 @@
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 bcdf677..85b9e79b 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -320,8 +320,7 @@
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 f799c3b..cbac551 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -226,10 +226,9 @@
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 64c1a354..5a27573 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -65,9 +65,10 @@
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 0dc2530..e9f821d 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -116,10 +116,12 @@
// 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 315503f..e62262d 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1018,17 +1018,18 @@
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 @@
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 bc8cb9f6..dbfb5a5 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -269,8 +269,9 @@
{
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 24769f8..6b49f1c 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -168,12 +168,13 @@
{
// 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;
}