View | Details | Raw Unified | Return to issue 120016
Collapse All | Expand All

(-)a/main/sw/source/core/layout/tabfrm.cxx (-14 / +42 lines)
Lines 1875-1880 SwFrm* lcl_FormatNextCntntForKeep( SwTabFrm* pTabFrm ) Link Here
1875
    return pNxt;
1875
    return pNxt;
1876
}
1876
}
1877
1877
1878
namespace {
1879
    bool AreAllRowsKeepWithNext( const SwRowFrm* pFirstRowFrm )
1880
    {
1881
        bool bRet = pFirstRowFrm != 0 &&
1882
                    pFirstRowFrm->ShouldRowKeepWithNext();
1883
1884
        while ( bRet && pFirstRowFrm->GetNext() != 0 )
1885
        {
1886
            pFirstRowFrm = dynamic_cast<const SwRowFrm*>(pFirstRowFrm->GetNext());
1887
            bRet = pFirstRowFrm != 0 &&
1888
                   pFirstRowFrm->ShouldRowKeepWithNext();
1889
        }
1890
1891
        return bRet;
1892
    }
1893
}
1878
void SwTabFrm::MakeAll()
1894
void SwTabFrm::MakeAll()
1879
{
1895
{
1880
	if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
1896
	if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
Lines 2419-2429 void SwTabFrm::MakeAll() Link Here
2419
        // 2. If this row wants to keep, we need an additional row
2435
        // 2. If this row wants to keep, we need an additional row
2420
        // 3. The table is allowed to split or we do not have an pIndPrev:
2436
        // 3. The table is allowed to split or we do not have an pIndPrev:
2421
        //
2437
        //
2422
		SwFrm* pIndPrev = GetIndPrev();
2438
        SwFrm* pIndPrev = GetIndPrev();
2423
        const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
2439
        const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
2440
        // #120016# if this row wants to keep, allow split in case that all rows want to keep with next, 
2441
        // the table can not move forward as it is the first one and a split is in general allowed.
2442
        const bool bAllowSplitOfRow = ( bTableRowKeep && 
2443
                                        AreAllRowsKeepWithNext( pFirstNonHeadlineRow ) ) &&
2444
                                      !pIndPrev && 
2445
                                      !bDontSplit;
2424
2446
2425
        if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
2447
        if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
2426
             ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() ) &&
2448
             ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow ) &&
2427
             ( !bDontSplit || !pIndPrev ) )
2449
             ( !bDontSplit || !pIndPrev ) )
2428
        {
2450
        {
2429
            // --> FME 2004-06-03 #i29438#
2451
            // --> FME 2004-06-03 #i29438#
Lines 2442-2448 void SwTabFrm::MakeAll() Link Here
2442
2464
2443
            // 1. Try: bTryToSplit = true  => Try to split the row.
2465
            // 1. Try: bTryToSplit = true  => Try to split the row.
2444
            // 2. Try: bTryToSplit = false => Split the table between the rows.
2466
            // 2. Try: bTryToSplit = false => Split the table between the rows.
2445
			if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
2467
            if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
2446
            {
2468
            {
2447
                SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
2469
                SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
2448
                if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
2470
                if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
Lines 2515-2525 void SwTabFrm::MakeAll() Link Here
2515
                    // An existing follow flow line has to be removed.
2537
                    // An existing follow flow line has to be removed.
2516
                    //
2538
                    //
2517
                    if ( HasFollowFlowLine() )
2539
                    if ( HasFollowFlowLine() )
2518
						RemoveFollowFlowLine();
2540
                    {
2541
                        RemoveFollowFlowLine();
2542
                    }
2519
2543
2520
                    const bool bSplitError = !Split( nDeadLine, bTryToSplit, bTableRowKeep );
2544
                    const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) );
2521
					if( !bTryToSplit && !bSplitError && nUnSplitted > 0 )
2545
                    if( !bTryToSplit && !bSplitError && nUnSplitted > 0 )
2522
						--nUnSplitted;
2546
                    {
2547
                        --nUnSplitted;
2548
                    }
2523
2549
2524
                    // --> FME 2004-06-09 #i29771# Two tries to split the table:
2550
                    // --> FME 2004-06-09 #i29771# Two tries to split the table:
2525
                    // If an error occured during splitting. We start a second
2551
                    // If an error occured during splitting. We start a second
Lines 2546-2557 void SwTabFrm::MakeAll() Link Here
2546
                    {
2572
                    {
2547
                        lcl_RecalcRow( static_cast<SwRowFrm&>(*Lower()), LONG_MAX );
2573
                        lcl_RecalcRow( static_cast<SwRowFrm&>(*Lower()), LONG_MAX );
2548
                        bValidPos = sal_False;
2574
                        bValidPos = sal_False;
2549
    					bTryToSplit = false;
2575
                        bTryToSplit = false;
2550
                        continue;
2576
                        continue;
2551
                    }
2577
                    }
2552
                    // <--
2578
                    // <--
2553
2579
2554
  					bTryToSplit = !bSplitError;
2580
                    bTryToSplit = !bSplitError;
2555
2581
2556
                    //Damit es nicht zu Oszillationen kommt, muss der
2582
                    //Damit es nicht zu Oszillationen kommt, muss der
2557
                    //Follow gleich gueltig gemacht werden.
2583
                    //Follow gleich gueltig gemacht werden.
Lines 2636-2646 void SwTabFrm::MakeAll() Link Here
2636
        // Set to false again as early as possible.
2662
        // Set to false again as early as possible.
2637
        bLastRowHasToMoveToFollow = false;
2663
        bLastRowHasToMoveToFollow = false;
2638
2664
2639
		if( IsInSct() && bMovedFwd && bMakePage && GetUpper()->IsColBodyFrm() &&
2665
        if( IsInSct() && bMovedFwd && bMakePage && GetUpper()->IsColBodyFrm() &&
2640
			GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
2666
            GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
2641
			( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
2667
            ( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
2642
			((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
2668
            ((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
2643
			bMovedFwd = sal_False;
2669
        {
2670
            bMovedFwd = sal_False;
2671
        }
2644
2672
2645
        // --> FME 2004-06-09 #i29771# Reset bTryToSplit flag on change of upper
2673
        // --> FME 2004-06-09 #i29771# Reset bTryToSplit flag on change of upper
2646
        const SwFrm* pOldUpper = GetUpper();
2674
        const SwFrm* pOldUpper = GetUpper();

Return to issue 120016