summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-13 21:03:08 +0200
committerAndras Timar <andras.timar@collabora.com>2018-08-28 20:26:07 +0200
commit57d732c628b39834a97165404ae02a32577259f5 (patch)
tree8d96bbcef87c9c32f470c05ef0beb30779d9a525
parent6fa9aaaa5dca4d6b79698b55a2f2c956c99c3482 (diff)
tdf#118058 sw, sections in tables: no split for multiple columns
The original use-case was "group a few paragraphs together" for the split sections inside tables, i.e. it's safe to not split when the section has multiple columns. And the multiple columns case would mean that we don't find where to put the follow section inside a table, resulting in a layout loop. Reviewed-on: https://gerrit.libreoffice.org/58951 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit d2d996db4806e84ae0bf6aef1c285b498f2d2867) Conflicts: sw/qa/extras/layout/layout.cxx Change-Id: Ifab220e582439d2e757b5645f3167b55a051a379 Reviewed-on: https://gerrit.libreoffice.org/59686 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sw/qa/extras/layout/data/tdf118058.fodt37
-rw-r--r--sw/qa/extras/layout/layout.cxx9
-rw-r--r--sw/source/core/layout/sectfrm.cxx16
3 files changed, 61 insertions, 1 deletions
diff --git a/sw/qa/extras/layout/data/tdf118058.fodt b/sw/qa/extras/layout/data/tdf118058.fodt
new file mode 100644
index 000000000000..dbdf26bf519f
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf118058.fodt
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging"/>
+ </style:default-style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Checklist" style:family="table">
+ <style:table-properties style:width="12.338cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Checklist.A" style:family="table-column">
+ <style:table-column-properties style:column-width="12.338cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Checklist.1" style:family="table-row">
+ <style:table-row-properties fo:background-color="#ffff00">
+ <style:background-image/>
+ </style:table-row-properties>
+ </style:style>
+ <style:style style:name="Checklist.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding-left="0.25cm" fo:padding-right="0.101cm" fo:padding-top="0.101cm" fo:padding-bottom="0.101cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties text:dont-balance-text-columns="false" style:editable="false">
+ <style:columns fo:column-count="2" fo:column-gap="0.497cm">
+ <style:column style:rel-width="32767*" fo:start-indent="0cm" fo:end-indent="0.249cm"/>
+ <style:column style:rel-width="32768*" fo:start-indent="0.249cm" fo:end-indent="0cm"/>
+ </style:columns>
+ </style:section-properties>
+ </style:style>
+ </office:automatic-styles>
+ <office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <text:p text:style-name="P5"><draw:frame draw:style-name="fr1" draw:name="Rámec2" text:anchor-type="paragraph" svg:x="-0.039cm" svg:y="1.914cm" svg:width="12.338cm" svg:height="15.399cm" draw:z-index="0"><draw:text-box><table:table table:name="Checklist" table:style-name="Checklist"><table:table-column table:style-name="Checklist.A"/><table:table-row table:style-name="Checklist.1"><table:table-cell table:style-name="Checklist.A1" office:value-type="string"><text:p text:style-name="Table_20_header"/></table:table-cell></table:table-row><table:table-row table:style-name="Checklist.1"><table:table-cell table:style-name="Checklist.A1" office:value-type="string"><text:p text:style-name="P3"/></table:table-cell></table:table-row><table:table-row table:style-name="Checklist.1"><table:table-cell table:style-name="Checklist.A1" office:value-type="string"><text:p text:style-name="Table_20_header"/></table:table-cell></table:table-row><table:table-row><table:table-cell table:style-name="Checklist.A1" office:value-type="string"><text:section text:style-name="Sect1" text:name="Oblasť1"><text:p text:style-name="P4">Para 1.</text:p><text:p text:style-name="P2">No. However, you will not be able to see the colours produced on a black-and-white set.</text:p></text:section></table:table-cell></table:table-row></table:table><text:p text:style-name="P1"/></draw:text-box></draw:frame></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9a73e2025147..d7a25e95886c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -19,11 +19,13 @@ public:
void testTdf116830();
void testTdf116925();
void testTdf117028();
+ void testTdf118058();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testTdf116830);
CPPUNIT_TEST(testTdf116925);
CPPUNIT_TEST(testTdf117028);
+ CPPUNIT_TEST(testTdf118058);
CPPUNIT_TEST_SUITE_END();
private:
@@ -108,6 +110,13 @@ void SwLayoutWriter::testTdf117028()
assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
}
+void SwLayoutWriter::testTdf118058()
+{
+ SwDoc* pDoc = createDoc("tdf118058.fodt");
+ // This resulted in a layout loop.
+ pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 1030d9ecb0e2..3790c92a199d 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -617,7 +617,21 @@ namespace
return true;
// The frame is in a table, see if the table is in a section.
- return !pFrame->FindTabFrame()->IsInSct();
+ bool bRet = !pFrame->FindTabFrame()->IsInSct();
+
+ if (bRet)
+ {
+ // Don't try to split if the frame itself is a section frame with
+ // multiple columns.
+ if (pFrame->IsSctFrame())
+ {
+ const SwFrame* pLower = pFrame->GetLower();
+ if (pLower && pLower->IsColumnFrame())
+ bRet = false;
+ }
+ }
+
+ return bRet;
}
}