sw/source/core/layout/tabfrm.cxx | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
New commits: commit 84203fab20b7eb98f0d3667e6626f5c2139e5a7f Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Mon Jul 9 15:43:44 2012 +0000 Resolves: #i120016# refine condition for allowing split of a table row Found by: Yan Ji, Jian Hong Cheng Patch by: Oliver-Rainer Wittmann Review by: Jian Hong Cheng (cherry picked from commit 472d5610c71b7a74e6d279d8f625cec8b41b8e81) Conflicts: sw/source/core/layout/tabfrm.cxx Change-Id: I718a0c70c12ed34c4ca3a2826f388b17a84c63e7 diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index dde5056..4c62cb9 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1800,6 +1800,22 @@ SwFrm* sw_FormatNextCntntForKeep( SwTabFrm* pTabFrm ) return pNxt; } +namespace { + bool AreAllRowsKeepWithNext( const SwRowFrm* pFirstRowFrm ) + { + bool bRet = pFirstRowFrm != 0 && + pFirstRowFrm->ShouldRowKeepWithNext(); + + while ( bRet && pFirstRowFrm->GetNext() != 0 ) + { + pFirstRowFrm = dynamic_cast<const SwRowFrm*>(pFirstRowFrm->GetNext()); + bRet = pFirstRowFrm != 0 && + pFirstRowFrm->ShouldRowKeepWithNext(); + } + + return bRet; + } +} void SwTabFrm::MakeAll() { if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 ) @@ -2334,9 +2350,15 @@ void SwTabFrm::MakeAll() // SwFrm* pIndPrev = GetIndPrev(); const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow(); + // #i120016# if this row wants to keep, allow split in case that all rows want to keep with next, + // the table can not move forward as it is the first one and a split is in general allowed. + const bool bAllowSplitOfRow = ( bTableRowKeep && + AreAllRowsKeepWithNext( pFirstNonHeadlineRow ) ) && + !pIndPrev && + !bDontSplit; if ( pFirstNonHeadlineRow && nUnSplitted > 0 && - ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() ) && + ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow ) && ( !bDontSplit || !pIndPrev ) ) { // #i29438# @@ -2420,11 +2442,15 @@ void SwTabFrm::MakeAll() // An existing follow flow line has to be removed. // if ( HasFollowFlowLine() ) + { RemoveFollowFlowLine(); + } - const bool bSplitError = !Split( nDeadLine, bTryToSplit, bTableRowKeep ); + const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) ); if( !bTryToSplit && !bSplitError && nUnSplitted > 0 ) + { --nUnSplitted; + } // #i29771# Two tries to split the table // If an error occurred during splitting. We start a second @@ -2454,7 +2480,7 @@ void SwTabFrm::MakeAll() continue; } - bTryToSplit = !bSplitError; + bTryToSplit = !bSplitError; //To avoid oscillations the Follow must become valid now if ( GetFollow() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits