View module in:   git

 

Writer Application Code

Exact history was lost before Sept. 18th, 2000, but old source code comments show that Writer core dates back until at least November 1990.

Module Contents

Source Contents

Core

There is a good overview documentation of basic architecture of Writer core in the OOo wiki:

Writer specific WhichIds are defined in sw/inc/hintids.hxx.

The details below are mainly about details missing from the wiki pages.

SwDoc

The central class for a document is SwDoc, which represents a document.

A lot of the functionality is split out into separate Manager classes, each of which implements some IDocument* interface; there are SwDoc::getIDocument*() methods to retrieve the managers.

However there are still too many members and methods in this class, many of which could be moved to some Manager or other…

SwNodes

Basically a (fancy) array of SwNode pointers. There are special subclasses of SwNode (SwStartNode and SwEndNode) which are used to encode a nested tree structure into the flat array; the range of nodes from SwStartNode to its corresponding SwEndNode is sometimes called a “section” (but is not necessarily what the high-level document model calls a “Section”; that is just one of the possibilities).

The SwNodes contains the following top-level sections:

  1. Empty
  2. Footnote content
  3. Frame / Header / Footer content
  4. Deleted Change Tracking content
  5. Body content

Undo

The Undo/Redo information is stored in a sw::UndoManager member of SwDoc, which implements the IDocumentUndoRedo interface. Its members include a SwNodes array containing the document content that is currently not in the actual document but required for Undo/Redo, and a stack of SwUndo actions, each of which represents one user-visible Undo/Redo step.

There are also ListActions which internally contain several individual SwUndo actions; these are created by the StartUndo/EndUndo wrapper methods.

Text Attributes

The sub-structure of paragraphs is stored in the SwpHintsArray member SwTextNode::m_pSwpHints. There is a base class SwTextAttr with numerous subclasses; the SwTextAttr has a start and end index and a SfxPoolItem to store the actual formatting attribute.

There are several sub-categories of SwTextAttr:

Fields

There are multiple model classes involved for fields:

Lists

Note that there is no UNO service to represent a list.

Layout

The layout is a tree of SwFrame subclasses, the following relationships are possible between frames: