From: Glen Mazza Date: Tue, 15 Jun 2004 06:26:56 +0000 (+0000) Subject: 1.) Added restriction to fo:declarations that fo:color-profile is the only XSL namesp... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~713 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=39d2edd0962d329ca15a1a99f895ce11262e004f;p=xmlgraphics-fop.git 1.) Added restriction to fo:declarations that fo:color-profile is the only XSL namespace child element allowed. 2.) Switched from fo.FOTreeControl to apps.Document throughout app, to better clarify that it is the apps.Document object being accessed/used. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197716 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java index cd204fcb0..be8a025c4 100644 --- a/src/java/org/apache/fop/apps/Document.java +++ b/src/java/org/apache/fop/apps/Document.java @@ -28,7 +28,6 @@ import org.apache.fop.area.AreaTree; 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; @@ -40,7 +39,7 @@ import org.xml.sax.SAXException; * 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; diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index dfbd1412c..95175958b 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -511,7 +511,7 @@ public class Driver { foInputHandler.setLogger(getLogger()); treeBuilder.setFOInputHandler(foInputHandler); - treeBuilder.setFOTreeControl(currentDocument); + treeBuilder.setDocument(currentDocument); return new ProxyContentHandler(treeBuilder) { diff --git a/src/java/org/apache/fop/fo/FOInputHandler.java b/src/java/org/apache/fop/fo/FOInputHandler.java index 8ead9bff1..994603505 100644 --- a/src/java/org/apache/fop/fo/FOInputHandler.java +++ b/src/java/org/apache/fop/fo/FOInputHandler.java @@ -94,8 +94,8 @@ public abstract class FOInputHandler { } /** - * 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; diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index a9a0f7ad0..1092be5c7 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -28,9 +28,10 @@ import org.xml.sax.Locator; 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; @@ -59,7 +60,7 @@ public abstract class FONode { * @return FOUserAgent */ public FOUserAgent getUserAgent() { - return getFOTreeControl().getDriver().getUserAgent(); + return getDocument().getDriver().getUserAgent(); } /** @@ -67,7 +68,7 @@ public abstract class FONode { * @return the logger */ public Log getLogger() { - return getFOTreeControl().getDriver().getLogger(); + return getDocument().getDriver().getLogger(); } /** @@ -183,8 +184,8 @@ public abstract class FONode { * 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(); } /** diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index 0e2ce5545..519d05b88 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -31,6 +31,7 @@ import java.util.Set; 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; @@ -79,8 +80,8 @@ public class FOTreeBuilder extends DefaultHandler { */ 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; @@ -93,11 +94,11 @@ public class FOTreeBuilder extends DefaultHandler { } /** - * 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; } /** @@ -253,7 +254,7 @@ public class FOTreeBuilder extends DefaultHandler { if (rootFObj == null) { rootFObj = (Root) foNode; - rootFObj.setFOTreeControl(foTreeControl); + rootFObj.setDocument(document); } else { currentFObj.addChild(foNode); } diff --git a/src/java/org/apache/fop/fo/FOTreeControl.java b/src/java/org/apache/fop/fo/FOTreeControl.java deleted file mode 100644 index 1582d2855..000000000 --- a/src/java/org/apache/fop/fo/FOTreeControl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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(); - -} diff --git a/src/java/org/apache/fop/fo/FOTreeHandler.java b/src/java/org/apache/fop/fo/FOTreeHandler.java index 4dec73881..2082bcb35 100644 --- a/src/java/org/apache/fop/fo/FOTreeHandler.java +++ b/src/java/org/apache/fop/fo/FOTreeHandler.java @@ -98,7 +98,7 @@ public class FOTreeHandler extends FOInputHandler { /** * 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 @@ -478,7 +478,7 @@ public class FOTreeHandler extends FOInputHandler { * * @return the font information */ - public FOTreeControl getFontInfo() { + public Document getFontInfo() { return doc; } diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 977ea6a1c..4afe44319 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -298,7 +298,7 @@ public class FObj extends FONode implements Constants { 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); diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index 513294ad6..78831cade 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -46,8 +46,8 @@ public class FObjMixed extends FObj { 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); @@ -55,7 +55,7 @@ public class FObjMixed extends FObj { 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); } diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java index 2505c323d..972a224f4 100644 --- a/src/java/org/apache/fop/fo/PropertyManager.java +++ b/src/java/org/apache/fop/fo/PropertyManager.java @@ -19,6 +19,7 @@ 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; @@ -44,7 +45,7 @@ import org.xml.sax.Attributes; 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; @@ -72,27 +73,27 @@ public class PropertyManager implements Constants { /** * 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. */ @@ -121,9 +122,9 @@ public class PropertyManager implements Constants { // 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; @@ -457,14 +458,14 @@ public class PropertyManager implements Constants { /** * 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 = diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 002650c67..88a656547 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -54,7 +54,7 @@ public class BasicLink extends Inline { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startLink(this); + getDocument().getFOInputHandler().startLink(this); } public void setup() { @@ -143,7 +143,7 @@ public class BasicLink extends Inline { public void end() { super.end(); - getFOTreeControl().getFOInputHandler().endLink(); + getDocument().getFOInputHandler().endLink(); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index e1f90ea9a..0a0365ede 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -111,7 +111,7 @@ public class Block extends FObjMixed { setupID(); - getFOTreeControl().getFOInputHandler().startBlock(this); + getDocument().getFOInputHandler().startBlock(this); } private void setup() { @@ -238,7 +238,7 @@ public class Block extends FObjMixed { */ public void end() { handleWhiteSpace(); - getFOTreeControl().getFOInputHandler().endBlock(this); + getDocument().getFOInputHandler().endBlock(this); } private void handleWhiteSpace() { diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index adcac83ca..4b7ff9035 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -63,7 +63,7 @@ public class ExternalGraphic extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().image(this); + getDocument().getFOInputHandler().image(this); } /** diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index 4f74945a5..536c8b06d 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -48,7 +48,7 @@ public class Footnote extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startFootnote(this); + getDocument().getFOInputHandler().startFootnote(this); } /** @@ -79,7 +79,7 @@ public class Footnote extends FObj { protected void end() { super.end(); - getFOTreeControl().getFOInputHandler().endFootnote(this); + getDocument().getFOInputHandler().endFootnote(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index 5b9a2c3a6..8461b44d8 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -52,7 +52,7 @@ public class FootnoteBody extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startFootnoteBody(this); + getDocument().getFOInputHandler().startFootnoteBody(this); } public void acceptVisitor(FOTreeVisitor fotv) { @@ -62,7 +62,7 @@ public class FootnoteBody extends FObj { protected void end() { super.end(); - getFOTreeControl().getFOInputHandler().endFootnoteBody(this); + getDocument().getFOInputHandler().endFootnoteBody(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index ebe49bd49..8d940ddab 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -114,7 +114,7 @@ public class Inline extends FObjMixed { this.lineThrough = true; } - getFOTreeControl().getFOInputHandler().startInline(this); + getDocument().getFOInputHandler().startInline(this); } /** @@ -139,7 +139,7 @@ public class Inline extends FObjMixed { * @see org.apache.fop.fo.FONode#end */ public void end() { - getFOTreeControl().getFOInputHandler().endInline(this); + getDocument().getFOInputHandler().endInline(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index f9c3ac8c4..f5387a62c 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -66,7 +66,7 @@ public class Leader extends FObjMixed { 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(); diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 23d4da5ef..84b85ed93 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -64,7 +64,7 @@ public class ListBlock extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startList(this); + getDocument().getFOInputHandler().startList(this); } private void setup() throws FOPException { @@ -139,7 +139,7 @@ public class ListBlock extends FObj { protected void end() { super.end(); - getFOTreeControl().getFOInputHandler().endList(this); + getDocument().getFOInputHandler().endList(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 6c5ed254b..b403c44cb 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -64,7 +64,7 @@ public class ListItem extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startListItem(this); + getDocument().getFOInputHandler().startListItem(this); } private void setup() { @@ -148,7 +148,7 @@ public class ListItem extends FObj { protected void end() { super.end(); - getFOTreeControl().getFOInputHandler().endListItem(this); + getDocument().getFOInputHandler().endListItem(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index cead94f88..51b8da235 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -46,7 +46,7 @@ public class ListItemLabel extends FObj { */ protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); - getFOTreeControl().getFOInputHandler().startListLabel(); + getDocument().getFOInputHandler().startListLabel(); } private void setup() { @@ -86,7 +86,7 @@ public class ListItemLabel extends FObj { protected void end() { super.end(); - getFOTreeControl().getFOInputHandler().endListLabel(); + getDocument().getFOInputHandler().endListLabel(); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 1871e8133..0c4e558bf 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -61,7 +61,7 @@ public class PageNumber extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); setup(); - getFOTreeControl().getFOInputHandler().startPageNumber(this); + getDocument().getFOInputHandler().startPageNumber(this); } public void setup() { @@ -77,7 +77,7 @@ public class PageNumber extends FObj { 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(); @@ -129,7 +129,7 @@ public class PageNumber extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endPageNumber(this); + getDocument().getFOInputHandler().endPageNumber(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index b1907b05b..6ea66fe3a 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -82,7 +82,7 @@ public class PageNumberCitation extends FObj { 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(); diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 94fada6c1..82202e65c 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -81,7 +81,7 @@ public class Table extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); setupID(); - getFOTreeControl().getFOInputHandler().startTable(this); + getDocument().getFOInputHandler().startTable(this); } /** @@ -203,7 +203,7 @@ public class Table extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endTable(this); + getDocument().getFOInputHandler().endTable(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index ce5048a67..a75142b1c 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -57,7 +57,7 @@ public class TableBody extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); setupID(); - getFOTreeControl().getFOInputHandler().startBody(this); + getDocument().getFOInputHandler().startBody(this); } private void setup() throws FOPException { @@ -104,7 +104,7 @@ public class TableBody extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endBody(this); + getDocument().getFOInputHandler().endBody(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index b9d4e2b6a..88c089963 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -123,7 +123,7 @@ public class TableCell extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); doSetup(); // init some basic property values - getFOTreeControl().getFOInputHandler().startCell(this); + getDocument().getFOInputHandler().startCell(this); } /** @@ -348,7 +348,7 @@ public class TableCell extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endCell(this); + getDocument().getFOInputHandler().endCell(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index 232d6b0ea..69e18b8fa 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -60,7 +60,7 @@ public class TableColumn extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); initialize(); // init some basic property values - getFOTreeControl().getFOInputHandler().startColumn(this); + getDocument().getFOInputHandler().startColumn(this); } /** @@ -124,7 +124,7 @@ public class TableColumn extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endColumn(this); + getDocument().getFOInputHandler().endColumn(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 9ecc3ec12..467fe02b2 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -68,7 +68,7 @@ public class TableRow extends FObj { protected void addProperties(Attributes attlist) throws FOPException { super.addProperties(attlist); setupID(); - getFOTreeControl().getFOInputHandler().startRow(this); + getDocument().getFOInputHandler().startRow(this); } /** @@ -145,7 +145,7 @@ public class TableRow extends FObj { } protected void end() { - getFOTreeControl().getFOInputHandler().endRow(this); + getDocument().getFOInputHandler().endRow(this); } public String getName() { diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index 21cca9935..e54a6f714 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -24,6 +24,7 @@ import java.util.Map; 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; @@ -50,6 +51,19 @@ public class Declarations extends FObj { ((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. @@ -79,7 +93,7 @@ public class Declarations extends FObj { } external.add(node); } else { - getLogger().warn("invalid element " + node.getName() + "inside declarations"); + getLogger().warn("invalid element " + node.getName() + " inside declarations"); } } } diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 8ceba8956..115e18173 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -92,14 +92,14 @@ public class Flow extends FObj { // 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); } /** diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 91755ce13..d9c32092a 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -291,7 +291,7 @@ public class PageSequence extends FObj { */ private void startStructuredPageSequence() { if (!sequenceStarted) { - getFOTreeControl().getFOInputHandler().startPageSequence(this); + getDocument().getFOInputHandler().startPageSequence(this); sequenceStarted = true; } } @@ -303,7 +303,7 @@ public class PageSequence extends FObj { */ 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); diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index c5e9669a0..71e3c6feb 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -22,7 +22,7 @@ package org.apache.fop.fo.pagination; 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; @@ -47,7 +47,7 @@ public class Root extends FObj { */ private int runningPageNumberCounter = 0; - private FOTreeControl foTreeControl = null; + private Document document = null; /** * @see org.apache.fop.fo.FONode#FONode(FONode) @@ -197,23 +197,23 @@ public class Root extends FObj { } /** - * 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; } /** diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index f90ed6d00..c0599cd18 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -59,7 +59,7 @@ public class Title extends FObjMixed { 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(); diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 815df1c58..8e3fc034b 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -74,7 +74,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { childLMiter = new BlockLMiter(this, childLMiter); userAgent = inBlock.getUserAgent(); setBlockTextInfo(inBlock.getPropertyManager().getTextLayoutProps( - inBlock.getFOTreeControl())); + inBlock.getDocument())); } private void setBlockTextInfo(TextInfo ti) { diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 4f049a407..2e727d17f 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -46,6 +46,7 @@ import java.util.Map; 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; @@ -55,7 +56,6 @@ import org.apache.fop.area.RegionViewport; 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; diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java index 68708a2eb..ad61fd658 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ b/src/java/org/apache/fop/render/ps/PSRenderer.java @@ -44,7 +44,6 @@ import org.apache.fop.fonts.Typeface; 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; @@ -226,7 +225,7 @@ public class PSRenderer extends AbstractRenderer { /** * 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; diff --git a/src/java/org/apache/fop/render/svg/SVGRenderer.java b/src/java/org/apache/fop/render/svg/SVGRenderer.java index 3473a0087..7c9e3425b 100644 --- a/src/java/org/apache/fop/render/svg/SVGRenderer.java +++ b/src/java/org/apache/fop/render/svg/SVGRenderer.java @@ -18,6 +18,7 @@ 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; @@ -27,7 +28,6 @@ import org.apache.fop.area.inline.TextArea; 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; @@ -132,7 +132,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { } /** - * @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 diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index ec633777b..9e415bb72 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -59,7 +59,6 @@ import org.apache.fop.area.inline.Viewport; 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; /**