sw/source/core/access/accmap.cxx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
New commits: commit 08c09017bfa5c72ba2b9614237fcf0c0f9738037 Author: Noel Grandin <[email protected]> AuthorDate: Thu Apr 27 19:08:25 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Apr 28 12:33:55 2023 +0200 fix regression in "tdf#119388 add new UNO listener/broadcaster" Upon further inspection, I note that part of the the code I added in commit ec940941e0bd7db15c5cf7d43df82226e0d849dc Author: Noel Grandin <[email protected]> Date: Tue Aug 20 17:03:13 2019 +0200 tdf#119388 add new UNO listener/broadcaster would never have been able to be hit. Re-arrange a little to fix that. Change-Id: I537102d768591e5fa0ec2fb4b52b05dad4d26f29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151140 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 5d21e969311c..b7f00ffea291 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -196,18 +196,32 @@ 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() ) - 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 ); @@ -224,16 +238,6 @@ 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() commit e8c265d06a9f34fec382d67c65c38189f16ee323 Author: Noel Grandin <[email protected]> AuthorDate: Thu Apr 27 19:05:50 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Apr 28 12:33:41 2023 +0200 remove dead code in SwDrawModellListener_Impl::Notify The isType<SdrObject>(pSdrHint->GetObject()) ) ) code has always been unconditionally true, because SdrHint has always returned an SdrObject, ever since it was introduced in commit 12b8488b9cf659adcafd4b998227397c57cf51ba Author: Vladimir Glazounov <[email protected]> Date: Wed Jul 9 08:16:20 2003 +0000 INTEGRATION: CWS sw020 (1.44.80); FILE MERGED 2003/07/01 11:50:20 od 1.44.80.1: #110554# <SwDrawModellListener_Impl::Notify(..)> - correction: no broadcast of notifications for writer fly frames and plane <SdrObject>-objects. Change-Id: I67e6576f0670856259edee35aaf001401e67d98d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151139 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 6dc1feaa8dd5..5d21e969311c 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -197,13 +197,8 @@ 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()) ) ) - { + if (pSdrHint->GetObject() ) return; - } OSL_ENSURE( mpDrawModel, "draw model listener is disposed" ); if( !mpDrawModel )
