2.) Error messages for bad fo: files now give locator (line/col. #) information. 3.) Parent of the fo:root (FO Tree) "lowered" from apps.Document to fo.FOInputHandler; IDReferences moved from former to latter. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197717 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -18,20 +18,12 @@ | |||
package org.apache.fop.apps; | |||
// Java | |||
import java.util.Map; | |||
import java.util.Set; | |||
import java.util.HashSet; | |||
// FOP | |||
import org.apache.fop.area.AreaTree; | |||
import org.apache.fop.area.AreaTreeModel; | |||
import org.apache.fop.fo.FOInputHandler; | |||
import org.apache.fop.fonts.FontInfo; | |||
import org.apache.commons.logging.Log; | |||
// SAX | |||
import org.xml.sax.SAXException; | |||
@@ -53,12 +45,6 @@ public class Document { | |||
/** The AreaTreeModel for the PageSequence being rendered. */ | |||
public AreaTreeModel atModel; | |||
/** | |||
* The current set of id's in the FO tree. | |||
* This is used so we know if the FO tree contains duplicates. | |||
*/ | |||
private Set idReferences = new HashSet(); | |||
/** | |||
* Structure handler used to notify structure | |||
* events such as start end element. | |||
@@ -99,14 +85,6 @@ public class Document { | |||
return areaTree; | |||
} | |||
/** | |||
* Retuns the set of ID references. | |||
* @return the ID references | |||
*/ | |||
public Set getIDReferences() { | |||
return idReferences; | |||
} | |||
/** | |||
* @return the FOInputHandler for parsing this FO Tree | |||
*/ |
@@ -18,6 +18,10 @@ | |||
package org.apache.fop.fo; | |||
// Java | |||
import java.util.HashSet; | |||
import java.util.Set; | |||
// FOP | |||
import org.apache.fop.apps.Document; | |||
import org.apache.fop.apps.Driver; | |||
@@ -68,6 +72,12 @@ public abstract class FOInputHandler { | |||
*/ | |||
protected Log logger = null; | |||
/** | |||
* The current set of id's in the FO tree. | |||
* This is used so we know if the FO tree contains duplicates. | |||
*/ | |||
private Set idReferences = new HashSet(); | |||
/** | |||
* Main constructor | |||
* @param document the apps.Document implementation that is controlling | |||
@@ -77,6 +87,14 @@ public abstract class FOInputHandler { | |||
doc = document; | |||
} | |||
/** | |||
* Retuns the set of ID references. | |||
* @return the ID references | |||
*/ | |||
public Set getIDReferences() { | |||
return idReferences; | |||
} | |||
/** | |||
* Sets the Commons-Logging instance for this class | |||
* @param logger The Commons-Logging instance |
@@ -28,7 +28,6 @@ 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.apps.FOUserAgent; | |||
import org.apache.fop.util.CharUtilities; | |||
@@ -60,7 +59,7 @@ public abstract class FONode { | |||
* @return FOUserAgent | |||
*/ | |||
public FOUserAgent getUserAgent() { | |||
return getDocument().getDriver().getUserAgent(); | |||
return getFOInputHandler().getDriver().getUserAgent(); | |||
} | |||
/** | |||
@@ -68,7 +67,7 @@ public abstract class FONode { | |||
* @return the logger | |||
*/ | |||
public Log getLogger() { | |||
return getDocument().getDriver().getLogger(); | |||
return getFOInputHandler().getDriver().getLogger(); | |||
} | |||
/** | |||
@@ -101,7 +100,7 @@ public abstract class FONode { | |||
* @param localName (e.g. "table" for "fo:table") | |||
* @throws IllegalArgumentException if incoming node not valid for parent | |||
*/ | |||
protected void validateChildNode(String namespaceURI, String localName) {} | |||
protected void validateChildNode(Locator loc, String namespaceURI, String localName) {} | |||
/** | |||
* Adds characters (does nothing here) | |||
@@ -180,12 +179,12 @@ public abstract class FONode { | |||
} | |||
/** | |||
* Recursively goes up the FOTree hierarchy until the FONode is found, | |||
* which returns the parent Document. | |||
* @return the Document object that is the parent of this node. | |||
* Recursively goes up the FOTree hierarchy until the fo:root is found, | |||
* which returns the parent FOInputHandler. | |||
* @return the FOInputHandler object that is the parent of the FO Tree | |||
*/ | |||
public Document getDocument() { | |||
return parent.getDocument(); | |||
public FOInputHandler getFOInputHandler() { | |||
return parent.getFOInputHandler(); | |||
} | |||
/** | |||
@@ -226,9 +225,9 @@ public abstract class FONode { | |||
* (e.g., two fo:declarations within fo:root) | |||
* @param offendingNode incoming node that would cause a duplication. | |||
*/ | |||
protected void tooManyNodesError(String offendingNode) { | |||
protected void tooManyNodesError(Locator loc, String offendingNode) { | |||
throw new IllegalArgumentException( | |||
"Error: for " + getName() + ", only one " | |||
errorText(loc) + getName() + ", only one " | |||
+ offendingNode + " may be declared."); | |||
} | |||
@@ -238,9 +237,10 @@ public abstract class FONode { | |||
* @param tooLateNode string name of node that should be earlier in document | |||
* @param tooEarlyNode string name of node that should be later in document | |||
*/ | |||
protected void nodesOutOfOrderError(String tooLateNode, String tooEarlyNode) { | |||
protected void nodesOutOfOrderError(Locator loc, String tooLateNode, | |||
String tooEarlyNode) { | |||
throw new IllegalArgumentException( | |||
"Error: for " + getName() + ", " + tooLateNode | |||
errorText(loc) + getName() + ", " + tooLateNode | |||
+ " must be declared before " + tooEarlyNode + "."); | |||
} | |||
@@ -250,11 +250,19 @@ public abstract class FONode { | |||
* @param nsURI namespace URI of incoming invalid node | |||
* @param lName local name (i.e., no prefix) of incoming node | |||
*/ | |||
protected void invalidChildError(String nsURI, String lName) { | |||
protected void invalidChildError(Locator loc, String nsURI, String lName) { | |||
throw new IllegalArgumentException( | |||
"Error: " + getNodeString(nsURI, lName) + | |||
errorText(loc) + getNodeString(nsURI, lName) + | |||
" is not valid child element of " + getName() + "."); | |||
} | |||
/** | |||
* Helper function to return "Error (line#/column#)" string for | |||
* above exception messages | |||
* @param loc org.xml.sax.Locator object | |||
*/ | |||
protected static String errorText(Locator loc) { | |||
return "Error(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): "; | |||
} | |||
} | |||
@@ -234,7 +234,7 @@ public class FOTreeBuilder extends DefaultHandler { | |||
} | |||
} else { // check that incoming node is valid for currentFObj | |||
try { | |||
currentFObj.validateChildNode(namespaceURI, localName); | |||
currentFObj.validateChildNode(locator, namespaceURI, localName); | |||
} catch (IllegalArgumentException e) { | |||
throw new SAXException(e); | |||
} | |||
@@ -254,7 +254,7 @@ public class FOTreeBuilder extends DefaultHandler { | |||
if (rootFObj == null) { | |||
rootFObj = (Root) foNode; | |||
rootFObj.setDocument(document); | |||
rootFObj.setFOInputHandler(document.getFOInputHandler()); | |||
} else { | |||
currentFObj.addChild(foNode); | |||
} |
@@ -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 = getDocument().getIDReferences(); | |||
Set idrefs = getFOInputHandler().getIDReferences(); | |||
if (!idrefs.contains(str)) { | |||
id = str; | |||
idrefs.add(id); |
@@ -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(getDocument()); | |||
textInfo = propMgr.getTextLayoutProps(getDocument()); | |||
propMgr.setFontInfo(getFOInputHandler().getDocument()); | |||
textInfo = propMgr.getTextLayoutProps(getFOInputHandler().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 */ | |||
getDocument().getFOInputHandler().characters(ft.ca, ft.startIndex, ft.endIndex); | |||
getFOInputHandler().characters(ft.ca, ft.startIndex, ft.endIndex); | |||
addChild(ft); | |||
} |
@@ -54,7 +54,7 @@ public class BasicLink extends Inline { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startLink(this); | |||
getFOInputHandler().startLink(this); | |||
} | |||
public void setup() { | |||
@@ -142,8 +142,7 @@ public class BasicLink extends Inline { | |||
*/ | |||
public void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endLink(); | |||
getFOInputHandler().endLink(); | |||
} | |||
public String getName() { |
@@ -111,7 +111,7 @@ public class Block extends FObjMixed { | |||
setupID(); | |||
getDocument().getFOInputHandler().startBlock(this); | |||
getFOInputHandler().startBlock(this); | |||
} | |||
private void setup() { | |||
@@ -238,7 +238,7 @@ public class Block extends FObjMixed { | |||
*/ | |||
public void end() { | |||
handleWhiteSpace(); | |||
getDocument().getFOInputHandler().endBlock(this); | |||
getFOInputHandler().endBlock(this); | |||
} | |||
private void handleWhiteSpace() { |
@@ -63,7 +63,7 @@ public class ExternalGraphic extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().image(this); | |||
getFOInputHandler().image(this); | |||
} | |||
/** |
@@ -48,7 +48,7 @@ public class Footnote extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startFootnote(this); | |||
getFOInputHandler().startFootnote(this); | |||
} | |||
/** | |||
@@ -79,7 +79,7 @@ public class Footnote extends FObj { | |||
protected void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endFootnote(this); | |||
getFOInputHandler().endFootnote(this); | |||
} | |||
public String getName() { |
@@ -52,7 +52,7 @@ public class FootnoteBody extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startFootnoteBody(this); | |||
getFOInputHandler().startFootnoteBody(this); | |||
} | |||
public void acceptVisitor(FOTreeVisitor fotv) { | |||
@@ -61,8 +61,7 @@ public class FootnoteBody extends FObj { | |||
protected void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endFootnoteBody(this); | |||
getFOInputHandler().endFootnoteBody(this); | |||
} | |||
public String getName() { |
@@ -114,7 +114,7 @@ public class Inline extends FObjMixed { | |||
this.lineThrough = true; | |||
} | |||
getDocument().getFOInputHandler().startInline(this); | |||
getFOInputHandler().startInline(this); | |||
} | |||
/** | |||
@@ -139,7 +139,7 @@ public class Inline extends FObjMixed { | |||
* @see org.apache.fop.fo.FONode#end | |||
*/ | |||
public void end() { | |||
getDocument().getFOInputHandler().endInline(this); | |||
getFOInputHandler().endInline(this); | |||
} | |||
public String getName() { |
@@ -66,7 +66,7 @@ public class Leader extends FObjMixed { | |||
CommonBackground bProps = propMgr.getBackgroundProps(); | |||
// Common Font Properties | |||
this.fontState = propMgr.getFontState(getDocument()); | |||
this.fontState = propMgr.getFontState(getFOInputHandler().getDocument()); | |||
// Common Margin Properties-Inline | |||
CommonMarginInline mProps = propMgr.getMarginInlineProps(); |
@@ -64,7 +64,7 @@ public class ListBlock extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startList(this); | |||
getFOInputHandler().startList(this); | |||
} | |||
private void setup() throws FOPException { | |||
@@ -138,8 +138,7 @@ public class ListBlock extends FObj { | |||
protected void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endList(this); | |||
getFOInputHandler().endList(this); | |||
} | |||
public String getName() { |
@@ -64,7 +64,7 @@ public class ListItem extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startListItem(this); | |||
getFOInputHandler().startListItem(this); | |||
} | |||
private void setup() { | |||
@@ -148,7 +148,7 @@ public class ListItem extends FObj { | |||
protected void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endListItem(this); | |||
getFOInputHandler().endListItem(this); | |||
} | |||
public String getName() { |
@@ -46,7 +46,7 @@ public class ListItemLabel extends FObj { | |||
*/ | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
getDocument().getFOInputHandler().startListLabel(); | |||
getFOInputHandler().startListLabel(); | |||
} | |||
private void setup() { | |||
@@ -85,8 +85,7 @@ public class ListItemLabel extends FObj { | |||
protected void end() { | |||
super.end(); | |||
getDocument().getFOInputHandler().endListLabel(); | |||
getFOInputHandler().endListLabel(); | |||
} | |||
public String getName() { |
@@ -61,7 +61,7 @@ public class PageNumber extends FObj { | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
setup(); | |||
getDocument().getFOInputHandler().startPageNumber(this); | |||
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(getDocument()); | |||
this.fontState = propMgr.getFontState(getFOInputHandler().getDocument()); | |||
// Common Margin Properties-Inline | |||
CommonMarginInline mProps = propMgr.getMarginInlineProps(); | |||
@@ -129,7 +129,7 @@ public class PageNumber extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endPageNumber(this); | |||
getFOInputHandler().endPageNumber(this); | |||
} | |||
public String getName() { |
@@ -82,7 +82,7 @@ public class PageNumberCitation extends FObj { | |||
CommonBackground bProps = propMgr.getBackgroundProps(); | |||
// Common Font Properties | |||
this.fontState = propMgr.getFontState(getDocument()); | |||
this.fontState = propMgr.getFontState(getFOInputHandler().getDocument()); | |||
// Common Margin Properties-Inline | |||
CommonMarginInline mProps = propMgr.getMarginInlineProps(); |
@@ -81,7 +81,7 @@ public class Table extends FObj { | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
setupID(); | |||
getDocument().getFOInputHandler().startTable(this); | |||
getFOInputHandler().startTable(this); | |||
} | |||
/** | |||
@@ -203,7 +203,7 @@ public class Table extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endTable(this); | |||
getFOInputHandler().endTable(this); | |||
} | |||
public String getName() { |
@@ -57,7 +57,7 @@ public class TableBody extends FObj { | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
setupID(); | |||
getDocument().getFOInputHandler().startBody(this); | |||
getFOInputHandler().startBody(this); | |||
} | |||
private void setup() throws FOPException { | |||
@@ -104,7 +104,7 @@ public class TableBody extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endBody(this); | |||
getFOInputHandler().endBody(this); | |||
} | |||
public String getName() { |
@@ -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 | |||
getDocument().getFOInputHandler().startCell(this); | |||
getFOInputHandler().startCell(this); | |||
} | |||
/** | |||
@@ -348,7 +348,7 @@ public class TableCell extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endCell(this); | |||
getFOInputHandler().endCell(this); | |||
} | |||
public String getName() { |
@@ -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 | |||
getDocument().getFOInputHandler().startColumn(this); | |||
getFOInputHandler().startColumn(this); | |||
} | |||
/** | |||
@@ -124,7 +124,7 @@ public class TableColumn extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endColumn(this); | |||
getFOInputHandler().endColumn(this); | |||
} | |||
public String getName() { |
@@ -68,7 +68,7 @@ public class TableRow extends FObj { | |||
protected void addProperties(Attributes attlist) throws FOPException { | |||
super.addProperties(attlist); | |||
setupID(); | |||
getDocument().getFOInputHandler().startRow(this); | |||
getFOInputHandler().startRow(this); | |||
} | |||
/** | |||
@@ -145,7 +145,7 @@ public class TableRow extends FObj { | |||
} | |||
protected void end() { | |||
getDocument().getFOInputHandler().endRow(this); | |||
getFOInputHandler().endRow(this); | |||
} | |||
public String getName() { |
@@ -24,6 +24,7 @@ import java.awt.color.ICC_ColorSpace; | |||
import java.net.URL; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import org.xml.sax.Locator; | |||
// FOP | |||
import org.apache.fop.datatypes.ColorType; | |||
@@ -48,6 +49,14 @@ public class ColorProfile extends FObj { | |||
super(parent); | |||
} | |||
/** | |||
* @see org.apache.fop.fo.FONode#validateChildNode(String, String) | |||
XSL 1.0/FOP: EMPTY (no child nodes permitted) | |||
*/ | |||
protected void validateChildNode(Locator loc, String nsURI, String localName) { | |||
invalidChildError(loc, nsURI, localName); | |||
} | |||
/** | |||
* Special processing for the end of parsing an ColorProfile object. | |||
* Extract instance variables from the collection of properties for this |
@@ -29,6 +29,7 @@ import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FObj; | |||
import org.apache.fop.fo.FOTreeVisitor; | |||
import org.apache.fop.fo.XMLObj; | |||
import org.xml.sax.Locator; | |||
/** | |||
@@ -54,12 +55,12 @@ public class Declarations extends FObj { | |||
/** | |||
* @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) | |||
FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes) | |||
*/ | |||
protected void validateChildNode(String nsURI, String localName) { | |||
protected void validateChildNode(Locator loc, String nsURI, String localName) { | |||
if (nsURI == FOElementMapping.URI) { | |||
if (!localName.equals("color-profile")) { | |||
invalidChildError(nsURI, localName); | |||
invalidChildError(loc, nsURI, localName); | |||
} | |||
} // anything outside of XSL namespace is OK. | |||
} |
@@ -92,14 +92,14 @@ public class Flow extends FObj { | |||
// Now done in addChild of page-sequence | |||
//pageSequence.addFlow(this); | |||
getDocument().getFOInputHandler().startFlow(this); | |||
getFOInputHandler().startFlow(this); | |||
} | |||
/** | |||
* Tell the StructureRenderer that we are at the end of the flow. | |||
*/ | |||
public void end() { | |||
getDocument().getFOInputHandler().endFlow(this); | |||
getFOInputHandler().endFlow(this); | |||
} | |||
/** |
@@ -291,7 +291,7 @@ public class PageSequence extends FObj { | |||
*/ | |||
private void startStructuredPageSequence() { | |||
if (!sequenceStarted) { | |||
getDocument().getFOInputHandler().startPageSequence(this); | |||
getFOInputHandler().startPageSequence(this); | |||
sequenceStarted = true; | |||
} | |||
} | |||
@@ -303,7 +303,7 @@ public class PageSequence extends FObj { | |||
*/ | |||
public void end() { | |||
try { | |||
this.getDocument().getFOInputHandler().endPageSequence(this); | |||
getFOInputHandler().endPageSequence(this); | |||
} catch (FOPException fopex) { | |||
getLogger().error("Error in PageSequence.end(): " | |||
+ fopex.getMessage(), fopex); |
@@ -22,13 +22,14 @@ package org.apache.fop.fo.pagination; | |||
import java.util.List; | |||
// FOP | |||
import org.apache.fop.apps.Document; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FObj; | |||
import org.apache.fop.fo.FOElementMapping; | |||
import org.apache.fop.fo.extensions.ExtensionElementMapping; | |||
import org.apache.fop.fo.extensions.Bookmarks; | |||
import org.apache.fop.fo.FOInputHandler; | |||
import org.apache.fop.fo.FOTreeVisitor; | |||
import org.xml.sax.Locator; | |||
/** | |||
* The fo:root formatting object. Contains page masters, page-sequences. | |||
@@ -47,7 +48,10 @@ public class Root extends FObj { | |||
*/ | |||
private int runningPageNumberCounter = 0; | |||
private Document document = null; | |||
/** | |||
* Controlling FOTreeHandler object for this FO Tree | |||
*/ | |||
private FOInputHandler foInputHandler = null; | |||
/** | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
@@ -66,43 +70,43 @@ public class Root extends FObj { | |||
XSL 1.0 Spec: (layout-master-set,declarations?,page-sequence+) | |||
FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+) | |||
*/ | |||
protected void validateChildNode(String nsURI, String localName) { | |||
protected void validateChildNode(Locator loc, String nsURI, String localName) { | |||
if (nsURI == FOElementMapping.URI) { | |||
if (localName.equals("layout-master-set")) { | |||
if (layoutMasterSet != null) { | |||
tooManyNodesError("fo:layout-master-set"); | |||
tooManyNodesError(loc, "fo:layout-master-set"); | |||
} | |||
} else if (localName.equals("declarations")) { | |||
if (layoutMasterSet == null) { | |||
nodesOutOfOrderError("fo:layout-master-set", "fo:declarations"); | |||
nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:declarations"); | |||
} else if (declarations != null) { | |||
tooManyNodesError("fo:declarations"); | |||
tooManyNodesError(loc, "fo:declarations"); | |||
} else if (bookmarks != null) { | |||
nodesOutOfOrderError("fo:declarations", "fox:bookmarks"); | |||
nodesOutOfOrderError(loc, "fo:declarations", "fox:bookmarks"); | |||
} else if (pageSequenceFound) { | |||
nodesOutOfOrderError("fo:declarations", "fo:page-sequence"); | |||
nodesOutOfOrderError(loc, "fo:declarations", "fo:page-sequence"); | |||
} | |||
} else if (localName.equals("page-sequence")) { | |||
if (layoutMasterSet == null) { | |||
nodesOutOfOrderError("fo:layout-master-set", "fo:page-sequence"); | |||
nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:page-sequence"); | |||
} else { | |||
pageSequenceFound = true; | |||
} | |||
} else { | |||
invalidChildError(nsURI, localName); | |||
invalidChildError(loc, nsURI, localName); | |||
} | |||
} else if (nsURI.equals(ExtensionElementMapping.URI)) { | |||
if (!localName.equals("bookmarks")) { | |||
invalidChildError(nsURI, localName); | |||
invalidChildError(loc, nsURI, localName); | |||
} else if (layoutMasterSet == null) { | |||
nodesOutOfOrderError("fo:layout-master-set", "fox:bookmarks"); | |||
nodesOutOfOrderError(loc, "fo:layout-master-set", "fox:bookmarks"); | |||
} else if (bookmarks != null) { | |||
tooManyNodesError("fox:bookmarks"); | |||
tooManyNodesError(loc, "fox:bookmarks"); | |||
} else if (pageSequenceFound) { | |||
nodesOutOfOrderError("fox:bookmarks", "fo:page-sequence"); | |||
nodesOutOfOrderError(loc, "fox:bookmarks", "fo:page-sequence"); | |||
} | |||
} else { | |||
invalidChildError(nsURI, localName); | |||
invalidChildError(loc, nsURI, localName); | |||
} | |||
} | |||
@@ -201,19 +205,19 @@ public class Root extends FObj { | |||
* @param document the apps.Document implementation to which this Root | |||
* is attached | |||
*/ | |||
public void setDocument(Document document) { | |||
this.document = document; | |||
public void setFOInputHandler(FOInputHandler foInputHandler) { | |||
this.foInputHandler = foInputHandler; | |||
} | |||
/** | |||
* 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 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 | |||
* of the tree, it returns the actual FOInputHandler object. Thus, any FONode | |||
* can use this chain to find which FOInputHandler it is being built for. | |||
* @return the FOInputHandler implementation that this Root is attached to | |||
*/ | |||
public Document getDocument() { | |||
return document; | |||
public FOInputHandler getFOInputHandler() { | |||
return foInputHandler; | |||
} | |||
/** |
@@ -59,7 +59,7 @@ public class Title extends FObjMixed { | |||
CommonBackground bProps = propMgr.getBackgroundProps(); | |||
// Common Font Properties | |||
Font fontState = propMgr.getFontState(getDocument()); | |||
Font fontState = propMgr.getFontState(getFOInputHandler().getDocument()); | |||
// Common Margin Properties-Inline | |||
CommonMarginInline mProps = propMgr.getMarginInlineProps(); |
@@ -74,7 +74,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { | |||
childLMiter = new BlockLMiter(this, childLMiter); | |||
userAgent = inBlock.getUserAgent(); | |||
setBlockTextInfo(inBlock.getPropertyManager().getTextLayoutProps( | |||
inBlock.getDocument())); | |||
inBlock.getFOInputHandler().getDocument())); | |||
} | |||
private void setBlockTextInfo(TextInfo ti) { |