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

 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
 
const SwTextFrameGetMaster () const
 
long GetNextTop () const
 
void SetNextTop (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 to be taken in account. More...
 
void SetIgnoreCurrentFrame (bool bNew)
 
void SetIgnoreContour (bool bNew)
 
void SetIgnoreObjsInHeaderFooter (const bool bNew)
 

Private Member Functions

SwRect GetFrame_ (const SwRect &rPortion) const
 This method will be called during the LineIter formatting. More...
 
SwAnchoredObjListInitAnchoredObjList ()
 
SwAnchoredObjListGetAnchoredObjList () const
 
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 SwPageFramepPage
 
const SwAnchoredObjectmpCurrAnchoredObj
 
const SwTextFramem_pCurrFrame
 
const SwTextFramem_pMaster
 
std::unique_ptr< SwAnchoredObjListmpAnchoredObjList
 
long nMinBottom
 
long nNextTop
 
sal_uLong m_nCurrFrameNodeIndex
 Stores the upper edge of the "next" frame. More...
 
bool bOn: 1
 
bool 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 119 of file txtfly.hxx.

Constructor & Destructor Documentation

SwTextFly::SwTextFly ( )

Definition at line 313 of file txtfly.cxx.

SwTextFly::SwTextFly ( const SwTextFrame pFrame)

Definition at line 330 of file txtfly.cxx.

References CtorInitTextFly().

SwTextFly::SwTextFly ( const SwTextFly rTextFly)
SwTextFly::~SwTextFly ( )

Definition at line 356 of file txtfly.cxx.

Member Function Documentation

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 1262 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().

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

The left margin is the left margin of the current PrintArea or it is determined by the last FlyFrame, which stands on the line.

Definition at line 1198 of file txtfly.cxx.

References SwContourCache::CalcBoundRect(), SwAnchoredObject::GetObjRectWithSpaces(), GetSurroundForTextWrap(), SwRect::IsOver(), SwTextFrame::IsSwapped(), SwFrame::IsVertical(), SwRect::Left(), m_pCurrFrame, mpCurrAnchoredObj, and size.

Referenced by AnchoredObjToRect().

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

The right margin is the right margin or it is determined by the next object standing on the line.

Definition at line 1109 of file txtfly.cxx.

References SwContourCache::CalcBoundRect(), GetSurroundForTextWrap(), SwRect::IsOver(), SwTextFrame::IsSwapped(), SwFrame::IsVertical(), m_pCurrFrame, mpCurrAnchoredObj, nNextTop, SetNextTop(), and size.

Referenced by AnchoredObjToRect().

void SwTextFly::CtorInitTextFly ( const SwTextFrame pFrame)
void SwTextFly::DrawFlyRect ( OutputDevice pOut,
const SwRect rRect 
)
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 453 of file txtfly.cxx.

References bOn, bTopRule, CH_BLANK, COMPLETE_STRING, SwFont::DrawStretchText_(), SwFont::DrawText_(), 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(), SwRect::IsOver(), SwNoTextFrame::IsTransparent(), SwLayoutFrame::Lower(), mpCurrAnchoredObj, pPage, SAL_MAX_UINT32, SwDrawTextInfo::SetPos(), size, Point::X(), and Point::Y().

Referenced by SwTextPaintInfo::DrawText_().

bool SwTextFly::ForEach ( const SwRect rRect,
SwRect pRect,
bool  bAvoid 
) const
private
SwAnchoredObjList * SwTextFly::GetAnchoredObjList ( ) const
inlineprivate

Definition at line 301 of file txtfly.hxx.

References InitAnchoredObjList(), and mpAnchoredObjList.

Referenced by DrawFlyRect(), DrawTextOpaque(), ForEach(), and GetPos().

SwRect SwTextFly::GetFrame ( const SwRect rPortion) const
inline
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 383 of file txtfly.cxx.

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

Referenced by GetFrame().

const SwTextFrame * SwTextFly::GetMaster ( ) const
inline
const SwTextFrame * SwTextFly::GetMaster_ ( )
private

Definition at line 445 of file txtfly.cxx.

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

Referenced by GetMaster().

SwTwips SwTextFly::GetMinBottom ( ) const
inline

Definition at line 336 of file txtfly.hxx.

References CalcMinBottom(), mpAnchoredObjList, and nMinBottom.

Referenced by SwTextFormatter::CalcBottomLine().

long SwTextFly::GetNextTop ( ) const
inline

Definition at line 346 of file txtfly.hxx.

References nNextTop.

Referenced by SwTextFormatter::CalcFlyWidth().

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

Definition at line 1099 of file txtfly.cxx.

References GetAnchoredObjList(), and mpAnchoredObjList.

Referenced by AnchoredObjToRect().

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 1327 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().

bool SwTextFly::GetTop ( const SwAnchoredObject _pAnchoredObj,
const bool  bInFootnote,
const bool  bInFooterOrHeader 
)
private
SwAnchoredObjList * SwTextFly::InitAnchoredObjList ( )
private
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 1404 of file txtfly.cxx.

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

bool SwTextFly::IsAnyFrame ( ) const

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

Definition at line 401 of file txtfly.cxx.

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

Referenced by Relax().

bool SwTextFly::IsAnyObj ( const SwRect rRect) const

true when a frame or DrawObj must to 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 412 of file txtfly.cxx.

References bOn, SwFrameAreaDefinition::getFrameArea(), SwFrameAreaDefinition::getFramePrintArea(), SwAnchoredObject::GetObjRect(), SwAnchoredObject::GetObjRectWithSpaces(), SwPageFrame::GetSortedObjs(), i, SwRect::IsEmpty(), SwRect::Left(), m_pCurrFrame, mpCurrAnchoredObj, SwRect::Pos(), pPage, SwRect::Right(), SwSortedObjs::size(), and SwRect::SSize().

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

bool SwTextFly::IsOn ( ) const
inline
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 318 of file txtfly.hxx.

References bOn, and IsAnyFrame().

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

bool SwTextFly::Relax ( )
inline

Definition at line 327 of file txtfly.hxx.

References bOn, and IsAnyFrame().

void SwTextFly::SetIgnoreContour ( bool  bNew)
inline

Definition at line 366 of file txtfly.hxx.

References mbIgnoreContour.

Referenced by SwTextFrame::CalcBaseOfstForFly().

void SwTextFly::SetIgnoreCurrentFrame ( bool  bNew)
inline

Definition at line 361 of file txtfly.hxx.

References mbIgnoreCurrentFrame.

Referenced by SwTextFrame::CalcBaseOfstForFly().

void SwTextFly::SetIgnoreObjsInHeaderFooter ( const bool  bNew)
inline

Definition at line 371 of file txtfly.hxx.

References mbIgnoreObjsInHeaderFooter.

Referenced by SwTextFrame::CalcBaseOfstForFly().

void SwTextFly::SetNextTop ( long  nNew) const
inline

Definition at line 351 of file txtfly.hxx.

References nNextTop.

Referenced by AnchoredObjToRect(), and CalcRightMargin().

void SwTextFly::SetTopRule ( )
inline

Definition at line 308 of file txtfly.hxx.

References bTopRule.

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

Member Data Documentation

bool SwTextFly::bOn
private
bool SwTextFly::bTopRule
private

Definition at line 132 of file txtfly.hxx.

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

sal_uLong SwTextFly::m_nCurrFrameNodeIndex
private

Stores the upper edge of the "next" frame.

Definition at line 129 of file txtfly.hxx.

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

const SwTextFrame* SwTextFly::m_pCurrFrame
private
const SwTextFrame* SwTextFly::m_pMaster
private

Definition at line 124 of file txtfly.hxx.

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

bool SwTextFly::mbIgnoreContour
private

Definition at line 134 of file txtfly.hxx.

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

bool SwTextFly::mbIgnoreCurrentFrame
private

Definition at line 133 of file txtfly.hxx.

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

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 139 of file txtfly.hxx.

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

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

Definition at line 125 of file txtfly.hxx.

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

const SwAnchoredObject* SwTextFly::mpCurrAnchoredObj
private
long SwTextFly::nMinBottom
private

Definition at line 127 of file txtfly.hxx.

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

long SwTextFly::nNextTop
private

Definition at line 128 of file txtfly.hxx.

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

const SwPageFrame* SwTextFly::pPage
private

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