diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-11-02 13:05:31 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-11-02 15:07:34 +0100 |
commit | f269467ab5b73999c7ae7edbd0d5dd605d006090 (patch) | |
tree | 8c0b797290434c99b1e7a224a3a193374bc9d7b4 /sw/source/core | |
parent | 4839756fcb381e37f7c4cc65e392d772b325c8b4 (diff) |
SwGrfNode: ModifyNotification no more ...
Change-Id: I6c1fda1d92c4e3511113fcd8a8bc09efba96e3e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105180
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/docnode/swbaslnk.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 25 |
2 files changed, 25 insertions, 32 deletions
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index 3ab59b95932c..544aa0f414bd 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -53,27 +53,6 @@ using namespace com::sun::star; static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size &rOrigGrfSize ); -static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) -{ - //call first all not SwNoTextFrames, then the SwNoTextFrames. - // The reason is, that in the SwNoTextFrames the Graphic - // after a Paint will be swapped out! So all other "behind" - // them haven't a loaded Graphic. - rGrfNd.LockModify(); - { - SwIterator<SwModify,SwGrfNode> aIter(rGrfNd); - for(SwModify* pLast = aIter.First(); pLast; pLast = aIter.Next()) - if(dynamic_cast<const SwContentFrame*>(pLast) == nullptr) - pLast->ModifyNotification(&rItem, &rItem); - } - { - SwIterator<SwContentFrame,SwGrfNode> aIter(rGrfNd); - for(SwContentFrame* pLast = aIter.First(); pLast; pLast = aIter.Next()) - pLast->ModifyNotification(&rItem, &rItem); - } - rGrfNd.UnlockModify(); -} - ::sfx2::SvBaseLink::UpdateResult SwBaseLink::DataChanged( const OUString& rMimeType, const uno::Any & rValue ) { @@ -163,15 +142,8 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) if ( !bUpdate || bFrameInPaint ) return SUCCESS; - if (pSwGrfNode) - { - if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz)) - { - SwMsgPoolItem aMsgHint(RES_GRAPHIC_ARRIVED); - lcl_CallModify(*pSwGrfNode, aMsgHint); - return SUCCESS; - } - } + if(pSwGrfNode && !SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz)) + pSwGrfNode->TriggerGraphicArrived(); return SUCCESS; } diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 583ac191fbb2..a676b3900c4a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -42,6 +42,7 @@ #include <hints.hxx> #include <swbaslnk.hxx> #include <pagefrm.hxx> +#include <cntfrm.hxx> #include <rtl/ustring.hxx> #include <o3tl/deleter.hxx> @@ -369,6 +370,27 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic) onGraphicChanged(); } +void SwGrfNode::TriggerGraphicArrived() +{ + const SwMsgPoolItem aMsgHint(RES_GRAPHIC_ARRIVED); + // FIXME: instead of hacking the notification to only handle specific clients. + // this should have been implemented cleanly witth two hints, e.g. + // RES_GRAPHIC_ARRIVED_PREP and RES_GRAPHIC_ARRIVED. + LockModify(); + { + SwIterator<SwModify,SwGrfNode> aIter(*this); + for(SwModify* pLast = aIter.First(); pLast; pLast = aIter.Next()) + if(dynamic_cast<const SwContentFrame*>(pLast) == nullptr) + pLast->SwClientNotify(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); + } + { + SwIterator<SwContentFrame,SwGrfNode> aIter(*this); + for(SwContentFrame* pLast = aIter.First(); pLast; pLast = aIter.Next()) + pLast->SwClientNotify(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); + } + UnlockModify(); +} + const Graphic& SwGrfNode::GetGrf(bool bWait) const { const_cast<SwGrfNode*>(this)->SwapIn(bWait); @@ -853,8 +875,7 @@ void SwGrfNode::UpdateLinkWithInputStream() GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly ); GetLink()->Update(); - SwMsgPoolItem aMsgHint( RES_GRAPHIC_ARRIVED ); - lcl_SwClientNotify(*this, aMsgHint); + TriggerGraphicArrived(); // #i88291# mxInputStream.clear(); |