*
*/
public void setupDefaultMappings() {
- addElementMapping("org.apache.fop.fo.StandardElementMapping");
+ addElementMapping("org.apache.fop.fo.FOElementMapping");
addElementMapping("org.apache.fop.svg.SVGElementMapping");
addElementMapping("org.apache.fop.extensions.ExtensionElementMapping");
long timeUsed = System.currentTimeMillis() - startTime;
log.debug("Total time used: " + timeUsed + "ms");
- log.debug("Pages rendererd: " + pageCount);
- log.debug("Avg render time: " + (timeUsed / pageCount) + "ms/page");
+ log.debug("Pages rendered: " + pageCount);
+ //log.debug("Avg render time: " + (timeUsed / pageCount) + "ms/page");
}
/**
// cacheable object
// image object, mime type, url
+// an image only needs to be loaded to get the size if not specified
+// and when rendering to the output
public class Image extends Area {
String url;
package org.apache.fop.extensions;
import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.ExtensionPropertyMapping;
-import org.apache.fop.fo.TreeBuilder;
import java.util.Enumeration;
import java.util.HashMap;
private static HashMap foObjs = null;
- public synchronized void addToBuilder(TreeBuilder builder) {
+ public synchronized void addToBuilder(FOTreeBuilder builder) {
if(foObjs == null) {
foObjs = new HashMap();
- foObjs.put("outline", Outline.maker());
- foObjs.put("label", Label.maker());
+ foObjs.put("outline", new O());
+ foObjs.put("label", new L());
}
builder.addMapping(URI, foObjs);
+ }
-
- builder.addPropertyList(ExtensionElementMapping.URI,
- ExtensionPropertyMapping.getGenericMappings());
- /* Add any element mappings */
- for (Iterator iter = ExtensionPropertyMapping.getElementMappings().iterator();
- iter.hasNext(); ) {
- String elem = (String)iter.next();
- builder.addElementPropertyList(ExtensionElementMapping.URI, elem,
- ExtensionPropertyMapping.getElementMapping(elem));
+ class O extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Outline(parent);
}
}
+ class L extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Label(parent);
+ }
+ }
}
import org.apache.fop.fo.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.ExtensionPropertyMapping;
+
+import org.xml.sax.Attributes;
/**
* base class for extension objects
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- public ExtensionObj(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ExtensionObj(FObj parent) {
+ super(parent);
}
/**
return new Status(Status.OK);
}
-
/**
* Called for root extensions. Root extensions aren't allowed to generate
* any visible areas. They are used for extra items that don't show up in
areaTree.addExtension(this);
}
+ protected PropertyListBuilder getListBuilder() {
+ PropertyListBuilder plb = new PropertyListBuilder();
+ plb.addList(ExtensionPropertyMapping.getGenericMappings());
+ return plb;
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ String uri = ExtensionElementMapping.URI;
+ properties =
+ getListBuilder().makeList(uri, name, attlist,
+ (parent == null) ? null
+ : parent.properties, parent);
+ }
}
public class Label extends ExtensionObj {
private String _label = "";
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent, PropertyList propertyList) {
- return new Label(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Label.Maker();
- }
-
- public Label(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Label(FObj parent) {
+ super(parent);
}
protected void addCharacters(char data[], int start, int end) {
import org.apache.fop.pdf.PDFGoTo;
import org.apache.fop.pdf.PDFAction;
import org.apache.fop.datatypes.IDReferences;
+import org.apache.fop.apps.FOPException;
import java.util.*;
+import org.xml.sax.Attributes;
public class Outline extends ExtensionObj {
private Label _label;
*/
private Object _rendererObject;
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent, PropertyList propertyList) {
- return new Outline(parent, propertyList);
- }
-
+ public Outline(FObj parent) {
+ super(parent);
}
- public static FObj.Maker maker() {
- return new Outline.Maker();
- }
-
- public Outline(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
-
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
_internalDestination =
this.properties.get("internal-destination").getString();
_externalDestination =
}
public Label getLabel() {
- return _label == null ? new Label(this, this.properties) : _label;
+ return _label == null ? new Label(this) : _label;
}
public Vector getOutlines() {
*/
public class ColorProfile extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ColorProfile(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new ColorProfile.Maker();
- }
-
- protected ColorProfile(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ protected ColorProfile(FObj parent) {
+ super(parent);
this.name = "fo:color-profile";
// this.properties.get("src");
*/
public class Declarations extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Declarations(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Declarations.Maker();
- }
-
- protected Declarations(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ protected Declarations(FObj parent) {
+ super(parent);
this.name = "fo:declarations";
}
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.fo;
-
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.svg.*;
-import org.apache.fop.datatypes.*;
-
-import org.apache.fop.apps.FOPException;
-
-import org.xml.sax.Attributes;
-
-/**
- * This is a property list builder that bypasses overhead.
- * The attribute list is made available directly so it can
- * be used to build a dom.
- * Note: there should be a better way to handle this and
- * the attribute list is only valid within the startElement
- * call of the sax events.
- */
-public class DirectPropertyListBuilder extends PropertyListBuilder {
-
- public DirectPropertyListBuilder() {
- }
-
- public PropertyList makeList(String uri, String elementName, Attributes attributes,
- PropertyList parentPropertyList,
- FObj parentFO) throws FOPException {
- AttrPropertyList ret = new AttrPropertyList(attributes);
- return ret;
- }
-
- public static class AttrPropertyList extends PropertyList {
- Attributes attributes;
- AttrPropertyList(Attributes attr) {
- super(null, null, null);
- attributes = attr;
- }
-
- public Attributes getAttributes() {
- return attributes;
- }
- }
-}
* the given builder.
*/
public interface ElementMapping {
- public void addToBuilder(TreeBuilder builder);
+ public void addToBuilder(FOTreeBuilder builder);
+
+ public static class Maker {
+ public FObj make(FObj parent) {
+ return null;
+ }
+ }
}
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.fo;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.fop.fo.flow.*;
+import org.apache.fop.fo.pagination.*;
+
+public class FOElementMapping implements ElementMapping {
+ private static HashMap foObjs = null;
+
+ public synchronized void addToBuilder(FOTreeBuilder builder) {
+
+ if(foObjs == null) {
+ foObjs = new HashMap();
+
+ // Declarations and Pagination and Layout Formatting Objects
+ foObjs.put("root", new R());
+ foObjs.put("declarations", new Dec());
+ foObjs.put("color-profile", new CP());
+ foObjs.put("page-sequence", new PS());
+ foObjs.put("layout-master-set", new LMS());
+ foObjs.put("page-sequence-master",
+ new PSM());
+ foObjs.put("single-page-master-reference",
+ new SPMR());
+ foObjs.put("repeatable-page-master-reference",
+ new RPMR());
+ foObjs.put("repeatable-page-master-alternatives",
+ new RPMA());
+ foObjs.put("conditional-page-master-reference",
+ new CPMR());
+ foObjs.put("simple-page-master",
+ new SPM());
+ foObjs.put("region-body", new RB());
+ foObjs.put("region-before", new RBefore());
+ foObjs.put("region-after", new RA());
+ foObjs.put("region-start", new RS());
+ foObjs.put("region-end", new RE());
+ foObjs.put("flow", new Fl());
+ foObjs.put("static-content", new SC());
+ foObjs.put("title", new T());
+
+ // Block-level Formatting Objects
+ foObjs.put("block", new B());
+ foObjs.put("block-container", new BC());
+
+ // Inline-level Formatting Objects
+ foObjs.put("bidi-override", new BO());
+ foObjs.put("character",
+ new Ch());
+ foObjs.put("initial-property-set",
+ new IPS());
+ foObjs.put("external-graphic", new EG());
+ foObjs.put("instream-foreign-object",
+ new IFO());
+ foObjs.put("inline", new In());
+ foObjs.put("inline-container", new IC());
+ foObjs.put("leader", new L());
+ foObjs.put("page-number", new PN());
+ foObjs.put("page-number-citation",
+ new PNC());
+
+ // Formatting Objects for Tables
+ foObjs.put("table-and-caption", new TAC());
+ foObjs.put("table", new Ta());
+ foObjs.put("table-column", new TC());
+ foObjs.put("table-caption", new TCaption());
+ foObjs.put("table-header", new TH());
+ foObjs.put("table-footer", new TF());
+ foObjs.put("table-body", new TB());
+ foObjs.put("table-row", new TR());
+ foObjs.put("table-cell", new TCell());
+
+ // Formatting Objects for Lists
+ foObjs.put("list-block", new LB());
+ foObjs.put("list-item", new LI());
+ foObjs.put("list-item-body", new LIB());
+ foObjs.put("list-item-label", new LIL());
+
+ // Dynamic Effects: Link and Multi Formatting Objects
+ foObjs.put("basic-link", new BL());
+ foObjs.put("multi-switch", new MS());
+ foObjs.put("multi-case", new MC());
+ foObjs.put("multi-toggle", new MT());
+ foObjs.put("multi-properties", new MP());
+ foObjs.put("multi-property-set",
+ new MPS());
+
+ // Out-of-Line Formatting Objects
+ foObjs.put("float",
+ new F());
+ foObjs.put("footnote", new Foot());
+ foObjs.put("footnote-body", new FB());
+
+ // Other Formatting Objects
+ foObjs.put("wrapper", new W());
+ foObjs.put("marker", new M());
+ foObjs.put("retrieve-marker", new RM());
+ }
+
+ String uri = "http://www.w3.org/1999/XSL/Format";
+ builder.addMapping(uri, foObjs);
+ }
+
+ class R extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Root(parent);
+ }
+ }
+
+ class Dec extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Declarations(parent);
+ }
+ }
+
+ class CP extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ColorProfile(parent);
+ }
+ }
+
+ class PS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new PageSequence(parent);
+ }
+ }
+
+ class LMS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new LayoutMasterSet(parent);
+ }
+ }
+
+ class PSM extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new PageSequenceMaster(parent);
+ }
+ }
+
+ class SPMR extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new SinglePageMasterReference(parent);
+ }
+ }
+
+ class RPMR extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RepeatablePageMasterReference(parent);
+ }
+ }
+
+ class RPMA extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RepeatablePageMasterAlternatives(parent);
+ }
+ }
+
+ class CPMR extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ConditionalPageMasterReference(parent);
+ }
+ }
+
+ class SPM extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new SimplePageMaster(parent);
+ }
+ }
+
+ class RB extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RegionBody(parent);
+ }
+ }
+
+ class RBefore extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RegionBefore(parent);
+ }
+ }
+
+ class RA extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RegionAfter(parent);
+ }
+ }
+
+ class RS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RegionStart(parent);
+ }
+ }
+
+ class RE extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RegionEnd(parent);
+ }
+ }
+
+ class Fl extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Flow(parent);
+ }
+ }
+
+ class SC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new StaticContent(parent);
+ }
+ }
+
+ class T extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Title(parent);
+ }
+ }
+
+ class B extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Block(parent);
+ }
+ }
+
+ class BC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new BlockContainer(parent);
+ }
+ }
+
+ class BO extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new BidiOverride(parent);
+ }
+ }
+
+ class Ch extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new org.apache.fop.fo.flow.Character(parent);
+ }
+ }
+
+ class IPS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new InitialPropertySet(parent);
+ }
+ }
+
+ class EG extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ExternalGraphic(parent);
+ }
+ }
+
+ class IFO extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new InstreamForeignObject(parent);
+ }
+ }
+
+ class In extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Inline(parent);
+ }
+ }
+
+ class IC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new InlineContainer(parent);
+ }
+ }
+
+ class L extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Leader(parent);
+ }
+ }
+
+ class PN extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new PageNumber(parent);
+ }
+ }
+
+ class PNC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new PageNumberCitation(parent);
+ }
+ }
+
+ class TAC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableAndCaption(parent);
+ }
+ }
+
+ class Ta extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Table(parent);
+ }
+ }
+
+ class TC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableColumn(parent);
+ }
+ }
+
+ class TCaption extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableCaption(parent);
+ }
+ }
+
+ class TH extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableHeader(parent);
+ }
+ }
+
+ class TF extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableFooter(parent);
+ }
+ }
+
+ class TB extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableBody(parent);
+ }
+ }
+
+ class TR extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableRow(parent);
+ }
+ }
+
+ class TCell extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new TableCell(parent);
+ }
+ }
+
+ class LB extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ListBlock(parent);
+ }
+ }
+
+ class LI extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ListItem(parent);
+ }
+ }
+
+ class LIB extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ListItemBody(parent);
+ }
+ }
+
+ class LIL extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new ListItemLabel(parent);
+ }
+ }
+
+ class BL extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new BasicLink(parent);
+ }
+ }
+
+ class MS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new MultiSwitch(parent);
+ }
+ }
+
+ class MC extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new MultiCase(parent);
+ }
+ }
+
+ class MT extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new MultiToggle(parent);
+ }
+ }
+
+ class MP extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new MultiProperties(parent);
+ }
+ }
+
+ class MPS extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new MultiPropertySet(parent);
+ }
+ }
+
+ class F extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new org.apache.fop.fo.flow.Float(parent);
+ }
+ }
+
+ class Foot extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Footnote(parent);
+ }
+ }
+
+ class FB extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new FootnoteBody(parent);
+ }
+ }
+
+ class W extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Wrapper(parent);
+ }
+ }
+
+ class M extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Marker(parent);
+ }
+ }
+
+ class RM extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new RetrieveMarker(parent);
+ }
+ }
+}
import java.util.Vector;
import java.util.Hashtable;
+import org.xml.sax.Attributes;
+
/**
* base class for nodes in the formatting object tree
*
log = logger;
}
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ }
+
public void setIsInTableCell() {
this.isInTableCell = true;
// made recursive by Eric Schaeffer
// Java
import java.util.HashMap;
-import java.util.Stack;
import java.util.ArrayList;
import java.io.IOException;
* supresses adding the PageSequence object to the Root,
* since it is parsed immediately.
*/
-public class FOTreeBuilder extends DefaultHandler implements TreeBuilder {
+public class FOTreeBuilder extends DefaultHandler {
/**
* table mapping element names to the makers of objects
protected ArrayList namespaces = new ArrayList();
- /**
- * class that builds a property list for each formatting object
- */
- protected HashMap propertylistTable = new HashMap();
-
/**
* current formatting object being handled
*/
this.namespaces.add(namespaceURI.intern());
}
- /**
- * add a mapping from element name to maker.
- *
- * @param namespaceURI namespace URI of formatting object element
- * @param localName local name of formatting object element
- * @param maker Maker for class representing formatting object
- */
- public void addPropertyList(String namespaceURI, HashMap list) {
- PropertyListBuilder plb;
- plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
- if (plb == null) {
- plb = new PropertyListBuilder();
- plb.addList(list);
- this.propertylistTable.put(namespaceURI, plb);
- } else {
- plb.addList(list);
- }
- }
-
- /**
- * add a mapping from element name to maker.
- *
- * @param namespaceURI namespace URI of formatting object element
- * @param localName local name of formatting object element
- * @param maker Maker for class representing formatting object
- */
- public void addElementPropertyList(String namespaceURI, String localName,
- HashMap list) {
- PropertyListBuilder plb;
- plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
- if (plb == null) {
- plb = new PropertyListBuilder();
- plb.addElementList(localName, list);
- this.propertylistTable.put(namespaceURI, plb);
- } else {
- plb.addElementList(localName, list);
- }
- }
-
- public void addPropertyListBuilder(String namespaceURI,
- PropertyListBuilder propbuilder) {
- PropertyListBuilder plb;
- plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
- if (plb == null) {
- this.propertylistTable.put(namespaceURI, propbuilder);
- } else {
- // Error already added
- }
- }
-
/**
* SAX Handler for characters
*/
throws SAXException {
currentFObj.end();
- //
- // mark-fop@inomial.com - tell the stream renderer to render
- // this page-sequence
- //
- if(currentFObj instanceof PageSequence) {
- streamRenderer.render((PageSequence) currentFObj);
- } else if(currentFObj instanceof ExtensionObj) {
- if(!(currentFObj.getParent() instanceof ExtensionObj)) {
- streamRenderer.addExtension((ExtensionObj)currentFObj);
- }
- }
-
currentFObj = (FObj)currentFObj.getParent();
}
FObj fobj;
/* the maker for the formatting object started */
- FObj.Maker fobjMaker = null;
+ ElementMapping.Maker fobjMaker = null;
HashMap table = (HashMap)fobjTable.get(uri);
if(table != null) {
- fobjMaker = (FObj.Maker)table.get(localName);
+ fobjMaker = (ElementMapping.Maker)table.get(localName);
+ // try default
+ if(fobjMaker == null) {
+ fobjMaker = (ElementMapping.Maker)table.get("<default>");
+ }
}
- PropertyListBuilder currentListBuilder =
- (PropertyListBuilder)this.propertylistTable.get(uri);
-
boolean foreignXML = false;
if (fobjMaker == null) {
String fullName = uri + "^" + localName;
// fall back
fobjMaker = new Unknown.Maker();
} else {
- fobjMaker = new UnknownXMLObj.Maker(uri, localName);
+ fobjMaker = new UnknownXMLObj.Maker(uri);
foreignXML = true;
}
}
try {
- PropertyList list = null;
- if (currentListBuilder != null) {
- list =
- currentListBuilder.makeList(uri, localName, attlist,
- (currentFObj == null) ? null
- : currentFObj.properties, currentFObj);
- } else if(foreignXML) {
- list = new DirectPropertyListBuilder.AttrPropertyList(attlist);
- } else {
- if(currentFObj == null) {
- throw new FOPException("Invalid XML or missing namespace");
- }
- list = currentFObj.properties;
- }
- fobj = fobjMaker.make(currentFObj, list);
+ fobj = fobjMaker.make(currentFObj);
+ fobj.setName(localName);
fobj.setLogger(log);
+ fobj.handleAttrs(attlist);
} catch (FOPException e) {
throw new SAXException(e);
}
import org.apache.fop.layout.Area;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.IDReferences;
+import org.apache.fop.fo.properties.FOPropertyMapping;
-// Java
-import java.util.Hashtable;
-import java.util.Enumeration;
+import org.xml.sax.Attributes;
/**
* base class for representation of formatting objects and their processing
*/
public class FObj extends FONode {
- public static class Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new FObj(parent, propertyList);
- }
-
- }
-
- public static Maker maker() {
- return new Maker();
- }
-
- // protected PropertyList properties;
public PropertyList properties;
protected PropertyManager propMgr;
protected String name;
- protected FObj(FObj parent, PropertyList propertyList) {
+ public FObj(FObj parent) {
super(parent);
- this.properties = propertyList; // TO BE REMOVED!!!
- propertyList.setFObj(this);
- this.propMgr = makePropertyManager(propertyList);
- this.name = "default FO";
+ }
+
+ public void setName(String str) {
+ name = "fo:" + str;
+ }
+
+ protected PropertyListBuilder getListBuilder() {
+ PropertyListBuilder plb = new PropertyListBuilder();
+ plb.addList(FOPropertyMapping.getGenericMappings());
+ return plb;
+ }
+
+ /**
+ * Handle the attributes for this element.
+ * The attributes must be used immediately as the sax attributes
+ * will be altered for the next element.
+ */
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ String uri = "http://www.w3.org/1999/XSL/Format";
+ properties =
+ getListBuilder().makeList(uri, name, attlist,
+ (parent == null) ? null
+ : parent.properties, parent);
+ properties.setFObj(this);
+ this.propMgr = makePropertyManager(properties);
setWritingMode();
}
*/
public class FObjMixed extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new FObjMixed(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new FObjMixed.Maker();
- }
-
- protected FObjMixed(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public FObjMixed(FObj parent) {
+ super(parent);
}
protected void addCharacters(char data[], int start, int length) {
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.fo;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.apache.fop.fo.properties.FOPropertyMapping;
-import org.apache.fop.fo.flow.*;
-import org.apache.fop.fo.pagination.*;
-
-public class StandardElementMapping implements ElementMapping {
- private static HashMap foObjs = null;
-
- public synchronized void addToBuilder(TreeBuilder builder) {
-
- if(foObjs == null) {
- foObjs = new HashMap();
-
- // Declarations and Pagination and Layout Formatting Objects
- foObjs.put("root", Root.maker());
- foObjs.put("declarations", Declarations.maker());
- foObjs.put("color-profile", ColorProfile.maker());
- foObjs.put("page-sequence", PageSequence.maker());
- foObjs.put("layout-master-set", LayoutMasterSet.maker());
- foObjs.put("page-sequence-master",
- PageSequenceMaster.maker());
- foObjs.put("single-page-master-reference",
- SinglePageMasterReference.maker());
- foObjs.put("repeatable-page-master-reference",
- RepeatablePageMasterReference.maker());
- foObjs.put("repeatable-page-master-alternatives",
- RepeatablePageMasterAlternatives.maker());
- foObjs.put("conditional-page-master-reference",
- ConditionalPageMasterReference.maker());
- foObjs.put("simple-page-master",
- SimplePageMaster.maker());
- foObjs.put("region-body", RegionBody.maker());
- foObjs.put("region-before", RegionBefore.maker());
- foObjs.put("region-after", RegionAfter.maker());
- foObjs.put("region-start", RegionStart.maker());
- foObjs.put("region-end", RegionEnd.maker());
- foObjs.put("flow", Flow.maker());
- foObjs.put("static-content", StaticContent.maker());
- foObjs.put("title", Title.maker());
-
- // Block-level Formatting Objects
- foObjs.put("block", Block.maker());
- foObjs.put("block-container", BlockContainer.maker());
-
- // Inline-level Formatting Objects
- foObjs.put("bidi-override", BidiOverride.maker());
- foObjs.put("character",
- org.apache.fop.fo.flow.Character.maker());
- foObjs.put("initial-property-set",
- InitialPropertySet.maker());
- foObjs.put("external-graphic", ExternalGraphic.maker());
- foObjs.put("instream-foreign-object",
- InstreamForeignObject.maker());
- foObjs.put("inline", Inline.maker());
- foObjs.put("inline-container", InlineContainer.maker());
- foObjs.put("leader", Leader.maker());
- foObjs.put("page-number", PageNumber.maker());
- foObjs.put("page-number-citation",
- PageNumberCitation.maker());
-
- // Formatting Objects for Tables
- foObjs.put("table-and-caption", TableAndCaption.maker());
- foObjs.put("table", Table.maker());
- foObjs.put("table-column", TableColumn.maker());
- foObjs.put("table-caption", TableCaption.maker());
- foObjs.put("table-header", TableHeader.maker());
- foObjs.put("table-footer", TableFooter.maker());
- foObjs.put("table-body", TableBody.maker());
- foObjs.put("table-row", TableRow.maker());
- foObjs.put("table-cell", TableCell.maker());
-
- // Formatting Objects for Lists
- foObjs.put("list-block", ListBlock.maker());
- foObjs.put("list-item", ListItem.maker());
- foObjs.put("list-item-body", ListItemBody.maker());
- foObjs.put("list-item-label", ListItemLabel.maker());
-
- // Dynamic Effects: Link and Multi Formatting Objects
- foObjs.put("basic-link", BasicLink.maker());
- foObjs.put("multi-switch", MultiSwitch.maker());
- foObjs.put("multi-case", MultiCase.maker());
- foObjs.put("multi-toggle", MultiToggle.maker());
- foObjs.put("multi-properties", MultiProperties.maker());
- foObjs.put("multi-property-set",
- MultiPropertySet.maker());
-
- // Out-of-Line Formatting Objects
- foObjs.put("float",
- org.apache.fop.fo.flow.Float.maker());
- foObjs.put("footnote", Footnote.maker());
- foObjs.put("footnote-body", FootnoteBody.maker());
-
- // Other Formatting Objects
- foObjs.put("wrapper", Wrapper.maker());
- foObjs.put("marker", Marker.maker());
- foObjs.put("retrieve-marker", RetrieveMarker.maker());
- }
-
- String uri = "http://www.w3.org/1999/XSL/Format";
- builder.addMapping(uri, foObjs);
-
- builder.addPropertyList(uri, FOPropertyMapping.getGenericMappings());
- /* Add any element mappings */
- for (Iterator iter = FOPropertyMapping.getElementMappings().iterator();
- iter.hasNext(); ) {
- String elem = (String)iter.next();
- builder.addElementPropertyList(uri, elem,
- FOPropertyMapping.getElementMapping(elem));
- }
-
- }
-
-}
*/
public class Title extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Title(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Title.Maker();
- }
-
- protected Title(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public Title(FObj parent) {
+ super(parent);
this.name = "fo:title";
}
*/
public class ToBeImplementedElement extends FObj {
- protected ToBeImplementedElement(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ protected ToBeImplementedElement(FObj parent) {
+ super(parent);
}
public Status layout(Area area) throws FOPException {
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.fo;
-
-// Java
-import java.util.HashMap;
-
-/**
- */
-public interface TreeBuilder {
-
-
- /**
- * add a mapping from element name to maker.
- *
- * @param namespaceURI namespace URI of formatting object element
- * @param localName local name of formatting object element
- * @param maker Maker for class representing formatting object
- */
- public void addMapping(String namespaceURI, HashMap table);
-
- /**
- * add a mapping from element name to maker.
- *
- * @param namespaceURI namespace URI of formatting object element
- * @param localName local name of formatting object element
- * @param maker Maker for class representing formatting object
- */
- public void addPropertyList(String namespaceURI, HashMap list);
-
- public void addPropertyListBuilder(String namespaceURI, PropertyListBuilder list);
-
- /**
- * add a mapping from element name to maker.
- *
- * @param namespaceURI namespace URI of formatting object element
- * @param localName local name of formatting object element
- * @param maker Maker for class representing formatting object
- */
- public void addElementPropertyList(String namespaceURI, String localName,
- HashMap list);
-
-}
*/
public class Unknown extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Unknown(parent, propertyList);
+ public static class Maker extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new Unknown(parent);
}
-
- }
-
- public static FObj.Maker maker() {
- return new Unknown.Maker();
}
- protected Unknown(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
- this.name = "unknown";
+ public Unknown(FObj parent) {
+ super(parent);
}
public Status layout(Area area) throws FOPException {
public class UnknownXMLObj extends XMLObj {
String namespace;
- /**
- * inner class for making unknown xml objects.
- */
- public static class Maker extends FObj.Maker {
+ public static class Maker extends ElementMapping.Maker {
String space;
- String tag;
- Maker(String sp, String t) {
+ Maker(String sp) {
space = sp;
- tag = t;
}
- /**
- * make an unknown xml object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the unknown xml object
- */
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new UnknownXMLObj(parent, propertyList, space, tag);
+ public FObj make(FObj parent) {
+ return new UnknownXMLObj(parent, space);
}
}
- /**
- * returns the maker for this object.
- *
- * @return the maker for an unknown xml object
- */
- public static FObj.Maker maker(String space, String tag) {
- return new UnknownXMLObj.Maker(space, tag);
- }
-
/**
* constructs an unknown xml object (called by Maker).
*
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- protected UnknownXMLObj(FObj parent, PropertyList propertyList, String space, String tag) {
- super(parent, propertyList, tag);
+ protected UnknownXMLObj(FObj parent, String space) {
+ super(parent);
this.namespace = space;
- if(!"".equals(space)) {
- this.name = this.namespace + ":" + tag;
- } else {
- this.name = "(none):" + tag;
- }
}
public String getNameSpace() {
}
public Status layout(Area area) throws FOPException {
- //if (!(area instanceof ForeignObjectArea)) {
- // this is an error
- //throw new FOPException("Foreign XML not in fo:instream-foreign-object");
- //}
- log.error("no handler defined for " + this.name + " foreign xml");
+ if(!"".equals(this.namespace)) {
+ log.error("no handler defined for " + this.namespace + ":" + this.name + " foreign xml");
+ } else {
+ log.error("no handler defined for (none):" + this.name + " foreign xml");
+ }
/* return status */
return new Status(Status.OK);
import org.apache.fop.layout.inline.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
/**
* class representing svg:svg pseudo flow object.
*/
public class XMLElement extends XMLObj {
String namespace = "";
- /**
- * inner class for making XML objects.
- */
- public static class Maker extends FObj.Maker {
- String tag;
-
- Maker(String t) {
- tag = t;
- }
-
- /**
- * make an XML object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the XML object
- */
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new XMLElement(parent, propertyList, tag);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for XML objects
- */
- public static FObj.Maker maker(String tag) {
- return new XMLElement.Maker(tag);
- }
-
/**
* constructs an XML object (called by Maker).
*
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- public XMLElement(FObj parent, PropertyList propertyList, String tag) {
- super(parent, propertyList, tag);
+ public XMLElement(FObj parent) {
+ super(parent);
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
init();
}
*/
public abstract class XMLObj extends FObj {
- protected String tagName = "";
+ // temp reference for attributes
+ Attributes attr = null;
protected Element element;
protected Document doc;
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- public XMLObj(FObj parent, PropertyList propertyList, String tag) {
- super(parent, propertyList);
- tagName = tag;
+ public XMLObj(FObj parent) {
+ super(parent);
}
+ public void setName(String str) {
+ name = str;
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ attr = attlist;
+ }
public abstract String getNameSpace();
protected static Hashtable ns = new Hashtable();
public void addGraphic(Document doc, Element parent) {
this.doc = doc;
- element = doc.createElementNS(getNameSpace(), tagName);
+ element = doc.createElementNS(getNameSpace(), name);
- if(this.properties instanceof DirectPropertyListBuilder.AttrPropertyList) {
- Attributes attr = ((DirectPropertyListBuilder.AttrPropertyList)this.properties).getAttributes();
for (int count = 0; count < attr.getLength(); count++) {
String rf = attr.getValue(count);
String qname = attr.getQName(count);
qname, rf);
}
}
- } else {
- }
-
+ attr = null;
parent.appendChild(element);
}
public void buildTopLevel(Document doc, Element svgRoot) {
// build up the info for the top level element
- if(this.properties instanceof DirectPropertyListBuilder.AttrPropertyList) {
- Attributes attr = ((DirectPropertyListBuilder.AttrPropertyList)this.properties).getAttributes();
for (int count = 0; count < attr.getLength(); count++) {
String rf = attr.getValue(count);
String qname = attr.getQName(count);
qname, rf);
}
}
- } else {
- }
}
public Document createBasicDocument() {
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
fact.setNamespaceAware(true);
doc = fact.newDocumentBuilder().newDocument();
- Element el = doc.createElement(tagName);
+ Element el = doc.createElement(name);
doc.appendChild(el);
element = doc.getDocumentElement();
public class BasicLink extends Inline {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new BasicLink(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new BasicLink.Maker();
- }
-
- public BasicLink(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public BasicLink(FObj parent) {
+ super(parent);
this.name = "fo:basic-link";
}
*/
public class BidiOverride extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new BidiOverride(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new BidiOverride.Maker();
- }
-
- protected BidiOverride(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public BidiOverride(FObj parent) {
+ super(parent);
this.name = "fo:bidi-override";
}
import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
/*
Modified by Mark Lillywhite mark-fop@inomial.com. The changes
here are based on memory profiling and do not change functionality.
public class Block extends FObjMixed {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Block(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Block.Maker();
- }
-
int align;
int alignLast;
int breakAfter;
// this may be helpful on other FOs too
boolean anythingLaidOut = false;
- public Block(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Block(FObj parent) {
+ super(parent);
this.name = "fo:block";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
this.span = this.properties.get("span").getEnum();
}
import java.util.Hashtable;
import java.util.Enumeration;
+import org.xml.sax.Attributes;
+
public class BlockContainer extends FObj {
ColorType backgroundColor;
AreaContainer areaContainer;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new BlockContainer(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new BlockContainer.Maker();
- }
-
PageSequence pageSequence;
- protected BlockContainer(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public BlockContainer(FObj parent) {
+ super(parent);
this.name = "fo:block-container";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
this.span = this.properties.get("span").getEnum();
}
public final static int OK = 0;
public final static int DOESNOT_FIT = 1;
- public Character(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Character(FObj parent) {
+ super(parent);
this.name = "fo:character";
}
- public static FObj.Maker maker() {
- return new Character.Maker();
- }
-
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Character(parent, propertyList);
- }
-
- }
-
-
public Status layout(Area area) throws FOPException {
BlockArea blockArea;
if (!(area instanceof BlockArea)) {
ImageArea imageArea;
-
- public ExternalGraphic(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ExternalGraphic(FObj parent) {
+ super(parent);
this.name = "fo:external-graphic";
}
-
public Status layout(Area area) throws FOPException {
if (this.marker == START) {
return new Status(Status.OK);
}
-
- public static FObj.Maker maker() {
- return new ExternalGraphic.Maker();
- }
-
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ExternalGraphic(parent, propertyList);
- }
-
- }
}
*/
public class Float extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Float(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Float.Maker();
- }
-
- protected Float(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public Float(FObj parent) {
+ super(parent);
this.name = "fo:float";
}
import java.util.Enumeration;
import java.util.Vector;
-public class Flow extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Flow(parent, propertyList);
- }
+import org.xml.sax.Attributes;
- }
-
- public static FObj.Maker maker() {
- return new Flow.Maker();
- }
+public class Flow extends FObj {
/**
* PageSequence container
private Status _status = new Status(Status.AREA_FULL_NONE);
- protected Flow(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public Flow(FObj parent) {
+ super(parent);
this.name = getElementName();
+ }
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
if (parent.getName().equals("fo:page-sequence")) {
this.pageSequence = (PageSequence)parent;
} else {
+ "page-sequence, not "
+ parent.getName());
}
- setFlowName(getProperty("flow-name").getString());
-
// according to communication from Paul Grosso (XSL-List,
// 001228, Number 406), confusion in spec section 6.4.5 about
// multiplicity of fo:flow in XSL 1.0 is cleared up - one (1)
// fo:flow per fo:page-sequence only.
-
- if (pageSequence.isFlowSet()) {
+/* if (pageSequence.isFlowSet()) {
if (this.name.equals("fo:flow")) {
throw new FOPException("Only a single fo:flow permitted"
+ " per fo:page-sequence");
+ " not allowed after fo:flow");
}
}
+*/
+ setFlowName(getProperty("flow-name").getString());
pageSequence.addFlow(this);
}
public class Footnote extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Footnote(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Footnote.Maker();
- }
-
- public Footnote(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public Footnote(FObj parent) {
+ super(parent);
this.name = "fo:footnote";
}
int endIndent;
int textIndent;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new FootnoteBody(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new FootnoteBody.Maker();
- }
-
- public FootnoteBody(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public FootnoteBody(FObj parent) {
+ super(parent);
this.name = "fo:footnote-body";
- this.areaClass = AreaClass.setAreaClass(AreaClass.XSL_FOOTNOTE);
}
public Status layout(Area area) throws FOPException {
+ this.areaClass = AreaClass.setAreaClass(AreaClass.XSL_FOOTNOTE);
if (this.marker == START) {
this.marker = 0;
}
*/
public class InitialPropertySet extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new InitialPropertySet(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new InitialPropertySet.Maker();
- }
-
- protected InitialPropertySet(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public InitialPropertySet(FObj parent) {
+ super(parent);
this.name = "fo:initial-property-set";
}
// Java
import java.util.Enumeration;
-public class Inline extends FObjMixed {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Inline(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new Inline.Maker();
- }
+public class Inline extends FObjMixed {
// Textdecoration
protected boolean underlined = false;
protected boolean lineThrough = false;
- public Inline(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public Inline(FObj parent) {
+ super(parent);
this.name = "fo:inline";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
+
if (parent.getName().equals("fo:flow")) {
throw new FOPException("inline formatting objects cannot"
+ " be directly under flow");
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
/**
*/
public class InlineContainer extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new InlineContainer(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new InlineContainer.Maker();
- }
-
- protected InlineContainer(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public InlineContainer(FObj parent) {
+ super(parent);
this.name = "fo:inline-container";
+ }
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
// Common Border, Padding, and Background Properties
BorderAndPadding bap = propMgr.getBorderAndPadding();
BackgroundProps bProps = propMgr.getBackgroundProps();
public class InstreamForeignObject extends FObj {
- /**
- * inner class for making SVG objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make an SVG object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the SVG object
- */
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new InstreamForeignObject(parent, propertyList);
- }
-
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for SVG objects
- */
- public static FObj.Maker maker() {
- return new InstreamForeignObject.Maker();
- }
-
int breakBefore;
int breakAfter;
int scaling;
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- public InstreamForeignObject(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public InstreamForeignObject(FObj parent) {
+ super(parent);
this.name = "fo:instream-foreign-object";
}
* The following patterns are treated: rule, space, dots.
* The pattern use-content is ignored, i.e. it still must be implemented.
*/
-
public class Leader extends FObjMixed {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Leader(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Leader.Maker();
- }
-
- public Leader(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Leader(FObj parent) {
+ super(parent);
this.name = "fo:leader";
}
public class ListBlock extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ListBlock(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new ListBlock.Maker();
- }
-
int align;
int alignLast;
int breakBefore;
int spaceBetweenListRows = 0;
ColorType backgroundColor;
- public ListBlock(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ListBlock(FObj parent) {
+ super(parent);
this.name = "fo:list-block";
}
public class ListItem extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ListItem(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new ListItem.Maker();
- }
-
int align;
int alignLast;
int breakBefore;
String id;
BlockArea blockArea;
- public ListItem(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ListItem(FObj parent) {
+ super(parent);
this.name = "fo:list-item";
}
public class ListItemBody extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ListItemBody(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new ListItemBody.Maker();
- }
-
- public ListItemBody(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ListItemBody(FObj parent) {
+ super(parent);
this.name = "fo:list-item-body";
}
public class ListItemLabel extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ListItemLabel(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new ListItemLabel.Maker();
- }
-
- public ListItemLabel(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public ListItemLabel(FObj parent) {
+ super(parent);
this.name = "fo:list-item-label";
}
import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
public class Marker extends FObjMixed {
private String markerClassName;
private Area registryArea;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Marker(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Marker.Maker();
- }
-
- public Marker(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Marker(FObj parent) {
+ super(parent);
this.name = "fo:marker";
+ }
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
// do check to see that 'this' is under fo:flow
this.markerClassName =
*/
public class MultiCase extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new MultiCase(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new MultiCase.Maker();
- }
-
- protected MultiCase(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public MultiCase(FObj parent) {
+ super(parent);
this.name = "fo:multi-case";
}
*/
public class MultiProperties extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new MultiProperties(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new MultiProperties.Maker();
- }
-
- protected MultiProperties(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public MultiProperties(FObj parent) {
+ super(parent);
this.name = "fo:multi-properties";
}
*/
public class MultiPropertySet extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new MultiPropertySet(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new MultiPropertySet.Maker();
- }
-
- protected MultiPropertySet(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public MultiPropertySet(FObj parent) {
+ super(parent);
this.name = "fo:multi-property-set";
}
*/
public class MultiSwitch extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new MultiSwitch(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new MultiSwitch.Maker();
- }
-
- protected MultiSwitch(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public MultiSwitch(FObj parent) {
+ super(parent);
this.name = "fo:multi-switch";
}
*/
public class MultiToggle extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new MultiToggle(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new MultiToggle.Maker();
- }
-
- protected MultiToggle(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public MultiToggle(FObj parent) {
+ super(parent);
this.name = "fo:multi-toggle";
}
public class PageNumber extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new PageNumber(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new PageNumber.Maker();
- }
-
float red;
float green;
float blue;
int whiteSpaceCollapse;
TextState ts;
- public PageNumber(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public PageNumber(FObj parent) {
+ super(parent);
this.name = "fo:page-number";
}
*/
public class PageNumberCitation extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new PageNumberCitation(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new PageNumberCitation.Maker();
- }
-
float red;
float green;
float blue;
TextState ts;
- public PageNumberCitation(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public PageNumberCitation(FObj parent) {
+ super(parent);
this.name = "fo:page-number-citation";
}
-
public Status layout(Area area) throws FOPException {
if (!(area instanceof BlockArea)) {
log.warn("page-number-citation outside block area");
// Java
import java.util.Vector;
+import org.xml.sax.Attributes;
+
public class RetrieveMarker extends FObjMixed {
private String retrieveClassName;
private int retrievePosition;
private int retrieveBoundary;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RetrieveMarker(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RetrieveMarker.Maker();
- }
-
- public RetrieveMarker(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public RetrieveMarker(FObj parent) {
+ super(parent);
this.name = "fo:retrieve-marker";
+ }
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
this.retrieveClassName =
this.properties.get("retrieve-class-name").getString();
this.retrievePosition =
public class StaticContent extends Flow {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new StaticContent(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new StaticContent.Maker();
- }
-
- protected StaticContent(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public StaticContent(FObj parent) {
+ super(parent);
((PageSequence)parent).setIsFlowSet(false); // hacquery of sorts
}
public class Table extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Table(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Table.Maker();
- }
-
private static final int MINCOLWIDTH = 10000; // 10pt
int breakBefore;
int breakAfter;
AreaContainer areaContainer;
- public Table(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Table(FObj parent) {
+ super(parent);
this.name = "fo:table";
}
*/
public class TableAndCaption extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableAndCaption(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableAndCaption.Maker();
- }
-
- protected TableAndCaption(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public TableAndCaption(FObj parent) {
+ super(parent);
this.name = "fo:table-and-caption";
}
public class TableBody extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableBody(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableBody.Maker();
- }
-
int spaceBefore;
int spaceAfter;
ColorType backgroundColor;
AreaContainer areaContainer;
- public TableBody(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableBody(FObj parent) {
+ super(parent);
this.name = "fo:table-body";
}
*/
public class TableCaption extends ToBeImplementedElement {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableCaption(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableCaption.Maker();
- }
-
- protected TableCaption(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public TableCaption(FObj parent) {
+ super(parent);
this.name = "fo:table-caption";
}
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.*;
-public class TableCell extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableCell(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new TableCell.Maker();
- }
+public class TableCell extends FObj {
// int spaceBefore;
// int spaceAfter;
AreaContainer cellArea;
- public TableCell(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableCell(FObj parent) {
+ super(parent);
this.name = "fo:table-cell";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
doSetup(); // init some basic property values
}
AreaContainer areaContainer;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableColumn(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableColumn.Maker();
- }
-
- public TableColumn(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableColumn(FObj parent) {
+ super(parent);
this.name = "fo:table-column";
}
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
-// Java
-import java.util.Vector;
-import java.util.Enumeration;
-
public class TableFooter extends TableBody {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableFooter(parent, propertyList);
- }
-
- }
-
public int getYPosition() {
return areaContainer.getCurrentYPosition() - spaceBefore;
}
areaContainer.setYPosition(value + 2 * spaceBefore);
}
- public static FObj.Maker maker() {
- return new TableFooter.Maker();
- }
-
- public TableFooter(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableFooter(FObj parent) {
+ super(parent);
this.name = "fo:table-footer";
}
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
-// Java
-import java.util.Vector;
-import java.util.Enumeration;
-
public class TableHeader extends TableBody {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableHeader(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableHeader.Maker();
- }
-
- public TableHeader(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableHeader(FObj parent) {
+ super(parent);
this.name = "fo:table-header";
}
public class TableRow extends FObj {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new TableRow(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new TableRow.Maker();
- }
-
boolean setup = false;
int breakAfter;
}
- public TableRow(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public TableRow(FObj parent) {
+ super(parent);
this.name = "fo:table-row";
}
*/
public class Wrapper extends FObjMixed {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new Wrapper(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Wrapper.Maker();
- }
-
- public Wrapper(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
+ public Wrapper(FObj parent) {
+ super(parent);
// check that this occurs inside an fo:flow
}
import org.apache.fop.fo.properties.*;
import org.apache.fop.apps.FOPException;
-public class ConditionalPageMasterReference extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new ConditionalPageMasterReference(parent, propertyList);
- }
+import org.xml.sax.Attributes;
- }
-
- public static FObj.Maker maker() {
- return new ConditionalPageMasterReference.Maker();
- }
+public class ConditionalPageMasterReference extends FObj {
private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives;
private int oddOrEven;
private int blankOrNotBlank;
- public ConditionalPageMasterReference(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public ConditionalPageMasterReference(FObj parent) {
+ super(parent);
this.name = getElementName();
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
if (getProperty("master-name") != null) {
setMasterName(getProperty("master-name").getString());
}
setPagePosition(this.properties.get("page-position").getEnum());
setOddOrEven(this.properties.get("odd-or-even").getEnum());
setBlankOrNotBlank(this.properties.get("blank-or-not-blank").getEnum());
-
-
}
protected void setMasterName(String masterName) {
// Java
import java.util.*;
-public class LayoutMasterSet extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new LayoutMasterSet(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new LayoutMasterSet.Maker();
- }
+public class LayoutMasterSet extends FObj {
private Hashtable simplePageMasters;
private Hashtable pageSequenceMasters;
private Root root;
- protected LayoutMasterSet(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public LayoutMasterSet(FObj parent) {
+ super(parent);
this.name = "fo:layout-master-set";
+ }
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
this.simplePageMasters = new Hashtable();
this.pageSequenceMasters = new Hashtable();
import org.apache.fop.fo.properties.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
/**
* Base PageMasterReference class. Provides implementation for handling the
* master-name attribute and containment within a PageSequenceMaster
private String _masterName;
private PageSequenceMaster _pageSequenceMaster;
- public PageMasterReference(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public PageMasterReference(FObj parent) {
+ super(parent);
this.name = getElementName();
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
if (getProperty("master-name") != null) {
setMasterName(getProperty("master-name").getString());
}
// Java
import java.util.*;
+import org.xml.sax.Attributes;
+
/**
* This provides pagination of flows onto pages. Much of the
* logic for paginating flows is contained in this class.
* The main entry point is the format method.
*/
public class PageSequence extends FObj {
- //
- // Factory methods
- //
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new PageSequence(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new PageSequence.Maker();
- }
-
//
// intial-page-number types
//
private String currentPageMasterName;
- protected PageSequence(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public PageSequence(FObj parent) {
+ super(parent);
this.name = "fo:page-sequence";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
if (parent.getName().equals("fo:root")) {
this.root = (Root)parent;
// Java
import java.util.*;
-public class PageSequenceMaster extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new PageSequenceMaster(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new PageSequenceMaster.Maker();
- }
+public class PageSequenceMaster extends FObj {
LayoutMasterSet layoutMasterSet;
Vector subSequenceSpecifiers;
// references to page-masters. So the methods use the former
// terminology ('sub-sequence-specifiers', or SSS),
// but the actual FO's are MasterReferences.
- protected PageSequenceMaster(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public PageSequenceMaster(FObj parent) {
+ super(parent);
this.name = "fo:page-sequence-master";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
subSequenceSpecifiers = new Vector();
import org.apache.fop.apps.FOPException;
import org.apache.fop.layout.RegionArea;
+import org.xml.sax.Attributes;
+
/**
* This is an abstract base class for pagination regions
*/
private SimplePageMaster _layoutMaster;
private String _regionName;
- protected Region(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ protected Region(FObj parent) {
+ super(parent);
this.name = getElementName();
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
// regions may have name, or default
if (null == this.properties.get(PROP_REGION_NAME)) {
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.BackgroundProps;
-public class RegionAfter extends Region {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RegionAfter(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new RegionAfter.Maker();
- }
+public class RegionAfter extends Region {
public static final String REGION_CLASS = "after";
private int precedence;
- protected RegionAfter(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public RegionAfter(FObj parent) {
+ super(parent);
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
precedence = this.properties.get("precedence").getEnum();
}
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.apps.FOPException;
-public class RegionBefore extends Region {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RegionBefore(parent, propertyList);
- }
+import org.xml.sax.Attributes;
- }
-
- public static FObj.Maker maker() {
- return new RegionBefore.Maker();
- }
+public class RegionBefore extends Region {
public static final String REGION_CLASS = "before";
private int precedence;
- protected RegionBefore(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
- precedence = this.properties.get("precedence").getEnum();
+ public RegionBefore(FObj parent) {
+ super(parent);
}
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
+ precedence = this.properties.get("precedence").getEnum();
+ }
RegionArea makeRegionArea(int allocationRectangleXPosition,
int allocationRectangleYPosition,
public class RegionBody extends Region {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RegionBody(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RegionBody.Maker();
- }
-
public static final String REGION_CLASS = "body";
ColorType backgroundColor;
- protected RegionBody(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public RegionBody(FObj parent) {
+ super(parent);
}
RegionArea makeRegionArea(int allocationRectangleXPosition,
public class RegionEnd extends Region {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RegionEnd(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RegionEnd.Maker();
- }
-
public static final String REGION_CLASS = "end";
- protected RegionEnd(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public RegionEnd(FObj parent) {
+ super(parent);
}
-
RegionArea makeRegionArea(int allocationRectangleXPosition,
int allocationRectangleYPosition,
int allocationRectangleWidth,
public class RegionStart extends Region {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RegionStart(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RegionStart.Maker();
- }
-
public static final String REGION_CLASS = "start";
- protected RegionStart(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
+ public RegionStart(FObj parent) {
+ super(parent);
}
-
RegionArea makeRegionArea(int allocationRectangleXPosition,
int allocationRectangleYPosition,
int allocationRectangleWidth,
// Java
import java.util.Vector;
+import org.xml.sax.Attributes;
+
public class RepeatablePageMasterAlternatives extends FObj
implements SubSequenceSpecifier {
private static final int INFINITE = -1;
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RepeatablePageMasterAlternatives(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RepeatablePageMasterAlternatives.Maker();
- }
-
private PageSequenceMaster pageSequenceMaster;
/**
private Vector conditionalPageMasterRefs;
- public RepeatablePageMasterAlternatives(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public RepeatablePageMasterAlternatives(FObj parent) {
+ super(parent);
this.name = "fo:repeatable-page-master-alternatives";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
conditionalPageMasterRefs = new Vector();
import org.apache.fop.fo.*;
import org.apache.fop.apps.FOPException;
+import org.xml.sax.Attributes;
+
public class RepeatablePageMasterReference extends PageMasterReference
implements SubSequenceSpecifier {
private static final int INFINITE = -1;
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new RepeatablePageMasterReference(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new RepeatablePageMasterReference.Maker();
- }
-
-
private PageSequenceMaster pageSequenceMaster;
private int maximumRepeats;
private int numberConsumed = 0;
- public RepeatablePageMasterReference(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public RepeatablePageMasterReference(FObj parent) {
+ super(parent);
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
String mr = getProperty("maximum-repeats").getString();
if (mr.equals("no-limit")) {
*/
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 FObj.Maker maker() {
- return new Root.Maker();
- }
-
LayoutMasterSet layoutMasterSet;
Vector pageSequences;
*/
private int runningPageNumberCounter = 0;
- protected Root(FObj parent,
- PropertyList propertyList) throws FOPException {
- super(parent, propertyList);
- this.name = "fo:root";
+ public Root(FObj parent) {
+ super(parent);
// this.properties.get("media-usage");
pageSequences = new Vector();
if (parent != null) {
- throw new FOPException("root must be root element");
+ //throw new FOPException("root must be root element");
}
}
public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) {
this.layoutMasterSet = layoutMasterSet;
}
-/*
- public void format(AreaTree areaTree) throws FOPException {
- // log.debug(" Root[" + marker + "] ");
- if (layoutMasterSet == null) {
- throw new FOPException("No layout master set.");
- }
-
- Enumeration e = children.elements();
- while (e.hasMoreElements()) {
- Object o = e.nextElement();
- if (o instanceof PageSequence) {
- ((PageSequence)o).format(areaTree);
- } else if (o instanceof ExtensionObj) {
- ((ExtensionObj)o).format(areaTree);
- }
- }
- }
-*/
}
import java.util.*;
-public class SimplePageMaster extends FObj {
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new SimplePageMaster(parent, propertyList);
- }
-
- }
+import org.xml.sax.Attributes;
- public static FObj.Maker maker() {
- return new SimplePageMaster.Maker();
- }
+public class SimplePageMaster extends FObj {
/**
* Page regions (regionClass, Region)
*/
private Hashtable _regions;
-
LayoutMasterSet layoutMasterSet;
PageMaster pageMaster;
String masterName;
boolean afterPrecedence;
int afterHeight;
- protected SimplePageMaster(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public SimplePageMaster(FObj parent) {
+ super(parent);
this.name = "fo:simple-page-master";
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
public class SinglePageMasterReference extends PageMasterReference
implements SubSequenceSpecifier {
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new SinglePageMasterReference(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new SinglePageMasterReference.Maker();
- }
-
private static final int FIRST = 0;
private static final int DONE = 1;
private int state;
- public SinglePageMasterReference(FObj parent, PropertyList propertyList)
- throws FOPException {
- super(parent, propertyList);
+ public SinglePageMasterReference(FObj parent) {
+ super(parent);
this.state = FIRST;
-
}
public String getNextPageMaster(int currentPageNumber,
return new PDFGraphicsDevice(this);
}
+/*
+// for jdk1.4
+public java.awt.image.VolatileImage createCompatibleVolatileImage(int width, int height) {
+return null;
+}
+*/
}
/**
import org.w3c.dom.*;
import org.w3c.dom.svg.*;
import org.w3c.dom.svg.SVGLength;
+import org.xml.sax.Attributes;
import org.apache.batik.bridge.*;
import org.apache.batik.swing.svg.*;
import org.apache.batik.swing.gvt.*;
*/
public class SVGElement extends SVGObj {
- /**
- * inner class for making SVG objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make an SVG object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the SVG object
- */
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new SVGElement(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for SVG objects
- */
- public static FObj.Maker maker() {
- return new SVGElement.Maker();
- }
-
FontState fs;
/**
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- public SVGElement(FObj parent, PropertyList propertyList) {
- super(parent, propertyList, "svg");
+ public SVGElement(FObj parent) {
+ super(parent);
+ }
+
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
init();
}
import java.util.Enumeration;
import java.util.HashMap;
-import org.apache.fop.fo.DirectPropertyListBuilder;
-import org.apache.fop.fo.TreeBuilder;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeBuilder;
import org.apache.fop.fo.ElementMapping;
import org.apache.fop.apps.Driver;
private static HashMap foObjs = null;
- public synchronized void addToBuilder(TreeBuilder builder) {
+ public synchronized void addToBuilder(FOTreeBuilder builder) {
try {
if (foObjs == null) {
// this sets the parser that will be used
Driver.getParserClassName());
foObjs = new HashMap();
- foObjs.put("svg", SVGElement.maker());
- foObjs.put("rect", SVGObj.maker("rect"));
- foObjs.put("line", SVGObj.maker("line"));
- foObjs.put("text", SVGObj.maker("text"));
-
- foObjs.put("desc", SVGObj.maker("desc"));
- foObjs.put("title", SVGObj.maker("title"));
- foObjs.put("circle", SVGObj.maker("circle"));
- foObjs.put("ellipse", SVGObj.maker("ellipse"));
- foObjs.put("g", SVGObj.maker("g"));
- foObjs.put("polyline", SVGObj.maker("polyline"));
- foObjs.put("polygon", SVGObj.maker("polygon"));
- foObjs.put("defs", SVGObj.maker("defs"));
- foObjs.put("path", SVGObj.maker("path"));
- foObjs.put("use", SVGObj.maker("use"));
- foObjs.put("tspan", SVGObj.maker("tspan"));
- foObjs.put("tref", SVGObj.maker("tref"));
- foObjs.put("image", SVGObj.maker("image"));
- foObjs.put("style", SVGObj.maker("style"));
-
- foObjs.put("textPath", SVGObj.maker("textPath"));
- foObjs.put("clipPath", SVGObj.maker("clipPath"));
- foObjs.put("mask", SVGObj.maker("mask"));
- foObjs.put("linearGradient", SVGObj.maker("linearGradient"));
- foObjs.put("radialGradient", SVGObj.maker("radialGradient"));
- foObjs.put("stop", SVGObj.maker("stop"));
- foObjs.put("a", SVGObj.maker("a"));
- foObjs.put("switch", SVGObj.maker("switch"));
- foObjs.put("symbol", SVGObj.maker("symbol"));
-
- foObjs.put("pattern", SVGObj.maker("pattern"));
-
- foObjs.put("marker", SVGObj.maker("marker"));
- foObjs.put("animate", SVGObj.maker("animate"));
- foObjs.put("altGlyph", SVGObj.maker("altGlyph"));
- foObjs.put("font", SVGObj.maker("font"));
- foObjs.put("glyph", SVGObj.maker("glyph"));
- foObjs.put("missing-glyph", SVGObj.maker("missing-glyph"));
- foObjs.put("hkern", SVGObj.maker("hkern"));
- foObjs.put("vkern", SVGObj.maker("vkern"));
- foObjs.put("set", SVGObj.maker("set"));
- foObjs.put("animateMotion", SVGObj.maker("animateMotion"));
- foObjs.put("animateColor", SVGObj.maker("animateColor"));
- foObjs.put("animateTransform", SVGObj.maker("animateTransform"));
- foObjs.put("cursor", SVGObj.maker("cursor"));
- foObjs.put("filter", SVGObj.maker("filter"));
-
- foObjs.put("feFlood", SVGObj.maker("feFlood"));
- foObjs.put("feGaussianBlur", SVGObj.maker("feGaussianBlur"));
- foObjs.put("feOffset", SVGObj.maker("feOffset"));
- foObjs.put("feMerge", SVGObj.maker("feMerge"));
- foObjs.put("feMergeNode", SVGObj.maker("feMergeNode"));
+ foObjs.put("svg", new SE());
+ foObjs.put("<default>", new SVGMaker());
}
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
builder.addMapping(svgNS, foObjs);
-
- builder.addPropertyListBuilder(svgNS,
- new DirectPropertyListBuilder());
} catch (Throwable t) {
// if the classes are not available
}
}
+ class SVGMaker extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new SVGObj(parent);
+ }
+ }
+
+ class SE extends ElementMapping.Maker {
+ public FObj make(FObj parent) {
+ return new SVGElement(parent);
+ }
+ }
}
import org.w3c.dom.Element;
public class SVGObj extends XMLObj {
- /**
- * inner class for making svg objects.
- */
- public static class Maker extends FObj.Maker {
- String tag;
-
- Maker(String str) {
- tag = str;
- }
-
- /**
- * make an svg object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the svg object
- */
- public FObj make(FObj parent,
- PropertyList propertyList) throws FOPException {
- return new SVGObj(parent, propertyList, tag);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for an svg object
- */
- public static FObj.Maker maker(String str) {
- return new SVGObj.Maker(str);
- }
-
/**
* constructs an svg object (called by Maker).
*
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*/
- protected SVGObj(FObj parent, PropertyList propertyList, String tag) {
- super(parent, propertyList, tag);
- this.name = "svg:" + tag;
+ public SVGObj(FObj parent) {
+ super(parent);
}
public String getNameSpace() {
return "http://www.w3.org/2000/svg";
}
+
}