You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vm...@apache.org on 2003/08/19 07:19:21 UTC
cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr AddLMVisitor.java
vmote 2003/08/18 22:19:21
Modified: src/java/org/apache/fop/apps Driver.java
src/java/org/apache/fop/control Document.java
src/java/org/apache/fop/fo FONode.java FOTreeBuilder.java
FObjMixed.java PropertyManager.java
src/java/org/apache/fop/fo/pagination Root.java
src/java/org/apache/fop/layoutmgr AddLMVisitor.java
Added: src/java/org/apache/fop/fo FOTreeControl.java
Log:
create fo/FOTreeControl interface, and make control/Document implement it, to further encapsulate the FO Tree
Revision Changes Path
1.28 +1 -1 xml-fop/src/java/org/apache/fop/apps/Driver.java
Index: Driver.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Driver.java 19 Aug 2003 00:53:52 -0000 1.27
+++ Driver.java 19 Aug 2003 05:19:21 -0000 1.28
@@ -601,7 +601,7 @@
if (foInputHandler instanceof FOTreeHandler) {
currentDocument.setLayoutStrategy(new LayoutManagerLS());
}
- treeBuilder.document = currentDocument;
+ treeBuilder.foTreeControl = currentDocument;
try {
if (foInputHandler instanceof FOTreeHandler) {
FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
1.4 +3 -2 xml-fop/src/java/org/apache/fop/control/Document.java
Index: Document.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/control/Document.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Document.java 15 Aug 2003 15:52:10 -0000 1.3
+++ Document.java 19 Aug 2003 05:19:21 -0000 1.4
@@ -55,6 +55,7 @@
// FOP
import org.apache.fop.apps.Driver;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.layout.LayoutStrategy;
@@ -63,7 +64,7 @@
* Class storing information for the FOP Document being processed, and managing
* the processing of it.
*/
-public class Document {
+public class Document implements FOTreeControl {
/** The parent Driver object */
private Driver driver;
1.8 +3 -3 xml-fop/src/java/org/apache/fop/fo/FONode.java
Index: FONode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FONode.java 19 Aug 2003 00:53:52 -0000 1.7
+++ FONode.java 19 Aug 2003 05:19:21 -0000 1.8
@@ -61,7 +61,7 @@
// FOP
import org.apache.fop.apps.FOPException;
-import org.apache.fop.control.Document;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.util.CharUtilities;
/**
@@ -216,8 +216,8 @@
* which returns the parent Document.
* @return the Document object that is the parent of this node.
*/
- public Document getDocument() {
- return parent.getDocument();
+ public FOTreeControl getFOTreeControl() {
+ return parent.getFOTreeControl();
}
/**
1.11 +3 -3 xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java
Index: FOTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FOTreeBuilder.java 16 Aug 2003 06:43:51 -0000 1.10
+++ FOTreeBuilder.java 19 Aug 2003 05:19:21 -0000 1.11
@@ -54,7 +54,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.fop.control.Document;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fo.pagination.Root;
// SAX
@@ -122,7 +122,7 @@
private FOUserAgent userAgent;
- public Document document;
+ public FOTreeControl foTreeControl;
/**
* Default constructor
@@ -295,7 +295,7 @@
+ fobj.getName()));
}
rootFObj = (Root)fobj;
- rootFObj.setDocument(document);
+ rootFObj.setFOTreeControl(foTreeControl);
} else {
currentFObj.addChild(fobj);
}
1.9 +4 -4 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java
Index: FObjMixed.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FObjMixed.java 19 Aug 2003 00:53:52 -0000 1.8
+++ FObjMixed.java 19 Aug 2003 05:19:21 -0000 1.9
@@ -50,7 +50,7 @@
*/
package org.apache.fop.fo;
-import org.apache.fop.control.Document;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
import org.apache.fop.layoutmgr.LMiter;
@@ -64,7 +64,7 @@
/** TextInfo for this object */
protected TextInfo textInfo = null;
/** FontInfo for this object */
- protected Document fontInfo = null;
+ protected FOTreeControl fontInfo = null;
/**
* @param parent FONode that is the parent of this object
@@ -90,8 +90,8 @@
if (textInfo == null) {
// Really only need one of these, but need to get fontInfo
// stored in propMgr for later use.
- propMgr.setFontInfo(getDocument());
- textInfo = propMgr.getTextLayoutProps(getDocument());
+ propMgr.setFontInfo(getFOTreeControl());
+ textInfo = propMgr.getTextLayoutProps(getFOTreeControl());
}
FOText ft = new FOText(data, start, length, textInfo, this);
1.8 +13 -13 xml-fop/src/java/org/apache/fop/fo/PropertyManager.java
Index: PropertyManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PropertyManager.java 16 Aug 2003 06:43:51 -0000 1.7
+++ PropertyManager.java 19 Aug 2003 05:19:21 -0000 1.8
@@ -58,7 +58,7 @@
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.fonts.Font;
-import org.apache.fop.control.Document;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonMarginInline;
@@ -83,7 +83,7 @@
public class PropertyManager {
private PropertyList properties;
- private Document doc = null;
+ private FOTreeControl foTreeControl = null;
private Font fontState = null;
private CommonBorderAndPadding borderAndPadding = null;
private CommonHyphenation hyphProps = null;
@@ -122,8 +122,8 @@
* available.
* @param doc Document containing font information
*/
- public void setFontInfo(Document doc) {
- this.doc = doc;
+ public void setFontInfo(FOTreeControl foTreeControl) {
+ this.foTreeControl = foTreeControl;
}
@@ -133,12 +133,12 @@
* @param doc Document containing the font information
* @return a FontState object
*/
- public Font getFontState(Document doc) {
+ public Font getFontState(FOTreeControl foTreeControl) {
if (fontState == null) {
- if (doc == null) {
- doc = this.doc;
- } else if (this.doc == null) {
- this.doc = doc;
+ if (foTreeControl == null) {
+ foTreeControl = this.foTreeControl;
+ } else if (this.foTreeControl == null) {
+ this.foTreeControl = foTreeControl;
}
/**@todo this is ugly. need to improve. */
@@ -167,9 +167,9 @@
// various kinds of keywords too
int fontSize = properties.get("font-size").getLength().getValue();
//int fontVariant = properties.get("font-variant").getEnum();
- String fname = doc.fontLookup(fontFamily, fontStyle,
+ String fname = foTreeControl.fontLookup(fontFamily, fontStyle,
fontWeight);
- FontMetrics metrics = doc.getMetricsFor(fname);
+ FontMetrics metrics = foTreeControl.getMetricsFor(fname);
fontState = new Font(fname, metrics, fontSize);
}
return fontState;
@@ -479,10 +479,10 @@
* @param doc Document containing list of available fonts
* @return a TextInfo object
*/
- public TextInfo getTextLayoutProps(Document doc) {
+ public TextInfo getTextLayoutProps(FOTreeControl foTreeControl) {
if (textInfo == null) {
textInfo = new TextInfo();
- textInfo.fs = getFontState(doc);
+ textInfo.fs = getFontState(foTreeControl);
textInfo.color = properties.get("color").getColorType();
textInfo.verticalAlign =
1.1 xml-fop/src/java/org/apache/fop/fo/FOTreeControl.java
Index: FOTreeControl.java
===================================================================
/*
* $Id: FOTreeControl.java,v 1.1 2003/08/19 05:19:21 vmote Exp $
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jt...@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.fo;
import org.apache.fop.fonts.FontMetrics;
/**
* 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 {
public String fontLookup(String family, String style,
int weight);
public FontMetrics getMetricsFor(String fontName);
}
1.6 +12 -11 xml-fop/src/java/org/apache/fop/fo/pagination/Root.java
Index: Root.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Root.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Root.java 19 Aug 2003 00:53:54 -0000 1.5
+++ Root.java 19 Aug 2003 05:19:21 -0000 1.6
@@ -54,7 +54,7 @@
import java.util.List;
// FOP
-import org.apache.fop.control.Document;
+import org.apache.fop.fo.FOTreeControl;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
@@ -71,7 +71,7 @@
*/
private int runningPageNumberCounter = 0;
- private Document document = null;
+ private FOTreeControl foTreeControl = null;
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
@@ -144,22 +144,23 @@
}
/**
- * Sets the Document that this Root is attached to
- * @param document the Document that this Root is attached to
+ * Sets the FOTreeControl that this Root is attached to
+ * @param foTreeControl the FOTreeControl implementation to which this Root
+ * is attached
*/
- public void setDocument(Document document) {
- this.document = document;
+ public void setFOTreeControl(FOTreeControl foTreeControl) {
+ this.foTreeControl = foTreeControl;
}
/**
* 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 Document object. Thus, any FONode can
- * use this chain to find which Document it is being built for.
- * @return the Document that this Root is attached to
+ * 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
*/
- public Document getDocument() {
- return document;
+ public FOTreeControl getFOTreeControl() {
+ return foTreeControl;
}
public void acceptVisitor(FOTreeVisitor fotv) {
1.2 +2 -2 xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
Index: AddLMVisitor.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AddLMVisitor.java 19 Aug 2003 00:53:54 -0000 1.1
+++ AddLMVisitor.java 19 Aug 2003 05:19:21 -0000 1.2
@@ -251,7 +251,7 @@
BlockLayoutManager blm = new BlockLayoutManager();
blm.setUserAgent(node.getUserAgent());
blm.setFObj(node);
- TextInfo ti = node.getPropertyManager().getTextLayoutProps(node.getDocument());
+ TextInfo ti = node.getPropertyManager().getTextLayoutProps(node.getFOTreeControl());
blm.setBlockTextInfo(ti);
currentLMList.add(blm);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org