66 struct AnchoredObjOrder
71 AnchoredObjOrder(
const bool bR2L,
83 ( (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() ==
84 (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() ) ) ||
86 ( (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() ==
87 (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() ) ) )
91 (aBoundRectOfListedObj.*mfnRect->
fnGetTop)() );
94 ( (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() >
95 (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() ) ) ||
97 ( (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() <
98 (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() ) ) ) )
102 else if ( nTopDiff > 0 )
108 ( (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() >
109 (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() ) ) ||
111 ( (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() <
112 (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() ) ) )
177 bHandleContour =
true;
181 if( bHandleContour &&
193 pFormat, pAnchoredObj->
GetDrawObj(), pFrame, rLine, nXPos, bRight );
222 std::optional<::basegfx::B2DPolyPolygon> pPolyPolygon;
224 if (
auto pVirtFlyDrawObj =
dynamic_cast< const SwVirtFlyDrawObj *
>( pObj ) )
229 if( !pVirtFlyDrawObj->GetFlyFrame()->GetContour( aPoly ) )
231 GetFlyFrame()->getFrameArea().SVRect() );
232 aPolyPolygon.
clear();
248 std::make_unique<TextRanger>( aPolyPolygon, pPolyPolygon ? &*pPolyPolygon :
nullptr, 20,
249 o3tl::narrowing<sal_uInt16>(rLRSpace.
GetLeft()), o3tl::narrowing<sal_uInt16>(rLRSpace.
GetRight()),
256 pPolyPolygon.reset();
276 Range aRange(
std::min( nTmpTop, nTmpBottom ), std::max( nTmpTop, nTmpBottom ) );
278 std::deque<tools::Long>* pTmp =
mvItems[0].mxTextRanger->GetTextRanges( aRange );
280 const size_t nCount = pTmp->size();
284 while( nIdx <
nCount && (*pTmp)[ nIdx ] < nXPos )
286 bool bOdd = nIdx % 2;
290 else if( ! bRight && ( nIdx >=
nCount || (*pTmp)[ nIdx ] != nXPos ) )
298 if( bSet && nIdx <
nCount )
302 aRectFnSet.
SetLeft( aRet, (*pTmp)[ nIdx ] );
303 aRectFnSet.
SetRight( aRet, (*pTmp)[ nIdx + 1 ] + 1 );
311 , mpCurrAnchoredObj(nullptr)
312 , m_pCurrFrame(nullptr)
316 , m_nCurrFrameNodeIndex(0)
319 , mbIgnoreCurrentFrame(false)
320 , mbIgnoreContour(false)
321 , mbIgnoreObjsInHeaderFooter(false)
382 if(
ForEach( rRect, &aRet,
true ) )
390 if ( aRectFnSet.
YDiff( nRetBottom, nRectBottom ) > 0 ||
392 aRectFnSet.
SetBottom( aRet, nRectBottom );
401 OSL_ENSURE(
m_bOn,
"IsAnyFrame: Why?" );
405 return ForEach( aRect,
nullptr,
false );
410 OSL_ENSURE(
m_bOn,
"SwTextFly::IsAnyObj: Who's knocking?" );
429 for (
size_t i = 0;
i < pSorted->
size(); ++
i )
466 sal_Int32 nSpaceCnt = 0;
488 bool bOpaque =
false;
493 OSL_ENSURE( !
m_bTopRule,
"DrawTextOpaque: Wrong TopRule" );
500 for( SwAnchoredObjList::size_type
i = 0;
i <
nCount; ++
i )
515 css::text::WrapTextMode_THROUGH == rSur.
GetSurround() &&
519 ((RndStdIds::FLY_AT_PARA != rAnchor.
GetAnchorId()) &&
525 nCurrOrd < pTmpAnchoredObj->GetDrawObj()->GetOrdNum()
558 else if( !aRegion.empty() )
562 for(
size_t i = 0;
i < aRegion.size(); ++
i )
579 OSL_ENSURE( !
m_bTopRule,
"DrawFlyRect: Wrong TopRule" );
585 for( SwAnchoredObjList::size_type
i = 0;
i <
nCount; ++
i )
605 ( ( css::text::WrapTextMode_THROUGH == rSur.
GetSurround() )
626 for(
size_t i = 0;
i < aRegion.size(); ++
i )
628 pOut->DrawRect( aRegion[
i].SVRect() );
637 const bool bInFootnote,
638 const bool bInFooterOrHeader )
649 if (pEdgeObj->GetConnectedNode(
true) || pEdgeObj->GetConnectedNode(
false))
655 if( ( bInFootnote || bInFooterOrHeader ) &&
m_bTopRule )
665 if ( bInFooterOrHeader )
706 if (RndStdIds::FLY_AS_CHAR == rCurrA.
GetAnchorId())
715 if (RndStdIds::FLY_AT_PAGE == rCurrA.
GetAnchorId())
722 else if (RndStdIds::FLY_AT_PAGE == rCurrA.
GetAnchorId())
724 else if (RndStdIds::FLY_AT_FLY == rNewA.
GetAnchorId())
726 else if( RndStdIds::FLY_AT_FLY == rCurrA.
GetAnchorId() )
755 OSL_ENSURE( RndStdIds::FLY_AS_CHAR != rNewA.
GetAnchorId(),
756 "Don't call GetTop with a FlyInContentFrame" );
781 ->GetAnchorFrameContainingAnchPos()->GetUpper();
802 const SwFrame* pHeader =
nullptr;
810 if( pHeader || RndStdIds::FLY_AT_FLY == rNewA.
GetAnchorId() )
851 OSL_ENSURE(
m_pCurrFrame,
"InitFlyList: No Frame, no FlyList" );
858 const size_t nCount = pSorted ? pSorted->
size() : 0;
873 if(
nCount && bWrapAllowed )
899 assert(pAnchoredObj);
900 if ( !pAnchoredObj ||
912 if ( nRight < aRectFnSet.
GetLeft(aBound) ||
915 nLeft > aRectFnSet.
GetRight(aBound) ||
934 SwAnchoredObjList::iterator aInsPosIter =
938 AnchoredObjOrder( bR2L, aRectFnSet.
FnRect() ) );
950 if( text::VertOrientation::BOTTOM != rTmpFormat.
GetVertOrient() )
980 OSL_ENSURE(pLclMaster,
"SwTextFly without master");
982 const size_t nCount = pDrawObj ? pDrawObj->
size() : 0;
994 if( text::VertOrientation::BOTTOM != rTmpFormat.
GetVertOrient() )
997 if( aBound.
Top() < nEndOfFrame )
1043 if (nX < aRect.
Left())
1052 if (nX > aRect.
Right())
1095 for( SwAnchoredObjList::size_type
i = 0;
i <
nCount; ++
i )
1117 if( ( css::text::WrapTextMode_THROUGH == rSur.
GetSurround() &&
1121 ((RndStdIds::FLY_AT_PARA != rAnchor.
GetAnchorId()) &&
1122 (RndStdIds::FLY_AT_CHAR != rAnchor.
GetAnchorId())) ) )
1148 aRectFnSet.
GetLeft(*pRect) ) ) ||
1151 aRectFnSet.
GetRight(*pRect) ) ) ) )
1172 SwAnchoredObjList::size_type nRet = 0;
1180 SwAnchoredObjList::size_type nFlyPos,
1181 const SwRect &rLine )
const
1185 "SwTextFly::CalcRightMargin with swapped frame" );
1191 aRectFnSet.
SetRight( aLine, nRight );
1200 css::text::WrapTextMode eSurroundForTextWrap;
1204 SwAnchoredObjList::size_type
nPos = 0;
1207 while( nPos < mpAnchoredObjList->
size() && !bStop )
1209 if(
nPos == nFlyPos )
1219 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap )
1236 if( aRectFnSet.
YDiff( nTmpTop, aRectFnSet.
GetTop(aLine) ) > 0 )
1241 else if (!aRectFnSet.
GetWidth(aTmp))
1248 aRectFnSet.
GetTop(aLine) ) > 0 )
1251 if( aTmp.
Overlaps( aLine ) && nTmpRight > nFlyRight )
1253 nFlyRight = nTmpRight;
1254 if( css::text::WrapTextMode_RIGHT == eSurroundForTextWrap ||
1255 css::text::WrapTextMode_PARALLEL == eSurroundForTextWrap )
1258 if( nRight > nFlyRight )
1264 aRectFnSet.
SetRight( rFly, nRight );
1269 SwAnchoredObjList::size_type nFlyPos,
1270 const SwRect &rLine )
const
1273 "SwTextFly::CalcLeftMargin with swapped frame" );
1279 if( nLeft > nFlyLeft )
1280 nLeft = rFly.
Left();
1283 aRectFnSet.
SetLeft( aLine, nLeft );
1292 SwAnchoredObjList::size_type nMyPos = nFlyPos;
1293 while( ++nFlyPos < mpAnchoredObjList->
size() )
1298 if( aRectFnSet.
GetLeft(aTmp) >= nFlyLeft )
1304 if( --nFlyPos == nMyPos )
1311 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap )
1322 if ( nLeft <= nTmpRight )
1328 aRectFnSet.
SetLeft( rFly, nLeft );
1333 const SwRect &rLine )
const
1351 SwAnchoredObjList::size_type nFlyPos =
GetPos( pAnchoredObj );
1364 case css::text::WrapTextMode_LEFT :
1369 case css::text::WrapTextMode_RIGHT :
1374 case css::text::WrapTextMode_NONE :
1389#define TEXT_MIN 1134
1392#define FRAME_MAX 850
1398 css::text::WrapTextMode eSurroundForTextWrap = rFlyFormat.
GetSurround();
1403 if ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
1404 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()))
1406 return css::text::WrapTextMode_NONE;
1411 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap ||
1412 css::text::WrapTextMode_NONE == eSurroundForTextWrap )
1413 return eSurroundForTextWrap;
1418 if ( css::text::WrapTextMode_LEFT == eSurroundForTextWrap )
1419 eSurroundForTextWrap = css::text::WrapTextMode_RIGHT;
1420 else if ( css::text::WrapTextMode_RIGHT == eSurroundForTextWrap )
1421 eSurroundForTextWrap = css::text::WrapTextMode_LEFT;
1425 if ( css::text::WrapTextMode_DYNAMIC == eSurroundForTextWrap )
1434 if ( nFlyRight < nCurrLeft || nFlyLeft > nCurrRight )
1435 eSurroundForTextWrap = css::text::WrapTextMode_PARALLEL;
1442 if( nLeft < nRight )
1454 if (nLeft == 0 && nRight == 0)
1455 return css::text::WrapTextMode_PARALLEL;
1457 if( nLeft < textMin )
1459 if( nRight < textMin )
1462 eSurroundForTextWrap = nRight ? css::text::WrapTextMode_PARALLEL : css::text::WrapTextMode_LEFT;
1464 eSurroundForTextWrap = nRight ? css::text::WrapTextMode_RIGHT: css::text::WrapTextMode_NONE;
1468 return eSurroundForTextWrap;
1476 OSL_ENSURE(
m_bOn,
"IsAnyFrame: Why?" );
1478 return ForEach( rLine,
nullptr,
false );
@ CONSIDER_WRAP_ON_OBJECT_POSITION
@ SURROUND_TEXT_WRAP_SMALL
@ USE_FORMER_TEXT_WRAPPING
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 SdrLayerID GetHellId() const =0
virtual bool IsVisibleLayerId(SdrLayerID _nLayerId) const =0
method to determine, if a layer ID belongs to the visible ones.
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
vcl::Region GetClipRegion() const
bool IsClipRegion() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
sal_uInt32 GetOrdNum() const
virtual basegfx::B2DPolyPolygon TakeContour() const
virtual SdrLayerID GetLayer() const
tools::Long GetRight() const
tools::Long GetLeft() 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
bool ConsiderForTextWrap() const
virtual SwFrameFormat & GetFrameFormat()=0
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
virtual const SwFlyFrame * DynCastFlyFrame() const
const SdrObject * GetDrawObj() const
virtual SwRect GetObjRect() const =0
SwLineBreakClear GetClear() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwTextFrame * FindMaster() const
const SdrObject * GetObject(sal_uInt16 nPos) const
sal_uInt16 GetCount() const
SwRect ContourRect(const SwFormat *pFormat, const SdrObject *pObj, const SwTextFrame *pFrame, const SwRect &rLine, const tools::Long nXPos, const bool bRight)
static SwRect CalcBoundRect(const SwAnchoredObject *pAnchoredObj, const SwRect &rLine, const SwTextFrame *pFrame, const tools::Long nXPos, const bool bRight)
Computes the rectangle that will cover the object in the given line.
void ClrObject(sal_uInt16 nPos)
std::vector< CacheItem > mvItems
IDocumentSettingAccess const & getIDocumentSettingAccess() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
TextFrameIndex GetIdx() const
void SetPos(const Point &rNew)
TextFrameIndex GetLen() const
const OUString & GetText() const
tools::Long GetKern() const
sal_uInt16 GetAscent() const
vcl::RenderContext & GetOut() const
vcl::RenderContext * GetpOut() const
const Point & GetPos() const
const Size & GetSize() const
tools::Long GetSpace() const
general base class for all free-flowing frames
virtual const SwFlyFrameFormat * GetFormat() const override
bool IsBackgroundTransparent() const
SwFlyFrame::IsBackgroundTransparent.
bool supportsAutoContour() const
void DrawStretchText_(SwDrawTextInfo &rInf)
void DrawText_(SwDrawTextInfo &rInf)
const SwRect & getFrameArea() const
const SwRect & getFramePrintArea() const
Base class of the Writer layout elements.
SwFlyFrame * FindFlyFrame()
bool IsInFootnote() const
const SwSortedObjs * GetDrawObjs() const
bool IsRightToLeft() const
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
bool IsNoTextFrame() const
SwPageFrame * FindPageFrame()
SwFrame * FindFooterOrHeader()
const SwFrame * Lower() const
bool IsTransparent() const
SwNodeOffset GetIndex() const
const SwPageDesc * GetFollow() const
const SwSortedObjs * GetSortedObjs() const
SwPageDesc * GetPageDesc()
tools::Long GetHeight(const SwRect &rRect) const
void SetBottom(SwRect &rRect, tools::Long nNew) const
void SetRight(SwRect &rRect, tools::Long nNew) const
tools::Long GetWidth(const SwRect &rRect) const
tools::Long GetTop(const SwRect &rRect) const
tools::Long GetPrtRight(const SwFrame &rFrame) const
void SetTopAndHeight(SwRect &rRect, tools::Long nTop, tools::Long nHeight) const
tools::Long YDiff(tools::Long n1, tools::Long n2) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetPrtLeft(const SwFrame &rFrame) const
tools::Long GetBottom(const SwRect &rRect) const
void SetTop(SwRect &rRect, tools::Long nNew) const
tools::Long GetRight(const SwRect &rRect) const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
void SetLeft(SwRect &rRect, tools::Long nNew) 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 Bottom(const tools::Long nBottom)
void Pos(const Point &rNew)
void SSize(const Size &rNew)
void AddBottom(const tools::Long nAdd)
bool Overlaps(const SwRect &rRect) const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
const SwRect & GetOrigin() const
SwViewShell * GetCurrShell() const
void ChgClip(const SwRect &rRect, const SwTextFrame *pFrame=nullptr, bool bEnlargeRect=false, sal_Int32 nEnlargeTop=0, sal_Int32 nEnlargeBottom=0)
class for collecting anchored objects
The purpose of this class is to be the universal interface between formatting/text output and the pos...
void CalcRightMargin(SwRect &rFly, SwAnchoredObjList::size_type nPos, const SwRect &rLine) const
The right margin is the right margin or it is determined by the next object standing on the line.
void SetNextTop(tools::Long nNew) const
std::unique_ptr< SwAnchoredObjList > mpAnchoredObjList
bool GetTop(const SwAnchoredObject *_pAnchoredObj, const bool bInFootnote, const bool bInFooterOrHeader)
#i26945# - change first parameter Now it's the <SwAnchoredObject> instance of the floating screen obj...
bool IsAnyObj(const SwRect &rRect) const
true when a frame or DrawObj must be taken in account.
SwAnchoredObjList::size_type GetPos(const SwAnchoredObject *pAnchoredObj) const
SwRect GetFrame_(const SwRect &rPortion) const
This method will be called during the LineIter formatting.
SwRect AnchoredObjToRect(const SwAnchoredObject *pAnchoredObj, const SwRect &rRect) const
Determines the demanded rectangle for an anchored object, considering its surround for text wrapping.
SwTwips GetMaxBottom(const SwBreakPortion &rPortion, const SwTextFormatInfo &rInfo) const
Gets the maximum of the fly frame bottoms.
SwAnchoredObjList * InitAnchoredObjList()
const SwTextFrame * GetMaster() const
const SwTextFrame * GetMaster_()
bool IsAnyFrame() const
Same as IsAnyFrame(const SwRect&), but uses the current frame print area.
bool ForEach(const SwRect &rRect, SwRect *pRect, bool bAvoid) const
Look for the first object which overlaps with the rectangle.
SwRect GetFrameArea() const
const SwPageFrame * m_pPage
void DrawFlyRect(OutputDevice *pOut, const SwRect &rRect)
Two subtleties needs to be mentioned:
const SwAnchoredObject * mpCurrAnchoredObj
css::text::WrapTextMode GetSurroundForTextWrap(const SwAnchoredObject *pAnchoredObj) const
bool mbIgnoreObjsInHeaderFooter
boolean, indicating if objects in page header|footer are considered for text frames not in page heade...
SwTwips CalcMinBottom() const
const SwTextFrame * m_pCurrFrame
const SwTextFrame * m_pMaster
bool mbIgnoreCurrentFrame
SwAnchoredObjList * GetAnchoredObjList() const
void CalcLeftMargin(SwRect &rFly, SwAnchoredObjList::size_type nPos, const SwRect &rLine) const
The left margin is the left margin of the current PrintArea or it is determined by the last FlyFrame,...
SwNodeOffset m_nCurrFrameNodeIndex
Stores the upper edge of the "next" frame.
void CtorInitTextFly(const SwTextFrame *pFrame)
void DrawTextOpaque(SwDrawTextInfo &rInf)
This method is called by DrawText().
Represents the visualization of a paragraph.
SwTwips GetLowerMarginForFlyIntersect() const
Get the amount of lower margin of this frame we need to consider for fly portion purposes.
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout.
SwTextNode * GetTextNodeFirst()
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
tools::Rectangle GetBoundRect() const
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
SVXCORE_DLLPUBLIC E3dObject * DynCastE3dObject(SdrObject *)
const sal_Unicode CH_BLANK
constexpr sal_Int32 COMPLETE_STRING
void ClrContourCache(const SdrObject *pObj)
std::vector< SwAnchoredObject * > SwAnchoredObjList
SwContourCache * pContourCache
Contour-cache global variable, initialized/destroyed in txtinit.cxx and needed in txtfly....