diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-12-13 01:07:42 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-12-13 11:16:23 +0100 |
commit | 1d9f243a39169256ebb923afb32fffecf04ac427 (patch) | |
tree | d9ae9f10a1929d914e66dbd0f700056948b3640d /sw | |
parent | 579cf9548615e8535a0569a8eb4cdf325fbbbac7 (diff) |
pagechg: Modify no more
Change-Id: I571813d6e4fd3c465f77eb7acca9d656440a136a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107648
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/pagefrm.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 92 |
2 files changed, 46 insertions, 51 deletions
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 24c6ba554d45..c5ad094e46a8 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -38,7 +38,7 @@ class SwAnchoredObject; /// A page of the document layout. Upper frame is expected to be an SwRootFrame /// instance. At least an SwBodyFrame lower is expected. -class SAL_DLLPUBLIC_RTTI SwPageFrame: public SwFootnoteBossFrame +class SAL_DLLPUBLIC_RTTI SwPageFrame final: public SwFootnoteBossFrame { friend class SwFrame; @@ -99,10 +99,7 @@ class SAL_DLLPUBLIC_RTTI SwPageFrame: public SwFootnoteBossFrame virtual void DestroyImpl() override; virtual ~SwPageFrame() override; - -protected: virtual void MakeAll(vcl::RenderContext* pRenderContext) override; - virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; virtual void SwClientNotify(const SwModify&, const SfxHint&) override; /// Calculate the content height of a page (without columns). diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index f1e2c35f52f1..611b63753bc1 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -495,52 +495,6 @@ void SwPageFrame::PreparePage( bool bFootnote ) } } -void SwPageFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) -{ - SwViewShell *pSh = getRootFrame()->GetCurrShell(); - if ( pSh ) - pSh->SetFirstVisPageInvalid(); - sal_uInt8 nInvFlags = 0; - - 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 - { - 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_( pOld, pNew, nInvFlags ); - - if ( nInvFlags == 0 ) - return; - - InvalidatePage( this ); - if ( nInvFlags & 0x01 ) - InvalidatePrt_(); - if ( nInvFlags & 0x02 ) - SetCompletePaint(); - if ( nInvFlags & 0x04 && GetNext() ) - GetNext()->InvalidatePos(); - if ( nInvFlags & 0x08 ) - PrepareHeader(); - if ( nInvFlags & 0x10 ) - PrepareFooter(); - if ( nInvFlags & 0x20 ) - CheckGrid( nInvFlags & 0x40 ); -} - - void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) { if(typeid(sw::PageFootnoteHint) == typeid(rHint)) @@ -554,7 +508,51 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) // here, the page might be destroyed: static_cast<SwRootFrame*>(GetUpper())->RemoveFootnotes(nullptr, false, true); } - else + else if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint)) + { + if(auto pSh = getRootFrame()->GetCurrShell()) + pSh->SetFirstVisPageInvalid(); + + 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); + pOItem = aOIter.NextItem(); + pNItem = aNIter.NextItem(); + } while(pNItem); + if(aOldSet.Count() || aNewSet.Count()) + SwLayoutFrame::Modify(&aOldSet, &aNewSet); + } + else + UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags); + + if (nInvFlags == 0) + return; + + InvalidatePage( this ); + if(nInvFlags & 0x01) + InvalidatePrt_(); + if(nInvFlags & 0x02) + SetCompletePaint(); + if(nInvFlags & 0x04 && GetNext() ) + GetNext()->InvalidatePos(); + if(nInvFlags & 0x08) + PrepareHeader(); + if(nInvFlags & 0x10) + PrepareFooter(); + if(nInvFlags & 0x20) + CheckGrid(nInvFlags & 0x40); + } else SwFrame::SwClientNotify(rModify, rHint); } |