36 #include <osl/diagnose.h>
43 class SwForbidFollowFormat
47 const bool bOldFollowFormatAllowed;
50 explicit SwForbidFollowFormat(
SwTextFrame& _rTextFrame )
51 : mrTextFrame( _rTextFrame ),
52 bOldFollowFormatAllowed( _rTextFrame.FollowFormatAllowed() )
57 ~SwForbidFollowFormat()
59 if ( bOldFollowFormatAllowed )
73 mrAnchorTextFrame( _rAnchorTextFrame ),
74 mpMasterAnchorTextFrame( _pMasterAnchorTextFrame )
87 std::unique_ptr<SwObjectFormatterTextFrame> pObjFormatter;
93 pMasterOfAnchorFrame = _rAnchorTextFrame.
FindMaster();
94 while ( pMasterOfAnchorFrame && pMasterOfAnchorFrame->
IsFollow() )
96 pMasterOfAnchorFrame = pMasterOfAnchorFrame->
FindMaster();
103 ( pMasterOfAnchorFrame && pMasterOfAnchorFrame->
GetDrawObjs() ) )
107 pMasterOfAnchorFrame, _pLayAction ));
110 return pObjFormatter;
120 const bool _bCheckForMovedFwd )
129 bool bSuccess(
true );
149 const bool bRestart =
172 ( _bCheckForMovedFwd ||
175 GetWrapInfluenceOnObjPos(
true ) ==
177 text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ) )
197 bool bInsert(
true );
198 sal_uInt32 nToPageNum( 0 );
203 if ( nToPageNum < pAnchorPageFrame->GetPhyPageNum() )
219 OSL_FAIL(
"<SwObjectFormatterTextFrame::DoFormatObj(..)> - anchor frame not marked to move forward" );
228 OSL_ENSURE( nIdx > 0,
229 "<SwObjectFormatterTextFrame::DoFormatObj(..)> - anchored object not collected!?" );
232 sal_uInt32 nToPageNum( 0 );
234 bool bDummy(
false );
239 nToPageNum, bDummy ) )
243 bool bInsert(
true );
244 sal_uInt32 nMovedFwdToPageNum( 0 );
249 if ( nMovedFwdToPageNum < nToPageNum )
275 OSL_FAIL(
"<SwObjectFormatterTextFrame::DoFormatObj(..)> - anchor frame not marked to move forward" );
309 OSL_FAIL(
"<SwObjectFormatterTextFrame::DoFormatObjs()> called for invalidate anchor text frame." );
315 bool bSuccess(
true );
325 "SwObjectFormatterTextFrame::DoFormatObjs() - missing 'master' anchor text frame" );
358 sal_uInt32 nToPageNum( 0 );
360 bool bInFollow(
false );
366 text::WrapInfluenceOnPosition::ONCE_CONCURRENT,
367 nToPageNum, bInFollow );
381 bool bInsert(
true );
382 sal_uInt32 nTmpToPageNum( 0 );
387 if ( nTmpToPageNum < pAnchorPageFrame->GetPhyPageNum() )
403 OSL_FAIL(
"<SwObjectFormatterTextFrame::DoFormatObjs(..)> - anchor frame not marked to move forward" );
407 else if ( pObj && bDoesAnchorHadPrev )
413 bool bInsert(
true );
414 sal_uInt32 nMovedFwdToPageNum( 0 );
419 if ( nMovedFwdToPageNum < nToPageNum )
444 OSL_FAIL(
"<SwObjectFormatterTextFrame::DoFormatObjs(..)> - anchor frame not marked to move forward" );
469 GetWrapInfluenceOnObjPos(
true ) !=
471 text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
486 GetWrapInfluenceOnObjPos(
true ) ==
488 text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
503 for (
size_t i = pObjs->
ListPosOf( _rAnchoredObj ) + 1;
i < pObjs->
size(); ++
i )
512 const sal_Int16 _nWrapInfluenceOnPosition,
513 sal_uInt32& _noToPageNum,
517 OSL_ENSURE( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
518 _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT,
519 "<SwObjectFormatterTextFrame::GetFirstObjWithMovedFwdAnchor(..)> - invalid value for parameter <_nWrapInfluenceOnPosition>" );
530 GetWrapInfluenceOnObjPos(
true ) == _nWrapInfluenceOnPosition )
538 _noToPageNum, _boInFollow ) )
540 pRetAnchoredObj = pAnchoredObj;
546 return pRetAnchoredObj;
553 const sal_uInt32 _nFromPageNum,
554 const bool _bAnchoredAtMasterBeforeFormatAnchor,
555 sal_uInt32& _noToPageNum,
558 bool bAnchorIsMovedForward(
false );
561 if ( pPageFrameOfAnchor )
563 const sal_uInt32 nPageNum = pPageFrameOfAnchor->
GetPhyPageNum();
564 if ( nPageNum > _nFromPageNum )
566 _noToPageNum = nPageNum;
573 if ( _noToPageNum > (_nFromPageNum + 1) )
576 if ( pAnchorFrame->
IsInTab() &&
579 _noToPageNum = _nFromPageNum + 1;
582 bAnchorIsMovedForward =
true;
590 if ( !bAnchorIsMovedForward &&
591 _bAnchoredAtMasterBeforeFormatAnchor &&
597 "<SwObjectFormatterTextFrame::CheckMovedFwdCondition(..) - wrong type of anchor frame>" );
599 bool bCheck(
false );
600 if ( pAnchorTextFrame->IsFollow() )
604 else if( pAnchorTextFrame->IsInTab() )
618 while ( pColFrame && !pColFrame->
GetNext() )
622 if ( !pColFrame || !pColFrame->
GetNext() )
624 _noToPageNum = _nFromPageNum + 1;
625 bAnchorIsMovedForward =
true;
632 return bAnchorIsMovedForward;
646 assert(pFootnote->IsFootnoteFrame());
648 if (!pFootnote->IsDeleteForbidden() && !pFootnote->GetLower() && !pFootnote->IsColLocked() &&
654 pFootnote = pNextNote;
663 SwFrame* pLastLowerFrame =
nullptr )
666 while ( pLowerFrame )
669 if ( pLastLowerFrame && pLowerFrame == pLastLowerFrame )
705 if ( !_rAnchorTextFrame.
IsFollow() )
710 if ( _rAnchorTextFrame.
IsInSct() )
719 pSectFrame = pSectFrame->
GetUpper();
730 while ( pFrame && pFrame != pSectFrame )
740 &_rAnchorTextFrame );
750 if ( pColFrameOfAnchor )
756 while ( pColFrame != pColFrameOfAnchor )
769 pColFrame = pColFrame->
GetNext();
779 if ( _rAnchorTextFrame.
IsInTab() )
781 SwForbidFollowFormat aForbidFollowFormat( _rAnchorTextFrame );
807 if ( pObjs && pObjs->
size() > 1 )
811 if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
vcl::RenderContext * GetOut() const
static bool CheckMovedFwdCondition(SwAnchoredObject &_rAnchoredObj, const sal_uInt32 _nFromPageNum, const bool _bAnchoredAtMasterBeforeFormatAnchor, sal_uInt32 &_noToPageNum, bool &_boInFollow)
method to check the conditions, if 'anchor is moved forward'
virtual bool DoFormatObj(SwAnchoredObject &_rAnchoredObj, const bool _bCheckForMovedFwd=false) override
intrinsic method to format a certain floating screen object
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
const SwSortedObjs * GetDrawObjs() const
void SetClearedEnvironment(const bool _bClearedEnvironment)
SwAnchoredObject * GetFirstObjWithMovedFwdAnchor(const sal_Int16 _nWrapInfluenceOnPosition, sal_uInt32 &_noToPageNum, bool &_boInFollow)
method to determine first anchored object, whose 'anchor is moved forward'.
virtual SwFrame & GetAnchorFrame() override
static std::unique_ptr< SwObjectFormatterTextFrame > CreateObjFormatter(SwTextFrame &_rAnchorTextFrame, const SwPageFrame &_rPageFrame, SwLayAction *_pLayAction)
method to create an instance of is necessary.
bool AtLeastOneObjIsTmpConsiderWrapInfluence()
method to determine if at least one anchored object has state
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool isFrameAreaDefinitionValid() const
sal_uInt16 GetPhyPageNum() const
void InvalidateObjPosForConsiderWrapInfluence()
method to perform necessary invalidations for the positioning of objects, for whose the wrapping styl...
wrapper class for the positioning of Writer fly frames and drawing objects
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void InvalidatePrevObjs(SwAnchoredObject &_rAnchoredObj)
method to invalidate objects, anchored previous to given object at the anchor text frame ...
SwTextFrame * GetFollow()
TextFrameIndex GetOffset() const
SwFrame * GetIndPrev() const
const SwSortedObjs * GetSortedObjs() const
The usage of LayAction is always the same:
SwPageFrame * FindPageFrame()
SwTextFrame * mpMasterAnchorTextFrame
static void RemoveMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame)
SwLayoutFrame * GetUpper()
const SwRowFrame * IsInFollowFlowRow() const
void FormatAnchorFrameForCheckMoveFwd()
method to format the anchor frame for checking of the move forward condition
A page of the document layout.
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
bool RestartLayoutProcess() const
void InvalidateFollowObjs(SwAnchoredObject &_rAnchoredObj)
method to invalidate objects, anchored after the given object at the page frame
bool IsLayoutFrame() const
SwTextFrame & mrAnchorTextFrame
virtual bool IsFormatPossible() const
method to determine, if a format on the anchored object is possible
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
virtual SwFrameFormat & GetFrameFormat()=0
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is...
SwTextFrame * FindMaster() const
SwPageFrame * GetPageFrame()
sal_uInt16 GetPhyPageNum() const
bool HasClearedEnvironment() const
method to determine, if due to anchored object size and wrapping style, its layout environment is cle...
void ForbidFollowFormat()
virtual ~SwObjectFormatterTextFrame() override
size_t ListPosOf(const SwAnchoredObject &_rAnchoredObj) const
Position of object <_rAnchoredObj> in sorted list.
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
static bool FrameMovedFwdByObjPos(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame, sal_uInt32 &_ornToPageNum)
bool IsFootnoteContFrame() const
static void FormatAnchorFrameAndItsPrevs(SwTextFrame &_rAnchorTextFrame)
method to format given anchor text frame and its previous frames
bool PositionLocked() const
SwViewShell * GetCurrShell() const
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
virtual bool DoFormatObjs() override
intrinsic method to format all floating screen objects
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
SwObjectFormatterTextFrame(SwTextFrame &_rAnchorTextFrame, const SwPageFrame &_rPageFrame, SwTextFrame *_pMasterAnchorTextFrame, SwLayAction *_pLayAction)
SwRootFrame * getRootFrame()
static void InsertMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rMovedFwdFrameByObjPos, const sal_uInt32 _nToPageNum)
SwRowFrame is one table row in the document layout.
virtual const SwFrameFormat * GetFormat() const