xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r764744 [2/4] - in /xmlgraphics/fop/branches/Temp_Accessibility: ./ examples/embedding/java/embedding/intermediate/ src/documentation/ src/documentation/content/xdocs/trunk/ src/documentation/intermediate-format-ng/ src/java/META-INF/servic...
Date Tue, 14 Apr 2009 11:35:15 GMT
Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/svg/AFPGraphicsDevice.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/svg/AFPTextHandler.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/svg/AFPTextPainter.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/BinaryUtils.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/DTDEntityResolver.java
            ('svn:mergeinfo' removed)

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java Tue Apr 14 11:35:08 2009
@@ -19,42 +19,68 @@
 
 package org.apache.fop.afp.util;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.net.URL;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.commons.io.IOUtils;
+
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.fonts.FontManager;
 
 /**
  * Default implementation of the {@link ResourceAccessor} interface for use inside FOP.
  */
-public class DefaultFOPResourceAccessor implements ResourceAccessor {
+public class DefaultFOPResourceAccessor extends SimpleResourceAccessor {
 
     private FOUserAgent userAgent;
+    private String categoryBaseURI;
 
     /**
-     * Main constructor.
+     * Constructor for resource to be accessed via the {@link FOUserAgent}. This contructor
+     * can take two base URIs: the category base URI is the one to use when differentiating between
+     * normal resources (ex. images) and font resources. So, if fonts need to be accessed, you can
+     * set the {@link FontManager}'s base URI instead of the one on the {@link FopFactory}.
      * @param userAgent the FO user agent
+     * @param categoryBaseURI the category base URI (may be null)
+     * @param baseURI the custom base URI to resolve relative URIs against (may be null)
      */
-    public DefaultFOPResourceAccessor(FOUserAgent userAgent) {
+    public DefaultFOPResourceAccessor(FOUserAgent userAgent, String categoryBaseURI, URI baseURI) {
+        super(baseURI);
         this.userAgent = userAgent;
+        this.categoryBaseURI = categoryBaseURI;
     }
 
     /** {@inheritDoc} */
     public InputStream createInputStream(URI uri) throws IOException {
-        Source src = userAgent.resolveURI(uri.toASCIIString());
+        //Step 1: resolve against local base URI --> URI
+        URI resolved = resolveAgainstBase(uri);
+
+        //Step 2: resolve against the user agent --> stream
+        Source src;
+        src = userAgent.resolveURI(resolved.toASCIIString(), this.categoryBaseURI);
+
         if (src == null) {
-            return null;
+            throw new FileNotFoundException("Resource not found: " + uri.toASCIIString());
         } else if (src instanceof StreamSource) {
             StreamSource ss = (StreamSource)src;
             InputStream in = ss.getInputStream();
-            return in;
-        } else {
-            return null;
+            if (in != null) {
+                return in;
+            }
+            if (ss.getReader() != null) {
+                //Don't support reader, retry using system ID below
+                IOUtils.closeQuietly(ss.getReader());
+            }
         }
+        URL url = new URL(src.getSystemId());
+        return url.openStream();
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/SimpleResourceAccessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/SimpleResourceAccessor.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/SimpleResourceAccessor.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/SimpleResourceAccessor.java Tue Apr 14 11:35:08 2009
@@ -26,7 +26,8 @@
 import java.net.URL;
 
 /**
- * Simple implementation of the {@link ResourceAccessor} interface for access via files.
+ * Simple implementation of the {@link ResourceAccessor} interface for access relative to a
+ * base URI.
  */
 public class SimpleResourceAccessor implements ResourceAccessor {
 
@@ -34,23 +35,40 @@
 
     /**
      * Creates a new simple resource accessor.
-     * @param basePath the base path to resolve relative URIs to
+     * @param baseURI the base URI to resolve relative URIs against (may be null)
      */
-    public SimpleResourceAccessor(File basePath) {
-        this.baseURI = basePath.toURI();
+    public SimpleResourceAccessor(URI baseURI) {
+        this.baseURI = baseURI;
     }
 
     /**
      * Creates a new simple resource accessor.
-     * @param basePath the base path to resolve relative URIs to
+     * @param baseDir the base directory to resolve relative filenames against (may be null)
      */
-    public SimpleResourceAccessor(String basePath) {
-        this(new File(basePath));
+    public SimpleResourceAccessor(File baseDir) {
+        this(baseDir != null ? baseDir.toURI() : null);
+    }
+
+    /**
+     * Returns the base URI.
+     * @return the base URI (or null if no base URI was set)
+     */
+    public URI getBaseURI() {
+        return this.baseURI;
+    }
+
+    /**
+     * Resolve the given URI against the baseURI.
+     * @param uri the URI to resolve
+     * @return the resolved URI
+     */
+    protected URI resolveAgainstBase(URI uri) {
+        return (getBaseURI() != null ? getBaseURI().resolve(uri) : uri);
     }
 
     /** {@inheritDoc} */
     public InputStream createInputStream(URI uri) throws IOException {
-        URI resolved = this.baseURI.resolve(uri);
+        URI resolved = resolveAgainstBase(uri);
         URL url = resolved.toURL();
         return url.openStream();
     }

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/StringUtils.java
            ('svn:mergeinfo' removed)

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/util/StructuredFieldReader.java
            ('svn:mergeinfo' removed)

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOURIResolver.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOURIResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOURIResolver.java Tue Apr 14 11:35:08 2009
@@ -24,6 +24,8 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 
@@ -32,8 +34,10 @@
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.xmlgraphics.util.io.Base64EncodeStream;
 import org.apache.xmlgraphics.util.uri.CommonURIResolver;
 
@@ -74,15 +78,31 @@
             base += "/";
         }
         File dir = new File(base);
-        try {
-            base = (dir.isDirectory() ? dir.toURI().toURL() : new URL(base)).toExternalForm();
-        } catch (MalformedURLException mfue) {
-            if (throwExceptions) {
-                throw mfue;
+        if (dir.isDirectory()) {
+            return dir.toURI().toASCIIString();
+        } else {
+            URI baseURI;
+            try {
+                baseURI = new URI(base);
+                String scheme = baseURI.getScheme();
+                boolean directoryExists = true;
+                if ("file".equals(scheme)) {
+                    dir = FileUtils.toFile(baseURI.toURL());
+                    directoryExists = dir.isDirectory();
+                }
+                if (scheme == null || !directoryExists) {
+                    String message = "base " + base + " is not a valid directory";
+                    if (throwExceptions) {
+                        throw new MalformedURLException(message);
+                    }
+                    log.error(message);
+                }
+                return baseURI.toASCIIString();
+            } catch (URISyntaxException e) {
+                //TODO not ideal: our base URLs are actually base URIs.
+                throw new MalformedURLException(e.getMessage());
             }
-            log.error(mfue.getMessage());
         }
-        return base;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOUserAgent.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FOUserAgent.java Tue Apr 14 11:35:08 2009
@@ -21,6 +21,7 @@
 
 // Java
 import java.io.File;
+import java.net.MalformedURLException;
 import java.util.Date;
 import java.util.Map;
 
@@ -43,6 +44,7 @@
 import org.apache.fop.events.FOPEventListenerProxy;
 import org.apache.fop.events.LoggingEventListener;
 import org.apache.fop.fo.FOEventHandler;
+import org.apache.fop.fonts.FontManager;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.render.RendererFactory;
 import org.apache.fop.render.XMLHandlerRegistry;
@@ -84,9 +86,6 @@
      */
     private String base = null;
 
-    /** The base URL for all font URL resolutions. */
-    private String fontBase = null;
-
     /** A user settable URI Resolver */
     private URIResolver uriResolver = null;
 
@@ -97,6 +96,7 @@
     private Renderer rendererOverride = null;
     private FOEventHandler foEventHandlerOverride = null;
     private boolean locatorEnabled = true; // true by default (for error messages).
+    private boolean conserveMemoryPolicy = false;
     private EventBroadcaster eventBroadcaster = new FOPEventBroadcaster();
 
     //TODO Verify that a byte array is the best solution here
@@ -154,7 +154,6 @@
         }
         this.factory = factory;
         setBaseURL(factory.getBaseURL());
-        setFontBaseURL(factory.getFontManager().getFontBaseURL());
         setTargetResolution(factory.getTargetResolution());
         if (this.getRendererOptions().get("accessibility") == null) {
             this.rendererOptions.put("accessibility", Boolean.FALSE);
@@ -351,11 +350,16 @@
     }
 
     /**
-     * sets font base URL
+     * Sets font base URL.
      * @param fontBaseUrl font base URL
+     * @deprecated Use {@link FontManager#setFontBaseURL(String)} instead.
      */
     public void setFontBaseURL(String fontBaseUrl) {
-        this.fontBase = fontBaseUrl;
+        try {
+            getFactory().getFontManager().setFontBaseURL(fontBaseUrl);
+        } catch (MalformedURLException e) {
+            throw new IllegalArgumentException(e.getMessage());
+    }
     }
 
     /**
@@ -490,8 +494,13 @@
     // ---------------------------------------------- environment-level stuff
     //                                                (convenience access to FopFactory methods)
 
-    /** @return the font base URL */
+    /**
+     * Returns the font base URL.
+     * @return the font base URL
+     * @deprecated Use {@link FontManager#getFontBaseURL()} instead. This method is not used by FOP.
+     */
     public String getFontBaseURL() {
+        String fontBase = getFactory().getFontManager().getFontBaseURL();
         return fontBase != null ? fontBase : getBaseURL();
     }
 
@@ -623,6 +632,24 @@
     }
 
     /**
+     * Check whether memory-conservation is enabled.
+     *
+     * @return true if FOP is to conserve as much as possible
+     */
+    public boolean isConserveMemoryPolicyEnabled() {
+        return this.conserveMemoryPolicy;
+    }
+
+    /**
+     * Control whether memory-conservation should be enabled
+     *
+     * @param conserveMemoryPolicy the cachingEnabled to set
+     */
+    public void setConserveMemoryPolicy(boolean conserveMemoryPolicy) {
+        this.conserveMemoryPolicy = conserveMemoryPolicy;
+    }
+
+    /**
      * Check if accessibility is enabled.
      * @return true if accessibility is enabled
      */

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactory.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactory.java Tue Apr 14 11:35:08 2009
@@ -278,9 +278,11 @@
      */
     public Fop newFop(FOUserAgent userAgent) throws FOPException {
         if (userAgent.getRendererOverride() == null
-                && userAgent.getFOEventHandlerOverride() == null) {
-            throw new IllegalStateException("Either the overriding renderer or the overriding"
-                    + " FOEventHandler must be set when this factory method is used!");
+                && userAgent.getFOEventHandlerOverride() == null
+                && userAgent.getDocumentHandlerOverride() == null) {
+            throw new IllegalStateException("An overriding renderer,"
+                    + " FOEventHandler or IFDocumentHandler must be set on the user agent"
+                    + " when this factory method is used!");
         }
         return newFop(null, userAgent);
     }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactoryConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactoryConfigurator.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactoryConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/apps/FopFactoryConfigurator.java Tue Apr 14 11:35:08 2009
@@ -61,6 +61,8 @@
     /** Defines the default target resolution (72dpi) for FOP */
     public static final float DEFAULT_TARGET_RESOLUTION = 72.0f; //dpi
 
+    private static final String PREFER_RENDERER = "prefer-renderer";
+
     /** logger instance */
     private final Log log = LogFactory.getLog(FopFactoryConfigurator.class);
 
@@ -182,6 +184,16 @@
             }
         }
 
+        // prefer Renderer over IFDocumentHandler
+        if (cfg.getChild(PREFER_RENDERER, false) != null) {
+            try {
+                factory.getRendererFactory().setRendererPreferred(
+                        cfg.getChild(PREFER_RENDERER).getValueAsBoolean());
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, strict);
+            }
+        }
+
         // configure font manager
         FontManager fontManager = factory.getFontManager();
         FontManagerConfigurator fontManagerConfigurator = new FontManagerConfigurator(cfg);

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeHandler.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeHandler.java Tue Apr 14 11:35:08 2009
@@ -124,7 +124,11 @@
      */
     protected void setupModel(FOUserAgent userAgent, String outputFormat,
             OutputStream stream) throws FOPException {
-        this.model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream);
+        if (userAgent.isConserveMemoryPolicyEnabled()) {
+            this.model = new CachedRenderPagesModel(userAgent, outputFormat, fontInfo, stream);
+        } else {
+            this.model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream);
+        }
     }
 
     /**
@@ -442,7 +446,6 @@
 
         /**
          * Default constructor
-         * @param areaTreeHandler area tree handler
          */
         protected Statistics() {
             this.runtime = Runtime.getRuntime();

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeParser.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeParser.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/AreaTreeParser.java Tue Apr 14 11:35:08 2009
@@ -21,6 +21,8 @@
 
 import java.awt.Color;
 import java.awt.geom.Rectangle2D;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.nio.CharBuffer;
 import java.util.List;
 import java.util.Map;
@@ -41,6 +43,7 @@
 
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 import org.xml.sax.helpers.DefaultHandler;
@@ -48,6 +51,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.xmlgraphics.image.loader.ImageException;
 import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.ImageManager;
 import org.apache.xmlgraphics.image.loader.ImageSessionContext;
@@ -68,6 +72,7 @@
 import org.apache.fop.area.inline.TextArea;
 import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.area.inline.WordArea;
+import org.apache.fop.events.ResourceEventProducer;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.ElementMappingRegistry;
 import org.apache.fop.fo.expr.PropertyException;
@@ -149,6 +154,7 @@
         private Stack delegateStack = new Stack();
         private ContentHandler delegate;
         private DOMImplementation domImplementation;
+        private Locator locator;
 
 
         public Handler(AreaTreeModel treeModel, FOUserAgent userAgent,
@@ -224,6 +230,15 @@
         }
 
         /** {@inheritDoc} */
+        public void setDocumentLocator(Locator locator) {
+            this.locator = locator;
+        }
+
+        private Locator getLocator() {
+            return this.locator;
+        }
+
+        /** {@inheritDoc} */
         public void startElement(String uri, String localName, String qName, Attributes attributes)
                     throws SAXException {
             if (delegate != null) {
@@ -356,6 +371,7 @@
                 pageSequence.setLanguage(lang);
                 String country = attributes.getValue("country");
                 pageSequence.setCountry(country);
+                transferForeignObjects(attributes, pageSequence);
                 areaStack.push(pageSequence);
             }
         }
@@ -970,9 +986,16 @@
                     this.currentPageViewport.addExtensionAttachment(attachment);
                 }
             } else {
+                Object o = areaStack.peek();
+                if (o instanceof AreaTreeObject && obj instanceof ExtensionAttachment) {
+                    AreaTreeObject ato = (AreaTreeObject)o;
+                    ExtensionAttachment attachment = (ExtensionAttachment)obj;
+                    ato.addExtensionAttachment(attachment);
+                } else {
                 log.warn("Don't know how to handle externally generated object: " + obj);
             }
         }
+        }
 
         private void setAreaAttributes(Attributes attributes, Area area) {
             area.setIPD(Integer.parseInt(attributes.getValue("ipd")));
@@ -1048,8 +1071,21 @@
                                     = userAgent.getImageSessionContext();
                                 ImageInfo info = manager.getImageInfo(uri, sessionContext);
                                 bkg.setImageInfo(info);
-                            } catch (Exception e) {
-                                log.error("Background image not available: " + uri, e);
+                            } catch (ImageException e) {
+                                ResourceEventProducer eventProducer
+                                    = ResourceEventProducer.Provider.get(
+                                        this.userAgent.getEventBroadcaster());
+                                eventProducer.imageError(this, uri, e, getLocator());
+                            } catch (FileNotFoundException fnfe) {
+                                ResourceEventProducer eventProducer
+                                    = ResourceEventProducer.Provider.get(
+                                        this.userAgent.getEventBroadcaster());
+                                eventProducer.imageNotFound(this, uri, fnfe, getLocator());
+                            } catch (IOException ioe) {
+                                ResourceEventProducer eventProducer
+                                    = ResourceEventProducer.Provider.get(
+                                        this.userAgent.getEventBroadcaster());
+                                eventProducer.imageIOError(this, uri, ioe, getLocator());
                             }
 
                             String repeat = attributes.getValue("bkg-repeat");

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/CachedRenderPagesModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/CachedRenderPagesModel.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/CachedRenderPagesModel.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/CachedRenderPagesModel.java Tue Apr 14 11:35:08 2009
@@ -129,7 +129,7 @@
         try {
             // save page to cache
             ObjectOutputStream tempstream;
-            String fname = "fop-page-" + page.toString() + ".ser";
+            String fname = "fop-page-" + page.getPageIndex() + ".ser";
             File tempFile = new File(baseDir, fname);
             tempFile.deleteOnExit();
             tempstream = new ObjectOutputStream(new BufferedOutputStream(

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/PageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/PageSequence.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/PageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/PageSequence.java Tue Apr 14 11:35:08 2009
@@ -24,7 +24,7 @@
 /**
  * Represents a page sequence in the area tree.
  */
-public class PageSequence {
+public class PageSequence extends AreaTreeObject {
 
     private List pages = new java.util.ArrayList();
     private LineArea title;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/inline/InlineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/inline/InlineArea.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/inline/InlineArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/area/inline/InlineArea.java Tue Apr 14 11:35:08 2009
@@ -19,6 +19,8 @@
 
 package org.apache.fop.area.inline;
 
+import java.io.Serializable;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.Trait;
@@ -35,7 +37,7 @@
      * that can be used in order to re-compute adjustments when a
      * page-number or a page-number-citation is resolved
      */
-    protected class InlineAdjustingInfo {
+    protected class InlineAdjustingInfo implements Serializable {
         /** stretch of the inline area */
         protected int availableStretch;
         /** shrink of the inline area */

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java Tue Apr 14 11:35:08 2009
@@ -110,6 +110,8 @@
     private Map renderingOptions = new java.util.HashMap();
     /* target resolution (for the user agent) */
     private int targetResolution = 0;
+    /* control memory-conservation policy */
+    private boolean conserveMemoryPolicy = false;
 
     private FopFactory factory = FopFactory.newInstance();
     private FOUserAgent foUserAgent;
@@ -168,6 +170,7 @@
                 }
                 addXSLTParameter("fop-output-format", getOutputFormat());
                 addXSLTParameter("fop-version", Version.getVersion());
+                foUserAgent.setConserveMemoryPolicy(conserveMemoryPolicy);
             } else {
                 return false;
             }
@@ -268,6 +271,8 @@
                 setLogOption("debug", "debug");
             } else if (args[i].equals("-r")) {
                 factory.setStrictValidation(false);
+            } else if (args[i].equals("-conserve")) {
+                conserveMemoryPolicy = true;
             } else if (args[i].equals("-dpi")) {
                 i = i + parseResolution(args, i);
             } else if (args[i].equals("-q") || args[i].equals("--quiet")) {
@@ -1134,6 +1139,8 @@
             + "  -a                enables accessibility features (Tagged PDF etc., default off)\n"
             + "  -pdfprofile prof  PDF file will be generated with the specified profile\n"
             + "                    (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n"
+            + "  -conserve         Enable memory-conservation policy (trades memory-consumption for disk I/O)"
+            + "                    (Note: currently only influences whether the area tree is serialized.)"
             + " [INPUT]  \n"
             + "  infile            xsl:fo input file (the same as the next) \n"
             + "                    (use '-' for infile to pipe input from stdin)\n"

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml Tue Apr 14 11:35:08 2009
@@ -24,6 +24,8 @@
   <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message>
   <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message>
   <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message>
+  <message key="rule.childOfPageSequence">The element must be a child of fo:page-sequence.</message>
+  <message key="rule.childOfPageSequenceOrSPM">The element must be a child of fo:page-sequence or fo:simple-page-master.</message>
   <message key="rule.wrapperInvalidChildForParent">An fo:wrapper is only permitted to have children that would be permitted for its parent.</message>
   <message key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">For "{elementName}", only one "{offendingNode}" may be declared.{{locator}}</message>
   <message key="org.apache.fop.fo.FOValidationEventProducer.nodeOutOfOrder">For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}}</message>

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/Constants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/Constants.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/Constants.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/Constants.java Tue Apr 14 11:35:08 2009
@@ -784,27 +784,27 @@
 
     // compound property constants
 
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_BLOCK_PROGRESSION_DIRECTION = 1 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_CONDITIONALITY = 2 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_INLINE_PROGRESSION_DIRECTION = 3 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_LENGTH = 4 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_MAXIMUM = 5 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_MINIMUM = 6 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_OPTIMUM = 7 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_PRECEDENCE = 8 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_WITHIN_COLUMN = 9 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_WITHIN_LINE = 10 << COMPOUND_SHIFT;
-    /** Property constant for compund property */
+    /** Property constant for compound property */
     int CP_WITHIN_PAGE = 11 << COMPOUND_SHIFT;
 
     // Enumeration constants

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/Leader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/Leader.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/Leader.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/Leader.java Tue Apr 14 11:35:08 2009
@@ -73,6 +73,7 @@
         leaderLength = pList.get(PR_LEADER_LENGTH).getLengthRange();
         leaderPattern = pList.get(PR_LEADER_PATTERN).getEnum();
         leaderPatternWidth = pList.get(PR_LEADER_PATTERN_WIDTH).getLength();
+        ruleThickness = pList.get(PR_RULE_THICKNESS).getLength();
         switch(leaderPattern) {
         case EN_SPACE:
             // use Space
@@ -81,7 +82,6 @@
             // the following properties only apply
             // for leader-pattern = "rule"
             ruleStyle = pList.get(PR_RULE_STYLE).getEnum();
-            ruleThickness = pList.get(PR_RULE_THICKNESS).getLength();
             break;
         case EN_DOTS:
             break;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/PageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/PageSequence.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/PageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/PageSequence.java Tue Apr 14 11:35:08 2009
@@ -48,7 +48,7 @@
     // the set of flows includes StaticContent flows also
 
     /** Map of flows to their flow name (flow-name, Flow) */
-    private Map flowMap;
+    private Map/*<String, Flow>*/ flowMap;
 
     /**
      * The currentSimplePageMaster is either the page master for the
@@ -96,18 +96,18 @@
     /** {@inheritDoc} */
     protected void startOfNode() throws FOPException {
         super.startOfNode();
-        flowMap = new java.util.HashMap();
+        flowMap = new java.util.HashMap/*<String, Flow>*/();
 
-        this.simplePageMaster = getRoot().getLayoutMasterSet().getSimplePageMaster(masterReference);
-        if (this.simplePageMaster == null) {
+        this.simplePageMaster
+            = getRoot().getLayoutMasterSet().getSimplePageMaster(masterReference);
+        if (simplePageMaster == null) {
             this.pageSequenceMaster
-                    = getRoot().getLayoutMasterSet().getPageSequenceMaster(masterReference);
-            if (this.pageSequenceMaster == null) {
+                = getRoot().getLayoutMasterSet().getPageSequenceMaster(masterReference);
+            if (pageSequenceMaster == null) {
                 getFOValidationEventProducer().masterNotFound(this, getName(),
                         masterReference, getLocator());
             }
         }
-
         getFOEventHandler().startPageSequence(this);
     }
 
@@ -170,7 +170,7 @@
             flowMap.put(((StaticContent)child).getFlowName(), child);
             break;
         default:
-            assert false;
+            super.addChildNode(child);
         }
     }
 

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/Region.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/Region.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/Region.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/Region.java Tue Apr 14 11:35:08 2009
@@ -26,6 +26,7 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
@@ -130,6 +131,24 @@
                 || name.equals("xsl-footnote-separator"));
     }
 
+    /**
+     * Get the page-width context
+     * @param lengthBase    the lengthBase to use for resolving percentages
+     * @return  context for the width of the page-reference-area
+     */
+    protected PercentBaseContext getPageWidthContext(int lengthBase) {
+        return layoutMaster.getPageWidthContext(lengthBase);
+    }
+
+    /**
+     * Get the page-width context
+     * @param lengthBase    the lengthBase to use for resolving percentages
+     * @return  context for the width of the page-reference-area
+     */
+    protected PercentBaseContext getPageHeightContext(int lengthBase) {
+        return layoutMaster.getPageHeightContext(lengthBase);
+    }
+
     /** {@inheritDoc} */
     public boolean generatesReferenceAreas() {
         return true;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionAfter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionAfter.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionAfter.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionAfter.java Tue Apr 14 11:35:08 2009
@@ -26,7 +26,7 @@
 import org.apache.fop.fo.FONode;
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.datatypes.PercentBaseContext;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-after">
@@ -48,25 +48,9 @@
         /* Special rules apply to resolving extent as values are resolved relative
          * to the page size and reference orientation.
          */
-        SimplePercentBaseContext pageWidthContext;
-        SimplePercentBaseContext pageHeightContext;
-        if (spm.getReferenceOrientation() % 180 == 0) {
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageWidth().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageHeight().getValue());
-        } else {
-            // invert width and height since top left are rotated by 90 (cl or ccl)
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageHeight().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageWidth().getValue());
-        }
-        SimplePercentBaseContext neighbourContext;
+        PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext neighbourContext;
         Rectangle vpRect;
         if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) {
             neighbourContext = pageWidthContext;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionBody.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionBody.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionBody.java Tue Apr 14 11:35:08 2009
@@ -27,7 +27,7 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.LengthBase;
 import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.properties.CommonMarginBlock;
@@ -106,24 +106,8 @@
          * Also the values are resolved relative to the page size
          * and reference orientation.
          */
-        SimplePercentBaseContext pageWidthContext;
-        SimplePercentBaseContext pageHeightContext;
-        if (spm.getReferenceOrientation() % 180 == 0) {
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CONTAINING_BLOCK_WIDTH,
-                                                            spm.getPageWidth().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CONTAINING_BLOCK_WIDTH,
-                                                             spm.getPageHeight().getValue());
-        } else {
-            // invert width and height since top left are rotated by 90 (cl or ccl)
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CONTAINING_BLOCK_WIDTH,
-                                                            spm.getPageHeight().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CONTAINING_BLOCK_WIDTH,
-                                                             spm.getPageWidth().getValue());
-        }
+        PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH);
+        PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH);
 
         int start;
         int end;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionEnd.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionEnd.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionEnd.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionEnd.java Tue Apr 14 11:35:08 2009
@@ -26,7 +26,7 @@
 import org.apache.fop.fo.FONode;
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.datatypes.PercentBaseContext;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-end">
@@ -48,25 +48,9 @@
         /* Special rules apply to resolving extent as values are resolved relative
          * to the page size and reference orientation.
          */
-        SimplePercentBaseContext pageWidthContext;
-        SimplePercentBaseContext pageHeightContext;
-        if (spm.getReferenceOrientation() % 180 == 0) {
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageWidth().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageHeight().getValue());
-        } else {
-            // invert width and height since top left are rotated by 90 (cl or ccl)
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageHeight().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageWidth().getValue());
-        }
-        SimplePercentBaseContext neighbourContext;
+        PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext neighbourContext;
         Rectangle vpRect;
         if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) {
             neighbourContext = pageHeightContext;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionStart.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionStart.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionStart.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/RegionStart.java Tue Apr 14 11:35:08 2009
@@ -26,7 +26,7 @@
 import org.apache.fop.fo.FONode;
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.datatypes.PercentBaseContext;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-start">
@@ -48,25 +48,9 @@
         /* Special rules apply to resolving extent as values are resolved relative
          * to the page size and reference orientation.
          */
-        SimplePercentBaseContext pageWidthContext;
-        SimplePercentBaseContext pageHeightContext;
-        if (spm.getReferenceOrientation() % 180 == 0) {
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageWidth().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageHeight().getValue());
-        } else {
-            // invert width and height since top left are rotated by 90 (cl or ccl)
-            pageWidthContext = new SimplePercentBaseContext(null,
-                                                            LengthBase.CUSTOM_BASE,
-                                                            spm.getPageHeight().getValue());
-            pageHeightContext = new SimplePercentBaseContext(null,
-                                                             LengthBase.CUSTOM_BASE,
-                                                             spm.getPageWidth().getValue());
-        }
-        SimplePercentBaseContext neighbourContext;
+        PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE);
+        PercentBaseContext neighbourContext;
         Rectangle vpRect;
         if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) {
             neighbourContext = pageHeightContext;

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java Tue Apr 14 11:35:08 2009
@@ -29,6 +29,8 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
@@ -195,6 +197,44 @@
     }
 
     /**
+     * Gets the context for the width of the page-reference-area,
+     * taking into account the reference-orientation.
+     *
+     * @param lengthBase    the lengthBase to use to resolve percentages
+     * @return context for the width of the page-reference-area
+     */
+    protected final PercentBaseContext getPageWidthContext(int lengthBase) {
+        return (this.referenceOrientation.getValue() % 180 == 0)
+                ? new SimplePercentBaseContext(
+                        null,
+                        lengthBase,
+                        this.getPageWidth().getValue())
+                : new SimplePercentBaseContext(
+                        null,
+                        lengthBase,
+                        this.getPageHeight().getValue());
+    }
+
+    /**
+     * Gets the context for the height of the page-reference-area,
+     * taking into account the reference-orientation.
+     *
+     * @param lengthBase    the lengthBase to use to resolve percentages
+     * @return the context for the height of the page-reference-area
+     */
+    protected final PercentBaseContext getPageHeightContext(int lengthBase) {
+        return (this.referenceOrientation.getValue() % 180 == 0)
+                ? new SimplePercentBaseContext(
+                        null,
+                        lengthBase,
+                        this.getPageHeight().getValue())
+                : new SimplePercentBaseContext(
+                        null,
+                        lengthBase,
+                        this.getPageWidth().getValue());
+    }
+
+    /**
      * Returns the region for a given region class.
      * @param regionId Constants ID of the FO representing the region
      * @return the region, null if it doesn't exist

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java Tue Apr 14 11:35:08 2009
@@ -650,6 +650,78 @@
                 || borderInfo[START] != null || borderInfo[END] != null);
     }
 
+    /**
+     * Returns the "background-color" property.
+     * @return the "background-color" property.
+     */
+    public Color getBackgroundColor() {
+        return backgroundColor;
+    }
+
+    /**
+     * Returns the "background-attachment" property.
+     * @return the "background-attachment" property.
+     */
+    public int getBackgroundAttachment() {
+        return backgroundAttachment;
+    }
+
+    /**
+     * Returns the "background-image" property.
+     * @return the "background-image" property.
+     */
+    public String getBackgroundImage() {
+        return backgroundImage;
+    }
+
+    /**
+     * Returns the "background-repeat" property.
+     * @return the "background-repeat" property.
+     */
+    public int getBackgroundRepeat() {
+        return backgroundRepeat;
+    }
+
+    /**
+     * Returns the "background-position-horizontal" property.
+     * @return the "background-position-horizontal" property.
+     */
+    public Length getBackgroundPositionHorizontal() {
+        return backgroundPositionHorizontal;
+    }
+
+    /**
+     * Returns the "background-position-vertical" property.
+     * @return the "background-position-vertical" property.
+     */
+    public Length getBackgroundPositionVertical() {
+        return backgroundPositionVertical;
+    }
+
+    /**
+     * Returns the background image info
+     * @return the background image info
+     */
+    public ImageInfo getBackgroundImageInfo() {
+        return backgroundImageInfo;
+    }
+
+    /**
+     * Returns the border info
+     * @return the border info
+     */
+    public BorderInfo[] getBorderInfo() {
+        return borderInfo;
+    }
+
+    /**
+     * Returns the padding
+     * @return the padding
+     */
+    public CondLengthProperty[] getPadding() {
+        return padding;
+    }
+
     /** {@inheritDoc} */
     public boolean equals(Object obj) {
         if (this == obj) {

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonFont.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/properties/CommonFont.java Tue Apr 14 11:35:08 2009
@@ -170,6 +170,16 @@
         return fontWeight.getEnum();
     }
 
+    /** @return the "font-size" property. */
+    public Length getFontSize() {
+        return fontSize;
+    }
+
+    /** @return the "font-size-adjust" property. */
+    public Numeric getFontSizeAdjust() {
+        return fontSizeAdjust;
+    }
+
     /**
      * Create and return an array of <code>FontTriplets</code> based on
      * the properties stored in the instance variables.

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/FontManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/FontManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/FontManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/FontManager.java Tue Apr 14 11:35:08 2009
@@ -20,6 +20,8 @@
 package org.apache.fop.fonts;
 
 import java.net.MalformedURLException;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
@@ -186,4 +188,27 @@
     public Matcher getReferencedFontsMatcher() {
         return this.referencedFontsMatcher;
     }
+
+    /**
+     * Updates the referenced font list
+     * @param fontInfoList a font info list
+     */
+    public void updateReferencedFonts(List fontInfoList) {
+        Matcher matcher = getReferencedFontsMatcher();
+        if (matcher == null) {
+            return; //No referenced fonts
+        }
+        Iterator iter = fontInfoList.iterator();
+        while (iter.hasNext()) {
+            EmbedFontInfo fontInfo = (EmbedFontInfo)iter.next();
+            Iterator triplets = fontInfo.getFontTriplets().iterator();
+            while (triplets.hasNext()) {
+                FontTriplet triplet = (FontTriplet)triplets.next();
+                if (matcher.matches(triplet)) {
+                    fontInfo.setEmbedded(false);
+                    break;
+                }
+            }
+        }
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java Tue Apr 14 11:35:08 2009
@@ -130,7 +130,7 @@
      * @throws IOException io exception
      * {@inheritDoc}
      */
-    public List find() throws IOException {
+    public List/*<URL>*/ find() throws IOException {
         final FontFinder fontDirFinder;
         final String osName = System.getProperty("os.name");
         if (osName.startsWith("Windows")) {
@@ -142,8 +142,8 @@
                 fontDirFinder = new UnixFontDirFinder();
             }
         }
-        List fontDirs = fontDirFinder.find();
-        List results = new java.util.ArrayList();
+        List/*<URL>*/ fontDirs = fontDirFinder.find();
+        List/*<URL>*/ results = new java.util.ArrayList/*<URL>*/();
         for (Iterator iter = fontDirs.iterator(); iter.hasNext();) {
             final File dir = (File)iter.next();
             super.walk(dir, results);

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFinder.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/autodetect/FontFinder.java Tue Apr 14 11:35:08 2009
@@ -37,6 +37,6 @@
      * @throws IOException
      *             In case of an I/O problem
      */
-    List find() throws IOException;
+    List/*<URL>*/ find() throws IOException;
 
 }

Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java
            ('svn:mergeinfo' removed)

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -26,7 +26,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
+import org.apache.fop.area.AreaTreeObject;
 import org.apache.fop.area.PageViewport;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
@@ -266,8 +268,10 @@
             childLMs = new java.util.ArrayList(10);
         }
         childLMs.add(lm);
-        log.trace(this.getClass().getName()
-                  + ": Adding child LM " + lm.getClass().getName());
+        if (log.isTraceEnabled()) {
+            log.trace(this.getClass().getName()
+                    + ": Adding child LM " + lm.getClass().getName());
+        }
     }
 
     /**
@@ -300,6 +304,13 @@
         return pos;
     }
 
+    private void verifyNonNullPosition(Position pos) {
+        if (pos == null || pos.getIndex() < 0) {
+            throw new IllegalArgumentException(
+                    "Only non-null Positions with an index can be checked");
+        }
+    }
+
     /**
      * Indicates whether the given Position is the first area-generating Position of this LM.
      * @param pos the Position (must be one with a position index)
@@ -307,9 +318,7 @@
      */
     public boolean isFirst(Position pos) {
         //log.trace("isFirst() smallestPosNumberChecked=" + smallestPosNumberChecked + " " + pos);
-        if (pos == null || pos.getIndex() < 0) {
-            throw new IllegalArgumentException("Only non-null Positions with an index can be checked");
-        }
+        verifyNonNullPosition(pos);
         if (pos.getIndex() == this.smallestPosNumberChecked) {
             return true;
         } else if (pos.getIndex() < this.smallestPosNumberChecked) {
@@ -326,10 +335,7 @@
      * @return True if it is the last Position
      */
     public boolean isLast(Position pos) {
-        //log.trace("isLast() lastGenPos=" + lastGeneratedPosition + " " + pos);
-        if (pos == null || pos.getIndex() < 0) {
-            throw new IllegalArgumentException("Only non-null Positions with an index can be checked");
-        }
+        verifyNonNullPosition(pos);
         return (pos.getIndex() == this.lastGeneratedPosition
                 && isFinished());
     }
@@ -338,12 +344,32 @@
      * Transfers foreign attributes from the formatting object to the area.
      * @param targetArea the area to set the attributes on
      */
-    protected void transferForeignAttributes(Area targetArea) {
+    protected void transferForeignAttributes(AreaTreeObject targetArea) {
         Map atts = fobj.getForeignAttributes();
         targetArea.setForeignAttributes(atts);
     }
 
     /**
+     * Transfers extension attachments from the formatting object to the area.
+     * @param targetArea the area to set the extensions on
+     */
+    protected void transferExtensionAttachments(AreaTreeObject targetArea) {
+        if (fobj.hasExtensionAttachments()) {
+            targetArea.setExtensionAttachments(fobj.getExtensionAttachments());
+        }
+    }
+
+    /**
+     * Transfers extensions (foreign attributes and extension attachments) from
+     * the formatting object to the area.
+     * @param targetArea the area to set the extensions on
+     */
+    protected void transferExtensions(AreaTreeObject targetArea) {
+        transferForeignAttributes(targetArea);
+        transferExtensionAttachments(targetArea);
+    }
+
+    /**
      * Registers the FO's markers on the current PageViewport
      *
      * @param isStarting    boolean indicating whether the markers qualify as 'starting'

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -167,6 +167,13 @@
         addChildToArea(childArea, getCurrentArea());
     }
 
+    /** {@inheritDoc} */
+    protected void notifyEndOfLayout() {
+        super.notifyEndOfLayout();
+        // Free memory of the area tree
+        //this.parentArea = null;
+    }
+
     /**
      * Force current area to be added to parent area.
      */
@@ -340,18 +347,19 @@
 
                 return returnList;
             } else {
-                if (prevLM != null) {
-                    // there is a block handled by prevLM
-                    // before the one handled by curLM
-                    addInBetweenBreak(contentList, context, childLC);
-                }
                 if (returnedList == null || returnedList.isEmpty()) {
                     //Avoid NoSuchElementException below (happens with empty blocks)
                     continue;
                 }
+                if (prevLM != null
+                        && !ElementListUtils.startsWithForcedBreak(returnedList)) {
+                    // there is a block handled by prevLM before the one
+                    // handled by curLM, and the one handled
+                    // by the current LM does not begin with a break
+                    addInBetweenBreak(contentList, context, childLC);
+                }
                 contentList.addAll(returnedList);
-                if (((ListElement) ListUtil.getLast(returnedList))
-                        .isForcedBreak()) {
+                if (ElementListUtils.endsWithForcedBreak(returnedList)) {
                     // a descendant of this block has break-after
                     if (curLM.isFinished() && !hasNextChildLM()) {
                         forcedBreakAfterLast = (BreakElement) ListUtil
@@ -486,7 +494,7 @@
         //      ? "penalty" : (lastElement.isGlue() ? "glue" : "box" )));
 /*LF*/  //log.debug("  position e' " + lastElement.getPosition().getClass().getName());
 /*LF*/  //log.debug("  " + (bpUnit > 0 ? "unit" : ""));
-        Position innerPosition = ((NonLeafPosition) lastElement.getPosition()).getPosition();
+        Position innerPosition = lastElement.getPosition().getPosition();
 
         if (innerPosition == null && lastElement.isGlue()) {
             // this adjustment applies to space-before or space-after of this block
@@ -536,7 +544,7 @@
 /*LF*/              //log.debug("  BLM.negotiateBPDAdjustment> chiamata passata");
                     return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager())
                            .negotiateBPDAdjustment(storedPenalty.getW(),
-                                   (KnuthElement)storedPenalty);
+                                   storedPenalty);
                 } else {
                     // the original penalty has width = 0
                     // the adjustment involves only the spaces before and after
@@ -787,12 +795,12 @@
                 returnList.add(new KnuthGlue(0, 0, 0,
                         SPACE_AFTER_ADJUSTMENT,
                         new NonLeafPosition(this, null),
-                        (!spaceAfterIsConditional) ? false : true));
+                        spaceAfterIsConditional));
             } else {
                 returnList.add(new KnuthGlue(adjustedSpaceAfter, 0, 0,
                         SPACE_AFTER_ADJUSTMENT,
                         new NonLeafPosition(this, null),
-                        (!spaceAfterIsConditional) ? false : true));
+                        spaceAfterIsConditional));
             }
             if (!spaceAfterIsConditional) {
                 returnList.add(new KnuthBox(0,
@@ -1201,8 +1209,8 @@
                 totalLength.add(new MinOptMax(element.getW()));
                 //log.debug("box " + element.getW());
             } else if (element.isGlue()) {
-                totalLength.min -= ((KnuthGlue) element).getZ();
-                totalLength.max += ((KnuthGlue) element).getY();
+                totalLength.min -= element.getZ();
+                totalLength.max += element.getY();
                 //leafValue = ((LeafPosition) element.getPosition()).getLeafPos();
                 //log.debug("glue " + element.getW() + " + "
                 //    + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ());
@@ -1239,10 +1247,10 @@
                 lengthAfterBreak.subtract(new MinOptMax(element.getW()));
                 bPrevIsBox = true;
             } else if (element.isGlue()) {
-                lengthBeforeBreak.min -= ((KnuthGlue) element).getZ();
-                lengthAfterBreak.min += ((KnuthGlue) element).getZ();
-                lengthBeforeBreak.max += ((KnuthGlue) element).getY();
-                lengthAfterBreak.max -= ((KnuthGlue) element).getY();
+                lengthBeforeBreak.min -= element.getZ();
+                lengthAfterBreak.min += element.getZ();
+                lengthBeforeBreak.max += element.getY();
+                lengthAfterBreak.max -= element.getY();
                 bPrevIsBox = false;
             } else {
                 lengthBeforeBreak.add(new MinOptMax(element.getW()));
@@ -1250,7 +1258,7 @@
             }
 
             // create the new elements
-            if (element.isPenalty() && ((KnuthPenalty) element).getP() < KnuthElement.INFINITE
+            if (element.isPenalty() && element.getP() < KnuthElement.INFINITE
                     || element.isGlue() && bPrevIsBox
                     || !oldListIterator.hasNext()) {
                 // suppress elements after the breaking point
@@ -1260,8 +1268,8 @@
                     iStepsForward++;
                     if (el.isGlue()) {
                         // suppressed glue
-                        lengthAfterBreak.min += ((KnuthGlue) el).getZ();
-                        lengthAfterBreak.max -= ((KnuthGlue) el).getY();
+                        lengthAfterBreak.min += el.getZ();
+                        lengthAfterBreak.max -= el.getY();
                     } else if (el.isPenalty()) {
                         // suppressed penalty, do nothing
                     } else {
@@ -1281,8 +1289,8 @@
                 for (int i = 0; i < iStepsForward; i++) {
                     KnuthElement el = (KnuthElement) oldListIterator.previous();
                     if (el.isGlue()) {
-                        lengthAfterBreak.min -= ((KnuthGlue) el).getZ();
-                        lengthAfterBreak.max += ((KnuthGlue) el).getY();
+                        lengthAfterBreak.min -= el.getZ();
+                        lengthAfterBreak.max += el.getY();
                     }
                 }
 

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Tue Apr 14 11:35:08 2009
@@ -194,6 +194,15 @@
     }
 
     /**
+     * Indicates whether the given element list starts with a forced break.
+     * @param elems the element list
+     * @return true if the list starts with a forced break
+     */
+    public static boolean startsWithForcedBreak(List elems) {
+        return !elems.isEmpty() && ((ListElement) elems.get(0)).isForcedBreak();
+    }
+
+    /**
      * Indicates whether the given element list ends with a penalty with a non-infinite penalty
      * value.
      * @param elems the element list
@@ -229,4 +238,4 @@
         return prevBreak;
     }
 
-}
+}
\ No newline at end of file

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -105,7 +105,9 @@
             Dimension intrinsicSize = info.getSize().getDimensionMpt();
             ImageLayout layout = new ImageLayout(getExternalDocument(), this, intrinsicSize);
 
-            areaTreeHandler.getAreaTreeModel().startPageSequence(new PageSequence(null));
+            PageSequence pageSequence = new PageSequence(null);
+            transferExtensions(pageSequence);
+            areaTreeHandler.getAreaTreeModel().startPageSequence(pageSequence);
             if (log.isDebugEnabled()) {
                 log.debug("Starting layout");
             }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -88,8 +88,8 @@
                         .getDisableColumnBalancing();
             } else if (curLM instanceof BlockContainerLayoutManager) {
                 span = ((BlockContainerLayoutManager)curLM).getBlockContainerFO().getSpan();
-                disableColumnBalancing = ((BlockContainerLayoutManager) curLM)
-                        .getBlockContainerFO().getDisableColumnBalancing();
+                disableColumnBalancing = ((BlockContainerLayoutManager) curLM).getBlockContainerFO()
+                        .getDisableColumnBalancing();
             }
 
             int currentSpan = context.getCurrentSpan();
@@ -130,24 +130,23 @@
                 returnList.addAll(returnedList);
                 SpaceResolver.resolveElementList(returnList);
                 return returnList;
-            } else {
-                if (returnList.size() > 0) {
+            } else if (returnedList.size() > 0) {
+                if (returnList.size() > 0
+                        && !ElementListUtils.startsWithForcedBreak(returnedList)) {
                     addInBetweenBreak(returnList, context, childLC);
                 }
-                if (returnedList.size() > 0) {
-                    returnList.addAll(returnedList);
-                    if (ElementListUtils.endsWithForcedBreak(returnList)) {
-                        if (curLM.isFinished() && !hasNextChildLM()) {
-                            //If the layout manager is finished at this point, the pending
-                            //marks become irrelevant.
-                            childLC.clearPendingMarks();
-                            //setFinished(true);
-                            break;
-                        }
-                        // a descendant of this flow has break-after
-                        SpaceResolver.resolveElementList(returnList);
-                        return returnList;
+                returnList.addAll(returnedList);
+                if (ElementListUtils.endsWithForcedBreak(returnList)) {
+                    if (curLM.isFinished() && !hasNextChildLM()) {
+                        //If the layout manager is finished at this point, the pending
+                        //marks become irrelevant.
+                        childLC.clearPendingMarks();
+                        //setFinished(true);
+                        break;
                     }
+                    // a descendant of this flow has break-after
+                    SpaceResolver.resolveElementList(returnList);
+                    return returnList;
                 }
             }
 

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageBreaker.java Tue Apr 14 11:35:08 2009
@@ -273,7 +273,8 @@
             //Get page break from which we restart
             PageBreakPosition pbp = (PageBreakPosition)
                     alg.getPageBreaks().get(restartPoint - 1);
-            newStartPos = pbp.getLeafPos();
+            //Set starting position to the first element *after* the page-break
+            newStartPos = pbp.getLeafPos() + 1;
             //Handle page break right here to avoid any side-effects
             if (newStartPos > 0) {
                 handleBreakTrait(Constants.EN_PAGE);
@@ -306,16 +307,15 @@
                     1, true, BreakingAlgorithm.ALL_BREAKS);
         AbstractBreaker.log.debug("restart: iOptPageCount= " + iOptPageCount
                 + " pageBreaks.size()= " + algRestart.getPageBreaks().size());
+        //Make sure we only add the areas we haven't added already
+        effectiveList.ignoreAtStart = newStartPos;
         boolean replaceLastPage
                 = iOptPageCount <= pslm.getCurrentPV().getBodyRegion().getColumnCount();
         if (replaceLastPage) {
             //Replace last page
             pslm.setCurrentPage(pageProvider.getPage(false, currentPageNum));
-            //Make sure we only add the areas we haven't added already
-            effectiveList.ignoreAtStart = newStartPos;
             addAreas(algRestart, iOptPageCount, originalList, effectiveList);
         } else {
-            effectiveList.ignoreAtStart = newStartPos;
             addAreas(alg, restartPoint, partCount - restartPoint, originalList, effectiveList);
             //Add blank last page
             pageProvider.setLastPageIndex(currentPageNum + 1);
@@ -430,8 +430,8 @@
                         childLC);
             }
             // set the offset from the top margin
-            Footnote parentArea = (Footnote) pslm.getCurrentPV().getBodyRegion().getFootnote();
-            int topOffset = (int) pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD();
+            Footnote parentArea = pslm.getCurrentPV().getBodyRegion().getFootnote();
+            int topOffset = pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD();
             if (separatorArea != null) {
                 topOffset -= separatorArea.getBPD();
             }
@@ -451,7 +451,7 @@
     /** {@inheritDoc} */
     protected void observeElementList(List elementList) {
         ElementListObserver.observe(elementList, "breaker",
-                ((PageSequence)pslm.getFObj()).getId());
+                pslm.getFObj().getId());
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -92,6 +92,7 @@
         AreaTreeModel areaTreeModel = areaTreeHandler.getAreaTreeModel();
         org.apache.fop.area.PageSequence pageSequenceAreaObject
                 = new org.apache.fop.area.PageSequence(title);
+        transferExtensions(pageSequenceAreaObject);
         pageSequenceAreaObject.setLanguage(getPageSequence().getLanguage());
         pageSequenceAreaObject.setCountry(getPageSequence().getCountry());
         areaTreeModel.startPageSequence(pageSequenceAreaObject);

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -121,16 +121,15 @@
                     = new org.apache.fop.area.inline.Leader();
                 leader.setRuleStyle(fobj.getRuleStyle());
                 leader.setRuleThickness(fobj.getRuleThickness().getValue(this));
-                leader.setBPD(fobj.getRuleThickness().getValue(this));
                 leaderArea = leader;
             } else {
                 leaderArea = new Space();
-                leaderArea.setBPD(1);
             }
+            leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
             leaderArea.addTrait(Trait.COLOR, fobj.getColor());
         } else if (fobj.getLeaderPattern() == EN_SPACE) {
             leaderArea = new Space();
-            leaderArea.setBPD(1);
+            leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
         } else if (fobj.getLeaderPattern() == EN_DOTS) {
             TextArea t = new TextArea();
             char dot = '.'; // userAgent.getLeaderDotCharacter();
@@ -198,7 +197,7 @@
             } else {
                 //Content collapsed to nothing, so use a space
                 leaderArea = new Space();
-                leaderArea.setBPD(1);
+                leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
             }
         }
         TraitSetter.setProducerID(leaderArea, fobj.getId());

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Tue Apr 14 11:35:08 2009
@@ -201,8 +201,6 @@
             p.setP(0);
         }
 
-        notifyEndOfLayout();
-
         setFinished(true);
         return returnList;
     }
@@ -427,6 +425,8 @@
         flush();
 
         curBlockArea = null;
+
+        notifyEndOfLayout();
     }
 
     /** Adds background areas for the column, body and row, if any. */

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java Tue Apr 14 11:35:08 2009
@@ -33,9 +33,8 @@
     }
 
     /** {@inheritDoc} */
-    protected void setupFilterList() {
-        addDefaultFilter(PDFFilterList.FONT_FILTER);
-        super.setupFilterList();
+    protected String getDefaultFilterName() {
+        return PDFFilterList.FONT_FILTER;
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFStream.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFStream.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/AbstractPDFStream.java Tue Apr 14 11:35:08 2009
@@ -47,21 +47,23 @@
      * from outside.
      */
     protected void setupFilterList() {
-        addDefaultFilter(PDFFilterList.DEFAULT_FILTER);
+        if (!getFilterList().isInitialized()) {
+            getFilterList().addDefaultFilters(
+                getDocumentSafely().getFilterMap(),
+                getDefaultFilterName());
+        }
         prepareImplicitFilters();
         getDocument().applyEncryption(this);
     }
 
     /**
-     * Adds the default filter to the filter list if the filter list hasn't been initialized, yet.
-     * @param filterName the name of the default filter to use
+     * Returns the name of a suitable filter for this PDF object.
+     *
+     * @return the default filter
+     * @see PDFFilterList
      */
-    protected void addDefaultFilter(String filterName) {
-        if (!getFilterList().isInitialized()) {
-            getFilterList().addDefaultFilters(
-                getDocumentSafely().getFilterMap(),
-                filterName);
-        }
+    protected String getDefaultFilterName() {
+        return PDFFilterList.DEFAULT_FILTER;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFImageXObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFImageXObject.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFImageXObject.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFImageXObject.java Tue Apr 14 11:35:08 2009
@@ -159,14 +159,11 @@
     }
 
     /**
-     * This sets up the default filters for XObjects. It uses the PDFImage
-     * instance to determine what default filters to apply.
      * {@inheritDoc}
+     * This class uses the PDFImage instance to determine the default filter.
      */
-    protected void setupFilterList() {
-        addDefaultFilter(pdfimage.getFilterHint());
-        super.setupFilterList();
+    protected String getDefaultFilterName() {
+        return pdfimage.getFilterHint();
     }
 
-
 }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFMetadata.java?rev=764744&r1=764743&r2=764744&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFMetadata.java Tue Apr 14 11:35:08 2009
@@ -59,9 +59,8 @@
     }
 
     /** {@inheritDoc} */
-    protected void setupFilterList() {
-        addDefaultFilter(PDFFilterList.METADATA_FILTER);
-        super.setupFilterList();
+    protected String getDefaultFilterName() {
+        return PDFFilterList.METADATA_FILTER;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message