summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-24 17:09:21 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-24 17:38:20 +0000
commitf4eb82cf9fea5c1df49fad6ee2d91fc51854cd29 (patch)
treee2574f17cc424992224844f56d9b277440f74b6f /sw/source
parent64afe3040bf3d07bb0b13f03b33fce074383ee39 (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/tabfrm.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2f16c985ccd1..e185feac12f3 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
{