20 #include <config_wasm_strip.h>
26 #include <viewimp.hxx>
61 #include <objectformatter.hxx>
66 #include <osl/diagnose.h>
79 , m_bCalcLowers(
false)
80 , m_bLowersFormatted(
false)
81 , m_bLockBackMove(
false)
82 , m_bResizeHTMLTable(
false)
83 , m_bONECalcLowers(
false)
84 , m_bHasFollowFlowLine(
false)
85 , m_bIsRebuildLastLine(
false)
86 , m_bRestrictTableGrowth(
false)
87 , m_bRemoveFollowFlowLinePending(
false)
88 , m_bConsiderObjsForMinCellHeight(true)
89 , m_bObjsDoesFit(true)
90 , m_bInRecalcLowerRow(
false)
101 for (
size_t i = 0;
i < rLines.
size(); ++
i )
104 if ( bHiddenRedlines && rLines[
i]->IsDeleted(nRedlinePos) )
122 , m_pTable( rTab.GetTable() )
124 , m_bCalcLowers(
false)
125 , m_bLowersFormatted(
false)
126 , m_bLockBackMove(
false)
127 , m_bResizeHTMLTable(
false)
128 , m_bONECalcLowers(
false)
129 , m_bHasFollowFlowLine(
false)
130 , m_bIsRebuildLastLine(
false)
131 , m_bRestrictTableGrowth(
false)
132 , m_bRemoveFollowFlowLinePending(
false)
133 , m_bConsiderObjsForMinCellHeight(true)
134 , m_bObjsDoesFit(true)
135 , m_bInRecalcLowerRow(
false)
190 bool _bOnlyRowsAndCells =
false );
196 const bool _bConsiderObjs );
203 if ( !nCount || !pStart)
208 while ( pStart && nCount > 0 )
221 OSL_ENSURE( rTmpRow.
IsRowFrame(),
"No row frame to copy for FollowFlowLine" );
229 return pFollowFlowLine;
236 const bool _bMoveObjsOutOfRange =
false,
243 OSL_ENSURE( _pPageFrame,
244 "<lcl_InvalidateLowerObjs(..)> - missing page frame -> no move of lower objects out of range" );
253 while ( pLowerFrame )
258 _bMoveObjsOutOfRange, _pPageFrame );
275 if ( _bMoveObjsOutOfRange )
281 pAnchoredObj->
SetObjLeft( _pPageFrame->getFrameArea().Right() );
288 == RndStdIds::FLY_AS_CHAR )
294 if ( pFly !=
nullptr )
302 if ( pFly !=
nullptr )
308 pLowerFrame = pLowerFrame->
GetNext();
318 bool bAllCellsCollapsed =
true;
319 while ( pCurrMasterCell )
335 bool bAllLowersCollapsed =
true;
337 if ( pTmp && pTmp->IsRowFrame() )
348 if ( pTmp->IsTabFrame() )
351 bool bAllRowsCollapsed =
true;
358 bAllRowsCollapsed =
false;
363 if (bAllRowsCollapsed)
370 aRectFnSet.
SetTop(aPrt, 0);
374 bAllLowersCollapsed =
false;
378 pTmp->Shrink(aRectFnSet.
GetHeight(pTmp->getFrameArea()));
380 aRectFnSet.
SetTop(aPrt, 0);
383 if (aRectFnSet.
GetHeight(pTmp->getFrameArea()) > 0)
385 bAllLowersCollapsed =
false;
389 pTmp = pTmp->GetPrev();
398 if (bAllLowersCollapsed)
405 aRectFnSet.
SetTop(aPrt, 0);
409 bAllCellsCollapsed =
false;
414 if (bAllCellsCollapsed)
421 aRectFnSet.
SetTop(aPrt, 0);
435 while ( pCurrSourceCell )
440 while ( pTmpSourceRow )
451 while ( pTmpDestRow->
GetNext() )
452 pTmpDestRow = static_cast<SwRowFrame*>(pTmpDestRow->
GetNext());
513 while ( pCurrLastLineCell )
524 while ( pTmpLastLineRow->
GetNext() && nTmpCut > nCurrentHeight )
526 nTmpCut -= nCurrentHeight;
537 bool bTableLayoutTooComplex =
false;
557 if ( static_cast<SwCellFrame*>(pCell)->
Lower() &&
558 static_cast<SwCellFrame*>(pCell)->
Lower()->IsRowFrame() )
560 bTableLayoutTooComplex =
true;
579 if ( nTmpCut > nCurrentHeight ||
581 !bTableLayoutTooComplex && nMinHeight < nTmpCut ) )
588 pNewRow->
InsertBehind( pCurrFollowFlowLineCell,
nullptr );
593 while ( pTmpLastLineRow )
598 pTmpLastLineRow->
InsertBefore( pCurrFollowFlowLineCell,
nullptr );
601 pTmpLastLineRow = pTmp;
606 pCurrFollowFlowLineCell =
static_cast<SwCellFrame*
>(pCurrFollowFlowLineCell->
GetNext());
614 while ( pCurrMasterCell )
616 if ( pCurrMasterCell->
Lower() &&
623 OSL_ENSURE( pRowFrame->
GetFollowRow(),
"Deleting row frame without follow" );
683 rTab.
Shrink(nAlreadyFree + nCurLastLineHeight - nRemainingSpaceForLastRow + 1);
686 bool bUnlockMaster =
false;
691 bUnlockMaster =
true;
708 rLastLine.
Calc(pRenderContext);
730 const SwTwips nDistanceToUpperPrtBottom =
742 for (
SwFootnoteFrame const* pFootnote = static_cast<SwFootnoteFrame const*>(pCont->Lower());
743 pFootnote !=
nullptr;
758 nFollowFootnotes += aRectFnSet.GetHeight(pFootnote->getFrameArea());
764 if (nDistanceToUpperPrtBottom + nFollowFootnotes < 0 || !rTab.
DoesObjsFit())
775 while ( pCurrMasterCell )
834 if ( nLayoutRowSpan > 1 )
858 bool bNextRow =
false;
860 while ( pCurrentRowFrame )
874 pCurrentRowFrame = bNextRow ?
896 pLastLine,
"There should be a flowline in the follow" );
899 if ( !pFollowFlowLine || !pLastLine )
903 SAL_WARN(
"sw.layout",
"Cannot remove in-use Follow Flow Line");
920 if ( nRowsToMove > 1 )
927 while ( pRow && nRowsToMove-- > 1 )
939 pInsertBehind = pRow;
947 pFirstRow = pFirstRow->
GetNext();
954 bool bJoin = !pFollowFlowLine->
GetNext();
955 pFollowFlowLine->
Cut();
990 if (!pSectionLower->IsColumnFrame())
996 for (
const SwFrame* pFrame = pSectionLower; pFrame; pFrame = pFrame->
GetNext())
998 if (pFrame->IsTabFrame())
1013 pTmpFrame = pTmpFrame->
GetNext();
1043 sal_uInt16 nRowCount = 0;
1045 SwTwips nRemainingSpaceForLastRow =
1047 nRemainingSpaceForLastRow -= aRectFnSet.
GetTopMargin(*
this);
1070 bool bSplitRowAllowed =
true;
1078 bSplitRowAllowed =
false;
1087 bTryToSplit =
false;
1094 bool bKeepNextRow =
false;
1095 if ( nRowCount < nRepeat )
1100 OSL_ENSURE( !
GetIndPrev(),
"Table is supposed to be at beginning" );
1104 else if ( !
GetIndPrev() && nRepeat == nRowCount )
1109 if ( bTryToSplit && bSplitRowAllowed )
1114 while ( pLowerCell )
1122 bKeepNextRow =
true;
1130 bKeepNextRow =
true;
1154 bSplitRowAllowed = bSplitRowAllowed && bTryToSplit &&
1159 if ( !bSplitRowAllowed && bTableRowKeep )
1164 nRowCount > nRepeat )
1181 if ( !bSplitRowAllowed )
1184 if ( pRow == pFirstNonHeadlineRow )
1194 if ( !pTmpRow || pRow == pTmpRow )
1230 for ( nRowCount = 0; nRowCount < nRepeat; ++nRowCount )
1242 if( !pTable->
empty() )
1251 ?
static_cast<SwTextFrame*
>(pFrame)->GetTextNodeFirst()->GetIndex()
1266 if ( bSplitRowAllowed )
1284 while ( pCellFrame )
1318 pInsertBehind = pRow;
1337 pRow->
Paste( pFoll, pPasteBefore );
1355 if (!bRet && !bSplitRowAllowed)
1378 SAL_WARN(
"sw.layout",
"Delete Forbidden");
1392 if (!pFoll || !CanDeleteFollow(pFoll))
1434 if ( static_cast<SwLayoutFrame*>(pFrame)->Lower() )
1474 if ( pToInvalidate->
Lower() )
1521 int nLoopControlRuns = 0;
1522 const int nLoopControlMax = 10;
1525 while (pCnt && rDontLeave.
IsAnLower(pCnt))
1536 bool bSkipContent =
false;
1537 if ( bSkipRowSpanCells && pCnt->
IsInTab() )
1542 if ( pCell && 1 != static_cast<const SwCellFrame*>( pCell )->GetLayoutRowSpan() )
1543 bSkipContent =
true;
1546 if ( bFormatPossible && !bSkipContent )
1552 pCnt->
Calc(pRenderContext);
1558 "<SwContentFrame::CalcLowers(..)> - text frame invalid and not locked." );
1567 static_cast<SwTextFrame*>(pCnt)->GetTextNodeFirst());
1568 if (pTextNode == pLoopControlCond)
1572 nLoopControlRuns = 0;
1573 pLoopControlCond = pTextNode;
1576 if ( nLoopControlRuns < nLoopControlMax )
1583 #if OSL_DEBUG_LEVEL > 1
1584 OSL_FAIL(
"LoopControl in SwContentFrame::CalcLowers" );
1606 bool _bOnlyRowsAndCells )
1627 pFrame->
Calc(pRenderContext);
1628 if( static_cast<SwLayoutFrame*>(pFrame)->
Lower() )
1639 rToCalc.
Calc(pRenderContext);
1640 if ( rToCalc.
Lower() )
1656 int nLoopControlRuns_1 = 0;
1657 sal_uInt16 nLoopControlStage_1 = 0;
1658 const int nLoopControlMax = 10;
1664 int nLoopControlRuns_2 = 0;
1665 sal_uInt16 nLoopControlStage_2 = 0;
1669 if ( ++nLoopControlRuns_2 > nLoopControlMax )
1671 SAL_WARN_IF(nLoopControlStage_2 == 0,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 1!");
1672 SAL_WARN_IF(nLoopControlStage_2 == 1,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 2!!");
1673 SAL_WARN_IF(nLoopControlStage_2 >= 2,
"sw.layout",
"LoopControl_2 in lcl_RecalcRow: Stage 3!!!");
1675 nLoopControlRuns_2 = 0;
1676 if( nLoopControlStage_2 > 2 )
1692 for (
int i = 0;
i < 2; ++
i )
1695 while ( pCellFrame )
1697 const bool bCalc = 0 ==
i ?
1715 if ( ++nLoopControlRuns_1 > nLoopControlMax )
1717 SAL_WARN_IF(nLoopControlStage_1 == 0,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 1!");
1718 SAL_WARN_IF(nLoopControlStage_1 == 1,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 2!!");
1719 SAL_WARN_IF(nLoopControlStage_1 >= 2,
"sw.layout",
"LoopControl_1 in lcl_RecalcRow: Stage 3!!!");
1721 nLoopControlRuns_1 = 0;
1722 if( nLoopControlStage_1 > 2 )
1757 bool bSkippedDirectPrevEmptySection(
false );
1762 pPrev->IsSctFrame() &&
1766 bSkippedDirectPrevEmptySection =
true;
1774 if ( ( !bSkippedDirectPrevEmptySection && !rFrame.
GetIndPrev() ) ||
1775 ( bSkippedDirectPrevEmptySection &&
1801 #define KEEPTAB ( !GetFollow() && !IsFollow() )
1834 pNxt->
Calc(pRenderContext);
1841 bool AreAllRowsKeepWithNext(
const SwRowFrame* pFirstRowFrame,
const bool bCheckParents =
true )
1843 bool bRet = pFirstRowFrame !=
nullptr &&
1846 while ( bRet && pFirstRowFrame->
GetNext() != nullptr )
1849 bRet = pFirstRowFrame !=
nullptr &&
1889 "SwTabFrame::MakeAll for master while follow is in RebuildLastLine()" );
1936 bool bMakePage =
true;
1938 bool bMovedBwd =
false;
1941 bool bMovedFwd =
false;
1943 bool bSplit =
false;
1947 std::optional<SwBorderAttrAccess> oAccess(std::in_place,
SwFrame::GetCache(),
this);
1951 const bool bDontSplit = !
IsFollow() &&
1959 bool bTryToSplit =
true;
1972 bool bLastRowHasToMoveToFollow =
false;
1973 bool bLastRowMoveNoMoreTries =
false;
1976 const bool bEmulateTableKeep = !bLargeTable && bTableRowKeep
2027 else if (!
MoveFwd(bMakePage,
false))
2033 int nUnSplitted = 5;
2034 int nThrowAwayValidLayoutLimit = 5;
2040 !(bMovedFwd && bEmulateTableKeep) )
2070 if ( bKeep || (
nullptr != (pPre =
FindPrev()) &&
2102 pAttrs = oAccess->Get();
2123 if ( !bMovedFwd && (bMoveable || bFly) &&
lcl_NoPrev( *
this ) )
2141 std::optional<SfxDeleteListener> oDeleteListener;
2143 oDeleteListener.emplace(*pOldBoss);
2147 SAL_WARN_IF(oDeleteListener && oDeleteListener->WasDeleted(),
"sw.layout",
"SwFootnoteBossFrame unexpectedly deleted");
2152 if (bFootnotesInDoc && !oDeleteListener->WasDeleted())
2154 if ( bReformat || bKeep )
2174 pAttrs = oAccess->Get();
2212 SwTwips nDistanceToUpperPrtBottom =
2218 if ( nDistanceToUpperPrtBottom < 0 && bBrowseMode )
2231 if( nDistanceToUpperPrtBottom >= 0 && !bLastRowHasToMoveToFollow )
2268 if ( !pRow || !pRow->
GetNext() )
2290 while ( pRowToMove && nRowsToMove-- > 0 )
2295 if ( bMoveFootnotes )
2308 pRowToMove->
Paste(
this );
2312 if ( bMoveFootnotes )
2316 pRowToMove = pNextRow;
2328 bool bFormat =
false;
2331 else if ( bTableRowKeep && !bLastRowMoveNoMoreTries )
2335 bLastRowMoveNoMoreTries =
true;
2351 pAttrs = oAccess->Get();
2377 bLastRowHasToMoveToFollow =
true;
2421 bLastRowHasToMoveToFollow =
false;
2443 const bool bAllowSplitOfRow = bTableRowKeep && !pIndPrev && AreAllRowsKeepWithNext(pFirstNonHeadlineRow);
2448 if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
2449 ( bEmulateTableKeepSplitAllowed || bAllowSplitOfRow ||
2450 ( ( !bTableRowKeep || pFirstNonHeadlineRow->
GetNext() ||
2452 ) && ( !bDontSplit || !pIndPrev )
2464 bTryToSplit =
false;
2469 if ( pFirstNonHeadlineRow->
GetNext() || bTryToSplit )
2473 nDeadLine = aRectFnSet.
YInc( nDeadLine,
2494 bLastRowHasToMoveToFollow =
false;
2505 if ( pTmpRow && !static_cast<const SwRowFrame*>(pTmpRow)->IsRowSplitAllowed() )
2509 sal_uInt16 nMinNumOfLines = nRepeat;
2511 if ( bTableRowKeep )
2532 if( aRectFnSet.
YDiff(nDeadLine, nBreakLine) >=0
2533 || !pIndPrev || bEmulateTableKeepSplitAllowed )
2541 if (!nThrowAwayValidLayoutLimit)
2547 if (bInitialLoopEndCondition && !bFinalLoopEndCondition)
2549 --nThrowAwayValidLayoutLimit;
2554 const bool bSplitError = !
Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !(bAllowSplitOfRow || bEmulateTableKeepSplitAllowed) ) );
2557 if (bSplitError && nRepeat >
GetTable()->GetRowsToRepeat())
2563 if (!bTryToSplit && !bSplitError)
2583 if ( bSplitError && bTryToSplit )
2587 bTryToSplit =
false;
2591 bTryToSplit = !bSplitError;
2628 if ( !bOldJoinLock )
2640 bool bCalcNxt =
true;
2655 pNxt->
Calc(pRenderContext);
2671 bLastRowHasToMoveToFollow =
false;
2691 else if (!
MoveFwd(bMakePage,
false))
2712 pTab->
Calc(pRenderContext);
2737 SwTwips nDistToUpperPrtBottom =
2739 if ( nDistToUpperPrtBottom >= 0 || bTryToSplit )
2747 #if OSL_DEBUG_LEVEL > 0
2750 OSL_FAIL(
"debug assertion: <SwTabFrame::MakeAll()> - format of table lowers suppressed by fix i44910" );
2769 if ( bMovedFwd || bMovedBwd || !bOldValidPos )
2780 if (pContentFrame == &rAnchorFrame)
2792 SwTwips *
const pSpaceBelowBottom)
const
2794 bool bInvalidatePrtArea =
false;
2810 nPrtPos = aRectFnSet.
YInc( nPrtPos, rUpper );
2812 if (pSpaceBelowBottom)
2830 const SwRect aFlyRect = pFly->GetObjRectWithSpaces();
2847 const SwTextFrame* pAnchorCharFrame = pFly->FindAnchorCharFrame();
2851 (pFly->isFrameAreaDefinitionValid() || bAddVerticalFlyOffsets) &&
2853 pFly->IsFlyAtContentFrame() &&
2860 (!pAnchorCharFrame || !
IsAnLower(pAnchorCharFrame)))) &&
2862 !pFly->IsAnLower(
this ) &&
2873 pFly->GetAnchorFrame()->FindPageFrame()->GetPhyPageNum() &&
2875 ( !pAnchorCharFrame ||
2884 if ( pFlyHeaderFooterFrame != pThisHeaderFooterFrame &&
2888 ( !bConsiderWrapOnObjPos ||
nullptr != pThisHeaderFooterFrame || !pFlyHeaderFooterFrame->
IsHeaderFrame() ) )
2889 bConsiderFly =
false;
2896 bool bShiftDown = css::text::WrapTextMode_NONE == rSur.
GetSurround();
2897 if (!bShiftDown && bAddVerticalFlyOffsets)
2899 if (rSur.
GetSurround() == text::WrapTextMode_PARALLEL
2912 const SwRect aFlyRectWithoutSpaces = pFly->GetObjRect();
2914 aRectFnSet.
GetRight(aFlyRectWithoutSpaces));
2919 bShiftDown = aTabRange.
overlaps(aFlyRange);
2938 *static_cast<SwTextFrame*>(pFly->GetAnchorFrameContainingAnchPos())))
2940 if (aRectFnSet.
YDiff( nPrtPos, nBottom ) < 0)
2944 if (pSpaceBelowBottom
2947 if (aRectFnSet.
YDiff(aRectFnSet.
GetTop(aRect), aRectFnSet.
GetTop(aFlyRect)) < 0)
2956 bInvalidatePrtArea =
true;
2959 if ( (css::text::WrapTextMode_RIGHT == rSur.
GetSurround() ||
2960 css::text::WrapTextMode_PARALLEL == rSur.
GetSurround())&&
2965 aRectFnSet.
GetLeft(pFly->GetAnchorFrame()->getFrameArea()) );
2966 rLeftOffset = std::max( rLeftOffset, nWidth );
2967 bInvalidatePrtArea =
true;
2969 if ( (css::text::WrapTextMode_LEFT == rSur.
GetSurround() ||
2970 css::text::WrapTextMode_PARALLEL == rSur.
GetSurround())&&
2974 aRectFnSet.
GetRight(pFly->GetAnchorFrame()->getFrameArea()),
2975 aRectFnSet.
GetLeft(aFlyRect) );
2976 rRightOffset = std::max( rRightOffset, nWidth );
2977 bInvalidatePrtArea =
true;
2983 if (pSpaceBelowBottom)
2985 *pSpaceBelowBottom = aRectFnSet.
GetHeight(aRect);
2989 return bInvalidatePrtArea;
2996 OSL_ENSURE( pAttrs,
"TabFrame::Format, pAttrs is 0." );
3006 aRectFnSet.
AddRight( aFrm, nDiff );
3060 bool bCheckBrowseWidth =
false;
3065 switch (
GetFormat()->GetHoriOrient().GetHoriOrient() )
3067 case text::HoriOrientation::LEFT:
3070 nLeftSpacing = nLeftLine + nLeftOffset;
3076 const SwTwips nWishRight = nMax - nWishedTableWidth - nLeftOffset;
3077 if ( nRightOffset > 0 )
3082 nRightSpacing = nRightLine + std::max(
SwTwips(nRightOffset), nWishRight );
3091 nRightSpacing = nRightLine +
3092 ( ( (nWishRight+nLeftOffset) < 0 ) ?
3093 (nWishRight+nLeftOffset) :
3094 std::max(
SwTwips(0), nWishRight ) );
3098 case text::HoriOrientation::RIGHT:
3101 nRightSpacing = nRightLine + nRightOffset;
3107 const SwTwips nWishLeft = nMax - nWishedTableWidth - nRightOffset;
3108 if ( nLeftOffset > 0 )
3113 nLeftSpacing = nLeftLine + std::max(
SwTwips(nLeftOffset), nWishLeft );
3122 nLeftSpacing = nLeftLine +
3123 ( ( (nWishLeft+nRightOffset) < 0 ) ?
3124 (nWishLeft+nRightOffset) :
3125 std::max(
SwTwips(0), nWishLeft ) );
3129 case text::HoriOrientation::CENTER:
3132 const SwTwips nCenterSpacing = ( nMax - nWishedTableWidth ) / 2;
3133 nLeftSpacing = nLeftLine +
3134 ( (nLeftOffset > 0) ?
3135 std::max( nCenterSpacing,
SwTwips(nLeftOffset) ) :
3137 nRightSpacing = nRightLine +
3138 ( (nRightOffset > 0) ?
3139 std::max( nCenterSpacing,
SwTwips(nRightOffset) ) :
3143 case text::HoriOrientation::FULL:
3148 bCheckBrowseWidth =
true;
3149 nLeftSpacing = nLeftLine + nLeftOffset;
3150 nRightSpacing = nRightLine + nRightOffset;
3155 nLeftSpacing = pAttrs->
CalcLeft(
this );
3162 nLeftSpacing = std::max( nLeftSpacing,
SwTwips( nLeftOffset + nLeftLine ) );
3165 nRightSpacing = pAttrs->
CalcRight(
this );
3172 nRightSpacing = std::max( nRightSpacing,
SwTwips( nRightOffset + nRightLine ) );
3176 case text::HoriOrientation::LEFT_AND_WIDTH:
3181 nLeftSpacing = pAttrs->
CalcLeft(
this );
3192 nMax - (nLeftSpacing-pAttrs->
CalcLeftLine()) - nWishedTableWidth;
3193 nRightSpacing = nRightLine +
3194 ( (nRightOffset > 0) ?
3195 std::max( nWishRight,
SwTwips(nRightOffset) ) :
3200 OSL_FAIL(
"Invalid orientation for table." );
3211 if( (nMax -
MINLAY) < (nLeftSpacing + nRightSpacing) )
3214 aRectFnSet.
SetXMargins( *
this, nLeftSpacing, nRightSpacing );
3217 if ( bCheckBrowseWidth &&
3245 SwTwips nRemaining = 0, nDiff;
3253 nRemaining += nUpper + nLower;
3258 else if ( nDiff < 0 )
3266 if( nHeight > 0 && nDist > (
LONG_MAX - nHeight ) )
3278 while ( pFrame &&
GetFollow() != pFrame )
3284 if ( nReal < nDist )
3291 nDist = nTmp < 0 ? 0 : nTmp;
3302 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
3347 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
3351 bool bAttrSetChg = pLegacy->m_pNew &&
RES_ATTRSET_CHG == pLegacy->m_pNew->Which();
3355 auto& rOldSetChg = *
static_cast<const SwAttrSetChg*
>(pLegacy->m_pOld);
3356 auto& rNewSetChg = *
static_cast<const SwAttrSetChg*
>(pLegacy->m_pNew);
3365 UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
3366 pNItem = aNIter.NextItem();
3367 pOItem = aOIter.NextItem();
3373 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
3416 const sal_uInt16 nWhich = pOld ? pOld->
Which() : pNew ? pNew->
Which() : 0;
3433 for ( sal_uInt16 nIdx = 0; nIdx < nNewRepeat; ++nIdx )
3440 pHeadline->
Paste(
this, pLowerRow );
3460 if (
GetFormat()->GetPageDesc().GetNumOffset())
3494 if ( pOldSet || pNewSet )
3560 #if OSL_DEBUG_LEVEL > 0
3562 OSL_ENSURE( pSect,
"Where does this column come from?");
3563 OSL_ENSURE(
IsAnLower( pSect ),
"Split cell?" );
3571 OSL_ENSURE( pRet->
IsCellFrame(),
"SwTabFrame::FindLastContent failed" );
3573 while ( pRow && !pRow->GetUpper()->IsTabFrame() )
3578 while ( pContentFrame && static_cast<const SwLayoutFrame*>(pRow)->
IsAnLower( pContentFrame ) )
3597 pRet = static_cast<SwSectionFrame*>(pRet)->FindLastContent();
3600 assert(pRet ==
nullptr || dynamic_cast<SwContentFrame*>(pRet) || dynamic_cast<SwTabFrame*>(pRet));
3613 assert(pRet ==
nullptr || dynamic_cast<SwContentFrame*>(pRet));
3639 bool bMoveAnyway =
false;
3649 if(
std::abs( nNewWidth - nOldWidth ) < 2 )
3657 while ( pPrevFrame && pPrevFrame !=
this )
3660 pPrevFrame = pPrevFrame->
GetNext();
3681 tools::Long nLeftOffsetDummy(0), nRightOffsetDummy(0);
3684 nUpperDummy, nLeftOffsetDummy, nRightOffsetDummy, &nSpace);
3700 bool bFits = nSpace > 0;
3704 bFits = nSpace >= 0;
3724 return nTmpHeight <= nSpace;
3732 OSL_ENSURE(
GetUpper(),
"Cut without Upper()." );
3760 if (
nullptr != pFrame )
3798 !pSct->ContainsAny(
true ) )
3803 pSct->InvalidateSize_();
3813 pTmp->InvalidatePrt_();
3837 OSL_ENSURE( pParent,
"No parent for pasting." );
3838 OSL_ENSURE( pParent->
IsLayoutFrame(),
"Parent is ContentFrame." );
3839 OSL_ENSURE( pParent !=
this,
"I'm the parent myself." );
3840 OSL_ENSURE( pSibling !=
this,
"I'm my own neighbour." );
3842 "I'm still registered somewhere." );
3845 InsertBefore( static_cast<SwLayoutFrame*>(pParent), pSibling );
3905 , m_pTabLine( &rLine )
3906 , m_pFollowRow( nullptr )
3908 , mnTopMarginForLowers( 0 )
3909 , mnBottomMarginForLowers( 0 )
3910 , mnBottomLineSize( 0 )
3912 , m_bIsFollowFlowRow(
false )
3914 , m_bIsRepeatedHeadline(
false )
3915 , m_bIsRowSpanLine(
false )
3916 , m_bForceRowSplitAllowed(
false )
3917 , m_bIsInSplit(
false )
3924 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
3962 if(bInFirstNonHeadlineRow)
3964 if(bInFirstNonHeadlineRow || !
GetNext())
3973 if(
auto pNewFormatHint = dynamic_cast<const sw::TableLineFormatChanged*>(&rHint))
3975 if(
GetTabLine() != &pNewFormatHint->m_rTabLine)
3977 RegisterToFormat(const_cast<SwTableLineFormat&>(pNewFormatHint->m_rNewFormat));
3986 bool bInFollowFlowRow =
false;
3988 if(bInFirstNonHeadlineRow ||
3993 if(bInFirstNonHeadlineRow || bInFollowFlowRow)
4000 else if(
auto pMoveTableLineHint = dynamic_cast<const sw::MoveTableLineHint*>(&rHint))
4003 if(
GetTabLine() != &pMoveTableLineHint->m_rTableLine)
4010 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
4013 if(!pLegacy->m_pNew)
4019 switch(pLegacy->m_pNew->Which())
4036 OnFrameSize(*static_cast<const SwFormatFrameSize*>(pLegacy->m_pNew));
4056 static_cast<const SwSectionFrame*
>(pFrame)->ContainsContent() : pFrame;
4061 bool bIsFollow(
false );
4093 pAnchoredObj->FindAnchorCharFrame() != pTmp )
4101 const SwFrameFormat& rFrameFormat = pAnchoredObj->GetFrameFormat();
4103 bool bIsFarAway = pAnchoredObj->GetObjRect().Top() !=
FAR_AWAY;
4105 bool bIsAnchoredToTmpFrm =
false;
4106 if ( pPageFrm && pPageFrm->
IsPageFrame() && pAnchoredObj->GetPageFrame())
4107 bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == pPageFrm ||
4109 const bool bConsiderObj =
4112 bFollowTextFlow && bIsAnchoredToTmpFrm;
4114 if (pFrame->
IsInTab() && bFollowTextFlow && bWrapThrough)
4127 const SwTwips nDistOfFlyBottomToAnchorTop =
4128 aRectFnSet.
GetHeight(pAnchoredObj->GetObjRect()) +
4130 pAnchoredObj->GetCurrRelPos().X() :
4131 pAnchoredObj->GetCurrRelPos().Y() );
4138 nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop + nFrameDiff -
4148 const SwTwips nDistOfFlyBottomToAnchorTop2 = aRectFnSet.
YDiff(
4149 aRectFnSet.
GetBottom(pAnchoredObj->GetObjRect()),
4152 nHeight = std::max( nHeight,
tools::Long(nDistOfFlyBottomToAnchorTop2 ));
4161 if( !static_cast<const SwSectionFrame*>(pFrame)->IsAnLower( pTmp ) )
4176 nTopSpace =
static_cast<const SwRowFrame*
>(rCell.
GetUpper())->GetTopMarginForLowers();
4177 nBottomSpace =
static_cast<const SwRowFrame*
>(rCell.
GetUpper())->GetBottomMarginForLowers();
4183 nTopSpace = rAttrs.
CalcLeft( &rCell );
4184 nBottomSpace = rAttrs.
CalcRight( &rCell );
4193 return nTopSpace + nBottomSpace;
4200 const bool _bConsiderObjs,
4220 nHeight += nLowHeight;
4222 if ( _bConsiderObjs )
4224 nFlyAdd = std::max(
tools::Long(0), nFlyAdd - nLowHeight );
4237 if ( _pCell->
Lower() )
4254 const bool _bConsiderObjs )
4284 if ( 1 == nRowSpan )
4288 else if ( -1 == nRowSpan )
4296 while ( pMasterRow && pMasterRow != _pRow )
4299 pMasterRow = pMasterRow->
GetNext();
4319 sal_uInt16 nTopSpace = 0;
4320 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4321 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4323 sal_uInt16 nTmpTopSpace = 0;
4324 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4325 nTmpTopSpace =
lcl_GetTopSpace( *static_cast<const SwRowFrame*>(pCurrLower->Lower()) );
4330 nTmpTopSpace = rBoxItem.
CalcLineSpace( SvxBoxItemLine::TOP,
true );
4332 nTopSpace = std::max( nTopSpace, nTmpTopSpace );
4340 sal_uInt16 nTopLineDist = 0;
4341 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4342 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4344 sal_uInt16 nTmpTopLineDist = 0;
4345 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4346 nTmpTopLineDist =
lcl_GetTopLineDist( *static_cast<const SwRowFrame*>(pCurrLower->Lower()) );
4351 nTmpTopLineDist = rBoxItem.
GetDistance( SvxBoxItemLine::TOP );
4353 nTopLineDist = std::max( nTopLineDist, nTmpTopLineDist );
4355 return nTopLineDist;
4361 sal_uInt16 nBottomLineSize = 0;
4362 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4363 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4365 sal_uInt16 nTmpBottomLineSize = 0;
4366 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4368 const SwFrame* pRow = pCurrLower->GetLastLower();
4375 nTmpBottomLineSize = rBoxItem.
CalcLineSpace( SvxBoxItemLine::BOTTOM,
true ) -
4378 nBottomLineSize = std::max( nBottomLineSize, nTmpBottomLineSize );
4380 return nBottomLineSize;
4386 sal_uInt16 nBottomLineDist = 0;
4387 for (
const SwCellFrame* pCurrLower = static_cast<const SwCellFrame*>(rRow.
Lower()); pCurrLower;
4388 pCurrLower =
static_cast<const SwCellFrame*
>(pCurrLower->GetNext()) )
4390 sal_uInt16 nTmpBottomLineDist = 0;
4391 if ( pCurrLower->Lower() && pCurrLower->Lower()->IsRowFrame() )
4393 const SwFrame* pRow = pCurrLower->GetLastLower();
4400 nTmpBottomLineDist = rBoxItem.
GetDistance( SvxBoxItemLine::BOTTOM );
4402 nBottomLineDist = std::max( nBottomLineDist, nTmpBottomLineDist );
4404 return nBottomLineDist;
4424 if (!pLine || !pTab || !pTab->
IsFollow())
4428 for (
const SwRowFrame* pCurRow = aIter.First(); pCurRow; pCurRow = aIter.Next())
4430 if (pCurRow != &rRow && pCurRow->
GetTabLine() == pLine)
4445 nResult += aRectFnSet.
GetHeight(pCurRow->getFrameArea());
4455 OSL_ENSURE( pAttrs,
"SwRowFrame::Format without Attrs." );
4495 while ( pTmpRow && !pPrevTabLine )
4502 while ( rLines[ nIdx ] != pTmpRow->
GetTabLine() )
4508 pPrevTabLine = rLines[ nIdx - 1 ];
4525 for (
SwRowFrame* pRow = aIter.First(); pRow; pRow = aIter.Next() )
4530 if ( pRow->GetTabLine() == pPrevTabLine &&
4531 !pRow->IsRepeatedHeadline() )
4533 pPreviousRow = pRow;
4539 sal_uInt16 nTopPrtMargin = nTopSpace;
4542 const sal_uInt16 nTmpPrtMargin = pPreviousRow->
GetBottomLineSize() + nTopLineDist;
4543 if ( nTmpPrtMargin > nTopPrtMargin )
4544 nTopPrtMargin = nTmpPrtMargin;
4577 #if OSL_DEBUG_LEVEL > 0
4594 Shrink( nDiff,
false,
true );
4595 else if ( nDiff < 0 )
4610 pSibling = pSibling->
GetNext();
4611 }
while ( pSibling );
4627 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
4659 SwFrame* pToAdjustRow =
nullptr;
4666 pToAdjustRow = pToAdjust->
GetUpper();
4670 pToAdjust = pCellFrame;
4671 pToAdjustRow =
this;
4677 while ( pToAdjustRow )
4680 nSumRowHeight += pToAdjustRow ==
this ?
4684 if ( nRowSpan-- == 1 )
4687 pToAdjustRow = pToAdjustRow->
GetNext();
4690 if ( pToAdjustRow && pToAdjustRow !=
this )
4696 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
4701 pNotify = pToAdjust;
4706 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
4746 bool bRestrictTableGrowth;
4752 bRestrictTableGrowth = pFollowFlowRow && !pFollowFlowRow->
IsRowSpanLine();
4757 bRestrictTableGrowth =
GetFollowRow() && bHasFollowFlowLine;
4758 OSL_ENSURE( !bRestrictTableGrowth || !
GetNext(),
4759 "GetFollowRow for row frame that has a Next" );
4762 const SwTwips nAdditionalSpace =
4764 if ( bRestrictTableGrowth && nAdditionalSpace > 0 )
4766 nReal =
std::min( nAdditionalSpace, nDist );
4776 if ( bRestrictTableGrowth )
4817 const bool bShrinkAnyway = bInfo;
4836 OSL_ENSURE(
FindTabFrame(),
"<SwRowFrame::ShrinkFrame(..)> - no table frame -> crash." );
4837 const bool bConsiderObjs(
FindTabFrame()->IsConsiderObjsForMinCellHeight() );
4844 if ( nRealDist < 0 )
4854 aRectFnSet.
SetHeight( aFrm, nHeight - nReal );
4858 aFrm.
Pos().AdjustX(nReal );
4864 if ( !bShrinkAnyway && !
GetNext() && nTmp != nReal )
4873 aRectFnSet.
SetHeight( aFrm, nHeight + nReal );
4877 aFrm.
Pos().AdjustX( -nReal );
4942 static_cast<const SwTextFrame*
>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue();
4947 , m_pTabBox( &rBox )
4951 if ( !bInsertContent )
4965 for (
size_t i = 0;
i < rLines.
size(); ++
i )
4981 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
5010 if( nFrameTop != lYStart )
5018 aRectFnSet.
SubTop( aFrm, -lDiff );
5030 aRectFnSet.
GetTop(static_cast<SwLayoutFrame*>(pFrame)->
Lower()->getFrameArea())
5049 bool bVertPosDepOnAnchor(
true );
5052 switch ( aVert.GetRelationOrient() )
5054 case text::RelOrientation::PAGE_FRAME:
5055 case text::RelOrientation::PAGE_PRINT_AREA:
5056 bVertPosDepOnAnchor =
false;
5070 const bool bDirectMove =
5071 FAR_AWAY != pFly->getFrameArea().Top() &&
5072 bVertPosDepOnAnchor &&
5073 !pFly->ConsiderObjWrapInfluenceOnObjPos();
5078 aRectFnSet.
SubTop( aFrm, -lDiff );
5082 pFly->GetVirtDrawObj()->SetBoundAndSnapRectsDirty();
5086 pFly->GetVirtDrawObj()->SetChanged();
5088 pFly->InvalidateObjRectWithSpaces();
5091 if ( pFly->IsFlyInContentFrame() )
5101 else if( pFly->IsAutoPos() )
5103 pFly->AddLastCharY( lDiff );
5106 pFly->AddLastTopOfLineY( lDiff );
5117 pFly->IsFlyFreeFrame() )
5121 if ( pPageFrame != pPageOfAnchor )
5125 pPageFrame->
MoveFly( pFly, pPageOfAnchor );
5134 pFly->InvalidatePos();
5144 pFly->SetCompletePaint();
5147 else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) !=
nullptr )
5155 != RndStdIds::FLY_AS_CHAR))
5159 if ( pPageFrame != pPageOfAnchor )
5175 const bool bDirectMove =
5177 bVertPosDepOnAnchor &&
5182 if ( aRectFnSet.
IsVert() )
5197 OSL_FAIL(
"<lcl_ArrangeLowers(..)> - unknown type of anchored object!" );
5204 lYStart = aRectFnSet.
YInc( lYStart,
5212 SwTwips nDistanceToUpperPrtBottom =
5217 if ( nDistanceToUpperPrtBottom < 0 &&
5220 !
static_cast<SwTextFrame*
>(pFrame)->IsUndersized() ) ) ||
5233 OSL_ENSURE( pAttrs,
"CellFrame::Format, pAttrs is 0." );
5244 SwTwips nTopSpace, nBottomSpace, nLeftSpace, nRightSpace;
5249 nLeftSpace = rBoxItem.
GetDistance( SvxBoxItemLine::LEFT );
5250 nRightSpace = rBoxItem.
GetDistance( SvxBoxItemLine::RIGHT );
5257 nLeftSpace = pAttrs->
CalcLeft(
this );
5258 nRightSpace = pAttrs->
CalcRight(
this );
5259 nTopSpace = pAttrs->
CalcTop();
5262 aRectFnSet.
SetXMargins( *
this, nLeftSpace, nRightSpace );
5263 aRectFnSet.
SetYMargins( *
this, nTopSpace, nBottomSpace );
5288 OSL_ENSURE( nWish,
"Table without width?" );
5289 OSL_ENSURE( nWidth <= nWish,
"Width of cell larger than table." );
5290 OSL_ENSURE( nWidth > 0,
"Box without width" );
5293 if ( nWish != nPrtWidth )
5307 pTmpBox = rBoxes[ i++ ];
5313 double nTmpWidth = nSumWidth;
5314 nTmpWidth *= nPrtWidth;
5316 nWidth =
static_cast<SwTwips>(nTmpWidth);
5321 while ( pTmpCell !=
this )
5324 pTmpCell = pTmpCell->
GetNext();
5327 nWidth = nWidth - nSumFrameWidths;
5333 double nTmpWidth = nWidth;
5334 nTmpWidth *= nPrtWidth;
5336 nWidth =
static_cast<SwTwips>(nTmpWidth);
5342 OSL_ENSURE( pAttrs->
GetSize().
Width() > 0,
"Box without width" );
5345 while ( pPre !=
this )
5359 aRectFnSet.
SubLeft( aFrm, nDiff );
5363 aRectFnSet.
AddRight( aFrm, nDiff );
5369 aRectFnSet.
AddRight( aPrt, nDiff );
5376 if ( nDiffHeight > 0 )
5380 if ( !
Grow( nDiffHeight ) )