Merged changes from Trunk up to revision 830265


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@830280 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/conf/fop.xconf b/conf/fop.xconf
index 86b72a8..4396360 100644
--- a/conf/fop.xconf
+++ b/conf/fop.xconf
@@ -443,10 +443,6 @@
     </renderer>
     -->
 
-    <renderer mime="text/plain">
-      <pageSize columns="80"/>
-    </renderer>
-
   </renderers>
 
 </fop>
diff --git a/src/documentation/content/xdocs/trunk/output.xml b/src/documentation/content/xdocs/trunk/output.xml
index 0516d05..01af40a 100644
--- a/src/documentation/content/xdocs/trunk/output.xml
+++ b/src/documentation/content/xdocs/trunk/output.xml
@@ -704,8 +704,15 @@
 ]]></source>
       <p>When the native attribute is specified and set to "true", all image resources will be natively injected
       into the datastream using an object container rather than being converted into an IOCA FS45 image.
-      Support for native image formats (e.g. JPEG, GIF) is not always available on printer implementations
+      Support for native image formats (e.g. JPEG, TIFF, GIF) is not always available on printer implementations
       so by default this configuration option is set to "false".</p>
+      <p>
+        Setting <code>cmyk="true"</code> on the <code>images</code> element will enable CMYK
+        colors. This will only have an effect if the color mode is set to "color". Example:
+      </p>
+      <source><![CDATA[
+      <images mode="color" cmyk="true"/>
+]]></source>
       </section>
       <section id="afp-shading-config">
         <title>Shading</title>
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java
index 2e6e204..011e840 100644
--- a/src/java/org/apache/fop/cli/CommandLineOptions.java
+++ b/src/java/org/apache/fop/cli/CommandLineOptions.java
@@ -1028,7 +1028,11 @@
             case IF_INPUT:
                 return new IFInputHandler(iffile);
             case XSLT_INPUT:
-                return new InputHandler(xmlfile, xsltfile, xsltParams, useCatalogResolver);
+                InputHandler handler = new InputHandler(xmlfile, xsltfile, xsltParams);
+                if (useCatalogResolver) {
+                    handler.createCatalogResolver(foUserAgent);
+                }
+                return handler;
             case IMAGE_INPUT:
                 return new ImageInputHandler(imagefile, xsltfile, xsltParams);
             default:
diff --git a/src/java/org/apache/fop/cli/InputHandler.java b/src/java/org/apache/fop/cli/InputHandler.java
index a1ff171..363cd07 100644
--- a/src/java/org/apache/fop/cli/InputHandler.java
+++ b/src/java/org/apache/fop/cli/InputHandler.java
@@ -51,6 +51,7 @@
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
+import org.apache.fop.events.ResourceEventProducer;
 import org.apache.fop.render.awt.viewer.Renderable;
 
 /**
@@ -64,8 +65,8 @@
     protected File sourcefile;
     private File stylesheet;  // for XML/XSLT usage
     private Vector xsltParams; // for XML/XSLT usage
-    private EntityResolver entityResolver;
-    private URIResolver uriResolver;
+    private EntityResolver entityResolver = null;
+    private URIResolver uriResolver = null;
 
     /** the logger */
     protected Log log = LogFactory.getLog(InputHandler.class);
@@ -85,23 +86,6 @@
     }
 
     /**
-     * Constructor for XML->XSLT->FO input
-     *
-     * @param xmlfile XML file
-     * @param xsltfile XSLT file
-     * @param params Vector of command-line parameters (name, value,
-     *      name, value, ...) for XSL stylesheet, null if none
-     * @param useCatalogResolver if true, use a catalog resolver
-     *      for XML parsing and XSLT URI resolution
-     */
-    public InputHandler(File xmlfile, File xsltfile, Vector params, boolean useCatalogResolver) {
-        this(xmlfile, xsltfile, params);
-        if (useCatalogResolver) {
-            createCatalogResolver();
-        }
-    }
-
-    /**
      * Constructor for FO input
      * @param fofile the file to read the FO document.
      */
@@ -213,10 +197,12 @@
      * Tries the Apache Commons Resolver, and if unsuccessful,
      * tries the same built into Java 6.
      */
-    private void createCatalogResolver() {
+    public void createCatalogResolver(FOUserAgent userAgent) {
         String[] classNames = new String[] {
                 "org.apache.xml.resolver.tools.CatalogResolver",
                 "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver"};
+        ResourceEventProducer eventProducer =
+            ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster());
         Class resolverClass = null;
         for (int i = 0; i < classNames.length && resolverClass == null; ++i) {
             try {
@@ -226,7 +212,7 @@
             }
         }
         if (resolverClass == null) {
-            log.error("Could not find catalog resolver in class path");
+            eventProducer.catalogResolverNotFound(this);
             return;
         }
         try {
@@ -234,8 +220,10 @@
             uriResolver = (URIResolver) resolverClass.newInstance();
         } catch (InstantiationException e) {
             log.error("Error creating the catalog resolver: " + e.getMessage());
+            eventProducer.catalogResolverNotCreated(this, e.getMessage());
         } catch (IllegalAccessException e) {
             log.error("Error creating the catalog resolver: " + e.getMessage());
+            eventProducer.catalogResolverNotCreated(this, e.getMessage());
         }
     }
 
diff --git a/src/java/org/apache/fop/events/EventFormatter.xml b/src/java/org/apache/fop/events/EventFormatter.xml
index 7561f15..341dd13 100644
--- a/src/java/org/apache/fop/events/EventFormatter.xml
+++ b/src/java/org/apache/fop/events/EventFormatter.xml
@@ -79,6 +79,8 @@
   <message key="org.apache.fop.events.ResourceEventProducer.foreignXMLNoHandler">Some XML content will be ignored. No handler defined for XML with namespace "{namespaceURI}".</message>
   <message key="org.apache.fop.events.ResourceEventProducer.imageWritingError">Error while writing an image to the target file.[ Reason: {e}]</message>
   <message key="org.apache.fop.events.ResourceEventProducer.cannotDeleteTempFile">Temporary file could not be deleted: {tempFile}</message>
+  <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotFound">Catalog resolver not found along the classpath</message>
+  <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotCreated">Error creating the catalog resolver: {message}</message>
   <message key="org.apache.fop.layoutmgr.inline.InlineLevelEventProducer.leaderWithoutContent">fo:leader is set to "use-content" but has no content.{{locator}}</message>
   <message key="org.apache.fop.layoutmgr.inline.InlineLevelEventProducer.lineOverflows">Line {line} of a paragraph overflows the available area by {overflowLength,choice,50000#{overflowLength} millipoints|50000&lt;more than 50 points}.{{locator}}</message>
   <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.rowTooTall">The contents of table-row {row} are taller than they should be (there is a block-progression-dimension or height constraint on the indicated row). Due to its contents the row grows to {effCellBPD} millipoints, but the row shouldn't get any taller than {maxCellBPD} millipoints.{{locator}}</message>
diff --git a/src/java/org/apache/fop/events/ResourceEventProducer.java b/src/java/org/apache/fop/events/ResourceEventProducer.java
index 607d2fa..3753e83 100644
--- a/src/java/org/apache/fop/events/ResourceEventProducer.java
+++ b/src/java/org/apache/fop/events/ResourceEventProducer.java
@@ -133,4 +133,18 @@
      */
     void cannotDeleteTempFile(Object source, File tempFile);
 
+    /**
+     * Catalog Resolver not found along the class path
+     * @param source the event source
+     * @event.severity ERROR
+     */
+    void catalogResolverNotFound(Object source);
+
+    /**
+     * Catalog Resolver not created, due to InstantiationException or IllegalAccessException
+     * @param source the event source
+     * @param message the exception message
+     * @event.severity ERROR
+     */
+    void catalogResolverNotCreated(Object source, String message);
 }
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
index 83dea01..cab68a1 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
@@ -117,10 +117,6 @@
         this.layoutListener = layoutListener;
         best = new BestPageRecords();
         this.footnoteSeparatorLength = (MinOptMax) footnoteSeparatorLength.clone();
-        // add some stretch, to avoid a restart for every page containing footnotes
-        if (footnoteSeparatorLength.min == footnoteSeparatorLength.max) {
-            footnoteSeparatorLength.max += 10000;
-        }
         this.autoHeight = autoHeight;
         this.favorSinglePart = favorSinglePart;
     }