aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2009-10-22 15:30:13 +0000
committerVincent Hennebert <vhennebert@apache.org>2009-10-22 15:30:13 +0000
commit444ea54c14025e69be8a7e098a5b5de698d3fafc (patch)
treef7d470b6b4f11e2bc584c4810123f20011675c92 /src/java/org/apache/fop/area
parent7859b3ed2d10c712c35644164d7703192e3985d8 (diff)
downloadxmlgraphics-fop-444ea54c14025e69be8a7e098a5b5de698d3fafc.tar.gz
xmlgraphics-fop-444ea54c14025e69be8a7e098a5b5de698d3fafc.zip
Issue an error when attempting to render an intermediate XML file in accessibility mode, but that file wasn't generated with accessibility (i.e., does not contain the structure tree)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@828747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r--src/java/org/apache/fop/area/AreaTreeParser.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java
index 784ca0684..ffffda7f4 100644
--- a/src/java/org/apache/fop/area/AreaTreeParser.java
+++ b/src/java/org/apache/fop/area/AreaTreeParser.java
@@ -57,6 +57,7 @@ import org.apache.xmlgraphics.image.loader.ImageManager;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
import org.apache.xmlgraphics.util.QName;
+import org.apache.fop.accessibility.AccessibilityEventProducer;
import org.apache.fop.accessibility.StructureTreeBuilder;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.Trait.Background;
@@ -164,19 +165,19 @@ public class AreaTreeParser {
private ContentHandler structureTreeBuilderWrapper;
- private final class StructureTreeBuilderWrapper extends DelegatingContentHandler {
+ private Attributes pageSequenceAttributes;
- private Attributes pageSequenceAttributes;
+ private final class StructureTreeBuilderWrapper extends DelegatingContentHandler {
- private StructureTreeBuilderWrapper(Attributes pageSequenceAttributes)
+ private StructureTreeBuilderWrapper()
throws SAXException {
super(structureTreeBuilder.getHandlerForNextPageSequence());
- this.pageSequenceAttributes = new AttributesImpl(pageSequenceAttributes);
}
public void endDocument() throws SAXException {
super.endDocument();
startAreaTreeElement("pageSequence", pageSequenceAttributes);
+ pageSequenceAttributes = null;
}
}
@@ -297,7 +298,8 @@ public class AreaTreeParser {
boolean handled = true;
if ("".equals(uri)) {
if (localName.equals("pageSequence") && userAgent.isAccessibilityEnabled()) {
- structureTreeBuilderWrapper = new StructureTreeBuilderWrapper(attributes);
+ structureTreeBuilderWrapper = new StructureTreeBuilderWrapper();
+ pageSequenceAttributes = new AttributesImpl(attributes);
} else if (localName.equals("structureTree")) {
if (userAgent.isAccessibilityEnabled()) {
delegate = structureTreeBuilderWrapper;
@@ -309,6 +311,18 @@ public class AreaTreeParser {
delegate.startDocument();
delegate.startElement(uri, localName, qName, attributes);
} else {
+ if (pageSequenceAttributes != null) {
+ /*
+ * This means that no structure-element tag was
+ * found in the XML, otherwise a
+ * StructureTreeBuilderWrapper object would have
+ * been created, which would have reset the
+ * pageSequenceAttributes field.
+ */
+ AccessibilityEventProducer.Provider
+ .get(userAgent.getEventBroadcaster())
+ .noStructureTreeInXML(this);
+ }
handled = startAreaTreeElement(localName, attributes);
}
} else {