23 #include <viewimp.hxx>
57 #include <objectformatter.hxx>
74 , m_bCalcLowers(false)
75 , m_bLowersFormatted(false)
76 , m_bLockBackMove(false)
77 , m_bResizeHTMLTable(false)
78 , m_bONECalcLowers(false)
79 , m_bHasFollowFlowLine(false)
80 , m_bIsRebuildLastLine(false)
81 , m_bRestrictTableGrowth(false)
82 , m_bRemoveFollowFlowLinePending(false)
83 , m_bConsiderObjsForMinCellHeight(true)
84 , m_bObjsDoesFit(true)
85 , m_bInRecalcLowerRow(false)
86 , m_bSplitRowDisabled(false)
94 for (
size_t i = 0;
i < rLines.
size(); ++
i )
111 , m_pTable( rTab.GetTable() )
113 , m_bCalcLowers(false)
114 , m_bLowersFormatted(false)
115 , m_bLockBackMove(false)
116 , m_bResizeHTMLTable(false)
117 , m_bONECalcLowers(false)
118 , m_bHasFollowFlowLine(false)
119 , m_bIsRebuildLastLine(false)
120 , m_bRestrictTableGrowth(false)
121 , m_bRemoveFollowFlowLinePending(false)
122 , m_bConsiderObjsForMinCellHeight(true)
123 , m_bObjsDoesFit(true)
124 , m_bInRecalcLowerRow(false)
125 , m_bSplitRowDisabled(false)
180 bool _bOnlyRowsAndCells =
false );
186 const bool _bConsiderObjs );
193 if ( !nCount || !pStart)
198 while ( pStart && nCount > 0 )
211 OSL_ENSURE( rTmpRow.
IsRowFrame(),
"No row frame to copy for FollowFlowLine" );
219 return pFollowFlowLine;
226 const bool _bMoveObjsOutOfRange =
false,
233 OSL_ENSURE( _pPageFrame,
234 "<lcl_InvalidateLowerObjs(..)> - missing page frame -> no move of lower objects out of range" );
243 while ( pLowerFrame )
248 _bMoveObjsOutOfRange, _pPageFrame );
255 pAnchoredObj->SetTmpConsiderWrapInfluence(
false );
256 pAnchoredObj->SetConsiderForTextWrap(
false );
257 pAnchoredObj->UnlockPosition();
258 pAnchoredObj->InvalidateObjPos();
263 if ( _bMoveObjsOutOfRange )
269 pAnchoredObj->SetObjLeft( _pPageFrame->getFrameArea().Right() );
273 pAnchoredObj->ClearCharRectAndTopOfLine();
274 pAnchoredObj->SetCurrRelPos(
Point( 0, 0 ) );
275 if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
276 == RndStdIds::FLY_AS_CHAR )
278 pAnchoredObj->AnchorFrame()
280 &(pAnchoredObj->GetFrameFormat()) );
282 if ( pFly !=
nullptr )
290 if ( pFly !=
nullptr )
296 pLowerFrame = pLowerFrame->
GetNext();
306 bool bAllCellsCollapsed =
true;
307 while ( pCurrMasterCell )
323 bool bAllLowersCollapsed =
true;
325 if ( pTmp && pTmp->IsRowFrame() )
336 if ( pTmp->IsTabFrame() )
339 bool bAllRowsCollapsed =
true;
346 bAllRowsCollapsed =
false;
351 if (bAllRowsCollapsed)
358 aRectFnSet.
SetTop(aPrt, 0);
362 bAllLowersCollapsed =
false;
366 pTmp->Shrink(aRectFnSet.
GetHeight(pTmp->getFrameArea()));
368 aRectFnSet.
SetTop(aPrt, 0);
371 if (aRectFnSet.
GetHeight(pTmp->getFrameArea()) > 0)
373 bAllLowersCollapsed =
false;
377 pTmp = pTmp->GetPrev();
386 if (bAllLowersCollapsed)
393 aRectFnSet.
SetTop(aPrt, 0);
397 bAllCellsCollapsed =
false;
402 if (bAllCellsCollapsed)
409 aRectFnSet.
SetTop(aPrt, 0);
423 while ( pCurrSourceCell )
428 while ( pTmpSourceRow )
439 while ( pTmpDestRow->
GetNext() )
440 pTmpDestRow = static_cast<SwRowFrame*>(pTmpDestRow->
GetNext());
501 while ( pCurrLastLineCell )
512 while ( pTmpLastLineRow->
GetNext() && nTmpCut > nCurrentHeight )
514 nTmpCut -= nCurrentHeight;
525 bool bTableLayoutTooComplex =
false;
545 if ( static_cast<SwCellFrame*>(pCell)->
Lower() &&
546 static_cast<SwCellFrame*>(pCell)->
Lower()->IsRowFrame() )
548 bTableLayoutTooComplex =
true;
567 if ( nTmpCut > nCurrentHeight ||
569 !bTableLayoutTooComplex && nMinHeight < nTmpCut ) )
576 pNewRow->
InsertBehind( pCurrFollowFlowLineCell,
nullptr );
581 while ( pTmpLastLineRow )
586 pTmpLastLineRow->
InsertBefore( pCurrFollowFlowLineCell,
nullptr );
589 pTmpLastLineRow = pTmp;
594 pCurrFollowFlowLineCell =
static_cast<SwCellFrame*
>(pCurrFollowFlowLineCell->
GetNext());
602 while ( pCurrMasterCell )
604 if ( pCurrMasterCell->
Lower() &&
611 OSL_ENSURE( pRowFrame->
GetFollowRow(),
"Deleting row frame without follow" );
671 rTab.
Shrink(nAlreadyFree + nCurLastLineHeight - nRemainingSpaceForLastRow + 1);
674 bool bUnlockMaster =
false;
679 bUnlockMaster =
true;
696 rLastLine.
Calc(pRenderContext);
718 const SwTwips nDistanceToUpperPrtBottom =
730 for (
SwFootnoteFrame const* pFootnote = static_cast<SwFootnoteFrame const*>(pCont->Lower());
731 pFootnote !=
nullptr;
746 nFollowFootnotes += aRectFnSet.GetHeight(pFootnote->getFrameArea());
752 if (nDistanceToUpperPrtBottom + nFollowFootnotes < 0 || !rTab.
DoesObjsFit())
763 while ( pCurrMasterCell )
822 if ( nLayoutRowSpan > 1 )
846 bool bNextRow =
false;
848 while ( pCurrentRowFrame )
862 pCurrentRowFrame = bNextRow ?
884 pLastLine,
"There should be a flowline in the follow" );
887 if ( !pFollowFlowLine || !pLastLine )
891 SAL_WARN(
"sw.layout",
"Cannot remove in-use Follow Flow Line");
908 if ( nRowsToMove > 1 )
915 while ( pRow && nRowsToMove-- > 1 )
927 pInsertBehind = pRow;
935 pFirstRow = pFirstRow->
GetNext();
942 bool bJoin = !pFollowFlowLine->
GetNext();
943 pFollowFlowLine->
Cut();
978 if (!pSectionLower->IsColumnFrame())
984 for (
const SwFrame* pFrame = pSectionLower; pFrame; pFrame = pFrame->
GetNext())
986 if (pFrame->IsTabFrame())
1001 pTmpFrame = pTmpFrame->
GetNext();
1031 sal_uInt16 nRowCount = 0;
1033 SwTwips nRemainingSpaceForLastRow =
1035 nRemainingSpaceForLastRow -= aRectFnSet.
GetTopMargin(*
this);
1066 bSplitRowAllowed =
false;
1075 bTryToSplit =
false;
1082 bool bKeepNextRow =
false;
1083 if ( nRowCount < nRepeat )
1088 OSL_ENSURE( !
GetIndPrev(),
"Table is supposed to be at beginning" );
1092 else if ( !
GetIndPrev() && nRepeat == nRowCount )
1097 if ( bTryToSplit && bSplitRowAllowed )
1102 while ( pLowerCell )
1110 bKeepNextRow =
true;
1118 bKeepNextRow =
true;
1142 bSplitRowAllowed = bSplitRowAllowed && bTryToSplit &&
1147 if ( !bSplitRowAllowed && bTableRowKeep )
1152 nRowCount > nRepeat )
1169 if ( !bSplitRowAllowed )
1172 if ( pRow == pFirstNonHeadlineRow )
1182 if ( !pTmpRow || pRow == pTmpRow )
1217 for ( nRowCount = 0; nRowCount < nRepeat; ++nRowCount )
1222 *
GetTable()->GetTabLines()[ nRowCount ],
this );
1229 if( !pTable->
empty() )
1238 ?
static_cast<SwTextFrame*
>(pFrame)->GetTextNodeFirst()->GetIndex()
1253 if ( bSplitRowAllowed )
1271 while ( pCellFrame )
1305 pInsertBehind = pRow;
1324 pRow->
Paste( pFoll, pPasteBefore );
1342 if (!bRet && !bSplitRowAllowed)
1404 if ( static_cast<SwLayoutFrame*>(pFrame)->Lower() )
1442 if ( pToInvalidate->
Lower() )
1489 int nLoopControlRuns = 0;
1490 const int nLoopControlMax = 10;
1493 while (pCnt && rDontLeave.
IsAnLower(pCnt))
1504 bool bSkipContent =
false;
1505 if ( bSkipRowSpanCells && pCnt->
IsInTab() )
1510 if ( pCell && 1 != static_cast<const SwCellFrame*>( pCell )->GetLayoutRowSpan() )
1511 bSkipContent =
true;
1514 if ( bFormatPossible && !bSkipContent )
1520 pCnt->
Calc(pRenderContext);
1526 "<SwContentFrame::CalcLowers(..)> - text frame invalid and not locked." );
1535 static_cast<SwTextFrame*>(pCnt)->GetTextNodeFirst());
1536 if (pTextNode == pLoopControlCond)
1540 nLoopControlRuns = 0;
1541 pLoopControlCond = pTextNode;
1544 if ( nLoopControlRuns < nLoopControlMax )
1551 #if OSL_DEBUG_LEVEL > 1
1552 OSL_FAIL(
"LoopControl in SwContentFrame::CalcLowers" );
1574 bool _bOnlyRowsAndCells )
1593 pFrame->
Calc(pRenderContext);
1594 if( static_cast<SwLayoutFrame*>(pFrame)->
Lower() )
1603 rToCalc.
Calc(pRenderContext);
1604 if ( rToCalc.
Lower() )
1619 int nLoopControlRuns_1 = 0;
1620 sal_uInt16 nLoopControlStage_1 = 0;
1621 const int nLoopControlMax = 10;
1627 int nLoopControlRuns_2 = 0;
1628 sal_uInt16 nLoopControlStage_2 = 0;
1632 if ( ++nLoopControlRuns_2 > nLoopControlMax )
1634 SAL_WARN_IF(nLoopControlStage_2 == 0,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 1!");
1635 SAL_WARN_IF(nLoopControlStage_2 == 1,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 2!!");
1636 SAL_WARN_IF(nLoopControlStage_2 >= 2,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 3!!!");
1638 nLoopControlRuns_2 = 0;
1639 if( nLoopControlStage_2 > 2 )
1655 for (
int i = 0;
i < 2; ++
i )
1658 while ( pCellFrame )
1660 const bool bCalc = 0 ==
i ?
1678 if ( ++nLoopControlRuns_1 > nLoopControlMax )
1680 SAL_WARN_IF(nLoopControlStage_1 == 0,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 1!");
1681 SAL_WARN_IF(nLoopControlStage_1 == 1,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 2!!");
1682 SAL_WARN_IF(nLoopControlStage_1 >= 2,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 3!!!");
1684 nLoopControlRuns_1 = 0;
1685 if( nLoopControlStage_1 > 2 )
1720 bool bSkippedDirectPrevEmptySection(
false );
1725 pPrev->IsSctFrame() &&
1729 bSkippedDirectPrevEmptySection =
true;
1737 if ( ( !bSkippedDirectPrevEmptySection && !rFrame.
GetIndPrev() ) ||
1738 ( bSkippedDirectPrevEmptySection &&
1764 #define KEEPTAB ( !GetFollow() && !IsFollow() )
1797 pNxt->
Calc(pRenderContext);
1804 bool AreAllRowsKeepWithNext(
const SwRowFrame* pFirstRowFrame,
const bool bCheckParents =
true )
1806 bool bRet = pFirstRowFrame !=
nullptr &&
1809 while ( bRet && pFirstRowFrame->
GetNext() != nullptr )
1812 bRet = pFirstRowFrame !=
nullptr &&
1852 "SwTabFrame::MakeAll for master while follow is in RebuildLastLine()" );
1899 bool bMakePage =
true;
1901 bool bMovedBwd =
false;
1904 bool bMovedFwd =
false;
1906 bool bSplit =
false;
1914 const bool bDontSplit = !
IsFollow() &&
1922 bool bTryToSplit =
true;
1935 bool bLastRowHasToMoveToFollow =
false;
1936 bool bLastRowMoveNoMoreTries =
false;
1939 const bool bEmulateTableKeep = !bLargeTable && bTableRowKeep && AreAllRowsKeepWithNext(
GetFirstNonHeadlineRow(),
false );
1941 const bool bKeep =
IsKeep(pAttrs->GetAttrSet().GetKeep(),
GetBreakItem(), bEmulateTableKeep);
1988 else if (!
MoveFwd(bMakePage,
false))
1994 int nUnSplitted = 5;
1995 int nThrowAwayValidLayoutLimit = 5;
2001 !(bMovedFwd && bEmulateTableKeep) )
2026 pAttrs = pAccess->Get();
2033 if ( bKeep || (
nullptr != (pPre =
FindPrev()) &&
2072 pAttrs = pAccess->Get();
2082 if ( !bMovedFwd && (bMoveable || bFly) &&
lcl_NoPrev( *
this ) )
2105 if ( bFootnotesInDoc )
2107 if ( bReformat || bKeep )
2122 pAttrs = pAccess->Get();
2158 SwTwips nDistanceToUpperPrtBottom =
2164 if ( nDistanceToUpperPrtBottom < 0 && bBrowseMode )
2177 if( nDistanceToUpperPrtBottom >= 0 && !bLastRowHasToMoveToFollow )
2214 if ( !pRow || !pRow->
GetNext() )
2236 while ( pRowToMove && nRowsToMove-- > 0 )
2241 if ( bMoveFootnotes )
2254 pRowToMove->
Paste(
this );
2258 if ( bMoveFootnotes )
2262 pRowToMove = pNextRow;
2274 bool bFormat =
false;
2277 else if ( bTableRowKeep && !bLastRowMoveNoMoreTries )
2281 bLastRowMoveNoMoreTries =
true;
2311 pAttrs = pAccess->Get();
2319 bLastRowHasToMoveToFollow =
true;
2363 bLastRowHasToMoveToFollow =
false;
2385 const bool bAllowSplitOfRow = bTableRowKeep && !pIndPrev && AreAllRowsKeepWithNext(pFirstNonHeadlineRow);
2390 if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
2391 ( bEmulateTableKeepSplitAllowed || bAllowSplitOfRow ||
2392 ( ( !bTableRowKeep || pFirstNonHeadlineRow->
GetNext() ||
2394 ) && ( !bDontSplit || !pIndPrev )
2406 bTryToSplit =
false;
2411 if ( pFirstNonHeadlineRow->
GetNext() || bTryToSplit )
2415 nDeadLine = aRectFnSet.
YInc( nDeadLine,
2436 bLastRowHasToMoveToFollow =
false;
2447 if ( pTmpRow && !static_cast<const SwRowFrame*>(pTmpRow)->IsRowSplitAllowed() )
2451 sal_uInt16 nMinNumOfLines = nRepeat;
2453 if ( bTableRowKeep )
2474 if( aRectFnSet.
YDiff(nDeadLine, nBreakLine) >=0
2475 || !pIndPrev || bEmulateTableKeepSplitAllowed )
2483 if (!nThrowAwayValidLayoutLimit)
2489 if (bInitialLoopEndCondition && !bFinalLoopEndCondition)
2491 --nThrowAwayValidLayoutLimit;
2495 const bool bSplitError = !
Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !(bAllowSplitOfRow || bEmulateTableKeepSplitAllowed) ) );
2498 if (bSplitError && nRepeat >
GetTable()->GetRowsToRepeat())
2504 if (!bTryToSplit && !bSplitError)
2524 if ( bSplitError && bTryToSplit )
2528 bTryToSplit =
false;
2532 bTryToSplit = !bSplitError;
2559 pAttrs = pAccess->Get();
2572 if ( !bOldJoinLock )
2584 bool bCalcNxt =
true;
2599 pNxt->
Calc(pRenderContext);
2614 bLastRowHasToMoveToFollow =
false;
2634 else if (!
MoveFwd(bMakePage,
false))
2655 pTab->
Calc(pRenderContext);
2680 SwTwips nDistToUpperPrtBottom =
2682 if ( nDistToUpperPrtBottom >= 0 || bTryToSplit )
2690 #if OSL_DEBUG_LEVEL > 0
2693 OSL_FAIL(
"debug assertion: <SwTabFrame::MakeAll()> - format of table lowers suppressed by fix i44910" );
2712 if ( bMovedFwd || bMovedBwd || !bOldValidPos )
2723 if (pContentFrame == &rAnchorFrame)
2736 bool bInvalidatePrtArea =
false;
2752 nPrtPos = aRectFnSet.
YInc( nPrtPos, rUpper );
2763 if (
auto pFly = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
2765 const SwRect aFlyRect = pFly->GetObjRectWithSpaces();
2782 const SwTextFrame* pAnchorCharFrame = pFly->FindAnchorCharFrame();
2786 (pFly->isFrameAreaDefinitionValid() || bAddVerticalFlyOffsets) &&
2788 pFly->IsFlyAtContentFrame() &&
2790 aFlyRect.
IsOver( aRect ) &&
2794 ( !pAnchorCharFrame || !
IsAnLower( pAnchorCharFrame ) ) ) &&
2796 !pFly->IsAnLower(
this ) &&
2807 pFly->GetAnchorFrame()->FindPageFrame()->GetPhyPageNum() &&
2809 ( !pAnchorCharFrame ||
2818 if ( pFlyHeaderFooterFrame != pThisHeaderFooterFrame &&
2822 ( !bConsiderWrapOnObjPos ||
nullptr != pThisHeaderFooterFrame || !pFlyHeaderFooterFrame->
IsHeaderFrame() ) )
2823 bConsiderFly =
false;
2830 bool bShiftDown = css::text::WrapTextMode_NONE == rSur.
GetSurround();
2831 if (!bShiftDown && bAddVerticalFlyOffsets)
2833 if (rSur.
GetSurround() == text::WrapTextMode_PARALLEL
2846 const SwRect aFlyRectWithoutSpaces = pFly->GetObjRect();
2848 aRectFnSet.
GetRight(aFlyRectWithoutSpaces));
2853 bShiftDown = aTabRange.
overlaps(aFlyRange);
2872 *static_cast<SwTextFrame*>(pFly->GetAnchorFrameContainingAnchPos())))
2874 if (aRectFnSet.
YDiff( nPrtPos, nBottom ) < 0)
2876 bInvalidatePrtArea =
true;
2879 if ( (css::text::WrapTextMode_RIGHT == rSur.
GetSurround() ||
2880 css::text::WrapTextMode_PARALLEL == rSur.
GetSurround())&&
2885 aRectFnSet.
GetLeft(pFly->GetAnchorFrame()->getFrameArea()) );
2886 rLeftOffset = std::max( rLeftOffset, nWidth );
2887 bInvalidatePrtArea =
true;
2889 if ( (css::text::WrapTextMode_LEFT == rSur.
GetSurround() ||
2890 css::text::WrapTextMode_PARALLEL == rSur.
GetSurround())&&
2894 aRectFnSet.
GetRight(pFly->GetAnchorFrame()->getFrameArea()),
2895 aRectFnSet.
GetLeft(aFlyRect) );
2896 rRightOffset = std::max( rRightOffset, nWidth );
2897 bInvalidatePrtArea =
true;
2905 return bInvalidatePrtArea;
2912 OSL_ENSURE( pAttrs,
"TabFrame::Format, pAttrs is 0." );
2922 aRectFnSet.
AddRight( aFrm, nDiff );
2976 bool bCheckBrowseWidth =
false;
2981 switch (
GetFormat()->GetHoriOrient().GetHoriOrient() )
2983 case text::HoriOrientation::LEFT:
2986 nLeftSpacing = nLeftLine + nLeftOffset;
2992 const SwTwips nWishRight = nMax - nWishedTableWidth - nLeftOffset;
2993 if ( nRightOffset > 0 )
2998 nRightSpacing = nRightLine + std::max(
SwTwips(nRightOffset), nWishRight );
3007 nRightSpacing = nRightLine +
3008 ( ( (nWishRight+nLeftOffset) < 0 ) ?
3009 (nWishRight+nLeftOffset) :
3010 std::max(
SwTwips(0), nWishRight ) );
3014 case text::HoriOrientation::RIGHT:
3017 nRightSpacing = nRightLine + nRightOffset;
3023 const SwTwips nWishLeft = nMax - nWishedTableWidth - nRightOffset;
3024 if ( nLeftOffset > 0 )
3029 nLeftSpacing = nLeftLine + std::max(
SwTwips(nLeftOffset), nWishLeft );
3038 nLeftSpacing = nLeftLine +
3039 ( ( (nWishLeft+nRightOffset) < 0 ) ?
3040 (nWishLeft+nRightOffset) :
3041 std::max(
SwTwips(0), nWishLeft ) );
3045 case text::HoriOrientation::CENTER:
3048 const SwTwips nCenterSpacing = ( nMax - nWishedTableWidth ) / 2;
3049 nLeftSpacing = nLeftLine +
3050 ( (nLeftOffset > 0) ?
3051 std::max( nCenterSpacing,
SwTwips(nLeftOffset) ) :
3053 nRightSpacing = nRightLine +
3054 ( (nRightOffset > 0) ?
3055 std::max( nCenterSpacing,
SwTwips(nRightOffset) ) :
3059 case text::HoriOrientation::FULL:
3064 bCheckBrowseWidth =
true;
3065 nLeftSpacing = nLeftLine + nLeftOffset;
3066 nRightSpacing = nRightLine + nRightOffset;
3071 nLeftSpacing = pAttrs->
CalcLeft(
this );
3078 nLeftSpacing = std::max( nLeftSpacing,
SwTwips( nLeftOffset + nLeftLine ) );
3081 nRightSpacing = pAttrs->
CalcRight(
this );
3088 nRightSpacing = std::max( nRightSpacing,
SwTwips( nRightOffset + nRightLine ) );
3092 case text::HoriOrientation::LEFT_AND_WIDTH:
3097 nLeftSpacing = pAttrs->
CalcLeft(
this );
3108 nMax - (nLeftSpacing-pAttrs->
CalcLeftLine()) - nWishedTableWidth;
3109 nRightSpacing = nRightLine +
3110 ( (nRightOffset > 0) ?
3111 std::max( nWishRight,
SwTwips(nRightOffset) ) :
3116 OSL_FAIL(
"Invalid orientation for table." );
3127 if( (nMax -
MINLAY) < (nLeftSpacing + nRightSpacing) )
3130 aRectFnSet.
SetXMargins( *
this, nLeftSpacing, nRightSpacing );
3133 if ( bCheckBrowseWidth &&
3146 aPrt.
Width( std::min( nWidth, aPrt.
Width() ) );
3161 SwTwips nRemaining = 0, nDiff;
3169 nRemaining += nUpper + nLower;
3174 else if ( nDiff < 0 )
3182 if( nHeight > 0 && nDist > (
LONG_MAX - nHeight ) )
3196 while ( pFrame &&
GetFollow() != pFrame )
3202 if ( nReal < nDist )
3208 nTmp = std::min(
tools::Long(nDist), nReal + nTmp );
3209 nDist = nTmp < 0 ? 0 : nTmp;
3270 auto& rOldSetChg = *
static_cast<const SwAttrSetChg*
>(pLegacy->m_pOld);
3271 auto& rNewSetChg = *
static_cast<const SwAttrSetChg*
>(pLegacy->m_pNew);
3280 UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
3281 pNItem = aNIter.NextItem();
3282 pOItem = aOIter.NextItem();
3288 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
3295 if(nInvFlags & 0x02)
3297 if(nInvFlags & 0x40)
3302 if(nInvFlags & 0x04)
3308 if(nInvFlags & 0x10)
3311 if(nInvFlags & 0x08 &&
nullptr != (pTmp =
GetPrev()))
3317 if(nInvFlags & 0x20)
3320 static_cast<SwRootFrame*>(pPage->
GetUpper())->InvalidateBrowseWidth();
3322 if(nInvFlags & 0x80)
3331 const sal_uInt16 nWhich = pOld ? pOld->
Which() : pNew ? pNew->
Which() : 0;
3347 for ( sal_uInt16 nIdx = 0; nIdx < nNewRepeat; ++nIdx )
3353 pHeadline->
Paste(
this, pLowerRow );
3373 if (
GetFormat()->GetPageDesc().GetNumOffset())
3406 if ( pOldSet || pNewSet )
3473 #if OSL_DEBUG_LEVEL > 0
3475 OSL_ENSURE( pSect,
"Where does this column come from?");
3476 OSL_ENSURE(
IsAnLower( pSect ),
"Split cell?" );
3484 OSL_ENSURE( pRet->
IsCellFrame(),
"SwTabFrame::FindLastContent failed" );
3486 while ( pRow && !pRow->GetUpper()->IsTabFrame() )
3491 while ( pContentFrame && static_cast<const SwLayoutFrame*>(pRow)->
IsAnLower( pContentFrame ) )
3510 pRet = static_cast<SwSectionFrame*>(pRet)->FindLastContent();
3513 assert(pRet ==
nullptr || dynamic_cast<SwContentFrame*>(pRet) || dynamic_cast<SwTabFrame*>(pRet));
3526 assert(pRet ==
nullptr || dynamic_cast<SwContentFrame*>(pRet));
3552 bool bMoveAnyway =
false;
3562 if( std::abs( nNewWidth - nOldWidth ) < 2 )
3570 while ( pPrevFrame && pPrevFrame !=
this )
3573 pPrevFrame = pPrevFrame->
GetNext();
3605 bool bFits = nSpace > 0;
3609 bFits = nSpace >= 0;
3629 return nTmpHeight <= nSpace;
3637 OSL_ENSURE(
GetUpper(),
"Cut without Upper()." );
3665 if (
nullptr != pFrame )
3703 !pSct->ContainsAny(
true ) )
3708 pSct->InvalidateSize_();
3718 pTmp->InvalidatePrt_();
3737 static_cast<SwRootFrame*>(pPage->
GetUpper())->InvalidateBrowseWidth();
3742 OSL_ENSURE( pParent,
"No parent for pasting." );
3743 OSL_ENSURE( pParent->
IsLayoutFrame(),
"Parent is ContentFrame." );
3744 OSL_ENSURE( pParent !=
this,
"I'm the parent myself." );
3745 OSL_ENSURE( pSibling !=
this,
"I'm my own neighbour." );
3747 "I'm still registered somewhere." );
3750 InsertBefore( static_cast<SwLayoutFrame*>(pParent), pSibling );
3790 static_cast<SwRootFrame*>(pPage->
GetUpper())->InvalidateBrowseWidth();
3810 , m_pTabLine( &rLine )
3811 , m_pFollowRow( nullptr )
3813 , mnTopMarginForLowers( 0 )
3814 , mnBottomMarginForLowers( 0 )
3815 , mnBottomLineSize( 0 )
3817 , m_bIsFollowFlowRow( false )
3819 , m_bIsRepeatedHeadline( false )
3820 , m_bIsRowSpanLine( false )
3821 , m_bForceRowSplitAllowed( false )
3822 , m_bIsInSplit( false )
3829 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
3867 if(bInFirstNonHeadlineRow)
3869 if(bInFirstNonHeadlineRow || !
GetNext())
3878 if(
auto pMoveTableLineHint = dynamic_cast<const sw::MoveTableLineHint*>(&rHint))
3881 if(
GetTabLine() != &pMoveTableLineHint->m_rTableLine)
3891 if(!pLegacy->m_pNew)
3897 switch(pLegacy->m_pNew->Which())
3914 OnFrameSize(*static_cast<const SwFormatFrameSize*>(pLegacy->m_pNew));
3934 static_cast<const SwSectionFrame*
>(pFrame)->ContainsContent() : pFrame;
3939 bool bIsFollow(
false );
3971 pAnchoredObj->FindAnchorCharFrame() != pTmp )
3979 const SwFrameFormat& rFrameFormat = pAnchoredObj->GetFrameFormat();
3981 bool bIsFarAway = pAnchoredObj->GetObjRect().Top() !=
FAR_AWAY;
3983 bool bIsAnchoredToTmpFrm =
false;
3984 if ( pPageFrm && pPageFrm->
IsPageFrame() && pAnchoredObj->GetPageFrame())
3985 bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == pPageFrm ||
3987 const bool bConsiderObj =
3990 bFollowTextFlow && bIsAnchoredToTmpFrm;
3992 if (pFrame->
IsInTab() && bFollowTextFlow && bWrapThrough)
4005 const SwTwips nDistOfFlyBottomToAnchorTop =
4006 aRectFnSet.
GetHeight(pAnchoredObj->GetObjRect()) +
4008 pAnchoredObj->GetCurrRelPos().X() :
4009 pAnchoredObj->GetCurrRelPos().Y() );
4016 nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop + nFrameDiff -
4026 const SwTwips nDistOfFlyBottomToAnchorTop2 = aRectFnSet.
YDiff(
4027 aRectFnSet.
GetBottom(pAnchoredObj->GetObjRect()),
4030 nHeight = std::max( nHeight,
tools::Long(nDistOfFlyBottomToAnchorTop2 ));
4039 if( !static_cast<const SwSectionFrame*>(pFrame)->IsAnLower( pTmp ) )
4054 nTopSpace =
static_cast<const SwRowFrame*
>(rCell.
GetUpper())->GetTopMarginForLowers();
4055 nBottomSpace =
static_cast<const SwRowFrame*
>(rCell.
GetUpper())->GetBottomMarginForLowers();
4061 nTopSpace = rAttrs.
CalcLeft( &rCell );
4062 nBottomSpace = rAttrs.
CalcRight( &rCell );
4071 return nTopSpace + nBottomSpace;
4078 const bool _bConsiderObjs,
4098 nHeight += nLowHeight;
4100 if ( _bConsiderObjs )
4102 nFlyAdd = std::max(
tools::Long(0), nFlyAdd - nLowHeight );
4115 if ( _pCell->
Lower() )
4132 const bool _bConsiderObjs )
4162 if ( 1 == nRowSpan )
4166 else if ( -1 == nRowSpan )
4174 while ( pMasterRow && pMasterRow != _pRow )
4177 pMasterRow = pMasterRow->
GetNext();
4197 sal_uInt16 nTopSpace = 0;
4198 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4199 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4201 sal_uInt16 nTmpTopSpace = 0;
4202 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4203 nTmpTopSpace =
lcl_GetTopSpace( *static_cast<const SwRowFrame*>(pCurrLower->Lower()) );
4208 nTmpTopSpace = rBoxItem.
CalcLineSpace( SvxBoxItemLine::TOP,
true );
4210 nTopSpace = std::max( nTopSpace, nTmpTopSpace );
4218 sal_uInt16 nTopLineDist = 0;
4219 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4220 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4222 sal_uInt16 nTmpTopLineDist = 0;
4223 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4224 nTmpTopLineDist =
lcl_GetTopLineDist( *static_cast<const SwRowFrame*>(pCurrLower->Lower()) );
4229 nTmpTopLineDist = rBoxItem.
GetDistance( SvxBoxItemLine::TOP );
4231 nTopLineDist = std::max( nTopLineDist, nTmpTopLineDist );
4233 return nTopLineDist;
4239 sal_uInt16 nBottomLineSize = 0;
4240 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4241 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4243 sal_uInt16 nTmpBottomLineSize = 0;
4244 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4246 const SwFrame* pRow = pCurrLower->GetLastLower();
4253 nTmpBottomLineSize = rBoxItem.
CalcLineSpace( SvxBoxItemLine::BOTTOM,
true ) -
4256 nBottomLineSize = std::max( nBottomLineSize, nTmpBottomLineSize );
4258 return nBottomLineSize;
4264 sal_uInt16 nBottomLineDist = 0;
4265 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4266 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4268 sal_uInt16 nTmpBottomLineDist = 0;
4269 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4271 const SwFrame* pRow = pCurrLower->GetLastLower();
4278 nTmpBottomLineDist = rBoxItem.
GetDistance( SvxBoxItemLine::BOTTOM );
4280 nBottomLineDist = std::max( nBottomLineDist, nTmpBottomLineDist );
4282 return nBottomLineDist;
4302 if (!pLine || !pTab || !pTab->
IsFollow())
4306 for (
const SwRowFrame* pCurRow = aIter.First(); pCurRow; pCurRow = aIter.Next())
4308 if (pCurRow != &rRow && pCurRow->
GetTabLine() == pLine)
4323 nResult += aRectFnSet.
GetHeight(pCurRow->getFrameArea());
4333 OSL_ENSURE( pAttrs,
"SwRowFrame::Format without Attrs." );
4373 while ( pTmpRow && !pPrevTabLine )
4380 while ( rLines[ nIdx ] != pTmpRow->
GetTabLine() )
4386 pPrevTabLine = rLines[ nIdx - 1 ];
4403 for (
SwRowFrame* pRow = aIter.First(); pRow; pRow = aIter.Next() )
4408 if ( pRow->GetTabLine() == pPrevTabLine &&
4409 !pRow->IsRepeatedHeadline() )
4411 pPreviousRow = pRow;
4417 sal_uInt16 nTopPrtMargin = nTopSpace;
4420 const sal_uInt16 nTmpPrtMargin = pPreviousRow->
GetBottomLineSize() + nTopLineDist;
4421 if ( nTmpPrtMargin > nTopPrtMargin )
4422 nTopPrtMargin = nTmpPrtMargin;
4455 #if OSL_DEBUG_LEVEL > 0
4472 Shrink( nDiff,
false,
true );
4473 else if ( nDiff < 0 )
4488 pSibling = pSibling->
GetNext();
4489 }
while ( pSibling );
4536 SwFrame* pToAdjustRow =
nullptr;
4543 pToAdjustRow = pToAdjust->
GetUpper();
4547 pToAdjust = pCellFrame;
4548 pToAdjustRow =
this;
4554 while ( pToAdjustRow )
4557 nSumRowHeight += pToAdjustRow ==
this ?
4561 if ( nRowSpan-- == 1 )
4564 pToAdjustRow = pToAdjustRow->
GetNext();
4567 if ( pToAdjustRow && pToAdjustRow !=
this )
4576 pNotify = pToAdjust;
4618 bool bRestrictTableGrowth;
4624 bRestrictTableGrowth = pFollowFlowRow && !pFollowFlowRow->
IsRowSpanLine();
4629 bRestrictTableGrowth =
GetFollowRow() && bHasFollowFlowLine;
4630 OSL_ENSURE( !bRestrictTableGrowth || !
GetNext(),
4631 "GetFollowRow for row frame that has a Next" );
4634 const SwTwips nAdditionalSpace =
4636 if ( bRestrictTableGrowth && nAdditionalSpace > 0 )
4638 nReal = std::min( nAdditionalSpace, nDist );
4648 if ( bRestrictTableGrowth )
4689 const bool bShrinkAnyway = bInfo;
4708 OSL_ENSURE(
FindTabFrame(),
"<SwRowFrame::ShrinkFrame(..)> - no table frame -> crash." );
4709 const bool bConsiderObjs(
FindTabFrame()->IsConsiderObjsForMinCellHeight() );
4716 if ( nRealDist < 0 )
4726 aRectFnSet.
SetHeight( aFrm, nHeight - nReal );
4730 aFrm.
Pos().AdjustX(nReal );
4736 if ( !bShrinkAnyway && !
GetNext() && nTmp != nReal )
4745 aRectFnSet.
SetHeight( aFrm, nHeight + nReal );
4749 aFrm.
Pos().AdjustX( -nReal );
4814 static_cast<const SwTextFrame*
>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue();
4819 , m_pTabBox( &rBox )
4823 if ( !bInsertContent )
4837 for (
size_t i = 0;
i < rLines.
size(); ++
i )
4880 if( nFrameTop != lYStart )
4888 aRectFnSet.
SubTop( aFrm, -lDiff );
4900 aRectFnSet.
GetTop(static_cast<SwLayoutFrame*>(pFrame)->
Lower()->getFrameArea())
4919 bool bVertPosDepOnAnchor(
true );
4922 switch ( aVert.GetRelationOrient() )
4924 case text::RelOrientation::PAGE_FRAME:
4925 case text::RelOrientation::PAGE_PRINT_AREA:
4926 bVertPosDepOnAnchor =
false;
4931 if (
auto pFly = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
4940 const bool bDirectMove =
4941 FAR_AWAY != pFly->getFrameArea().Top() &&
4942 bVertPosDepOnAnchor &&
4943 !pFly->ConsiderObjWrapInfluenceOnObjPos();
4948 aRectFnSet.
SubTop( aFrm, -lDiff );
4952 pFly->GetVirtDrawObj()->SetRectsDirty();
4956 pFly->GetVirtDrawObj()->SetChanged();
4958 pFly->InvalidateObjRectWithSpaces();
4961 if ( pFly->IsFlyInContentFrame() )
4971 else if( pFly->IsAutoPos() )
4973 pFly->AddLastCharY( lDiff );
4976 pFly->AddLastTopOfLineY( lDiff );
4987 pFly->IsFlyFreeFrame() )
4991 if ( pPageFrame != pPageOfAnchor )
4995 pPageFrame->
MoveFly( pFly, pPageOfAnchor );
5004 pFly->InvalidatePos();
5014 pFly->SetCompletePaint();
5017 else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) !=
nullptr )
5025 != RndStdIds::FLY_AS_CHAR))
5029 if ( pPageFrame != pPageOfAnchor )
5045 const bool bDirectMove =
5047 bVertPosDepOnAnchor &&
5052 if ( aRectFnSet.
IsVert() )
5067 OSL_FAIL(
"<lcl_ArrangeLowers(..)> - unknown type of anchored object!" );
5074 lYStart = aRectFnSet.
YInc( lYStart,
5082 SwTwips nDistanceToUpperPrtBottom =
5087 if ( nDistanceToUpperPrtBottom < 0 &&
5090 !
static_cast<SwTextFrame*
>(pFrame)->IsUndersized() ) ) ||
5103 OSL_ENSURE( pAttrs,
"CellFrame::Format, pAttrs is 0." );
5114 SwTwips nTopSpace, nBottomSpace, nLeftSpace, nRightSpace;
5119 nLeftSpace = rBoxItem.
GetDistance( SvxBoxItemLine::LEFT );
5120 nRightSpace = rBoxItem.
GetDistance( SvxBoxItemLine::RIGHT );
5127 nLeftSpace = pAttrs->
CalcLeft(
this );
5128 nRightSpace = pAttrs->
CalcRight(
this );
5129 nTopSpace = pAttrs->
CalcTop();
5132 aRectFnSet.
SetXMargins( *
this, nLeftSpace, nRightSpace );
5133 aRectFnSet.
SetYMargins( *
this, nTopSpace, nBottomSpace );
5158 OSL_ENSURE( nWish,
"Table without width?" );
5159 OSL_ENSURE( nWidth <= nWish,
"Width of cell larger than table." );
5160 OSL_ENSURE( nWidth > 0,
"Box without width" );
5163 if ( nWish != nPrtWidth )
5177 pTmpBox = rBoxes[ i++ ];
5183 double nTmpWidth = nSumWidth;
5184 nTmpWidth *= nPrtWidth;
5186 nWidth =
static_cast<SwTwips>(nTmpWidth);
5191 while ( pTmpCell !=
this )
5194 pTmpCell = pTmpCell->
GetNext();
5197 nWidth = nWidth - nSumFrameWidths;
5203 double nTmpWidth = nWidth;
5204 nTmpWidth *= nPrtWidth;
5206 nWidth =
static_cast<SwTwips>(nTmpWidth);
5212 OSL_ENSURE( pAttrs->
GetSize().
Width() > 0,
"Box without width" );
5215 while ( pPre !=
this )
5229 aRectFnSet.
SubLeft( aFrm, nDiff );
5233 aRectFnSet.
AddRight( aFrm, nDiff );
5239 aRectFnSet.
AddRight( aPrt, nDiff );
5246 if ( nDiffHeight > 0 )
5250 if ( !
Grow( nDiffHeight ) )
5261 if ( !
Shrink( -nDiffHeight ) )
5286 OSL_ENSURE(
false,
"VAlign to cell without content" );
5289 bool bVertDir =
true;
5300 SwRect aTmp( pAnchoredObj->GetObjRect() );
5301 const SwFrame* pAnch = pAnchoredObj->GetAnchorFrame();
5302 if ( (bConsiderWrapOnObjPos &&
IsAnLower( pAnch )) || (!bConsiderWrapOnObjPos && aTmp.IsOver( aRect )) )
5304 const SwFrameFormat& rAnchoredObjFrameFormat = pAnchoredObj->GetFrameFormat();
5307 if ( bConsiderWrapOnObjPos || css::text::WrapTextMode_THROUGH != rSur.
GetSurround() )
5310 if (
auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
5312 if ( pFly->IsAnLower(
this ) )
5322 if ( bConsiderWrapOnObjPos ||
5324 pAnchoredObj->IsTmpConsiderWrapInfluence() ||
5347 case text::VertOrientation::CENTER: lTopOfst = nDiff / 2;
break;
5348 case text::VertOrientation::BOTTOM: lTopOfst = nDiff;
break;
5353 aRectFnSet.
GetPrtTop(*
this), lTopOfst );
5374 if (!pFrame->IsTextFrame())
5379 auto pTextFrame =
static_cast<SwTextFrame*
>(pFrame);
5380 if (!pTextFrame->GetHasRotatedPortions())
5391 if(
auto pMoveTableBoxHint = dynamic_cast<const sw::MoveTableBoxHint*>(&rHint))
5393 if(
GetTabBox() != &pMoveTableBoxHint->m_rTableBox)
5402 else if(
auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
5408 const auto nWhich = pLegacy->m_pNew ? pLegacy->m_pNew->
Which() : 0;
5413 auto& rChgSet = *
static_cast<const SwAttrSetChg*
>(pLegacy->m_pNew)->GetChgSet();
5415 rChgSet.GetItemState(
RES_PROTECT,
false, &pProtectItem);
5416 rChgSet.GetItemState(
RES_FRAMEDIR,
false, &pFrameDirItem);
5417 rChgSet.GetItemState(
RES_BOX,
false, &pBoxItem);
5421 pVertOrientItem = pLegacy->m_pNew;
5424 pProtectItem = pLegacy->m_pNew;
5427 pFrameDirItem = pLegacy->m_pNew;
5430 pBoxItem = pLegacy->m_pNew;
<