Browse Source

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
tags/fop-0_20_4-doc
Keiron Liddle 22 years ago
parent
commit
31965968c6
83 changed files with 848 additions and 1519 deletions
  1. 1
    1
      src/org/apache/fop/apps/Driver.java
  2. 2
    2
      src/org/apache/fop/apps/StreamRenderer.java
  3. 2
    0
      src/org/apache/fop/area/inline/Image.java
  4. 12
    14
      src/org/apache/fop/extensions/ExtensionElementMapping.java
  5. 18
    3
      src/org/apache/fop/extensions/ExtensionObj.java
  6. 2
    13
      src/org/apache/fop/extensions/Label.java
  7. 7
    14
      src/org/apache/fop/extensions/Outline.java
  8. 2
    15
      src/org/apache/fop/fo/ColorProfile.java
  9. 2
    15
      src/org/apache/fop/fo/Declarations.java
  10. 0
    49
      src/org/apache/fop/fo/DirectPropertyListBuilder.java
  11. 7
    1
      src/org/apache/fop/fo/ElementMapping.java
  12. 449
    0
      src/org/apache/fop/fo/FOElementMapping.java
  13. 5
    0
      src/org/apache/fop/fo/FONode.java
  14. 11
    90
      src/org/apache/fop/fo/FOTreeBuilder.java
  15. 28
    21
      src/org/apache/fop/fo/FObj.java
  16. 2
    14
      src/org/apache/fop/fo/FObjMixed.java
  17. 0
    125
      src/org/apache/fop/fo/StandardElementMapping.java
  18. 2
    15
      src/org/apache/fop/fo/Title.java
  19. 2
    3
      src/org/apache/fop/fo/ToBeImplementedElement.java
  20. 0
    48
      src/org/apache/fop/fo/TreeBuilder.java
  21. 5
    13
      src/org/apache/fop/fo/Unknown.java
  22. 11
    39
      src/org/apache/fop/fo/UnknownXMLObj.java
  23. 8
    35
      src/org/apache/fop/fo/XMLElement.java
  24. 14
    15
      src/org/apache/fop/fo/XMLObj.java
  25. 2
    15
      src/org/apache/fop/fo/flow/BasicLink.java
  26. 2
    15
      src/org/apache/fop/fo/flow/BidiOverride.java
  27. 8
    14
      src/org/apache/fop/fo/flow/Block.java
  28. 8
    15
      src/org/apache/fop/fo/flow/BlockContainer.java
  29. 2
    16
      src/org/apache/fop/fo/flow/Character.java
  30. 2
    17
      src/org/apache/fop/fo/flow/ExternalGraphic.java
  31. 2
    15
      src/org/apache/fop/fo/flow/Float.java
  32. 10
    19
      src/org/apache/fop/fo/flow/Flow.java
  33. 2
    15
      src/org/apache/fop/fo/flow/Footnote.java
  34. 3
    16
      src/org/apache/fop/fo/flow/FootnoteBody.java
  35. 2
    15
      src/org/apache/fop/fo/flow/InitialPropertySet.java
  36. 9
    15
      src/org/apache/fop/fo/flow/Inline.java
  37. 7
    15
      src/org/apache/fop/fo/flow/InlineContainer.java
  38. 2
    31
      src/org/apache/fop/fo/flow/InstreamForeignObject.java
  39. 2
    15
      src/org/apache/fop/fo/flow/Leader.java
  40. 2
    14
      src/org/apache/fop/fo/flow/ListBlock.java
  41. 2
    14
      src/org/apache/fop/fo/flow/ListItem.java
  42. 2
    14
      src/org/apache/fop/fo/flow/ListItemBody.java
  43. 2
    14
      src/org/apache/fop/fo/flow/ListItemLabel.java
  44. 7
    14
      src/org/apache/fop/fo/flow/Marker.java
  45. 2
    15
      src/org/apache/fop/fo/flow/MultiCase.java
  46. 2
    15
      src/org/apache/fop/fo/flow/MultiProperties.java
  47. 2
    15
      src/org/apache/fop/fo/flow/MultiPropertySet.java
  48. 2
    15
      src/org/apache/fop/fo/flow/MultiSwitch.java
  49. 2
    15
      src/org/apache/fop/fo/flow/MultiToggle.java
  50. 2
    14
      src/org/apache/fop/fo/flow/PageNumber.java
  51. 2
    15
      src/org/apache/fop/fo/flow/PageNumberCitation.java
  52. 7
    14
      src/org/apache/fop/fo/flow/RetrieveMarker.java
  53. 2
    15
      src/org/apache/fop/fo/flow/StaticContent.java
  54. 2
    14
      src/org/apache/fop/fo/flow/Table.java
  55. 2
    15
      src/org/apache/fop/fo/flow/TableAndCaption.java
  56. 2
    14
      src/org/apache/fop/fo/flow/TableBody.java
  57. 2
    15
      src/org/apache/fop/fo/flow/TableCaption.java
  58. 8
    14
      src/org/apache/fop/fo/flow/TableCell.java
  59. 2
    14
      src/org/apache/fop/fo/flow/TableColumn.java
  60. 2
    18
      src/org/apache/fop/fo/flow/TableFooter.java
  61. 2
    18
      src/org/apache/fop/fo/flow/TableHeader.java
  62. 2
    14
      src/org/apache/fop/fo/flow/TableRow.java
  63. 2
    14
      src/org/apache/fop/fo/flow/Wrapper.java
  64. 8
    17
      src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
  65. 7
    15
      src/org/apache/fop/fo/pagination/LayoutMasterSet.java
  66. 8
    3
      src/org/apache/fop/fo/pagination/PageMasterReference.java
  67. 8
    18
      src/org/apache/fop/fo/pagination/PageSequence.java
  68. 8
    15
      src/org/apache/fop/fo/pagination/PageSequenceMaster.java
  69. 8
    3
      src/org/apache/fop/fo/pagination/Region.java
  70. 8
    15
      src/org/apache/fop/fo/pagination/RegionAfter.java
  71. 8
    16
      src/org/apache/fop/fo/pagination/RegionBefore.java
  72. 2
    16
      src/org/apache/fop/fo/pagination/RegionBody.java
  73. 2
    16
      src/org/apache/fop/fo/pagination/RegionEnd.java
  74. 2
    16
      src/org/apache/fop/fo/pagination/RegionStart.java
  75. 8
    16
      src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
  76. 8
    16
      src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  77. 3
    35
      src/org/apache/fop/fo/pagination/Root.java
  78. 8
    16
      src/org/apache/fop/fo/pagination/SimplePageMaster.java
  79. 2
    16
      src/org/apache/fop/fo/pagination/SinglePageMasterReference.java
  80. 6
    0
      src/org/apache/fop/svg/PDFGraphics2D.java
  81. 7
    30
      src/org/apache/fop/svg/SVGElement.java
  82. 15
    58
      src/org/apache/fop/svg/SVGElementMapping.java
  83. 3
    36
      src/org/apache/fop/svg/SVGObj.java

+ 1
- 1
src/org/apache/fop/apps/Driver.java View File

@@ -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");


+ 2
- 2
src/org/apache/fop/apps/StreamRenderer.java View File

@@ -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");
}

/**

+ 2
- 0
src/org/apache/fop/area/inline/Image.java View File

@@ -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;


+ 12
- 14
src/org/apache/fop/extensions/ExtensionElementMapping.java View File

@@ -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);
}
}
}

+ 18
- 3
src/org/apache/fop/extensions/ExtensionObj.java View File

@@ -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);
}
}

+ 2
- 13
src/org/apache/fop/extensions/Label.java View File

@@ -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) {

+ 7
- 14
src/org/apache/fop/extensions/Outline.java View File

@@ -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() {

+ 2
- 15
src/org/apache/fop/fo/ColorProfile.java View File

@@ -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");

+ 2
- 15
src/org/apache/fop/fo/Declarations.java View File

@@ -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";
}


+ 0
- 49
src/org/apache/fop/fo/DirectPropertyListBuilder.java View File

@@ -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;
}
}
}

+ 7
- 1
src/org/apache/fop/fo/ElementMapping.java View File

@@ -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;
}
}
}

+ 449
- 0
src/org/apache/fop/fo/FOElementMapping.java View File

@@ -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);
}
}
}

+ 5
- 0
src/org/apache/fop/fo/FONode.java View File

@@ -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

+ 11
- 90
src/org/apache/fop/fo/FOTreeBuilder.java View File

@@ -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("<default>");
}
}

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);
}

+ 28
- 21
src/org/apache/fop/fo/FObj.java View File

@@ -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();
}


+ 2
- 14
src/org/apache/fop/fo/FObjMixed.java View File

@@ -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) {

+ 0
- 125
src/org/apache/fop/fo/StandardElementMapping.java View File

@@ -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));
}

}

}

+ 2
- 15
src/org/apache/fop/fo/Title.java View File

@@ -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";
}


+ 2
- 3
src/org/apache/fop/fo/ToBeImplementedElement.java View File

@@ -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 {

+ 0
- 48
src/org/apache/fop/fo/TreeBuilder.java View File

@@ -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);

}

+ 5
- 13
src/org/apache/fop/fo/Unknown.java View File

@@ -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 {

+ 11
- 39
src/org/apache/fop/fo/UnknownXMLObj.java View File

@@ -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);

+ 8
- 35
src/org/apache/fop/fo/XMLElement.java View File

@@ -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();
}


+ 14
- 15
src/org/apache/fop/fo/XMLObj.java View File

@@ -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();

+ 2
- 15
src/org/apache/fop/fo/flow/BasicLink.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/BidiOverride.java View File

@@ -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";
}


+ 8
- 14
src/org/apache/fop/fo/flow/Block.java View File

@@ -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();
}


+ 8
- 15
src/org/apache/fop/fo/flow/BlockContainer.java View File

@@ -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();
}


+ 2
- 16
src/org/apache/fop/fo/flow/Character.java View File

@@ -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)) {

+ 2
- 17
src/org/apache/fop/fo/flow/ExternalGraphic.java View File

@@ -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);
}

}
}


+ 2
- 15
src/org/apache/fop/fo/flow/Float.java View File

@@ -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";
}


+ 10
- 19
src/org/apache/fop/fo/flow/Flow.java View File

@@ -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);
}


+ 2
- 15
src/org/apache/fop/fo/flow/Footnote.java View File

@@ -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";
}


+ 3
- 16
src/org/apache/fop/fo/flow/FootnoteBody.java View File

@@ -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;
}

+ 2
- 15
src/org/apache/fop/fo/flow/InitialPropertySet.java View File

@@ -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";
}


+ 9
- 15
src/org/apache/fop/fo/flow/Inline.java View File

@@ -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");

+ 7
- 15
src/org/apache/fop/fo/flow/InlineContainer.java View File

@@ -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();

+ 2
- 31
src/org/apache/fop/fo/flow/InstreamForeignObject.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/Leader.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/ListBlock.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/ListItem.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/ListItemBody.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/ListItemLabel.java View File

@@ -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";
}


+ 7
- 14
src/org/apache/fop/fo/flow/Marker.java View File

@@ -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 =

+ 2
- 15
src/org/apache/fop/fo/flow/MultiCase.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/MultiProperties.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/MultiPropertySet.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/MultiSwitch.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/MultiToggle.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/PageNumber.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/PageNumberCitation.java View File

@@ -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");

+ 7
- 14
src/org/apache/fop/fo/flow/RetrieveMarker.java View File

@@ -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 =

+ 2
- 15
src/org/apache/fop/fo/flow/StaticContent.java View File

@@ -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
}


+ 2
- 14
src/org/apache/fop/fo/flow/Table.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/TableAndCaption.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/TableBody.java View File

@@ -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";
}


+ 2
- 15
src/org/apache/fop/fo/flow/TableCaption.java View File

@@ -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";
}


+ 8
- 14
src/org/apache/fop/fo/flow/TableCell.java View File

@@ -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
}


+ 2
- 14
src/org/apache/fop/fo/flow/TableColumn.java View File

@@ -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";
}


+ 2
- 18
src/org/apache/fop/fo/flow/TableFooter.java View File

@@ -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";
}


+ 2
- 18
src/org/apache/fop/fo/flow/TableHeader.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/TableRow.java View File

@@ -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";
}


+ 2
- 14
src/org/apache/fop/fo/flow/Wrapper.java View File

@@ -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
}


+ 8
- 17
src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java View File

@@ -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) {

+ 7
- 15
src/org/apache/fop/fo/pagination/LayoutMasterSet.java View File

@@ -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();


+ 8
- 3
src/org/apache/fop/fo/pagination/PageMasterReference.java View File

@@ -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());
}

+ 8
- 18
src/org/apache/fop/fo/pagination/PageSequence.java View File

@@ -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;

+ 8
- 15
src/org/apache/fop/fo/pagination/PageSequenceMaster.java View File

@@ -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();


+ 8
- 3
src/org/apache/fop/fo/pagination/Region.java View File

@@ -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)) {

+ 8
- 15
src/org/apache/fop/fo/pagination/RegionAfter.java View File

@@ -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();
}


+ 8
- 16
src/org/apache/fop/fo/pagination/RegionBefore.java View File

@@ -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,

+ 2
- 16
src/org/apache/fop/fo/pagination/RegionBody.java View File

@@ -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,

+ 2
- 16
src/org/apache/fop/fo/pagination/RegionEnd.java View File

@@ -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,

+ 2
- 16
src/org/apache/fop/fo/pagination/RegionStart.java View File

@@ -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,

+ 8
- 16
src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java View File

@@ -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();


+ 8
- 16
src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java View File

@@ -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")) {

+ 3
- 35
src/org/apache/fop/fo/pagination/Root.java View File

@@ -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);
}
}
}
*/
}

+ 8
- 16
src/org/apache/fop/fo/pagination/SimplePageMaster.java View File

@@ -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;

+ 2
- 16
src/org/apache/fop/fo/pagination/SinglePageMasterReference.java View File

@@ -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,

+ 6
- 0
src/org/apache/fop/svg/PDFGraphics2D.java View File

@@ -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;
}
*/
}

/**

+ 7
- 30
src/org/apache/fop/svg/SVGElement.java View File

@@ -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();
}


+ 15
- 58
src/org/apache/fop/svg/SVGElementMapping.java View File

@@ -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("<default>", new SVGMaker());
}

String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
builder.addMapping(svgNS, foObjs);

builder.addPropertyListBuilder(svgNS,
new DirectPropertyListBuilder());
} catch (Throwable t) {
// if the classes are not available
}
}

class SVGMaker extends ElementMapping.Maker {
public FObj make(FObj parent) {
return new SVGObj(parent);
}
}

class SE extends ElementMapping.Maker {
public FObj make(FObj parent) {
return new SVGElement(parent);
}
}
}

+ 3
- 36
src/org/apache/fop/svg/SVGObj.java View File

@@ -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";
}

}


Loading…
Cancel
Save