]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Remove all storage of fo/FOInputHandler from within the FO Tree itself, in favor...
authorWilliam Victor Mote <vmote@apache.org>
Tue, 2 Sep 2003 01:31:36 +0000 (01:31 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Tue, 2 Sep 2003 01:31:36 +0000 (01:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196887 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
src/java/org/apache/fop/apps/Document.java
src/java/org/apache/fop/apps/Driver.java
src/java/org/apache/fop/fo/FONode.java
src/java/org/apache/fop/fo/FOText.java
src/java/org/apache/fop/fo/FOTreeBuilder.java
src/java/org/apache/fop/fo/FOTreeControl.java
src/java/org/apache/fop/fo/FObj.java
src/java/org/apache/fop/fo/FObjMixed.java
src/java/org/apache/fop/fo/flow/Block.java
src/java/org/apache/fop/fo/flow/Leader.java
src/java/org/apache/fop/fo/flow/PageNumber.java
src/java/org/apache/fop/fo/flow/PageNumberCitation.java
src/java/org/apache/fop/fo/pagination/Flow.java
src/java/org/apache/fop/fo/pagination/PageSequence.java
src/java/org/apache/fop/fo/pagination/Title.java

index caaeee71a4dd3bed70fd4ed9f4cfbf65fffcf074..5d985bb16c89989c9cc5dc9ac87a22ad1b7b37dd 100644 (file)
@@ -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;
@@ -111,6 +112,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;
+    }
 
+}
index cd16f4d3f7bba908d2d84acf4daf799f84cb3be7..94f5cd93f595c778508ff2058b6e8a9f01f03805 100644 (file)
@@ -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) {
index 5ba62bd248daa5ab37e6b3d3323cd424a22c095c..079ee5d9c9167190cb965306ce5bcf418cecf0f5 100644 (file)
@@ -117,13 +117,6 @@ public abstract class FONode {
         return userAgent;
     }
 
-    /**
-     * 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.
index dc7a5829b55676ce34775ace29ff776adad651f7..20c03b4767995fd778f905b6f6111ae23c66be5c 100644 (file)
@@ -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
index 64c5832ceada425a1fb4019315e366d0fc6d3f87..a8b56cb76ccdc5e8092ac676f445758d689acbe9 100644 (file)
@@ -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) {
index a77b6b2a805ee422ae63eb10287c931e9339262a..79621ffa347c350a1c764023cf8c8723f6f6642b 100644 (file)
@@ -114,4 +114,8 @@ public interface FOTreeControl {
      */
     Set getIDReferences();
 
+    /**
+     * @return the FOInputHandler for parsing this FO Tree
+     */
+    FOInputHandler getFOInputHandler();
 }
index b1510f2694c28dd450e1a067fe0e33cc2f4c48e8..84ff3b8b3c554b9f5d59ce4345047e62fe9e777f 100644 (file)
@@ -78,12 +78,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.
      */
@@ -251,19 +245,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
index 179f2fe91f6591caa9c2f913a74f15471f1a8d90..8d1096173389e97655e36856e3b4bd7f86e55901 100644 (file)
@@ -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
@@ -67,14 +65,6 @@ public class FObjMixed extends FObj {
         super(parent);
     }
 
-    /**
-     * @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
@@ -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);
     }
 
index 994da7ccb75d15fcb8480bf134c7ee7534decce0..b40bda32ae06fe347ea95b9107ee219d0da544ab 100644 (file)
@@ -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() {
index df1e96af5bbf6a526e49ec07feac087d5f2cf9a1..6d9c65333b7013195bcee50fe561f43bcf206054 100644 (file)
@@ -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();
index abb0b695947ad843baf9b2497678e4a651e10b4e..bd7bd05bb7767be89b6e691ee25685dc1c351722 100644 (file)
@@ -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();
index 621e898ce1009ebdf1e59aa2a39b4744c936c9e1..ec72a4e407c260234e7907684a7aa131f98040f5 100644 (file)
@@ -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;
 
@@ -94,14 +92,6 @@ public class PageNumberCitation extends FObj {
         super(parent);
     }
 
-    /**
-     * @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();
index 15b156e870d12d25b3922d68546402315537ec12..5a6e2ee8dd86274c727e97b930b91c3a62f7f57c 100644 (file)
@@ -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);
     }
 
     /**
index 77198e21bb05a05b814dcd0423a7968f5addbd83..d783b65103d96f0ef570a5c114f135ab36dea640 100644 (file)
@@ -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);
index a944e05ec60eff53b0f514a34461cef8ce613238..a2b7584048ff4e5f429002a66af982608e58a86f 100644 (file)
@@ -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();