import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.fo.FOInputHandler;
-import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fonts.FontInfo;
import org.apache.commons.logging.Log;
* Class storing information for the FOP Document being processed, and managing
* the processing of it.
*/
-public class Document implements FOTreeControl {
+public class Document {
/** The parent Driver object */
private Driver driver;
foInputHandler.setLogger(getLogger());
treeBuilder.setFOInputHandler(foInputHandler);
- treeBuilder.setFOTreeControl(currentDocument);
+ treeBuilder.setDocument(currentDocument);
return new ProxyContentHandler(treeBuilder) {
}
/**
- * Returns the FOTreeControl object associated with this FOInputHandler.
- * @return the FOTreeControl object
+ * Returns the Document object associated with this FOInputHandler.
+ * @return the Document object
*/
public Document getDocument() {
return doc;
import org.apache.commons.logging.Log;
// FOP
+import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.util.CharUtilities;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.util.CharUtilities;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.svg.SVGElementMapping;
* @return FOUserAgent
*/
public FOUserAgent getUserAgent() {
- return getFOTreeControl().getDriver().getUserAgent();
+ return getDocument().getDriver().getUserAgent();
}
/**
* @return the logger
*/
public Log getLogger() {
- return getFOTreeControl().getDriver().getLogger();
+ return getDocument().getDriver().getLogger();
}
/**
* which returns the parent Document.
* @return the Document object that is the parent of this node.
*/
- public FOTreeControl getFOTreeControl() {
- return parent.getFOTreeControl();
+ public Document getDocument() {
+ return parent.getDocument();
}
/**
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.ElementMapping.Maker;
import org.apache.fop.fo.pagination.Root;
*/
private FOInputHandler foInputHandler;
- /** The FOTreeControl object managing the FO Tree that is being built */
- private FOTreeControl foTreeControl;
+ /** The Document object managing the FO Tree that is being built */
+ private Document document;
/** The SAX locator object managing the line and column counters */
private Locator locator;
}
/**
- * Sets the FO Tree Control for this object
- * @param fotc FOTreeControl instance
+ * Sets the apps.Document for this object
+ * @param doc Document instance
*/
- public void setFOTreeControl(FOTreeControl fotc) {
- this.foTreeControl = fotc;
+ public void setDocument(Document doc) {
+ this.document = doc;
}
/**
if (rootFObj == null) {
rootFObj = (Root) foNode;
- rootFObj.setFOTreeControl(foTreeControl);
+ rootFObj.setDocument(document);
} else {
currentFObj.addChild(foNode);
}
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-
-package org.apache.fop.fo;
-
-// Java
-import java.util.Map;
-import java.util.Set;
-
-// FOP
-import org.apache.fop.apps.Driver;
-import org.apache.fop.fonts.FontMetrics;
-import org.apache.fop.fonts.FontInfo;
-
-/**
- * An interface for classes that are conceptually the parent class of the
- * fo.pagination.Root object. The purpose of the interface is to maintain
- * encapsulation of the FO Tree classes, but to acknowledge that a higher-level
- * object is needed to control the building of the FO Tree, to provide it
- * with information about the environment, and to keep track of meta-type
- * information.
- */
-public interface FOTreeControl {
-
- /**
- * Returns the set of ID references found in the FO Tree.
- * @return the ID references
- */
- Set getIDReferences();
-
- /**
- * @return the FOInputHandler for parsing this FO Tree
- */
- FOInputHandler getFOInputHandler();
-
- /**
- * @return the Driver associated with this FO Tree
- */
- Driver getDriver();
-
- /**
- * @return the FontInfo object associated with this FOTree
- */
- FontInfo getFontInfo();
-
-}
/**
* Main constructor
- * @param foTreeControl the FOTreeControl implementation that governs this
+ * @param document the apps.Document implementation that governs this
* FO Tree
* @param store if true then use the store pages model and keep the
* area tree in memory
*
* @return the font information
*/
- public FOTreeControl getFontInfo() {
+ public Document getFontInfo() {
return doc;
}
if (prop != null) {
String str = prop.getString();
if (str != null && !str.equals("")) {
- Set idrefs = getFOTreeControl().getIDReferences();
+ Set idrefs = getDocument().getIDReferences();
if (!idrefs.contains(str)) {
id = str;
idrefs.add(id);
if (textInfo == null) {
// Really only need one of these, but need to get fontInfo
// stored in propMgr for later use.
- propMgr.setFontInfo(getFOTreeControl());
- textInfo = propMgr.getTextLayoutProps(getFOTreeControl());
+ propMgr.setFontInfo(getDocument());
+ textInfo = propMgr.getTextLayoutProps(getDocument());
}
FOText ft = new FOText(data, start, length, textInfo, this);
ft.setName("text");
/* characters() processing empty for FOTreeHandler, not empty for RTF & MIFHandlers */
- getFOTreeControl().getFOInputHandler().characters(ft.ca, ft.startIndex, ft.endIndex);
+ getDocument().getFOInputHandler().characters(ft.ca, ft.startIndex, ft.endIndex);
addChild(ft);
}
package org.apache.fop.fo;
// FOP
+import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.Property;
public class PropertyManager implements Constants {
private PropertyList propertyList;
- private FOTreeControl foTreeControl = null;
+ private Document document = null;
private Font fontState = null;
private CommonBorderAndPadding borderAndPadding = null;
private CommonHyphenation hyphProps = null;
/**
* Sets the Document object telling the property manager which fonts are
* available.
- * @param foTreeControl foTreeControl implementation containing font
+ * @param document apps.Document implementation containing font
* information
*/
- public void setFontInfo(FOTreeControl foTreeControl) {
- this.foTreeControl = foTreeControl;
+ public void setFontInfo(Document document) {
+ this.document = document;
}
/**
* Constructs a FontState object. If it was constructed before it is
* reused.
- * @param foTreeControl FOTreeControl implementation containing the font
+ * @param document apps.Document implementation containing the font
* information
* @return a FontState object
*/
- public Font getFontState(FOTreeControl foTreeControl) {
+ public Font getFontState(Document document) {
if (fontState == null) {
- if (foTreeControl == null) {
- foTreeControl = this.foTreeControl;
- } else if (this.foTreeControl == null) {
- this.foTreeControl = foTreeControl;
+ if (document == null) {
+ document = this.document;
+ } else if (this.document == null) {
+ this.document = document;
}
/**@todo this is ugly. need to improve. */
// various kinds of keywords too
int fontSize = propertyList.get(PR_FONT_SIZE).getLength().getValue();
//int fontVariant = propertyList.get("font-variant").getEnum();
- String fname = foTreeControl.getFontInfo().fontLookup(fontFamily, fontStyle,
+ String fname = document.getFontInfo().fontLookup(fontFamily, fontStyle,
fontWeight);
- FontMetrics metrics = foTreeControl.getFontInfo().getMetricsFor(fname);
+ FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
fontState = new Font(fname, metrics, fontSize);
}
return fontState;
/**
* Constructs a TextInfo objects. If it was constructed before it is
* reused.
- * @param foTreeControl FOTreeControl implementation containing list of
+ * @param document apps.Document implementation containing list of
* available fonts
* @return a TextInfo object
*/
- public TextInfo getTextLayoutProps(FOTreeControl foTreeControl) {
+ public TextInfo getTextLayoutProps(Document document) {
if (textInfo == null) {
textInfo = new TextInfo();
- textInfo.fs = getFontState(foTreeControl);
+ textInfo.fs = getFontState(document);
textInfo.color = propertyList.get(PR_COLOR).getColorType();
textInfo.verticalAlign =
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startLink(this);
+ getDocument().getFOInputHandler().startLink(this);
}
public void setup() {
public void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endLink();
+ getDocument().getFOInputHandler().endLink();
}
public String getName() {
setupID();
- getFOTreeControl().getFOInputHandler().startBlock(this);
+ getDocument().getFOInputHandler().startBlock(this);
}
private void setup() {
*/
public void end() {
handleWhiteSpace();
- getFOTreeControl().getFOInputHandler().endBlock(this);
+ getDocument().getFOInputHandler().endBlock(this);
}
private void handleWhiteSpace() {
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().image(this);
+ getDocument().getFOInputHandler().image(this);
}
/**
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startFootnote(this);
+ getDocument().getFOInputHandler().startFootnote(this);
}
/**
protected void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endFootnote(this);
+ getDocument().getFOInputHandler().endFootnote(this);
}
public String getName() {
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startFootnoteBody(this);
+ getDocument().getFOInputHandler().startFootnoteBody(this);
}
public void acceptVisitor(FOTreeVisitor fotv) {
protected void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endFootnoteBody(this);
+ getDocument().getFOInputHandler().endFootnoteBody(this);
}
public String getName() {
this.lineThrough = true;
}
- getFOTreeControl().getFOInputHandler().startInline(this);
+ getDocument().getFOInputHandler().startInline(this);
}
/**
* @see org.apache.fop.fo.FONode#end
*/
public void end() {
- getFOTreeControl().getFOInputHandler().endInline(this);
+ getDocument().getFOInputHandler().endInline(this);
}
public String getName() {
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOTreeControl());
+ this.fontState = propMgr.getFontState(getDocument());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startList(this);
+ getDocument().getFOInputHandler().startList(this);
}
private void setup() throws FOPException {
protected void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endList(this);
+ getDocument().getFOInputHandler().endList(this);
}
public String getName() {
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startListItem(this);
+ getDocument().getFOInputHandler().startListItem(this);
}
private void setup() {
protected void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endListItem(this);
+ getDocument().getFOInputHandler().endListItem(this);
}
public String getName() {
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
- getFOTreeControl().getFOInputHandler().startListLabel();
+ getDocument().getFOInputHandler().startListLabel();
}
private void setup() {
protected void end() {
super.end();
- getFOTreeControl().getFOInputHandler().endListLabel();
+ getDocument().getFOInputHandler().endListLabel();
}
public String getName() {
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setup();
- getFOTreeControl().getFOInputHandler().startPageNumber(this);
+ getDocument().getFOInputHandler().startPageNumber(this);
}
public void setup() {
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOTreeControl());
+ this.fontState = propMgr.getFontState(getDocument());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endPageNumber(this);
+ getDocument().getFOInputHandler().endPageNumber(this);
}
public String getName() {
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOTreeControl());
+ this.fontState = propMgr.getFontState(getDocument());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
- getFOTreeControl().getFOInputHandler().startTable(this);
+ getDocument().getFOInputHandler().startTable(this);
}
/**
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endTable(this);
+ getDocument().getFOInputHandler().endTable(this);
}
public String getName() {
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
- getFOTreeControl().getFOInputHandler().startBody(this);
+ getDocument().getFOInputHandler().startBody(this);
}
private void setup() throws FOPException {
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endBody(this);
+ getDocument().getFOInputHandler().endBody(this);
}
public String getName() {
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
doSetup(); // init some basic property values
- getFOTreeControl().getFOInputHandler().startCell(this);
+ getDocument().getFOInputHandler().startCell(this);
}
/**
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endCell(this);
+ getDocument().getFOInputHandler().endCell(this);
}
public String getName() {
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
initialize(); // init some basic property values
- getFOTreeControl().getFOInputHandler().startColumn(this);
+ getDocument().getFOInputHandler().startColumn(this);
}
/**
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endColumn(this);
+ getDocument().getFOInputHandler().endColumn(this);
}
public String getName() {
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
- getFOTreeControl().getFOInputHandler().startRow(this);
+ getDocument().getFOInputHandler().startRow(this);
}
/**
}
protected void end() {
- getFOTreeControl().getFOInputHandler().endRow(this);
+ getDocument().getFOInputHandler().endRow(this);
}
public String getName() {
import java.util.Iterator;
// FOP
+import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
((Root) parent).setDeclarations(this);
}
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(String, String)
+ XSL 1.0: (color-profile)+ (and non-XSL NS nodes)
+ FOP (currently): (color-profile)* (and non-XSL NS nodes)
+ */
+ protected void validateChildNode(String nsURI, String localName) {
+ if (nsURI == FOElementMapping.URI) {
+ if (!localName.equals("color-profile")) {
+ invalidChildError(nsURI, localName);
+ }
+ } // anything outside of XSL namespace is OK.
+ }
+
/**
* At the end of this element sort out the child into
* a hashmap of color profiles and a list of external xml.
}
external.add(node);
} else {
- getLogger().warn("invalid element " + node.getName() + "inside declarations");
+ getLogger().warn("invalid element " + node.getName() + " inside declarations");
}
}
}
// Now done in addChild of page-sequence
//pageSequence.addFlow(this);
- getFOTreeControl().getFOInputHandler().startFlow(this);
+ getDocument().getFOInputHandler().startFlow(this);
}
/**
* Tell the StructureRenderer that we are at the end of the flow.
*/
public void end() {
- getFOTreeControl().getFOInputHandler().endFlow(this);
+ getDocument().getFOInputHandler().endFlow(this);
}
/**
*/
private void startStructuredPageSequence() {
if (!sequenceStarted) {
- getFOTreeControl().getFOInputHandler().startPageSequence(this);
+ getDocument().getFOInputHandler().startPageSequence(this);
sequenceStarted = true;
}
}
*/
public void end() {
try {
- this.getFOTreeControl().getFOInputHandler().endPageSequence(this);
+ this.getDocument().getFOInputHandler().endPageSequence(this);
} catch (FOPException fopex) {
getLogger().error("Error in PageSequence.end(): "
+ fopex.getMessage(), fopex);
import java.util.List;
// FOP
-import org.apache.fop.fo.FOTreeControl;
+import org.apache.fop.apps.Document;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
*/
private int runningPageNumberCounter = 0;
- private FOTreeControl foTreeControl = null;
+ private Document document = null;
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
}
/**
- * Sets the FOTreeControl that this Root is attached to
- * @param foTreeControl the FOTreeControl implementation to which this Root
+ * Sets the Document that this Root is attached to
+ * @param document the apps.Document implementation to which this Root
* is attached
*/
- public void setFOTreeControl(FOTreeControl foTreeControl) {
- this.foTreeControl = foTreeControl;
+ public void setDocument(Document document) {
+ this.document = document;
}
/**
* This method overrides the FONode version. The FONode version calls the
* method by the same name for the parent object. Since Root is at the top
- * of the tree, it returns the actual foTreeControl object. Thus, any FONode
- * can use this chain to find which foTreeControl it is being built for.
- * @return the FOTreeControl implementation that this Root is attached to
+ * of the tree, it returns the actual apps.Document object. Thus, any FONode
+ * can use this chain to find which apps.Document it is being built for.
+ * @return the Document implementation that this Root is attached to
*/
- public FOTreeControl getFOTreeControl() {
- return foTreeControl;
+ public Document getDocument() {
+ return document;
}
/**
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- Font fontState = propMgr.getFontState(getFOTreeControl());
+ Font fontState = propMgr.getFontState(getDocument());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
childLMiter = new BlockLMiter(this, childLMiter);
userAgent = inBlock.getUserAgent();
setBlockTextInfo(inBlock.getPropertyManager().getTextLayoutProps(
- inBlock.getFOTreeControl()));
+ inBlock.getDocument()));
}
private void setBlockTextInfo(TextInfo ti) {
import java.util.Vector;
import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.InputHandler;
import org.apache.fop.area.Area;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
import org.apache.fop.render.AbstractRenderer;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.AbstractRenderer;
import org.apache.fop.render.RendererContext;
-import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
/**
* Set up the font info
*
- * @param foTreeControl the font info object to set up
+ * @param inFontInfo the font info object to set up
*/
public void setupFontInfo(FontInfo inFontInfo) {
this.fontInfo = inFontInfo;
package org.apache.fop.render.svg;
+import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Title;
import org.apache.fop.svg.SVGUtilities;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fo.FOTreeControl;
import org.w3c.dom.Node;
import org.w3c.dom.svg.SVGSVGElement;
}
/**
- * @see org.apache.fop.render.Renderer#setupFontInfo(FOTreeControl)
+ * @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo)
*/
public void setupFontInfo(FontInfo fontInfo) {
// create a temp Image to test font metrics on
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.fonts.FontSetup;
import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fo.pagination.Region;
/**