aboutsummaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorarved <arved@unknown>2001-07-17 03:16:29 +0000
committerarved <arved@unknown>2001-07-17 03:16:29 +0000
commitbd80a07ca213125986d1c98ea03f422542c4caf0 (patch)
tree2e9bf396d050abb093adfc7c56bc3e931b1e3dbd /src/org
parent20c03ca3c9b9a0492cc780292f01c64aa3098b36 (diff)
downloadxmlgraphics-fop-bd80a07ca213125986d1c98ea03f422542c4caf0.tar.gz
xmlgraphics-fop-bd80a07ca213125986d1c98ea03f422542c4caf0.zip
AHS: improving area information
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194357 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-rw-r--r--src/org/apache/fop/fo/flow/FootnoteBody.java3
-rw-r--r--src/org/apache/fop/fo/flow/Marker.java1
-rw-r--r--src/org/apache/fop/fo/flow/StaticContent.java3
-rw-r--r--src/org/apache/fop/layout/Area.java8
-rw-r--r--src/org/apache/fop/layout/AreaContainer.java12
-rw-r--r--src/org/apache/fop/layout/BodyAreaContainer.java3
-rw-r--r--src/org/apache/fop/layout/ColumnArea.java1
-rw-r--r--src/org/apache/fop/render/xml/XMLRenderer.java36
8 files changed, 62 insertions, 5 deletions
diff --git a/src/org/apache/fop/fo/flow/FootnoteBody.java b/src/org/apache/fop/fo/flow/FootnoteBody.java
index 4b5e95c6c..38e1fdb14 100644
--- a/src/org/apache/fop/fo/flow/FootnoteBody.java
+++ b/src/org/apache/fop/fo/flow/FootnoteBody.java
@@ -54,6 +54,7 @@ package org.apache.fop.fo.flow;
// 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.*;
@@ -85,6 +86,7 @@ public class FootnoteBody extends FObj {
throws FOPException {
super(parent, propertyList);
this.name = "fo:footnote-body";
+ this.areaClass = AreaClass.setAreaClass(AreaClass.XSL_FOOTNOTE);
}
public Status layout(Area area) throws FOPException {
@@ -96,6 +98,7 @@ public class FootnoteBody extends FObj {
area.getAllocationWidth(),
area.spaceLeft(), startIndent, endIndent, textIndent,
align, alignLast, lineHeight);
+ blockArea.generatedBy = this;
blockArea.setPage(area.getPage());
blockArea.start();
diff --git a/src/org/apache/fop/fo/flow/Marker.java b/src/org/apache/fop/fo/flow/Marker.java
index 627d98542..1b9ad20e7 100644
--- a/src/org/apache/fop/fo/flow/Marker.java
+++ b/src/org/apache/fop/fo/flow/Marker.java
@@ -50,6 +50,7 @@ public class Marker extends FObjMixed {
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);
diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java
index 154e90025..4d0069163 100644
--- a/src/org/apache/fop/fo/flow/StaticContent.java
+++ b/src/org/apache/fop/fo/flow/StaticContent.java
@@ -62,6 +62,9 @@ public class StaticContent extends Flow {
}
+ 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)) {
diff --git a/src/org/apache/fop/layout/Area.java b/src/org/apache/fop/layout/Area.java
index fc10ebf06..c25a7cbf5 100644
--- a/src/org/apache/fop/layout/Area.java
+++ b/src/org/apache/fop/layout/Area.java
@@ -361,6 +361,10 @@ abstract public class Area extends Box {
return bp;
}
+ public void addMarker(Marker marker) {
+ markers.addElement(marker);
+ }
+
public void addMarkers(Vector markers) {
markers.addAll(markers);
}
@@ -368,4 +372,8 @@ abstract public class Area extends Box {
public void addLineagePair(org.apache.fop.fo.FObj fo, int areaPosition) {
returnedBy.put(fo, new Integer(areaPosition));
}
+
+ public Vector getMarkers() {
+ return markers;
+ }
}
diff --git a/src/org/apache/fop/layout/AreaContainer.java b/src/org/apache/fop/layout/AreaContainer.java
index 0ceb5c249..e15a8ca61 100644
--- a/src/org/apache/fop/layout/AreaContainer.java
+++ b/src/org/apache/fop/layout/AreaContainer.java
@@ -20,6 +20,10 @@ public class AreaContainer extends Area {
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) {
@@ -63,4 +67,12 @@ public class AreaContainer extends Area {
public void shiftYPosition(int value) {
yPosition += value;
}
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
}
diff --git a/src/org/apache/fop/layout/BodyAreaContainer.java b/src/org/apache/fop/layout/BodyAreaContainer.java
index 67df63d7d..7aa5fde1f 100644
--- a/src/org/apache/fop/layout/BodyAreaContainer.java
+++ b/src/org/apache/fop/layout/BodyAreaContainer.java
@@ -68,13 +68,16 @@ public class BodyAreaContainer extends Area {
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
diff --git a/src/org/apache/fop/layout/ColumnArea.java b/src/org/apache/fop/layout/ColumnArea.java
index 24530f1fa..e5e24181b 100644
--- a/src/org/apache/fop/layout/ColumnArea.java
+++ b/src/org/apache/fop/layout/ColumnArea.java
@@ -25,6 +25,7 @@ public class ColumnArea extends AreaContainer {
super(fontState, xPosition, yPosition, allocationWidth,
maxHeight, Position.ABSOLUTE);
this.maxColumns = columnCount;
+ this.setAreaName("normal-flow-ref.-area");
}
public void render(Renderer renderer) {
diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java
index 9f47e8787..405e7a04e 100644
--- a/src/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/org/apache/fop/render/xml/XMLRenderer.java
@@ -149,7 +149,7 @@ public class XMLRenderer implements 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();
@@ -194,9 +194,35 @@ public class XMLRenderer implements Renderer {
* @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();
@@ -310,7 +336,7 @@ public class XMLRenderer implements Renderer {
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();