Make sure Makefiles work
Get images working
[PARTIAL] Incorporate Arved Sandstrom's simple-link implementation
-Switch to using Status object as return from layout()
-Implement basic keeps
+[DONE] Switch to using Status object as return from layout()
+[PARTIAL] Implement basic keeps
[DONE]Incorporate Eric Schaeffer's fix to tables in static-content
[DONE] Incorporate Kelly Campell's fixes to GifJpegImage
<datatype>Length</datatype>
<default>0pt</default>
</property>
+ <property>
+ <name>keep-with-next</name>
+ <class-name>KeepWithNext</class-name>
+ <inherited>false</inherited>
+ <datatype>
+ <enumeration>
+ <value const="TRUE">true</value>
+ <value const="FALSE">false</value>
+ </enumeration>
+ </datatype>
+ <default>false</default>
+ </property>
</property-list>
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
/**
* class representing the version of FOP.
*
- * added at the request of Stefano Mazzocchi for use by Fop.
+ * added at the request of Stefano Mazzocchi for use by Cocoon.
*/
public class Version {
* @return the version string
*/
public static String getVersion() {
- return "FOP 0.12.0pre5";
+ return "FOP 0.11.5";
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo;
// FOP
}
}
+ public void removeAreas() {
+ // still to do
+ }
+
protected void addChild(FONode child) {
children.addElement(child);
}
return this.parent;
}
- /* status */
- /* layout was fully completed */
- public final static int OK = 1;
- /* none of the formatting object could be laid out because the
- containing area was full (end of page) */
- public final static int AREA_FULL_NONE = 2;
- /* some of the formatting object could not be laid out because the
- containing area was full (end of page) */
- public final static int AREA_FULL_SOME = 3;
- /* force page break */
- public final static int FORCE_PAGE_BREAK = 4;
- public final static int FORCE_PAGE_BREAK_EVEN = 5;
- public final static int FORCE_PAGE_BREAK_ODD = 6;
-
- abstract public int layout(Area area)
+ abstract public Status layout(Area area)
throws FOPException;
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo;
// FOP
this.length = e - s;
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (!(area instanceof BlockArea)) {
System.err.println("WARNING: text outside block area" + new String(ca, start, length));
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
String fontFamily =
whiteSpaceTreatment,
ca, this.marker, length);
if (this.marker == -1) {
- return OK;
+ return new Status(Status.OK);
} else if (this.marker != orig_start) {
- return AREA_FULL_SOME;
+ return new Status(Status.AREA_FULL_SOME);
} else {
- return AREA_FULL_NONE;
+ return new Status(Status.AREA_FULL_NONE);
}
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo;
// FOP
// ignore
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
// should always be overridden
- return OK;
+ return new Status(Status.OK);
}
public String getName() {
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo;
import org.apache.fop.layout.Area;
children.addElement(new FOText(data,start,length,this));
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
this.marker = 0;
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FONode fo = (FONode) children.elementAt(i);
- int status;
- if ((status = fo.layout(area)) != OK) {
+ Status status;
+ if ((status = fo.layout(area)).isIncomplete()) {
this.marker = i;
return status;
}
}
- return OK;
+ return new Status(Status.OK);
}
}
Property.java \
PropertyList.java \
PropertyListBuilder.java \
- StandardElementMapping.java
+ StandardElementMapping.java \
+ Status.java
CLASSES=$(SOURCES:.java=.class)
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo;
import org.apache.fop.fo.properties.*;
import java.util.Hashtable;
public class PropertyListBuilder {
- private Hashtable propertyTable;
+
+ private Hashtable propertyTable;
- public PropertyListBuilder() {
- this.propertyTable = new Hashtable();
+ public PropertyListBuilder() {
+ this.propertyTable = new Hashtable();
- propertyTable.put("end-indent",EndIndent.maker());
- propertyTable.put("page-master-name",PageMasterName.maker());
- propertyTable.put("page-master-first",PageMasterFirst.maker());
- propertyTable.put("page-master-repeating",PageMasterRepeating.maker());
- propertyTable.put("page-master-odd",PageMasterOdd.maker());
- propertyTable.put("page-master-even",PageMasterEven.maker());
- propertyTable.put("margin-top",MarginTop.maker());
- propertyTable.put("margin-bottom",MarginBottom.maker());
- propertyTable.put("margin-left",MarginLeft.maker());
- propertyTable.put("margin-right",MarginRight.maker());
- propertyTable.put("extent",Extent.maker());
- propertyTable.put("page-width",PageWidth.maker());
- propertyTable.put("page-height",PageHeight.maker());
- propertyTable.put("flow-name",FlowName.maker());
- propertyTable.put("font-family",FontFamily.maker());
- propertyTable.put("font-style",FontStyle.maker());
- propertyTable.put("font-weight",FontWeight.maker());
- propertyTable.put("font-size",FontSize.maker());
- propertyTable.put("line-height",LineHeight.maker());
- propertyTable.put("text-align",TextAlign.maker());
- propertyTable.put("text-align-last",TextAlignLast.maker());
- propertyTable.put("space-before.optimum",SpaceBeforeOptimum.maker());
- propertyTable.put("space-after.optimum",SpaceAfterOptimum.maker());
- propertyTable.put("start-indent",StartIndent.maker());
- propertyTable.put("end-indent",EndIndent.maker());
- propertyTable.put("provisional-distance-between-starts",ProvisionalDistanceBetweenStarts.maker());
- propertyTable.put("provisional-label-separation",ProvisionalLabelSeparation.maker());
- propertyTable.put("rule-thickness",RuleThickness.maker());
- propertyTable.put("color",Color.maker());
- propertyTable.put("wrap-option",WrapOption.maker());
- propertyTable.put("white-space-treatment",WhiteSpaceTreatment.maker());
- propertyTable.put("break-before",BreakBefore.maker());
- propertyTable.put("break-after",BreakAfter.maker());
- propertyTable.put("text-indent",TextIndent.maker());
- propertyTable.put("href",HRef.maker());
- propertyTable.put("column-width",ColumnWidth.maker());
- propertyTable.put("height",SVGLength.maker());
- propertyTable.put("width",SVGLength.maker());
- propertyTable.put("x",SVGLength.maker());
- propertyTable.put("y",SVGLength.maker());
- propertyTable.put("x1",SVGLength.maker());
- propertyTable.put("x2",SVGLength.maker());
- propertyTable.put("y1",SVGLength.maker());
- propertyTable.put("y2",SVGLength.maker());
- }
+ propertyTable.put("end-indent",EndIndent.maker());
+ propertyTable.put("page-master-name",PageMasterName.maker());
+ propertyTable.put("page-master-first",PageMasterFirst.maker());
+ propertyTable.put("page-master-repeating",PageMasterRepeating.maker());
+ propertyTable.put("page-master-odd",PageMasterOdd.maker());
+ propertyTable.put("page-master-even",PageMasterEven.maker());
+ propertyTable.put("margin-top",MarginTop.maker());
+ propertyTable.put("margin-bottom",MarginBottom.maker());
+ propertyTable.put("margin-left",MarginLeft.maker());
+ propertyTable.put("margin-right",MarginRight.maker());
+ propertyTable.put("extent",Extent.maker());
+ propertyTable.put("page-width",PageWidth.maker());
+ propertyTable.put("page-height",PageHeight.maker());
+ propertyTable.put("flow-name",FlowName.maker());
+ propertyTable.put("font-family",FontFamily.maker());
+ propertyTable.put("font-style",FontStyle.maker());
+ propertyTable.put("font-weight",FontWeight.maker());
+ propertyTable.put("font-size",FontSize.maker());
+ propertyTable.put("line-height",LineHeight.maker());
+ propertyTable.put("text-align",TextAlign.maker());
+ propertyTable.put("text-align-last",TextAlignLast.maker());
+ propertyTable.put("space-before.optimum",SpaceBeforeOptimum.maker());
+ propertyTable.put("space-after.optimum",SpaceAfterOptimum.maker());
+ propertyTable.put("start-indent",StartIndent.maker());
+ propertyTable.put("end-indent",EndIndent.maker());
+ propertyTable.put("provisional-distance-between-starts",ProvisionalDistanceBetweenStarts.maker());
+ propertyTable.put("provisional-label-separation",ProvisionalLabelSeparation.maker());
+ propertyTable.put("rule-thickness",RuleThickness.maker());
+ propertyTable.put("color",Color.maker());
+ propertyTable.put("wrap-option",WrapOption.maker());
+ propertyTable.put("white-space-treatment",WhiteSpaceTreatment.maker());
+ propertyTable.put("break-before",BreakBefore.maker());
+ propertyTable.put("break-after",BreakAfter.maker());
+ propertyTable.put("text-indent",TextIndent.maker());
+ propertyTable.put("href",HRef.maker());
+ propertyTable.put("column-width",ColumnWidth.maker());
+ propertyTable.put("keep-with-next",KeepWithNext.maker());
- public Property computeProperty(PropertyList propertyList, String propertyName) {
+ propertyTable.put("height",SVGLength.maker());
+ propertyTable.put("width",SVGLength.maker());
+ propertyTable.put("x",SVGLength.maker());
+ propertyTable.put("y",SVGLength.maker());
+ propertyTable.put("x1",SVGLength.maker());
+ propertyTable.put("x2",SVGLength.maker());
+ propertyTable.put("y1",SVGLength.maker());
+ propertyTable.put("y2",SVGLength.maker());
+ }
- Property p = null;
+ public Property computeProperty(PropertyList propertyList, String propertyName) {
- Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
- if (propertyMaker != null) {
- p = propertyMaker.compute(propertyList);
- } else {
- //System.err.println("WARNING: property " + propertyName + " ignored");
+ Property p = null;
+
+ Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
+ if (propertyMaker != null) {
+ p = propertyMaker.compute(propertyList);
+ } else {
+ //System.err.println("WARNING: property " + propertyName + " ignored");
+ }
+ return p;
}
- return p;
- }
-
- public boolean isInherited(String propertyName) {
- boolean b;
+
+ public boolean isInherited(String propertyName) {
+ boolean b;
- Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
- if (propertyMaker != null) {
- b = propertyMaker.isInherited();
- } else {
- //System.err.println("WARNING: Unknown property " + propertyName);
- b = true;
+ Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
+ if (propertyMaker != null) {
+ b = propertyMaker.isInherited();
+ } else {
+ //System.err.println("WARNING: Unknown property " + propertyName);
+ b = true;
+ }
+ return b;
}
- return b;
- }
-
- public PropertyList makeList(AttributeList attributes, PropertyList parentPropertyList) throws FOPException {
+
+ public PropertyList makeList(AttributeList attributes, PropertyList parentPropertyList) throws FOPException {
+
+ PropertyList p = new PropertyList(parentPropertyList);
+ p.setBuilder(this);
- PropertyList p = new PropertyList(parentPropertyList);
- p.setBuilder(this);
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String attributeName = attributes.getName(i);
+ Property.Maker propertyMaker = (Property.Maker)propertyTable.get(attributeName);
+ if (propertyMaker != null) {
+ p.put(attributeName,propertyMaker.make(p,attributes.getValue(i)));
+ } else {
+ //System.err.println("WARNING: property " + attributeName + " ignored");
+ }
+ }
- for (int i = 0; i < attributes.getLength(); i++) {
- String attributeName = attributes.getName(i);
- Property.Maker propertyMaker = (Property.Maker)propertyTable.get(attributeName);
- if (propertyMaker != null) {
- p.put(attributeName,propertyMaker.make(p,attributes.getValue(i)));
- } else {
- //System.err.println("WARNING: property " + attributeName + " ignored");
- }
+ return p;
}
-
- return p;
- }
-
- public Property makeProperty(PropertyList propertyList, String propertyName) throws FOPException {
-
- Property p = null;
+
+ public Property makeProperty(PropertyList propertyList, String propertyName) throws FOPException {
+
+ Property p = null;
- Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
- if (propertyMaker != null) {
- p = propertyMaker.make(propertyList);
- } else {
- //System.err.println("WARNING: property " + propertyName + " ignored");
+ Property.Maker propertyMaker = (Property.Maker)propertyTable.get(propertyName);
+ if (propertyMaker != null) {
+ p = propertyMaker.make(propertyList);
+ } else {
+ //System.err.println("WARNING: property " + propertyName + " ignored");
+ }
+ return p;
}
- return p;
- }
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
int spaceBefore;
int spaceAfter;
int textIndent;
+ int keepWithNext;
BlockArea blockArea;
this.name = "fo:block";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
// System.err.print(" b:LAY[" + marker + "] ");
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
this.properties.get("space-after.optimum").getLength().mvalue();
this.textIndent =
this.properties.get("text-indent").getLength().mvalue();
+ this.keepWithNext =
+ this.properties.get("keep-with-next").getEnum();
if (area instanceof BlockArea) {
area.end();
this.marker = 0;
if (breakBefore == BreakBefore.PAGE) {
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakBefore == BreakBefore.ODD_PAGE) {
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakBefore == BreakBefore.EVEN_PAGE) {
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
}
}
fo.setDistanceBetweenStarts(this.distanceBetweenStarts);
fo.setBodyIndent(this.bodyIndent);
}
- int status;
- if ((status = fo.layout(blockArea)) != OK) {
+ Status status;
+ if ((status = fo.layout(blockArea)).isIncomplete()) {
this.marker = i;
- if ((i != 0) && (status == AREA_FULL_NONE)) {
- status = AREA_FULL_SOME;
+ if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ status = new Status(Status.AREA_FULL_SOME);
}
//blockArea.end();
area.addChild(blockArea);
if (breakAfter == BreakAfter.PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakAfter == BreakAfter.ODD_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakAfter == BreakAfter.EVEN_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
+ }
+
+ if (keepWithNext == KeepWithNext.TRUE) {
+ return new Status(Status.KEEP_WITH_NEXT);
}
//System.err.print(" b:OK" + marker + " ");
- return OK;
+ return new Status(Status.OK);
}
public int getAreaHeight() {
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:display-graphic";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
String fontFamily =
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
this.name = "fo:display-rule";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
// FIXME: doesn't check to see if it will fit
String fontFamily = this.properties.get("font-family").getString();
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:display-sequence";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
this.marker = 0;
}
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FObj fo = (FObj) children.elementAt(i);
- int status;
- if ((status = fo.layout(area)) != OK) {
- /* message from child */
- if (status > OK) {
- /* child still successful */
- this.marker = i+1;
- } else {
- /* child unsucessful */
- this.marker = i;
- }
- return status;
+ Status status;
+ if ((status = fo.layout(area)).isIncomplete()) {
+ this.marker = i;
}
+ return status;
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
pageSequence.setFlow(this);
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
this.marker = 0;
}
+
+ boolean prevChildMustKeepWithNext = false;
+
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FObj fo = (FObj) children.elementAt(i);
- int status;
- if ((status = fo.layout(area)) != OK) {
- this.marker = i;
- return status;
+ Status status;
+ if ((status = fo.layout(area)).isIncomplete()) {
+ if ((prevChildMustKeepWithNext) && (status.laidOutNone())) {
+ this.marker = i - 1;
+ FObj prevChild = (FObj) children.elementAt(this.marker);
+ prevChild.removeAreas();
+ prevChild.resetMarker();
+ return new Status(Status.AREA_FULL_SOME);
+ // should probably return AREA_FULL_NONE if first
+ // or perhaps an entirely new status code
+ } else {
+ this.marker = i;
+ return status;
+ }
+ }
+ if (status.getCode() == Status.KEEP_WITH_NEXT) {
+ prevChildMustKeepWithNext = true;
}
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:list-block";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
String fontFamily =
this.properties.get("font-family").getString();
for (int i = this.marker; i < numChildren; i++) {
if (!(children.elementAt(i) instanceof ListItem)) {
System.err.println("WARNING: This version of FOP requires list-items inside list-blocks");
- return OK;
+ return new Status(Status.OK);
}
ListItem listItem = (ListItem) children.elementAt(i);
listItem.setDistanceBetweenStarts(this.provisionalDistanceBetweenStarts);
listItem.setLabelSeparation(this.provisionalLabelSeparation);
listItem.setBodyIndent(this.bodyIndent);
- int status;
- if ((status = listItem.layout(blockArea)) != OK) {
- /* message from child */
- if (status > OK) {
- /* child still successful */
- this.marker = i+1;
- } else {
- /* child unsucessful */
- this.marker = i;
- }
+ Status status;
+ if ((status = listItem.layout(blockArea)).isIncomplete()) {
+ this.marker = i;
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:list-item";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
String fontFamily =
this.properties.get("font-family").getString();
/* this doesn't actually do anything */
body.setLabelSeparation(this.labelSeparation);
- int status;
+ Status status;
// what follows doesn't yet take into account whether the
// body failed completely or only got some text in
if (this.marker == 0) {
status = label.layout(blockArea);
- if (status != OK) {
+ if (status.isIncomplete()) {
return status;
}
}
status = body.layout(blockArea);
- if (status != OK) {
+ if (status.isIncomplete()) {
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
if (area instanceof BlockArea) {
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:list-item-body";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == START) {
this.marker = 0;
}
fo.setDistanceBetweenStarts(this.distanceBetweenStarts);
fo.setLabelSeparation(this.labelSeparation);
fo.setBodyIndent(this.bodyIndent);
- int status;
- if ((status = fo.layout(area)) != OK) {
+ Status status;
+ if ((status = fo.layout(area)).isIncomplete()) {
this.marker = i;
- if ((i == 0) && (status == AREA_FULL_NONE)) {
- return AREA_FULL_NONE;
+ if ((i == 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ return new Status(Status.AREA_FULL_NONE);
} else {
- return AREA_FULL_SOME;
+ return new Status(Status.AREA_FULL_SOME);
}
}
}
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:list-item-label";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
int numChildren = this.children.size();
if (numChildren != 1) {
block.setLabelSeparation(this.labelSeparation);
block.setBodyIndent(this.bodyIndent);
- int status;
+ Status status;
status = block.layout(area);
area.addDisplaySpace(-block.getAreaHeight());
return status;
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:page-number";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (!(area instanceof BlockArea)) {
System.err.println("WARNING: page-number outside block area");
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
String fontFamily = this.properties.get("font-family").getString();
}
String p = Integer.toString(area.getPage().getNumber());
this.marker = ((BlockArea) area).addText(fs, red, green, blue, wrapOption, whiteSpaceTreatment, p.toCharArray(), 0, p.length());
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
pageSequence.setStaticContent(flowName, this);
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
FObj fo = (FObj) children.elementAt(i);
fo.layout(area);
}
resetMarker();
- return OK;
+ return new Status(Status.OK);
}
}
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.name = "fo:table";
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
this.marker = 0;
if (breakBefore == BreakBefore.PAGE) {
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakBefore == BreakBefore.ODD_PAGE) {
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakBefore == BreakBefore.EVEN_PAGE) {
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
}
}
} else if (fo instanceof TableBody) {
if (columns.size() == 0) {
System.err.println("WARNING: current implementation of tables requires a table-column for each column, indicating column-width");
- return OK;
+ return new Status(Status.OK);
}
//if (this.isInListBody) {
((TableBody) fo).setColumns(columns);
- int status;
- if ((status = fo.layout(blockArea)) != OK) {
+ Status status;
+ if ((status = fo.layout(blockArea)).isIncomplete()) {
this.marker = i;
- if ((i != 0) && (status == AREA_FULL_NONE)) {
- status = AREA_FULL_SOME;
+ if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ status = new Status(Status.AREA_FULL_SOME);
}
//blockArea.end();
area.addChild(blockArea);
if (breakAfter == BreakAfter.PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakAfter == BreakAfter.ODD_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakAfter == BreakAfter.EVEN_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
}
- return OK;
+ return new Status(Status.OK);
}
public int getAreaHeight() {
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.columns = columns;
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
row.setColumns(columns);
- int status;
- if ((status = row.layout(blockArea)) != OK) {
+ Status status;
+ if ((status = row.layout(blockArea)).isIncomplete()) {
this.marker = i;
- if ((i != 0) && (status == AREA_FULL_NONE)) {
- status = AREA_FULL_SOME;
+ if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ status = new Status(Status.AREA_FULL_SOME);
}
//blockArea.end();
area.addChild(blockArea);
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
public int getAreaHeight() {
this.width = width;
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
fo.setIsInTableCell();
fo.forceStartOffset(startOffset);
fo.forceWidth(width);
- int status;
- if ((status = fo.layout(blockArea)) != OK) {
+ Status status;
+ if ((status = fo.layout(blockArea)).isIncomplete()) {
this.marker = i;
- if ((i == 0) && (status == AREA_FULL_NONE)) {
- return AREA_FULL_NONE;
+ if ((i == 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ return new Status(Status.AREA_FULL_NONE);
} else {
- return AREA_FULL_SOME;
+ return new Status(Status.AREA_FULL_SOME);
}
}
height += blockArea.getHeight();
blockArea.end();
area.addChild(blockArea);
- return OK;
+ return new Status(Status.OK);
}
public int getHeight() {
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.flow;
// FOP
this.columns = columns;
}
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
int numChildren = this.children.size();
if (numChildren != columns.size()) {
System.err.println("WARNING: Number of children under table-row not equal to number of table-columns");
- return OK;
+ return new Status(Status.OK);
}
// added by Eric Schaeffer
cell.setWidth(width);
widthOfCellsSoFar += width;
- int status;
- if ((status = cell.layout(blockArea)) != OK) {
+ Status status;
+ if ((status = cell.layout(blockArea)).isIncomplete()) {
this.marker = i;
- if ((i != 0) && (status == AREA_FULL_NONE)) {
- status = AREA_FULL_SOME;
+ if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
+ status = new Status(Status.AREA_FULL_SOME);
}
//blockArea.end();
area.addChild(blockArea);
area.start();
}
- return OK;
+ return new Status(Status.OK);
}
public int getAreaHeight() {
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.fo.pagination;
// FOP
}
public void format(AreaTree areaTree) throws FOPException {
- int status = OK;
+ Status status = new Status(Status.OK);
do {
currentPage = makePage(areaTree);
AreaContainer afterArea = currentPage.getAfter();
this.staticAfter.layout(afterArea);
}
- if ((status == FORCE_PAGE_BREAK_EVEN) &&
+ if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN) &&
((currentPageNumber % 2) == 1)) {
- } else if ((status == FORCE_PAGE_BREAK_ODD) &&
+ } else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD) &&
((currentPageNumber % 2) == 0)) {
} else {
AreaContainer bodyArea = currentPage.getBody();
}
System.err.print("]");
areaTree.addPage(currentPage);
- } while (status != OK);
+ } while (status.isIncomplete());
System.err.println();
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.layout;
// Java
public void increaseHeight(int amount) {
this.currentHeight += amount;
}
+
+ protected void removeChild(Area area) {
+ this.currentHeight -= area.getHeight();
+ this.children.removeElement(area);
+ }
+ public void remove() {
+ this.parent.removeChild(this);
+ }
+
public void setPage(Page page) {
this.page = page;
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.svg;
// FOP
*
* @return the status of the layout
*/
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
/* retrieve properties */
int x1 = this.properties.get("x1").getLength().mvalue();
}
/* return status */
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.svg;
/**
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.svg;
// FOP
*
* @return the status of the layout
*/
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
/* retrieve properties */
int width = this.properties.get("width").getLength().mvalue();
}
/* return status */
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.svg;
// FOP
*
* @return the status of the layout
*/
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
- return OK;
+ return new Status(Status.OK);
}
if (this.marker == START) {
this.marker = 0;
if (breakBefore == BreakBefore.PAGE) {
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakBefore == BreakBefore.ODD_PAGE) {
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakBefore == BreakBefore.EVEN_PAGE) {
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
}
}
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
FONode fo = (FONode) children.elementAt(i);
- int status;
- if ((status = fo.layout(svgArea)) != OK) {
+ Status status;
+ if ((status = fo.layout(svgArea)).isIncomplete()) {
return status;
}
}
if (breakAfter == BreakAfter.PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK;
+ return new Status(Status.FORCE_PAGE_BREAK);
}
if (breakAfter == BreakAfter.ODD_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_ODD;
+ return new Status(Status.FORCE_PAGE_BREAK_ODD);
}
if (breakAfter == BreakAfter.EVEN_PAGE) {
this.marker = BREAK_AFTER;
- return FORCE_PAGE_BREAK_EVEN;
+ return new Status(Status.FORCE_PAGE_BREAK_EVEN);
}
/* return status */
- return OK;
+ return new Status(Status.OK);
}
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.svg;
// FOP
*
* @return the status of the layout
*/
- public int layout(Area area) throws FOPException {
+ public Status layout(Area area) throws FOPException {
/* retrieve properties */
int x = this.properties.get("x").getLength().mvalue();
}
/* return status */
- return OK;
+ return new Status(Status.OK);
}
}