From fc90f7ea8034e9585486ea9cc3e55771aca85540 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 25 Jun 2018 19:39:55 +0300 Subject: tdf#108000 sw layout: ignore emulated keep on large tables There is no point in a very large (multipage) table keeping with the following content and it just makes the layout more complex. This is especially true when we are emulating this using MSWord's convention, and not LO's native table-keep option. This patch only affects my earlier code for emulated tables. Otherwise, something about the general logic could loop forever in certain huge tables. This seemed like a very reasonable compromise. Change-Id: Ic1bde12b266e71fc9f608ec4d1223277108750fa Reviewed-on: https://gerrit.libreoffice.org/56314 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/source/core/layout/tabfrm.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 9817b082b688..8fad05cf2508 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1862,8 +1862,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) auto pAccess = o3tl::make_unique(SwFrame::GetCache(), this); const SwBorderAttrs *pAttrs = pAccess->Get(); + const bool bLargeTable = GetTable()->GetTabLines().size() > 64; //arbitrary value, virtually guaranteed to be larger than one page. // The beloved keep attribute - const bool bEmulateTableKeep = AreAllRowsKeepWithNext( GetFirstNonHeadlineRow() ); + const bool bEmulateTableKeep = !bLargeTable && AreAllRowsKeepWithNext( GetFirstNonHeadlineRow() ); const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep); // All rows should keep together -- cgit v1.2.3