sw/source/core/text/frmform.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit f98654c98c976732a7096a4f980b01a37a80016f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Aug 5 16:47:22 2024 +0500 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Aug 7 10:21:43 2024 +0200 tdf#162345 Allow splitting, when we have columns This makes a similar exclusion as above in bLoneAsCharAnchoredObj case. I don't know exactly why should this depend on columns, but this works (so this is basically a monkey programming here). Change-Id: I6f15da77a16629d9146076e0a4ef50f82ebdc04c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171481 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins (cherry picked from commit 43cb4360e9e9211bd131178c9f96ec3ce6bae682) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171424 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 7b19b793041f..9ce1475a3b1b 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1084,9 +1084,11 @@ void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew ) MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) ); } -static bool isFirstVisibleFrameInBody(const SwTextFrame* pFrame) +static bool isFirstVisibleFrameInPageBody(const SwTextFrame* pFrame) { const SwFrame* pBodyFrame = pFrame->FindBodyFrame(); + while (pBodyFrame && !pBodyFrame->IsPageBodyFrame()) + pBodyFrame = pBodyFrame->GetUpper()->FindBodyFrame(); if (!pBodyFrame) return false; for (const SwFrame* pCur = pFrame;;) @@ -1096,7 +1098,7 @@ static bool isFirstVisibleFrameInBody(const SwTextFrame* pFrame) return false; pCur = pCur->GetUpper(); assert(pCur); // We found pBodyFrame, right? - if (pCur->IsBodyFrame()) + if (pCur == pBodyFrame) return true; } } @@ -1184,7 +1186,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, if (FindColFrame()) bLoneAsCharAnchoredObj = false; // tdf#160526: only no split if there is no preceding frames on same page - else if (!isFirstVisibleFrameInBody(this)) + else if (!isFirstVisibleFrameInPageBody(this)) bLoneAsCharAnchoredObj = false; else nNew = 0; @@ -1204,8 +1206,10 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, else if (!bEmptyWithSplitFly) { // Do not split immediately in the beginning of page (unless there is an at-para or - // at-char or at-page fly, which pushes the rest down) - if (isFirstVisibleFrameInBody(this) && !hasFly(this) && pBodyFrame && !hasAtPageFly(pBodyFrame)) + // at-char or at-page fly, which pushes the rest down); tdf#136040: still try split text + // frame if we have columns. + if (pBodyFrame && !FindColFrame() && isFirstVisibleFrameInPageBody(this) + && !hasFly(this) && !hasAtPageFly(pBodyFrame)) nNew = 0; } }