sw/qa/extras/layout/data/ToC-in-linked-frame-on-first-page-style.fodt | 203 ++++++++++ sw/qa/extras/layout/layout5.cxx | 25 + 2 files changed, 228 insertions(+)
New commits: commit 72f5b6674f7f8991983ac49b6f7665e1a0e99511 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Nov 5 17:08:59 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Nov 8 18:18:01 2025 +0100 tdf#33687: add a unit test Fixed by commit db83c41d460103df5d80f5bd99816575c4ead5cd (tdf#156725 sw: layout: don't prevent moving between columns ..., 2023-08-18). Change-Id: I5bdc596af55d8b979c2ada76b67e98dfa9328b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193620 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/extras/layout/data/ToC-in-linked-frame-on-first-page-style.fodt b/sw/qa/extras/layout/data/ToC-in-linked-frame-on-first-page-style.fodt new file mode 100644 index 000000000000..cf2cbf626379 --- /dev/null +++ b/sw/qa/extras/layout/data/ToC-in-linked-frame-on-first-page-style.fodt @@ -0,0 +1,203 @@ +<?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:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta: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:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns :css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#000000" draw:fill-color="#99ccff" fo:wrap-option="no-wrap" draw:shadow-offset-x="8.5pt" draw:shadow-offset-y="8.5pt" draw:start-line-spacing-horizontal="8.02pt" draw:start-line-spacing-vertical="8.02pt" draw:end-line-spacing-horizontal="8.02pt" draw:end-line-spacing-vertical="8.02pt" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="35.46pt" style:writing-mode="page"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt" fo:hyphenate="false"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> + <style:paragraph-properties fo:margin-bottom="5mm" fo:keep-with-next="always"/> + <style:text-properties fo:font-size="14pt"/> + </style:style> + <style:style style:name="Contents_20_Heading" style:display-name="Contents Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> + <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> + </style:style> + <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"/> + <style:style style:name="Contents_20_1" style:display-name="Contents 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> + <style:paragraph-properties> + <style:tab-stops> + <style:tab-stop style:position="170mm" style:type="right" style:leader-style="dotted" style:leader-text="."/> + </style:tab-stops> + </style:paragraph-properties> + </style:style> + <style:style style:name="Frame" style:family="graphic"> + <style:graphic-properties text:anchor-type="paragraph" svg:x="0" svg:y="0" fo:margin-left="1mm" fo:margin-right="1mm" fo:margin-top="1mm" fo:margin-bottom="1mm" style:wrap="parallel" draw:fill="none" fo:padding="5mm" fo:border="0.06pt solid #000000"/> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="First_20_Page"/> + <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame"> + <style:graphic-properties style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/> + </style:style> + <style:style style:name="Sect1" style:family="section"/> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="210mm" fo:page-height="297mm" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm"/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + <style:master-page style:name="First_20_Page" style:display-name="First Page" style:page-layout-name="pm1" style:next-style-name="Standard"/> + </office:master-styles> + <office:body> + <office:text> + <text:p text:style-name="P1"/> + <text:p><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="paragraph" svg:x="1cm" svg:y="0" svg:width="7cm" svg:height="20cm"> + <draw:text-box draw:chain-next-name="Frame2"> + <text:table-of-content text:style-name="Sect1" text:protected="true" text:name="TOC1"> + <text:table-of-content-source text:outline-level="10"> + <text:index-title-template text:style-name="Contents_20_Heading">TOC</text:index-title-template> + <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents_20_1"> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + </text:table-of-content-entry-template> + </text:table-of-content-source> + <text:index-body> + <text:index-title text:style-name="Sect1" text:name="TOC1_Head"> + <text:p text:style-name="Contents_20_Heading">TOC</text:p> + </text:index-title> + <text:p text:style-name="Contents_20_1">Title Start<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>2</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>3</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>4</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title<text:tab/>5</text:p> + <text:p text:style-name="Contents_20_1">Title END<text:tab/>5</text:p> + </text:index-body> + </text:table-of-content> + <text:p/> + </draw:text-box> + </draw:frame></text:p> + <text:p><draw:frame draw:style-name="fr1" draw:name="Frame2" text:anchor-type="paragraph" svg:x="9cm" svg:y="0cm" svg:width="7cm" svg:height="20cm"> + <draw:text-box/> + </draw:frame></text:p> + <text:h text:outline-level="1">Title Start</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:p/> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:p/> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:p/> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title</text:h> + <text:h text:outline-level="1">Title END</text:h> + <text:p/> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout5.cxx b/sw/qa/extras/layout/layout5.cxx index 3752cd987a9a..efbf59ea6f1c 100644 --- a/sw/qa/extras/layout/layout5.cxx +++ b/sw/qa/extras/layout/layout5.cxx @@ -2308,6 +2308,31 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf169320) assertXPath(pXmlDoc, "//body/txt[5]//SwFieldPortion", "expand", u"4.1"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf33687) +{ + // A ToC in linked frames, on a First Page followed by a Standard page: + createSwDoc("ToC-in-linked-frame-on-first-page-style.fodt"); + auto pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//page", 5); + + // Check that the ToC text flows to the second frame: + + // First frame + assertXPath(pXmlDoc, "//page[1]/body/txt[2]/anchored/fly", "formatName", u"Frame1"); + assertXPath(pXmlDoc, "//page[1]/body/txt[2]/anchored/fly/section", 2); + assertXPath(pXmlDoc, "//page[1]/body/txt[2]/anchored/fly/section[1]", "formatName", + u"TOC1_Head"); + assertXPath(pXmlDoc, "//page[1]/body/txt[2]/anchored/fly/section[1]/txt", 1); + // Before the fix, this was 60: + assertXPath(pXmlDoc, "//page[1]/body/txt[2]/anchored/fly/section[2]/txt", 36); + + // Second frame + assertXPath(pXmlDoc, "//page[1]/body/txt[3]/anchored/fly", "formatName", u"Frame2"); + // Before the fix, there was no section in this frame, because ToC didn't flow here: + assertXPath(pXmlDoc, "//page[1]/body/txt[3]/anchored/fly/section", 1); + assertXPath(pXmlDoc, "//page[1]/body/txt[3]/anchored/fly/section[1]/txt", 24); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
