22#include <osl/diagnose.h>
57#include <lineinfo.hxx>
68bool SwFlowFrame::s_bMoveBwdJump =
false;
70SwFlowFrame::SwFlowFrame(
SwFrame &rFrame ) :
73 m_pPrecede( nullptr ),
75 m_bUndersized( false ),
79SwFlowFrame::~SwFlowFrame()
83 m_pFollow->m_pPrecede =
nullptr;
87 m_pPrecede->m_pFollow =
nullptr;
91void SwFlowFrame::SetFollow(SwFlowFrame *
const pFollow)
95 assert(
this == m_pFollow->m_pPrecede);
96 m_pFollow->m_pPrecede =
nullptr;
99 if (m_pFollow !=
nullptr)
101 if (m_pFollow->m_pPrecede)
103 assert(m_pFollow == m_pFollow->m_pPrecede->m_pFollow);
104 m_pFollow->m_pPrecede->m_pFollow =
nullptr;
106 m_pFollow->m_pPrecede =
this;
111bool SwFlowFrame::HasLockedFollow()
const
113 const SwFlowFrame* pFrame = GetFollow();
116 if( pFrame->IsJoinLocked() )
118 pFrame = pFrame->GetFollow();
123bool SwFlowFrame::IsKeepFwdMoveAllowed(
bool bIgnoreMyOwnKeepValue )
130 if ( bIgnoreMyOwnKeepValue && pFrame->
GetIndPrev() )
146void SwFlowFrame::CheckKeep()
185bool IsNextContentFullPage(
const SwFrame& rThis)
194 if (!pNextDrawObjs || !pNextDrawObjs->
size())
199 for (
const auto& pDrawObj : *pNextDrawObjs)
206 SwTwips nDrawObjHeight = pDrawObj->GetObjRectWithSpaces().Height();
207 const SwPageFrame* pPageFrame = pDrawObj->GetPageFrame();
214 if (nDrawObjHeight < nBodyHeight)
220 if (rSurround.
GetSurround() != text::WrapTextMode_NONE)
236 bool const bCheckIfLastRowShouldKeep)
const
245 bool bKeep = bCheckIfLastRowShouldKeep ||
246 ( !m_rThis.IsInFootnote() &&
247 ( !m_rThis.IsInTab() || m_rThis.IsTabFrame() ) &&
248 rKeep.GetValue() && !IsNextContentFullPage(m_rThis));
250 OSL_ENSURE( !bCheckIfLastRowShouldKeep || m_rThis.IsTabFrame(),
251 "IsKeep with bCheckIfLastRowShouldKeep should only be used for tabfrms" );
258 case SvxBreak::ColumnAfter:
259 case SvxBreak::ColumnBoth:
260 case SvxBreak::PageAfter:
261 case SvxBreak::PageBoth:
271 if(
nullptr != (pNxt = m_rThis.FindNextCnt()) &&
272 (!m_pFollow || pNxt != &m_pFollow->GetFrame()))
276 if ( bCheckIfLastRowShouldKeep )
283 if ( pThisSectionFrame )
284 pThisSection = pThisSectionFrame->
GetSection();
286 if ( pNextSectionFrame )
287 pNextSection = pNextSectionFrame->
GetSection();
289 if ( pThisSection != pNextSection )
298 if (pTab && (!m_rThis.IsInTab() || m_rThis.FindTabFrame() != pTab))
314 case SvxBreak::ColumnBefore:
315 case SvxBreak::ColumnBoth:
316 case SvxBreak::PageBefore:
317 case SvxBreak::PageBoth:
350 SwFlowFrame *pTmp =
this;
356 if( pTmp->GetFrame().GetDrawObjs() )
358 pTmp = pTmp->GetFollow();
359 }
while ( !nRet && pTmp );
366 for (
size_t i = 0; nRet < 3 &&
i < rObjs.
size(); ++
i )
372 if ( aRect.Overlaps( rRect ) &&
375 if( m_rThis.IsLayoutFrame() &&
380 if ( pFly->IsAnLower( &m_rThis ) )
385 if ( pAnchor == &m_rThis )
407 if (m_rThis.IsTextFrame())
408 pNode =
static_cast<SwTextFrame&
>(m_rThis).GetTextNodeFirst();
409 else if (m_rThis.IsNoTextFrame())
411 else if( m_rThis.IsSctFrame() )
416 assert(!m_rThis.IsContentFrame());
417 OSL_ENSURE( m_rThis.IsTabFrame(),
"new FowFrame?" );
418 pNode =
static_cast<SwTabFrame&
>(m_rThis).GetTable()->
419 GetTabSortBoxes()[0]->GetSttNd()->FindTableNode();
423 if (nIndex < nTmpIndex &&
424 (!m_rThis.IsTextFrame() ||
492 bool bUnlock = !
static_cast<SwFootnoteFrame*
>(pLay)->IsBackMoveLocked();
497 while ( pCnt && pLay->
IsAnLower( pCnt ) )
502 OSL_ENSURE( pCnt->
IsTextFrame(),
"The Graphic has landed." );
503 if (
static_cast<SwTextFrame*
>(pCnt)->IsLocked() ||
504 static_cast<SwTextFrame*
>(pCnt)->GetFollow() == pStart )
534 if (
nullptr != pStart->
mpPrev )
544 if (
nullptr == pStart->
mpPrev )
594 if (
static_cast<SwTextFrame*
>(pFloat)->GetCacheIdx() != USHRT_MAX )
600 nGrowVal += aRectFnSet.GetHeight(pFloat->
getFrameArea());
625 pOldParent->
Shrink( nGrowVal );
626 pParent->
Grow( nGrowVal );
636 OSL_ENSURE( pParent,
"No parent given." );
637 OSL_ENSURE( m_rThis.GetUpper(),
"Where are we coming from?" );
640 SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
660 m_rThis.GetUpper()->SetCompletePaint();
661 m_rThis.GetUpper()->InvalidatePage();
676 pOldParent = CutTree( &m_rThis );
677 bInvaLay = PasteTree( &m_rThis, pParent, pSibling, pOldParent );
684 if ( pOldParent && !pOldParent->
Lower() &&
686 !(pSct = pOldParent->
FindSctFrame())->ContainsContent() &&
693 if( !m_rThis.IsInSct() &&
694 ( !m_rThis.IsInTab() || ( m_rThis.IsTabFrame() && !m_rThis.GetUpper()->IsInTab() ) ) )
695 m_rThis.GetUpper()->Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
696 else if( m_rThis.GetUpper()->IsSctFrame() )
701 pTmpSct->
Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
707 if ( pOldPage != pPage )
710 if ( m_rThis.IsLayoutFrame() )
719 m_rThis.InvalidateLineNum_();
723 m_rThis.GetUpper()->InvalidatePage( pPage );
726bool SwFlowFrame::IsAnFollow(
const SwFlowFrame *pAssumed )
const
728 const SwFlowFrame *pFoll =
this;
730 {
if ( pAssumed == pFoll )
732 pFoll = pFoll->GetFollow();
739 OSL_ENSURE( IsFollow(),
"SwContentFrame::FindMaster(): !IsFollow" );
743 if ( pPrec && pPrec->HasFollow() && pPrec->
GetFollow() == this )
745 OSL_ENSURE( pPrec->
IsTextFrame(),
"NoTextFrame with follow found" );
749 OSL_FAIL(
"Follow is lost in Space." );
755 OSL_ENSURE( IsFollow(),
"SwSectionFrame::FindMaster(): !IsFollow" );
766 pSect = aIter.
Next();
769 OSL_FAIL(
"Follow is lost in Space." );
775 OSL_ENSURE( IsFollow(),
"SwTabFrame::FindMaster(): !IsFollow" );
787 if ( !pTab->IsFollow() )
807 OSL_FAIL(
"Follow is lost in Space." );
826 { pLeaf =
const_cast<SwFrame*
>(pLeaf)->
GetLeaf( eMakePage, bFwd );
837 }
while ( !bFound && pLeaf );
852 if ( bInTab && bInSct )
855 while ( pUpperFrame )
870 pUpperFrame = pUpperFrame->
GetUpper();
921 std::optional<sal_uInt16> oTmp;
922 SwFlowFrame *pFlow = SwFlowFrame::CastFlowFrame(
this );
923 if ( !pFlow || !pFlow->IsFollow() )
949 if( pNewFlow == pFlow )
951 if ( pNewFlow && pNewFlow->GetFrame().IsInTab() )
953 const SwPageDesc *pNewDesc= ( pNewFlow && !pNewFlow->IsFollow() )
954 ? pNewFlow->GetFrame().GetPageDescItem().GetPageDesc()
959 SAL_INFO(
"sw.pageframe",
"WrongPageDesc right: " << isRightPage
960 <<
" first: " << bFirst <<
" " << pNew->
GetFormat() <<
" == "
967 || (pNewDesc && pNewDesc == pDesc);
973 OSL_ENSURE( !
IsInFootnote(),
"GetNextLeaf(), don't call me for Footnote." );
974 OSL_ENSURE( !
IsInSct(),
"GetNextLeaf(), don't call me for Sections." );
1018 pOldLayLeaf = pLayLeaf;
1049 if( pFootnote && pFootnote->
GetRef() )
1068 if ( !pPg || pPg == pNew )
1073 pOldLayLeaf =
nullptr;
1105 OSL_ENSURE( !
IsInFootnote(),
"GetPrevLeaf(), don't call me for Footnote." );
1121 if ( pLayLeaf->
Lower() )
1123 pPrevLeaf = pLayLeaf;
1126 SwFlowFrame::SetMoveBwdJump(
true );
1133 return pLayLeaf ? pLayLeaf : pPrevLeaf;
1136bool SwFlowFrame::IsPrevObjMove()
const
1142 const SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
1150 OSL_ENSURE( SwFlowFrame::CastFlowFrame( pPre ),
"new flowfrm?" );
1151 if( SwFlowFrame::CastFlowFrame( pPre )->IsAnFollow(
this ) )
1153 if (SwFlowFrame::CastFlowFrame(pPre)->IsJoinLocked())
1157 if (SwFlowFrame::CastFlowFrame(pPre)->IsKeep(rAttrs.GetAttrSet().GetKeep(), pPre->
GetBreakItem()))
1191 if ( pVertPosOrientFrame &&
1192 pPreUp != pVertPosOrientFrame &&
1193 !pPreUp->
IsAnLower( pVertPosOrientFrame ) )
1218bool SwFlowFrame::IsPageBreak(
bool bAct )
const
1220 if ( !IsFollow() && m_rThis.IsInDocBody() &&
1221 ( !m_rThis.IsInTab() || ( m_rThis.IsTabFrame() && !m_rThis.GetUpper()->IsInTab() ) ) )
1223 const SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
1235 OSL_ENSURE( pPrev->
IsInDocBody(),
"IsPageBreak: Not in DocBody?" );
1248 const SvxBreak eBreak = m_rThis.GetBreakItem().GetBreak();
1249 if ( eBreak == SvxBreak::PageBefore ||
1250 eBreak == SvxBreak::PageBoth ||
1251 ( bTreatSingleColumnBreakAsPageBreak && eBreak == SvxBreak::ColumnBefore && !m_rThis.FindColFrame() ))
1256 if ( ePrB == SvxBreak::PageAfter ||
1257 ePrB == SvxBreak::PageBoth ||
1258 m_rThis.GetPageDescItem().GetPageDesc())
1281bool SwFlowFrame::IsColBreak(
bool bAct )
const
1283 if ( !IsFollow() && (m_rThis.IsMoveable() || bAct) )
1290 while( pPrev && ( ( !pPrev->
IsInDocBody() && !m_rThis.IsInFly() && !m_rThis.FindFooterOrHeader() ) ||
1306 if ( eBreak == SvxBreak::ColumnBefore ||
1307 eBreak == SvxBreak::ColumnBoth )
1312 if ( ePrB == SvxBreak::ColumnAfter ||
1313 ePrB == SvxBreak::ColumnBoth )
1322bool SwFlowFrame::HasParaSpaceAtPages(
bool bSct )
const
1324 if( m_rThis.IsInSct() )
1334 return !pTmp->
GetPrev() || IsPageBreak(
true);
1336 return IsColBreak(
true );
1341 OSL_FAIL(
"HasParaSpaceAtPages: Where's my page?" );
1344 if( !m_rThis.IsInDocBody() || ( m_rThis.IsInTab() && !m_rThis.IsTabFrame()) ||
1345 IsPageBreak(
true ) || ( m_rThis.FindColFrame() && IsColBreak(
true ) ) )
1356 return pTmp && !pTmp->
GetPrev();
1364const SwFrame* SwFlowFrame::GetPrevFrameForUpperSpaceCalc_(
const SwFrame* _pProposedPrevFrame )
const
1366 const SwFrame* pPrevFrame = _pProposedPrevFrame
1367 ? _pProposedPrevFrame
1371 while ( pPrevFrame &&
1377 pPrevFrame = pPrevFrame->
GetPrev();
1383 if ( !pPrevFrame && m_rThis.IsInFootnote() &&
1384 ( m_rThis.IsSctFrame() ||
1385 !m_rThis.IsInSct() || !m_rThis.FindSctFrame()->IsInFootnote() ) )
1388 static_cast<const SwFootnoteFrame*
>(m_rThis.FindFootnoteFrame()->GetPrev());
1389 if ( pPrevFootnoteFrame )
1394 while ( pPrevFrame &&
1400 pPrevFrame = pPrevFrame->
GetPrev();
1415 if ( pPrevFrame && pPrevFrame->
IsInTab() )
1418 if ( pPrevSectFrame->
IsAnLower( pTableFrame ) )
1420 pPrevFrame = pTableFrame;
1424 while ( pPrevFrame &&
1426 static_cast<const SwTextFrame*
>(pPrevFrame)->IsHiddenNow() )
1428 pPrevFrame = pPrevFrame->
GetPrev();
1446 bool bIdenticalStyles =
false;
1452 bIdenticalStyles = pPrevFormatColl == pFormatColl;
1454 return bIdenticalStyles;
1471 const bool _bConsiderGrid )
const
1473 const SwFrame* pPrevFrame = GetPrevFrameForUpperSpaceCalc_( pPr );
1475 std::optional<SwBorderAttrAccess> oAccess;
1479 if( m_rThis.IsSctFrame() )
1484 while( !pOwn &&
nullptr != ( pFoll = pFoll->
GetFollow() ) );
1491 pAttrs = oAccess->Get();
1508 const bool bContextualSpacing = bContextualSpacingThis
1509 && bContextualSpacingPrev
1510 && bIdenticalStyles;
1514 const bool bHalfContextualSpacing = !bContextualSpacing
1515 && bContextualSpacingThis
1516 && !bContextualSpacingPrev
1517 && bIdenticalStyles;
1521 const bool bHalfContextualSpacingPrev = !bContextualSpacing
1522 && !bContextualSpacingThis
1523 && bContextualSpacingPrev
1524 && bIdenticalStyles;
1531 bool bPrevLineSpacingProportional =
false;
1533 nPrevLowerSpace, nPrevLineSpacing,
1534 bPrevLineSpacingProportional,
1540 SwTwips nAdd = nPrevLineSpacing;
1543 if ( bUseFormerLineSpacing )
1568 if ( bPrevLineSpacingProportional )
1570 nAdd +=
static_cast<SwTextFrame*
>(pOwn)->GetLineSpace(
true );
1574 nAdd = std::max( nAdd,
SwTwips(
static_cast<SwTextFrame*
>(pOwn)->GetLineSpace(
true )) );
1582 nUpper = bContextualSpacing ? 0 : std::max(
1583 bHalfContextualSpacingPrev ? 0 :
static_cast<tools::Long>(nPrevLowerSpace),
1588 if ( bUseFormerLineSpacing )
1592 nUpper = std::max( nUpper,
SwTwips(
static_cast<SwTextFrame*
>(pOwn)->GetLineSpace()) );
1593 if ( nPrevLineSpacing != 0 )
1595 nUpper = std::max( nUpper, nPrevLineSpacing );
1606 SwTwips nAdd = nPrevLineSpacing;
1616 if ( bPrevLineSpacingProportional )
1618 nAdd +=
static_cast<SwTextFrame*
>(pOwn)->GetLineSpace(
true );
1622 nAdd = std::max( nAdd,
SwTwips(
static_cast<SwTextFrame*
>(pOwn)->GetLineSpace(
true )) );
1630 CastFlowFrame( pOwn )->HasParaSpaceAtPages( m_rThis.IsSctFrame() ) )
1639 nUpper += pAttrs->
GetTopLine( m_rThis, (pPr ? pPrevFrame :
nullptr) );
1645 if ( _bConsiderGrid && m_rThis.GetUpper()->GetFormat()->GetDoc()->IsSquaredPageMode() )
1647 nUpper += GetUpperSpaceAmountConsideredForPageGrid_( nUpper );
1658SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPageGrid_(
1659 const SwTwips _nUpperSpaceWithoutGrid )
const
1661 SwTwips nUpperSpaceAmountConsideredForPageGrid = 0;
1663 if ( m_rThis.IsInDocBody() && m_rThis.GetAttrSet()->GetParaGrid().GetValue() )
1673 pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
1676 const SwTwips nBodyPrtTop = aRectFnSet.GetPrtTop(*pBodyFrame);
1677 const SwTwips nProposedPrtTop =
1678 aRectFnSet.YInc( aRectFnSet.GetTop(m_rThis.getFrameArea()),
1679 _nUpperSpaceWithoutGrid );
1681 const SwTwips nSpaceAbovePrtTop =
1682 aRectFnSet.YDiff( nProposedPrtTop, nBodyPrtTop );
1683 const SwTwips nSpaceOfCompleteLinesAbove =
1684 nGridLineHeight * ( nSpaceAbovePrtTop / nGridLineHeight );
1686 aRectFnSet.YInc( nBodyPrtTop, nSpaceOfCompleteLinesAbove );
1687 if ( aRectFnSet.YDiff( nProposedPrtTop, nNewPrtTop ) > 0 )
1689 nNewPrtTop = aRectFnSet.YInc( nNewPrtTop, nGridLineHeight );
1692 const SwTwips nNewUpperSpace =
1693 aRectFnSet.YDiff( nNewPrtTop,
1694 aRectFnSet.GetTop(m_rThis.getFrameArea()) );
1696 nUpperSpaceAmountConsideredForPageGrid =
1697 nNewUpperSpace - _nUpperSpaceWithoutGrid;
1699 OSL_ENSURE( nUpperSpaceAmountConsideredForPageGrid >= 0,
1700 "<SwFlowFrame::GetUpperSpaceAmountConsideredForPageGrid(..)> - negative space considered for page grid!" );
1704 return nUpperSpaceAmountConsideredForPageGrid;
1712SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrame()
const
1714 SwTwips nUpperSpaceAmountOfPrevFrame = 0;
1716 const SwFrame* pPrevFrame = GetPrevFrameForUpperSpaceCalc_();
1722 bool bDummy =
false;
1724 if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 )
1730 nUpperSpaceAmountOfPrevFrame = nPrevLowerSpace + nPrevLineSpacing;
1734 nUpperSpaceAmountOfPrevFrame = std::max( nPrevLowerSpace, nPrevLineSpacing );
1739 return nUpperSpaceAmountOfPrevFrame;
1748SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid()
const
1750 SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid = 0;
1752 if (!m_rThis.GetUpper() || !m_rThis.GetUpper()->GetFormat())
1754 return nUpperSpaceAmountConsideredForPrevFrameAndPageGrid;
1759 nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =
1760 GetUpperSpaceAmountConsideredForPrevFrame() +
1761 ( m_rThis.GetUpper()->GetFormat()->GetDoc()->IsSquaredPageMode()
1762 ? GetUpperSpaceAmountConsideredForPageGrid_( CalcUpperSpace(
nullptr,
nullptr,
false ) )
1766 return nUpperSpaceAmountConsideredForPrevFrameAndPageGrid;
1775 std::optional<SwBorderAttrAccess> oAttrAccess;
1779 _pAttrs = oAttrAccess->Get();
1782 bool bCommonBorder =
true;
1783 if ( m_rThis.IsInSct() && m_rThis.GetUpper()->IsColBodyFrame() )
1788 nLowerSpace = bCommonBorder ?
1795 if ( ( ( m_rThis.IsTabFrame() && m_rThis.GetUpper()->IsInTab() ) ||
1797 ( m_rThis.IsInTab() && !GetFollow() ) ) &&
1798 !m_rThis.GetIndNext() )
1800 nLowerSpace += CalcAddLowerSpaceAsLastInTableCell( _pAttrs );
1804 bool bHasSpacingBelowPara = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(
1806 if (bHasSpacingBelowPara && !m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow()
1807 && !m_rThis.GetIndNext())
1818SwTwips SwFlowFrame::CalcAddLowerSpaceAsLastInTableCell(
1821 SwTwips nAdditionalLowerSpace = 0;
1826 const SwFrame* pFrame = &m_rThis;
1831 if ( pFrame && pFrame->
IsInTab() )
1834 if ( pSectFrame->
IsAnLower( pTableFrame ) )
1836 pFrame = pTableFrame;
1841 std::optional<SwBorderAttrAccess> oAttrAccess;
1842 if (pFrame && (!_pAttrs || pFrame != &m_rThis))
1845 _pAttrs = oAttrAccess->Get();
1859 return nAdditionalLowerSpace;
1863bool SwFlowFrame::CheckMoveFwd(
bool& rbMakePage,
bool bKeep,
bool bIgnoreMyOwnKeepValue )
1869 (
nullptr != (pNxt = m_rThis.FindNext()) ) && IsKeepFwdMoveAllowed(bIgnoreMyOwnKeepValue) )
1873 const SwFrame* pTmp =
nullptr;
1891 if( pNxtSct && pSct->IsAnFollow( pNxtSct ) )
1905 bool bMovedFwd =
false;
1907 if ( m_rThis.GetIndPrev() )
1909 if ( IsPrevObjMove() )
1912 if ( !
MoveFwd( rbMakePage,
false ) )
1917 if ( IsPageBreak(
false ) )
1919 while (
MoveFwd( rbMakePage,
true ) )
1924 else if ( IsColBreak (
false ) )
1929 {
MoveFwd( rbMakePage,
false );
1938 }
while ( IsColBreak(
false ) );
1939 if ( pPage != m_rThis.FindPageFrame() )
1947bool SwFlowFrame::ForbiddenForFootnoteCntFwd()
const
1949 return m_rThis.
IsTabFrame() || m_rThis.IsInTab();
1955bool SwFlowFrame::MoveFwd(
bool bMakePage,
bool bPageBreak,
bool bMoveAlways )
1959 if (m_rThis.IsInFootnote())
1961 assert(!ForbiddenForFootnoteCntFwd());
1962 if (!m_rThis.IsContentFrame() || !pOldBoss)
1964 SAL_WARN(
"sw.core",
"Tables in footnotes are not truly supported");
1967 return static_cast<SwContentFrame&
>(m_rThis).MoveFootnoteCntFwd( bMakePage, pOldBoss );
1970 if( !IsFwdMoveAllowed() && !bMoveAlways )
1973 if( m_rThis.IsInSct() )
1981 if ( m_rThis.IsInTab() &&
1982 ( !m_rThis.IsTabFrame() ||
1983 m_rThis.GetUpper()->IsInTab() ) &&
1984 nullptr != m_rThis.GetNextCellLeaf() )
1997 if ( !pCol || !pCol->
GetPrev() )
2002 std::optional<SwFrameDeleteGuard> oDeleteGuard;
2004 oDeleteGuard.emplace(pOldBoss);
2006 bool bSamePage =
true;
2025 if( pSect != m_rThis.FindSctFrame() )
2029 pNewUpper->
Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
2036 pNewUpper->
Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
2039 bool bBossChg = pNewBoss != pOldBoss;
2044 oDeleteGuard.reset();
2047 bool bFootnoteMoved =
false;
2056 const bool bForceSimpleFormat = pSect && pSect->HasFollow() &&
2059 if ( pNewBoss != pOldBoss )
2062 bSamePage = pNewPage == pOldPage;
2070 OSL_ENSURE( pStart || ( m_rThis.IsTabFrame() && !
static_cast<SwTabFrame&
>(m_rThis).
Lower() ),
2071 "MoveFwd: Missing Content" );
2082 if( pNewUpper != m_rThis.GetUpper() )
2086 if ( m_rThis.GetUpper()->IsSctFrame() )
2091 MoveSubTree( pNewUpper, pNewUpper->
Lower() );
2109 if ( bForceSimpleFormat )
2114 if ( bFootnoteMoved && !bSamePage )
2125 SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
2137 const SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
2144 ( m_rThis.GetPageDescItem().GetPageDesc() ||
2160bool SwFlowFrame::MoveBwd(
bool &rbReformat )
2162 SwFlowFrame::SetMoveBwdJump(
false );
2170 if ( m_rThis.IsTextFrame() && m_rThis.IsInTab() )
2173 while ( pUpperFrame )
2181 bool bIsFollowSection = pUpperFrame->
IsSctFrame() &&
static_cast<const SwSectionFrame*
>(pUpperFrame)->GetPrecede();
2185 bool bIsFollow =
const_cast<SwLayoutFrame*
>(pUpperFrame)->GetPrevCellLeaf();
2187 if ( ( pUpperFrame->
IsColumnFrame() && pUpperFrame->
IsInSct() ) || bIsFollowSection || bIsFollow )
2191 pUpperFrame = pUpperFrame->
GetUpper();
2201 bool bCheckPageDescs =
false;
2202 bool bCheckPageDescOfNextPage =
false;
2215 if( bEndnote && pFootnote->
IsInSct() )
2230 pRef = pFootnote->
GetRef();
2232 OSL_ENSURE( pRef,
"MoveBwd: Endnote for an empty section?" );
2237 if ( pOldBoss != pRefBoss &&
2244 else if ( IsPageBreak(
true ) )
2250 const SwFrame *pFlow = &m_rThis;
2289 if (pNewUpper && pNewUpper->
Lower())
2292 if ( pNewNextUpper &&
2293 pNewNextUpper != m_rThis.GetUpper() &&
2301 pNewUpper = pNewNextUpper;
2302 bCheckPageDescOfNextPage =
true;
2306 bCheckPageDescs =
true;
2311 else if ( IsColBreak(
true ) )
2316 if( m_rThis.IsInSct() )
2319 if( pNewUpper && !SwFlowFrame::IsMoveBwdJump() &&
2325 pNewUpper =
nullptr;
2330 else if ( pNewUpper && !SwFlowFrame::IsMoveBwdJump() )
2343 if ( pNewNextUpper &&
2351 pNewUpper = pNewNextUpper;
2380 if( SwFlowFrame::IsMoveBwdJump() )
2382 pNewUpper = pColBody;
2398 if ( pNewNextUpper &&
2399 pNewNextUpper != m_rThis.GetUpper() &&
2407 pNewUpper = pNewNextUpper;
2415 pNewUpper = pColBody;
2421 SwFlowFrame::SetMoveBwdJump(
true );
2436 m_rThis.IsTextFrame() && !IsFollow() )
2438 sal_uInt32 nToPageNum( 0 );
2443 if ( bMoveFwdByObjPos &&
2446 pNewUpper =
nullptr;
2450 else if ( m_rThis.GetDrawObjs() )
2455 if ( pAnchoredObj->RestartLayoutProcess() &&
2456 !pAnchoredObj->IsTmpConsiderWrapInfluence() )
2458 pNewUpper =
nullptr;
2468 if ( pNewUpper && IsFollow() && pNewUpper->
Lower() )
2472 bool bProposedNewUpperContainsOnlyEmptySections(
true );
2477 if ( pLower->IsSctFrame() &&
2480 pLower = pLower->GetNext();
2485 bProposedNewUpperContainsOnlyEmptySections =
false;
2490 if ( !bProposedNewUpperContainsOnlyEmptySections )
2492 if ( SwFlowFrame::IsMoveBwdJump() )
2499 if( pNewUpper == m_rThis.GetUpper() )
2500 pNewUpper =
nullptr;
2503 pNewUpper =
nullptr;
2506 if ( pNewUpper && !ShouldBwdMoved( pNewUpper, rbReformat ) )
2508 if( !pNewUpper->
Lower() )
2524 m_rThis.setFrameAreaPositionValid(
true);
2528 pNewUpper =
nullptr;
2535 if ( pNewUpper && !IsFollow() &&
2536 m_rThis.GetAttrSet()->GetKeep().GetValue() && m_rThis.GetIndNext() )
2556 OSL_ENSURE( !pIndNext ||
dynamic_cast<const SwTextFrame*
>( pIndNext) !=
nullptr,
2557 "<SwFlowFrame::MovedBwd(..)> - incorrect next found." );
2559 SwFlowFrame::CastFlowFrame(pIndNext)->IsJoinLocked() )
2561 pNewUpper =
nullptr;
2569 if ( pNewUpper && !IsFollow() &&
2570 pNewUpper != m_rThis.GetUpper() &&
2572 *
this, *pNewUpper ) )
2575 ( !m_rThis.IsSctFrame() && m_rThis.IsInSct() )
2580 OSL_ENSURE( pNextNewUpper,
"<SwFlowFrame::MoveBwd(..)> - missing next new upper" );
2581 if ( pNextNewUpper &&
2582 ( pNextNewUpper == m_rThis.GetUpper() ||
2583 pNextNewUpper->
GetType() != m_rThis.GetUpper()->GetType() ) )
2591 pNewUpper =
nullptr;
2592 OSL_FAIL(
"<SwFlowFrame::MoveBwd(..)> - layout loop control for layout action <Move Backward> applied!" );
2596 OSL_ENSURE( pNewUpper != m_rThis.GetUpper(),
2597 "<SwFlowFrame::MoveBwd(..)> - moving backward to the current upper frame!?" );
2605 pNew->
Paste( pNewUpper );
2629 pSct->
Paste( pNewUpper );
2636 bool bUnlock =
false;
2637 bool bFollow =
false;
2645 bFollow = pSect->HasFollow();
2649 auto const pOld = m_rThis.
GetUpper();
2650 ::std::optional<SwFrameDeleteGuard> g;
2651 if (m_rThis.GetUpper()->IsCellFrame())
2654 SwTabFrame const*
const pTabFrame(m_rThis.FindTabFrame());
2655 if ( pTabFrame->IsFollow()
2657 && pTabFrame->GetFirstNonHeadlineRow() == m_rThis.GetUpper()->GetUpper())
2660 g.emplace(m_rThis.GetUpper()->GetUpper());
2661 assert(m_rThis.GetUpper()->GetUpper()->IsDeleteForbidden());
2664 pNewUpper->
Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
2665 SAL_WARN_IF(pOld != m_rThis.GetUpper(),
"sw.core",
2666 "MoveBwd(): pNewUpper->Calc() moved this frame?");
2673 bool bFormatSect(
false );
2677 if( pSect->HasFollow() != bFollow )
2681 if ( pSect == pNewUpper )
2686 m_rThis.Paste( pNewUpper );
2689 pSect->
Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
2692 if( pNewPage != pOldPage )
2695 SwViewShell *pSh = m_rThis.getRootFrame()->GetCurrShell();
2707 if ( bCheckPageDescs && pNewPage->
GetNext() )
2709 SwPageFrame* pStartPage = bCheckPageDescOfNextPage ?
2714 else if (m_rThis.GetPageDescItem().GetPageDesc())
2723 return pNewUpper !=
nullptr;
2726SwFlowFrame *SwFlowFrame::CastFlowFrame(
SwFrame *pFrame )
2737const SwFlowFrame *SwFlowFrame::CastFlowFrame(
const SwFrame *pFrame )
2742 return static_cast<const SwTabFrame*
>(pFrame);
@ TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK
@ HEADER_SPACING_BELOW_LAST_PARA
@ PARA_SPACE_MAX_AT_PAGES
@ ADD_PARA_SPACING_TO_TABLE_CELLS
@ ADD_PARA_LINE_SPACING_TO_TABLE_CELLS
virtual bool IsVisibleLayerId(SdrLayerID _nLayerId) const =0
method to determine, if a layer ID belongs to the visible ones.
virtual void SetNewFieldLst(bool bFlag)=0
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual SdrLayerID GetLayer() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
const SwLayoutFrame * GetVertPosOrientFrame() const
virtual SwFrameFormat & GetFrameFormat()=0
virtual const SwFlyFrame * DynCastFlyFrame() const
const SdrObject * GetDrawObj() const
virtual SwRect GetObjRect() const =0
const SvxFormatBreakItem & GetBreak(bool=true) const
const SwDoc * GetDoc() const
const SwFormatPageDesc & GetPageDesc(bool=true) const
const SvxFormatKeepItem & GetKeep(bool=true) const
Container of body content (i.e.
const SvxULSpaceItem & GetULSpace() const
sal_uInt16 GetTopLine(const SwFrame &_rFrame, const SwFrame *_pPrevFrame=nullptr) const
sal_uInt16 GetBottomLine(const SwFrame &_rFrame) const
sal_uInt16 CalcBottomLine() const
sal_uInt16 CalcLineSpacing() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
const SwContentFrame * GetFollow() const
SwContentFrame * GetNextContentFrame() const
SwTextFrame * FindMaster() const
SwFormatColl * GetFormatColl() const
const SwLineNumberInfo & GetLineNumberInfo() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SwPageDesc * GetPageDesc()
const ::std::optional< sal_uInt16 > & GetNumOffset() const
const SwRect & getFrameArea() const
bool isFrameAreaPositionValid() const
bool isFrameAreaSizeValid() const
Base class of the Writer layout elements.
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
SwLayoutFrame * GetPrevLeaf()
Returns the previous layout leaf where we can move the frame.
bool IsFootnoteContFrame() const
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
SwFrame * GetIndPrev() const
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
SwFlyFrame * FindFlyFrame()
SwSectionFrame * FindSctFrame()
SwTabFrame * FindTabFrame()
SwLayoutFrame * GetNextSctLeaf(MakePageType eMakePage)
Returns the next layout sheet where the frame can be moved in.
bool IsColumnFrame() const
SwLayoutFrame * GetNextFlyLeaf(MakePageType eMakePage)
SwFrameType GetType() const
bool IsInFootnote() const
bool IsHeaderFrame() const
SwPageFrame * InsertPage(SwPageFrame *pSibling, bool bFootnote)
virtual void Calc(vcl::RenderContext *pRenderContext) const
const SwSortedObjs * GetDrawObjs() const
SwLayoutFrame * GetPrevFlyLeaf()
static SwCache & GetCache()
static void CheckPageDescs(SwPageFrame *pStart, bool bNotifyFields=true, SwPageFrame **ppPrev=nullptr)
Check all pages (starting from the given one) if they use the appropriate frame format.
virtual bool IsDeleteForbidden() const
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
bool WrongPageDesc(SwPageFrame *pNew)
SwLayoutFrame * GetNextCellLeaf()
bool IsFooterFrame() const
SwLayoutFrame * GetPrevFootnoteLeaf(MakePageType eMakeFootnote)
Get the preceding layout leaf in that the frame can be moved.
bool IsFootnoteFrame() const
SwLayoutFrame * GetUpper()
const SwLayoutFrame * GetNextLayoutLeaf() const
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
SwLayoutFrame * GetNextFootnoteLeaf(MakePageType eMakePage)
Return the next layout leaf in that the frame can be moved.
SwLayoutFrame * GetNextLeaf(MakePageType eMakePage)
Returns the next layout leaf in which we can move the frame.
SwRootFrame * getRootFrame()
virtual const SvxFormatBreakItem & GetBreakItem() const
bool IsContentFrame() const
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
const SwLayoutFrame * GetPrevLayoutLeaf() const
SwPageFrame * FindPageFrame()
SwFootnoteFrame * FindFootnoteFrame()
virtual const SwFormatPageDesc & GetPageDescItem() const
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
sal_uInt16 GetPhyPageNum() const
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
bool IsLayoutFrame() const
SwLayoutFrame * GetPrevSctLeaf()
Returns the preceding layout sheet where the frame can be moved into.
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm....
SwLayoutFrame * GetPrevCellLeaf()
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
bool IsAnLower(const SwFrame *) const
virtual const SwFrameFormat * GetFormat() const
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
bool IsBefore(const SwLayoutFrame *_pCheckRefLayFrame) const
method to check relative position of layout frame to a given layout frame.
const SwFrame * GetLastLower() const
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
bool MoveLowerFootnotes(SwContentFrame *pStart, SwFootnoteBossFrame *pOldBoss, SwFootnoteBossFrame *pNewBoss, const bool bFootnoteNums)
Moving the Footnotes of all Lowers - starting from StartContent.
const SwFrame * Lower() const
virtual void Cut() override
static bool FrameMovedFwdByObjPos(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame, sal_uInt32 &_ornToPageNum)
static bool MoveBwdSuppressed(const SwDoc &p_rDoc, const SwFlowFrame &p_rFlowFrame, const SwLayoutFrame &p_rNewUpperFrame)
bool IsRestartEachPage() const
const SwContentNode * GetNode() const
Base class of the Writer document model elements.
SwNodeOffset GetIndex() const
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page.
const SwPageDesc * GetFollow() const
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
A page of the document layout.
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
void InvalidateWordCount() const
void InvalidateAutoCompleteWords() const
sal_uInt16 GetPhyPageNum() const
const SwSortedObjs * GetSortedObjs() const
void InvalidateSmartTags() const
SwContentFrame * FindFirstBodyContent()
void InvalidateSpelling() const
SwPageDesc * FindPageDesc()
bool IsFootnotePage() const
Foot note interface.
SwPageDesc * GetPageDesc()
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
SwViewShell * GetCurrShell() const
const SwPageFrame * GetLastPage() const
void DelEmpty(bool bRemove)
bool IsContentLocked() const
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
void SetContentLock(bool bNew)
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
SwSectionFrame * FindMaster() const
const SwSectionFrame * GetFollow() const
SwSectionFormat * GetFormat()
class for collecting anchored objects
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
const SwTabFrame * GetFollow() const
const SwTable * GetTable() const
bool HasFollowFlowLine() const
const SwFormatFootnote & GetFootnote() const
Represents the style of a paragraph.
Represents the visualization of a paragraph.
bool IsEmptyMaster() const
If there's a Follow and we don't contain text ourselves.
bool IsHiddenNow() const
Hidden.
SwTextNode const * GetTextNodeForParaProps() const
bool getBrowseMode() const
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
SwLayAction & GetLayAction()
vcl::RenderContext * GetOut() const
const SwViewOption * GetViewOptions() const
#define PROTOCOL_ENTER(pFrame, nFunc, nAct, pPar)
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
static bool lcl_getContextualSpacing(const SwFrame *pPrevFrame)
static bool lcl_IdenticalStyles(const SwFrame *pPrevFrame, const SwFrame *pFrame)
Compare styles attached to these text frames.
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
bool IsRightPageByNumber(SwRootFrame const &rLayout, sal_uInt16 nPageNum)
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
SwTextGridItem const * GetGridItem(SwPageFrame const *const)