20#include <config_wasm_strip.h>
41#include <osl/diagnose.h>
58 ~SwPosNotify() COVERITY_NOEXCEPT_FALSE;
60 Point const & LastObjPos() const;
66 mpAnchoredDrawObj( _pAnchoredDrawObj )
68 maOldObjRect = mpAnchoredDrawObj->
GetObjRect();
73SwPosNotify::~SwPosNotify() COVERITY_NOEXCEPT_FALSE
75 if ( maOldObjRect != mpAnchoredDrawObj->
GetObjRect() )
77 if( maOldObjRect.
HasArea() && mpOldPageFrame )
83 if( aNewObjRect.HasArea() )
129#if !ENABLE_WASM_STRIP_ACCESSIBILITY
133 nullptr, mpAnchoredDrawObj->
GetDrawObj(), maOldObjRect);
139Point const & SwPosNotify::LastObjPos()
const
141 return maOldObjRect.
Pos();
148class SwObjPosOscillationControl
153 std::vector<Point> maObjPositions;
158 bool OscillationDetected();
163SwObjPosOscillationControl::SwObjPosOscillationControl(
165 : mpAnchoredDrawObj( &_rAnchoredDrawObj )
169bool SwObjPosOscillationControl::OscillationDetected()
171 bool bOscillationDetected =
false;
173 if ( maObjPositions.size() == 20 )
176 bOscillationDetected =
true;
181 for (
auto const & pt : maObjPositions )
183 if ( aNewObjPos == pt )
186 bOscillationDetected =
true;
190 if ( !bOscillationDetected )
192 maObjPositions.push_back( aNewObjPos );
196 return bOscillationDetected;
202 mbNotYetAttachedToAnchorFrame( true ),
204 mbNotYetPositioned( true ),
206 mbCaptureAfterLayoutDirChange( false )
233 bool bOutsidePage(
false );
263 OSL_FAIL(
"<SwAnchoredDrawObject::MakeObjPos() - drawing object not yet attached to anchor frame -> no positioning" );
304 case RndStdIds::FLY_AS_CHAR:
312 case RndStdIds::FLY_AT_PARA:
313 case RndStdIds::FLY_AT_CHAR:
320 case RndStdIds::FLY_AT_PAGE:
321 case RndStdIds::FLY_AT_FLY:
330 assert(!
"<SwAnchoredDrawObject::MakeObjPos()> - unknown anchor type.");
356 if ( aObjRect.
Right() >= aPageRect.
Right() + 10 )
363 if ( aObjRect.
Left() + 10 <= aPageRect.
Left() )
400 bool bFormatAnchorOnce = !bJoinLocked && bAddVerticalFlyOffsets;
402 if (bFormatAnchor || bFormatAnchorOnce)
408 bool bOscillationDetected =
false;
409 SwObjPosOscillationControl aObjPosOscCtrl( *
this );
413 bool bConsiderWrapInfluenceDueToOverlapPrevCol(
false );
421 SwPosNotify aPosNotify(
this );
435 bOscillationDetected = aObjPosOscCtrl.OscillationDetected();
451 bConsiderWrapInfluenceDueToOverlapPrevCol =
true;
453 }
while ( !
mbValidPos && !bOscillationDetected &&
454 !bConsiderWrapInfluenceDueToOverlapPrevCol );
459 if ( bOscillationDetected || bConsiderWrapInfluenceDueToOverlapPrevCol )
477 SwPosNotify aPosNotify(
this );
490 const Point aNewAnchorPos =
508 Point aNewAnchorPos =
511 if ( aNewAnchorPos != aCurrAnchorPos )
514 Size aMove( aCurrAnchorPos.
getX() - aNewAnchorPos.
getX(),
515 aCurrAnchorPos.
getY() - aNewAnchorPos.
getY() );
522 GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() &&
523 GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor())
546 if (
GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR )
586 (
GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
601 if ( pPageFrameRegisteredAt &&
602 pPageFrameRegisteredAt != pPageFrame )
610 if ( pPageFrameOfAnchor &&
611 pPageFrameOfAnchor != pPageFrame &&
612 pPageFrameOfAnchor != pPageFrameRegisteredAt )
649 if (nPageNum % 2 == (isOutside ? 0 : 1))
669 if (
GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME)
675 else if (
GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT)
680 nWidth = getInsideOutsideRelativeWidth(
true,
GetPageFrame());
685 else if (
GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_RIGHT)
689 nWidth = getInsideOutsideRelativeWidth(
false,
GetPageFrame());
720 else if (
GetDrawObj()->GetRelativeHeightRelation() == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
726 aFooterRect = pFooterFrame->GetPaintArea();
734 if ( nTargetWidth != aCurrObjRect.
GetWidth( ) || nTargetHeight != aCurrObjRect.
GetHeight( ) )
750 uno::Reference<drawing::XShape> xShape(
pObject->getUnoShape(), uno::UNO_QUERY);
783 const SwRect* _pNewObjRect )
790 const bool bVert = _pNewAnchorFrame->
IsVertical();
794 nHoriRelPos = aObjRect.
Top() - aAnchorPos.
Y();
795 nVertRelPos = aAnchorPos.
X() - aObjRect.
Right();
799 nHoriRelPos = aAnchorPos.
X() - aObjRect.
Right();
800 nVertRelPos = aObjRect.
Top() - aAnchorPos.
Y();
804 nHoriRelPos = aObjRect.
Left() - aAnchorPos.
X();
805 nVertRelPos = aObjRect.
Top() - aAnchorPos.
Y();
857 text::PositionLayoutDir::PositionInHoriL2R )
860 switch ( eLayoutDir )
869 nHoriPos = -aObjRect.
Left() - aObjRect.
Width();
874 nHoriPos = aObjRect.
Top();
875 nVertPos = -aObjRect.
Left() - aObjRect.
Width();
880 assert(!
"<SwAnchoredDrawObject::SetPositioningAttr()> - unsupported layout direction");
889 if (nHoriPos != aHori.
GetPos()) {
896 if (nVertPos != aVert.
GetPos()) {
904 text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
@ ADD_VERTICAL_FLY_OFFSETS
@ DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
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...
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void SetEnableSetModified(bool bEnableSetModified)=0
virtual bool IsEnableSetModified() const =0
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
virtual bool IsAutoGrowHeight() const override
virtual void SetAnchorPos(const Point &rPnt)
const Point & GetAnchorPos() const
const double * GetRelativeHeight() const
virtual void Move(const Size &rSiz)
virtual const tools::Rectangle & GetCurrentBoundRect() const
const double * GetRelativeWidth() const
sal_Int16 GetRelativeHeightRelation() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
class for the positioning of drawing objects
void MakeObjPosAnchoredAtLayout()
method for the intrinsic positioning of an at-page|at-frame anchored drawing object
virtual SwFrameFormat & GetFrameFormat() override
bool mbCaptureAfterLayoutDirChange
virtual bool SetObjTop_(const SwTwips _nTop) override
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint) override
method to notify background of drawing object
virtual ~SwAnchoredDrawObject() override
virtual void UpdateLayoutDir() override
method update layout direction the layout direction, the anchored object is assigned to
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
bool NotYetPositioned() const
virtual bool SetObjLeft_(const SwTwips _nLeft) override
bool IsOutsidePage() const
std::optional< tools::Rectangle > maLastObjRect
void SetLastObjRect(const tools::Rectangle &_rNewObjRect)
void SetDrawObjAnchor()
method to set internal anchor position of <SdrObject> instance of the drawing object
virtual SwRect GetObjRect() const override
void SetPositioningAttr()
method to set positioning attributes (not for as-character anchored)
virtual void InvalidateObjPos() override
method to invalidate position of the anchored object
void AdjustPositioningAttr(const SwFrame *_pNewAnchorFrame, const SwRect *_pNewObjRect=nullptr)
adjust positioning and alignment attributes for new anchor frame
void MakeObjPosAnchoredAtPara()
method for the intrinsic positioning of an at-paragraph|at-character anchored drawing object
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
virtual void RegisterAtPage(SwPageFrame &) override
virtual void ObjectAttachedToAnchorFrame() override
method to indicate, that anchored object is attached to an anchor frame
virtual SwRect GetObjBoundRect() const override
void InvalidatePage_(SwPageFrame *_pPageFrame)
method to invalidate the given page frame
bool mbNotYetAttachedToAnchorFrame
const SwFrame * GetAnchorFrame() const
bool ConsiderForTextWrap() const
void SetObjTop(const SwTwips _nTop)
bool InvalidationOfPosAllowed() const
method to determine, if invalidation of position is allowed
virtual void ObjectAttachedToAnchorFrame()
method to indicate, that anchored object is attached to an anchor frame
void SetVertPosOrientFrame(const SwLayoutFrame &_rVertPosOrientFrame)
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
const SwLayoutFrame * GetVertPosOrientFrame() const
void SetTmpConsiderWrapInfluence(const bool _bTmpConsiderWrapInfluence)
void SetCurrRelPos(Point _aRelPos)
void SetObjLeft(const SwTwips _nLeft)
bool OverlapsPrevColumn() const
method to determine, if the anchored object is overlapping with a previous column
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
SwPageFrame * GetPageFrame()
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is.
void SetConsiderForTextWrap(const bool _bConsiderForTextWrap)
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
virtual void UpdateLayoutDir()
method update layout direction the layout direction, the anchored object is assigned to
void InvalidateObjRectWithSpaces() const
bool ConsiderObjWrapInfluenceOfOtherObjs() const
method to determine, if other anchored objects, also attached at to the anchor frame,...
const SdrObject * GetDrawObj() const
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
bool IsPositioningInProgress() const
is positioning of anchored object in progress
const Point & GetCurrRelPos() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
IDocumentState const & getIDocumentState() const
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object.
const SwRect & getFrameArea() const
const SwRect & getFramePrintArea() const
Base class of the Writer layout elements.
SwRect GetPaintArea() const
|* The paintarea is the area, in which the content of a frame is allowed |* to be displayed.
tools::Long GetLeftMargin() const
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
tools::Long GetRightMargin() const
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool IsRightToLeft() const
SwLayoutFrame * GetUpper()
tools::Long GetBottomMargin() const
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
SwRootFrame * getRootFrame()
SwPageFrame * FindPageFrame()
tools::Long GetTopMargin() const
virtual const SwFrameFormat * GetFormat() const
Helper class for notify that positioning of an anchored object is in progress.
A page of the document layout.
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
sal_uInt16 GetPhyPageNum() const
void InvalidateFlyInCnt() const
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
const SwFooterFrame * GetFooterFrame() const
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
const SwHeaderFrame * GetHeaderFrame() const
SwRect GetBoundRect(OutputDevice const *pOutputDevice) const
Point GetPos(const SwRect &rRect) const
Of course Writer needs its own rectangles.
SwRect & Intersection(const SwRect &rRect)
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Pos(const Point &rNew)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
The root element of a Writer document layout.
SwViewShell * GetCurrShell() const
const SwContentFrame * GetTurbo() const
bool IsAnyShellAccessible() const
void DisallowTurbo() const
static void syncProperty(SwFrameFormat *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any &rValue, SdrObject *pObj=nullptr)
Sync property of TextBox with the one of the shape.
static bool changeAnchor(SwFrameFormat *pShape, SdrObject *pObj)
Sets the anchor of the associated textframe of the given shape, and returns true on success.
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
Represents the visualization of a paragraph.
TextFrameIndex CalcFlyPos(SwFrameFormat const *pSearch)
Calculates the position of FlyInContentFrames.
void MoveAccessible(const SwFrame *pFrame, const SdrObject *pObj, const SwRect &rOldFrame)
Move a frame's position in the accessible view.
virtual void CalcPosition() override
calculate position of object
const SwLayoutFrame & GetVertPosOrientFrame() const
frame, at which the vertical position is oriented at
const Point & GetRelPos() const
calculated relative position for object
virtual void CalcPosition() override
calculate position for object
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
EmbeddedObjectRef * pObject
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
constexpr sal_Int32 COMPLETE_STRING
@ FlyFrameAttributesChanged
void ClrContourCache(const SdrObject *pObj)