diff options
author | Justin Luth <justin_luth@sil.org> | 2018-07-18 09:01:43 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-07-25 10:19:40 +0200 |
commit | 6db143f43874a817b7a920dea41939bf9439ca9b (patch) | |
tree | c84a2e3a01c86c890d8a27066140fd9b3a2a0681 | |
parent | 5fa898acb96fb344b526bd6e3892c4f4fae6e4f8 (diff) |
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.
Change-Id: I008fc7b6a7083292463c20972ad209761ec97601
Reviewed-on: https://gerrit.libreoffice.org/57613
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
(cherry picked from commit ef86b2e7a08ea25c434db85087d094f030f762cc)
Reviewed-on: https://gerrit.libreoffice.org/57697
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/source/core/inc/rowfrm.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx index 9ff22cc0a125..c3724667cdaf 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 8fad05cf2508..ae20788f9da0 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1777,16 +1777,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; @@ -1863,8 +1863,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) const SwBorderAttrs *pAttrs = pAccess->Get(); const bool bLargeTable = GetTable()->GetTabLines().size() > 64; //arbitrary value, virtually guaranteed to be larger than one page. + const bool bEmulateTableKeep = !bLargeTable && AreAllRowsKeepWithNext( GetFirstNonHeadlineRow(), /*bCheckParents=*/false ); // The beloved keep attribute - const bool bEmulateTableKeep = !bLargeTable && AreAllRowsKeepWithNext( GetFirstNonHeadlineRow() ); const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep); // All rows should keep together @@ -4613,7 +4613,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() ) @@ -4623,7 +4623,7 @@ bool SwRowFrame::ShouldRowKeepWithNext() const const SwFrame* pText = pCell->Lower(); return pText && pText->IsTextFrame() && - static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep().GetValue(); + static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue(); } SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertContent) |