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;
*/
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
return idReferences;
}
-}
+ /**
+ * @return the FOInputHandler for parsing this FO Tree
+ */
+ public FOInputHandler getFOInputHandler() {
+ return foInputHandler;
+ }
+}
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) {
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.
* the character array containing the text
*/
public char[] ca;
- private int start;
+ public int start;
/**
* the length of the character array containing the text
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
fobj.setUserAgent(userAgent);
// set the structure handler so that appropriate
// elements can signal structure events
- fobj.setFOInputHandler(foInputHandler);
fobj.handleAttrs(attlist);
} catch (FOPException e) {
*/
Set getIDReferences();
+ /**
+ * @return the FOInputHandler for parsing this FO Tree
+ */
+ FOInputHandler getFOInputHandler();
}
*/
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.
*/
}
}
- /**
- * 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
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
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
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);
}
setupID();
- foInputHandler.startBlock(this);
+ getFOTreeControl().getFOInputHandler().startBlock(this);
}
private void setup() {
*/
public void end() {
handleWhiteSpace();
- foInputHandler.endBlock(this);
+ getFOTreeControl().getFOInputHandler().endBlock(this);
}
private void handleWhiteSpace() {
private int ruleThickness;
private int leaderPattern;
private int patternWidth;
- /** FontInfo for this object */
- protected FOTreeControl fontInfo = null;
/** FontState for this object */
protected Font fontState;
super(parent);
}
-
- /**
- * @param foih FOInputHandler to set
- */
- public void setFOInputHandler(FOInputHandler foih) {
- super.setFOInputHandler(foih);
- fontInfo = foih.getFontInfo();
- }
-
public void setup() {
// Common Accessibility Properties
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();
* Standard.
*/
public class PageNumber extends FObj {
- /** FontInfo for this object */
- protected FOTreeControl fontInfo = null;
/** FontState for this object */
protected Font fontState;
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
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();
* 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;
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
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();
// 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);
}
/**
*/
private void startStructuredPageSequence() {
if (!sequenceStarted) {
- foInputHandler.startPageSequence(this);
+ getFOTreeControl().getFOInputHandler().startPageSequence(this);
sequenceStarted = true;
}
}
*/
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);
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();