namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
namespace sw::mark { class MarkBase; } namespace sw { enumclass ParagraphBreakMode; } class SwCharRange; class SwTextNode; class SwTextAttrEnd; class SwTextFormatter; class SwTextFormatInfo; class SwParaPortion; class WidowsAndOrphans; class SwTextFootnote; class SwInterHyphInfo; // Hyphenate() class SwCache; class SwFrameFormat; struct SwCursorMoveState; struct SwFillData; class SwPortionHandler; class SwScriptInfo; enumclass ExpandMode; class SwTextAttr; class SwWrtShell; class SwNode; class SwNodeIndex; class SwFlyAtContentFrame;
/// a clone of SwInterHyphInfo, but with TextFrameIndex instead of node index class SwInterHyphInfoTextFrame
{ private: /// output: hyphenated word
css::uno::Reference<css::linguistic2::XHyphenatedWord> m_xHyphWord; public: /// input: requested range to hyphenate
TextFrameIndex m_nStart;
TextFrameIndex m_nEnd; /// output: found word
TextFrameIndex m_nWordStart;
TextFrameIndex m_nWordLen;
// warning: Existing must be used only once; a second use would delete the frame created by the first one... enumclass FrameMode { New, Existing };
std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode);
SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, sw::FrameMode eMode);
/// Represents the visualization of a paragraph. Typical upper is an /// SwBodyFrame. The first text portion of the first line is az SwParaPortion. class SW_DLLPUBLIC SwTextFrame final : public SwContentFrame
{ friendclass SwTextIter; friendclass SwTestFormat; friendclass WidowsAndOrphans; friendclass TextFrameLockGuard; // May Lock()/Unlock() friendbool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew);
/// SwLineLayout cache: the lines are not actually owned by the SwTextFrame /// but by this SwCache, so they will be deleted in large documents /// if there are too many of them, but the "valid" flags of the frame /// will still be set; GetFormatted() is the function that forces /// recreation of the SwLineLayout by Format() if necessary. static SwCache *s_pTextCache;
sal_Int32 mnAllLines :24; // Line count for the Paint (including nThisLines)
sal_Int32 mnThisLines :8; // Count of Lines of the Frame
// The x position for flys anchored at this paragraph. // These values are calculated in SwTextFrame::CalcBaseOfstForFly()
SwTwips mnFlyAnchorOfst; // The x position for wrap-through flys anchored at this paragraph.
SwTwips mnFlyAnchorOfstNoWrap; /// The y position for wrap-through flys anchored at this paragraph.
SwTwips mnFlyAnchorVertOfstNoWrap;
SwTwips mnFootnoteLine; // OD 2004-03-17 #i11860# - re-factoring of #i11859# // member for height of last line (value needed for proportional line spacing)
SwTwips mnHeightOfLastLine; // member for the additional first line offset, which is caused by the list // label alignment for list level position and space mode LABEL_ALIGNMENT. // This additional first line offset is used for the text formatting. // It is NOT used for the determination of printing area.
SwTwips mnAdditionalFirstLineOffset;
/// redline merge data
std::unique_ptr<sw::MergedPara> m_pMergedPara;
TextFrameIndex mnOffset; // Is the offset in the Content (character count)
TextFrameIndex mnNoHyphOffset; // Is the offset of the last line with disabled or limited hyphenation
sal_Int16 mnNoHyphEndZone; // size of end zone (-1 means disabled hyphenation)
sal_uInt16 mnCacheIndex; // Index into the cache, USHRT_MAX if there's definitely no fitting object in the cache
// Separates the Master and creates a Follow or adjusts the data in the Follow void AdjustFollow_( SwTextFormatter &rLine, TextFrameIndex nOffset,
TextFrameIndex nStrEnd, bool bDontJoin );
// Iterates all Lines and sets the line spacing using the attribute void CalcLineSpace();
// Only called in Format void AdjustFrame( const SwTwips nChgHeight, bool bHasToFit = false );
bool mbLocked : 1; // In the Format? bool mbWidow : 1; // Is our follow a Widow? bool mbJustWidow : 1; // Did we just request Widow flag on master? bool mbEmpty : 1; // Are we an empty paragraph? bool mbInFootnoteConnect : 1; // Is in Connect at the moment bool mbFootnote : 1; // Has at least one footnote bool mbRepaint : 1; // TextFrame: Repaint is ready to be fetched /// Contains rotated portions. bool mbHasRotatedPortions : 1; bool mbFieldFollow : 1; // Start with Field rest of the Master bool mbHasAnimation : 1; // Contains animated SwGrfNumPortion bool mbIsSwapped : 1; // during text formatting we swap the // width and height for vertical formatting // OD 14.03.2003 #i11760# - flag to control, if follow is formatted in // method <CalcFollow(..)>. // E.g., avoid formatting of follow, if method <SwLayoutFrame::FormatWidthCols(..)> // is running. bool mbFollowFormatAllowed : 1;
// Changes the Frame or not (cf. FlyCnt) bool GetModelPositionForViewPoint_(SwPosition *pPos, const Point &rPoint, constbool bChgFrame, SwCursorMoveState* = nullptr ) const; void FillCursorPos( SwFillData &rFill ) const;
// Format exactly one Line bool FormatLine( SwTextFormatter &rLine, constbool bPrev );
// In order to safe stack space, we split this method: // Format_ calls Format_ with parameters void FormatImpl( vcl::RenderContext* pRenderContext, SwParaPortion *pPara,
::std::vector<SwAnchoredObject *> & rIntersectingObjs); void Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf, constbool bAdjust = false ); void FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
// Formats the Follow and ensures disposing on orphans bool CalcFollow(TextFrameIndex nTextOfst);
virtualvoid MakePos() override;
// Corrects the position from which we need to format static TextFrameIndex FindBrk(std::u16string_view aText, TextFrameIndex nStart,
TextFrameIndex nEnd);
/** *WeformataLineforinteractivehyphenation *@returnfound
*/ bool Hyphenate(SwInterHyphInfoTextFrame & rInf); /// Is a hyphenated word? At selection, Point can be at the end of the word bool IsInHyphenatedWord(SwPaM *, bool bSelection) const;
/// Does the Frame have a local footnote (in this Frame or Follow)? #ifdef DBG_UTIL void CalcFootnoteFlag(TextFrameIndex nStop = TextFrameIndex(COMPLETE_STRING)); //For testing SplitFrame #else void CalcFootnoteFlag(); #endif
/// Removes the Line information from the Cache but retains the entry itself void ClearPara(); /// Removes this frame completely from the Cache void RemoveFromCache();
/// Am I a FootnoteFrame, with a number at the start of the paragraph? bool IsFootnoteNumFrame() const
{ return IsInFootnote() && !GetIndPrev() && IsFootnoteNumFrame_(); }
/// This text frame may have a split fly frames anchored to it. Is any of them a frame that has /// a follow, i.e. not the last in a master -> follow 1 -> ... -> last follow chain?
SwFlyAtContentFrame* HasNonLastSplitFlyDrawObj() const;
/// This text frame has a follow and the text frame don't contain text. Additionally one split /// fly is anchored to the text frame. bool IsEmptyMasterWithSplitFly() const;
/// This text frame is not split, doesn't fit the upper, has a single split fly anchored to it /// with a negative vertical offset. Such frames may need explicit splitting. bool IsEmptyWithSplitFly() const;
//use this to protect a SwTextFrame for a given scope from getting merged with //its neighbour and thus deleted class TextFrameLockGuard
{ private:
SwTextFrame *m_pTextFrame; bool m_bOldLocked; public: //Lock pFrame for the lifetime of the Cut/Paste call, etc. to avoid //SwTextFrame::AdjustFollow_ removing the pFrame we're trying to Make
TextFrameLockGuard(SwFrame* pFrame)
{
m_pTextFrame = pFrame->IsTextFrame() ? static_cast<SwTextFrame*>(pFrame) : nullptr; if (m_pTextFrame)
{
m_bOldLocked = m_pTextFrame->IsLocked();
m_pTextFrame->Lock();
} else
{
m_bOldLocked = false;
}
}
~TextFrameLockGuard()
{ if (m_pTextFrame && !m_bOldLocked)
m_pTextFrame->Unlock();
}
};
/** *Describespartsofmultipletextnodes,whichwillformatextframe,even *whenredlinesarehiddenatalayoutlevel.
*/ struct MergedPara
{
sw::WriterMultiListener listener;
std::vector<Extent> extents; /// note: cannot be const currently to avoid UB because SwTextGuess::Guess /// const_casts it and modifies it (also, Update will modify it)
OUString mergedText; /// most paragraph properties are taken from the first non-empty node
SwTextNode * pParaPropsNode; /// except break attributes, those are taken from the first node
SwTextNode *const pFirstNode; /// mainly for sanity checks
SwTextNode const* pLastNode;
MergedPara(SwTextFrame & rFrame, std::vector<Extent>&& rExtents,
OUString aText,
SwTextNode *const pFirst,
SwTextNode const*const pLast)
: listener(rFrame), extents(std::move(rExtents)), mergedText(std::move(aText))
, pParaPropsNode(nullptr), pFirstNode(pFirst), pLastNode(pLast)
{
assert(pFirstNode);
assert(pLastNode);
}
};
/// iterate SwTextAttr in potentially merged text frame class MergedAttrIterBase
{ protected:
sw::MergedPara const*const m_pMerged;
SwTextNode const*const m_pNode;
size_t m_CurrentExtent;
size_t m_CurrentHint;
MergedAttrIterBase(SwTextFrame const& rFrame);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.