30#include <osl/diagnose.h>
42 const Point& _rProposedAnchorPos,
46 const SwTwips _nLineAscentInclObjs,
47 const SwTwips _nLineDescentInclObjs )
49 mrProposedAnchorPos( _rProposedAnchorPos ),
51 mnLineAscent( _nLineAscent ),
52 mnLineDescent( _nLineDescent ),
53 mnLineAscentInclObjs( _nLineAscentInclObjs ),
54 mnLineDescentInclObjs( _nLineDescentInclObjs ),
67 "SwAsCharAnchoredObjectPosition::GetAnchorTextFrame() - wrong anchor frame type" );
97 SwTwips nLRSpaceLeft, nLRSpaceRight, nULSpaceUpper, nULSpaceLower;
108 nLRSpaceRight = rULSpace.
GetLower();
109 nULSpaceUpper = rLRSpace.
GetRight();
110 nULSpaceLower = rLRSpace.
GetLeft();
117 nLRSpaceRight = rLRSpace.
GetLeft();
121 nLRSpaceLeft = rLRSpace.
GetLeft();
122 nLRSpaceRight = rLRSpace.
GetRight();
125 nULSpaceUpper = rULSpace.
GetUpper();
126 nULSpaceLower = rULSpace.
GetLower();
134 aAnchorPos.
AdjustX(nLRSpaceLeft );
136 aAnchorPos.
AdjustY(nULSpaceUpper );
157 aObjBoundRect.
AddLeft( - nLRSpaceLeft );
158 aObjBoundRect.
AddWidth( nLRSpaceRight );
159 aObjBoundRect.
AddTop( - nULSpaceUpper );
160 aObjBoundRect.
AddHeight( nULSpaceLower );
165 ? aObjBoundRect.
Width()
193 aRelPos.
setX( -nRelPos - aObjBoundRect.
Width() );
196 aRelPos.
setX( nRelPos );
201 aRelPos.
setY( nRelPos );
217 const_cast<SwFrameFormat&
>(rFrameFormat).SetFormatAttr( aVert );
224 Point aAbsAnchorPos( aAnchorPos );
228 aAbsAnchorPos.
AdjustX( -nObjWidth );
246 aDiff = aRelPos + aAbsAnchorPos - aSnapRect.
TopLeft();
248 aDiff = aRelPos + aAnchorPos - aSnapRect.
TopLeft();
251 aDiff =
Point( -aDiff.
Y(), aDiff.
X() );
263 aAnchorPos.
AdjustX( -nObjWidth );
270 "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong type of anchored object." );
284 aAnchorPos.
AdjustX( -nObjWidth );
289 aRelAttr =
Point( -nRelPos, 0 );
290 aRelPos =
Point( -aRelPos.
Y(), aRelPos.
X() );
293 aRelAttr =
Point( 0, nRelPos );
297 "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong anchored object." );
301 ( aAnchorPos != rFlyInContentFrame.
GetRefPoint() ||
306 pFlyInContentFrame->
SetRefPoint( aAnchorPos, aRelAttr, aRelPos );
318 "SwAnchoredObjectPosition::CalcPosition(..) - fly frame has an invalid height" );
336 const SwTwips _nObjBoundHeight,
346 nRelPosToBase = _rVert.
GetPos();
349 if ( eVertOrient == text::VertOrientation::CENTER )
350 nRelPosToBase -= _nObjBoundHeight / 2;
351 else if ( eVertOrient == text::VertOrientation::TOP )
352 nRelPosToBase -= _nObjBoundHeight;
353 else if ( eVertOrient == text::VertOrientation::BOTTOM )
355 else if ( eVertOrient == text::VertOrientation::CHAR_CENTER )
357 else if ( eVertOrient == text::VertOrientation::CHAR_TOP )
359 else if ( eVertOrient == text::VertOrientation::CHAR_BOTTOM )
368 if ( eVertOrient == text::VertOrientation::LINE_CENTER )
370 else if ( eVertOrient == text::VertOrientation::LINE_TOP )
372 else if ( eVertOrient == text::VertOrientation::LINE_BOTTOM )
375 else if ( eVertOrient == text::VertOrientation::LINE_CENTER )
380 else if ( eVertOrient == text::VertOrientation::LINE_TOP )
385 else if ( eVertOrient == text::VertOrientation::LINE_BOTTOM )
393 return nRelPosToBase;
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual void SetAnchorPos(const Point &rPnt)
virtual void Move(const Size &rSiz)
tools::Long GetRight() const
tools::Long GetLeft() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
class for the positioning of drawing objects
void SetLastObjRect(const tools::Rectangle &_rNewObjRect)
virtual SwRect GetObjRect() const override
virtual SwRect GetObjRect() const =0
const Point & GetCurrRelPos() const
Flys that are anchored as a character in the content.
const Point & GetRefPoint() const
void SetRefPoint(const Point &rPoint, const Point &rRelAttr, const Point &rRelPos)
const SwRect & getFrameArea() const
Helper class which can be used instead of the macros if a function has too many returns.
bool IsRightToLeft() const
tools::Long GetHeight(const SwRect &rRect) const
tools::Long GetWidth(const SwRect &rRect) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void AddLeft(const tools::Long nAdd)
void AddHeight(const tools::Long nAdd)
void AddTop(const tools::Long nAdd)
void AddWidth(const tools::Long nAdd)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
Represents the visualization of a paragraph.
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout.
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
SwAnchoredObject & GetAnchoredObj() const
const SwFrameFormat & GetFrameFormat() const
SdrObject & GetObject() const
SwFrame & GetAnchorFrame() const
sw::LineAlign mnLineAlignment
const SwTextFrame & GetAnchorTextFrame() const
method to cast <SwAnchoredObjectPosition::GetAnchorFrame()> to needed type
const SwTwips mnLineDescent
const SwTwips mnLineAscentInclObjs
const SwTwips mnLineAscent
virtual ~SwAsCharAnchoredObjectPosition() override
destructor
const SwTwips mnLineDescentInclObjs
SwAsCharAnchoredObjectPosition(SdrObject &_rDrawObj, const Point &_rProposedAnchorPos, const AsCharFlags _nFlags, const SwTwips _nLineAscent, const SwTwips _nLineDescent, const SwTwips _nLineAscentInclObjs, const SwTwips _nLineDescentInclObjs)
constructor; provided object to be positioned and needed data for calculation of the object position
SwTwips GetRelPosToBase(const SwTwips _nObjBoundHeight, const SwFormatVertOrient &_rVert)
determine the relative position to base line for object position
const Point & mrProposedAnchorPos
const AsCharFlags mnFlags
virtual void CalcPosition() override
calculate position for object position
Dialog to specify the properties of date form field.