diff options
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r-- | src/java/org/apache/fop/apps/Document.java | 15 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/Driver.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FONode.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOText.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOTreeBuilder.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOTreeControl.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 19 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObjMixed.java | 12 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/Block.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/Leader.java | 13 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/PageNumber.java | 12 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/PageNumberCitation.java | 12 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Flow.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/PageSequence.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Title.java | 2 |
15 files changed, 31 insertions, 86 deletions
diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java index caaeee71a..5d985bb16 100644 --- a/src/java/org/apache/fop/apps/Document.java +++ b/src/java/org/apache/fop/apps/Document.java @@ -62,6 +62,7 @@ import org.apache.fop.area.AreaTree; import org.apache.fop.area.AreaTreeModel; import org.apache.fop.fo.extensions.Bookmarks; +import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.FOTreeEvent; import org.apache.fop.fo.FOTreeListener; @@ -112,6 +113,12 @@ public class Document implements FOTreeControl, FOTreeListener { private Set idReferences = new HashSet(); /** + * Structure handler used to notify structure events + * such as start end element. + */ + public FOInputHandler foInputHandler; + + /** * Main constructor * @param driver the Driver object that is the "parent" of this Document */ @@ -383,5 +390,11 @@ public class Document implements FOTreeControl, FOTreeListener { return idReferences; } -} + /** + * @return the FOInputHandler for parsing this FO Tree + */ + public FOInputHandler getFOInputHandler() { + return foInputHandler; + } +} diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index cd16f4d3f..94f5cd93f 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -576,6 +576,7 @@ public class Driver implements LogEnabled { currentDocument = new Document(this); } parser.setContentHandler(getContentHandler()); + currentDocument.foInputHandler = foInputHandler; /** LayoutStrategy is hard-wired for now, but needs to be made accessible through the API and/or configuration */ if (foInputHandler instanceof FOTreeHandler) { diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 5ba62bd24..079ee5d9c 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -118,13 +118,6 @@ public abstract class FONode { } /** - * Sets the structure handler to send events to. - * @param foih FOInputHandler instance - */ - public void setFOInputHandler(FOInputHandler foih) { - } - - /** * Do something with the attributes for this element * @param attlist Collection of attributes passed to us from the parser. * @throws FOPException for errors or inconsistencies in the attributes diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index dc7a5829b..20c03b476 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -76,7 +76,7 @@ public class FOText extends FObj { * the character array containing the text */ public char[] ca; - private int start; + public int start; /** * the length of the character array containing the text @@ -139,11 +139,6 @@ public class FOText extends FObj { textTransform(); } - public void setFOInputHandler(FOInputHandler foih) { - super.setFOInputHandler(foih); - foInputHandler.characters(ca, start, length); - } - /** * Check if this text node will create an area. * This means either there is non-whitespace or it is diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index 64c5832ce..a8b56cb76 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -282,7 +282,6 @@ public class FOTreeBuilder extends DefaultHandler { fobj.setUserAgent(userAgent); // set the structure handler so that appropriate // elements can signal structure events - fobj.setFOInputHandler(foInputHandler); fobj.handleAttrs(attlist); } catch (FOPException e) { diff --git a/src/java/org/apache/fop/fo/FOTreeControl.java b/src/java/org/apache/fop/fo/FOTreeControl.java index a77b6b2a8..79621ffa3 100644 --- a/src/java/org/apache/fop/fo/FOTreeControl.java +++ b/src/java/org/apache/fop/fo/FOTreeControl.java @@ -114,4 +114,8 @@ public interface FOTreeControl { */ Set getIDReferences(); + /** + * @return the FOInputHandler for parsing this FO Tree + */ + FOInputHandler getFOInputHandler(); } diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index b1510f269..84ff3b8b3 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -79,12 +79,6 @@ public class FObj extends FONode { protected static PropertyListBuilder plb = null; /** - * Structure handler used to notify structure events - * such as start end element. - */ - protected FOInputHandler foInputHandler; - - /** * Formatting properties for this fo element. */ public PropertyList properties; @@ -252,19 +246,6 @@ public class FObj extends FONode { } /** - * Set the structure handler for handling structure events. - * - * @param st the structure handler - */ - public void setFOInputHandler(FOInputHandler foih) { - foInputHandler = foih; - } - - public FOInputHandler getFOInputHandler() { - return foInputHandler; - } - - /** * lets outside sources access the property list * first used by PageNumberCitation to find the "id" property * @param name - the name of the desired property to obtain diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index 179f2fe91..8d1096173 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -57,8 +57,6 @@ package org.apache.fop.fo; public class FObjMixed extends FObj { /** TextInfo for this object */ protected TextInfo textInfo = null; - /** FontInfo for this object */ - protected FOTreeControl fontInfo = null; /** * @param parent FONode that is the parent of this object @@ -68,14 +66,6 @@ public class FObjMixed extends FObj { } /** - * @param foih FOInputHandler to set - */ - public void setFOInputHandler(FOInputHandler foih) { - super.setFOInputHandler(foih); - fontInfo = foih.getFontInfo(); - } - - /** * @param data array of characters containing text to be added * @param start starting array element to add * @param length number of characters to add @@ -90,7 +80,7 @@ public class FObjMixed extends FObj { FOText ft = new FOText(data, start, length, textInfo, this); ft.setUserAgent(userAgent); - ft.setFOInputHandler(foInputHandler); + getFOTreeControl().getFOInputHandler().characters(ft.ca, ft.start, ft.length); addChild(ft); } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index 994da7ccb..b40bda32a 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -143,7 +143,7 @@ public class Block extends FObjMixed { setupID(); - foInputHandler.startBlock(this); + getFOTreeControl().getFOInputHandler().startBlock(this); } private void setup() { @@ -270,7 +270,7 @@ public class Block extends FObjMixed { */ public void end() { handleWhiteSpace(); - foInputHandler.endBlock(this); + getFOTreeControl().getFOInputHandler().endBlock(this); } private void handleWhiteSpace() { diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index df1e96af5..6d9c65333 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -79,8 +79,6 @@ public class Leader extends FObjMixed { private int ruleThickness; private int leaderPattern; private int patternWidth; - /** FontInfo for this object */ - protected FOTreeControl fontInfo = null; /** FontState for this object */ protected Font fontState; @@ -91,15 +89,6 @@ public class Leader extends FObjMixed { super(parent); } - - /** - * @param foih FOInputHandler to set - */ - public void setFOInputHandler(FOInputHandler foih) { - super.setFOInputHandler(foih); - fontInfo = foih.getFontInfo(); - } - public void setup() { // Common Accessibility Properties @@ -113,7 +102,7 @@ public class Leader extends FObjMixed { CommonBackground bProps = propMgr.getBackgroundProps(); // Common Font Properties - this.fontState = propMgr.getFontState(fontInfo); + this.fontState = propMgr.getFontState(getFOTreeControl()); // Common Margin Properties-Inline CommonMarginInline mProps = propMgr.getMarginInlineProps(); diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index abb0b6959..bd7bd05bb 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -71,8 +71,6 @@ import org.apache.fop.fo.FOInputHandler; * Standard. */ public class PageNumber extends FObj { - /** FontInfo for this object */ - protected FOTreeControl fontInfo = null; /** FontState for this object */ protected Font fontState; @@ -88,14 +86,6 @@ public class PageNumber extends FObj { super(parent); } - /** - * @param foih FOInputHandler to be set - */ - public void setFOInputHandler(FOInputHandler foih) { - super.setFOInputHandler(foih); - fontInfo = foih.getFontInfo(); - } - public void setup() { // Common Accessibility Properties @@ -109,7 +99,7 @@ public class PageNumber extends FObj { CommonBackground bProps = propMgr.getBackgroundProps(); // Common Font Properties - this.fontState = propMgr.getFontState(fontInfo); + this.fontState = propMgr.getFontState(getFOTreeControl()); // Common Margin Properties-Inline CommonMarginInline mProps = propMgr.getMarginInlineProps(); diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 621e898ce..ec72a4e40 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -74,8 +74,6 @@ import org.apache.fop.util.CharUtilities; * block referenced with the ref-id attribute. */ public class PageNumberCitation extends FObj { - /** FontInfo for this object **/ - protected FOTreeControl fontInfo = null; /** Fontstate for this object **/ protected Font fontState; @@ -95,14 +93,6 @@ public class PageNumberCitation extends FObj { } /** - * @param foih the FOInputHandler object to set - */ - public void setFOInputHandler(FOInputHandler foih) { - super.setFOInputHandler(foih); - fontInfo = foih.getFontInfo(); - } - - /** * @param str string to be measured * @return width (in millipoints ??) of the string */ @@ -128,7 +118,7 @@ public class PageNumberCitation extends FObj { CommonBackground bProps = propMgr.getBackgroundProps(); // Common Font Properties - this.fontState = propMgr.getFontState(fontInfo); + this.fontState = propMgr.getFontState(getFOTreeControl()); // Common Margin Properties-Inline CommonMarginInline mProps = propMgr.getMarginInlineProps(); diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 15b156e87..5a6e2ee8d 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -126,14 +126,14 @@ public class Flow extends FObj { // Now done in addChild of page-sequence //pageSequence.addFlow(this); - foInputHandler.startFlow(this); + getFOTreeControl().getFOInputHandler().startFlow(this); } /** * Tell the StructureRenderer that we are at the end of the flow. */ public void end() { - foInputHandler.endFlow(this); + getFOTreeControl().getFOInputHandler().endFlow(this); } /** diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 77198e21b..d783b6510 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -331,7 +331,7 @@ public class PageSequence extends FObj { */ private void startStructuredPageSequence() { if (!sequenceStarted) { - foInputHandler.startPageSequence(this); + getFOTreeControl().getFOInputHandler().startPageSequence(this); sequenceStarted = true; } } @@ -343,7 +343,7 @@ public class PageSequence extends FObj { */ public void end() { try { - this.foInputHandler.endPageSequence(this); + this.getFOTreeControl().getFOInputHandler().endPageSequence(this); } catch (FOPException fopex) { getLogger().error("Error in PageSequence.end(): " + fopex.getMessage(), fopex); diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index a944e05ec..a2b758404 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -91,7 +91,7 @@ public class Title extends FObjMixed { CommonBackground bProps = propMgr.getBackgroundProps(); // Common Font Properties - Font fontState = propMgr.getFontState(foInputHandler.getFontInfo()); + Font fontState = propMgr.getFontState(getFOTreeControl().getFOInputHandler().getFontInfo()); // Common Margin Properties-Inline CommonMarginInline mProps = propMgr.getMarginInlineProps(); |