xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arved Sandstrom <Arved...@chebucto.ns.ca>
Subject Re: Page and Column Breaks
Date Wed, 27 Dec 2000 22:54:35 GMT
On Wed, 27 Dec 2000, Keiron Liddle wrote:

> I have implemented some footnotes. I'm still considering how best to 
> handle some of the things.
> The basic concepts are:
> - have a footnote element, this simply does a layout of the contained 
> inline part to the current area.
> - the footnote body simply holds the block(s) of the footnote text.
> - since the current line being added to the layout is not yet added then 
> add the footnote body to the block area so that it can add the pending 
> footnotes to the footnote area after it adds the current line.
> - if a footnote does not fit on the current page then add the footnote 
> to the pending footnotes for the page
> - the page sequence then transfers pending footnotes to the next page it 
> creates, the new page immediately adds the pending footnotes.
> I'm not sure if I am doing some things the right way and it gets a bit 
> confusing trying to organise the max heights of the various areas (added 
> or not added etc.)

Hi, Keiron

I took a looksee. What I would suggest is, the infrastructure is already set up
in BodyAreaContainer.java. This area represents the region-body reference area,
and is responsible for maintaining 3 child areas - one for the main reference
area, and one each for optional before-floats and footnotes.

You can access the BodyAreaContainer (BAC) via the Page - there is a
blockArea.setPage(area.getPage()) inside the layout() method for Block.java,
for example. The method getFootnoteReferenceArea() in BodyAreaContainer returns
the AreaContainer for footnotes. Once this is obtained, I would suggest laying
out the footnote separator (if present) and the footnote-body into the
footnoteRefArea AreaContainer, getting that resulting height, and seeing if the
remaining height available to the main-reference-area can be borrowed from. The
BAC method getRemainingHeight() may even work already to give you that number.
:-) In fact, to make this work, you will need to have the available height
already assigned to the footnoteReferenceArea as its maxHeight, and then it's a
question of looking at the content height after layout. The maxHeight of the
footnoteRefArea would need to be trimmed before installing it into the BAC.

If the footnote reference area will fit, it can be installed at
footnoteRefAreaYPosition += footnoteRefArea.getContentHeight(), and that much
space subtracted from the maxHeight of the main-reference-area. The variable
footnoteRefAreaYPosition is initially set to be at the bottom of the
region-reference-area, reflecting a zero-height footnoteRefArea.

If it won't fit, then your existing mechanism can be used to carry over to the
next page. We can ensure that before anything else is laid out on a page (in
the region-reference-area, that is), that any pending footnotes get laid out
first. A possible hook to do this is via Flow, which has access to the BAC very
easily, and can be passed in the pending footnotes from PageSequence. I won't
speculate further on this at the moment, but it ought to be doable without too
much agony. 

This is simplistic, and it certainly doesn't account for humungous footnotes. I
think that a more complicated algorithm for footnote continuation can maybe
wait, though. :-)

This will make more sense if you walk through the code in BodyAreaContainer, I
think. Please ask if you have any questions.

Regards, Arved

View raw message