AbiWord Layout Engine Design Overview

Copyright (C) 1999 AbiSource, Inc. All Rights Reserved.

Eric W. Sink, eric@abisource.com

AbiSource, Inc.

Introduction

This document gives an overview of the architecture and design of the AbiWord text layout engine. The sources for the engine live in the src/text/fmt/xp directory.

The layout engine manages two hierarchies, one of the actual document content (logical/content) and one of spatial objects which reprepresent the layout of a document (physical/layout) in a certain context (view).

This division is reflected in the class and filenames using prefixes:

fb_: Functions working on blocks [how to build the layout based on content rules?]

fg_: Graphical representation [images?]

fl_: Part of the logical hierarchy

fp_: Part of the physical hierarchy

fv_: View [describing the user's interaction-context with the document?]

The terms/components in these hierarchies are described below in this form:

<term> (class/filename): <description>

Document (fp_DocLayout): The formatted representation of a PD_Document for a specific GR_Graphics context. This class is the root of both hierarchies for a given document.

Content Hierarchy

[how is a document split up in these sub-constituents? Why?]

Document (fp_DocLayout): Contains a list of fl_SectionLayout objects.

Section (fl_SectionLayout): A Section is a portion of a document. It contains one or more blocks.

Block (fl_BlockLayout): A Block is a paragraph [of text].

Layout Hierarchy

Document (fl_DocLayout): A DocLayout contains one or more Pages.

Page (fp_Page): A Page represents a physical sheet of paper. Its dimensions are fixed (defined by fp_PageSize). A Page contains one or more Columns.

Column (fp_Column): A Column is a container into which text can be flowed. It is rectangular. A Column contains one or more Lines.

Line (fp_Line): A Line is a single line of text. A Line contains one or more Runs.

Run (fp_Run): A Run is a piece of content. Currently, all Runs contain text. All text within a Run must be of the same font and formatting information.

Multiple Columns

AbiWord supports multiple columns using a very simple model. Each Section specifies its column model as the number of columns, and the gap spacing between them. That model will be used for all content in the Section.