commit: Alpha code to enable editting of Headers/Footers


Subject: commit: Alpha code to enable editting of Headers/Footers
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sun Dec 03 2000 - 05:03:12 CST


CVS:
----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: src/text/fmt/xp/fl_BlockLayout.cpp
CVS: src/text/fmt/xp/fl_DocListener.cpp
CVS: src/text/fmt/xp/fl_SectionLayout.cpp
CVS: src/text/fmt/xp/fl_SectionLayout.h src/text/fmt/xp/fp_Run.cpp
CVS: src/text/fmt/xp/fv_View.cpp src/text/fmt/xp/fv_View.h
CVS: src/text/ptbl/xp/pt_PT_InsertStrux.cpp
CVS:
----------------------------------------------------------------------
Alpha code to enable header/footer display and editting. Lots more work
required here but the basic code is now in place.

Before this commit there was NO code to enable headers and footers to be
entered via the GUI though they could if you knew how to edit *.abw files.

So here's a basic description of how Headers and Footers work in Abi.

You specify that a section has a header or footer associated with it by
speficiying the footer/header attribute in the section and give the
attribute a unique identifier.
Then somewhere in the document you must also speicy a HdrFtrSection with
type="header" ("footer") and the matching identifier.

In the file format this is represented by

<section footer="martin-id">
.
.
.
</section>
<section type="footer" id="martin-id">
<p PROPS="text-align:center"> <field type="page_number" />
</p>
</section>

OK all this works nicely in the Piece Table along with with everything
else else about the Piece Table. I have never found any bugs here.

However the code to actually allow editible headers/footers had not been
written yet. At things currently stand, it is not possible to specify
different types of sections that can be inserted via
m_pDoc->insertStrux(iPoint, PTX_Section).

What you have to do is to do the insertStrux then do a changeStruxFmt

        m_pDoc->changeStruxFmt(PTC_AddFmt, getPoint(), getPoint(),
sec_attributes1, NULL, PTX_Section);

With sec_attributes1 having "Type" "footer" attribute pair. This nicely
does the right thing in the piece table but the corresponding code to
convert a regualr sectionLayout to a HdrFrtSectionLayout had not been
written.

Now it has although it needs LOTS of work.

The designers of Abi envisioned headers and footers being implemented
in the layout code the following way.

There is an overall HdrFrtSectionLayout associated with each section
and a "shadow" HdrFrtSectionLayout associated with every page owned by
sectionLayout's asking for a header/footer with the matching identifier.

So working out from the piece table we have this structure.

pt_PieceTable
     |
     |
pd_Document
     |
     |
HdrFtrSectionLayout
     |
     ------------------------------------------------------
     | | |
  page 1 page 2 page 3
  pShadowLayout pShadowLayout pShadowLayout

PieceTable operations on our HdrFtrSection are transmitted to
HdrFtrSectionLayout which then updates the shadow layouts on every page.

In this way we have very flexible way of allowing fully editable headers
and footers that can be grouped per section. ie You can have different
header/footers in every section.

You can see the first results of this code by pressing cnrl-F12. You get
2 page numbers in the header. However every following page gets the page
numbers correct.

Anyway the header/footer/page number feature will definately be available
in the next release :-)

Cheers

martin



This archive was generated by hypermail 2b25 : Sun Dec 03 2000 - 05:03:25 CST