diff options
Diffstat (limited to 'src/org/apache/fop/fo/pagination')
16 files changed, 98 insertions, 249 deletions
diff --git a/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index 2e3a81431..26ad3ccb9 100644 --- a/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -11,19 +11,9 @@ import org.apache.fop.fo.*; import org.apache.fop.fo.properties.*; import org.apache.fop.apps.FOPException; -public class ConditionalPageMasterReference extends FObj { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new ConditionalPageMasterReference(parent, propertyList); - } +import org.xml.sax.Attributes; - } - - public static FObj.Maker maker() { - return new ConditionalPageMasterReference.Maker(); - } +public class ConditionalPageMasterReference extends FObj { private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives; @@ -33,11 +23,14 @@ public class ConditionalPageMasterReference extends FObj { private int oddOrEven; private int blankOrNotBlank; - public ConditionalPageMasterReference(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public ConditionalPageMasterReference(FObj parent) { + super(parent); this.name = getElementName(); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); if (getProperty("master-name") != null) { setMasterName(getProperty("master-name").getString()); } @@ -47,8 +40,6 @@ public class ConditionalPageMasterReference extends FObj { setPagePosition(this.properties.get("page-position").getEnum()); setOddOrEven(this.properties.get("odd-or-even").getEnum()); setBlankOrNotBlank(this.properties.get("blank-or-not-blank").getEnum()); - - } protected void setMasterName(String masterName) { diff --git a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java index 1c5b85118..8ac2e8fc9 100644 --- a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -16,19 +16,9 @@ import org.apache.fop.layout.PageMaster; // Java import java.util.*; -public class LayoutMasterSet extends FObj { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new LayoutMasterSet(parent, propertyList); - } - - } +import org.xml.sax.Attributes; - public static FObj.Maker maker() { - return new LayoutMasterSet.Maker(); - } +public class LayoutMasterSet extends FObj { private Hashtable simplePageMasters; private Hashtable pageSequenceMasters; @@ -36,11 +26,13 @@ public class LayoutMasterSet extends FObj { private Root root; - protected LayoutMasterSet(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public LayoutMasterSet(FObj parent) { + super(parent); this.name = "fo:layout-master-set"; + } + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); this.simplePageMasters = new Hashtable(); this.pageSequenceMasters = new Hashtable(); diff --git a/src/org/apache/fop/fo/pagination/PageMasterReference.java b/src/org/apache/fop/fo/pagination/PageMasterReference.java index 05300a065..1c9a2f722 100644 --- a/src/org/apache/fop/fo/pagination/PageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/PageMasterReference.java @@ -11,6 +11,8 @@ import org.apache.fop.fo.*; import org.apache.fop.fo.properties.*; import org.apache.fop.apps.FOPException; +import org.xml.sax.Attributes; + /** * Base PageMasterReference class. Provides implementation for handling the * master-name attribute and containment within a PageSequenceMaster @@ -21,10 +23,13 @@ public abstract class PageMasterReference extends FObj private String _masterName; private PageSequenceMaster _pageSequenceMaster; - public PageMasterReference(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public PageMasterReference(FObj parent) { + super(parent); this.name = getElementName(); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); if (getProperty("master-name") != null) { setMasterName(getProperty("master-name").getString()); } diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index 5b957d8a8..67d55212e 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -28,6 +28,8 @@ 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. @@ -35,21 +37,6 @@ import java.util.*; */ public class PageSequence extends FObj { // - // Factory methods - // - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new PageSequence(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new PageSequence.Maker(); - } - - // // intial-page-number types // private static final int EXPLICIT = 0; @@ -134,10 +121,13 @@ public class PageSequence extends FObj { private String currentPageMasterName; - protected PageSequence(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public PageSequence(FObj parent) { + super(parent); this.name = "fo:page-sequence"; + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); if (parent.getName().equals("fo:root")) { this.root = (Root)parent; diff --git a/src/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/org/apache/fop/fo/pagination/PageSequenceMaster.java index 018356f7a..6be32ac1e 100644 --- a/src/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -16,19 +16,9 @@ import org.apache.fop.apps.FOPException; // Java import java.util.*; -public class PageSequenceMaster extends FObj { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new PageSequenceMaster(parent, propertyList); - } - - } +import org.xml.sax.Attributes; - public static FObj.Maker maker() { - return new PageSequenceMaster.Maker(); - } +public class PageSequenceMaster extends FObj { LayoutMasterSet layoutMasterSet; Vector subSequenceSpecifiers; @@ -40,10 +30,13 @@ public class PageSequenceMaster extends FObj { // references to page-masters. So the methods use the former // terminology ('sub-sequence-specifiers', or SSS), // but the actual FO's are MasterReferences. - protected PageSequenceMaster(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public PageSequenceMaster(FObj parent) { + super(parent); this.name = "fo:page-sequence-master"; + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); subSequenceSpecifiers = new Vector(); diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java index 18c2d6d15..f0c8be477 100644 --- a/src/org/apache/fop/fo/pagination/Region.java +++ b/src/org/apache/fop/fo/pagination/Region.java @@ -13,6 +13,8 @@ import org.apache.fop.fo.PropertyList; import org.apache.fop.apps.FOPException; import org.apache.fop.layout.RegionArea; +import org.xml.sax.Attributes; + /** * This is an abstract base class for pagination regions */ @@ -22,10 +24,13 @@ public abstract class Region extends FObj { private SimplePageMaster _layoutMaster; private String _regionName; - protected Region(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + protected Region(FObj parent) { + super(parent); this.name = getElementName(); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); // regions may have name, or default if (null == this.properties.get(PROP_REGION_NAME)) { diff --git a/src/org/apache/fop/fo/pagination/RegionAfter.java b/src/org/apache/fop/fo/pagination/RegionAfter.java index 39fe22d1a..e57034161 100644 --- a/src/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/org/apache/fop/fo/pagination/RegionAfter.java @@ -15,27 +15,20 @@ import org.apache.fop.layout.RegionArea; import org.apache.fop.layout.BorderAndPadding; import org.apache.fop.layout.BackgroundProps; -public class RegionAfter extends Region { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RegionAfter(parent, propertyList); - } - - } +import org.xml.sax.Attributes; - public static FObj.Maker maker() { - return new RegionAfter.Maker(); - } +public class RegionAfter extends Region { public static final String REGION_CLASS = "after"; private int precedence; - protected RegionAfter(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public RegionAfter(FObj parent) { + super(parent); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); precedence = this.properties.get("precedence").getEnum(); } diff --git a/src/org/apache/fop/fo/pagination/RegionBefore.java b/src/org/apache/fop/fo/pagination/RegionBefore.java index e2bcdcf5e..6d96aa365 100644 --- a/src/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/org/apache/fop/fo/pagination/RegionBefore.java @@ -15,30 +15,22 @@ import org.apache.fop.layout.BorderAndPadding; import org.apache.fop.layout.BackgroundProps; import org.apache.fop.apps.FOPException; -public class RegionBefore extends Region { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RegionBefore(parent, propertyList); - } +import org.xml.sax.Attributes; - } - - public static FObj.Maker maker() { - return new RegionBefore.Maker(); - } +public class RegionBefore extends Region { public static final String REGION_CLASS = "before"; private int precedence; - protected RegionBefore(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); - precedence = this.properties.get("precedence").getEnum(); + public RegionBefore(FObj parent) { + super(parent); } + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); + precedence = this.properties.get("precedence").getEnum(); + } RegionArea makeRegionArea(int allocationRectangleXPosition, int allocationRectangleYPosition, diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java index 9c4d46078..97f55127d 100644 --- a/src/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/org/apache/fop/fo/pagination/RegionBody.java @@ -21,26 +21,12 @@ import org.apache.fop.layout.MarginProps; public class RegionBody extends Region { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RegionBody(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new RegionBody.Maker(); - } - public static final String REGION_CLASS = "body"; ColorType backgroundColor; - protected RegionBody(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public RegionBody(FObj parent) { + super(parent); } RegionArea makeRegionArea(int allocationRectangleXPosition, diff --git a/src/org/apache/fop/fo/pagination/RegionEnd.java b/src/org/apache/fop/fo/pagination/RegionEnd.java index 0712af5c0..b1fecf325 100644 --- a/src/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/org/apache/fop/fo/pagination/RegionEnd.java @@ -17,27 +17,13 @@ import org.apache.fop.apps.FOPException; public class RegionEnd extends Region { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RegionEnd(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new RegionEnd.Maker(); - } - public static final String REGION_CLASS = "end"; - protected RegionEnd(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public RegionEnd(FObj parent) { + super(parent); } - RegionArea makeRegionArea(int allocationRectangleXPosition, int allocationRectangleYPosition, int allocationRectangleWidth, diff --git a/src/org/apache/fop/fo/pagination/RegionStart.java b/src/org/apache/fop/fo/pagination/RegionStart.java index 0388340ec..bbd262df3 100644 --- a/src/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/org/apache/fop/fo/pagination/RegionStart.java @@ -17,27 +17,13 @@ import org.apache.fop.apps.FOPException; public class RegionStart extends Region { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RegionStart(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new RegionStart.Maker(); - } - public static final String REGION_CLASS = "start"; - protected RegionStart(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); + public RegionStart(FObj parent) { + super(parent); } - RegionArea makeRegionArea(int allocationRectangleXPosition, int allocationRectangleYPosition, int allocationRectangleWidth, diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index a7ef8632c..3a6dd83bf 100644 --- a/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -13,24 +13,13 @@ import org.apache.fop.apps.FOPException; // Java import java.util.Vector; +import org.xml.sax.Attributes; + public class RepeatablePageMasterAlternatives extends FObj implements SubSequenceSpecifier { private static final int INFINITE = -1; - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RepeatablePageMasterAlternatives(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new RepeatablePageMasterAlternatives.Maker(); - } - private PageSequenceMaster pageSequenceMaster; /** @@ -42,10 +31,13 @@ public class RepeatablePageMasterAlternatives extends FObj private Vector conditionalPageMasterRefs; - public RepeatablePageMasterAlternatives(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public RepeatablePageMasterAlternatives(FObj parent) { + super(parent); this.name = "fo:repeatable-page-master-alternatives"; + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); conditionalPageMasterRefs = new Vector(); diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index 85abf8039..521fd02c9 100644 --- a/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -10,32 +10,24 @@ package org.apache.fop.fo.pagination; import org.apache.fop.fo.*; import org.apache.fop.apps.FOPException; +import org.xml.sax.Attributes; + public class RepeatablePageMasterReference extends PageMasterReference implements SubSequenceSpecifier { private static final int INFINITE = -1; - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RepeatablePageMasterReference(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new RepeatablePageMasterReference.Maker(); - } - - private PageSequenceMaster pageSequenceMaster; private int maximumRepeats; private int numberConsumed = 0; - public RepeatablePageMasterReference(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public RepeatablePageMasterReference(FObj parent) { + super(parent); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); String mr = getProperty("maximum-repeats").getString(); if (mr.equals("no-limit")) { diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java index eecfb57b3..4a16a7fd1 100644 --- a/src/org/apache/fop/fo/pagination/Root.java +++ b/src/org/apache/fop/fo/pagination/Root.java @@ -25,18 +25,6 @@ import java.util.Enumeration; */ public class Root extends FObj { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Root(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new Root.Maker(); - } - LayoutMasterSet layoutMasterSet; Vector pageSequences; @@ -45,17 +33,15 @@ public class Root extends FObj { */ private int runningPageNumberCounter = 0; - protected Root(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); - this.name = "fo:root"; + public Root(FObj parent) { + super(parent); // this.properties.get("media-usage"); pageSequences = new Vector(); if (parent != null) { - throw new FOPException("root must be root element"); + //throw new FOPException("root must be root element"); } } @@ -101,22 +87,4 @@ public class Root extends FObj { public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) { this.layoutMasterSet = layoutMasterSet; } -/* - public void format(AreaTree areaTree) throws FOPException { - // log.debug(" Root[" + marker + "] "); - if (layoutMasterSet == null) { - throw new FOPException("No layout master set."); - } - - Enumeration e = children.elements(); - while (e.hasMoreElements()) { - Object o = e.nextElement(); - if (o instanceof PageSequence) { - ((PageSequence)o).format(areaTree); - } else if (o instanceof ExtensionObj) { - ((ExtensionObj)o).format(areaTree); - } - } - } -*/ } diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java index 92586593c..d50194889 100644 --- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -18,26 +18,15 @@ import org.apache.fop.apps.FOPException; import java.util.*; -public class SimplePageMaster extends FObj { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new SimplePageMaster(parent, propertyList); - } - - } +import org.xml.sax.Attributes; - public static FObj.Maker maker() { - return new SimplePageMaster.Maker(); - } +public class SimplePageMaster extends FObj { /** * Page regions (regionClass, Region) */ private Hashtable _regions; - LayoutMasterSet layoutMasterSet; PageMaster pageMaster; String masterName; @@ -48,10 +37,13 @@ public class SimplePageMaster extends FObj { boolean afterPrecedence; int afterHeight; - protected SimplePageMaster(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public SimplePageMaster(FObj parent) { + super(parent); this.name = "fo:simple-page-master"; + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); if (parent.getName().equals("fo:layout-master-set")) { this.layoutMasterSet = (LayoutMasterSet)parent; diff --git a/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 7422aa257..c22afb672 100644 --- a/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -12,28 +12,14 @@ import org.apache.fop.apps.FOPException; public class SinglePageMasterReference extends PageMasterReference implements SubSequenceSpecifier { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new SinglePageMasterReference(parent, propertyList); - } - - } - - public static FObj.Maker maker() { - return new SinglePageMasterReference.Maker(); - } - private static final int FIRST = 0; private static final int DONE = 1; private int state; - public SinglePageMasterReference(FObj parent, PropertyList propertyList) - throws FOPException { - super(parent, propertyList); + public SinglePageMasterReference(FObj parent) { + super(parent); this.state = FIRST; - } public String getNextPageMaster(int currentPageNumber, |