From 920e76f15b78398de62002e30002f4f8e0fee7c1 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 2 Jun 2023 11:02:46 +0200 Subject: sw floattable: ignore keep-with-next for anchors of non-last split flys The bugdoc has a floating table that could split between page 1 and page 2, but we used to put the entire table to page 2. What happens is that the anchor of the floating table had , which means the layout tried to keep the paragraph on a single page, and also with the next paragraph (but in this case there is no next paragraph, it's the last one in the document). Fix the problem ignoring the "keep with next" request, in case the paragraph is an anchor for a split floating table; unless we're the last anchor in the chain. This is probably consistent with the intent that "keep with next" is meant to control the anchor text and not the anchored floating tables. Change-Id: I387a2db5f5db013da7055686ae6b9d032b467266 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152525 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/core/layout/flowfrm.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sw/source') diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index cb47267f1195..41b6b8fff953 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -248,6 +248,17 @@ bool SwFlowFrame::IsKeep(SvxFormatKeepItem const& rKeep, ( !m_rThis.IsInTab() || m_rThis.IsTabFrame() ) && rKeep.GetValue() && !IsNextContentFullPage(m_rThis)); + if (bKeep && m_rThis.IsTextFrame()) + { + auto& rTextFrame = static_cast(m_rThis); + if (rTextFrame.HasNonLastSplitFlyDrawObj()) + { + // Allow split for the non-last anchors of a split fly, even if rKeep.GetValue() is + // true. + bKeep = false; + } + } + OSL_ENSURE( !bCheckIfLastRowShouldKeep || m_rThis.IsTabFrame(), "IsKeep with bCheckIfLastRowShouldKeep should only be used for tabfrms" ); -- cgit