Kaydet (Commit) 8da365e2 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: split section frames inside table cells, handle nested tables

Commit 3d1bb76e (tdf#112109 sw: split
section frames inside table cells, ignore nested tables, 2017-08-31)
explicitly disabled this, but the underlying problem is now fixed with
commit ec262cbc (tdf#112160 sw: audit
GetNextLayoutLeaf() calls in SwFrame::GetNextSctLeaf(), 2017-09-04), so
we can have it again.

Change-Id: Ic17c4921de2c69e4cc16ae82cfed58d096879db7
üst 68af7378
......@@ -267,6 +267,7 @@ public:
void testTableInNestedSection();
void testTableInSectionInTable();
void testSectionInTableInTable();
void testSectionInTableInTable2();
void testTdf112160();
void testLinesMoveBackwardsInSectionInTable();
#endif
......@@ -422,6 +423,7 @@ public:
CPPUNIT_TEST(testTableInNestedSection);
CPPUNIT_TEST(testTableInSectionInTable);
CPPUNIT_TEST(testSectionInTableInTable);
CPPUNIT_TEST(testSectionInTableInTable2);
CPPUNIT_TEST(testTdf112160);
CPPUNIT_TEST(testLinesMoveBackwardsInSectionInTable);
#endif
......@@ -5180,6 +5182,21 @@ void SwUiWriterTest::testSectionInTableInTable()
createDoc("tdf112109.fodt");
}
void SwUiWriterTest::testSectionInTableInTable2()
{
createDoc("split-section-in-nested-table.fodt");
xmlDocPtr pXmlDoc = parseLayoutDump();
sal_uInt32 nSection1 = getXPath(pXmlDoc, "//page[1]//body/tab/row/cell/tab/row/cell/section", "id").toUInt32();
sal_uInt32 nSection1Follow = getXPath(pXmlDoc, "//page[1]//body/tab/row/cell/tab/row/cell/section", "follow").toUInt32();
// This failed, the section wasn't split inside a nested table.
sal_uInt32 nSection2 = getXPath(pXmlDoc, "//page[2]//body/tab/row/cell/tab/row/cell/section", "id").toUInt32();
sal_uInt32 nSection2Precede = getXPath(pXmlDoc, "//page[2]//body/tab/row/cell/tab/row/cell/section", "precede").toUInt32();
// Make sure that the first's follow and the second's precede is correct.
CPPUNIT_ASSERT_EQUAL(nSection2, nSection1Follow);
CPPUNIT_ASSERT_EQUAL(nSection1, nSection2Precede);
}
void SwUiWriterTest::testTdf112160()
{
// Assert that the A2 cell is on page 1.
......
......@@ -589,34 +589,14 @@ namespace
return pLayFrame;
}
/// Checks if pFrame is in a table, which itself is in a section.
bool IsFrameInTableInSection(const SwFrame* pFrame)
/// Checks if pFrame has a parent that can contain a split section frame.
bool CanContainSplitSection(const SwFrame* pFrame)
{
if (!pFrame->IsInTab())
return false;
return true;
// The frame is in a table, see if the table is in a section.
return pFrame->FindTabFrame()->IsInSct();
}
/// Checks if pFrame is in a table, which itself is in a table.
bool IsFrameInTableInTable(const SwFrame* pFrame)
{
if (!pFrame->IsInTab())
return false;
// The frame is in a table, see if the inner table is in an outer
// table.
bool bNested = false;
if (const SwFrame* pUpper = pFrame->FindTabFrame()->GetUpper())
bNested = pUpper->IsInTab();
return bNested;
}
/// Checks if pFrame has a parent that can contain a split section frame.
bool CanContainSplitSection(const SwFrame* pFrame)
{
return !IsFrameInTableInSection(pFrame) && !IsFrameInTableInTable(pFrame);
return !pFrame->FindTabFrame()->IsInSct();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment