sw/inc/ndgrf.hxx | 1 + sw/source/core/docnode/swbaslnk.cxx | 32 ++------------------------------ sw/source/core/graphic/ndgrf.cxx | 25 +++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 32 deletions(-)
New commits: commit f269467ab5b73999c7ae7edbd0d5dd605d006090 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Mon Nov 2 13:05:31 2020 +0100 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Mon Nov 2 15:07:34 2020 +0100 SwGrfNode: ModifyNotification no more ... Change-Id: I6c1fda1d92c4e3511113fcd8a8bc09efba96e3e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105180 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index afaf8936558c..82be71429780 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -80,6 +80,7 @@ public: /// isolated only way to set GraphicObject to allow more actions when doing so void SetGraphic(const Graphic& rGraphic); + void TriggerGraphicArrived(); /// wrappers for non-const calls at GraphicObject void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, tools::Long nExtraData, OutputDevice* pFirstFrameOutDev) 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits