63 struct AnchoredObjOrder
68 AnchoredObjOrder(
const bool bR2L,
80 ( (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() ==
81 (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() ) ) ||
83 ( (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() ==
84 (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() ) ) )
88 (aBoundRectOfListedObj.*mfnRect->
fnGetTop)() );
91 ( (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() >
92 (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() ) ) ||
94 ( (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() <
95 (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() ) ) ) )
99 else if ( nTopDiff > 0 )
105 ( (aBoundRectOfListedObj.*mfnRect->
fnGetRight)() >
106 (aBoundRectOfNewObj.*mfnRect->
fnGetRight)() ) ) ||
108 ( (aBoundRectOfListedObj.*mfnRect->
fnGetLeft)() <
109 (aBoundRectOfNewObj.*mfnRect->
fnGetLeft)() ) ) )
170 const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(pAnchoredObj));
174 bHandleContour =
true;
178 if( bHandleContour &&
179 ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) ==
nullptr ||
180 ( static_cast<const SwFlyFrame*>(pAnchoredObj)->
Lower() &&
181 static_cast<const SwFlyFrame*>(pAnchoredObj)->
Lower()->IsNoTextFrame() ) ) )
184 if( aRet.
IsOver( rLine ) )
190 pFormat, pAnchoredObj->
GetDrawObj(), pFrame, rLine, nXPos, bRight );
219 std::unique_ptr<::basegfx::B2DPolyPolygon> pPolyPolygon;
221 if (
auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) )
226 if( !pVirtFlyDrawObj->GetFlyFrame()->GetContour( aPoly ) )
228 GetFlyFrame()->getFrameArea().SVRect() );
229 aPolyPolygon.
clear();
234 if( dynamic_cast< const E3dObject *>( pObj ) == nullptr )
240 pPolyPolygon.reset(new ::basegfx::B2DPolyPolygon(aContourPoly));
246 std::make_unique<TextRanger>( aPolyPolygon, pPolyPolygon.get(), 20,
247 static_cast<sal_uInt16
>(rLRSpace.
GetLeft()), static_cast<sal_uInt16>(rLRSpace.
GetRight()),
254 pPolyPolygon.reset();
274 Range aRange( std::min( nTmpTop, nTmpBottom ), std::max( nTmpTop, nTmpBottom ) );
276 std::deque<tools::Long>* pTmp =
mvItems[0].mxTextRanger->GetTextRanges( aRange );
278 const size_t nCount = pTmp->size();
282 while( nIdx < nCount && (*pTmp)[ nIdx ] < nXPos )
284 bool bOdd = nIdx % 2;
288 else if( ! bRight && ( nIdx >= nCount || (*pTmp)[ nIdx ] != nXPos ) )
296 if( bSet && nIdx < nCount )
300 aRectFnSet.
SetLeft( aRet, (*pTmp)[ nIdx ] );
301 aRectFnSet.
SetRight( aRet, (*pTmp)[ nIdx + 1 ] + 1 );
309 , mpCurrAnchoredObj(nullptr)
310 , m_pCurrFrame(nullptr)
314 , m_nCurrFrameNodeIndex(0)
317 , mbIgnoreCurrentFrame(false)
318 , mbIgnoreContour(false)
319 , mbIgnoreObjsInHeaderFooter(false)
380 if(
ForEach( rRect, &aRet,
true ) )
388 if ( aRectFnSet.
YDiff( nRetBottom, nRectBottom ) > 0 ||
390 aRectFnSet.
SetBottom( aRet, nRectBottom );
399 OSL_ENSURE(
m_bOn,
"IsAnyFrame: Why?" );
403 return ForEach( aRect,
nullptr,
false );
408 OSL_ENSURE(
m_bOn,
"SwTextFly::IsAnyObj: Who's knocking?" );
421 for (
size_t i = 0;
i < pSorted->
size(); ++
i )
458 sal_Int32 nSpaceCnt = 0;
466 aRect.Width( aRect.Width() + nSpaceCnt * rInf.
GetSpace() );
469 aRect.Width( aRect.Width() - sal_Int32(nTmpLen) * rInf.
GetSpace() );
480 bool bOpaque =
false;
485 OSL_ENSURE( !
m_bTopRule,
"DrawTextOpaque: Wrong TopRule" );
492 for( SwAnchoredObjList::size_type
i = 0;
i < nCount; ++
i )
496 if( dynamic_cast<const SwFlyFrame*>(pTmpAnchoredObj) &&
508 css::text::WrapTextMode_THROUGH == rSur.
GetSurround() &&
512 ((RndStdIds::FLY_AT_PARA != rAnchor.
GetAnchorId()) &&
551 else if( !aRegion.empty() )
555 for(
size_t i = 0;
i < aRegion.size(); ++
i )
559 aClipVout.ChgClip( rRect );
572 OSL_ENSURE( !
m_bTopRule,
"DrawFlyRect: Wrong TopRule" );
578 for( SwAnchoredObjList::size_type
i = 0;
i < nCount; ++
i )
598 ( ( css::text::WrapTextMode_THROUGH == rSur.
GetSurround() )
612 if( !aFly.IsEmpty() )
619 for(
size_t i = 0;
i < aRegion.size(); ++
i )
630 const bool bInFootnote,
631 const bool bInFooterOrHeader )
640 if (
const SdrEdgeObj* pEdgeObj = dynamic_cast<const SdrEdgeObj*>(pNew))
642 if (pEdgeObj->GetConnectedNode(
true) || pEdgeObj->GetConnectedNode(
false))
648 if( ( bInFootnote || bInFooterOrHeader ) &&
m_bTopRule )
658 if ( bInFooterOrHeader )
662 aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA;
699 if (RndStdIds::FLY_AS_CHAR == rCurrA.
GetAnchorId())
708 if (RndStdIds::FLY_AT_PAGE == rCurrA.
GetAnchorId())
715 else if (RndStdIds::FLY_AT_PAGE == rCurrA.
GetAnchorId())
717 else if (RndStdIds::FLY_AT_FLY == rNewA.
GetAnchorId())
719 else if( RndStdIds::FLY_AT_FLY == rCurrA.
GetAnchorId() )
748 OSL_ENSURE( RndStdIds::FLY_AS_CHAR != rNewA.
GetAnchorId(),
749 "Don't call GetTop with a FlyInContentFrame" );
774 ->GetAnchorFrameContainingAnchPos()->GetUpper();
795 const SwFrame* pHeader =
nullptr;
803 if( pHeader || RndStdIds::FLY_AT_FLY == rNewA.
GetAnchorId() )
828 OSL_ENSURE(
m_pCurrFrame,
"InitFlyList: No Frame, no FlyList" );
835 const size_t nCount = pSorted ? pSorted->
size() : 0;
850 if( nCount && bWrapAllowed )
876 for(
size_t i = 0;
i < nCount; ++
i )
888 if ( !pAnchoredObj ||
900 if ( nRight < aRectFnSet.
GetLeft(aBound) ||
903 nLeft > aRectFnSet.
GetRight(aBound) ||
922 SwAnchoredObjList::iterator aInsPosIter =
926 AnchoredObjOrder( bR2L, aRectFnSet.
FnRect() ) );
938 if( text::VertOrientation::BOTTOM != rTmpFormat.
GetVertOrient() )
968 OSL_ENSURE(pLclMaster,
"SwTextFly without master");
970 const size_t nCount = pDrawObj ? pDrawObj->
size() : 0;
974 for(
size_t i = 0;
i < nCount; ++
i )
982 if( text::VertOrientation::BOTTOM != rTmpFormat.
GetVertOrient() )
985 if( aBound.Top() < nEndOfFrame )
986 nRet = std::max( nRet,
SwTwips(aBound.Bottom()) );
1025 for( SwAnchoredObjList::size_type
i = 0;
i < nCount; ++
i )
1047 if( ( css::text::WrapTextMode_THROUGH == rSur.
GetSurround() &&
1051 ((RndStdIds::FLY_AT_PARA != rAnchor.
GetAnchorId()) &&
1052 (RndStdIds::FLY_AT_CHAR != rAnchor.
GetAnchorId())) ) )
1078 aRectFnSet.
GetLeft(*pRect) ) ) ||
1081 aRectFnSet.
GetRight(*pRect) ) ) ) )
1102 SwAnchoredObjList::size_type nRet = 0;
1110 SwAnchoredObjList::size_type nFlyPos,
1111 const SwRect &rLine )
const
1115 "SwTextFly::CalcRightMargin with swapped frame" );
1119 SwTwips nFlyRight = aRectFnSet.GetRight(rFly);
1121 aRectFnSet.SetRight( aLine, nRight );
1122 aRectFnSet.SetLeft( aLine, aRectFnSet.GetLeft(rFly) );
1130 css::text::WrapTextMode eSurroundForTextWrap;
1134 SwAnchoredObjList::size_type nPos = 0;
1137 while( nPos < mpAnchoredObjList->
size() && !bStop )
1139 if( nPos == nFlyPos )
1149 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap )
1154 SwTwips nTmpRight = aRectFnSet.GetRight(aTmp);
1165 const tools::Long nTmpTop = aRectFnSet.GetTop(aTmp);
1166 if( aRectFnSet.YDiff( nTmpTop, aRectFnSet.GetTop(aLine) ) > 0 )
1168 if( aRectFnSet.YDiff(
m_nNextTop, nTmpTop ) > 0 )
1171 else if (!aRectFnSet.GetWidth(aTmp))
1176 if( ! aRectFnSet.GetHeight(aTmp) ||
1177 aRectFnSet.YDiff( aRectFnSet.GetBottom(aTmp),
1178 aRectFnSet.GetTop(aLine) ) > 0 )
1181 if( aTmp.
IsOver( aLine ) && nTmpRight > nFlyRight )
1183 nFlyRight = nTmpRight;
1184 if( css::text::WrapTextMode_RIGHT == eSurroundForTextWrap ||
1185 css::text::WrapTextMode_PARALLEL == eSurroundForTextWrap )
1188 if( nRight > nFlyRight )
1194 aRectFnSet.SetRight( rFly, nRight );
1199 SwAnchoredObjList::size_type nFlyPos,
1200 const SwRect &rLine )
const
1203 "SwTextFly::CalcLeftMargin with swapped frame" );
1207 const SwTwips nFlyLeft = aRectFnSet.GetLeft(rFly);
1209 if( nLeft > nFlyLeft )
1210 nLeft = rFly.
Left();
1213 aRectFnSet.SetLeft( aLine, nLeft );
1222 SwAnchoredObjList::size_type nMyPos = nFlyPos;
1223 while( ++nFlyPos < mpAnchoredObjList->
size() )
1228 if( aRectFnSet.GetLeft(aTmp) >= nFlyLeft )
1234 if( --nFlyPos == nMyPos )
1241 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap )
1247 if( aRectFnSet.GetLeft(aTmp) < nFlyLeft && aTmp.
IsOver( aLine ) )
1251 SwTwips nTmpRight = aRectFnSet.GetRight(aTmp);
1252 if ( nLeft <= nTmpRight )
1258 aRectFnSet.SetLeft( rFly, nLeft );
1263 const SwRect &rLine )
const
1281 SwAnchoredObjList::size_type nFlyPos =
GetPos( pAnchoredObj );
1294 case css::text::WrapTextMode_LEFT :
1299 case css::text::WrapTextMode_RIGHT :
1304 case css::text::WrapTextMode_NONE :
1319 #define TEXT_MIN 1134
1322 #define TEXT_MIN_SMALL 300
1325 #define FRAME_MAX 850
1331 css::text::WrapTextMode eSurroundForTextWrap = rFlyFormat.
GetSurround();
1336 if ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
1337 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()))
1339 return css::text::WrapTextMode_NONE;
1344 if( css::text::WrapTextMode_THROUGH == eSurroundForTextWrap ||
1345 css::text::WrapTextMode_NONE == eSurroundForTextWrap )
1346 return eSurroundForTextWrap;
1351 if ( css::text::WrapTextMode_LEFT == eSurroundForTextWrap )
1352 eSurroundForTextWrap = css::text::WrapTextMode_RIGHT;
1353 else if ( css::text::WrapTextMode_RIGHT == eSurroundForTextWrap )
1354 eSurroundForTextWrap = css::text::WrapTextMode_LEFT;
1358 if ( css::text::WrapTextMode_DYNAMIC == eSurroundForTextWrap )
1367 if ( nFlyRight < nCurrLeft || nFlyLeft > nCurrRight )
1368 eSurroundForTextWrap = css::text::WrapTextMode_PARALLEL;
1375 if( nLeft < nRight )
1387 if (nLeft == 0 && nRight == 0)
1388 return css::text::WrapTextMode_PARALLEL;
1390 if( nLeft < textMin )
1392 if( nRight < textMin )
1395 eSurroundForTextWrap = nRight ? css::text::WrapTextMode_PARALLEL : css::text::WrapTextMode_LEFT;
1397 eSurroundForTextWrap = nRight ? css::text::WrapTextMode_RIGHT: css::text::WrapTextMode_NONE;
1401 return eSurroundForTextWrap;
1409 OSL_ENSURE(
m_bOn,
"IsAnyFrame: Why?" );
1411 return ForEach( rLine,
nullptr,
false );
SwAnchoredObjList * GetAnchoredObjList() const
SwFrame * FindFooterOrHeader()
void SetTop(SwRect &rRect, tools::Long nNew) const
vcl::Region GetClipRegion() const
void SetNextTop(tools::Long nNew) const
Base class of the Writer layout elements.
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
Represents the visualization of a paragraph.
virtual SwRect GetObjRect() const =0
tools::Long GetRight(const SwRect &rRect) const
sal_uLong GetIndex() const
void Right(const tools::Long nRight)
virtual const SwFlyFrameFormat * GetFormat() const override
const SwSortedObjs * GetDrawObjs() const
const SwRect & GetOrigin() const
tools::Long GetPrtRight(const SwFrame &rFrame) const
sal_uInt16 GetLower() const
vcl::RenderContext * GetpOut() const
bool IsAnyFrame() const
Same as IsAnyFrame(const SwRect&), but uses the current frame print area.
bool IsAnyObj(const SwRect &rRect) const
true when a frame or DrawObj must be taken in account.
bool mbIgnoreObjsInHeaderFooter
boolean, indicating if objects in page header|footer are considered for text frames not in page heade...
SwRect GetFrame_(const SwRect &rPortion) const
This method will be called during the LineIter formatting.
const SwTextFrame * GetMaster_()
void Left(const tools::Long nLeft)
void ClrObject(sal_uInt16 nPos)
bool IsInFootnote() const
tools::Long GetRight() const
const SwRect & getFramePrintArea() const
void DrawFlyRect(OutputDevice *pOut, const SwRect &rRect)
Two subtleties needs to be mentioned:
The purpose of this class is to be the universal interface between formatting/text output and the pos...
SwAnchoredObjList * InitAnchoredObjList()
void SetPos(const Point &rNew)
sal_uInt16 GetAscent() const
SwContourCache * pContourCache
Contour-cache global variable, initialized/destroyed in txtinit.cxx and needed in txtfly...
void Pos(const Point &rNew)
bool IsBackgroundTransparent() const
SwFlyFrame::IsBackgroundTransparent.
Of course Writer needs its own rectangles.
tools::Rectangle GetBoundRect() const
SwTwips CalcMinBottom() const
const SwAnchoredObject * mpCurrAnchoredObj
bool mbIgnoreCurrentFrame
void DrawText_(SwDrawTextInfo &rInf)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SwTextFrame * m_pMaster
tools::Long GetTop(const SwRect &rRect) const
void SetBottom(SwRect &rRect, tools::Long nNew) const
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.
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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...
SwRect & Intersection(const SwRect &rRect)
sal_uLong GetIndex() const
tools::Long GetPrtLeft(const SwFrame &rFrame) const
void Width(tools::Long nNew)
sal_uLong m_nCurrFrameNodeIndex
Stores the upper edge of the "next" frame.
SwFlyFrame * FindFlyFrame()
void DrawTextOpaque(SwDrawTextInfo &rInf)
This method is called by DrawText().
tools::Long GetLeft(const SwRect &rRect) const
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
void ClrContourCache(const SdrObject *pObj)
void DrawRect(const tools::Rectangle &rRect)
const OUString & GetText() const
std::vector< CacheItem > mvItems
bool ConsiderForTextWrap() const
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
SwTextNode * GetTextNodeFirst()
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
const SdrObject * GetDrawObj() const
const SwSortedObjs * GetSortedObjs() const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
bool IsClipRegion() const
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.
SwPageFrame * FindPageFrame()
const SwFrame * Lower() const
SwPageDesc * GetPageDesc()
tools::Long GetHeight(const SwRect &rRect) const
const sal_Unicode CH_BLANK
tools::Long GetLeft() const
void SetRight(SwRect &rRect, tools::Long nNew) const
SwLayoutFrame * GetUpper()
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
virtual basegfx::B2DPolyPolygon TakeContour() const
bool GetTop(const SwAnchoredObject *_pAnchoredObj, const bool bInFootnote, const bool bInFooterOrHeader)
#i26945# - change first parameter Now it's the instance of the floating screen obj...
sal_uInt32 GetOrdNum() const
Provides access to settings of a document.
void DrawStretchText_(SwDrawTextInfo &rInf)
SwRect AnchoredObjToRect(const SwAnchoredObject *pAnchoredObj, const SwRect &rRect) const
Determines the demanded rectangle for an anchored object, considering its surround for text wrapping...
tools::Long YDiff(tools::Long n1, tools::Long n2) const
const SdrObject * GetObject(sal_uInt16 nPos) const
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 SSize(const Size &rNew)
bool IsTransparent() const
sal_uInt16 GetCount() const
virtual SdrLayerID GetHellId() const =0
std::vector< SwAnchoredObject * > SwAnchoredObjList
virtual SdrLayerID GetLayer() const
const SwPageDesc * GetFollow() const
const SwTextFrame * m_pCurrFrame
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
SwAnchoredObjList::size_type GetPos(const SwAnchoredObject *pAnchoredObj) const
void SetTopAndHeight(SwRect &rRect, tools::Long nTop, tools::Long nHeight) const
void Bottom(const tools::Long nBottom)
tools::Long GetSpace() const
std::unique_ptr< SwAnchoredObjList > mpAnchoredObjList
const SwTextFrame * GetMaster() const
general base class for all free-flowing frames
virtual SwFrameFormat & GetFrameFormat()=0
const SwPageFrame * m_pPage
SwTextFrame * FindMaster() const
bool supportsAutoContour() const
const Point & GetPos() const
TextFrameIndex GetLen() const
bool IsNoTextFrame() const
const Size & GetSize() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
bool IsRightToLeft() const
SwRect ContourRect(const SwFormat *pFormat, const SdrObject *pObj, const SwTextFrame *pFrame, const SwRect &rLine, const tools::Long nXPos, const bool bRight)
void Top(const tools::Long nTop)
bool ForEach(const SwRect &rRect, SwRect *pRect, bool bAvoid) const
Look for the first object which overlaps with the rectangle.
css::text::WrapTextMode GetSurroundForTextWrap(const SwAnchoredObject *pAnchoredObj) const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
vcl::RenderContext & GetOut() const
tools::Long GetKern() const
tools::Long GetBottom(const SwRect &rRect) const
void SetLeft(SwRect &rRect, tools::Long nNew) const
TextFrameIndex GetIdx() const
const SwFrame * GetAnchorFrame() const
void CtorInitTextFly(const SwTextFrame *pFrame)
bool IsOver(const SwRect &rRect) 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
const sal_Int32 COMPLETE_STRING
SwRootFrame * getRootFrame()
sal_uInt16 GetUpper() const