sw/qa/extras/layout/data/linked_frames_section_bug.odt |binary
 sw/qa/extras/layout/layout.cxx                         |   18 +++++++++++++++++
 sw/source/core/layout/sectfrm.cxx                      |    1 
 3 files changed, 19 insertions(+)

New commits:
commit a5153d28700d8743fa7e629e359a9e46b8115b64
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Aug 18 16:44:16 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Aug 30 12:34:57 2023 +0200

    tdf#156419 sw: layout: don't prevent moving between linked flys
    
    ... when there is a page break on the next page.
    
    Of course you can put a section into a fly, and then link multiple flys.
    
    (regression from commit 325fe7ab507fd8f2ca17a3db32181edf30169525)
    
    Change-Id: I5cb854fc7ee5caa2af4e04f4da2d8a8083c0d007
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155842
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 987fe1175de2db53235cc6f2441335fcc3548d64)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155845
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit a445d8bda04c5daf3bb2d86bd25e53bca2646c90)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155994
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/layout/data/linked_frames_section_bug.odt 
b/sw/qa/extras/layout/data/linked_frames_section_bug.odt
new file mode 100644
index 000000000000..639332ad5516
Binary files /dev/null and 
b/sw/qa/extras/layout/data/linked_frames_section_bug.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 06f5accc22f5..0ffdb543fbd9 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -5138,6 +5138,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155324)
     assertXPath(pXmlDoc, "/root/page[5]/ftncont/ftn", 5);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf156419)
+{
+    createSwDoc("linked_frames_section_bug.odt");
+
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page", 2);
+    // there are 2 flys on page 1, and 1 on page 2, all linked
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[1]/section/column", 2);
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[1]/section/column[1]/body/txt", 11);
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[1]/section/column[2]/body/txt", 11);
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[2]/section/column", 2);
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[2]/section/column[1]/body/txt", 12);
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt/anchored/fly[2]/section/column[2]/body/txt", 12);
+    assertXPath(pXmlDoc, 
"/root/page[2]/body/txt/anchored/fly[1]/section/column", 2);
+    assertXPath(pXmlDoc, 
"/root/page[2]/body/txt/anchored/fly[1]/section/column[1]/body/txt", 2);
+    assertXPath(pXmlDoc, 
"/root/page[2]/body/txt/anchored/fly[1]/section/column[2]/body/txt", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 11d855724914..b86ccbf1b31d 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1758,6 +1758,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType 
eMakePage )
             // creating / moving the cell frame.
             // It doesn't make sense to move to a page that starts with break?
             if (pNxtPg != FindPageFrame() // tdf#156725 not between columns!
+                && !FindFlyFrame() // tdf#156419 linked fly frames don't care!
                 && (WrongPageDesc(pNxtPg) || HasPageBreakBefore(*pNxtPg))
                 && !bLayLeafTableAllowed)
             {

Reply via email to