summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/tabfrm.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-10-30 16:32:39 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-10-30 19:10:04 +0100
commitc9c956f2716c58e2573a9ac07073f712d736ed02 (patch)
tree4d9546f243c8bd88e2a3f721a48492abd57437ca /sw/source/core/layout/tabfrm.cxx
parent0c364fa7d507ae41bf04d36464f8942d154e49c0 (diff)
tdf#113520 sw split sections in tables: avoid empty page after content del
The problem was that since split sections are allowed in nested tables, deleting enough content so that the full content of a page is removed results in an empty page, having only a 0 height table. I.e. the split section gets removed properly, the inner table (and its row and column) as well, but the outer table is still there, though it is marked to have 0 height. This results in a situation that the previous page doesn't have free space (the in-table section tries to take as much space as it can), but on the other hand we try (and fail) to move the 0 height table on the current page to the previous one, as it doesn't have free space. At the end the "empty" page still has an invisible table frame, so it is not removed. Fix the problem by allowing the move of a 0 height follow table frame from the current page to the previous one, even it has no empty space. Change-Id: I2a5fac88b8b7dc2b91d041b58a4ad1b328f56a6b Reviewed-on: https://gerrit.libreoffice.org/44059 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/core/layout/tabfrm.cxx')
-rw-r--r--sw/source/core/layout/tabfrm.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index cdf0ef0b9d01..65f1e7373e13 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2108,7 +2108,13 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*pTmp);
if ( bBrowseMode )
nDeadLine += pTmp->Grow( LONG_MAX, true );
- if( aRectFnSet.BottomDist( getSwFrame(), nDeadLine ) > 0 )
+ bool bFits = aRectFnSet.BottomDist(getSwFrame(), nDeadLine) > 0;
+ if (!bFits && aRectFnSet.GetHeight(GetFollow()->getSwFrame()) == 0)
+ // The follow should move backwards, so allow the case
+ // when the upper has no space, but the follow is
+ // empty.
+ bFits = aRectFnSet.BottomDist(getSwFrame(), nDeadLine) >= 0;
+ if (bFits)
{
// First, we remove an existing follow flow line.
if ( HasFollowFlowLine() )
@@ -3413,7 +3419,12 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool &rReformat
rReformat = true;
return true;
}
- if (!m_bLockBackMove && nSpace > 0)
+ bool bFits = nSpace > 0;
+ if (!bFits && aRectFnSet.GetHeight(getSwFrame()) == 0)
+ // This frame fits into pNewUpper in case it has no space, but this
+ // frame is empty.
+ bFits = nSpace >= 0;
+ if (!m_bLockBackMove && bFits)
{
// #i26945# - check, if follow flow line
// contains frame, which are moved forward due to its object