Re: RFC: pt_PieceTable and headers/footers

Subject: Re: RFC: pt_PieceTable and headers/footers
From: Martin Sevior (
Date: Wed Oct 10 2001 - 02:52:03 CDT

On Wed, 10 Oct 2001, Matti Picus wrote:

> I am trying to implement RTF export of headers/footers. It seems to me
> that in general the internal representation of header/footers is not
> optimal. As far as I can tell, the pt_PieceTable holds a single dividing
> line in the form of a pf_Frag that delineates headers/footers from the main
> text.
> The problem arises when I need to know when the header/footer has
> ended. In short, I don't. I never recieve notification in the exporter
> that the header has finished. The exporter is left hanging in a way that it
> cannot close the document (clean up the stack of braces for RTF).
> In my case, the document looks like:
> Section | Block | Text | Text | Block | Text | Header | Block |Text | Block
> | Text
> I think it would be better if the document was structured as a recursive
> set of containers as in
> PieceTable
> |-Section --- Block---Text
> | | |-Text
> | |- Block---Text
> |-Header--- Block---Text
> |- Block---Text
> This would allow things like putting a different header in each section,
> and handling outline levels of a document, as well as trivializing the
> problem of knowing when the emission of a document portion has ended.

We already can have different headers in each section. I'm about 80% of
the way to giving us odd/even/first/last section types too.

I can load documents but with odd/even/first/last but I segfault on exit
currently. This should be fixed soon.

> Does anyone know what this change would involve?

Hi Matti,
         I don't want to do this. The current design gives us an easy
way to implement directly editable headers/footers because we can reuse
most of abi formatting capablities.

The piecetable is a linear linked list of fragments. You can tell a
section has an end by the presence of a new section. Headers and footer
are sections of specfic types. There can be a number of headers and
footers in the documents

They're always at the end of the piecetable.

There are actually different types of sections: Currently we have,
sections (Generic section frag)

section-doc (regular document sections)
Section-HdrFtr (Headers and Footers)
section-endnote (Endnotes)

In the future we will need section-cells, section-table, section-frame and
section-endcell, sectionendtable, section-endframe. So we can nest stuff.
With these constructs we can keep our current linear structure. That's
post 1.0 though.

The piecetable actually looks like this:


The header footers are always at the end of the document after all the

You might want to look at how the ie_exp_abiword-1.cpp program does this.
header/footer sections are just like regular sections but have a specific
type defined for them.

Look up the "type" attribute of a section frag to know if you've got a
header/footer. You can close off a section "{" when you encounter a new
section. The current rtf exporter does this already.



This archive was generated by hypermail 2b25 : Wed Oct 10 2001 - 02:52:12 CDT