summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-10-01 13:47:20 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-10-02 12:52:33 +0500
commitf518b009966adc40112ceb1b695022fb822e5ecc (patch)
treefef238f8b2bafafff3a267627b8f189835568464
parent586e100507359514f298a45958c26e6b9cc7783f (diff)
tdf#163230: make loop control hack more specific distro/collabora/dcm-7.5
Commit 0c49aa58cfbb81073e34b1d47861a5a1fdd44114 (tdf#161508: add another loop control hack, 2024-06-11) only checked the frame area sizes and positions, but ignores the "valid" frags. It turns out, that these flags also needed when checking the loop condition. Change-Id: If155f2424b9a02cad6bf6d5c931dfccfb110d4c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174310 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/layout/data/tdf163230.fodt108
-rw-r--r--sw/qa/extras/layout/layout2.cxx9
-rw-r--r--sw/source/core/layout/tabfrm.cxx48
3 files changed, 159 insertions, 6 deletions
diff --git a/sw/qa/extras/layout/data/tdf163230.fodt b/sw/qa/extras/layout/data/tdf163230.fodt
new file mode 100644
index 000000000000..5f100026d440
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf163230.fodt
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible: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:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="36pt" style:writing-mode="page"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" style:letter-kerning="false" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text">
+ <style:paragraph-properties fo:margin-top="0pt" fo:margin-bottom="8pt" style:contextual-spacing="false" fo:line-height="108%" fo:text-align="start" style:justify-single-word="false" fo:orphans="2" fo:widows="2" style:writing-mode="lr-tb"/>
+ </style:style>
+ <style:default-page-layout>
+ <style:page-layout-properties style:writing-mode="lr-tb" style:layout-grid-standard-mode="true"/>
+ </style:default-page-layout>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="11cm" fo:margin-left="0" fo:margin-top="0" fo:margin-bottom="0cm" table:align="left" style:writing-mode="page"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="11cm"/>
+ </style:style>
+ <style:style style:name="Table1.1" style:family="table-row">
+ <style:table-row-properties style:min-row-height="1cm" fo:keep-together="always"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding-left="1mm" fo:padding-right="1mm" fo:padding-top="0" fo:padding-bottom="0" fo:border="1pt solid #000000"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-bottom="0pt" style:contextual-spacing="false" fo:orphans="0" fo:widows="0"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="11cm" fo:page-height="19cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0" fo:margin-bottom="0cm" fo:margin-left="0" fo:margin-right="0" style:writing-mode="lr-tb"/>
+ <style:header-style>
+ <style:header-footer-properties fo:min-height="1cm" fo:margin-left="0" fo:margin-right="0" fo:margin-bottom="0cm" style:dynamic-spacing="true"/>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="1cm" fo:margin-left="0" fo:margin-right="0" fo:margin-top="0" style:dynamic-spacing="true"/>
+ </style:footer-style>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1">
+ <style:header>
+ <text:p/>
+ </style:header>
+ <style:footer>
+ <text:p/>
+ </style:footer>
+ </style:master-page>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1">
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st:</text:p>
+ <text:list>
+ <text:list-item>
+ <text:p>aaa</text:p>
+ </text:list-item>
+ <text:list-item>
+ <text:p>bbb</text:p>
+ </text:list-item>
+ <text:list-item>
+ <text:p>cccc</text:p>
+ </text:list-item>
+ <text:list-item>
+ <text:p>ddd</text:p>
+ </text:list-item>
+ </text:list>
+ <text:p text:style-name="P1">1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st.</text:p>
+ <text:p/>
+ <text:p text:style-name="P1">1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ <text:p/>
+ <text:p text:style-name="P1">1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st.</text:p>
+ <text:p/>
+ <text:p text:style-name="P1">1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st s:</text:p>
+ <text:p/>
+ <text:p/>
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ <text:p/>
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ <text:p>1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st 1_st</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1">
+ <text:p>2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd 2_nd</text:p>
+ <text:p/>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ </office:text>
+ </office:body>
+</office:document> \ No newline at end of file
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 12edcb311b71..60338481d0d7 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -3109,6 +3109,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTdf162614)
// clang-format on
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTdf163230)
+{
+ createSwDoc("tdf163230.fodt");
+ auto pExportDump = parseLayoutDump();
+ // The first row must split across pages, despite its "do not break" attribute, because it
+ // doesn't fit on the page. Before the fix, the document had only two pages.
+ assertXPath(pExportDump, "//page", 3);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 794f0f85b4f0..b8cc2523f8b5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1921,19 +1921,55 @@ public:
bool OscillationDetected(const SwFrameAreaDefinition& rFrameArea);
private:
- std::vector<std::pair<SwRect, SwRect>> maFrameDatas;
+ // A partial copy of SwFrameAreaDefinition data
+ struct FrameData
+ {
+ SwRect frameArea;
+ SwRect framePrintArea;
+ bool frameAreaPositionValid;
+ bool frameAreaSizeValid;
+ bool framePrintAreaValid;
+
+ FrameData(const SwFrameAreaDefinition& src)
+ : frameArea(src.getFrameArea())
+ , framePrintArea(src.getFramePrintArea())
+ , frameAreaPositionValid(src.isFrameAreaPositionValid())
+ , frameAreaSizeValid(src.isFrameAreaSizeValid())
+ , framePrintAreaValid(src.isFramePrintAreaValid())
+ {
+ }
+
+ bool operator==(const SwFrameAreaDefinition& src) const
+ {
+ return frameArea == src.getFrameArea() && framePrintArea == src.getFramePrintArea()
+ && frameAreaPositionValid == src.isFrameAreaPositionValid()
+ && frameAreaSizeValid == src.isFrameAreaSizeValid()
+ && framePrintAreaValid == src.isFramePrintAreaValid();
+ }
+ };
+ std::vector<FrameData> maFrameDatas;
};
bool PosSizeOscillationControl::OscillationDetected(const SwFrameAreaDefinition& rFrameArea)
{
+ for (size_t i = 0; i < maFrameDatas.size(); ++i)
+ {
+ const auto& f = maFrameDatas[i];
+ if (f == rFrameArea)
+ {
+ SAL_WARN("sw.layout",
+ "PosSize oscillation: frame " << i << " repeated; total frames " << maFrameDatas.size());
+ return true;
+ }
+ }
+
if (maFrameDatas.size() == 20) // stack is full -> oscillation
+ {
+ SAL_WARN("sw.layout", "PosSize oscillation: max frames");
return true;
+ }
- for (const auto& [area, printArea] : maFrameDatas)
- if (rFrameArea.getFrameArea() == area && rFrameArea.getFramePrintArea() == printArea)
- return true;
-
- maFrameDatas.emplace_back(rFrameArea.getFrameArea(), rFrameArea.getFramePrintArea());
+ maFrameDatas.emplace_back(rFrameArea);
return false;
}
}