Index: src/java/META-INF/services/org.apache.fop.fo.ElementMapping
===================================================================
--- src/java/META-INF/services/org.apache.fop.fo.ElementMapping (revision 744229)
+++ src/java/META-INF/services/org.apache.fop.fo.ElementMapping (working copy)
@@ -2,6 +2,7 @@
org.apache.fop.fo.extensions.svg.SVGElementMapping
org.apache.fop.fo.extensions.svg.BatikExtensionElementMapping
org.apache.fop.fo.extensions.ExtensionElementMapping
+org.apache.fop.fo.extensions.InternalElementMapping
org.apache.fop.fo.extensions.OldExtensionElementMapping
org.apache.fop.fo.extensions.xmp.XMPElementMapping
org.apache.fop.fo.extensions.xmp.RDFElementMapping
Index: src/java/org/apache/fop/accessibility/TransformerNode.java
===================================================================
--- src/java/org/apache/fop/accessibility/TransformerNode.java (revision 0)
+++ src/java/org/apache/fop/accessibility/TransformerNode.java (revision 0)
@@ -0,0 +1,338 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.accessibility;
+
+
+ import java.io.File;
+ import javax.xml.transform.Result;
+ import javax.xml.transform.Source;
+ import javax.xml.transform.TransformerConfigurationException;
+ import javax.xml.transform.TransformerFactory;
+ import javax.xml.transform.sax.SAXResult;
+ import javax.xml.transform.sax.SAXTransformerFactory;
+ import javax.xml.transform.sax.TransformerHandler;
+ import javax.xml.transform.stream.StreamSource;
+ import org.apache.fop.apps.FOPException;
+ import org.xml.sax.Attributes;
+ import org.xml.sax.Locator;
+ import org.xml.sax.SAXException;
+ import org.xml.sax.helpers.AttributesImpl;
+ import org.xml.sax.helpers.DefaultHandler;
+
+ /**
+ * Used for accessibility to run required xslt transforms
+ */
+ public class TransformerNode extends DefaultHandler {
+
+ private TransformerHandler mTranHandler;
+
+ /**
+ * happens after setParams have been broadcast.
+ * @param downstreamHandler the handler passed in
+ * @param xsltFile for transform
+ * @throws FOPException for general errors
+ */
+ public TransformerNode(DefaultHandler downstreamHandler, File xsltFile)
+ throws FOPException {
+ try {
+ TransformerFactory transFact = TransformerFactory.newInstance();
+ SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) transFact);
+ // StreamSource ss = new StreamSource(new StringReader(xsltText));
+ StreamSource ss = new StreamSource(xsltFile);
+ mTranHandler = saxTFactory.newTransformerHandler(ss);
+ SAXResult saxResult = new SAXResult();
+ saxResult.setHandler(downstreamHandler);
+ mTranHandler.setResult(saxResult);
+ } catch (TransformerConfigurationException t) {
+ throw new FOPException(t);
+ }
+ }
+
+ /**
+ *
+ * @param result of transform
+ * @param xsltFile for transform
+ * @throws FOPException for general errors
+ */
+ public TransformerNode(Result result, File xsltFile)
+ throws FOPException {
+ try {
+ TransformerFactory transFact = TransformerFactory.newInstance();
+ SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) transFact);
+ StreamSource ss = new StreamSource(xsltFile);
+ mTranHandler = saxTFactory.newTransformerHandler(ss);
+ mTranHandler.setResult(result);
+ } catch (TransformerConfigurationException t) {
+ throw new FOPException(t);
+ }
+ }
+
+ /**
+ * This is part of a two phase construction. Call this, then call initResult.
+ * @param xsltFile for transform
+ * @throws FOPException for general errors
+ */
+ public TransformerNode(Source xsltFile)
+ throws FOPException {
+ try {
+ TransformerFactory transFact = TransformerFactory.newInstance();
+ SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) transFact);
+ mTranHandler = saxTFactory.newTransformerHandler(xsltFile);
+ } catch (TransformerConfigurationException t) {
+ throw new FOPException(t);
+ }
+ }
+
+ /**
+ * Call this after calling constructor for xsltFile only above.
+ * @param result of transform
+ */
+ public void initResult(Result result) {
+ mTranHandler.setResult(result);
+ }
+
+
+
+ /******************** start of ContentHandler ***************************/
+ /**
+ * @param locator - the locator
+ */
+ public void setDocumentLocator(Locator locator) {
+ if (mTranHandler != null) {
+ mTranHandler.setDocumentLocator(locator);
+ }
+ }
+
+ /**
+ * handle startDocument event
+ * @throws SAXException - if parser fails
+ */
+ public void startDocument()
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.startDocument();
+ }
+ }
+
+ /**
+ * handle endDocument event
+ * @throws SAXException - if parser fails
+ */
+ public void endDocument()
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endDocument();
+ }
+ }
+
+ /** Processing instruction.
+ * @param target - of processing instruction
+ * @param data - of processing instruction
+ * @throws SAXException - if parser fails
+ */
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.processingInstruction(target, data);
+ }
+ }
+
+ /**
+ * Start element.
+ * This one is usually overridden for special processing as well as endElement
+ * @param uri - the uri
+ * @param local - the local
+ * @param raw - the raw version
+ * @param attrs - the attributes of the element
+ * @throws SAXException - if parser fails
+ */
+ public void startElement(String uri, String local, String raw,
+ Attributes attrs) throws SAXException {
+ AttributesImpl ai = new AttributesImpl(attrs);
+ if (mTranHandler != null) {
+ mTranHandler.startElement(uri, local, raw, ai);
+ }
+ }
+
+ /**
+ * Characters.
+ * @param ch the characters
+ * @param start - start index
+ * @param length - the length of ch
+ *
+ * @throws SAXException - if parser fails
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.characters(ch, start, length);
+ }
+ }
+
+ /**
+ * Ignorable whitespace.
+ * @param ch the characters
+ * @param start - start index
+ * @param length - the length of ch
+ * @throws SAXException - if parser fails
+ */
+ public void ignorableWhitespace(char[] ch, int start, int length)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.ignorableWhitespace(ch, start, length);
+ }
+ }
+
+ /**
+ * End element.
+ * @param uri - the uri
+ * @param local - the local
+ * @param raw - the raw version
+ * @throws SAXException - if parser fails
+ */
+
+ public void endElement(String uri, String local, String raw)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endElement(uri, local, raw);
+ }
+ }
+
+ /**
+ * @param string - to be skipped
+ * @throws SAXException - if parser fails
+ */
+ public void skippedEntity(String string)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.skippedEntity(string);
+ }
+ }
+
+ /**
+ * @param string - param1
+ * @param string1 - param2
+ * @throws SAXException - if parser fails
+ */
+ public void startPrefixMapping(String string, String string1)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.startPrefixMapping(string, string1);
+ }
+ }
+
+ /**
+ * @param string - param1
+ * @throws SAXException - if parser fails
+ */
+ public void endPrefixMapping(String string)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endPrefixMapping(string);
+ }
+ }
+
+ /***************************** LexicalHandlerImpl**************************/
+ /**
+ * @param name - param1
+ * @param pid - param2
+ * @param lid - param3
+ * @throws SAXException - if parser fails
+ */
+ public void startDTD(String name, String pid, String lid)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.startDTD(name, pid, lid);
+ }
+ }
+
+ /**
+ * End of DTD
+ * @throws SAXException - if parser fails
+ */
+ public void endDTD()
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endDTD();
+ }
+ }
+
+ /**
+ * startEnitity.
+ * @param string - param 1
+ * @throws SAXException - if parser fails
+ */
+ public void startEntity(String string)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.startEntity(string);
+ }
+ }
+
+ /**
+ * end Entity
+ * @param string - param 1
+ * @throws SAXException - if paser fails
+ */
+ public void endEntity(String string)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endEntity(string);
+ }
+ }
+
+ /**
+ * Start of CDATA section
+ * @throws SAXException - parser fails
+ */
+ public void startCDATA()
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.startCDATA();
+ }
+ }
+
+ /**
+ * endCDATA section
+ * @throws SAXException - if paser fails
+ */
+ public void endCDATA()
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.endCDATA();
+ }
+ }
+
+ /**
+ *
+ * @param charArray - the characters
+ * @param int1 - param 2
+ * @param int2 - param 3
+ * @throws SAXException - if paser fails
+ */
+ public void comment(char[] charArray, int int1, int int2)
+ throws SAXException {
+ if (mTranHandler != null) {
+ mTranHandler.comment(charArray, int1, int2);
+ }
+ }
+
+ /******************** End of Lexical Handler ***********************/
+ }
Index: src/java/org/apache/fop/accessibility/TransformerNodeEndProcessing.java
===================================================================
--- src/java/org/apache/fop/accessibility/TransformerNodeEndProcessing.java (revision 0)
+++ src/java/org/apache/fop/accessibility/TransformerNodeEndProcessing.java (revision 0)
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.accessibility;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * An extension of TransformerNode used to run 2nd transform after completion of first
+ *
+ */
+public class TransformerNodeEndProcessing extends TransformerNode {
+ private final ByteArrayOutputStream mBaosBuf = new ByteArrayOutputStream();
+ private DefaultHandler mFopHandler = null;
+ private final FOUserAgent userAgent;
+
+
+
+
+
+ /**
+ * Do a transform, but perform special processing at the end for the access
+ * stuff.
+ *
+ * @param xsltFile
+ * . Transform to do.
+ * @param fopHandler
+ * . Used in the end processing
+ * @param userAgent
+ * . the userAgent
+ * @throws FOPException
+ * if transform fails
+ */
+
+ public TransformerNodeEndProcessing(Source xsltFile, DefaultHandler fopHandler,
+ FOUserAgent userAgent) throws FOPException {
+ super(xsltFile);
+ mFopHandler = fopHandler;
+ this.userAgent = userAgent;
+ Result res1 = new StreamResult(mBaosBuf);
+ super.initResult(res1);
+ }
+
+ /**
+ * @throws SAXException
+ * if the parser fails
+ */
+ public void endDocument() throws SAXException {
+ super.endDocument();
+ // do the second tranform to struct
+ Source xsltFile = new
+ StreamSource(getClass().getResource("reduceFOTree.xsl").toExternalForm());
+ TransformerFactory factory = TransformerFactory.newInstance();
+ try {
+ Transformer transformer = factory.newTransformer(xsltFile);
+ Source src = new StreamSource(new ByteArrayInputStream(mBaosBuf
+ .toByteArray()));
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ Result res = new StreamResult(out);
+ userAgent.putResult(out);
+ transformer.transform(src, res);
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ saxParserFactory.setValidating(false);
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+ InputStream in = new ByteArrayInputStream(mBaosBuf.toByteArray());
+ saxParser.parse(in, mFopHandler);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ throw new SAXException(e);
+ }
+
+ }
+
+}
Index: src/java/org/apache/fop/accessibility/addPtr.xsl
===================================================================
--- src/java/org/apache/fop/accessibility/addPtr.xsl (revision 0)
+++ src/java/org/apache/fop/accessibility/addPtr.xsl (revision 0)
@@ -0,0 +1,13 @@
+
+
- * JAXP is the standard method of embedding FOP in Java programs. - * Please check our - * embedding page - * for samples (these are also available within the distribution in + * JAXP is the standard method of embedding FOP in Java programs. Please check + * our embedding + * page for samples (these are also available within the distribution in * FOP_DIR\examples\embedding) *
* Methods within FOUserAgent are available to customize portions of the - * process. For example, a specific Renderer object can be specified, - * also ElementMappings which determine elements in the FO that can be - * processed) can be added. + * process. For example, a specific Renderer object can be specified, also + * ElementMappings which determine elements in the FO that can be processed) can + * be added. *
- * At the moment, it is recommended not to reuse an instance of this - * class for more than one rendering run. + * At the moment, it is recommended not to reuse an instance of this class for + * more than one rendering run. */ public class Fop { - // desired output format: MIME type such as "application/pdf", "application/postscript" etc. + // desired output format: MIME type such as "application/pdf", + // "application/postscript" etc. private String outputFormat = null; // output stream to send results to @@ -57,15 +59,24 @@ // FOTreeBuilder object to maintain reference for access to results private FOTreeBuilder foTreeBuilder = null; + + /** - * Constructor for use with already-created FOUserAgents. It uses MIME types to select the - * output format (ex. "application/pdf" for PDF). - * @param outputFormat the MIME type of the output format to use (ex. "application/pdf"). - * @param ua FOUserAgent object - * @param stream the output stream - * @throws FOPException if setting up the DefaultHandler fails + * Constructor for use with already-created FOUserAgents. It uses MIME types + * to select the output format (ex. "application/pdf" for PDF). + * + * @param outputFormat + * the MIME type of the output format to use (ex. + * "application/pdf"). + * @param ua + * FOUserAgent object + * @param stream + * the output stream + * @throws FOPException + * if setting up the DefaultHandler fails */ - Fop(String outputFormat, FOUserAgent ua, OutputStream stream) throws FOPException { + Fop(String outputFormat, FOUserAgent ua, OutputStream stream) + throws FOPException { this.outputFormat = outputFormat; foUserAgent = ua; @@ -79,7 +90,9 @@ } /** - * Get the FOUserAgent instance associated with the rendering run represented by this instance. + * Get the FOUserAgent instance associated with the rendering run + * represented by this instance. + * * @return the user agent */ public FOUserAgent getUserAgent() { @@ -87,40 +100,60 @@ } /** - * Creates a DefaultHandler object used to generate the document. - * Note this object implements the ContentHandler interface. - * For processing with a Transformer object, this DefaultHandler object - * can be used in the SAXResult constructor. - * Alternatively, for processing with a SAXParser, this object can be - * used as the DefaultHandler argument to its parse() methods. + * Creates a DefaultHandler object used to generate the document. Note this + * object implements the ContentHandler interface. For processing with a + * Transformer object, this DefaultHandler object can be used in the + * SAXResult constructor. Alternatively, for processing with a SAXParser, + * this object can be used as the DefaultHandler argument to its parse() + * methods. * - * @throws FOPException if setting up the DefaultHandler fails + * @throws FOPException + * if setting up the DefaultHandler fails */ private void createDefaultHandler() throws FOPException { - this.foTreeBuilder = new FOTreeBuilder(outputFormat, foUserAgent, stream); + this.foTreeBuilder = new FOTreeBuilder(outputFormat, foUserAgent, + stream); } + + + /** - * Returns the DefaultHandler object that will receive the SAX stream containing the - * FO document to be rendered. + * Returns the DefaultHandler object that will receive the SAX stream + * containing the FO document to be rendered. + * * @return the SAX DefaultHandler for handling the SAX events. - * @throws FOPException if setting up the DefaultHandler fails + * @throws FOPException + * if setting up the DefaultHandler fails */ - public DefaultHandler getDefaultHandler() throws FOPException { + public DefaultHandler getDefaultHandler() throws + FOPException { + DefaultHandler fopHandler = null; + if (foTreeBuilder == null) { createDefaultHandler(); } - return this.foTreeBuilder; + fopHandler = this.foTreeBuilder; + if (this.foUserAgent.accessibilityEnabled()) { + Source xsltFile = new StreamSource(getClass().getResource( + "/org/apache/fop/accessibility/addPtr.xsl").toExternalForm()); + DefaultHandler transformNode = new TransformerNodeEndProcessing( + xsltFile, fopHandler, foUserAgent); + return transformNode; + } else { + return fopHandler; + } } /** - * Returns the results of the rendering process. Information includes - * the total number of pages generated and the number of pages per + * Returns the results of the rendering process. Information includes the + * total number of pages generated and the number of pages per * page-sequence. Call this method only after the rendering process is * finished. Note that the results are only available for output formats * which make use of FOP's layout engine (PDF, PS, etc.). + * * @return the results of the rendering process, or null for flow-oriented - * output formats like RTF and MIF. + * output formats like RTF and MIF. */ public FormattingResults getResults() { if (foTreeBuilder == null) { Index: src/java/org/apache/fop/apps/FopFactory.java =================================================================== --- src/java/org/apache/fop/apps/FopFactory.java (revision 744229) +++ src/java/org/apache/fop/apps/FopFactory.java (working copy) @@ -99,6 +99,11 @@ * external-graphics. */ private String base = null; + + /** + * Controls if accessibility is turned on or off + */ + private boolean accessibility = false; /** The base URL for all hyphen URL resolutions. */ private String hyphenBase = null; @@ -181,10 +186,19 @@ */ public FOUserAgent newFOUserAgent() { FOUserAgent userAgent = new FOUserAgent(this); + userAgent.getRendererOptions().put("accessibility", Boolean.valueOf(this.accessibility)); return userAgent; } /** + * Used for accessibility to pass value to newFOUserAgent + * @param value set through xconf file + */ + void setAccessibility(boolean value) { + this.accessibility = value; + } + + /** * Returns a new {@link Fop} instance. FOP will be configured with a default user agent * instance. *
Index: src/java/org/apache/fop/apps/FopFactoryConfigurator.java
===================================================================
--- src/java/org/apache/fop/apps/FopFactoryConfigurator.java (revision 744229)
+++ src/java/org/apache/fop/apps/FopFactoryConfigurator.java (working copy)
@@ -90,6 +90,21 @@
log.debug("Initializing FopFactory Configuration");
}
+ if (cfg.getChild("accessibility", false) != null) {
+ try {
+ String s = cfg.getChild("accessibility").getValue();
+ if ("true".equals(s)) {
+ this.factory.setAccessibility(true);
+ } else if ("false".equals(s)) {
+ this.factory.setAccessibility(false);
+ } else {
+ throw new FOPException("Invalid value for accessibility");
+ }
+ } catch (ConfigurationException e) {
+ throw new FOPException(e);
+ }
+ }
+
// strict configuration
if (cfg.getChild("strict-configuration", false) != null) {
try {
Index: src/java/org/apache/fop/area/AreaTreeParser.java
===================================================================
--- src/java/org/apache/fop/area/AreaTreeParser.java (revision 744229)
+++ src/java/org/apache/fop/area/AreaTreeParser.java (working copy)
@@ -127,11 +127,11 @@
private static class Handler extends DefaultHandler {
- private Map makers = new java.util.HashMap();
+ private final Map makers = new java.util.HashMap();
- private AreaTreeModel treeModel;
- private FOUserAgent userAgent;
- private ElementMappingRegistry elementMappingRegistry;
+ private final AreaTreeModel treeModel;
+ private final FOUserAgent userAgent;
+ private final ElementMappingRegistry elementMappingRegistry;
private Attributes lastAttributes;
@@ -139,14 +139,14 @@
private boolean ignoreCharacters = true;
private PageViewport currentPageViewport;
- private Map pageViewportsByKey = new java.util.HashMap();
+ private final Map pageViewportsByKey = new java.util.HashMap();
// set of "ID firsts" that have already been assigned to a PV:
- private Set idFirstsAssigned = new java.util.HashSet();
+ private final Set idFirstsAssigned = new java.util.HashSet();
- private Stack areaStack = new Stack();
+ private final Stack areaStack = new Stack();
private boolean firstFlow;
- private Stack delegateStack = new Stack();
+ private final Stack delegateStack = new Stack();
private ContentHandler delegate;
private DOMImplementation domImplementation;
@@ -839,7 +839,8 @@
public void startElement(Attributes attributes) {
String url = attributes.getValue("url");
- Image image = new Image(url);
+ //String ptr = attributes.getValue("ptr");
+ Image image = new Image(url/*, ptr*/);
transferForeignObjects(attributes, image);
setAreaAttributes(attributes, image);
setTraits(attributes, image, SUBSET_COMMON);
Index: src/java/org/apache/fop/area/Trait.java
===================================================================
--- src/java/org/apache/fop/area/Trait.java (revision 744229)
+++ src/java/org/apache/fop/area/Trait.java (working copy)
@@ -194,12 +194,16 @@
public static final Integer OVERLINE_COLOR = new Integer(35);
/** Trait for color of linethrough decorations when rendering inline parent. */
public static final Integer LINETHROUGH_COLOR = new Integer(36);
+
+ /** The ptr trait. Used for accessibility */
+ public static final Integer PTR = new Integer(37);
/** Maximum value used by trait keys */
- public static final int MAX_TRAIT_KEY = 36;
+ public static final int MAX_TRAIT_KEY = 37;
private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
+
private static class TraitInfo {
private String name;
private Class clazz; // Class of trait data
@@ -225,6 +229,7 @@
static {
// Create a hashmap mapping trait code to name for external representation
//put(ID_LINK, new TraitInfo("id-link", String.class));
+ put(PTR, new TraitInfo("ptr", String.class));
put(INTERNAL_LINK, new TraitInfo("internal-link", InternalLink.class));
put(EXTERNAL_LINK, new TraitInfo("external-link", ExternalLink.class));
put(FONT, new TraitInfo("font", FontTriplet.class));
@@ -277,7 +282,6 @@
new TraitInfo("is-reference-area", Boolean.class));
put(IS_VIEWPORT_AREA,
new TraitInfo("is-viewport-area", Boolean.class));
-
}
/**
Index: src/java/org/apache/fop/area/inline/Image.java
===================================================================
--- src/java/org/apache/fop/area/inline/Image.java (revision 744229)
+++ src/java/org/apache/fop/area/inline/Image.java (working copy)
@@ -27,15 +27,18 @@
* The url of the image is used as a key to reference the image cache.
*/
public class Image extends Area {
- private String url;
-
+ private final String url;
+ //private String ptr; // used for accessibility
+
/**
* Create a new image with the given url.
*
* @param url the url of the image
+ * @param ptr used for accessibility
*/
- public Image(String url) {
+ public Image(String url/*, String ptr*/) {
this.url = url;
+ // this.ptr = ptr;
}
/**
@@ -47,5 +50,14 @@
public String getURL() {
return this.url;
}
+
+ /**
+ * Used for accessibility
+ * @return ptr of this image
+ */
+ // public String getPtr() {
+ // return ptr;
+ // }
+
}
Index: src/java/org/apache/fop/cli/CommandLineOptions.java
===================================================================
--- src/java/org/apache/fop/cli/CommandLineOptions.java (revision 744229)
+++ src/java/org/apache/fop/cli/CommandLineOptions.java (working copy)
@@ -327,6 +327,8 @@
i = i + parseAreaTreeOption(args, i);
} else if (args[i].equals("-if")) {
i = i + parseIntermediateFormatOption(args, i);
+ } else if (args[i].equals("-a")) {
+ this.renderingOptions.put("accessibility", Boolean.TRUE);
} else if (args[i].equals("-v")) {
printVersion();
return false;
@@ -445,7 +447,8 @@
}
private int parsePDFOutputOption(String[] args, int i, String pdfAMode) throws FOPException {
- setOutputMode(MimeConstants.MIME_PDF);
+// setOutputMode(MimeConstants.MIME_PDF);
+ setOutputMode(MimeConstants.MIME_PDF + ";mode=painter");
if ((i + 1 == args.length)
|| (isOption(args[i + 1]))) {
throw new FOPException("you must specify the PDF output file");
@@ -1129,6 +1132,7 @@
+ " -nocopy PDF file will be encrypted without copy content permission\n"
+ " -noedit PDF file will be encrypted without edit content permission\n"
+ " -noannotations PDF file will be encrypted without edit annotation permission\n"
+ + " -a enables PDF accessibility (default off)\n"
+ " -pdfprofile prof PDF file will be generated with the specified profile\n"
+ " (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n"
+ " [INPUT] \n"
Index: src/java/org/apache/fop/cli/InputHandler.java
===================================================================
--- src/java/org/apache/fop/cli/InputHandler.java (revision 744229)
+++ src/java/org/apache/fop/cli/InputHandler.java (working copy)
@@ -51,9 +51,6 @@
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.render.awt.viewer.Renderable;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
/**
* Class for handling files input from command line
Index: src/java/org/apache/fop/events/EventFormatter.xml
===================================================================
--- src/java/org/apache/fop/events/EventFormatter.xml (revision 744229)
+++ src/java/org/apache/fop/events/EventFormatter.xml (working copy)
@@ -1,4 +1,5 @@
-
XSL Content Model: marker* (%block;)+
Index: src/java/org/apache/fop/fo/flow/Character.java
===================================================================
--- src/java/org/apache/fop/fo/flow/Character.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/Character.java (working copy)
@@ -62,6 +62,7 @@
private CommonTextDecoration textDecoration;
// private ToBeImplementedProperty textShadow;
private Property wordSpacing;
+ private String ptr; // used for accessibility
// Unused but valid items, commented out for performance:
// private CommonAural commonAural;
// private CommonMarginInline commonMarginInline;
@@ -108,8 +109,14 @@
lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
textDecoration = pList.getTextDecorationProps();
wordSpacing = pList.get(PR_WORD_SPACING);
+ ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
}
-
+
+ /** @return the "fox:ptr" property. */
+ public String getPtr() {
+ return ptr;
+ }
+
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
Index: src/java/org/apache/fop/fo/flow/Footnote.java
===================================================================
--- src/java/org/apache/fop/fo/flow/Footnote.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/Footnote.java (working copy)
@@ -53,7 +53,7 @@
public void bind(PropertyList pList) throws FOPException {
// No active properties -> do nothing.
}
-
+
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnote(this);
Index: src/java/org/apache/fop/fo/flow/FootnoteBody.java
===================================================================
--- src/java/org/apache/fop/fo/flow/FootnoteBody.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/FootnoteBody.java (working copy)
@@ -33,10 +33,11 @@
* fo:footnote-body
object.
*/
public class FootnoteBody extends FObj {
- // The value of properties relevant for fo:footnote-body (commented out for perforance).
+ // The value of properties relevant for fo:footnote-body (commented out for performance).
// private CommonAccessibility commonAccessibility;
// End of property values
+
/**
* Base constructor
*
@@ -49,7 +50,9 @@
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
}
+
+
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnoteBody(this);
Index: src/java/org/apache/fop/fo/flow/Inline.java
===================================================================
--- src/java/org/apache/fop/fo/flow/Inline.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/Inline.java (working copy)
@@ -37,6 +37,7 @@
private Length alignmentAdjust;
private int alignmentBaseline;
private Length baselineShift;
+ private String ptr; // used for accessibility
private int dominantBaseline;
// Unused but valid items, commented out for performance:
// private CommonRelativePosition commonRelativePosition;
@@ -66,6 +67,7 @@
alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
+ ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
}
/** {@inheritDoc} */
@@ -149,6 +151,11 @@
return "inline";
}
+ /** @return the "foi:ptr" property. */
+ public String getPtr() {
+ return ptr;
+ }
+
/**
* {@inheritDoc}
* @return {@link org.apache.fop.fo.Constants#FO_INLINE}
Index: src/java/org/apache/fop/fo/flow/ListBlock.java
===================================================================
--- src/java/org/apache/fop/fo/flow/ListBlock.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/ListBlock.java (working copy)
@@ -132,7 +132,7 @@
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}
-
+
/** @return the "break-after" property */
public int getBreakAfter() {
return breakAfter;
Index: src/java/org/apache/fop/fo/flow/ListItem.java
===================================================================
--- src/java/org/apache/fop/fo/flow/ListItem.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/ListItem.java (working copy)
@@ -138,7 +138,7 @@
public CommonMarginBlock getCommonMarginBlock() {
return commonMarginBlock;
}
-
+
/** @return the {@link CommonBorderPaddingBackground} */
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
Index: src/java/org/apache/fop/fo/flow/Marker.java
===================================================================
--- src/java/org/apache/fop/fo/flow/Marker.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/Marker.java (working copy)
@@ -19,7 +19,6 @@
package org.apache.fop.fo.flow;
-import java.util.Collections;
import java.util.Map;
import org.xml.sax.Attributes;
@@ -65,12 +64,11 @@
}
markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString();
-
if (markerClassName == null || markerClassName.equals("")) {
missingPropertyError("marker-class-name");
}
}
-
+
/**
* Retrieve the property list of the given {@link FONode}
* descendant
Index: src/java/org/apache/fop/fo/flow/PageNumber.java
===================================================================
--- src/java/org/apache/fop/fo/flow/PageNumber.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/PageNumber.java (working copy)
@@ -47,6 +47,7 @@
private int alignmentBaseline;
private Length baselineShift;
private int dominantBaseline;
+ private String ptr; // used for accessibility
// private ToBeImplementedProperty letterSpacing;
private SpaceProperty lineHeight;
/** Holds the text decoration values. May be null */
@@ -92,6 +93,7 @@
// letterSpacing = pList.get(PR_LETTER_SPACING);
lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
textDecoration = pList.getTextDecorationProps();
+ ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
// textShadow = pList.get(PR_TEXT_SHADOW);
// implicit properties
@@ -109,6 +111,11 @@
getFOEventHandler().endPageNumber(this);
}
+ /** @return the "foi:ptr" property. */
+ public String getPtr() {
+ return ptr;
+ }
+
/**
* {@inheritDoc}
*
XSL Content Model: empty
Index: src/java/org/apache/fop/fo/flow/Wrapper.java
===================================================================
--- src/java/org/apache/fop/fo/flow/Wrapper.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/Wrapper.java (working copy)
@@ -26,6 +26,7 @@
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObjMixed;
+import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
/**
@@ -51,6 +52,11 @@
super(parent);
}
+ /** {@inheritDoc} */
+ public void bind(PropertyList pList) throws FOPException {
+ super.bind(pList);
+ }
+
/**
* {@inheritDoc}
*
XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
Index: src/java/org/apache/fop/fo/flow/table/TableFObj.java
===================================================================
--- src/java/org/apache/fop/fo/flow/table/TableFObj.java (revision 744229)
+++ src/java/org/apache/fop/fo/flow/table/TableFObj.java (working copy)
@@ -46,6 +46,7 @@
private Numeric borderBeforePrecedence;
private Numeric borderEndPrecedence;
private Numeric borderStartPrecedence;
+ private String ptr;
ConditionalBorder borderBefore;
ConditionalBorder borderAfter;
@@ -71,6 +72,7 @@
borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
+ ptr = pList.get(PR_X_PTR).getString();
if (getNameId() != FO_TABLE //Separate check for fo:table in Table.java
&& getNameId() != FO_TABLE_CELL
&& getCommonBorderPaddingBackground().hasPadding(
@@ -235,6 +237,11 @@
}
}
+ /** @return the "foi:ptr" property. */
+ public String getPtr() {
+ return ptr;
+ }
+
/**
* Prepares the borders of this element if the collapsing-border model is in use.
* Conflict resolution with parent elements is done where applicable.
Index: src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (working copy)
@@ -385,6 +385,7 @@
addMarkersToPage(false, isFirst(firstPos), isLast(lastPos));
+ TraitSetter.addPtr(curBlockArea, getBlockFO().getPtr()); // used for accessibility
TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
effSpaceBefore, effSpaceAfter);
flush();
Index: src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (working copy)
@@ -95,7 +95,7 @@
pageSequenceAreaObject.setLanguage(getPageSequence().getLanguage());
pageSequenceAreaObject.setCountry(getPageSequence().getCountry());
areaTreeModel.startPageSequence(pageSequenceAreaObject);
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.debug("Starting layout");
}
Index: src/java/org/apache/fop/layoutmgr/TraitSetter.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/TraitSetter.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/TraitSetter.java (working copy)
@@ -584,6 +584,17 @@
}
/**
+ * Adds the ptr trait to the area.
+ * @param area the area to set the traits on
+ * @param ptr string
+ */
+ public static void addPtr(Area area, String ptr) {
+ if (ptr != null && ptr.length() > 0) {
+ area.addTrait(Trait.PTR, ptr);
+ }
+ }
+
+ /**
* Sets the producer's ID as a trait on the area. This can be used to track back the
* generating FO node.
* @param area the area to set the traits on
Index: src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (working copy)
@@ -39,6 +39,7 @@
*/
public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManager {
+
/**
* Constructor.
*
@@ -85,6 +86,7 @@
transferForeignAttributes(viewportArea);
Viewport vp = new Viewport(viewportArea);
+ TraitSetter.addPtr(vp, fobj.getPtr()); // used for accessibility
TraitSetter.setProducerID(vp, fobj.getId());
vp.setIPD(imageLayout.getViewportSize().width);
vp.setBPD(imageLayout.getViewportSize().height);
@@ -102,6 +104,9 @@
return vp;
}
+
+
+
/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context,
int alignment) {
Index: src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (working copy)
@@ -138,6 +138,7 @@
text.setBaselineOffset(font.getAscender());
TraitSetter.addFontTraits(text, font);
text.addTrait(Trait.COLOR, fobj.getColor());
+ TraitSetter.addPtr(text, fobj.getPtr()); // used for accessibility
TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
}
Index: src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java (working copy)
@@ -56,6 +56,7 @@
private void setupBasicLinkArea(InlineArea area) {
BasicLink fobj = (BasicLink) this.fobj;
// internal destinations take precedence:
+ area.addTrait(Trait.PTR, fobj.getPtr()); // used for accessibility
if (fobj.hasInternalDestination()) {
String idref = fobj.getInternalDestination();
PageSequenceLayoutManager pslm = getPSLM();
Index: src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (working copy)
@@ -86,6 +86,7 @@
}
TraitSetter.setProducerID(text, node.getId());
TraitSetter.addTextDecoration(text, node.getTextDecoration());
+ TraitSetter.addPtr(text, node.getPtr()); // used for accessibility
return text;
}
Index: src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java (working copy)
@@ -41,8 +41,8 @@
}
/** {@inheritDoc} */
- protected Area getChildArea() {
- return new Image(((ExternalGraphic) fobj).getSrc());
+ protected Area getChildArea() { // used for accessibility
+ return new Image(((ExternalGraphic) fobj).getSrc()/*, ((ExternalGraphic) fobj).getPtr()*/);
}
}
Index: src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (working copy)
@@ -85,9 +85,8 @@
text.setBaselineOffset(font.getAscender());
TraitSetter.addFontTraits(text, font);
text.addTrait(Trait.COLOR, fobj.getColor());
-
+ TraitSetter.addPtr(text, fobj.getPtr()); // used for accessibility
TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
-
return text;
}
Index: src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (revision 744229)
+++ src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (working copy)
@@ -27,8 +27,10 @@
import org.apache.commons.logging.LogFactory;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.area.Block; // ??
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FOText;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontSelector;
import org.apache.fop.layoutmgr.InlineKnuthSequence;
@@ -504,12 +506,27 @@
}
TraitSetter.addFontTraits(textArea, font);
textArea.addTrait(Trait.COLOR, this.foText.getColor());
-
+ textArea.addTrait(Trait.PTR, getPtr()); // used for accessibility
TraitSetter.addTextDecoration(textArea, this.foText.getTextDecoration());
-
return textArea;
}
+ /**
+ * used for accessibility
+ * @return ptr of fobj
+ */
+ private String getPtr() {
+ FObj fobj = this.parentLM.getFObj();
+ if (fobj instanceof org.apache.fop.fo.flow.Block) {
+ return (((org.apache.fop.fo.flow.Block) fobj).getPtr());
+ } else if (fobj instanceof org.apache.fop.fo.flow.Inline) {
+ return (((org.apache.fop.fo.flow.Inline) fobj).getPtr());
+ } else {
+ log.warn("Accessibility: TLM.getPtr-no Ptr found");
+ return "";
+ }
+ }
+
private void addToLetterAdjust(final int index, final int width) {
if (this.letterAdjustArray[index] == null) {
this.letterAdjustArray[index] = new MinOptMax(width);
Index: src/java/org/apache/fop/pdf/PDFArray.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFArray.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFArray.java (working copy)
@@ -107,6 +107,15 @@
}
/**
+ * Used for accessibility
+ * @param obj searched
+ * @return boolean indicating if obj is contained or not
+ */
+ public boolean contains(Object obj) {
+ return this.values.contains(obj);
+ }
+
+ /**
* Returns the length of the array
* @return the length of the array
*/
Index: src/java/org/apache/fop/pdf/PDFDocument.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFDocument.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFDocument.java (working copy)
@@ -75,14 +75,16 @@
/** Integer constant to represent PDF 1.4 */
public static final int PDF_VERSION_1_4 = 4;
+
/** the encoding to use when converting strings to PDF commands */
+
public static final String ENCODING = "ISO-8859-1";
/** the counter for object numbering */
protected int objectcount = 0;
/** the logger instance */
- private Log log = LogFactory.getLog("org.apache.fop.pdf");
+ private final Log log = LogFactory.getLog("org.apache.fop.pdf");
/** the current character position */
private int position = 0;
@@ -91,40 +93,40 @@
private int xref;
/** the character position of each object */
- private List location = new ArrayList();
+ private final List location = new ArrayList();
/** List of objects to write in the trailer */
- private List trailerObjects = new ArrayList();
+ private final List trailerObjects = new ArrayList();
/** the objects themselves */
- private List objects = new LinkedList();
+ private final List objects = new LinkedList();
/** Indicates what PDF version is active */
- private int pdfVersion = PDF_VERSION_1_4;
+ private final int pdfVersion = PDF_VERSION_1_4;
/** Indicates which PDF profiles are active (PDF/A, PDF/X etc.) */
- private PDFProfile pdfProfile = new PDFProfile(this);
+ private final PDFProfile pdfProfile = new PDFProfile(this);
/** the /Root object */
- private PDFRoot root;
+ private final PDFRoot root;
/** The root outline object */
private PDFOutline outlineRoot = null;
/** The /Pages object (mark-fop@inomial.com) */
- private PDFPages pages;
+ private final PDFPages pages;
/** the /Info object */
- private PDFInfo info;
+ private final PDFInfo info;
/** the /Resources object */
- private PDFResources resources;
+ private final PDFResources resources;
/** the document's encryption, if it exists */
private PDFEncryption encryption;
/** the colorspace (0=RGB, 1=CMYK) */
- private PDFDeviceColorSpace colorspace =
+ private final PDFDeviceColorSpace colorspace =
new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
/** the counter for Pattern name numbering (e.g. 'Pattern1') */
@@ -138,43 +140,43 @@
/** the {@link PDFXObject}s map */
/* TODO: Should be modified (works only for image subtype) */
- private Map xObjectsMap = new HashMap();
+ private final Map xObjectsMap = new HashMap();
/** The {@link PDFFont} map */
- private Map fontMap = new HashMap();
+ private final Map fontMap = new HashMap();
/** The {@link PDFFilter} map */
private Map filterMap = new HashMap();
/** List of {@link PDFGState}s. */
- private List gstates = new ArrayList();
+ private final List gstates = new ArrayList();
/** List of {@link PDFFunction}s. */
- private List functions = new ArrayList();
+ private final List functions = new ArrayList();
/** List of {@link PDFShading}s. */
- private List shadings = new ArrayList();
+ private final List shadings = new ArrayList();
/** List of {@link PDFPattern}s. */
- private List patterns = new ArrayList();
+ private final List patterns = new ArrayList();
/** List of {@link PDFLink}s. */
- private List links = new ArrayList();
+ private final List links = new ArrayList();
/** List of {@link PDFDestination}s. */
private List destinations;
/** List of {@link PDFFileSpec}s. */
- private List filespecs = new ArrayList();
+ private final List filespecs = new ArrayList();
/** List of {@link PDFGoToRemote}s. */
- private List gotoremotes = new ArrayList();
+ private final List gotoremotes = new ArrayList();
/** List of {@link PDFGoTo}s. */
- private List gotos = new ArrayList();
+ private final List gotos = new ArrayList();
/** List of {@link PDFLaunch}es. */
- private List launches = new ArrayList();
+ private final List launches = new ArrayList();
/**
* The PDFDests object for the name dictionary.
@@ -182,9 +184,9 @@
*/
private PDFDests dests;
- private PDFFactory factory;
+ private final PDFFactory factory;
- private boolean encodingOnTheFly = true;
+ private final boolean encodingOnTheFly = true;
/**
* Creates an empty PDF document.
@@ -206,15 +208,17 @@
this.pages = getFactory().makePages();
// Create the Root object
- this.root = getFactory().makeRoot(this.pages);
+ this.root = getFactory().makeRoot(pages);
// Create the Resources object
this.resources = getFactory().makeResources();
// Make the /Info record
this.info = getFactory().makeInfo(prod);
+
}
+
/**
* @return the integer representing the active PDF version
* (one of PDFDocument.PDF_VERSION_*)
@@ -470,7 +474,6 @@
*/
public void addTrailerObject(PDFObject obj) {
this.trailerObjects.add(obj);
-
if (obj instanceof PDFGoTo) {
this.gotos.add(obj);
}
@@ -1068,4 +1071,5 @@
return pdfBytes.length;
}
+
}
Index: src/java/org/apache/fop/pdf/PDFFactory.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFFactory.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFFactory.java (working copy)
@@ -65,9 +65,9 @@
*/
public class PDFFactory {
- private PDFDocument document;
+ private final PDFDocument document;
- private Log log = LogFactory.getLog(PDFFactory.class);
+ private final Log log = LogFactory.getLog(PDFFactory.class);
/**
* Creates a new PDFFactory.
@@ -94,6 +94,7 @@
*
* @param pages the pages pdf object that the root points to
* @return the new pdf root object for this document
+ *
*/
public PDFRoot makeRoot(PDFPages pages) {
//Make a /Pages object. This object is written in the trailer.
@@ -177,19 +178,19 @@
* @param pageWidth width of the page in points
* @param pageHeight height of the page in points
* @param pageIndex index of the page (zero-based)
+ * @param currentPageParentKey used for accessibility
*
* @return the created /Page object
*/
public PDFPage makePage(PDFResources resources,
- int pageWidth, int pageHeight, int pageIndex) {
-
+ int pageWidth, int pageHeight, int pageIndex,
+ int currentPageParentKey) {
/*
* create a PDFPage with the next object number, the given
* resources, contents and dimensions
*/
- PDFPage page = new PDFPage(resources,
- pageWidth, pageHeight, pageIndex);
-
+ PDFPage page = new PDFPage(resources, // old numPages
+ pageWidth, pageHeight, pageIndex, currentPageParentKey);
getDocument().assignObjectNumber(page);
getDocument().getPages().addPage(page);
return page;
@@ -203,12 +204,14 @@
* @param resources resources object to use
* @param pageWidth width of the page in points
* @param pageHeight height of the page in points
+ * @param currentPageParentKey used for accessibility
*
* @return the created /Page object
*/
public PDFPage makePage(PDFResources resources,
- int pageWidth, int pageHeight) {
- return makePage(resources, pageWidth, pageHeight, -1);
+ int pageWidth, int pageHeight,
+ int currentPageParentKey) {
+ return makePage(resources, pageWidth, pageHeight, -1, currentPageParentKey);
}
/* ========================= functions ================================= */
@@ -868,6 +871,17 @@
}
/**
+ * Used for accessibility
+ * @return structure Tree Root element
+ */
+ public PDFStructTreeRoot makeStructTreeRoot() {
+ PDFStructTreeRoot structTreeRoot = new PDFStructTreeRoot();
+ getDocument().assignObjectNumber(structTreeRoot);
+ getDocument().addTrailerObject(structTreeRoot);
+ return structTreeRoot;
+ }
+
+ /**
* Make a the head object of the name dictionary (the /Dests object).
*
* @param destinationList a list of PDFDestination instances
Index: src/java/org/apache/fop/pdf/PDFLink.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFLink.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFLink.java (working copy)
@@ -42,6 +42,7 @@
private float bry;
private String color;
private PDFAction action;
+ private String structParent = "";
/**
* create objects associated with a link annotation (GoToR)
@@ -68,7 +69,16 @@
this.action = action;
}
+
/**
+ * Used for accessibility
+ * @param mcid of this structParent
+ */
+ public void setStructParent(int mcid) {
+ this.structParent = "/StructParent " + String.valueOf(mcid) + "\n";
+ }
+
+ /**
* {@inheritDoc}
*/
public String toPDFString() {
@@ -87,6 +97,7 @@
+ (brx) + " " + (bry) + " ]\n" + "/C [ "
+ this.color + " ]\n" + "/Border [ 0 0 0 ]\n" + "/A "
+ this.action.getAction() + "\n" + "/H /I\n"
+ + this.structParent
+ fFlag + "\n>>\nendobj\n";
return s;
}
Index: src/java/org/apache/fop/pdf/PDFPage.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFPage.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFPage.java (working copy)
@@ -42,9 +42,10 @@
* @param pageWidth the page's width in points
* @param pageHeight the page's height in points
* @param pageIndex the page's zero-based index (or -1 if the page number is auto-determined)
+ * @param structParents used for accessibility
*/
public PDFPage(PDFResources resources, PDFStream contents,
- int pageWidth, int pageHeight, int pageIndex) {
+ int pageWidth, int pageHeight, int pageIndex, int structParents) {
/* generic creation of object */
super(resources);
@@ -54,6 +55,10 @@
setContents(contents);
setSimplePageSize(pageWidth, pageHeight);
this.pageIndex = pageIndex;
+ if (structParents > -1) {
+ put("StructParents", structParents);
+ put("Tabs", new PDFName("S"));
+ }
}
/**
@@ -63,10 +68,11 @@
* @param pageWidth the page's width in points
* @param pageHeight the page's height in points
* @param pageIndex the page's zero-based index (or -1 if the page number is auto-determined)
+ * @param structParents used for accessibility
*/
public PDFPage(PDFResources resources,
- int pageWidth, int pageHeight, int pageIndex) {
- this(resources, null, pageWidth, pageHeight, pageIndex);
+ int pageWidth, int pageHeight, int pageIndex, int structParents) {
+ this(resources, null, pageWidth, pageHeight, pageIndex, structParents);
}
private void setSimplePageSize(int width, int height) {
Index: src/java/org/apache/fop/pdf/PDFParentTree.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFParentTree.java (revision 0)
+++ src/java/org/apache/fop/pdf/PDFParentTree.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.pdf;
+
+/**
+ * Class representing a PDF /ParentTree
+ */
+public class PDFParentTree extends PDFNumberTreeNode {
+
+ /**
+ * Create the /ParentTree NumberTreeNode
+ */
+ public PDFParentTree() {
+ super();
+ }
+
+ /**
+ * get the parentTree
+ * @return parentTree as PDFNumsArray
+ */
+ public PDFNumsArray getNums() {
+ PDFNumsArray nums = super.getNums();
+ if (nums == null) {
+ nums = new PDFNumsArray(this);
+ setNums(nums);
+ }
+ return nums;
+ }
+}
+
+
+
+
Index: src/java/org/apache/fop/pdf/PDFRoot.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFRoot.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFRoot.java (working copy)
@@ -19,6 +19,7 @@
package org.apache.fop.pdf;
+
/**
* Class representing a Root (/Catalog) object.
*/
@@ -51,6 +52,8 @@
new PDFName("FullScreen"),
};
+
+
/**
* create a Root (/Catalog) object. NOTE: The PDFRoot
* object must be created before the PDF document is
@@ -63,7 +66,7 @@
*/
public PDFRoot(int objnum, PDFPages pages) {
super();
- setObjectNumber(objnum);
+ setObjectNumber(objnum);
put("Type", new PDFName("Catalog"));
setRootPages(pages);
}
@@ -252,4 +255,25 @@
put("Lang", lang);
}
-}
+ /**
+ * Used for accessibility
+ * @param structTreeRoot of this document
+ */
+
+ public void setStructTreeRoot(PDFStructTreeRoot structTreeRoot) {
+ if (structTreeRoot == null) {
+ throw new NullPointerException("structTreeRoot must not be null");
+ }
+ put("StructTreeRoot", structTreeRoot);
+ }
+
+ /**
+ * Used for accessibility
+ */
+ public void makeTagged() {
+ PDFDictionary dict = new PDFDictionary();
+ dict.put("Marked", Boolean.TRUE);
+ put("MarkInfo", dict); //new PDFMarkInfo()
+ }
+
+}
\ No newline at end of file
Index: src/java/org/apache/fop/pdf/PDFStructElem.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFStructElem.java (revision 0)
+++ src/java/org/apache/fop/pdf/PDFStructElem.java (revision 0)
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.pdf;
+
+
+
+/**
+ *
+ * Class representing a PDF Structure Element
+ *
+ */
+public class PDFStructElem extends PDFDictionary {
+
+ private PDFObject parentObject = null;
+ private String source = "";
+ private boolean level1 = false;
+
+ /**
+ * Create the /StructTreeRoot dictionary
+ * @param fo passed in fo object
+ * @param parent Parent of this PDFStructElem
+ */
+ public PDFStructElem(String fo, PDFObject parent) {
+ super();
+ if (parent instanceof PDFStructElem) {
+ parentObject = (PDFStructElem) parent;
+ }
+ put("Type", new PDFName("StructElem"));
+ source = fo;
+ if ("block".equals(fo)) {
+ put("S", new PDFName("P"));
+ } else if ("inline".equals(fo) || "wrapper".equals(fo) || "character".equals(fo)) {
+ put("S", new PDFName("Span"));
+ } else if ("table-cell".equals(fo)) {
+ PDFStructElem grandParent = (PDFStructElem)
+ ((PDFStructElem)parent).getParentStructElem();
+ String s = grandParent.getSource();
+ if ("table-header".equals(s)) {
+ put("S", new PDFName("TH"));
+ } else {
+ put("S", new PDFName("TD"));
+ }
+ } else if ("table-row".equals(fo)) {
+ put("S", new PDFName("TR"));
+ } else if ("root".equals(fo)) {
+ put("S", new PDFName("Document"));
+ } else if ("page-sequence".equals(fo)) {
+ put("S", new PDFName("Part"));
+ } else if ("flow".equals(fo) || "static-content".equals(fo)) {
+ put("S", new PDFName("Sect"));
+ } else if ("page-number".equals(fo) || "page-number-citation".equals(fo)
+ || "page-number-citation-last".equals(fo)) {
+ put("S", new PDFName("Quote"));
+ } else if ("external-graphic".equals(fo) || "instream-foreign-object".equals(fo)) {
+ put("S", new PDFName("Figure"));
+ } else if ("table".equals(fo)) {
+ put("S", new PDFName("Table"));
+ } else if ("table-body".equals(fo)) {
+ put("S", new PDFName("TBody"));
+ } else if ("table-header".equals(fo)) {
+ put("S", new PDFName("THead"));
+ } else if ("table-footer".equals(fo)) {
+ put("S", new PDFName("TFoot"));
+ } else if ("list-block".equals(fo)) {
+ put("S", new PDFName("L"));
+ } else if ("list-item".equals(fo)) {
+ put("S", new PDFName("LI"));
+ } else if ("list-item-label".equals(fo)) {
+ put("S", new PDFName("Lbl"));
+ } else if ("list-item-body".equals(fo)) {
+ put("S", new PDFName("LBody"));
+ } else if ("block-container".equals(fo)) {
+ put("S", new PDFName("Div"));
+ } else if ("basic-link".equals(fo)) {
+ put("S", new PDFName("Link"));
+ } else if ("footnote".equals(fo)) {
+ put("S", new PDFName("Note"));
+ } else if ("footnote-body".equals(fo)) {
+ put("S", new PDFName("Sect"));
+ } else if ("marker".equals(fo)) {
+ put("S", new PDFName("Private"));
+ } else {
+ log.error("Accessibility: PDFStructElem constructor is missing: " + fo);
+ }
+ setParent(parent);
+ if (!"external-graphic".equals(fo) && !"instream-foreign-object".equals(fo)) {
+ put("K", new PDFArray());
+ }
+ }
+
+ /**
+ * This method is called for PDFStructElements which are direct children of
+ * fo:static-content or fo:flow-section
+ */
+ public void setLevel1() {
+ this.level1 = true;
+ }
+
+ /**
+ *
+ * @return true if the PDFStructElement is a direct child of
+ * fo:static-content or fo:flow-section
+ */
+ public boolean getLevel1() {
+ return this.level1;
+ }
+
+ /**
+ * Get the parent
+ * @return PDFStructElem of parent
+ */
+ public PDFObject getParentStructElem() {
+ return (PDFStructElem)this.parentObject;
+ }
+
+ /**
+ * Set the parent for this StructElem
+ * @param parent to be added
+ */
+ public void setParent(PDFObject parent) {
+ if (parent != null) {
+ put("P", new PDFReference(parent));
+ }
+ }
+
+ /**
+ * Get the source of this StructElem
+ * @return the source
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * The kids of this StructElem
+ * @return the kids
+ */
+ public PDFArray getKids() {
+ return (PDFArray)get("K");
+ }
+
+ /**
+ * Add a kid to this strucElem
+ * @param kid to be added
+ */
+ public void addKid(PDFObject kid) {
+ getKids().add(kid);
+ }
+
+ /**
+ * Add a kid, but only if it does not already exist
+ * @param kid to be added
+ * @return true if kid did not already exist
+ */
+ public boolean addUniqueKid(PDFObject kid) {
+ PDFArray mArray = getKids();
+ if (!mArray.contains(kid)) {
+ getKids().add(kid);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Add kid referenced through mcid integer
+ * used fo:external-graphic
+ * @param mcid of this kid
+ */
+ public void addMCIDKid(int mcid) {
+ put("K", mcid);
+ }
+
+ /**
+ * Add a page reference to this structElem
+ * @param pageObject to be added
+ */
+ public void addPage(Object pageObject) {
+ put("Pg", (PDFObject) pageObject);
+ }
+
+}
Index: src/java/org/apache/fop/pdf/PDFStructTreeRoot.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFStructTreeRoot.java (revision 0)
+++ src/java/org/apache/fop/pdf/PDFStructTreeRoot.java (revision 0)
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.pdf;
+
+/**
+ * Class representing a PDF /StructTreeRoot dictionary.
+ */
+public class PDFStructTreeRoot extends PDFDictionary {
+
+ /**
+ * Create the /StructTreeRoot dictionary
+ */
+ public PDFStructTreeRoot() {
+ super();
+ put("Type", new PDFName("StructTreeRoot"));
+ put("K", new PDFArray());
+ }
+
+ /**
+ * Add parentTree entry
+ * @param parentTree to be added
+ */
+ public void addParentTree(PDFParentTree parentTree) {
+ put("ParentTree", parentTree);
+ }
+
+ /**
+ * Get the kids
+ * @return the kids
+ */
+ public PDFArray getKids() {
+ return (PDFArray)get("K");
+ }
+
+ /**
+ * add a kid
+ * @param kid to be added
+ */
+ public void addKid(PDFObject kid) {
+ getKids().add(kid);
+ }
+}
\ No newline at end of file
Index: src/java/org/apache/fop/pdf/PDFTextUtil.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFTextUtil.java (revision 744229)
+++ src/java/org/apache/fop/pdf/PDFTextUtil.java (working copy)
@@ -128,16 +128,68 @@
}
/**
+ * begin of a regular text object, used for accessibility
+ * @param mcid of text object
+ * @param structElemType of parent
+ */
+ public void beginTextObjectAccess(int mcid, String structElemType) {
+ if (inTextObject) {
+ throw new IllegalStateException("Already in text object");
+ }
+ write(structElemType + " <>\nBDC\nBT\n");
+ this.inTextObject = true;
+ }
+
+
+ /**
+ * begin of a fo:leader text object
+ * used for accessibility
+ */
+ public void beginLeaderTextObject() {
+ if (inTextObject) {
+ throw new IllegalStateException("Already in text object");
+ }
+ write("/Artifact\nBMC\nBT\n");
+ this.inTextObject = true;
+ }
+
+
+
+ /**
* Called when a text object should be ended.
+ * @param accessEnabled indicating if accessibility is turned on or not
*/
- public void endTextObject() {
+ public void endTextObject(boolean accessEnabled) {
checkInTextObject();
- write("ET\n");
+ if (accessEnabled) {
+ write("ET\nEMC\n");
+ } else {
+ write("ET\n");
+ }
this.inTextObject = false;
initValues();
}
/**
+ * used for accessibility, separate 2 text elements
+ * @param mcid of new text element
+ * @param structElemType of parent
+ */
+ public void makeTextSeparator(int mcid, String structElemType) {
+ write("ET\nEMC\n" + structElemType + " <>\nBDC\nBT\n");
+ }
+
+ /**
+ * used for accessibility, separate regular text from fo:leader text
+ */
+ public void separateTextFromLeader() {
+ write("ET\nEMC\n/Artifact\nBMC\nBT\n");
+ }
+
+
+ /**
* Resets the state fields.
*/
protected void initValues() {
@@ -300,4 +352,7 @@
return bufTJ != null && bufTJ.length() > 0;
}
+
+
+
}
Index: src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
===================================================================
--- src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (revision 744229)
+++ src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (working copy)
@@ -834,8 +834,10 @@
* @param url the URI/URL of the image
* @param pos the position of the image
* @param foreignAttributes an optional Map with foreign attributes, may be null
+ * @param ptr used for accessibility
*/
- protected abstract void drawImage(String url, Rectangle2D pos, Map foreignAttributes);
+ protected abstract void drawImage(String url, Rectangle2D pos, Map foreignAttributes,
+ String ptr);
/**
* Draw an image at the indicated location.
@@ -843,7 +845,7 @@
* @param pos the position of the image
*/
protected final void drawImage(String url, Rectangle2D pos) {
- drawImage(url, pos, null);
+ drawImage(url, pos, null, "");
}
/**
Index: src/java/org/apache/fop/render/AbstractRenderer.java
===================================================================
--- src/java/org/apache/fop/render/AbstractRenderer.java (revision 744229)
+++ src/java/org/apache/fop/render/AbstractRenderer.java (working copy)
@@ -737,11 +737,13 @@
currentBPPosition += viewport.getOffset();
Rectangle2D contpos = viewport.getContentPosition();
if (content instanceof Image) {
- renderImage((Image) content, contpos);
+ String ptr = (String) viewport.getTrait(Trait.PTR);
+ renderImage((Image) content, contpos, ptr);
} else if (content instanceof Container) {
renderContainer((Container) content);
} else if (content instanceof ForeignObject) {
- renderForeignObject((ForeignObject) content, contpos);
+ String ptr = (String) viewport.getTrait(Trait.PTR);
+ renderForeignObject((ForeignObject) content, contpos, ptr);
} else if (content instanceof InlineBlockParent) {
renderInlineBlockParent((InlineBlockParent) content);
}
@@ -754,9 +756,10 @@
*
* @param image The image
* @param pos The target position of the image
+ * @param ptr used for accessibility
* (todo) Make renderImage() protected
*/
- public void renderImage(Image image, Rectangle2D pos) {
+ public void renderImage(Image image, Rectangle2D pos, String ptr) {
// Default: do nothing.
// Some renderers (ex. Text) don't support images.
}
@@ -780,9 +783,10 @@
*
* @param fo The foreign object area
* @param pos The target position of the foreign object
+ * @param ptr used for accessibility
* (todo) Make renderForeignObject() protected
*/
- protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
+ protected void renderForeignObject(ForeignObject fo, Rectangle2D pos, String ptr) {
// Default: do nothing.
// Some renderers (ex. Text) don't support foreign objects.
}
Index: src/java/org/apache/fop/render/afp/AFPPainter.java
===================================================================
--- src/java/org/apache/fop/render/afp/AFPPainter.java (revision 744229)
+++ src/java/org/apache/fop/render/afp/AFPPainter.java (working copy)
@@ -183,7 +183,7 @@
}
/** {@inheritDoc} */
- public void drawImage(String uri, Rectangle rect) throws IFException {
+ public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
String name = documentHandler.getPageSegmentNameFor(uri);
if (name != null) {
float[] srcPts = {rect.x, rect.y};
@@ -195,7 +195,7 @@
}
/** {@inheritDoc} */
- public void drawImage(Document doc, Rectangle rect) throws IFException {
+ public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
drawImageUsingDocument(doc, rect);
}
@@ -312,7 +312,7 @@
/** {@inheritDoc} */
public void drawText(int x, int y,
final int letterSpacing, final int wordSpacing, final int[] dx,
- final String text) throws IFException {
+ final String text, final String ptr) throws IFException {
final int fontSize = this.state.getFontSize();
getPaintingState().setFontSize(fontSize);
Index: src/java/org/apache/fop/render/afp/AFPRenderer.java
===================================================================
--- src/java/org/apache/fop/render/afp/AFPRenderer.java (revision 744229)
+++ src/java/org/apache/fop/render/afp/AFPRenderer.java (working copy)
@@ -375,7 +375,7 @@
ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE };
/** {@inheritDoc} */
- public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
+ public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
uri = URISpecification.getURL(uri);
paintingState.setImageUri(uri);
@@ -506,7 +506,7 @@
/** {@inheritDoc} */
public void renderImage(Image image, Rectangle2D pos) {
- drawImage(image.getURL(), pos, image.getForeignAttributes());
+ drawImage(image.getURL(), pos, image.getForeignAttributes(),"");
}
/** {@inheritDoc} */
Index: src/java/org/apache/fop/render/intermediate/IFConstants.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFConstants.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFConstants.java (working copy)
@@ -50,4 +50,6 @@
String EL_BORDER_RECT = "border-rect";
String EL_FONT = "font";
String EL_TEXT = "text";
+ /** used for accessibility */
+ String EL_STRUCTURE_TREE = "structure-tree";
}
Index: src/java/org/apache/fop/render/intermediate/IFDocumentHandler.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFDocumentHandler.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFDocumentHandler.java (working copy)
@@ -20,6 +20,7 @@
package org.apache.fop.render.intermediate;
import java.awt.Dimension;
+import java.io.IOException;
import javax.xml.transform.Result;
@@ -140,6 +141,7 @@
* Indicates the start of a document. This method may only be called once before any other
* event method.
* @throws IFException if an error occurs while handling this event
+ * @throws
*/
void startDocument() throws IFException;
Index: src/java/org/apache/fop/render/intermediate/IFPainter.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFPainter.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFPainter.java (working copy)
@@ -153,10 +153,11 @@
* @param wordSpacing additional spacing between words (may be 0)
* @param dx an array of adjustment values for each character in X-direction (may be null)
* @param text the text
+ * @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
void drawText(int x, int y, int letterSpacing, int wordSpacing,
- int[] dx, String text) throws IFException;
+ int[] dx, String text, String ptr) throws IFException;
/**
* Restricts the current clipping region with the given rectangle.
@@ -205,18 +206,20 @@
* an fo:external-graphic in XSL-FO.
* @param uri the image's URI
* @param rect the rectangle in which the image shall be painted
+ * @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
- void drawImage(String uri, Rectangle rect) throws IFException;
+ void drawImage(String uri, Rectangle rect, String ptr) throws IFException;
/**
* Draws an image (represented by a DOM document) inside a given rectangle. This is the
* equivalent to an fo:instream-foreign-object in XSL-FO.
* @param doc the DOM document containing the foreign object
* @param rect the rectangle in which the image shall be painted
+ * @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
- void drawImage(Document doc, Rectangle rect) throws IFException;
+ void drawImage(Document doc, Rectangle rect, String ptr) throws IFException;
//Note: For now, all foreign objects are handled as DOM documents. At the moment, all known
//implementations use a DOM anyway, so optimizing this to work with SAX wouldn't result in
//any performance benefits. The IFRenderer itself has a DOM anyway. Only the IFParser could
Index: src/java/org/apache/fop/render/intermediate/IFParser.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFParser.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFParser.java (working copy)
@@ -86,7 +86,7 @@
try {
Transformer transformer = tFactory.newTransformer();
transformer.setErrorListener(new DefaultErrorListener(log));
-
+
SAXResult res = new SAXResult(getContentHandler(documentHandler, userAgent));
transformer.transform(src, res);
@@ -481,7 +481,9 @@
s = lastAttributes.getValue("word-spacing");
int wordSpacing = (s != null ? Integer.parseInt(s) : 0);
int[] dx = XMLUtil.getAttributeAsIntArray(lastAttributes, "dx");
- painter.drawText(x, y, letterSpacing, wordSpacing, dx, content.toString());
+ int[] dy = XMLUtil.getAttributeAsIntArray(lastAttributes, "dy");
+ String ptr = lastAttributes.getValue("ptr"); // used for accessibility
+ painter.drawText(x, y, letterSpacing, wordSpacing, dx, content.toString(), ptr);
}
public boolean ignoreCharacters() {
@@ -576,9 +578,10 @@
int height = Integer.parseInt(lastAttributes.getValue("height"));
Map foreignAttributes = getForeignAttributes(lastAttributes);
establishForeignAttributes(foreignAttributes);
+ String ptr = lastAttributes.getValue("ptr"); // used for accessibility
if (foreignObject != null) {
painter.drawImage(foreignObject,
- new Rectangle(x, y, width, height));
+ new Rectangle(x, y, width, height), ptr);
foreignObject = null;
} else {
String uri = lastAttributes.getValue(
@@ -586,7 +589,7 @@
if (uri == null) {
throw new IFException("xlink:href is missing on image", null);
}
- painter.drawImage(uri, new Rectangle(x, y, width, height));
+ painter.drawImage(uri, new Rectangle(x, y, width, height), ptr);
}
resetForeignAttributes();
inForeignObject = false;
Index: src/java/org/apache/fop/render/intermediate/IFRenderer.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFRenderer.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFRenderer.java (working copy)
@@ -121,8 +121,8 @@
private boolean inPageSequence = false;
- private Stack graphicContextStack = new Stack();
- private Stack viewportDimensionStack = new Stack();
+ private final Stack graphicContextStack = new Stack();
+ private final Stack viewportDimensionStack = new Stack();
private IFGraphicContext graphicContext = new IFGraphicContext();
//private Stack groupStack = new Stack();
@@ -133,12 +133,12 @@
* Must be used in conjunction with the page reference to fully specify the details
* of a "go-to" action.
*/
- private Map idPositions = new java.util.HashMap();
+ private final Map idPositions = new java.util.HashMap();
/**
* The "go-to" actions in idGoTos that are not complete yet
*/
- private List unfinishedGoTos = new java.util.ArrayList();
+ private final List unfinishedGoTos = new java.util.ArrayList();
// can't use a Set because PDFGoTo.equals returns true if the target is the same,
// even if the object number differs
@@ -146,11 +146,11 @@
protected Map pageIndices = new java.util.HashMap();
private BookmarkTree bookmarkTree;
- private List deferredDestinations = new java.util.ArrayList();
- private List deferredLinks = new java.util.ArrayList();
- private ActionSet actionSet = new ActionSet();
+ private final List deferredDestinations = new java.util.ArrayList();
+ private final List deferredLinks = new java.util.ArrayList();
+ private final ActionSet actionSet = new ActionSet();
- private TextUtil textUtil = new TextUtil();
+ private final TextUtil textUtil = new TextUtil();
/**
* Main constructor
@@ -818,7 +818,7 @@
currentIPPosition = saveIP;
currentBPPosition = saveBP;
- currentBPPosition += (int)(bv.getAllocBPD());
+ currentBPPosition += (bv.getAllocBPD());
}
viewportDimensionStack.pop();
}
@@ -886,6 +886,7 @@
// stuff we only need if a link must be created:
Rectangle ipRect = null;
AbstractAction action = null;
+ String ptr = (String) ip.getTrait(Trait.PTR); // used for accessibility
// make sure the rect is determined *before* calling super!
int ipp = currentIPPosition;
int bpp = currentBPPosition + ip.getOffset();
@@ -898,6 +899,7 @@
boolean linkTraitFound = false;
+
// try INTERNAL_LINK first
Trait.InternalLink intLink = (Trait.InternalLink) ip.getTrait(Trait.INTERNAL_LINK);
if (intLink != null) {
@@ -929,6 +931,7 @@
// warn if link trait found but not allowed, else create link
if (linkTraitFound) {
+ action.setPtr(ptr); // used for accessibility
Link link = new Link(action, ipRect);
this.deferredLinks.add(link);
}
@@ -963,6 +966,7 @@
String fontName = getInternalFontNameForArea(text);
int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
+ String ptr = (String)text.getTrait(Trait.PTR); // used for accessibility
// This assumes that *all* CIDFonts use a /ToUnicode mapping
Typeface tf = getTypeface(fontName);
@@ -981,7 +985,7 @@
textUtil.setStartPosition(rx, bl);
textUtil.setSpacing(text.getTextLetterSpaceAdjust(), text.getTextWordSpaceAdjust());
super.renderText(text);
-
+ textUtil.setPtr(ptr); // used for accessibility
textUtil.flush();
renderTextDecoration(tf, size, text, bl, rx);
}
@@ -1054,15 +1058,24 @@
private static final int INITIAL_BUFFER_SIZE = 16;
private int[] dx = new int[INITIAL_BUFFER_SIZE];
private int lastDXPos = 0;
- private StringBuffer text = new StringBuffer();
+ private final StringBuffer text = new StringBuffer();
private int startx, starty;
private int tls, tws;
- private boolean combined = false;
+ private final boolean combined = false;
+ private String ptr = null; // used for accessibility
void addChar(char ch) {
text.append(ch);
}
+ /**
+ * used for accessibility
+ * @param inPtr to be stored
+ */
+ public void setPtr(String inPtr) {
+ ptr = inPtr;
+ }
+
void adjust(int adjust) {
if (adjust != 0) {
int idx = text.length();
@@ -1090,6 +1103,7 @@
this.starty = y;
}
+
void setSpacing(int tls, int tws) {
this.tls = tls;
this.tws = tws;
@@ -1105,9 +1119,9 @@
System.arraycopy(dx, 0, effDX, 0, size);
}
if (combined) {
- painter.drawText(startx, starty, 0, 0, effDX, text.toString());
+ painter.drawText(startx, starty, 0, 0, effDX, text.toString(), ptr);
} else {
- painter.drawText(startx, starty, tls, tws, effDX, text.toString());
+ painter.drawText(startx, starty, tls, tws, effDX, text.toString(), ptr);
}
} catch (IFException e) {
handleIFException(e);
@@ -1118,12 +1132,12 @@
}
/** {@inheritDoc} */
- public void renderImage(Image image, Rectangle2D pos) {
- drawImage(image.getURL(), pos, image.getForeignAttributes());
+ public void renderImage(Image image, Rectangle2D pos, String ptr) {
+ drawImage(image.getURL(), pos, image.getForeignAttributes(), ptr);
}
/** {@inheritDoc} */
- protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
+ protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
Rectangle posInt = new Rectangle(
currentIPPosition + (int)pos.getX(),
currentBPPosition + (int)pos.getY(),
@@ -1132,7 +1146,7 @@
uri = URISpecification.getURL(uri);
try {
establishForeignAttributes(foreignAttributes);
- painter.drawImage(uri, posInt);
+ painter.drawImage(uri, posInt, ptr);
resetForeignAttributes();
} catch (IFException ife) {
handleIFException(ife);
@@ -1140,7 +1154,7 @@
}
/** {@inheritDoc} */
- public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
+ public void renderForeignObject(ForeignObject fo, Rectangle2D pos, String ptr) {
endTextObject();
Rectangle posInt = new Rectangle(
currentIPPosition + (int)pos.getX(),
@@ -1150,7 +1164,7 @@
Document doc = fo.getDocument();
try {
establishForeignAttributes(fo.getForeignAttributes());
- painter.drawImage(doc, posInt);
+ painter.drawImage(doc, posInt, ptr);
resetForeignAttributes();
} catch (IFException ife) {
handleIFException(ife);
Index: src/java/org/apache/fop/render/intermediate/IFSerializer.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/IFSerializer.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/IFSerializer.java (working copy)
@@ -25,11 +25,30 @@
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -53,6 +72,8 @@
import org.apache.fop.util.XMLConstants;
import org.apache.fop.util.XMLUtil;
+
+
/**
* IFPainter implementation that serializes the intermediate format to XML.
*/
@@ -60,10 +81,46 @@
implements IFConstants, IFPainter, IFDocumentNavigationHandler {
private IFDocumentHandler mimicHandler;
+ private int pageSequenceCounter; // used for accessibility
+ private DocumentBuilder parser = null; // used for accessibility
+ private Document doc = null; // used for accessibility
/** Holds the intermediate format state */
private IFState state;
+ private class NamespaceContextImpl implements NamespaceContext {
+
+ public String uri;
+ public String prefix;
+
+ public NamespaceContextImpl() {
+ }
+
+ public NamespaceContextImpl(String prefix, String uri) {
+ this.uri = uri;
+ this.prefix = prefix;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return uri;
+ }
+ public void setNamespaceURI(String uri) {
+ this.uri = uri;
+ }
+
+ public String getPrefix(String uri) {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+ public Iterator getPrefixes(String uri) {
+ return null;
+ }
+
+ }
+
/**
* Default constructor.
*/
@@ -150,9 +207,18 @@
handler.startPrefixMapping(DocumentNavigationExtensionConstants.PREFIX,
DocumentNavigationExtensionConstants.NAMESPACE);
handler.startElement(EL_DOCUMENT);
+ if (this.getUserAgent().accessibilityEnabled()) {
+ pageSequenceCounter = 0;
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ parser = factory.newDocumentBuilder();
+ }
} catch (SAXException e) {
throw new IFException("SAX error in startDocument()", e);
- }
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
/** {@inheritDoc} */
@@ -202,6 +268,9 @@
}
}
+
+
+
/** {@inheritDoc} */
public void startPageSequence(String id) throws IFException {
try {
@@ -209,9 +278,36 @@
if (id != null) {
atts.addAttribute(XML_NAMESPACE, "id", "xml:id", XMLUtil.CDATA, id);
}
+
handler.startElement(EL_PAGE_SEQUENCE, atts);
+ if (this.getUserAgent().accessibilityEnabled()) {
+ if (doc == null) {
+ doc = parser.parse(
+ new ByteArrayInputStream(this.getUserAgent().getResultAsByteArray()));
+ }
+ handler.startElement(EL_STRUCTURE_TREE); // add structure tree
+ String xpathExpr
+ = "/fo:root/fo:page-sequence[" + Integer.toString(++pageSequenceCounter) + "]/*";
+ XPath xpath = XPathFactory.newInstance().newXPath();
+ NamespaceContext namespaceContext
+ = new NamespaceContextImpl("fo", "http://www.w3.org/1999/XSL/Format");
+ xpath.setNamespaceContext(namespaceContext);
+ NodeList nodes = (NodeList)xpath.evaluate(xpathExpr, doc, XPathConstants.NODESET);
+ for (int i = 0, n = nodes.getLength(); i < n; i++) {
+ Node node = nodes.item(i);
+ new DOM2SAX(handler).writeFragment(node);
+ }
+ handler.endElement(EL_STRUCTURE_TREE);
+ }
} catch (SAXException e) {
throw new IFException("SAX error in startPageSequence()", e);
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new IFException("IO Problem.", e);
}
}
@@ -231,10 +327,9 @@
AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "index", Integer.toString(index));
addAttribute(atts, "name", name);
- addAttribute(atts, "page-master-name", pageMasterName);
+ addAttribute(atts, "page-master-name", name);
addAttribute(atts, "width", Integer.toString(size.width));
addAttribute(atts, "height", Integer.toString(size.height));
- addForeignAttributes(atts);
handler.startElement(EL_PAGE, atts);
} catch (SAXException e) {
throw new IFException("SAX error in startPage()", e);
@@ -284,6 +379,7 @@
public void startPageTrailer() throws IFException {
try {
handler.startElement(EL_PAGE_TRAILER);
+ commitNavigation();
} catch (SAXException e) {
throw new IFException("SAX error in startPageTrailer()", e);
}
@@ -292,7 +388,6 @@
/** {@inheritDoc} */
public void endPageTrailer() throws IFException {
try {
- commitNavigation();
handler.endElement(EL_PAGE_TRAILER);
} catch (SAXException e) {
throw new IFException("SAX error in endPageTrailer()", e);
@@ -381,7 +476,7 @@
}
/** {@inheritDoc} */
- public void drawImage(String uri, Rectangle rect) throws IFException {
+ public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
addAttribute(atts, XLINK_HREF, uri);
@@ -389,33 +484,26 @@
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
- addForeignAttributes(atts);
+ if (ptr != null) {
+ addAttribute(atts, "ptr", ptr); // used for accessibility
+ }
handler.element(EL_IMAGE, atts);
} catch (SAXException e) {
throw new IFException("SAX error in startGroup()", e);
}
}
- private void addForeignAttributes(AttributesImpl atts) {
- Map foreignAttributes = getContext().getForeignAttributes();
- if (!foreignAttributes.isEmpty()) {
- Iterator iter = foreignAttributes.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- addAttribute(atts, (QName)entry.getKey(), entry.getValue().toString());
- }
- }
- }
-
/** {@inheritDoc} */
- public void drawImage(Document doc, Rectangle rect) throws IFException {
+ public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
- addForeignAttributes(atts);
+ if (ptr != null) {
+ addAttribute(atts, "ptr", ptr); // used for accessibility
+ }
handler.startElement(EL_IMAGE, atts);
new DOM2SAX(handler).writeDocument(doc, true);
handler.endElement(EL_IMAGE);
@@ -504,7 +592,7 @@
addAttribute(atts, "x2", Integer.toString(end.x));
addAttribute(atts, "y2", Integer.toString(end.y));
addAttribute(atts, "stroke-width", Integer.toString(width));
- addAttribute(atts, "color", ColorUtil.colorToString(color));
+ addAttribute(atts, "color", Integer.toString(width));
addAttribute(atts, "style", style.getName());
handler.element(EL_LINE, atts);
} catch (SAXException e) {
@@ -514,10 +602,9 @@
/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing,
- int[] dx, String text) throws IFException {
+ int[] dx, String text, String ptr) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
- XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
addAttribute(atts, "x", Integer.toString(x));
addAttribute(atts, "y", Integer.toString(y));
if (letterSpacing != 0) {
@@ -529,6 +616,9 @@
if (dx != null) {
addAttribute(atts, "dx", IFUtil.toString(dx));
}
+ if (ptr != null) {
+ addAttribute(atts, "ptr", ptr); // used for accessibility
+ }
handler.startElement(EL_TEXT, atts);
char[] chars = text.toCharArray();
handler.characters(chars, 0, chars.length);
@@ -707,8 +797,9 @@
public void addResolvedAction(AbstractAction action) throws IFException {
assert action.isComplete();
assert action.hasID();
- AbstractAction noted = (AbstractAction)incompleteActions.remove(action.getID());
+ AbstractAction noted = (AbstractAction)incompleteActions.get(action.getID());
if (noted != null) {
+ incompleteActions.remove(action.getID());
completeActions.add(action);
} else {
//ignore as it was already complete when it was first used.
Index: src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java
===================================================================
--- src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java (revision 744229)
+++ src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java (working copy)
@@ -27,6 +27,7 @@
public abstract class AbstractAction implements XMLizable {
private String id;
+ private String ptr; // used for accessibility
/**
* Sets an ID to make the action referencable.
@@ -43,8 +44,24 @@
public String getID() {
return this.id;
}
-
+
/**
+ * Used for accessibility
+ * @param s representing the ptr
+ */
+ public void setPtr(String s) {
+ this.ptr = s;
+ }
+
+ /**
+ * Used for accessibility
+ * @return the ptr
+ */
+ public String getPtr() {
+ return this.ptr;
+ }
+
+ /**
* Indicates whether the action has an ID and is therefore referencable.
* @return true if the action has an ID
*/
Index: src/java/org/apache/fop/render/java2d/Java2DPainter.java
===================================================================
--- src/java/org/apache/fop/render/java2d/Java2DPainter.java (revision 744229)
+++ src/java/org/apache/fop/render/java2d/Java2DPainter.java (working copy)
@@ -156,7 +156,7 @@
}
/** {@inheritDoc} */
- public void drawImage(String uri, Rectangle rect) throws IFException {
+ public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
drawImageUsingURI(uri, rect);
}
@@ -168,7 +168,7 @@
}
/** {@inheritDoc} */
- public void drawImage(Document doc, Rectangle rect) throws IFException {
+ public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
drawImageUsingDocument(doc, rect);
}
@@ -208,7 +208,7 @@
}
/** {@inheritDoc} */
- public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text)
+ public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text, String ptr)
throws IFException {
g2dState.updateColor(state.getTextColor());
FontTriplet triplet = new FontTriplet(
Index: src/java/org/apache/fop/render/java2d/Java2DRenderer.java
===================================================================
--- src/java/org/apache/fop/render/java2d/Java2DRenderer.java (revision 744229)
+++ src/java/org/apache/fop/render/java2d/Java2DRenderer.java (working copy)
@@ -875,7 +875,7 @@
ImageFlavor.XML_DOM};
/** {@inheritDoc} */
- protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
+ protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
int x = currentIPPosition + (int)Math.round(pos.getX());
int y = currentBPPosition + (int)Math.round(pos.getY());
Index: src/java/org/apache/fop/render/pcl/PCLEventProducer.xml
===================================================================
--- src/java/org/apache/fop/render/pcl/PCLEventProducer.xml (revision 744229)
+++ src/java/org/apache/fop/render/pcl/PCLEventProducer.xml (working copy)
@@ -1,3 +1,4 @@
-