summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-06-02 11:02:46 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-06-02 12:04:48 +0200
commit920e76f15b78398de62002e30002f4f8e0fee7c1 (patch)
tree54b10157e7185cf0df11483792701022ac387ef8 /sw/source
parent083975f9666e3dc6fd665dc0418e6c3130628359 (diff)
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 <w:keepNext>, 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 <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/flowfrm.cxx11
1 files changed, 11 insertions, 0 deletions
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<SwTextFrame&>(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" );