33 #include <osl/diagnose.h>
41 mpAnchoredObj( nullptr ),
43 mbOldObjPositioningInProgress(
false )
51 mpAnchoredObj( &_rAnchoredObj ),
53 mbOldObjPositioningInProgress(
false )
74 mpPageFrame( nullptr ),
76 mpVertPosOrientFrame( nullptr ),
78 mbPositioningInProgress(
false ),
79 mbConsiderForTextWrap(
false ),
80 mbPositionLocked(
false ),
82 mbKeepPositionLockedForSection(
false ),
83 mbRestartLayoutProcess(
false ),
85 mbClearedEnvironment(
false ),
87 mbTmpConsiderWrapInfluence(
false ),
88 mbObjRectWithSpacesValid(
false )
133 if ( !pAnchorFrameContainingAnchPos )
138 return pAnchorFrameContainingAnchPos;
212 const bool _bCheckForParaPorInf )
219 if ( !((rAnch.
GetAnchorId() == RndStdIds::FLY_AT_CHAR) &&
231 if ( !_bCheckForParaPorInf || aAnchorCharFrame.
HasPara() )
275 ( eVertRelOrient == text::RelOrientation::CHAR &&
278 ( ( ( eVertRelOrient == text::RelOrientation::FRAME ) ||
279 ( eVertRelOrient == text::RelOrientation::PRINT_AREA ) ||
280 ( eVertRelOrient == text::RelOrientation::PAGE_FRAME ) ||
281 ( eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) ) &&
365 const bool bVert = pAnchorFrame->
IsVertical();
425 if ( ((rAnchor.
GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
426 (rAnchor.
GetAnchorId() == RndStdIds::FLY_AT_PARA)) &&
449 if ( pObjs->
size() > 1 )
453 if ( pAnchoredObj !=
this &&
454 pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
519 bool bHasClearedEnvironment(
false );
523 "<SwAnchoredObject::HasClearedEnvironment()> - layout frame missing, at which the vertical position is oriented at." );
527 static_cast<const SwTextFrame*>(
GetAnchorFrame())->FindPageFrame()->GetPhyPageNum() >=
537 bHasClearedEnvironment =
true;
546 bHasClearedEnvironment =
true;
551 return bHasClearedEnvironment;
564 OSL_FAIL(
"<SwAnchoredObject::GetObjRectWithSpaces> - cache for object rectangle inclusive spaces marked as valid, but it couldn't be. Missing invalidation of cache." );
590 const bool bTopChanged(
SetObjTop_( _nTop ) );
626 for(
auto it = pObjs->
begin(); it != pObjs->
end(); ++it)
654 if (
GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
692 return pRetPageFrame;
712 if ((rAnch.
GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
721 return pAnchorCharFrame;
737 OSL_ASSERT(pFrameFormat);
739 const bool bIsWrapThrough = pFrameFormat->
GetSurround().
GetSurround() == text::WrapTextMode::WrapTextMode_THROUGH;
741 return bDisablePositioning && bIsWrapThrough;
767 if ( pObjs->
size() > 1 )
771 if ( pAnchoredObj !=
this )
773 pAnchoredObj->SetTmpConsiderWrapInfluence(
true );
790 bool bOverlapsPrevColumn(
false );
795 if ( pColFrame && pColFrame->
GetPrev() )
799 while ( pTmpColFrame )
802 pTmpColFrame = pTmpColFrame->
GetPrev();
808 return bOverlapsPrevColumn;
840 bool& _obRelToTableCell )
const
843 _obRelToTableCell =
false;
851 const SwFrame* pFrame(
nullptr );
867 _obRelToTableCell =
true;
SwRect maObjRectWithSpaces
void CheckCharRectAndTopOfLine(const bool _bCheckForParaPorInf)
check anchor character rectangle and top of line
Base class of the Writer layout elements.
const SwRect & GetLastCharRect() const
Represents the visualization of a paragraph.
virtual SwRect GetObjRect() const =0
bool OverlapsPrevColumn() const
method to determine, if the anchored object is overlapping with a previous column ...
const SwSortedObjs * GetDrawObjs() const
void SetClearedEnvironment(const bool _bClearedEnvironment)
SwRect & Union(const SwRect &rRect)
const SwLayoutFrame * mpVertPosOrientFrame
sal_uInt16 GetLower() const
~SwObjPositioningInProgress()
bool mbTmpConsiderWrapInfluence
void Left(const tools::Long nLeft)
virtual bool SetObjTop_(const SwTwips _nTop)=0
virtual void UpdateLayoutDir()
method update layout direction the layout direction, the anchored object is assigned to ...
bool ClearedEnvironment() const
tools::Long GetRight() const
const SwRect & getFramePrintArea() const
void SetConsiderForTextWrap(const bool _bConsiderForTextWrap)
void ChgAnchorFrame(SwFrame *_pNewAnchorFrame)
void Update(SwAnchoredObject &_rAnchoredObj)
method to update the position of the given anchored object in the sorted list
void AddLastCharY(tools::Long nDiff)
bool mbObjRectWithSpacesValid
void Pos(const Point &rNew)
void SetTmpConsiderWrapInfluenceOfOtherObjs()
method to apply temporary consideration of wrapping style influence to the anchored objects...
Of course Writer needs its own rectangles.
Point GetRelPosToChar() const
method to determine position of anchored object relative to anchor character
void ClearCharRectAndTopOfLine()
reset members and
static void InsertObjForTmpConsiderWrapInfluence(const SwDoc &_rDoc, SwAnchoredObject &_rAnchoredObj)
virtual SwRect GetObjBoundRect() const =0
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
tools::Long GetTop(const SwRect &rRect) const
void InvalidateObjPosForConsiderWrapInfluence()
method to perform necessary invalidations for the positioning of objects, for whose the wrapping styl...
SwTextFrame * FindAnchorCharFrame()
get frame, which contains the anchor character, if the object is anchored at-character or as-characte...
void SetDrawObj(SdrObject &_rDrawObj)
wrapper class for the positioning of Writer fly frames and drawing objects
virtual bool IsVisibleLayerId(SdrLayerID _nLayerId) const =0
method to determine, if a layer ID belongs to the visible ones.
void SetCurrRelPos(Point _aRelPos)
const SwRect & getFrameArea() const
SwTwips GetRelCharX(const SwFrame *pFrame) const
Point GetRelPosToPageFrame(const bool _bFollowTextFlow, bool &_obRelToTableCell) const
method to determine position of anchored object relative to page frame
void SetTmpConsiderWrapInfluence(const bool _bTmpConsiderWrapInfluence)
static void RemoveObjForTmpConsiderWrapInfluence(const SwDoc &_rDoc, SwAnchoredObject &_rAnchoredObj)
virtual void ObjectAttachedToAnchorFrame()
method to indicate, that anchored object is attached to an anchor frame
tools::Long GetLeft(const SwRect &rRect) const
static bool IsDraggingOffPageAllowed(const SwFrameFormat *)
method to determine if dragging objects off page is allowed
SwAnchoredObject * mpAnchoredObj
virtual bool SetObjLeft_(const SwTwips _nLeft)=0
SwTextFrame * GetFollow()
TextFrameIndex GetOffset() const
void SetObjTop(const SwTwips _nTop)
bool ConsiderForTextWrap() const
bool mbRestartLayoutProcess
SwObjPositioningInProgress(SdrObject &_rSdrObj)
void CheckCharRect(const SwFormatAnchor &_rAnch, const SwTextFrame &_rAnchorCharFrame)
check anchor character rectangle
Point GetRelPosToLine() const
method to determine position of anchored object relative to top of line
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
const SdrObject * GetDrawObj() const
void CheckTopOfLine(const SwFormatAnchor &_rAnch, const SwTextFrame &_rAnchorCharFrame)
check top of line
const SwSortedObjs * GetSortedObjs() const
SwPageFrame * FindPageFrame()
const SwFrame * Lower() const
tools::Long GetHeight(const SwRect &rRect) const
tools::Long GetLeft() const
bool IsTmpConsiderWrapInfluence() const
virtual const SwFlyFrame * DynCastFlyFrame() const
SwLayoutFrame * GetUpper()
SwTextFrame & GetFrameAtOfst(TextFrameIndex nOfst)
void AddHeight(const tools::Long nAdd)
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
void UpdateObjInSortedList()
method to update anchored object in the lists
bool IsUndersized() const
void ClearVertPosOrientFrame()
bool mbClearedEnvironment
SwPageFrame * mpPageFrame
void AddWidth(const tools::Long nAdd)
bool GetTopOfLine(SwTwips &_onTopOfLine, const SwPosition &_rPos) const
Determine top of line for given position in the text frame.
bool mbOldObjPositioningInProgress
virtual void InvalidateObjPos()=0
method to invalidate position of the anchored object
A page of the document layout.
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
bool RestartLayoutProcess() const
bool GetAutoPos(SwRect &, const SwPosition &) const
A slimmer version of GetCharRect for autopositioning Frames.
bool IsLayoutFrame() const
void Bottom(const tools::Long nBottom)
const SwLayoutFrame * GetVertPosOrientFrame() const
virtual bool IsFormatPossible() const
method to determine, if a format on the anchored object is possible
void SetPositioningInProgress(const bool _bPosInProgress)
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
general base class for all free-flowing frames
bool InvalidationOfPosAllowed() const
method to determine, if invalidation of position is allowed
virtual SwFrameFormat & GetFrameFormat()=0
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is...
SwPageFrame * GetPageFrame()
bool HasClearedEnvironment() const
method to determine, if due to anchored object size and wrapping style, its layout environment is cle...
void SetPageFrame(SwPageFrame *_pNewPageFrame)
Point GetRelPosToAnchorFrame() const
method to determine position of anchored object relative to anchor frame
void ClearTmpConsiderWrapInfluence()
SwTwips GetLastTopOfLine() const
bool IsRightToLeft() const
void Top(const tools::Long nTop)
const_iterator begin() const
void InvalidateObjRectWithSpaces() const
bool ConsiderObjWrapInfluenceOfOtherObjs() const
method to determine, if other anchored objects, also attached at to the anchor frame, have to consider its wrap influence.
virtual void RegisterAtCorrectPage()=0
method to assure that anchored object is registered at the correct page frame
size_t ListPosOf(const SwAnchoredObject &_rAnchoredObj) const
Position of object <_rAnchoredObj> in sorted list.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void SetObjLeft(const SwTwips _nLeft)
SwTwips GetRelCharY(const SwFrame *pFrame) const
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
const_iterator end() const
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
void SetVertPosOrientFrame(const SwLayoutFrame &_rVertPosOrientFrame)
bool PositionLocked() const
bool IsPositioningInProgress() const
is positioning of anchored object in progress
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
void ResetLastCharRectHeight()
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
void Height(tools::Long nNew)
bool Overlaps(const SwRect &rRect) const
bool mbConsiderForTextWrap
sal_uInt16 GetUpper() const
void AddLastTopOfLineY(SwTwips _nDiff)
bool m_bDetectedRangeSegmentation false
virtual ~SwAnchoredObject()
SwFrame * mpAnchorFrame
Frame the object is anchored at.