git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@828039 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -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> |
@@ -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()); | |||
} | |||
} | |||
} | |||
/** | |||
@@ -650,6 +648,17 @@ public class FOUserAgent { | |||
this.conserveMemoryPolicy = conserveMemoryPolicy; | |||
} | |||
/** | |||
* 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 |
@@ -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. |