sw/qa/extras/layout/data/tdf118058.fodt |   37 ++++++++++++++++++++++++++++++++
 sw/qa/extras/layout/layout.cxx          |    9 +++++++
 sw/source/core/layout/sectfrm.cxx       |   16 ++++++++++++-
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit 9b01a1a47453300dfda59e3bbacf80e960169654
Author:     Miklos Vajna <vmik...@collabora.co.uk>
AuthorDate: Mon Aug 13 21:03:08 2018 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Thu Aug 16 11:57:42 2018 +0200

    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.
    
    (cherry picked from commit d2d996db4806e84ae0bf6aef1c285b498f2d2867)
    
    Conflicts:
            sw/qa/extras/layout/layout.cxx
    
    Change-Id: Ifab220e582439d2e757b5645f3167b55a051a379
    Reviewed-on: https://gerrit.libreoffice.org/58983
    Tested-by: Jenkins
    Tested-by: Xisco Faulí <xiscofa...@libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

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 a3d0950db548..f94239b266e8 100755
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -27,6 +27,7 @@ public:
     void testTdf117245();
     void testTdf109077();
     void testTdf109137();
+    void testTdf118058();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
     CPPUNIT_TEST(testTdf116830);
@@ -39,6 +40,7 @@ public:
     CPPUNIT_TEST(testTdf117245);
     CPPUNIT_TEST(testTdf109077);
     CPPUNIT_TEST(testTdf109137);
+    CPPUNIT_TEST(testTdf118058);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -228,6 +230,13 @@ void SwLayoutWriter::testTdf109137()
                 /*nNumberOfNodes=*/1);
 }
 
+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 b12952b0114a..7f8009a5cc44 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -620,7 +620,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;
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to