You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by fo...@locus.apache.org on 2000/06/18 23:05:08 UTC
cvs commit: xml-fop/src/org/apache/fop/fo/pagination Root.java
fotis 00/06/18 14:05:08
Modified: src/codegen properties.xml
src/org/apache/fop/fo FONode.java FObj.java
PropertyListBuilder.java
StandardElementMapping.java
src/org/apache/fop/fo/flow Block.java StaticContent.java
src/org/apache/fop/fo/pagination Root.java
Log:
adds support for page-number-citation (limitation: works only for reversed referenced
blocks). Contributed by Mike Crowe.
Revision Changes Path
1.10 +17 -1 xml-fop/src/codegen/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/properties.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- properties.xml 2000/05/23 20:44:15 1.9
+++ properties.xml 2000/06/18 21:05:06 1.10
@@ -303,7 +303,7 @@
<class-name>HRef</class-name>
<inherited>false</inherited>
<datatype>String</datatype>
- <default></default>
+ <default></default>
</property>
<property>
<name>column-width</name>
@@ -799,5 +799,21 @@
<datatype>String</datatype>
<default>auto</default>
</property>
+ <property>
+ <name>ref-id</name>
+ <class-name>RefId</class-name>
+ <inherited>false</inherited>
+ <datatype>String</datatype>
+ <default></default>
+ </property>
+ <property>
+ <name>id</name>
+ <class-name>Id</class-name>
+ <inherited>false</inherited>
+ <datatype>String</datatype>
+ <default></default>
+ </property>
+
+
</property-list>
1.9 +16 -2 xml-fop/src/org/apache/fop/fo/FONode.java
Index: FONode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FONode.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FONode.java 1999/12/03 09:38:56 1.8
+++ FONode.java 2000/06/18 21:05:06 1.9
@@ -1,4 +1,4 @@
-/*-- $Id: FONode.java,v 1.8 1999/12/03 09:38:56 jtauber Exp $ --
+/*-- $Id: FONode.java,v 1.9 2000/06/18 21:05:06 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -65,8 +65,9 @@
abstract public class FONode {
protected FObj parent;
- protected Vector children = new Vector();
+ public Vector children = new Vector(); // made public for searching for id's
+
/** value of marker before layout begins */
public final static int START = -1000;
@@ -199,4 +200,17 @@
abstract public Status layout(Area area)
throws FOPException;
+
+ /**
+ * lets outside sources access the property list
+ * first used by PageNumberCitation to find the "id" property
+ * returns null by default, overide this function when there is a property list
+ *@param name - the name of the desired property to obtain
+ * @returns the property
+ */
+ public Property getProperty(String name)
+ {
+ return(null);
+ }
+
}
1.7 +36 -2 xml-fop/src/org/apache/fop/fo/FObj.java
Index: FObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FObj.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FObj.java 1999/11/25 17:33:10 1.6
+++ FObj.java 2000/06/18 21:05:06 1.7
@@ -1,4 +1,4 @@
-/*-- $Id: FObj.java,v 1.6 1999/11/25 17:33:10 jtauber Exp $ --
+/*-- $Id: FObj.java,v 1.7 2000/06/18 21:05:06 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -75,7 +75,9 @@
return new Maker();
}
- protected PropertyList properties;
+// protected PropertyList properties;
+ public PropertyList properties;
+
protected String name;
protected FObj(FObj parent, PropertyList propertyList) {
@@ -92,7 +94,21 @@
// should always be overridden
return new Status(Status.OK);
}
+
+
+ /**
+ * performs layout tasks which are global to all layout objects
+ * all subclasses of FObj which override layout should call layoutStart
+ * @param area - the current area being layed out
+ */
+ public Status layoutStart(Area area)
+ {
+
+ pageNumber = area.getPage().getNumber();
+ return new Status(Status.OK);
+ }
+
public String getName() {
return this.name;
}
@@ -103,6 +119,24 @@
protected void end() {
// do nothing by default
+ }
+
+ /**
+ * lets outside sources access the property list
+ * first used by PageNumberCitation to find the "id" property
+ *@param name - the name of the desired property to obtain
+ * @returns the property
+ */
+ public Property getProperty(String name)
+ {
+ return(properties.get(name));
+ }
+
+ protected int pageNumber = -1;
+
+ public int getPageNumber()
+ {
+ return(pageNumber);
}
}
1.12 +4 -1 xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java
Index: PropertyListBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PropertyListBuilder.java 2000/04/16 01:36:26 1.11
+++ PropertyListBuilder.java 2000/06/18 21:05:07 1.12
@@ -1,4 +1,4 @@
-/*-- $Id: PropertyListBuilder.java,v 1.11 2000/04/16 01:36:26 arved Exp $ --
+/*-- $Id: PropertyListBuilder.java,v 1.12 2000/06/18 21:05:07 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -163,6 +163,9 @@
propertyTable.put("top",Top.maker());
propertyTable.put("width",Width.maker());
propertyTable.put("initial-page-number",InitialPageNumber.maker());
+ propertyTable.put("ref-id",RefId.maker()); // used by page-number-citation
+ propertyTable.put("id",Id.maker()); // attribute for objects, used by page-number-citation
+
}
public Property computeProperty(PropertyList propertyList, String propertyName) {
1.9 +2 -1 xml-fop/src/org/apache/fop/fo/StandardElementMapping.java
Index: StandardElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/StandardElementMapping.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StandardElementMapping.java 2000/04/21 19:35:52 1.8
+++ StandardElementMapping.java 2000/06/18 21:05:07 1.9
@@ -1,4 +1,4 @@
-/*-- $Id: StandardElementMapping.java,v 1.8 2000/04/21 19:35:52 gears Exp $ --
+/*-- $Id: StandardElementMapping.java,v 1.9 2000/06/18 21:05:07 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -88,6 +88,7 @@
ListItemLabel.maker());
builder.addMapping(uri, "list-item-body", ListItemBody.maker());
builder.addMapping(uri, "page-number", PageNumber.maker());
+ builder.addMapping(uri, "page-number-citation", PageNumberCitation.maker());
builder.addMapping(uri, "display-sequence",
DisplaySequence.maker());
builder.addMapping(uri, "inline-sequence",
1.11 +2 -1 xml-fop/src/org/apache/fop/fo/flow/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Block.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Block.java 2000/06/14 02:01:00 1.10
+++ Block.java 2000/06/18 21:05:07 1.11
@@ -1,4 +1,4 @@
-/*-- $Id: Block.java,v 1.10 2000/06/14 02:01:00 arved Exp $ --
+/*-- $Id: Block.java,v 1.11 2000/06/18 21:05:07 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -218,6 +218,7 @@
blockArea.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth);
blockArea.setBorderColor(borderColor, borderColor, borderColor, borderColor);
blockArea.start();
+ layoutStart(area); // performs
blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
1.8 +12 -2 xml-fop/src/org/apache/fop/fo/flow/StaticContent.java
Index: StaticContent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/StaticContent.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StaticContent.java 2000/06/16 19:24:01 1.7
+++ StaticContent.java 2000/06/18 21:05:07 1.8
@@ -1,4 +1,4 @@
-/*-- $Id: StaticContent.java,v 1.7 2000/06/16 19:24:01 gears Exp $ --
+/*-- $Id: StaticContent.java,v 1.8 2000/06/18 21:05:07 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -93,6 +93,7 @@
}
public Status layout(Area area) throws FOPException {
+
int numChildren = this.children.size();
// Set area absolute height so that link rectangles will be drawn correctly in xsl-before and xsl-after
String flowName = this.properties.get("flow-name").getString();
@@ -107,7 +108,16 @@
for (int i = 0; i < numChildren; i++) {
FObj fo = (FObj) children.elementAt(i);
- fo.layout(area);
+
+ Status status;
+ if ((status = fo.layout(area)).isIncomplete()) {
+ this.marker = i;
+ if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ status = new Status(Status.AREA_FULL_SOME);
+ }
+ return(status);
+ }
+// fo.layout(area);
}
resetMarker();
return new Status(Status.OK);
1.6 +74 -37 xml-fop/src/org/apache/fop/fo/pagination/Root.java
Index: Root.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Root.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Root.java 1999/11/22 02:31:39 1.5
+++ Root.java 2000/06/18 21:05:08 1.6
@@ -1,4 +1,4 @@
-/*-- $Id: Root.java,v 1.5 1999/11/22 02:31:39 jtauber Exp $ --
+/*-- $Id: Root.java,v 1.6 2000/06/18 21:05:08 fotis Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -52,58 +52,95 @@
// FOP
import org.apache.fop.fo.*;
+import org.apache.fop.fo.flow.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.AreaTree;
-import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOPException;
// Java
import java.util.Vector;
import java.util.Enumeration;
public class Root extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent, PropertyList propertyList)
- throws FOPException {
- return new Root(parent, propertyList);
+ public static class Maker extends FObj.Maker {
+ public FObj make(FObj parent, PropertyList propertyList) throws FOPException {
+ return new Root(parent, propertyList);
+ }
}
- }
- public static FObj.Maker maker() {
- return new Root.Maker();
- }
+ public static FObj.Maker maker()
+ {
+ return new Root.Maker();
+ }
- LayoutMasterSet layoutMasterSet;
- Vector pageSequences;
+ LayoutMasterSet layoutMasterSet;
+ Vector pageSequences;
+ Vector unresolvedCitations;
- protected Root(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
- this.name = "fo:root";
+ protected Root(FObj parent, PropertyList propertyList) throws FOPException
+ {
+ super(parent, propertyList);
+ this.name = "fo:root";
- pageSequences = new Vector();
- if (parent != null) {
- throw new FOPException("root must be root element");
- }
- }
-
- public void addPageSequence(PageSequence pageSequence) {
- this.pageSequences.addElement(pageSequence);
- }
+ pageSequences = new Vector();
+ if (parent != null)
+ {
+ throw new FOPException("root must be root element");
+ }
+ }
+
+
+ public void addPageSequence(PageSequence pageSequence)
+ {
+ this.pageSequences.addElement(pageSequence);
+ }
- public LayoutMasterSet getLayoutMasterSet() {
- return this.layoutMasterSet;
- }
+
+ public LayoutMasterSet getLayoutMasterSet()
+ {
+ return this.layoutMasterSet;
+ }
- public void format(AreaTree areaTree) throws FOPException {
- if (layoutMasterSet == null) {
- throw new FOPException("No layout master set.");
- }
- Enumeration e = pageSequences.elements();
- while (e.hasMoreElements()) {
- ((PageSequence) e.nextElement()).format(areaTree);
+
+ public void format(AreaTree areaTree) throws FOPException
+ {
+// System.err.println(" Root[" + marker + "] ");
+ if(layoutMasterSet == null)
+ {
+ throw new FOPException("No layout master set.");
+ }
+
+ Enumeration e = pageSequences.elements();
+ while (e.hasMoreElements())
+ {
+ ((PageSequence) e.nextElement()).format(areaTree);
+ }
+
+
+ if(unresolvedCitations != null)
+ {
+ Enumeration ec = unresolvedCitations.elements();
+ while( ec.hasMoreElements() )
+ {
+ ((PageNumberCitation)ec.nextElement()).resolvePageNumber();
+ }
+
+ // forward page number citations have been resolved here
+ // question now is how to apply this information to the document
+
+ }
+ }
+
+
+ public void addUnresolvedCitation(Object x)
+ {
+ if(unresolvedCitations == null)
+ {
+ unresolvedCitations = new Vector();
+ }
+ unresolvedCitations.add(x);
}
- }
+
public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) {
this.layoutMasterSet = layoutMasterSet;