sw/source/core/inc/sectfrm.hxx | 4 -- sw/source/core/layout/sectfrm.cxx | 75 +++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 40 deletions(-)
New commits: commit 504fb3362dae5040d06c9223c4b9feb9936a07ef Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sun Dec 13 21:23:23 2020 +0100 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Sun Dec 13 22:46:51 2020 +0100 sectfrm: Modify no more Change-Id: Ie4aaa1a6ced60db3d812107d567af571c6a4d2e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107664 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 3b890b385e2a..47e7f27424be 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -33,7 +33,7 @@ enum class SwFindMode None = 0, EndNote = 1, LastCnt = 2, MyLast = 4 }; -class SwSectionFrame: public SwLayoutFrame, public SwFlowFrame +class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame { SwSection* m_pSection; bool m_bFootnoteAtEnd; // footnotes at the end of section @@ -56,11 +56,9 @@ class SwSectionFrame: public SwLayoutFrame, public SwFlowFrame virtual void DestroyImpl() override; virtual ~SwSectionFrame() override; -protected: virtual void MakeAll(vcl::RenderContext* pRenderContext) override; virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat ) override; virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override; - virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; virtual void SwClientNotify( const SwModify&, const SfxHint& ) override; public: diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index aa2af7d515f7..aab18463fe06 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2566,49 +2566,50 @@ void SwSectionFrame::CalcEndAtEndFlag() } } -void SwSectionFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) +void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) { - sal_uInt8 nInvFlags = 0; + if(const auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint)) + { + sal_uInt8 nInvFlags = 0; + if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which()) + { + auto& rOldSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pOld); + auto& rNewSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pNew); + SfxItemIter aOIter(*rOldSetChg.GetChgSet()); + SfxItemIter aNIter(*rNewSetChg.GetChgSet()); + const SfxPoolItem* pOItem = aOIter.GetCurItem(); + const SfxPoolItem* pNItem = aNIter.GetCurItem(); + SwAttrSetChg aOldSet(rOldSetChg); + SwAttrSetChg aNewSet(rNewSetChg); + do + { + UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet); + pNItem = aNIter.NextItem(); + pOItem = aOIter.NextItem(); + } while (pNItem); + if(aOldSet.Count() || aNewSet.Count()) + SwLayoutFrame::Modify(&aOldSet, &aNewSet); + } + else + UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags); - if( pNew && RES_ATTRSET_CHG == pNew->Which() ) - { - SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() ); - SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() ); - const SfxPoolItem* pNItem = aNIter.GetCurItem(); - const SfxPoolItem* pOItem = aOIter.GetCurItem(); - SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) ); - SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) ); - do + if(nInvFlags != 0) { - UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet); - pNItem = aNIter.NextItem(); - pOItem = aOIter.NextItem(); - } while (pNItem); - if ( aOldSet.Count() || aNewSet.Count() ) - SwLayoutFrame::Modify( &aOldSet, &aNewSet ); + if(nInvFlags & 0x01) + InvalidateSize(); + if(nInvFlags & 0x10) + SetCompletePaint(); + } } - else - UpdateAttr_( pOld, pNew, nInvFlags ); - - if ( nInvFlags != 0 ) + else if(const auto pHint = dynamic_cast<const SwSectionFrameMoveAndDeleteHint*>(&rHint)) { - if ( nInvFlags & 0x01 ) - InvalidateSize(); - if ( nInvFlags & 0x10 ) - SetCompletePaint(); + // #i117863# + if(&rMod != GetDep()) + return; + SwSectionFrame::MoveContentAndDelete(this, pHint->IsSaveContent()); } -} - -void SwSectionFrame::SwClientNotify( const SwModify& rMod, const SfxHint& rHint ) -{ - SwFrame::SwClientNotify(rMod, rHint); - // #i117863# - if(&rMod != GetDep()) - return; - const auto pHint = dynamic_cast<const SwSectionFrameMoveAndDeleteHint*>(&rHint); - if(!pHint) - return; - SwSectionFrame::MoveContentAndDelete( this, pHint->IsSaveContent() ); + else + SwFrame::SwClientNotify(rMod, rHint); } void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits