sw/source/core/access/accmap.cxx | 36 +++++++++++++++++++----------------- sw/source/core/doc/doclay.cxx | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-)
New commits: commit f701edb6f72e50fae5857a81081d3503e5363b8f Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Apr 28 15:26:29 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 28 21:14:12 2023 +0200 fix type checks of raw SdrObject's in writer Which are no longer possible since SdrObject is abstract now. I assume the original code was gunning for the kind of objects that were being created before commit 24a374ebc9da56cc6721e8feaa1e15ba850bf41d tdf#154040 use a SdrObjKind::NewFrame for frame creation in writer Instead of (ab)using SdrObjKind::NONE for the temporary, empty Since that is only explanation that makes sense Change-Id: I0c3a26cc303ab7d54193beacb285c69aaf98a63e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151170 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 6dc1feaa8dd5..f52542eda72a 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -197,10 +197,11 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, 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 || - isType<SdrObject>(pSdrHint->GetObject()) ) ) + const SdrObject* pObj = pSdrHint->GetObject(); + if (pObj && + ( dynamic_cast< const SwFlyDrawObj* >(pObj) || + dynamic_cast< const SwVirtFlyDrawObj* >(pObj) || + pObj->GetObjIdentifier() == SdrObjKind::NewFrame ) ) { return; } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index d316ba264b82..0ab802a5b6cd 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -141,7 +141,7 @@ rtl::Reference<SdrObject> SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveW SdrLayerID nLayerIdForClone = rObj.GetLayer(); if ( dynamic_cast<const SwFlyDrawObj*>( pObj.get() ) == nullptr && dynamic_cast<const SwVirtFlyDrawObj*>( pObj.get() ) == nullptr && - !isType<SdrObject>(pObj.get()) ) + pObj->GetObjIdentifier() != SdrObjKind::NewFrame ) { if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone ) ) { commit 4ab38a26bf4a6d37da6c03f7fdb999d0cacf2e63 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Apr 28 15:15:21 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 28 21:14:02 2023 +0200 Revert "remove dead code in SwDrawModellListener_Impl::Notify" This reverts commit e8c265d06a9f34fec382d67c65c38189f16ee323. Reason for revert: I misunderstood how the isType is working here Change-Id: Ic4fcedd02affa6df58b74b4cad231cfdf6288592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index b7f00ffea291..6dc1feaa8dd5 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -196,32 +196,23 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, // are no shapes that need to know about them. 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 || + isType<SdrObject>(pSdrHint->GetObject()) ) ) + { + return; + } OSL_ENSURE( mpDrawModel, "draw model listener is disposed" ); if( !mpDrawModel ) return; - const SdrHint *pSdrHint = static_cast<const SdrHint*>( &rHint ); - document::EventObject aEvent; if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) ) return; - - // right now, we're only handling the specific event necessary to fix this performance problem - if (pSdrHint->GetKind() == SdrHintKind::ObjectChange) - { - auto pSdrObject = const_cast<SdrObject*>(pSdrHint->GetObject()); - uno::Reference<drawing::XShape> xShape(pSdrObject->getUnoShape(), uno::UNO_QUERY); - std::unique_lock aGuard(maListenerMutex); - auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape); - for (auto it = itBegin; it != itEnd; ++it) - it->second->notifyShapeEvent(aEvent); - } - - if (pSdrHint->GetObject() ) - return; - { std::unique_lock g(maListenerMutex); ::comphelper::OInterfaceIteratorHelper4 aIter( g, maEventListeners ); @@ -238,6 +229,16 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, } } + // right now, we're only handling the specific event necessary to fix this performance problem + if (pSdrHint->GetKind() == SdrHintKind::ObjectChange) + { + auto pSdrObject = const_cast<SdrObject*>(pSdrHint->GetObject()); + uno::Reference<drawing::XShape> xShape(pSdrObject->getUnoShape(), uno::UNO_QUERY); + std::unique_lock aGuard(maListenerMutex); + auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape); + for (auto it = itBegin; it != itEnd; ++it) + it->second->notifyShapeEvent(aEvent); + } } void SwDrawModellListener_Impl::Dispose()