diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-23 09:26:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-23 14:10:38 +0200 |
commit | 10c934147d469965dba6abc78efd02759a010b8e (patch) | |
tree | 54fe37d01913d48abf93bd087c59f95fdcfa5a46 /svx | |
parent | a08401155a0b4b49878e8e50d39b2fd3e5278779 (diff) |
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>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/accessibility/GraphCtlAccessibleContext.cxx | 5 | ||||
-rw-r--r-- | svx/source/core/extedit.cxx | 9 | ||||
-rw-r--r-- | svx/source/form/fmundo.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 6 | ||||
-rw-r--r-- | svx/source/form/navigatortreemodel.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 5 | ||||
-rw-r--r-- | svx/source/unodraw/UnoNameItemTable.cxx | 7 | ||||
-rw-r--r-- | svx/source/unodraw/unomtabl.cxx | 10 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 17 | ||||
-rw-r--r-- | svx/source/unodraw/unoshtxt.cxx | 3 |
14 files changed, 51 insertions, 43 deletions
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: |