namespace drawinglayer::processor2d { class BaseProcessor2D; }
class SwLayoutFrame; class SwRootFrame; class SwPageFrame; class SwColumnFrame; class SwBodyFrame; class SwFlyFrame; class SwSectionFrame; class SwFootnoteFrame; class SwFootnoteBossFrame; class SwTabFrame; class SwRowFrame; class SwContentFrame; class SwAttrSet; class Color; class SwBorderAttrs; class SwCache; class SvxBrushItem; class SvxFormatBreakItem; class SwFormatPageDesc; class SwSelectionList; struct SwPosition; struct SwCursorMoveState; class SwFormat; class SwSortedObjs; class SwAnchoredObject; enumclass SvxFrameDirection; class IDocumentDrawModelAccess; class SwTextFrame;
// Each FrameType is represented here as a bit. // The bits must be set in a way that it can be determined with masking of // which kind of FrameType an instance is _and_ from what classes it was derived. // Each frame has in its base class a member that must be set by the // constructors accordingly. enumclass SwFrameType
{
None = 0x0000,
Root = 0x0001,
Page = 0x0002,
Column = 0x0004,
Header = 0x0008,
Footer = 0x0010,
FootnoteContainer = 0x0020,
Footnote = 0x0040,
Body = 0x0080,
Fly = 0x0100,
Section = 0x0200, // UNUSED 0x0400
Tab = 0x0800,
Row = 0x1000,
Cell = 0x2000,
Txt = 0x4000,
NoTxt = 0x8000,
};
// for GetNextLeaf/GetPrevLeaf. enum MakePageType
{
MAKEPAGE_NONE, // do not create page/footnote
MAKEPAGE_APPEND, // only append page if needed
MAKEPAGE_INSERT, // add or append page if needed
MAKEPAGE_FTN, // add footnote if needed
MAKEPAGE_NOSECTION // Don't create section frames
};
/// Helper class to isolate geometry-defining members of SwFrame /// and to control their accesses. Moved to own class to have no /// hidden accesses to 'private' members anymore. /// /// Added most important flags about the state of this geometric /// information and if it is valid or not class SAL_DLLPUBLIC_RTTI SwFrameAreaDefinition
{ private: friendvoid FriendHackInvalidateRowFrame(SwFrameAreaDefinition &);
// The absolute position and size of the SwFrame in the document. // This values are set by the layouter implementations
SwRect maFrameArea;
// The 'inner' Frame Area defined by a SwRect relative to FrameArea: // When identical to FrameArea, Pos() will be (0, 0) and Size identical.
SwRect maFramePrintArea;
// read accesses to FrameArea definitions - only const access allowed. // Do *not* const_cast results, it is necessary to track changes. use // the below offered WriteAccess helper classes instead const SwRect& getFrameArea() const { return maFrameArea; } const SwRect& getFramePrintArea() const { return maFramePrintArea; }
// helper class(es) for FrameArea manipulation. These // have to be used to apply changes to FrameAreas. They hold a copy of the // SwRect for manipulation. It gets written back at destruction. Thus, this // mechanism depends on scope usage, take care. It prevents errors using // different instances of SwFrame in get/set methods which is more safe class FrameAreaWriteAccess : public SwRect
{ private:
SwFrameAreaDefinition& mrTarget;
// RotateFlyFrame3 - Support for Transformations // Hand out the Transformations for the current FrameAreaDefinition // for the FrameArea and FramePrintArea. // FramePrintArea is not relative to FrameArea in this // transformation representation (to make it easier to use and understand). // There is no 'set' method since SwFrame is a layout object. For // some cases rotation will be included (used for SwGrfNode in inner // SwFrame of a SwFlyFrame) virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const; virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const;
// RotateFlyFrame3 - Support for Transformations // Modify current transformations by applying given translation virtualvoid transform_translate(const Point& rOffset);
};
/// RotateFlyFrame3: Helper class when you want to make your SwFrame derivate /// transformable. It provides some tooling to do so. To use, add as member /// (see e.g. SwFlyFreeFrame which uses 'std::unique_ptr< TransformableSwFrame >') class TransformableSwFrame
{ private: // The SwFrameAreaDefinition to work on
SwFrameAreaDefinition& mrSwFrameAreaDefinition;
// FrameAreaTransformation and FramePrintAreaTransformation // !identity when needed (translate/scale is used (e.g. rotation))
basegfx::B2DHomMatrix maFrameAreaTransformation;
basegfx::B2DHomMatrix maFramePrintAreaTransformation;
// get SwFrameArea in transformation form const basegfx::B2DHomMatrix& getLocalFrameAreaTransformation() const
{ return maFrameAreaTransformation;
}
// get SwFramePrintArea in transformation form const basegfx::B2DHomMatrix& getLocalFramePrintAreaTransformation() const
{ return maFramePrintAreaTransformation;
}
// Helpers to re-create the untransformed SwRect(s) originally // in the SwFrameAreaDefinition, based on the current Transformations.
SwRect getUntransformedFrameArea() const;
SwRect getUntransformedFramePrintArea() const;
// Helper method to re-create FrameAreaTransformations based on the // current FrameAreaDefinition transformed by given rotation and Center void createFrameAreaTransformations( double fRotation, const basegfx::B2DPoint& rCenter);
// Tooling method to reset the SwRect(s) in the current // SwFrameAreaDefinition which are already adapted to // Transformation back to the untransformed state, using // the getUntransformedFrame*Area calls above when needed. // Only the SwRect(s) are changed back, not the transformations. void restoreFrameAreas();
// Re-Creates the SwRect(s) as BoundAreas based on the current // set Transformations. void adaptFrameAreasToTransformations();
// Modify current definitions by applying the given transformation void transform(const basegfx::B2DHomMatrix& aTransform);
};
// Possible reasons why SwFrame::Grow[Frame] failed to provide the requested growth enumclass SwResizeLimitReason
{
Unspecified, // no specific reason
FixedSizeFrame, // e.g., fixed-height table row; children must be clipped
FlowToFollow, // content must flow to a follow; includes next page, column, linked frames
BalancedColumns, // resize is performed by Format*, not by Grow*
};
/** *BaseclassoftheWriterlayoutelements. * *Thisincludesnotonlyflyframes,buteverythingdowntotheparagraph *level:pages,headers,footers,etc.(InsideaparagraphSwLinePortion *instancesareused.)
*/ class SAL_DLLPUBLIC_RTTI SwFrame : public SwFrameAreaDefinition, public SwClient, publicSfxBroadcaster
{ // the hidden Frame friendclass SwFlowFrame; friendclass SwLayoutFrame; friendclass SwLooping; friendclass SwDeletionChecker; // for GetDep()
// voids lower during creation of a column friend SwFrame *SaveContent( SwLayoutFrame *, SwFrame* pStart ); friendvoid RestoreContent( SwFrame *, SwLayoutFrame *, SwFrame *pSibling );
// for validating a mistakenly invalidated one in SwContentFrame::MakeAll friendvoid ValidateSz( SwFrame *pFrame ); // implemented in text/txtftn.cxx, prevents Footnote oscillation friendvoid ValidateText( SwFrame *pFrame );
// if true, frame will be painted completely even content was changed // only partially. For ContentFrames a border (from Action) will exclusively // painted if <mbCompletePaint> is true. bool mbCompletePaint : 1;
bool mbRetouche : 1; // frame is responsible for retouching
bool mbInfInvalid : 1; // InfoFlags are invalid bool mbInfBody : 1; // Frame is in document body bool mbInfTab : 1; // Frame is in a table bool mbInfFly : 1; // Frame is in a Fly bool mbInfFootnote : 1; // Frame is in a footnote bool mbInfSct : 1; // Frame is in a section bool mbColLocked : 1; // lock Grow/Shrink for column-wise section // or fly frames, will be set in Format bool m_isInDestroy : 1; int mnForbidDelete;
// Only used by SwRootFrame Ctor to get 'this' into mpRoot... void setRootFrame( SwRootFrame* pRoot ) { mpRoot = pRoot; }
SwPageFrame *InsertPage( SwPageFrame *pSibling, bool bFootnote ); void PrepareMake(vcl::RenderContext* pRenderContext); void OptPrepareMake(); /// Calculates the frame area position, in case it's invalid. The frame area size and the print /// area is not considered here. virtualvoid MakePos(); // Format next frame of table frame to assure keeping attributes. // In case of nested tables method <SwFrame::MakeAll()> is called to // avoid formatting of superior table frame. friend SwFrame* sw_FormatNextContentForKeep( SwTabFrame* pTabFrame );
virtualvoid MakeAll(vcl::RenderContext* pRenderContext) = 0; // adjust frames of a page
SwTwips AdjustNeighbourhood( SwTwips nDiff, bool bTst = false );
/// use these so we can grep for SwFrame's GetRegisteredIn accesses /// beware that SwTextFrame may return sw::WriterMultiListener
sw::BroadcastingModify* GetDep()
{ returnstatic_cast<sw::BroadcastingModify*>(GetRegisteredInNonConst()); } const sw::BroadcastingModify* GetDep() const
{ returnstatic_cast<const sw::BroadcastingModify*>(GetRegisteredIn()); }
// different methods for inserting in layout tree (for performance reasons)
// insert before pBehind or at the end of the chain below mpUpper void InsertBefore( SwLayoutFrame* pParent, SwFrame* pBehind ); // insert after pBefore or at the beginning of the chain below mpUpper void InsertBehind( SwLayoutFrame *pParent, SwFrame *pBefore ); // insert before pBehind or at the end of the chain while considering // the siblings of pSct bool InsertGroupBefore( SwFrame* pParent, SwFrame* pWhere, SwFrame* pSct ); void RemoveFromLayout();
// For internal use only - who ignores this will be put in a sack and has // to stay there for two days // Does special treatment for Get_[Next|Prev]Leaf() (for tables).
SwLayoutFrame *GetLeaf( MakePageType eMakePage, bool bFwd );
SwLayoutFrame *GetNextLeaf ( MakePageType eMakePage );
SwLayoutFrame *GetNextFootnoteLeaf( MakePageType eMakePage );
SwLayoutFrame *GetNextSctLeaf( MakePageType eMakePage );
SwLayoutFrame *GetNextFlyLeaf( MakePageType eMakePage );
SwLayoutFrame *GetNextCellLeaf();
SwLayoutFrame *GetPrevLeaf ();
SwLayoutFrame *GetPrevFootnoteLeaf( MakePageType eMakeFootnote );
SwLayoutFrame *GetPrevSctLeaf();
SwLayoutFrame *GetPrevFlyLeaf();
SwLayoutFrame *GetPrevCellLeaf(); const SwLayoutFrame *GetLeaf ( MakePageType eMakePage, bool bFwd, const SwFrame *pAnch ) const;
bool WrongPageDesc( SwPageFrame* pNew );
//#i28701# - new methods to append/remove drawing objects void AppendDrawObj( SwAnchoredObject& _rNewObj ); void RemoveDrawObj( SwAnchoredObject& _rToRemoveObj );
// work with chain of FlyFrames void AppendFly( SwFlyFrame *pNew ); void RemoveFly( SwFlyFrame *pToRemove ); const SwSortedObjs *GetDrawObjs() const { return m_pDrawObjs.get(); }
SwSortedObjs *GetDrawObjs() { return m_pDrawObjs.get(); } void SetDrawObjsAsDeleted( bool bDeleted ); // change tracking of objects anchored to character // #i28701# - change purpose of method and adjust its name void InvalidateObjs( constbool _bNoInvaOfAsCharAnchoredObjs = true );
// If frame is inside a split table row, this function returns // the corresponding row frame in the follow table. const SwRowFrame* IsInSplitTableRow() const;
// If frame is inside a follow flow row, this function returns // the corresponding row frame master table const SwRowFrame* IsInFollowFlowRow() const;
void CheckDirChange(); // returns upper left frame position for LTR and // upper right frame position for Asian / RTL frames
Point GetFrameAnchorPos( bool bIgnoreFlysAnchoredAtThisFrame ) const;
/** determine, if frame is moveable in given environment
// Is it permitted for the (Text)Frame to add a footnote in the current // environment (not e.g. for repeating table headlines) bool IsFootnoteAllowed() const;
/// Calculates the frame area size and the print area, in case they are invalid. /// The frame area position is not considered here. virtualvoid Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr );
virtualvoid CheckDirection( bool bVert );
void ReinitializeFrameSizeAttrFlags();
/// WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for /// SwTextFrame, use GetBreakItem()/GetPageDescItem() instead const SwAttrSet *GetAttrSet() const; virtualconst SvxFormatBreakItem& GetBreakItem() const; virtualconst SwFormatPageDesc& GetPageDescItem() const;
bool HasFixSize() const { return mbFixSize; }
// check all pages (starting from the given) and correct them if needed staticvoid CheckPageDescs( SwPageFrame *pStart, bool bNotifyFields = true, SwPageFrame** ppPrev = nullptr);
virtualvoid Calc(vcl::RenderContext* pRenderContext) const; // here might be "formatted" inlinevoid OptCalc() const; // here we assume (for optimization) that // the predecessors are already formatted
Point GetRelPos() const;
// PaintArea is the area where content might be displayed. // The margin of a page or the space between columns belongs to it.
SW_DLLPUBLIC SwRect GetPaintArea() const;
// UnionFrame is the union of Frame- and PrtArea, normally identical // to the FrameArea except in case of negative Prt margins.
SwRect UnionFrame( bool bBorder = false ) const;
virtual Size ChgSize( const Size& aNewSize );
virtualvoid Cut() = 0;
/// Inserts the current frame under pParent, before pSibling. /// /// If pSibling is nullptr, then insert under pParent, at the end. virtualvoid Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) = 0;
// HACK: shortcut between frame and formatting // It's your own fault if you cast void* incorrectly! In any case check // the void* for 0. virtualbool Prepare( const PrepareHint ePrep = PrepareHint::Clear, constvoid *pVoid = nullptr, bool bNotify = true );
// true if it is the correct class, false otherwise inlinebool IsLayoutFrame() const; inlinebool IsRootFrame() const; inlinebool IsPageFrame() const; inlinebool IsColumnFrame() const; inlinebool IsFootnoteBossFrame() const; // footnote bosses might be PageFrames or ColumnFrames inlinebool IsHeaderFrame() const; inlinebool IsFooterFrame() const; inlinebool IsFootnoteContFrame() const; inlinebool IsFootnoteFrame() const; inlinebool IsBodyFrame() const; inlinebool IsColBodyFrame() const; // implemented in layfrm.hxx, BodyFrame above ColumnFrame inlinebool IsPageBodyFrame() const; // implemented in layfrm.hxx, BodyFrame above PageFrame inlinebool IsFlyFrame() const; inlinebool IsSctFrame() const; inlinebool IsTabFrame() const; inlinebool IsRowFrame() const; inlinebool IsCellFrame() const; inlinebool IsContentFrame() const; inlinebool IsTextFrame() const;
SW_DLLPUBLIC SwTextFrame* DynCastTextFrame(); const SwTextFrame* DynCastTextFrame() const;
SW_DLLPUBLIC SwPageFrame* DynCastPageFrame(); const SwPageFrame* DynCastPageFrame() const;
SW_DLLPUBLIC SwColumnFrame* DynCastColumnFrame(); const SwColumnFrame* DynCastColumnFrame() const; inlinebool IsNoTextFrame() const; // Frames where its PrtArea depends on their neighbors and that are // positioned in the content flow inlinebool IsFlowFrame() const; // Frames that are capable of retouching or that might need to retouch behind // themselves inlinebool IsRetoucheFrame() const; inlinebool IsAccessibleFrame() const;
void PrepareCursor(); // CursorShell is allowed to call this
// Is the Frame (or the section containing it) protected? Same for Fly in // Fly in ... and footnotes bool IsProtected() const;
// NEW TABLES // Some functions for covered/covering table cells. This way unnecessary // includes can be avoided virtualbool IsLeaveUpperAllowed() const; virtualbool IsCoveredCell() const; bool IsInCoveredCell() const;
public: // if writer is NULL, dumps the layout structure as XML in layout.xml virtualvoid dumpAsXml(xmlTextWriterPtr writer = nullptr) const = 0; void dumpTopMostAsXml(xmlTextWriterPtr writer = nullptr) const; void dumpInfosAsXml(xmlTextWriterPtr writer) const; virtualvoid dumpAsXmlAttributes(xmlTextWriterPtr writer) const; void dumpChildrenAsXml(xmlTextWriterPtr writer) const; bool IsCollapse() const;
/// Determines if the upper margin of this frame should be ignored. bool IsCollapseUpper() const;
};
inlinevoid SwFrame::InvalidateInfFlags()
{
mbInfInvalid = true; if (IsLayoutFrame())
{ // If we are not sure about our flags, neither are lowers for (SwFrame* p = GetLower(); p; p = p->GetNext())
p->InvalidateInfFlags();
}
}
//use this to protect a SwFrame for a given scope from getting deleted class SwFrameDeleteGuard
{ private:
SwFrame *m_pForbidFrame; public: //Flag pFrame for SwFrameDeleteGuard lifetime that we shouldn't delete //it in e.g. SwSectionFrame::MergeNext etc because we will need it //again after the SwFrameDeleteGuard dtor explicit SwFrameDeleteGuard(SwFrame* pFrame)
: m_pForbidFrame(pFrame)
{ if (m_pForbidFrame)
m_pForbidFrame->ForbidDelete();
}
// This class allows to use proper methods regardless of orientation (LTR/RTL, horizontal or vertical) extern SwRectFn fnRectHori, fnRectVert, fnRectVertL2R, fnRectVertL2RB2T; class SwRectFnSet { public: explicit SwRectFnSet(const SwFrame* pFrame) { Refresh(pFrame); }
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.