[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Mar 24 17:38:50 UTC 2016
sw/qa/extras/uiwriter/data/tdf88453-table.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 11 +++++++++++
sw/source/core/layout/tabfrm.cxx | 16 ++++++++++++++++
3 files changed, 27 insertions(+)
New commits:
commit f4eb82cf9fea5c1df49fad6ee2d91fc51854cd29
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 24 17:09:21 2016 +0100
tdf#88453 sw layout, nested table split: shrink inner tables as well
Commit b4b5dbee1ec7770ed64d7270de46d5cfc06b87b6 (tdf#88453 sw layout:
fix split of nested tables with large amount of rows, 2016-03-23) took
care of two similar problems when splitting tables which has nested
ones (setting cell height to 0 when its content height is 0, and setting
row height to 0 when its cells' height are zero).
Turns out there is a third aspect of the same problem: when row heights
are set to 0 during shrinking for table split purposes, the table height
has to be set to 0 as well, in case the table contains only 0-height
rows. With this, the original bugdoc's layout is the expected one.
Change-Id: I3f5392eb914a60e9caa5182dc6d44bd3a93f41d6
Reviewed-on: https://gerrit.libreoffice.org/23497
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf88453-table.odt b/sw/qa/extras/uiwriter/data/tdf88453-table.odt
new file mode 100644
index 0000000..2c20561
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf88453-table.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 5a3cbb7..f6b9d74 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -189,6 +189,7 @@ public:
void testTdf96479();
void testTdf96961();
void testTdf88453();
+ void testTdf88453Table();
void testClassificationPaste();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
@@ -282,6 +283,7 @@ public:
CPPUNIT_TEST(testTdf96479);
CPPUNIT_TEST(testTdf96961);
CPPUNIT_TEST(testTdf88453);
+ CPPUNIT_TEST(testTdf88453Table);
CPPUNIT_TEST(testClassificationPaste);
CPPUNIT_TEST_SUITE_END();
@@ -3523,6 +3525,15 @@ void SwUiWriterTest::testTdf88453()
assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1);
}
+void SwUiWriterTest::testTdf88453Table()
+{
+ createDoc("tdf88453-table.odt");
+ calcLayout();
+ // This was 2: layout could not split the large outer table in the document
+ // into 3 pages.
+ CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
namespace
{
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2f16c98..e185feac 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -364,11 +364,27 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
if ( pTmp->IsTabFrame() )
{
SwRowFrame* pTmpRow = static_cast<SwRowFrame*>(static_cast<SwTabFrame*>(pTmp)->Lower());
+ bool bAllRowsCollapsed = true;
+
while ( pTmpRow )
{
lcl_ShrinkCellsAndAllContent( *pTmpRow );
+
+ if ((pTmpRow->Frame().*fnRect->fnGetHeight)() > 0)
+ bAllRowsCollapsed = false;
+
pTmpRow = static_cast<SwRowFrame*>(pTmpRow->GetNext());
}
+
+ if (bAllRowsCollapsed)
+ {
+ // All rows of this table have 0 height -> set height of the table itself as well.
+ (pTmp->Frame().*fnRect->fnSetHeight)(0);
+ (pTmp->Prt().*fnRect->fnSetTop)(0);
+ (pTmp->Prt().*fnRect->fnSetHeight)(0);
+ }
+ else
+ bAllLowersCollapsed = false;
}
else
{
More information about the Libreoffice-commits
mailing list