// FOP
import org.apache.fop.fo.*;
import org.apache.fop.layout.Area;
+import org.apache.fop.layout.AreaClass;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
throws FOPException {
super(parent, propertyList);
this.name = "fo:footnote-body";
+ this.areaClass = AreaClass.setAreaClass(AreaClass.XSL_FOOTNOTE);
}
public Status layout(Area area) throws FOPException {
area.getAllocationWidth(),
area.spaceLeft(), startIndent, endIndent, textIndent,
align, alignLast, lineHeight);
+ blockArea.generatedBy = this;
blockArea.setPage(area.getPage());
blockArea.start();
public Status layout(Area area) throws FOPException {
// no layout action desired
this.registryArea = area;
+ area.addMarker(this);
area.getPage().registerMarker(this);
// System.out.println("Marker being registered in area '" + area + "'");
return new Status(Status.OK);
}
+ if (area instanceof org.apache.fop.layout.AreaContainer)
+ ((org.apache.fop.layout.AreaContainer)area).setAreaName(regionClass);
+
if (regionClass.equals(RegionBefore.REGION_CLASS)) {
area.setAbsoluteHeight(-area.getMaxHeight());
} else if (regionClass.equals(RegionAfter.REGION_CLASS)) {
return bp;
}
+ public void addMarker(Marker marker) {
+ markers.addElement(marker);
+ }
+
public void addMarkers(Vector markers) {
markers.addAll(markers);
}
public void addLineagePair(org.apache.fop.fo.FObj fo, int areaPosition) {
returnedBy.put(fo, new Integer(areaPosition));
}
+
+ public Vector getMarkers() {
+ return markers;
+ }
}
private int yPosition; // should be able to take value 'top' and 'bottom' too
private int position;
+ // use this for identifying the general usage of the area,
+ // like 'main-reference-area' or 'region-before'
+ private String areaName;
+
public AreaContainer(FontState fontState, int xPosition,
int yPosition, int allocationWidth, int maxHeight,
int position) {
public void shiftYPosition(int value) {
yPosition += value;
}
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
}
mainRefAreaHeight = maxHeight - beforeFloatRefAreaHeight - footnoteRefAreaHeight;
beforeFloatReferenceArea = new AreaContainer(fontState, xPosition, yPosition,
allocationWidth, beforeFloatRefAreaHeight, Position.ABSOLUTE);
+ beforeFloatReferenceArea.setAreaName("before-float-reference-area");
this.addChild(beforeFloatReferenceArea);
mainReferenceArea = new AreaContainer(fontState, xPosition, yPosition,
allocationWidth, mainRefAreaHeight, Position.ABSOLUTE);
+ mainReferenceArea.setAreaName("main-reference-area");
this.addChild(mainReferenceArea);
int footnoteRefAreaYPosition = yPosition - mainRefAreaHeight;
footnoteReferenceArea = new AreaContainer(fontState, xPosition, footnoteRefAreaYPosition,
allocationWidth, footnoteRefAreaHeight, Position.ABSOLUTE);
+ footnoteReferenceArea.setAreaName("footnote-reference-area");
this.addChild(footnoteReferenceArea);
// all padding and border-width must be 0
super(fontState, xPosition, yPosition, allocationWidth,
maxHeight, Position.ABSOLUTE);
this.maxColumns = columnCount;
+ this.setAreaName("normal-flow-ref.-area");
}
public void render(Renderer renderer) {
* @param area the area container to render
*/
public void renderAreaContainer(AreaContainer area) {
- writeStartTag("<AreaContainer>");
+ writeStartTag("<AreaContainer name=\"" + area.getAreaName() + "\">");
Enumeration e = area.getChildren().elements();
while (e.hasMoreElements()) {
Box b = (Box) e.nextElement();
* @param area the block area to render
*/
public void renderBlockArea(BlockArea area) {
- writeStartTag("<BlockArea start-indent=\"" +
- area.getStartIndent() + "\" end-indent=\"" +
- area.getEndIndent() + "\">");
+ StringBuffer baText = new StringBuffer();
+ baText.append("<BlockArea start-indent=\"" + area.getStartIndent() + "\"");
+ baText.append(" end-indent=\"" + area.getEndIndent() + "\"");
+ baText.append("\nis-first=\"" + area.isFirst + "\"");
+ baText.append(" is-last=\"" + area.isLast + "\"");
+ if (null != area.generatedBy)
+ baText.append(" generated-by=\"" + area.generatedBy.getName() +
+ "//" + area.generatedBy + "\"");
+ baText.append(">");
+ writeStartTag(baText.toString());
+
+ // write out marker info
+ java.util.Vector markers = area.getMarkers();
+ if (!markers.isEmpty()) {
+ writeStartTag("<Markers>");
+ for (int m = 0; m < markers.size(); m++) {
+ org.apache.fop.fo.flow.Marker marker =
+ (org.apache.fop.fo.flow.Marker)markers.elementAt(m);
+ StringBuffer maText = new StringBuffer();
+ maText.append("<Marker marker-class-name=\"" +
+ marker.getMarkerClassName() + "\"");
+ maText.append(" RegisteredArea=\"" +
+ marker.getRegistryArea() + "\"");
+ maText.append("/>");
+ writeEmptyElementTag(maText.toString());
+ }
+ writeEndTag("</Markers>");
+ }
+
Enumeration e = area.getChildren().elements();
while (e.hasMoreElements()) {
Box b = (Box) e.nextElement();
public void renderPage(Page page) {
BodyAreaContainer body;
AreaContainer before, after;
- writeStartTag("<Page number=\"" + page.getNumber() + "\">");
+ writeStartTag("<Page number=\"" + page.getFormattedNumber() + "\">");
body = page.getBody();
before = page.getBefore();
after = page.getAfter();