aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/documentation/content/xdocs/trunk/accessibility.xml2
-rw-r--r--src/java/org/apache/fop/apps/FOUserAgent.java17
-rw-r--r--src/java/org/apache/fop/apps/FopFactory.java12
3 files changed, 21 insertions, 10 deletions
diff --git a/src/documentation/content/xdocs/trunk/accessibility.xml b/src/documentation/content/xdocs/trunk/accessibility.xml
index d9fbbff1f..e7e49d7c0 100644
--- a/src/documentation/content/xdocs/trunk/accessibility.xml
+++ b/src/documentation/content/xdocs/trunk/accessibility.xml
@@ -47,7 +47,7 @@
<code>fop -a -fo mydocument.fo -pdf mydocument.pdf</code>
</li>
<li>
- <strong>Embedding:</strong> <code>userAgent.getRendererOptions().put("accessibility", Boolean.TRUE);</code>
+ <strong>Embedding:</strong> <code>userAgent.setAccessibility(true);</code>
</li>
<li>
<strong>Optional setting in fop.xconf file:</strong>
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java
index 0ed5151e0..11de99e33 100644
--- a/src/java/org/apache/fop/apps/FOUserAgent.java
+++ b/src/java/org/apache/fop/apps/FOUserAgent.java
@@ -156,9 +156,7 @@ public class FOUserAgent {
this.factory = factory;
setBaseURL(factory.getBaseURL());
setTargetResolution(factory.getTargetResolution());
- if (this.getRendererOptions().get(AccessibilityUtil.ACCESSIBILITY) == null) {
- this.rendererOptions.put(AccessibilityUtil.ACCESSIBILITY, Boolean.FALSE);
- }
+ setAccessibility(factory.isAccessibilityEnabled());
}
/** @return the associated FopFactory instance */
@@ -360,7 +358,7 @@ public class FOUserAgent {
getFactory().getFontManager().setFontBaseURL(fontBaseUrl);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
- }
+ }
}
/**
@@ -651,6 +649,17 @@ public class FOUserAgent {
}
/**
+ * Activates accessibility (for output formats that support it).
+ *
+ * @param accessibility <code>true</code> to enable accessibility support
+ */
+ public void setAccessibility(boolean accessibility) {
+ if (accessibility) {
+ getRendererOptions().put(AccessibilityUtil.ACCESSIBILITY, Boolean.TRUE);
+ }
+ }
+
+ /**
* Check if accessibility is enabled.
* @return true if accessibility is enabled
*/
diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java
index 6693f33c4..907895c99 100644
--- a/src/java/org/apache/fop/apps/FopFactory.java
+++ b/src/java/org/apache/fop/apps/FopFactory.java
@@ -41,7 +41,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.image.loader.ImageContext;
import org.apache.xmlgraphics.image.loader.ImageManager;
-import org.apache.fop.accessibility.AccessibilityUtil;
import org.apache.fop.fo.ElementMapping;
import org.apache.fop.fo.ElementMappingRegistry;
import org.apache.fop.fonts.FontCache;
@@ -187,19 +186,22 @@ public class FopFactory implements ImageContext {
*/
public FOUserAgent newFOUserAgent() {
FOUserAgent userAgent = new FOUserAgent(this);
- userAgent.getRendererOptions().put(AccessibilityUtil.ACCESSIBILITY,
- Boolean.valueOf(this.accessibility));
return userAgent;
}
/**
- * Used for accessibility to pass value to newFOUserAgent
- * @param value set through xconf file
+ * Sets accessibility support.
+ *
+ * @param value <code>true</code> to enable accessibility, <code>false</code> otherwise
*/
void setAccessibility(boolean value) {
this.accessibility = value;
}
+ boolean isAccessibilityEnabled() {
+ return accessibility;
+ }
+
/**
* Returns a new {@link Fop} instance. FOP will be configured with a default user agent
* instance.