aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/pagination
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-09-02 14:26:31 +0000
committerJeremias Maerki <jeremias@apache.org>2005-09-02 14:26:31 +0000
commit2daa1220f0331d560481ed48d5531ee1b6555793 (patch)
tree8ee289b54a62ce23c199c4b0c8cd349a12d8b53f /src/java/org/apache/fop/fo/pagination
parent7253134b2b9feac580724eea566a08ed8ac0fe7f (diff)
downloadxmlgraphics-fop-2daa1220f0331d560481ed48d5531ee1b6555793.tar.gz
xmlgraphics-fop-2daa1220f0331d560481ed48d5531ee1b6555793.zip
Initial work on enhancing the extension facilities to register special extensions which create so-called ExtensionAttachment objects which are attached to the formatting object they are attached to. These objects can be evaluated by standard or custom layout managers or simply passed through to the area tree (the latter is NYI). The AreaTreeHandler currently takes ExtensionAttachment objects from fo:root and fo:declarations and wraps them in OffDocumentItems that Renderers can react on to provide additional functionality on document-level (like PDF metadata or PostScript media dictionaries). Since the simple-page-master is available directly from the PageViewport the renderer can take ExtensionAttachment objects directly from there (see PSRenderer.renderPage()).
Extension Elements that provide ExtensionAttachments are not added as such to the child element list of a formatting object since they work a little differently and should free memory as soon as possible. The PostScript extension described in http://wiki.apache.org/xmlgraphics-fop/ExtensionsForPostScript are now fully implemented but under the namespace URI "http://xmlgraphics.apache.org/fop/postscript", not "http://xml.apache.org/fop/extensions". I'll need to look at namespaces again separately, later. The new PSExtensionElementMapping is currently hard-coded into FOTreeBuilder as are the other ElementMapping classes. OffDocumentItem is now an interface, AbstractOffDocumentItem now providing the base functionality of the former OffDocumentItem class. Lots of clean-up and javadocs while working through this, for example: FObj.childNodes is not public anymore. Instead a special method on fo.flow.InstreamForeignObject provides the child in the one case childNodes was directly accessed. PropertyMaker access in FObj is also done through a method now, propertyListTable is now private. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@267209 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination')
-rw-r--r--src/java/org/apache/fop/fo/pagination/Declarations.java25
-rw-r--r--src/java/org/apache/fop/fo/pagination/SimplePageMaster.java37
2 files changed, 23 insertions, 39 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java
index 110f8e2a8..57f1fd825 100644
--- a/src/java/org/apache/fop/fo/pagination/Declarations.java
+++ b/src/java/org/apache/fop/fo/pagination/Declarations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -20,7 +20,6 @@ package org.apache.fop.fo.pagination;
// Java
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.xml.sax.Locator;
@@ -30,8 +29,6 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.XMLObj;
-
/**
* Declarations formatting object.
@@ -43,7 +40,6 @@ import org.apache.fop.fo.XMLObj;
public class Declarations extends FObj {
private Map colorProfiles = null;
- private List external = null;
/**
* @param parent FONode that is the parent of this object
@@ -62,11 +58,11 @@ public class Declarations extends FObj {
/**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- XSL 1.0: (color-profile)+ (and non-XSL NS nodes)
- FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes)
+ * XSL 1.0: (color-profile)+ (and non-XSL NS nodes)
+ * FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (!localName.equals("color-profile")) {
invalidChildError(loc, nsURI, localName);
@@ -75,8 +71,9 @@ public class Declarations extends FObj {
}
/**
- * At the end of this element sort out the child into
- * a hashmap of color profiles and a list of external xml.
+ * At the end of this element sort out the children into
+ * a hashmap of color profiles and a list of extension attachments.
+ * @see org.apache.fop.fo.FONode#endOfNode()
*/
protected void endOfNode() throws FOPException {
if (childNodes != null) {
@@ -97,13 +94,9 @@ public class Declarations extends FObj {
} else {
getLogger().warn("color-profile-name required for color profile");
}
- } else if (node instanceof XMLObj) {
- if (external == null) {
- external = new java.util.ArrayList();
- }
- external.add(node);
} else {
- getLogger().warn("invalid element " + node.getName() + " inside declarations");
+ getLogger().debug("Ignoring element " + node.getName()
+ + " inside fo:declarations.");
}
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
index ee7bcce1c..47e7a1e53 100644
--- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -106,8 +106,8 @@ public class SimplePageMaster extends FObj {
*/
protected void endOfNode() throws FOPException {
if (!hasRegionBody) {
- missingChildElementError("(region-body, region-before?," +
- " region-after?, region-start?, region-end?)");
+ missingChildElementError(
+ "(region-body, region-before?, region-after?, region-start?, region-end?)");
}
}
@@ -182,8 +182,12 @@ public class SimplePageMaster extends FObj {
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) {
- addRegion((Region)child);
+ protected void addChildNode(FONode child) throws FOPException {
+ if (child instanceof Region) {
+ addRegion((Region)child);
+ } else {
+ super.addChildNode(child);
+ }
}
/**
@@ -229,45 +233,32 @@ public class SimplePageMaster extends FObj {
return false;
}
- /**
- * Return the Common Margin Properties-Block.
- */
+ /** @return the Common Margin Properties-Block. */
public CommonMarginBlock getCommonMarginBlock() {
return commonMarginBlock;
}
- /**
- * Return "master-name" property.
- */
+ /** @return "master-name" property. */
public String getMasterName() {
return masterName;
}
- /**
- * Return the "page-width" property.
- */
+ /** @return the "page-width" property. */
public Length getPageWidth() {
return pageWidth;
}
- /**
- * Return the "page-height" property.
- */
+ /** @return the "page-height" property. */
public Length getPageHeight() {
return pageHeight;
}
-
- /**
- * Return the "writing-mode" property.
- */
+ /** @return the "writing-mode" property. */
public int getWritingMode() {
return writingMode;
}
- /**
- * Return the "reference-orientation" property.
- */
+ /** @return the "reference-orientation" property. */
public int getReferenceOrientation() {
return referenceOrientation.getValue();
}