sw/source/core/inc/rowfrm.hxx | 2 +- sw/source/core/layout/tabfrm.cxx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
New commits: commit a7d6e8ded2d9cc2c71e85a38caecb3385c574a80 Author: Justin Luth <[email protected]> AuthorDate: Wed Jul 18 09:01:43 2018 +0300 Commit: Gabor Kelemen <[email protected]> CommitDate: Wed Mar 23 18:18:22 2022 +0100 tdf#118528 sw layout: only direct formatting for EmulateTableKeep Emulating MSWord's way of keeping a table with the next paragraph has caused a few complaints, but never anything that seemed to clearly indicate a real problem - usually just badly designed documents. But a common theme has been the keep attribute coming through styles. Since our export-emulation writes directly to the paragraph properties, lets make the emulation dependent on direct formatting to avoid some of these complaints. Reviewed-on: https://gerrit.libreoffice.org/57613 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> (cherry picked from commit ef86b2e7a08ea25c434db85087d094f030f762cc) Reviewed-on: https://gerrit.libreoffice.org/57697 Reviewed-by: Miklos Vajna <[email protected]> Change-Id: I008fc7b6a7083292463c20972ad209761ec97601 diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx index 1444630b0778..343756b9467d 100644 --- a/sw/source/core/inc/rowfrm.hxx +++ b/sw/source/core/inc/rowfrm.hxx @@ -97,7 +97,7 @@ public: // <-- split table rows // #131283# Table row keep feature - bool ShouldRowKeepWithNext() const; + bool ShouldRowKeepWithNext( const bool bCheckParents = true ) const; // #i4032# NEW TABLES bool IsRowSpanLine() const { return m_bIsRowSpanLine; } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 8496239b92c5..ec27fbd27405 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1712,16 +1712,16 @@ SwFrame* sw_FormatNextContentForKeep( SwTabFrame* pTabFrame ) } namespace { - bool AreAllRowsKeepWithNext( const SwRowFrame* pFirstRowFrame ) + bool AreAllRowsKeepWithNext( const SwRowFrame* pFirstRowFrame, const bool bCheckParents = true ) { bool bRet = pFirstRowFrame != nullptr && - pFirstRowFrame->ShouldRowKeepWithNext(); + pFirstRowFrame->ShouldRowKeepWithNext( bCheckParents ); while ( bRet && pFirstRowFrame->GetNext() != nullptr ) { pFirstRowFrame = dynamic_cast<const SwRowFrame*>(pFirstRowFrame->GetNext()); bRet = pFirstRowFrame != nullptr && - pFirstRowFrame->ShouldRowKeepWithNext(); + pFirstRowFrame->ShouldRowKeepWithNext( bCheckParents ); } return bRet; @@ -1797,9 +1797,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) auto pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this); const SwBorderAttrs *pAttrs = pAccess->Get(); + const bool bEmulateTableKeep = AreAllRowsKeepWithNext( GetFirstNonHeadlineRow(), /*bCheckParents=*/false ); // The beloved keep attribute - const bool bEmulateTableKeep = AreAllRowsKeepWithNext( GetFirstNonHeadlineRow() ); - const bool bKeep = IsKeep( pAttrs->GetAttrSet(), bEmulateTableKeep ); + const bool bKeep = IsKeep(pAttrs->GetAttrSet(), bEmulateTableKeep); // All rows should keep together const bool bDontSplit = !IsFollow() && @@ -4492,7 +4492,7 @@ bool SwRowFrame::IsRowSplitAllowed() const return rLP.GetValue(); } -bool SwRowFrame::ShouldRowKeepWithNext() const +bool SwRowFrame::ShouldRowKeepWithNext( const bool bCheckParents ) const { // No KeepWithNext if nested in another table if ( GetUpper()->GetUpper()->IsCellFrame() ) @@ -4502,7 +4502,7 @@ bool SwRowFrame::ShouldRowKeepWithNext() const const SwFrame* pText = pCell->Lower(); return pText && pText->IsTextFrame() && - static_cast<const SwTextFrame*>(pText)->GetTextNode()->GetSwAttrSet().GetKeep().GetValue(); + static_cast<const SwTextFrame*>(pText)->GetTextNode()->GetSwAttrSet().GetKeep(bCheckParents).GetValue(); } SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertContent)
