LibreOffice Module sw (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SwTextFly Class Reference

The purpose of this class is to be the universal interface between formatting/text output and the possibly overlapping free-flying frames. More...

#include <txtfly.hxx>

Collaboration diagram for SwTextFly:
[legend]

Public Member Functions

SwAnchoredObjListGetAnchoredObjList () const
 
 SwTextFly ()
 
 SwTextFly (const SwTextFrame *pFrame)
 
 SwTextFly (const SwTextFly &rTextFly)
 
 ~SwTextFly ()
 
void CtorInitTextFly (const SwTextFrame *pFrame)
 
void SetTopRule ()
 
SwRect GetFrame (const SwRect &rPortion) const
 
bool IsOn () const
 
bool Relax (const SwRect &rRect)
 If there is no flying object frame standing in rRect (usually the current row), then we are turning ourself off. More...
 
bool Relax ()
 
SwTwips GetMinBottom () const
 
SwTwips GetMaxBottom (const SwBreakPortion &rPortion, const SwTextFormatInfo &rInfo) const
 Gets the maximum of the fly frame bottoms. More...
 
const SwTextFrameGetMaster () const
 
tools::Long GetNextTop () const
 
void SetNextTop (tools::Long nNew) const
 
SwRect AnchoredObjToRect (const SwAnchoredObject *pAnchoredObj, const SwRect &rRect) const
 Determines the demanded rectangle for an anchored object, considering its surround for text wrapping. More...
 
void DrawTextOpaque (SwDrawTextInfo &rInf)
 This method is called by DrawText(). More...
 
void DrawFlyRect (OutputDevice *pOut, const SwRect &rRect)
 Two subtleties needs to be mentioned: More...
 
bool IsAnyFrame (const SwRect &rLine) const
 Used to switch off the SwTextFly when there is no overlapping object (Relax). More...
 
bool IsAnyFrame () const
 Same as IsAnyFrame(const SwRect&), but uses the current frame print area. More...
 
bool IsAnyObj (const SwRect &rRect) const
 true when a frame or DrawObj must be taken in account. More...
 
void SetIgnoreCurrentFrame (bool bNew)
 
void SetIgnoreContour (bool bNew)
 
void SetIgnoreObjsInHeaderFooter (const bool bNew)
 
SwRect GetFrameArea () const
 

Private Member Functions

SwRect GetFrame_ (const SwRect &rPortion) const
 This method will be called during the LineIter formatting. More...
 
SwAnchoredObjListInitAnchoredObjList ()
 
bool ForEach (const SwRect &rRect, SwRect *pRect, bool bAvoid) const
 Look for the first object which overlaps with the rectangle. More...
 
css::text::WrapTextMode GetSurroundForTextWrap (const SwAnchoredObject *pAnchoredObj) 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. More...
 
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, which stands on the line. More...
 
SwAnchoredObjList::size_type GetPos (const SwAnchoredObject *pAnchoredObj) const
 
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 object More...
 
SwTwips CalcMinBottom () const
 
const SwTextFrameGetMaster_ ()
 

Private Attributes

const SwPageFramem_pPage
 
const SwAnchoredObjectmpCurrAnchoredObj
 
const SwTextFramem_pCurrFrame
 
const SwTextFramem_pMaster
 
std::unique_ptr< SwAnchoredObjListmpAnchoredObjList
 
tools::Long m_nMinBottom
 
tools::Long m_nNextTop
 
SwNodeOffset m_nCurrFrameNodeIndex
 Stores the upper edge of the "next" frame. More...
 
bool m_bOn: 1
 
bool m_bTopRule: 1
 
bool mbIgnoreCurrentFrame: 1
 
bool mbIgnoreContour: 1
 
bool mbIgnoreObjsInHeaderFooter: 1
 boolean, indicating if objects in page header|footer are considered for text frames not in page header|footer. More...
 

Detailed Description

The purpose of this class is to be the universal interface between formatting/text output and the possibly overlapping free-flying frames.

During formatting the formatter gets the information from SwTextFly, whether a certain area is present by the attributes of an overlapping frame. Such areas are represented by dummy portions.

The whole text output and touch-up is, again, forwarded to a SwTextFly. This one decides, whether parts of the text need to be clipped and splits the areas for e.g. a DrawRect.

Please note that all free-flying frames are located in a PtrArray, sorted by TopLeft.

Internally we always use document-global values. The IN and OUT parameters are, however, adjusted to the needs of the LineIter most of the time. That is: they are converted to frame- and window-local coordinates. If multiple frames with wrap attributes are located on the same line, we get the following settings for the text flow:

 L/R    P     L     R     N
  P   -P-P- -P-L  -P R- -P N
  L   -L P- -L L  -L R- -L N
  R    R-P-  R-L   R R-  R N
  N    N P-  N L   N R-  N N

(P=parallel, L=left, R=right, N=no wrap)

We can describe the behaviour as follows: Every frame can push away text, with the restriction that it only has influence until the next frame.

Definition at line 124 of file txtfly.hxx.

Constructor & Destructor Documentation

◆ SwTextFly() [1/3]

SwTextFly::SwTextFly ( )

Definition at line 309 of file txtfly.cxx.

◆ SwTextFly() [2/3]

SwTextFly::SwTextFly ( const SwTextFrame pFrame)

Definition at line 326 of file txtfly.cxx.

References CtorInitTextFly().

◆ SwTextFly() [3/3]

SwTextFly::SwTextFly ( const SwTextFly rTextFly)

◆ ~SwTextFly()

SwTextFly::~SwTextFly ( )

Definition at line 352 of file txtfly.cxx.

Member Function Documentation

◆ AnchoredObjToRect()

SwRect SwTextFly::AnchoredObjToRect ( const SwAnchoredObject pAnchoredObj,
const SwRect rRect 
) const

Determines the demanded rectangle for an anchored object, considering its surround for text wrapping.

Parameters
pAnchoredObjthe object for which to get the bounds
rLinethe bounds of the line to format
Returns
the flying object bounds

Definition at line 1332 of file txtfly.cxx.

References SwContourCache::CalcBoundRect(), CalcLeftMargin(), CalcRightMargin(), SwRectFnSet::GetBottom(), SwRectFnSet::GetLeft(), SwAnchoredObject::GetObjRectWithSpaces(), GetPos(), GetSurroundForTextWrap(), SwFrame::IsRightToLeft(), m_pCurrFrame, mbIgnoreContour, SwRect::Right(), SetNextTop(), and SwRect::Width().

Referenced by ForEach(), and SwTextFrame::FormatImpl().

◆ CalcLeftMargin()

void SwTextFly::CalcLeftMargin ( SwRect rFly,
SwAnchoredObjList::size_type  nPos,
const SwRect rLine 
) const
private

◆ CalcMinBottom()

SwTwips SwTextFly::CalcMinBottom ( ) const
private

◆ CalcRightMargin()

void SwTextFly::CalcRightMargin ( SwRect rFly,
SwAnchoredObjList::size_type  nPos,
const SwRect rLine 
) const
private

◆ CtorInitTextFly()

void SwTextFly::CtorInitTextFly ( const SwTextFrame pFrame)

◆ DrawFlyRect()

void SwTextFly::DrawFlyRect ( OutputDevice pOut,
const SwRect rRect 
)

◆ DrawTextOpaque()

void SwTextFly::DrawTextOpaque ( SwDrawTextInfo rInf)

This method is called by DrawText().

Ensures that the overlapping frames (except the transparent frames) won't be scribbled by setting clip regions so that only the portions that are not in the area of FlyFrames that are opaque and above the current frame will be output.

DrawText() takes over the on optimization!

Definition at line 455 of file txtfly.cxx.

References CH_BLANK, SwSaveClip::ChgClip(), COMPLETE_STRING, SwFont::DrawStretchText_(), SwFont::DrawText_(), SwAnchoredObject::DynCastFlyFrame(), SwFormat::GetAnchor(), GetAnchoredObjList(), SwAnchoredObject::GetAnchorFrame(), SwFormatAnchor::GetAnchorId(), SwDrawTextInfo::GetAscent(), vcl::Region::GetBoundRect(), OutputDevice::GetClipRegion(), SwRootFrame::GetCurrShell(), SwAnchoredObject::GetDrawObj(), SwDrawTextInfo::GetFont(), SwFlyFrame::GetFormat(), SwFrameAreaDefinition::getFrameArea(), IDocumentDrawModelAccess::GetHellId(), SwViewShell::getIDocumentDrawModelAccess(), SwDrawTextInfo::GetIdx(), SwDrawTextInfo::GetKern(), SdrObject::GetLayer(), SwDrawTextInfo::GetLen(), GetMaster(), SdrObject::GetOrdNum(), SwRegionRects::GetOrigin(), SwDrawTextInfo::GetOut(), SwDrawTextInfo::GetPos(), SwDrawTextInfo::GetpOut(), SwFrame::getRootFrame(), SwDrawTextInfo::GetSize(), SwDrawTextInfo::GetSpace(), SwFormatSurround::GetSurround(), SwFormat::GetSurround(), SwDrawTextInfo::GetText(), i, SwRect::Intersection(), SwFormatSurround::IsAnchorOnly(), SwFlyFrame::IsBackgroundTransparent(), OutputDevice::IsClipRegion(), SwFormatSurround::IsContour(), SwFrame::IsNoTextFrame(), SwSaveClip::IsOn(), SwNoTextFrame::IsTransparent(), SwLayoutFrame::Lower(), m_bOn, m_bTopRule, m_pPage, mpCurrAnchoredObj, nCount, nPos, SwRect::Overlaps(), SAL_MAX_UINT32, SwDrawTextInfo::SetPos(), size, SwRect::Width(), Point::X(), and Point::Y().

Referenced by SwTextPaintInfo::DrawText_().

◆ ForEach()

bool SwTextFly::ForEach ( const SwRect rRect,
SwRect pRect,
bool  bAvoid 
) const
private

◆ GetAnchoredObjList()

SwAnchoredObjList * SwTextFly::GetAnchoredObjList ( ) const
inline

◆ GetFrame()

SwRect SwTextFly::GetFrame ( const SwRect rPortion) const
inline

◆ GetFrame_()

SwRect SwTextFly::GetFrame_ ( const SwRect rPortion) const
private

This method will be called during the LineIter formatting.

  • to compute the position of the next FlyPortion
  • remember new overlappings after a change of the line height.
Parameters
[in]rPortionScope: document global.

Definition at line 379 of file txtfly.cxx.

References ForEach(), SwRectFnSet::GetBottom(), SwRectFnSet::GetHeight(), SwRectFnSet::GetTop(), m_pCurrFrame, SwRectFnSet::SetBottom(), SwRectFnSet::SetTop(), and SwRectFnSet::YDiff().

Referenced by GetFrame().

◆ GetFrameArea()

SwRect SwTextFly::GetFrameArea ( ) const

◆ GetMaster()

const SwTextFrame * SwTextFly::GetMaster ( ) const
inline

◆ GetMaster_()

const SwTextFrame * SwTextFly::GetMaster_ ( )
private

Definition at line 447 of file txtfly.cxx.

References SwContentFrame::FindMaster(), m_pCurrFrame, and m_pMaster.

Referenced by GetMaster().

◆ GetMaxBottom()

SwTwips SwTextFly::GetMaxBottom ( const SwBreakPortion rPortion,
const SwTextFormatInfo rInfo 
) const

◆ GetMinBottom()

SwTwips SwTextFly::GetMinBottom ( ) const
inline

Definition at line 349 of file txtfly.hxx.

References CalcMinBottom(), m_nMinBottom, and mpAnchoredObjList.

Referenced by SwTextFormatter::CalcBottomLine().

◆ GetNextTop()

tools::Long SwTextFly::GetNextTop ( ) const
inline

Definition at line 359 of file txtfly.hxx.

References m_nNextTop.

Referenced by SwTextFormatter::CalcFlyWidth().

◆ GetPos()

SwAnchoredObjList::size_type SwTextFly::GetPos ( const SwAnchoredObject pAnchoredObj) const
private
Returns
the position in sorted array

Definition at line 1169 of file txtfly.cxx.

References GetAnchoredObjList(), mpAnchoredObjList, and nCount.

Referenced by AnchoredObjToRect().

◆ GetSurroundForTextWrap()

css::text::WrapTextMode SwTextFly::GetSurroundForTextWrap ( const SwAnchoredObject pAnchoredObj) const
private
  • There is less than 2cm space on both sides for the text: no surround (css::text::WrapTextMode_NONE)
  • There is more than 2cm space on only one side: surround on that side (css::text::WrapTextMode_LEFT or css::text::WrapTextMode_RIGHT)
  • There is more than 2cm space on both sides, the object is larger than 1.5cm: surround on the wider side (css::text::WrapTextMode_LEFT or css::text::WrapTextMode_RIGHT)
  • There is more than 2cm space on both sides and the object width is less than 1.5cm: both sides surround (css::text::WrapTextMode_PARALLEL)

Definition at line 1394 of file txtfly.cxx.

References FRAME_MAX, IDocumentSettingAccess::get(), SwFormat::GetAnchor(), SwAnchoredObject::GetAnchorFrame(), SwFormatAnchor::GetAnchorId(), SwTextFrame::GetDoc(), SwAnchoredObject::GetFrameFormat(), SwDoc::getIDocumentSettingAccess(), SwRectFnSet::GetLeft(), GetMaster(), SwAnchoredObject::GetObjRectWithSpaces(), SwRectFnSet::GetPrtLeft(), SwRectFnSet::GetPrtRight(), SwRectFnSet::GetRight(), SwFormatSurround::GetSurround(), SwFormat::GetSurround(), SwFormatSurround::IsAnchorOnly(), SwFrame::IsRightToLeft(), m_pCurrFrame, SURROUND_TEXT_WRAP_SMALL, TEXT_MIN, and TEXT_MIN_SMALL.

Referenced by AnchoredObjToRect(), CalcLeftMargin(), and CalcRightMargin().

◆ GetTop()

bool SwTextFly::GetTop ( const SwAnchoredObject _pAnchoredObj,
const bool  bInFootnote,
const bool  bInFooterOrHeader 
)
private

◆ InitAnchoredObjList()

SwAnchoredObjList * SwTextFly::InitAnchoredObjList ( )
private

◆ IsAnyFrame() [1/2]

bool SwTextFly::IsAnyFrame ( ) const

Same as IsAnyFrame(const SwRect&), but uses the current frame print area.

Definition at line 397 of file txtfly.cxx.

References ForEach(), SwFrameAreaDefinition::getFrameArea(), SwFrameAreaDefinition::getFramePrintArea(), m_bOn, m_pCurrFrame, SwRect::Pos(), SwRect::SSize(), and swap().

Referenced by Relax().

◆ IsAnyFrame() [2/2]

bool SwTextFly::IsAnyFrame ( const SwRect rLine) const

Used to switch off the SwTextFly when there is no overlapping object (Relax).

Parameters
[in]theline area
Returns
whether the line will be overlapped by a frame

Definition at line 1471 of file txtfly.cxx.

References ForEach(), m_bOn, m_pCurrFrame, and swap().

◆ IsAnyObj()

bool SwTextFly::IsAnyObj ( const SwRect rRect) const

true when a frame or DrawObj must be taken in account.

The optimizations like Paint/FormatEmpty for empty sentences or the virtual OutputDevice can be used only when false is returned.

Parameters
rRectThe rectangle can be empty, the current frame is then used. The value is global to the document.

Definition at line 408 of file txtfly.cxx.

References SwRect::AddBottom(), SwFrameAreaDefinition::getFrameArea(), SwFrameAreaDefinition::getFramePrintArea(), SwTextFrame::GetLowerMarginForFlyIntersect(), SwAnchoredObject::GetObjRect(), SwAnchoredObject::GetObjRectWithSpaces(), SwPageFrame::GetSortedObjs(), i, SwRect::IsEmpty(), SwRect::Left(), m_bOn, m_pCurrFrame, m_pPage, mpCurrAnchoredObj, SwRect::Overlaps(), SwRect::Pos(), SwRect::Right(), SwSortedObjs::size(), and SwRect::SSize().

Referenced by SwTextFrame::FormatEmpty(), and SwTextFrame::PaintEmpty().

◆ IsOn()

bool SwTextFly::IsOn ( ) const
inline

◆ Relax() [1/2]

bool SwTextFly::Relax ( )
inline

Definition at line 340 of file txtfly.hxx.

References IsAnyFrame(), and m_bOn.

◆ Relax() [2/2]

bool SwTextFly::Relax ( const SwRect rRect)
inline

If there is no flying object frame standing in rRect (usually the current row), then we are turning ourself off.

Parameters
rRectis global to the document!

Definition at line 331 of file txtfly.hxx.

References IsAnyFrame(), and m_bOn.

Referenced by SwTextFrame::CalcLineSpace(), SwTextFrame::PaintSwFrame(), and SwTextFrame::Prepare().

◆ SetIgnoreContour()

void SwTextFly::SetIgnoreContour ( bool  bNew)
inline

Definition at line 379 of file txtfly.hxx.

References mbIgnoreContour.

Referenced by SwTextFrame::CalcBaseOfstForFly().

◆ SetIgnoreCurrentFrame()

void SwTextFly::SetIgnoreCurrentFrame ( bool  bNew)
inline

Definition at line 374 of file txtfly.hxx.

References mbIgnoreCurrentFrame.

Referenced by SwTextFrame::CalcBaseOfstForFly().

◆ SetIgnoreObjsInHeaderFooter()

void SwTextFly::SetIgnoreObjsInHeaderFooter ( const bool  bNew)
inline

Definition at line 384 of file txtfly.hxx.

References mbIgnoreObjsInHeaderFooter.

Referenced by SwTextFrame::CalcBaseOfstForFly().

◆ SetNextTop()

void SwTextFly::SetNextTop ( tools::Long  nNew) const
inline

Definition at line 364 of file txtfly.hxx.

References m_nNextTop.

Referenced by AnchoredObjToRect(), and CalcRightMargin().

◆ SetTopRule()

void SwTextFly::SetTopRule ( )
inline

Definition at line 321 of file txtfly.hxx.

References m_bTopRule.

Referenced by SwTextFrame::PaintEmpty(), and SwTextFrame::PaintSwFrame().

Member Data Documentation

◆ m_bOn

bool SwTextFly::m_bOn
private

◆ m_bTopRule

bool SwTextFly::m_bTopRule
private

Definition at line 137 of file txtfly.hxx.

Referenced by CtorInitTextFly(), DrawFlyRect(), DrawTextOpaque(), GetTop(), SetTopRule(), and SwTextFly().

◆ m_nCurrFrameNodeIndex

SwNodeOffset SwTextFly::m_nCurrFrameNodeIndex
private

Stores the upper edge of the "next" frame.

Definition at line 134 of file txtfly.hxx.

Referenced by CtorInitTextFly(), GetTop(), and SwTextFly().

◆ m_nMinBottom

tools::Long SwTextFly::m_nMinBottom
private

Definition at line 132 of file txtfly.hxx.

Referenced by CtorInitTextFly(), GetMinBottom(), InitAnchoredObjList(), and SwTextFly().

◆ m_nNextTop

tools::Long SwTextFly::m_nNextTop
private

Definition at line 133 of file txtfly.hxx.

Referenced by CalcRightMargin(), CtorInitTextFly(), GetNextTop(), SetNextTop(), and SwTextFly().

◆ m_pCurrFrame

const SwTextFrame* SwTextFly::m_pCurrFrame
private

◆ m_pMaster

const SwTextFrame* SwTextFly::m_pMaster
private

Definition at line 129 of file txtfly.hxx.

Referenced by CtorInitTextFly(), GetMaster(), GetMaster_(), and SwTextFly().

◆ m_pPage

const SwPageFrame* SwTextFly::m_pPage
private

◆ mbIgnoreContour

bool SwTextFly::mbIgnoreContour
private

Definition at line 139 of file txtfly.hxx.

Referenced by AnchoredObjToRect(), CtorInitTextFly(), SetIgnoreContour(), and SwTextFly().

◆ mbIgnoreCurrentFrame

bool SwTextFly::mbIgnoreCurrentFrame
private

Definition at line 138 of file txtfly.hxx.

Referenced by CtorInitTextFly(), ForEach(), SetIgnoreCurrentFrame(), and SwTextFly().

◆ mbIgnoreObjsInHeaderFooter

bool SwTextFly::mbIgnoreObjsInHeaderFooter
private

boolean, indicating if objects in page header|footer are considered for text frames not in page header|footer.

Definition at line 144 of file txtfly.hxx.

Referenced by CtorInitTextFly(), InitAnchoredObjList(), SetIgnoreObjsInHeaderFooter(), and SwTextFly().

◆ mpAnchoredObjList

std::unique_ptr<SwAnchoredObjList> SwTextFly::mpAnchoredObjList
private

Definition at line 130 of file txtfly.hxx.

Referenced by GetAnchoredObjList(), GetMinBottom(), GetPos(), InitAnchoredObjList(), and SwTextFly().

◆ mpCurrAnchoredObj

const SwAnchoredObject* SwTextFly::mpCurrAnchoredObj
private

The documentation for this class was generated from the following files: