sw/qa/extras/layout/data/tdf169607-big-letters.fodt | 25 ++++++++++++++++++++ sw/qa/extras/layout/layout6.cxx | 13 ++++++++++ sw/source/core/text/frmform.cxx | 13 ++++++++++ 3 files changed, 51 insertions(+)
New commits: commit 950eaf7ade2ba8f742bb34a0d12d8446fe93c27a Author: Mike Kaganski <[email protected]> AuthorDate: Sun Feb 8 17:08:52 2026 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Feb 8 16:10:22 2026 +0100 tdf#169607: Do split when learned that it wasn't an empty master split Commit ae9e8f3f6d10b0be2fe5b9b238a531b17e0d67da prevented splitting master frame at the beginning of page, because there shouldn't be an empty frame there. But the actual number of characters that goes to the master frame will only be known after FindBreak, at which point it may turn out that the suppression was wrong. This change checks this situation, and splits anyway. It is similar to what happens below, where SplitFrame is also called. Change-Id: If32fe2817a91724d704a096111a963f63deee593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198902 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/qa/extras/layout/data/tdf169607-big-letters.fodt b/sw/qa/extras/layout/data/tdf169607-big-letters.fodt new file mode 100644 index 000000000000..1875781f248d --- /dev/null +++ b/sw/qa/extras/layout/data/tdf169607-big-letters.fodt @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:settings> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">true</config:config-item> + </config:config-item-set> + </office:settings> + <office:automatic-styles> + <style:style style:name="T1" style:family="text"> + <style:text-properties fo:font-size="500pt"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="297mm" fo:page-height="210mm" style:print-orientation="landscape" fo:margin-top="20mm" fo:margin-bottom="20mm" fo:margin-left="20mm" fo:margin-right="20mm" style:writing-mode="lr-tb"/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <text:p loext:marker-style-name="T1"><text:span text:style-name="T1">FOOBAR</text:span></text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout6.cxx b/sw/qa/extras/layout/layout6.cxx index 859515ff48f3..7022d355f9af 100644 --- a/sw/qa/extras/layout/layout6.cxx +++ b/sw/qa/extras/layout/layout6.cxx @@ -2152,6 +2152,19 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf167946) assertXPath(pXmlDoc, "//SwLineLayout[2]/child::*[81]", "portion", u","); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf169607) +{ + // Given a document with a sequence of huge letters, each of which don't fit to page vertically: + createSwDoc("tdf169607-big-letters.fodt"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + CPPUNIT_ASSERT(pXmlDoc); + + // There must be three pages, because the sequence must split two characters per page. Before + // the fix, there was only one page: + assertXPath(pXmlDoc, "//page", 3); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index dc4e06c89292..7afd83430384 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1233,6 +1233,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, GetDrawObjs() && GetDrawObjs()->size() == 1 && (*GetDrawObjs())[0]->GetFrameFormat()->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR; + bool bCreateNewSuppressedByEmptySplit = false; if (bLoneAsCharAnchoredObj) { // Still try split text frame if we have columns. @@ -1263,7 +1264,10 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, // frame if we have columns. if (pBodyFrame && !FindColFrame() && isFirstVisibleFrameInPageBody(this) && !hasFly(this) && !hasAtPageFly(pBodyFrame)) + { createNew = false; + bCreateNewSuppressedByEmptySplit = true; + } } } @@ -1317,6 +1321,15 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, if( !bDelta ) GetFollow()->ManipOfst( nEnd ); } + else + { + if (bCreateNewSuppressedByEmptySplit && nEnd != nOld) + { + // Not empty split: nEnd moved + SplitFrame(nEnd); + dontJoin = true; + } + } } else { // If we pass over lines, we must not call Join in Follows, instead we even
