From: Keiron Liddle Date: Tue, 6 Nov 2001 08:34:53 +0000 (+0000) Subject: changed the way that elements and properties are handled X-Git-Tag: fop-0_20_4-doc~227 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31965968c68717055bbd096b709df3e72ceb8b40;p=xmlgraphics-fop.git changed the way that elements and properties are handled the element makers are associated with the element mapping attributes are passed to the element object the object can then use the attributes to make the properties added default value for element handling, makes it easier to ensure all elements of an external xml markup are loaded (eg. svg) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194536 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index 7cb5579c5..3aa93e725 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -284,7 +284,7 @@ public class Driver { * */ 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"); diff --git a/src/org/apache/fop/apps/StreamRenderer.java b/src/org/apache/fop/apps/StreamRenderer.java index 476137634..df4db1af3 100644 --- a/src/org/apache/fop/apps/StreamRenderer.java +++ b/src/org/apache/fop/apps/StreamRenderer.java @@ -158,8 +158,8 @@ public class StreamRenderer { 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"); } /** diff --git a/src/org/apache/fop/area/inline/Image.java b/src/org/apache/fop/area/inline/Image.java index 3899997a5..47574369b 100644 --- a/src/org/apache/fop/area/inline/Image.java +++ b/src/org/apache/fop/area/inline/Image.java @@ -11,6 +11,8 @@ import org.apache.fop.area.Area; // 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; diff --git a/src/org/apache/fop/extensions/ExtensionElementMapping.java b/src/org/apache/fop/extensions/ExtensionElementMapping.java index c6c8ae402..70e72cd30 100644 --- a/src/org/apache/fop/extensions/ExtensionElementMapping.java +++ b/src/org/apache/fop/extensions/ExtensionElementMapping.java @@ -8,8 +8,6 @@ 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; @@ -21,24 +19,24 @@ public class ExtensionElementMapping implements ElementMapping { 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); + } + } } diff --git a/src/org/apache/fop/extensions/ExtensionObj.java b/src/org/apache/fop/extensions/ExtensionObj.java index 9cfc091ef..170e198be 100644 --- a/src/org/apache/fop/extensions/ExtensionObj.java +++ b/src/org/apache/fop/extensions/ExtensionObj.java @@ -10,6 +10,9 @@ package org.apache.fop.extensions; 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 @@ -21,8 +24,8 @@ public abstract class ExtensionObj extends FObj { * @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); } /** @@ -38,7 +41,6 @@ public abstract class ExtensionObj extends FObj { 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 @@ -51,4 +53,17 @@ public abstract class ExtensionObj extends FObj { 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); + } } diff --git a/src/org/apache/fop/extensions/Label.java b/src/org/apache/fop/extensions/Label.java index aa6bf1c31..cbc274413 100644 --- a/src/org/apache/fop/extensions/Label.java +++ b/src/org/apache/fop/extensions/Label.java @@ -13,19 +13,8 @@ import org.apache.fop.fo.*; 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) { diff --git a/src/org/apache/fop/extensions/Outline.java b/src/org/apache/fop/extensions/Outline.java index e9c8a0ca2..eb5d9da0e 100644 --- a/src/org/apache/fop/extensions/Outline.java +++ b/src/org/apache/fop/extensions/Outline.java @@ -11,9 +11,11 @@ import org.apache.fop.fo.*; 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; @@ -32,21 +34,12 @@ public class Outline extends ExtensionObj { */ 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 = @@ -92,7 +85,7 @@ public class Outline extends ExtensionObj { } public Label getLabel() { - return _label == null ? new Label(this, this.properties) : _label; + return _label == null ? new Label(this) : _label; } public Vector getOutlines() { diff --git a/src/org/apache/fop/fo/ColorProfile.java b/src/org/apache/fop/fo/ColorProfile.java index 020b6cce6..d3cb86eba 100644 --- a/src/org/apache/fop/fo/ColorProfile.java +++ b/src/org/apache/fop/fo/ColorProfile.java @@ -20,21 +20,8 @@ import org.apache.fop.apps.FOPException; */ 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"); diff --git a/src/org/apache/fop/fo/Declarations.java b/src/org/apache/fop/fo/Declarations.java index ce711f4f0..b7bcb7b7f 100644 --- a/src/org/apache/fop/fo/Declarations.java +++ b/src/org/apache/fop/fo/Declarations.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/DirectPropertyListBuilder.java b/src/org/apache/fop/fo/DirectPropertyListBuilder.java deleted file mode 100644 index d4f3fa02e..000000000 --- a/src/org/apache/fop/fo/DirectPropertyListBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $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; - } - } -} diff --git a/src/org/apache/fop/fo/ElementMapping.java b/src/org/apache/fop/fo/ElementMapping.java index 25137f0f8..d9e86be9a 100644 --- a/src/org/apache/fop/fo/ElementMapping.java +++ b/src/org/apache/fop/fo/ElementMapping.java @@ -12,5 +12,11 @@ package org.apache.fop.fo; * 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; + } + } } diff --git a/src/org/apache/fop/fo/FOElementMapping.java b/src/org/apache/fop/fo/FOElementMapping.java new file mode 100644 index 000000000..978a909d4 --- /dev/null +++ b/src/org/apache/fop/fo/FOElementMapping.java @@ -0,0 +1,449 @@ +/* + * $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); + } + } +} diff --git a/src/org/apache/fop/fo/FONode.java b/src/org/apache/fop/fo/FONode.java index af4791a40..0843f51e1 100644 --- a/src/org/apache/fop/fo/FONode.java +++ b/src/org/apache/fop/fo/FONode.java @@ -22,6 +22,8 @@ import org.apache.log.Logger; import java.util.Vector; import java.util.Hashtable; +import org.xml.sax.Attributes; + /** * base class for nodes in the formatting object tree * @@ -93,6 +95,9 @@ abstract public class FONode { log = logger; } + public void handleAttrs(Attributes attlist) throws FOPException { + } + public void setIsInTableCell() { this.isInTableCell = true; // made recursive by Eric Schaeffer diff --git a/src/org/apache/fop/fo/FOTreeBuilder.java b/src/org/apache/fop/fo/FOTreeBuilder.java index e4ac25758..6d6fd4172 100644 --- a/src/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/org/apache/fop/fo/FOTreeBuilder.java @@ -26,7 +26,6 @@ import org.xml.sax.Attributes; // Java import java.util.HashMap; -import java.util.Stack; import java.util.ArrayList; import java.io.IOException; @@ -41,7 +40,7 @@ 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 @@ -51,11 +50,6 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { 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 */ @@ -104,56 +98,6 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { 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 */ @@ -170,18 +114,6 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { 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(); } @@ -210,16 +142,17 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { 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(""); + } } - PropertyListBuilder currentListBuilder = - (PropertyListBuilder)this.propertylistTable.get(uri); - boolean foreignXML = false; if (fobjMaker == null) { String fullName = uri + "^" + localName; @@ -232,28 +165,16 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { // 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); } diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java index 02d305719..1f626a5ba 100644 --- a/src/org/apache/fop/fo/FObj.java +++ b/src/org/apache/fop/fo/FObj.java @@ -11,40 +11,47 @@ package org.apache.fop.fo; 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(); } diff --git a/src/org/apache/fop/fo/FObjMixed.java b/src/org/apache/fop/fo/FObjMixed.java index ddab909cc..607211d07 100644 --- a/src/org/apache/fop/fo/FObjMixed.java +++ b/src/org/apache/fop/fo/FObjMixed.java @@ -16,20 +16,8 @@ import org.apache.fop.apps.FOPException; */ 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) { diff --git a/src/org/apache/fop/fo/StandardElementMapping.java b/src/org/apache/fop/fo/StandardElementMapping.java deleted file mode 100644 index 5938bf0fd..000000000 --- a/src/org/apache/fop/fo/StandardElementMapping.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * $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)); - } - - } - -} diff --git a/src/org/apache/fop/fo/Title.java b/src/org/apache/fop/fo/Title.java index b55b0aeea..f5f4648a8 100644 --- a/src/org/apache/fop/fo/Title.java +++ b/src/org/apache/fop/fo/Title.java @@ -20,21 +20,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/ToBeImplementedElement.java b/src/org/apache/fop/fo/ToBeImplementedElement.java index f1df7e563..3243cd522 100644 --- a/src/org/apache/fop/fo/ToBeImplementedElement.java +++ b/src/org/apache/fop/fo/ToBeImplementedElement.java @@ -18,9 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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 { diff --git a/src/org/apache/fop/fo/TreeBuilder.java b/src/org/apache/fop/fo/TreeBuilder.java deleted file mode 100644 index 3076a2d6c..000000000 --- a/src/org/apache/fop/fo/TreeBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $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); - -} diff --git a/src/org/apache/fop/fo/Unknown.java b/src/org/apache/fop/fo/Unknown.java index 43cd255e8..0ab6c80e7 100644 --- a/src/org/apache/fop/fo/Unknown.java +++ b/src/org/apache/fop/fo/Unknown.java @@ -23,22 +23,14 @@ import org.apache.fop.apps.FOPException; */ 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 { diff --git a/src/org/apache/fop/fo/UnknownXMLObj.java b/src/org/apache/fop/fo/UnknownXMLObj.java index 0110dd992..97a3f6e87 100644 --- a/src/org/apache/fop/fo/UnknownXMLObj.java +++ b/src/org/apache/fop/fo/UnknownXMLObj.java @@ -18,55 +18,27 @@ import org.w3c.dom.Element; 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() { @@ -88,11 +60,11 @@ public class UnknownXMLObj extends XMLObj { } 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); diff --git a/src/org/apache/fop/fo/XMLElement.java b/src/org/apache/fop/fo/XMLElement.java index dc8586414..0db6997ed 100644 --- a/src/org/apache/fop/fo/XMLElement.java +++ b/src/org/apache/fop/fo/XMLElement.java @@ -13,53 +13,26 @@ import org.apache.fop.layout.Area; 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(); } diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index bc56718aa..9658f8552 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -28,7 +28,8 @@ import java.util.*; */ public abstract class XMLObj extends FObj { - protected String tagName = ""; + // temp reference for attributes + Attributes attr = null; protected Element element; protected Document doc; @@ -38,21 +39,25 @@ public abstract class XMLObj extends FObj { * @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); @@ -70,16 +75,12 @@ public abstract class XMLObj extends FObj { 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); @@ -97,8 +98,6 @@ public abstract class XMLObj extends FObj { qname, rf); } } - } else { - } } public Document createBasicDocument() { @@ -109,7 +108,7 @@ public abstract class XMLObj extends FObj { 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(); diff --git a/src/org/apache/fop/fo/flow/BasicLink.java b/src/org/apache/fop/fo/flow/BasicLink.java index ae1bad695..e8d19d6e7 100644 --- a/src/org/apache/fop/fo/flow/BasicLink.java +++ b/src/org/apache/fop/fo/flow/BasicLink.java @@ -20,21 +20,8 @@ import java.awt.Rectangle; 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"; } diff --git a/src/org/apache/fop/fo/flow/BidiOverride.java b/src/org/apache/fop/fo/flow/BidiOverride.java index 5133369bf..4127cbe00 100644 --- a/src/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/org/apache/fop/fo/flow/BidiOverride.java @@ -19,21 +19,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index 1b6c812fa..687d08bc7 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -14,6 +14,8 @@ import org.apache.fop.layout.*; 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. @@ -31,18 +33,6 @@ import org.apache.fop.apps.FOPException; 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; @@ -66,9 +56,13 @@ public class Block extends FObjMixed { // 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(); } diff --git a/src/org/apache/fop/fo/flow/BlockContainer.java b/src/org/apache/fop/fo/flow/BlockContainer.java index 563fbbfcc..57084d570 100644 --- a/src/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/org/apache/fop/fo/flow/BlockContainer.java @@ -19,6 +19,8 @@ import org.apache.fop.datatypes.*; import java.util.Hashtable; import java.util.Enumeration; +import org.xml.sax.Attributes; + public class BlockContainer extends FObj { ColorType backgroundColor; @@ -35,24 +37,15 @@ public class BlockContainer extends FObj { 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(); } diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java index ac8b870ab..ee325b949 100644 --- a/src/org/apache/fop/fo/flow/Character.java +++ b/src/org/apache/fop/fo/flow/Character.java @@ -37,25 +37,11 @@ public class Character extends FObj { 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)) { diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java index e5ce14930..5a988f7a0 100644 --- a/src/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java @@ -36,13 +36,11 @@ public class ExternalGraphic extends FObj { 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) { @@ -251,18 +249,5 @@ public class ExternalGraphic extends FObj { 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); - } - - } } diff --git a/src/org/apache/fop/fo/flow/Float.java b/src/org/apache/fop/fo/flow/Float.java index b88e7873c..d77c0d635 100644 --- a/src/org/apache/fop/fo/flow/Float.java +++ b/src/org/apache/fop/fo/flow/Float.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/Flow.java b/src/org/apache/fop/fo/flow/Flow.java index 9846c86d7..d705d9cd2 100644 --- a/src/org/apache/fop/fo/flow/Flow.java +++ b/src/org/apache/fop/fo/flow/Flow.java @@ -20,19 +20,9 @@ import java.util.Hashtable; 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 @@ -62,11 +52,13 @@ public class Flow extends FObj { 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 { @@ -74,14 +66,11 @@ public class Flow extends FObj { + "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"); @@ -90,6 +79,8 @@ public class Flow extends FObj { + " not allowed after fo:flow"); } } +*/ + setFlowName(getProperty("flow-name").getString()); pageSequence.addFlow(this); } diff --git a/src/org/apache/fop/fo/flow/Footnote.java b/src/org/apache/fop/fo/flow/Footnote.java index 3348b730d..4cdea7820 100644 --- a/src/org/apache/fop/fo/flow/Footnote.java +++ b/src/org/apache/fop/fo/flow/Footnote.java @@ -20,21 +20,8 @@ import java.util.Vector; 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"; } diff --git a/src/org/apache/fop/fo/flow/FootnoteBody.java b/src/org/apache/fop/fo/flow/FootnoteBody.java index 029ea5b92..5a2487126 100644 --- a/src/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/org/apache/fop/fo/flow/FootnoteBody.java @@ -27,26 +27,13 @@ public class FootnoteBody extends FObj { 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; } diff --git a/src/org/apache/fop/fo/flow/InitialPropertySet.java b/src/org/apache/fop/fo/flow/InitialPropertySet.java index aa53341a3..3c081007d 100644 --- a/src/org/apache/fop/fo/flow/InitialPropertySet.java +++ b/src/org/apache/fop/fo/flow/InitialPropertySet.java @@ -19,21 +19,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/Inline.java b/src/org/apache/fop/fo/flow/Inline.java index 69987b4e7..e954aa86c 100644 --- a/src/org/apache/fop/fo/flow/Inline.java +++ b/src/org/apache/fop/fo/flow/Inline.java @@ -16,19 +16,9 @@ import org.apache.fop.fo.properties.*; // 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; @@ -36,10 +26,14 @@ public class Inline extends FObjMixed { 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"); diff --git a/src/org/apache/fop/fo/flow/InlineContainer.java b/src/org/apache/fop/fo/flow/InlineContainer.java index 61aba7695..0f003208a 100644 --- a/src/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/org/apache/fop/fo/flow/InlineContainer.java @@ -14,27 +14,19 @@ import org.apache.fop.fo.properties.*; 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(); diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java index 27f9dc1c4..6a6e56e87 100644 --- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -21,35 +21,6 @@ import java.util.Enumeration; 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; @@ -74,8 +45,8 @@ public class InstreamForeignObject extends FObj { * @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"; } diff --git a/src/org/apache/fop/fo/flow/Leader.java b/src/org/apache/fop/fo/flow/Leader.java index b2a29007f..20a82b24d 100644 --- a/src/org/apache/fop/fo/flow/Leader.java +++ b/src/org/apache/fop/fo/flow/Leader.java @@ -23,23 +23,10 @@ import org.apache.fop.apps.FOPException; * 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"; } diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java index 935ba9ccb..ce82cc3b0 100644 --- a/src/org/apache/fop/fo/flow/ListBlock.java +++ b/src/org/apache/fop/fo/flow/ListBlock.java @@ -21,18 +21,6 @@ import java.util.Enumeration; 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; @@ -45,8 +33,8 @@ public class ListBlock extends FObj { 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"; } diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java index 683a2b024..06d802cfe 100644 --- a/src/org/apache/fop/fo/flow/ListItem.java +++ b/src/org/apache/fop/fo/flow/ListItem.java @@ -20,18 +20,6 @@ import java.util.Enumeration; 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; @@ -44,8 +32,8 @@ public class ListItem extends FObj { String id; BlockArea blockArea; - public ListItem(FObj parent, PropertyList propertyList) { - super(parent, propertyList); + public ListItem(FObj parent) { + super(parent); this.name = "fo:list-item"; } diff --git a/src/org/apache/fop/fo/flow/ListItemBody.java b/src/org/apache/fop/fo/flow/ListItemBody.java index fa00c4b4d..40ed3a35b 100644 --- a/src/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/org/apache/fop/fo/flow/ListItemBody.java @@ -19,20 +19,8 @@ import java.util.Enumeration; 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"; } diff --git a/src/org/apache/fop/fo/flow/ListItemLabel.java b/src/org/apache/fop/fo/flow/ListItemLabel.java index a649459d3..890247f57 100644 --- a/src/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/org/apache/fop/fo/flow/ListItemLabel.java @@ -19,20 +19,8 @@ import java.util.Enumeration; 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"; } diff --git a/src/org/apache/fop/fo/flow/Marker.java b/src/org/apache/fop/fo/flow/Marker.java index 0eb0baaa5..8267dcdf5 100644 --- a/src/org/apache/fop/fo/flow/Marker.java +++ b/src/org/apache/fop/fo/flow/Marker.java @@ -14,27 +14,20 @@ import org.apache.fop.layout.*; 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 = diff --git a/src/org/apache/fop/fo/flow/MultiCase.java b/src/org/apache/fop/fo/flow/MultiCase.java index d3c0884c2..5111cadf3 100644 --- a/src/org/apache/fop/fo/flow/MultiCase.java +++ b/src/org/apache/fop/fo/flow/MultiCase.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/MultiProperties.java b/src/org/apache/fop/fo/flow/MultiProperties.java index 19cd50019..c0262a95b 100644 --- a/src/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/org/apache/fop/fo/flow/MultiProperties.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/MultiPropertySet.java b/src/org/apache/fop/fo/flow/MultiPropertySet.java index f9c9fb96e..aebff3405 100644 --- a/src/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/org/apache/fop/fo/flow/MultiPropertySet.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/MultiSwitch.java b/src/org/apache/fop/fo/flow/MultiSwitch.java index eabd80535..505efef29 100644 --- a/src/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/org/apache/fop/fo/flow/MultiSwitch.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/MultiToggle.java b/src/org/apache/fop/fo/flow/MultiToggle.java index f49fcd170..6605c4fb5 100644 --- a/src/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/org/apache/fop/fo/flow/MultiToggle.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/PageNumber.java b/src/org/apache/fop/fo/flow/PageNumber.java index 81b807a15..b67f569fd 100644 --- a/src/org/apache/fop/fo/flow/PageNumber.java +++ b/src/org/apache/fop/fo/flow/PageNumber.java @@ -20,18 +20,6 @@ import java.util.Enumeration; 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; @@ -39,8 +27,8 @@ public class PageNumber extends FObj { int whiteSpaceCollapse; TextState ts; - public PageNumber(FObj parent, PropertyList propertyList) { - super(parent, propertyList); + public PageNumber(FObj parent) { + super(parent); this.name = "fo:page-number"; } diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index 447149cce..b0881783e 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -72,18 +72,6 @@ import org.apache.fop.apps.FOPException; */ 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; @@ -96,12 +84,11 @@ public class PageNumberCitation extends FObj { 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"); diff --git a/src/org/apache/fop/fo/flow/RetrieveMarker.java b/src/org/apache/fop/fo/flow/RetrieveMarker.java index 67e9f5047..b7f322522 100644 --- a/src/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/org/apache/fop/fo/flow/RetrieveMarker.java @@ -17,28 +17,21 @@ import org.apache.fop.apps.FOPException; // 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 = diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java index 9e50e242b..dd02ff0d3 100644 --- a/src/org/apache/fop/fo/flow/StaticContent.java +++ b/src/org/apache/fop/fo/flow/StaticContent.java @@ -19,21 +19,8 @@ import java.util.Enumeration; 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 } diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 6ebd4b711..9349b3f91 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -20,18 +20,6 @@ import java.util.Enumeration; 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; @@ -59,8 +47,8 @@ public class Table extends FObj { AreaContainer areaContainer; - public Table(FObj parent, PropertyList propertyList) { - super(parent, propertyList); + public Table(FObj parent) { + super(parent); this.name = "fo:table"; } diff --git a/src/org/apache/fop/fo/flow/TableAndCaption.java b/src/org/apache/fop/fo/flow/TableAndCaption.java index d7cbebf20..22db586c1 100644 --- a/src/org/apache/fop/fo/flow/TableAndCaption.java +++ b/src/org/apache/fop/fo/flow/TableAndCaption.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index 7ca06d172..3b85e0754 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -20,18 +20,6 @@ import java.util.Enumeration; 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; @@ -42,8 +30,8 @@ public class TableBody extends FObj { AreaContainer areaContainer; - public TableBody(FObj parent, PropertyList propertyList) { - super(parent, propertyList); + public TableBody(FObj parent) { + super(parent); this.name = "fo:table-body"; } diff --git a/src/org/apache/fop/fo/flow/TableCaption.java b/src/org/apache/fop/fo/flow/TableCaption.java index 396f08863..ef4ccc62e 100644 --- a/src/org/apache/fop/fo/flow/TableCaption.java +++ b/src/org/apache/fop/fo/flow/TableCaption.java @@ -18,21 +18,8 @@ import org.apache.fop.apps.FOPException; */ 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"; } diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java index 4c5fe1c1d..87fc89fef 100644 --- a/src/org/apache/fop/fo/flow/TableCell.java +++ b/src/org/apache/fop/fo/flow/TableCell.java @@ -14,19 +14,9 @@ import org.apache.fop.layout.*; 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; @@ -96,9 +86,13 @@ public class TableCell extends FObj { 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 } diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index 44684ae33..358fc10a5 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -28,20 +28,8 @@ public class TableColumn extends FObj { 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"; } diff --git a/src/org/apache/fop/fo/flow/TableFooter.java b/src/org/apache/fop/fo/flow/TableFooter.java index 0a6ebe02d..f69a47308 100644 --- a/src/org/apache/fop/fo/flow/TableFooter.java +++ b/src/org/apache/fop/fo/flow/TableFooter.java @@ -14,20 +14,8 @@ import org.apache.fop.datatypes.*; 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; } @@ -36,12 +24,8 @@ public class TableFooter extends TableBody { 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"; } diff --git a/src/org/apache/fop/fo/flow/TableHeader.java b/src/org/apache/fop/fo/flow/TableHeader.java index 81fd7a69b..c103b6da1 100644 --- a/src/org/apache/fop/fo/flow/TableHeader.java +++ b/src/org/apache/fop/fo/flow/TableHeader.java @@ -14,26 +14,10 @@ import org.apache.fop.datatypes.*; 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"; } diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index d06e04784..316d1d814 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -20,18 +20,6 @@ import java.util.Enumeration; 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; @@ -172,8 +160,8 @@ public class TableRow extends FObj { } - public TableRow(FObj parent, PropertyList propertyList) { - super(parent, propertyList); + public TableRow(FObj parent) { + super(parent); this.name = "fo:table-row"; } diff --git a/src/org/apache/fop/fo/flow/Wrapper.java b/src/org/apache/fop/fo/flow/Wrapper.java index da7eaa4f7..9eb8e56df 100644 --- a/src/org/apache/fop/fo/flow/Wrapper.java +++ b/src/org/apache/fop/fo/flow/Wrapper.java @@ -23,20 +23,8 @@ import org.apache.fop.layout.*; */ 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 } diff --git a/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index 2e3a81431..26ad3ccb9 100644 --- a/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -11,19 +11,9 @@ import org.apache.fop.fo.*; 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; @@ -33,11 +23,14 @@ public class ConditionalPageMasterReference extends FObj { 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()); } @@ -47,8 +40,6 @@ public class ConditionalPageMasterReference extends FObj { 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) { diff --git a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java index 1c5b85118..8ac2e8fc9 100644 --- a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -16,19 +16,9 @@ import org.apache.fop.layout.PageMaster; // 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; @@ -36,11 +26,13 @@ public class LayoutMasterSet extends FObj { 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(); diff --git a/src/org/apache/fop/fo/pagination/PageMasterReference.java b/src/org/apache/fop/fo/pagination/PageMasterReference.java index 05300a065..1c9a2f722 100644 --- a/src/org/apache/fop/fo/pagination/PageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/PageMasterReference.java @@ -11,6 +11,8 @@ import org.apache.fop.fo.*; 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 @@ -21,10 +23,13 @@ public abstract class PageMasterReference extends FObj 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()); } diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index 5b957d8a8..67d55212e 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -28,27 +28,14 @@ import org.apache.fop.apps.FOPException; // 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 // @@ -134,10 +121,13 @@ public class PageSequence extends FObj { 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; diff --git a/src/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/org/apache/fop/fo/pagination/PageSequenceMaster.java index 018356f7a..6be32ac1e 100644 --- a/src/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -16,19 +16,9 @@ import org.apache.fop.apps.FOPException; // 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; @@ -40,10 +30,13 @@ public class PageSequenceMaster extends FObj { // 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(); diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java index 18c2d6d15..f0c8be477 100644 --- a/src/org/apache/fop/fo/pagination/Region.java +++ b/src/org/apache/fop/fo/pagination/Region.java @@ -13,6 +13,8 @@ import org.apache.fop.fo.PropertyList; 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 */ @@ -22,10 +24,13 @@ public abstract class Region extends FObj { 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)) { diff --git a/src/org/apache/fop/fo/pagination/RegionAfter.java b/src/org/apache/fop/fo/pagination/RegionAfter.java index 39fe22d1a..e57034161 100644 --- a/src/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/org/apache/fop/fo/pagination/RegionAfter.java @@ -15,27 +15,20 @@ import org.apache.fop.layout.RegionArea; 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(); } diff --git a/src/org/apache/fop/fo/pagination/RegionBefore.java b/src/org/apache/fop/fo/pagination/RegionBefore.java index e2bcdcf5e..6d96aa365 100644 --- a/src/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/org/apache/fop/fo/pagination/RegionBefore.java @@ -15,30 +15,22 @@ import org.apache.fop.layout.BorderAndPadding; 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, diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java index 9c4d46078..97f55127d 100644 --- a/src/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/org/apache/fop/fo/pagination/RegionBody.java @@ -21,26 +21,12 @@ import org.apache.fop.layout.MarginProps; 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, diff --git a/src/org/apache/fop/fo/pagination/RegionEnd.java b/src/org/apache/fop/fo/pagination/RegionEnd.java index 0712af5c0..b1fecf325 100644 --- a/src/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/org/apache/fop/fo/pagination/RegionEnd.java @@ -17,27 +17,13 @@ import org.apache.fop.apps.FOPException; 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, diff --git a/src/org/apache/fop/fo/pagination/RegionStart.java b/src/org/apache/fop/fo/pagination/RegionStart.java index 0388340ec..bbd262df3 100644 --- a/src/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/org/apache/fop/fo/pagination/RegionStart.java @@ -17,27 +17,13 @@ import org.apache.fop.apps.FOPException; 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, diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index a7ef8632c..3a6dd83bf 100644 --- a/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -13,24 +13,13 @@ import org.apache.fop.apps.FOPException; // 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; /** @@ -42,10 +31,13 @@ public class RepeatablePageMasterAlternatives extends FObj 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(); diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index 85abf8039..521fd02c9 100644 --- a/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -10,32 +10,24 @@ package org.apache.fop.fo.pagination; 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")) { diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java index eecfb57b3..4a16a7fd1 100644 --- a/src/org/apache/fop/fo/pagination/Root.java +++ b/src/org/apache/fop/fo/pagination/Root.java @@ -25,18 +25,6 @@ import java.util.Enumeration; */ public class Root extends FObj { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Root(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new Root.Maker(); - } - LayoutMasterSet layoutMasterSet; Vector pageSequences; @@ -45,17 +33,15 @@ public class Root extends FObj { */ 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"); } } @@ -101,22 +87,4 @@ public class Root extends FObj { 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); - } - } - } -*/ } diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java index 92586593c..d50194889 100644 --- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -18,26 +18,15 @@ import org.apache.fop.apps.FOPException; 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; @@ -48,10 +37,13 @@ public class SimplePageMaster extends FObj { 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; diff --git a/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 7422aa257..c22afb672 100644 --- a/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -12,28 +12,14 @@ import org.apache.fop.apps.FOPException; 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, diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java index a48c4e7d6..296ef8768 100644 --- a/src/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -1250,6 +1250,12 @@ System.out.println("getting getNormalizingTransform"); return new PDFGraphicsDevice(this); } +/* +// for jdk1.4 +public java.awt.image.VolatileImage createCompatibleVolatileImage(int width, int height) { +return null; +} +*/ } /** diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java index 3d098e32c..4c49334ef 100644 --- a/src/org/apache/fop/svg/SVGElement.java +++ b/src/org/apache/fop/svg/SVGElement.java @@ -21,6 +21,7 @@ import org.apache.batik.dom.util.XMLSupport; 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.*; @@ -43,34 +44,6 @@ import java.awt.geom.AffineTransform; */ 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; /** @@ -79,8 +52,12 @@ public class SVGElement extends SVGObj { * @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(); } diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java index dc7df3dfb..cea2ea287 100644 --- a/src/org/apache/fop/svg/SVGElementMapping.java +++ b/src/org/apache/fop/svg/SVGElementMapping.java @@ -10,8 +10,7 @@ package org.apache.fop.svg; 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; @@ -23,7 +22,7 @@ public class SVGElementMapping implements ElementMapping { 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 @@ -33,68 +32,26 @@ public class SVGElementMapping implements ElementMapping { 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("", 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); + } + } } diff --git a/src/org/apache/fop/svg/SVGObj.java b/src/org/apache/fop/svg/SVGObj.java index 78a84bdda..f3f72b12a 100644 --- a/src/org/apache/fop/svg/SVGObj.java +++ b/src/org/apache/fop/svg/SVGObj.java @@ -15,52 +15,19 @@ import org.apache.fop.apps.FOPException; 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"; } + }