sw/source/core/crsr/callnk.cxx | 5 +- sw/source/core/inc/rowfrm.hxx | 3 + sw/source/core/layout/tabfrm.cxx | 68 +++++++++++++++++++++++---------------- 3 files changed, 45 insertions(+), 31 deletions(-)
New commits: commit b28e514d5e0ea45490b3cab30e1d97dd3da2c794 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Wed Nov 18 21:23:58 2020 +0100 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Sat Nov 21 08:29:34 2020 +0100 callnk: Replace needless SwClientNotifyCall with CallSwClientNotify Change-Id: Ie34f2b227e5986c1fc72c3d0ba84dae98b51b4c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106081 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index d44ff1c8ed19..300691c950a0 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -85,9 +85,8 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell & rShell) return; } - SwFormatFrameSize aSize = pLine->GetFrameFormat()->GetFrameSize(); - sw::BroadcastingModify aMod; - pRow->SwClientNotifyCall(aMod, sw::LegacyModifyHint(nullptr, &aSize)); + const SwFormatFrameSize aSize = pLine->GetFrameFormat()->GetFrameSize(); + pRow->OnFrameSize(aSize); } SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx index 505c0e635535..cde10cf8b305 100644 --- a/sw/source/core/inc/rowfrm.hxx +++ b/sw/source/core/inc/rowfrm.hxx @@ -52,7 +52,7 @@ class SwRowFrame : public SwLayoutFrame protected: virtual void MakeAll(vcl::RenderContext* pRenderContext) override; - virtual void Modify(const SfxPoolItem*, const SfxPoolItem*) override; + virtual void SwClientNotify(const SwModify&, const SfxHint&) override; public: SwRowFrame(const SwTableLine&, SwFrame*, bool bInsertContent = true); @@ -121,6 +121,7 @@ public: // height to fit the rest of space. bool IsInSplit() const { return m_bIsInSplit; } void SetInSplit(bool bNew = true) { m_bIsInSplit = bNew; } + void OnFrameSize(const SwFormatFrameSize&); }; #endif diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 02f12c22db93..c49b0d4d3f0b 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3849,40 +3849,54 @@ void SwRowFrame::RegistFlys( SwPageFrame *pPage ) ::RegistFlys( pPage ? pPage : FindPageFrame(), this ); } -void SwRowFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) +void SwRowFrame::OnFrameSize(const SwFormatFrameSize& rSize) { - bool bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which(); - const SfxPoolItem *pItem = nullptr; + SwTabFrame* pTab = FindTabFrame(); + if(pTab) + { + const bool bInFirstNonHeadlineRow = pTab->IsFollow() && this == pTab->GetFirstNonHeadlineRow(); + // #i35063# + // Invalidation required is pRow is last row + if(bInFirstNonHeadlineRow) + pTab = pTab->FindMaster(); + if(bInFirstNonHeadlineRow || !GetNext()) + pTab->InvalidatePos(); + } + const sw::BroadcastingModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(nullptr, &rSize)); +} - if( bAttrSetChg ) +void SwRowFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) +{ + auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint); + if(!pLegacy) + return; + if(!pLegacy->m_pNew) { - const SwAttrSet* pChgSet = static_cast<const SwAttrSetChg*>(pNew)->GetChgSet(); - pChgSet->GetItemState( RES_FRM_SIZE, false, &pItem); - if ( !pItem ) - pChgSet->GetItemState( RES_ROW_SPLIT, false, &pItem); + // possibly not needed? + SwLayoutFrame::SwClientNotify(rModify, rHint); + return; } - else if (pNew && (RES_FRM_SIZE == pNew->Which() || RES_ROW_SPLIT == pNew->Which())) - pItem = pNew; - - if ( pItem ) + switch(pLegacy->m_pNew->Which()) { - SwTabFrame *pTab = FindTabFrame(); - if ( pTab ) + case RES_ATTRSET_CHG: { - const bool bInFirstNonHeadlineRow = pTab->IsFollow() && - this == pTab->GetFirstNonHeadlineRow(); - // #i35063# - // Invalidation required is pRow is last row - if ( bInFirstNonHeadlineRow || !GetNext() ) - { - if ( bInFirstNonHeadlineRow ) - pTab = pTab->FindMaster(); - pTab->InvalidatePos(); - } - } + const SwAttrSet* pChgSet = static_cast<const SwAttrSetChg*>(pLegacy->m_pNew)->GetChgSet(); + const SfxPoolItem* pItem = nullptr; + pChgSet->GetItemState(RES_FRM_SIZE, false, &pItem); + if(!pItem) + pChgSet->GetItemState(RES_ROW_SPLIT, false, &pItem); + if(pItem) + OnFrameSize(*static_cast<const SwFormatFrameSize*>(pItem)); + else + SwLayoutFrame::SwClientNotify(rModify, rHint); // possibly not needed? + return; + } + case RES_FRM_SIZE: + case RES_ROW_SPLIT: + OnFrameSize(*static_cast<const SwFormatFrameSize*>(pLegacy->m_pNew)); + return; } - - SwLayoutFrame::Modify( pOld, pNew ); } void SwRowFrame::MakeAll(vcl::RenderContext* pRenderContext) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits