Writer/Core And Layout

From Apache OpenOffice Wiki
< Writer
Revision as of 13:02, 27 June 2007 by Ama (Talk | contribs)

Jump to: navigation, search

Caution

This page is still under construction hence the content is still very tentative.

About Frames

The layout is the visual representation of a Writer document. Basically a frame is a rectangular area which is linked with other frames:

Writer layout.png

The base class of the frame hierachy is SwFrm, which is derived from SwClient for inheriting the ability of being notified by changes.

SwFrm : SwClient
pRegisteredIn : SwModify*
pUpper : SwFrm*
pNext : SwFrm*
pPrev : SwFrm*
aFrm : SwRect
aPrt : SwRect
bValidPos : bool
bValidSize : bool
bValidPrtArea : bool

A layout frame has an additional member pLower, i.e., a layout frame is a frame that contains other frames. Incarnations of a layout frame are pages, tables, ...

SwLayoutFrm : SwFrm
pLower : SwFrm*

Some frames are not only derived from SwFrm, but also from SwFlowFrm. These are the frames that are allowed at page breaks and shall continue on the next page, e.g., paragraphs, tables, ...

SwFlowFrm
rThis : SwFrm&
pFollow : SwFlowFrm*

The most important frame is the SwTxtFrm, which is the layout counterpart a SwTxtNode object. The nOfst member referes to the aText string member of the associated SwTxtNode object. A SwTxtFrm object is registered in a SwTxtNode object in order to be notified in case the SwTxtNode object is changed.

SwTxtFrm : SwFrm
nOfst : xub_StrLen

A page frame additionally has a couple of boolean members to indicate if any of the page contents is invalid. These flags are used during formatting of the document.

SwPageFrm
bInvalidLayout : bool
bInvalidContent : bool
bInvalidFly : bool

Some Notes about Nodes

A SwDoc object, which denotes the model of a Writer document, has as member of Type SwNodes, which stores the document content. The SwNodes object of an empty Writer document looks like this:

SwStartNode	(special start-end-section, not used)
SwEndNode
SwStartNode	(special start-end-section used for footnotes)
SwEndNode
SwStartNode	(special start-end-section used for frames, headers, footers)
SwEndNode
SwStartNode	(special start-end-section used for 'delete' redlines if they are not shown)
SwEndNode
SwStartNode (special start-end-section for 'regular' document content)
	SwTxtNode	(there always at least one empty paragraph in the document)
SwEndNode
SwTxtNode : SwCntntNode
aText : string

Relationship between nodes and frames

An important base class of the Writer model is SwNode, an important base class of the Writer view is SwFrm.

What's the relationship between the classes derived from these?

SwTxtNode <-> SwTxtFrm
Every SwTxtFrm belongs to a SwTxtNode, a SwTxtFrm is a SwClient and is registered in a SwModify (the SwTxtNode!).
Some SwTxtNodes do not have related SwTxtFrms, e.g. if they are in a hidden section or a header of an unused page style.
Some SwTxtNodes have more than one corresponding SwTxtFrm, e.g. if they are in a header of a used page style or if the content did not fit into one page.

To be done:
SwTableNode <-> SwTabFrm
SwRowFrm
SwTableBoxStartNode <-> SwCellFrm
SwSectionNode <-> SwSectFrm
SwRootFrm
SwPageFrm
SwColumnFrm
etc.

Some UML Diagrams

Nodes

Writer nodes.png

Attributes

Writer attributes.png

Cursors

Writer cursors.png

Formats / Styles

Writer formats.png

Personal tools