aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2010-10-07 07:41:48 +0000
committerJeremias Maerki <jeremias@apache.org>2010-10-07 07:41:48 +0000
commiteff5b9fd40215ce4f4560feaecf37320a878e917 (patch)
tree1b956b5dea55e2bd5739abe9547bff580aeb5957 /src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
parent8ca38ab9b6f78481b23d3740dc68c684c78aa539 (diff)
downloadxmlgraphics-fop-eff5b9fd40215ce4f4560feaecf37320a878e917.tar.gz
xmlgraphics-fop-eff5b9fd40215ce4f4560feaecf37320a878e917.zip
Bugzilla #49379:
Added ability to embed an external AFP page segment resource file (AFP output only). Submitted by: Peter Hancock <peter.hancock.at.gmail.com> Changes to patch: - Replaced AFP parsing code with a more universal MO:DCA parser (as discussed). - AFPDocumentHandler: addressed a TODO (clearing of the page segment map was not necessary for each page) - AFPDocumentHandler: merged pageSegmentMap and pageSegmentUriMap by creating a combined object: PageSegmentDescriptor git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1005350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/afp/AFPDocumentHandler.java')
-rw-r--r--src/java/org/apache/fop/render/afp/AFPDocumentHandler.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
index 21d4faf56..c37e0c37c 100644
--- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
+++ b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
@@ -47,6 +47,7 @@ import org.apache.fop.render.afp.extensions.AFPElementMapping;
import org.apache.fop.render.afp.extensions.AFPIncludeFormMap;
import org.apache.fop.render.afp.extensions.AFPInvokeMediumMap;
import org.apache.fop.render.afp.extensions.AFPPageOverlay;
+import org.apache.fop.render.afp.extensions.AFPPageSegmentElement;
import org.apache.fop.render.afp.extensions.AFPPageSetup;
import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandler;
@@ -76,8 +77,8 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
private DataStream dataStream;
/** the map of page segments */
- private Map/*<String,String>*/pageSegmentMap
- = new java.util.HashMap/*<String,String>*/();
+ private Map/*<String,PageSegmentDescriptor>*/pageSegmentMap
+ = new java.util.HashMap/*<String,PageSegmentDescriptor>*/();
/** Medium Map referenced on previous page **/
private String lastMediumMap;
@@ -213,7 +214,6 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
throws IFException {
this.location = LOC_ELSEWHERE;
paintingState.clear();
- pageSegmentMap.clear();
AffineTransform baseTransform = getBaseTransform();
paintingState.concatenate(baseTransform);
@@ -288,9 +288,12 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
null);
}
if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
- String name = aps.getName();
- String source = aps.getValue();
- pageSegmentMap.put(source, name);
+ AFPPageSegmentElement.AFPPageSegmentSetup apse
+ = (AFPPageSegmentElement.AFPPageSegmentSetup)aps;
+ String name = apse.getName();
+ String source = apse.getValue();
+ String uri = apse.getResourceSrc();
+ pageSegmentMap.put(source, new PageSegmentDescriptor(name, uri));
} else if (AFPElementMapping.NO_OPERATION.equals(element)) {
String content = aps.getContent();
if (content != null) {
@@ -392,13 +395,13 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
}
/**
- * Returns the page segment name for a given URI if it actually represents a page segment.
+ * Returns the page segment descriptor for a given URI if it actually represents a page segment.
* Otherwise, it just returns null.
* @param uri the URI that identifies the page segment
- * @return the page segment name or null if there's no page segment for the given URI
+ * @return the page segment descriptor or null if there's no page segment for the given URI
*/
- String getPageSegmentNameFor(String uri) {
- return (String)pageSegmentMap.get(uri);
+ PageSegmentDescriptor getPageSegmentNameFor(String uri) {
+ return (PageSegmentDescriptor)pageSegmentMap.get(uri);
}
}