sw/inc/hints.hxx | 9 +++++++ sw/source/core/layout/tabfrm.cxx | 29 ++++++++++++++++++++++++- sw/source/core/table/swtable.cxx | 44 ++++----------------------------------- 3 files changed, 42 insertions(+), 40 deletions(-)
New commits: commit 0c8f364421014486c4e35a78a6dabca5b6a5dd26 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Mon Jul 5 01:53:48 2021 +0200 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Fri Jul 9 23:28:08 2021 +0200 remove some SwIterator abuse Change-Id: Ic95562ebb57106c733d919059ff9d042fef28f3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118392 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index e83d42251882..8f978d886c2a 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -35,6 +35,7 @@ class SwTextNode; class SwTextFormatColl; class SwFrameFormat; class SwTableLine; +class SwTableLineFormat; class SwTableBox; // Base class for all Message-Hints: @@ -170,6 +171,14 @@ public: class DocumentDyingHint final : public SfxHint { }; + +class TableLineFormatChanged final : public SfxHint +{ +public: + const SwTableLineFormat& m_rNewFormat; + const SwTableLine& m_rTabLine; + TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {}; +}; } class SwUpdateAttr final : public SwMsgPoolItem diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c54b24d59e3d..c50f4d4873eb 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3919,7 +3919,34 @@ void SwRowFrame::OnFrameSize(const SfxPoolItem& rSize) void SwRowFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) { - if(auto pMoveTableLineHint = dynamic_cast<const sw::MoveTableLineHint*>(&rHint)) + if(auto pNewFormatHint = dynamic_cast<const sw::TableLineFormatChanged*>(&rHint)) + { + if(GetTabLine() != &pNewFormatHint->m_rTabLine) + return; + RegisterToFormat(const_cast<SwTableLineFormat&>(pNewFormatHint->m_rNewFormat)); + InvalidateSize(); + InvalidatePrt_(); + SetCompletePaint(); + ReinitializeFrameSizeAttrFlags(); + + // #i35063# + // consider 'split row allowed' attribute + SwTabFrame* pTab = FindTabFrame(); + bool bInFollowFlowRow = false; + const bool bInFirstNonHeadlineRow = pTab->IsFollow() && this == pTab->GetFirstNonHeadlineRow(); + if(bInFirstNonHeadlineRow || + !GetNext() || + (bInFollowFlowRow = IsInFollowFlowRow()) || + nullptr != IsInSplitTableRow() ) + { + if(bInFirstNonHeadlineRow || bInFollowFlowRow) + pTab = pTab->FindMaster(); + + pTab->SetRemoveFollowFlowLinePending(true); + pTab->InvalidatePos(); + } + } + else if(auto pMoveTableLineHint = dynamic_cast<const sw::MoveTableLineHint*>(&rHint)) { if(GetTabLine() != &pMoveTableLineHint->m_rTableLine) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index c2f3b3bd9764..fe6a221daa0c 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1496,47 +1496,13 @@ SwFrameFormat* SwTableLine::ClaimFrameFormat() return pRet; } -void SwTableLine::ChgFrameFormat( SwTableLineFormat *pNewFormat ) +void SwTableLine::ChgFrameFormat(SwTableLineFormat* pNewFormat) { - SwFrameFormat *pOld = GetFrameFormat(); - SwIterator<SwRowFrame,SwFormat> aIter( *pOld ); - - // First, re-register the Frames. - for( SwRowFrame* pRow = aIter.First(); pRow; pRow = aIter.Next() ) - { - if( pRow->GetTabLine() == this ) - { - pRow->RegisterToFormat( *pNewFormat ); - - pRow->InvalidateSize(); - pRow->InvalidatePrt_(); - pRow->SetCompletePaint(); - pRow->ReinitializeFrameSizeAttrFlags(); - - // #i35063# - // consider 'split row allowed' attribute - SwTabFrame* pTab = pRow->FindTabFrame(); - bool bInFollowFlowRow = false; - const bool bInFirstNonHeadlineRow = pTab->IsFollow() && - pRow == pTab->GetFirstNonHeadlineRow(); - if ( bInFirstNonHeadlineRow || - !pRow->GetNext() || - ( bInFollowFlowRow = pRow->IsInFollowFlowRow() ) || - nullptr != pRow->IsInSplitTableRow() ) - { - if ( bInFirstNonHeadlineRow || bInFollowFlowRow ) - pTab = pTab->FindMaster(); - - pTab->SetRemoveFollowFlowLinePending( true ); - pTab->InvalidatePos(); - } - } - } - + auto pOld = GetFrameFormat(); + pOld->CallSwClientNotify(sw::TableLineFormatChanged(*pNewFormat, *this)); // Now, re-register self. - pNewFormat->Add( this ); - - if ( !pOld->HasWriterListeners() ) + pNewFormat->Add(this); + if(!pOld->HasWriterListeners()) delete pOld; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits