Kaydet (Commit) 472d5610 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

#120016# - method <SwTabFrm::MakeAll()> - 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
üst cbb7f35d
...@@ -1875,6 +1875,22 @@ SwFrm* lcl_FormatNextCntntForKeep( SwTabFrm* pTabFrm ) ...@@ -1875,6 +1875,22 @@ SwFrm* lcl_FormatNextCntntForKeep( SwTabFrm* pTabFrm )
return pNxt; 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() void SwTabFrm::MakeAll()
{ {
if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 ) if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
...@@ -2421,9 +2437,15 @@ void SwTabFrm::MakeAll() ...@@ -2421,9 +2437,15 @@ void SwTabFrm::MakeAll()
// //
SwFrm* pIndPrev = GetIndPrev(); SwFrm* pIndPrev = GetIndPrev();
const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow(); const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
// #120016# 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 && if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() ) && ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow ) &&
( !bDontSplit || !pIndPrev ) ) ( !bDontSplit || !pIndPrev ) )
{ {
// --> FME 2004-06-03 #i29438# // --> FME 2004-06-03 #i29438#
...@@ -2515,11 +2537,15 @@ void SwTabFrm::MakeAll() ...@@ -2515,11 +2537,15 @@ void SwTabFrm::MakeAll()
// An existing follow flow line has to be removed. // An existing follow flow line has to be removed.
// //
if ( HasFollowFlowLine() ) if ( HasFollowFlowLine() )
{
RemoveFollowFlowLine(); RemoveFollowFlowLine();
}
const bool bSplitError = !Split( nDeadLine, bTryToSplit, bTableRowKeep ); const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) );
if( !bTryToSplit && !bSplitError && nUnSplitted > 0 ) if( !bTryToSplit && !bSplitError && nUnSplitted > 0 )
{
--nUnSplitted; --nUnSplitted;
}
// --> FME 2004-06-09 #i29771# Two tries to split the table: // --> FME 2004-06-09 #i29771# Two tries to split the table:
// If an error occured during splitting. We start a second // If an error occured during splitting. We start a second
...@@ -2551,7 +2577,7 @@ void SwTabFrm::MakeAll() ...@@ -2551,7 +2577,7 @@ void SwTabFrm::MakeAll()
} }
// <-- // <--
bTryToSplit = !bSplitError; bTryToSplit = !bSplitError;
//Damit es nicht zu Oszillationen kommt, muss der //Damit es nicht zu Oszillationen kommt, muss der
//Follow gleich gueltig gemacht werden. //Follow gleich gueltig gemacht werden.
...@@ -2640,7 +2666,9 @@ void SwTabFrm::MakeAll() ...@@ -2640,7 +2666,9 @@ void SwTabFrm::MakeAll()
GetUpper()->GetUpper()->GetUpper()->IsSctFrm() && GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) && ( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) ) ((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
{
bMovedFwd = sal_False; bMovedFwd = sal_False;
}
// --> FME 2004-06-09 #i29771# Reset bTryToSplit flag on change of upper // --> FME 2004-06-09 #i29771# Reset bTryToSplit flag on change of upper
const SwFrm* pOldUpper = GetUpper(); const SwFrm* pOldUpper = GetUpper();
......
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