git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196884 13f79535-47bb-0310-9956-ffa450edef68pull/30/head
@@ -61,9 +61,8 @@ import org.apache.avalon.framework.logger.Logger; | |||
// FOP | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.FOTreeControl; | |||
import org.apache.fop.util.CharUtilities; | |||
import org.apache.fop.apps.*; | |||
import org.apache.fop.apps.FOUserAgent; | |||
/** | |||
* base class for nodes in the XML tree | |||
@@ -197,6 +196,9 @@ public abstract class FONode { | |||
return null; | |||
} | |||
/** | |||
* @return an iterator for the characters in this node | |||
*/ | |||
public CharIterator charIterator() { | |||
return new OneCharIterator(CharUtilities.CODE_EOT); | |||
} |
@@ -54,7 +54,6 @@ package org.apache.fop.fo; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import java.util.Set; | |||
import org.apache.fop.fo.FOTreeControl; | |||
import org.apache.fop.fo.pagination.Root; | |||
// SAX | |||
@@ -74,7 +73,7 @@ import java.io.Reader; | |||
import java.util.Enumeration; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.apps.*; | |||
import org.apache.fop.apps.FOUserAgent; | |||
/** | |||
* SAX Handler that passes parsed data to the various | |||
@@ -123,6 +122,7 @@ public class FOTreeBuilder extends DefaultHandler { | |||
private FOUserAgent userAgent; | |||
/** The FOTreeControl object managing the FO Tree that is being built */ | |||
public FOTreeControl foTreeControl; | |||
/** |
@@ -66,20 +66,45 @@ import org.apache.fop.fonts.FontMetrics; | |||
* with information about the environment, and to keep track of meta-type | |||
* information. | |||
*/ | |||
public interface FOTreeControl { | |||
public String fontLookup(String family, String style, | |||
/** | |||
* @param family the font family | |||
* @param style the font style | |||
* @param weight the font weight | |||
* @return the String font name matching the parameters | |||
*/ | |||
String fontLookup(String family, String style, | |||
int weight); | |||
public FontMetrics getMetricsFor(String fontName); | |||
/** | |||
* @param fontName the String containing the font name for which a | |||
* FontMetrics object is desired | |||
* @return the FontMetrics object matching the fontName parameter | |||
*/ | |||
FontMetrics getMetricsFor(String fontName); | |||
public boolean isSetupValid(); | |||
/** | |||
* @return true if the default font has been properly setup | |||
*/ | |||
boolean isSetupValid(); | |||
public Map getFonts(); | |||
/** | |||
* @return a Map containing the Fonts used in this FO Tree | |||
*/ | |||
Map getFonts(); | |||
public void setBookmarks(Bookmarks bookmarks); | |||
/** | |||
* Sets the Bookmark object which encapsulates the bookmarks for the FO | |||
* Tree. | |||
* @param bookmarks the Bookmark object encapsulating the bookmarks for this | |||
* FO Tree. | |||
*/ | |||
void setBookmarks(Bookmarks bookmarks); | |||
public Bookmarks getBookmarks(); | |||
/** | |||
* @return the Bookmark object encapsulating the bookmarks for the FO Tree. | |||
*/ | |||
Bookmarks getBookmarks(); | |||
} |
@@ -50,8 +50,6 @@ | |||
*/ | |||
package org.apache.fop.fo; | |||
import org.apache.fop.apps.*; | |||
/** | |||
* Base class for representation of mixed content formatting objects | |||
* and their processing |
@@ -3,34 +3,34 @@ | |||
* ============================================================================ | |||
* 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 | |||
@@ -42,12 +42,12 @@ | |||
* (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 <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
*/ | |||
package org.apache.fop.fo; | |||
import java.util.Vector; | |||
@@ -55,12 +55,21 @@ import java.util.Enumeration; | |||
public class GenericShorthandParser implements ShorthandParser { | |||
protected Vector list; // Vector of Property objects | |||
/** Vector of Property objects */ | |||
protected Vector list; | |||
/** | |||
* Constructor. | |||
* @param listprop the ListProperty object that should be parsed | |||
*/ | |||
public GenericShorthandParser(ListProperty listprop) { | |||
this.list = listprop.getList(); | |||
} | |||
/** | |||
* @param index the index into the List of properties | |||
* @return the property from the List of properties at the index parameter | |||
*/ | |||
protected Property getElement(int index) { | |||
if (list.size() > index) { | |||
return (Property)list.elementAt(index); | |||
@@ -69,6 +78,9 @@ public class GenericShorthandParser implements ShorthandParser { | |||
} | |||
} | |||
/** | |||
* @return the size of the list of properties | |||
*/ | |||
protected int count() { | |||
return list.size(); | |||
} | |||
@@ -90,6 +102,14 @@ public class GenericShorthandParser implements ShorthandParser { | |||
} | |||
/** | |||
* Converts a property name into a Property | |||
* @param propName the String containing the property name | |||
* @param maker the Property.Maker to be used in the conversion | |||
* @param propertyList the PropertyList from which the Property should be | |||
* extracted | |||
* @return the Property matching the parameters, or null if not found | |||
*/ | |||
protected Property convertValueForProperty(String propName, | |||
Property.Maker maker, | |||
PropertyList propertyList) { |
@@ -62,7 +62,7 @@ public class InlineCharIterator extends RecursiveCharIterator { | |||
/** | |||
* @param fobj the object for whose character contents and for whose | |||
* descendant's character contents should be iterated | |||
* @param bap | |||
* @param bap the CommonBorderAndPadding properties to be applied | |||
*/ | |||
public InlineCharIterator(FObj fobj, CommonBorderAndPadding bap) { | |||
super(fobj); |
@@ -3,34 +3,34 @@ | |||
* ============================================================================ | |||
* 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 | |||
@@ -42,30 +42,46 @@ | |||
* (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 <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
*/ | |||
package org.apache.fop.fo; | |||
import java.util.NoSuchElementException; | |||
/** | |||
* Class providing an iterator for one character. | |||
*/ | |||
public class OneCharIterator extends AbstractCharIterator { | |||
private boolean bFirst = true; | |||
private char charCode; | |||
/** | |||
* Constructor | |||
* @param c the character that this iterator should iterate. | |||
*/ | |||
public OneCharIterator(char c) { | |||
this.charCode = c; | |||
} | |||
/** | |||
* @return true if there is another element in the collection over which to | |||
* iterate (since this iterator only handles one character, this will return | |||
* false if it is past that character). | |||
*/ | |||
public boolean hasNext() { | |||
return bFirst; | |||
} | |||
/** | |||
* @return the next character, if there is one (since there is only one | |||
* character over which to iterate, it must be the first character). | |||
* @throws NoSuchElementException if past the first character | |||
*/ | |||
public char nextChar() throws NoSuchElementException { | |||
if (bFirst) { | |||
bFirst = false; |
@@ -510,11 +510,15 @@ public class PropertyManager { | |||
/** | |||
* Calculate absolute reference-orientation relative to media orientation. | |||
* @return the enumerated reference-orientation | |||
*/ | |||
public int getAbsRefOrient() { | |||
return properties.get("reference-orientation").getNumber().intValue(); | |||
} | |||
/** | |||
* @return the enumerated writing-mode | |||
*/ | |||
public int getWritingMode() { | |||
return properties.get("writing-mode").getEnum(); | |||
} |
@@ -67,12 +67,17 @@ public class XMLElement extends XMLObj { | |||
* constructs an XML object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
public XMLElement(FONode parent) { | |||
super(parent); | |||
} | |||
/** | |||
* Process the attributes for this element. | |||
* @param attlist the attribute list for this element returned by the SAX | |||
* parser | |||
* @throws FOPException for invalid attributes | |||
*/ | |||
public void handleAttrs(Attributes attlist) throws FOPException { | |||
super.handleAttrs(attlist); | |||
init(); | |||
@@ -82,6 +87,10 @@ public class XMLElement extends XMLObj { | |||
createBasicDocument(); | |||
} | |||
/** | |||
* Public accessor for the namespace. | |||
* @return the namespace for this element | |||
*/ | |||
public String getNameSpace() { | |||
return namespace; | |||
} |