diff options
author | Peter Hancock <phancock@apache.org> | 2012-01-27 15:36:05 +0000 |
---|---|---|
committer | Peter Hancock <phancock@apache.org> | 2012-01-27 15:36:05 +0000 |
commit | 160d78ce1c348b96e9807f59f3d20bb2226e75c0 (patch) | |
tree | 2649855fe306b6206f7cd9d7b3cf81035b79cee3 /src/java/org/apache/fop/render/intermediate/extensions | |
parent | c6fb066a02573904f7ca404605f14c800adf80c5 (diff) | |
download | xmlgraphics-fop-160d78ce1c348b96e9807f59f3d20bb2226e75c0.tar.gz xmlgraphics-fop-160d78ce1c348b96e9807f59f3d20bb2226e75c0.zip |
Associate structure tree elements directly to render content
* Defer the binding of PCData to struct elems using a placeholder mechanism.
* Translate text nodes to marked-content sequences in IF structure tree.
* Replace ptr with structure tree element.
* Re-order table footers so they appear at the end of the structure tree.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ImproveAccessibility@1236718 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/intermediate/extensions')
-rw-r--r-- | src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java | 24 |
2 files changed, 25 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java b/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java index 340b2e068..a2595d320 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java +++ b/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java @@ -21,13 +21,15 @@ package org.apache.fop.render.intermediate.extensions; import org.apache.xmlgraphics.util.XMLizable; +import org.apache.fop.accessibility.StructureTreeElement; + /** * Abstract base class for document actions, like "go-to" actions with absolute page coordinates. */ public abstract class AbstractAction implements XMLizable { private String id; - private String structurePointer; + private StructureTreeElement structureTreeElement; /** * Sets an ID to make the action referencable. @@ -47,18 +49,18 @@ public abstract class AbstractAction implements XMLizable { /** * Sets the structure element corresponding to this action. - * @param structurePointer a reference to the structure element + * @param structureTreeElement a reference to the structure element */ - public void setStructurePointer(String structurePointer) { - this.structurePointer = structurePointer; + public void setStructureTreeElement(StructureTreeElement structureTreeElement) { + this.structureTreeElement = structureTreeElement; } /** * Returns the structure element corresponding to this action. * @return the reference to the structure element */ - public String getStructurePointer() { - return structurePointer; + public StructureTreeElement getStructureTreeElement() { + return structureTreeElement; } /** diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java index 1e613d7eb..693497b73 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java +++ b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java @@ -21,6 +21,7 @@ package org.apache.fop.render.intermediate.extensions; import java.awt.Point; import java.awt.Rectangle; +import java.util.Map; import java.util.Stack; import org.xml.sax.Attributes; @@ -30,6 +31,8 @@ import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.fop.accessibility.StructureTreeElement; +import org.apache.fop.fo.extensions.InternalElementMapping; import org.apache.fop.render.intermediate.IFDocumentNavigationHandler; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.util.XMLUtil; @@ -48,14 +51,20 @@ public class DocumentNavigationHandler extends DefaultHandler private IFDocumentNavigationHandler navHandler; - private String structurePointer; + private StructureTreeElement structureTreeElement; + + private Map<String, StructureTreeElement> structureTreeElements; /** * Main constructor. * @param navHandler the navigation handler that will receive the events + * @param structureTreeElements the elements representing the structure of the document */ - public DocumentNavigationHandler(IFDocumentNavigationHandler navHandler) { + public DocumentNavigationHandler(IFDocumentNavigationHandler navHandler, + Map<String, StructureTreeElement> structureTreeElements) { this.navHandler = navHandler; + assert structureTreeElements != null; + this.structureTreeElements = structureTreeElements; } /** {@inheritDoc} */ @@ -98,7 +107,8 @@ public class DocumentNavigationHandler extends DefaultHandler throw new SAXException(localName + " must be the root element!"); } Rectangle targetRect = XMLUtil.getAttributeAsRectangle(attributes, "rect"); - structurePointer = attributes.getValue("ptr"); + structureTreeElement = structureTreeElements.get( + attributes.getValue(InternalElementMapping.URI, InternalElementMapping.STRUCT_REF)); Link link = new Link(null, targetRect); objectStack.push(link); } else if (GOTO_XY.getLocalName().equals(localName)) { @@ -121,8 +131,8 @@ public class DocumentNavigationHandler extends DefaultHandler } action = new GoToXYAction(id, pageIndex, location); } - if (structurePointer != null) { - action.setStructurePointer(structurePointer); + if (structureTreeElement != null) { + action.setStructureTreeElement(structureTreeElement); } objectStack.push(action); } else if (GOTO_URI.getLocalName().equals(localName)) { @@ -134,8 +144,8 @@ public class DocumentNavigationHandler extends DefaultHandler if (id != null) { action.setID(id); } - if (structurePointer != null) { - action.setStructurePointer(structurePointer); + if (structureTreeElement != null) { + action.setStructureTreeElement(structureTreeElement); } objectStack.push(action); } else { |