You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Mark C. Allman" <mc...@allmanpc.com> on 2003/02/04 20:02:23 UTC
(Re-post) Changes to maintenance release to support fo:marker
[Sorry to re-post this. I first had all files as attachments-too large
(109k > 100k). Then I put the test stuff into a zip file, but this
exceeded the fop-devel list max size (59k > 50k). So all are now in the
zip file.]
Attached is the "cvs diff" for all 22 files changed. Also attached (in
the zip file) is a test XSLFO file (mca.fo) and a pdf output run with my
modified code. The test files [all files now!] are in a zip file since
they'd be too large (together) to send (mailer-daemon limits to 100k
[fop-devel max is 50k]).
Notes on the changes:
These files just have a "mayContainMarker()" method added:
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableAndCaption.java
src/org/apache/fop/fo/flow/TableBody.java
src/org/apache/fop/fo/flow/TableCaption.java
src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableFooter.java
src/org/apache/fop/fo/flow/TableHeader.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/ListItemLabel.java
src/org/apache/fop/fo/flow/ListItemBody.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/Inline.java
src/org/apache/fop/fo/flow/Flow.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/BidiOverride.java
For src/org/apache/fop/fo/flow/RetrieveMarker.java
1. I cleaned the layout() method a bit. Just efficiencies--no bug
fixes.
2. Deleted the "locatePreviousPage()" method. Again, just an
efficiency edit.
3. In the "searchPage()" method I relaxed the search on the current
page for
the desired marker. Please correct me if I'm wrong, but the spec
appears
to say the "is-first" and "is-last" positional attributes are
preferences
and not exclusionary. So for example if we can't find a marker
that's
first but we can find the marker somewhere else on the page then
return what
we can, not "null/not found." I believe that's what the XSLFO spec
intends
but I could very well be wrong.
For src/org/apache/fop/fo/flow/Marker.java
1. Removed the method "mayPrecedeMarker()" since it is no longer used.
If
markers can contain markers (and it doesn't appear that they can)
then we
need to add a "mayContainMarker() {return true;}" method.
For src/org/apache/fop/fo/flow/AbstractTableBody.java
1. In the loop in the "layaout()" method where we process all child
nodes I
added a test for marker children. If the child node is a marker
just call
its layout method and continue to the next child node.
For src/org/apache/fop/apps/StreamRenderer.java
1. We need to keep a list of all pages. If a marker is referenced on a
later
page we need to be able to retrieve the marker value. We were
using the
page queue for this but as pages are rendered they're removed from
the
queue--not good if that removes a page with a marker we'll need
later. So
I added an ArrayList called "pagesList" to hold this list. This
might need
to be optimized to only save markers from previous pages but we also
need to
know things like page sequence so for now just save the entire page.
2. In the "queuePage()" method we also add the page to our list of
pages with
markers if the page has markers (obviously...).
3. In the "getPreviousPage()" method we switch from using the queued
pages list
to the "pagesWithMarkersList" list.
For src/org/apache/fop/fo/FObj.java
1. Added a method "addChild()" which checks if the child node to be
added is
a marker, and if it is checks that it can be added.
2. Cleaned up and added a javadoc header for the method "addMarker()."
Just an
efficiency change--no bug fix.
For src/org/apache/fop/fo/FONode.java
1. This is the base class where we defined the "mayContainMarker()"
method.
The inherited behavior for all nodes is "cannot contain markers,"
or "false."
Any node which can have markers as its initial children overrides
this to
return "true."
for src/org/apache/fop/fo/FOText.java
1. Commented out the "mayPrecedeMarker()" method, since it's no longer
used.
I didn't delete it because I want to keep it around just in case. I
still
need a test case which involves both Markers and FOText nodes.
Comments, criticisms, and feedback are encouraged.
-- Mark C. Allman
-- Allman Professional Consulting, Inc.
-- www.allmanpc.com <http://www.allmanpc.com/> , 617-947-4263