summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/data/rhbz739252-3.odtbin0 -> 20869 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx13
-rw-r--r--sw/source/core/layout/sectfrm.cxx5
3 files changed, 16 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/data/rhbz739252-3.odt b/sw/qa/extras/uiwriter/data/rhbz739252-3.odt
new file mode 100644
index 000000000000..e457c035b662
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/rhbz739252-3.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b85a7e58e5b4..453c62dece55 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -256,6 +256,7 @@ public:
void testTdf107976();
void testTdf108524();
void testTableInSection();
+ void testTableInNestedSection();
void testLinesInSectionInTable();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
@@ -400,6 +401,7 @@ public:
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf108524);
CPPUNIT_TEST(testTableInSection);
+ CPPUNIT_TEST(testTableInNestedSection);
CPPUNIT_TEST(testLinesInSectionInTable);
CPPUNIT_TEST_SUITE_END();
@@ -4993,6 +4995,17 @@ void SwUiWriterTest::testTableInSection()
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row/cell", 2);
}
+void SwUiWriterTest::testTableInNestedSection()
+{
+ // The document has a nested section, containing a table that spans over 2 pages.
+ // This crashed the layout.
+ createDoc("rhbz739252-3.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // Make sure the table is inside a section and spans over 2 pages.
+ assertXPath(pXmlDoc, "//page[1]//section/tab", 1);
+ assertXPath(pXmlDoc, "//page[2]//section/tab", 1);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 7288251dfd12..08e3934ddf6f 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1515,9 +1515,10 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
SwLayoutFrame *pLayLeaf;
SwLayoutFrame* pCellLeaf = nullptr;
- if (IsInTab())
+ if (IsInTab() && !IsInTableInSection(this))
{
- // We are in a table, see if there is a follow cell frame created already.
+ // We are in a table (which is itself not in a section), see if there
+ // is a follow cell frame created already.
pCellLeaf = GetNextCellLeaf();
if (!pCellLeaf)
{