From 57d732c628b39834a97165404ae02a32577259f5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 13 Aug 2018 21:03:08 +0200 Subject: 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 (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 --- 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(-) create mode 100644 sw/qa/extras/layout/data/tdf118058.fodt 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Para 1.No. However, you will not be able to see the colours produced on a black-and-white set. + + + 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; } } -- cgit v1.2.3