xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spepp...@apache.org
Subject svn commit: r627882 [16/41] - in /xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ examples/embedding/xml/xml/ examples/fo/ examples/...
Date Thu, 14 Feb 2008 21:57:53 GMT
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java Thu Feb 14 13:55:44 2008
@@ -1,110 +1,110 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: $ */
-
-package org.apache.fop.render.ps;
-
-/**
- * Postscript page device dictionary object
- * 
- * This object is used by the postscript renderer to hold postscript page device
- * values.  It can also be used to minimize the number of setpagedevice calls when
- * DSC compliance is false.
- */
-public class PSPageDeviceDictionary extends PSDictionary {
-    
-    private static final long serialVersionUID = 845943256485806509L;
-
-    /**
-     * Whether or not the contents of the dictionary are flushed on retrieval
-     */
-    private boolean flushOnRetrieval = false;
-
-    /**
-     * Dictionary content that has not been output/written yet
-     */
-    private PSDictionary unRetrievedContentDictionary;
-
-    /**
-     * @param key key with which the specified value is to be associated.
-     * @param value value to be associated with the specified key.
-     * @return the previous value associated with the key or null
-     * @see java.util.Map#put(Object, Object)
-     */
-    public Object put(Object key, Object value) {
-        Object previousValue = super.put(key, value);
-        if (flushOnRetrieval) {
-            if (previousValue == null || !previousValue.equals(value)) {
-                unRetrievedContentDictionary.put(key, value);
-            }
-        }
-        return previousValue;
-    }
-
-    /**
-     * @see java.util.Map#clear()
-     */
-    public void clear() {
-        super.clear();
-        if (unRetrievedContentDictionary != null) {
-            unRetrievedContentDictionary.clear();
-        }
-    }
-
-    /**
-     * Returns <tt>true</tt> if this map contains no key-value mappings.
-     *
-     * @return <tt>true</tt> if this map contains no key-value mappings.
-     */
-    public boolean isEmpty() {
-        if (flushOnRetrieval) {
-            return unRetrievedContentDictionary.isEmpty();
-        }
-        return super.isEmpty();
-    }
-
-    /**
-     * The contents of the dictionary are flushed when written
-     * @param flushOnRetrieval boolean value
-     */
-    public void setFlushOnRetrieval(boolean flushOnRetrieval) {
-        this.flushOnRetrieval = flushOnRetrieval;
-        if (flushOnRetrieval) {
-            unRetrievedContentDictionary = new PSDictionary();
-        }
-    }
-    
-    /**
-     * Returns a dictionary string with containing all unwritten content note:
-     * unnecessary writes are important as there is a device specific
-     * initgraphics call by the underlying postscript interpreter on every
-     * setpagedevice call which can result in blank pages etc.
-     * 
-     * @return unwritten content dictionary string
-     */
-    public String getContent() {
-        String content;
-        if (flushOnRetrieval) {
-            content = unRetrievedContentDictionary.toString();
-            unRetrievedContentDictionary.clear();
-        } else {
-            content = super.toString();
-        }
-        return content;
-    }    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps;
+
+/**
+ * Postscript page device dictionary object
+ * 
+ * This object is used by the postscript renderer to hold postscript page device
+ * values.  It can also be used to minimize the number of setpagedevice calls when
+ * DSC compliance is false.
+ */
+public class PSPageDeviceDictionary extends PSDictionary {
+    
+    private static final long serialVersionUID = 845943256485806509L;
+
+    /**
+     * Whether or not the contents of the dictionary are flushed on retrieval
+     */
+    private boolean flushOnRetrieval = false;
+
+    /**
+     * Dictionary content that has not been output/written yet
+     */
+    private PSDictionary unRetrievedContentDictionary;
+
+    /**
+     * @param key key with which the specified value is to be associated.
+     * @param value value to be associated with the specified key.
+     * @return the previous value associated with the key or null
+     * @see java.util.Map#put(Object, Object)
+     */
+    public Object put(Object key, Object value) {
+        Object previousValue = super.put(key, value);
+        if (flushOnRetrieval) {
+            if (previousValue == null || !previousValue.equals(value)) {
+                unRetrievedContentDictionary.put(key, value);
+            }
+        }
+        return previousValue;
+    }
+
+    /**
+     * @see java.util.Map#clear()
+     */
+    public void clear() {
+        super.clear();
+        if (unRetrievedContentDictionary != null) {
+            unRetrievedContentDictionary.clear();
+        }
+    }
+
+    /**
+     * Returns <tt>true</tt> if this map contains no key-value mappings.
+     *
+     * @return <tt>true</tt> if this map contains no key-value mappings.
+     */
+    public boolean isEmpty() {
+        if (flushOnRetrieval) {
+            return unRetrievedContentDictionary.isEmpty();
+        }
+        return super.isEmpty();
+    }
+
+    /**
+     * The contents of the dictionary are flushed when written
+     * @param flushOnRetrieval boolean value
+     */
+    public void setFlushOnRetrieval(boolean flushOnRetrieval) {
+        this.flushOnRetrieval = flushOnRetrieval;
+        if (flushOnRetrieval) {
+            unRetrievedContentDictionary = new PSDictionary();
+        }
+    }
+    
+    /**
+     * Returns a dictionary string with containing all unwritten content note:
+     * unnecessary writes are important as there is a device specific
+     * initgraphics call by the underlying postscript interpreter on every
+     * setpagedevice call which can result in blank pages etc.
+     * 
+     * @return unwritten content dictionary string
+     */
+    public String getContent() {
+        String content;
+        if (flushOnRetrieval) {
+            content = unRetrievedContentDictionary.toString();
+            unRetrievedContentDictionary.clear();
+        } else {
+            content = super.toString();
+        }
+        return content;
+    }    
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSPageDeviceDictionary.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java Thu Feb 14 13:55:44 2008
@@ -21,9 +21,11 @@
 
 // Java
 import java.awt.Color;
+import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.RenderedImage;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.LineNumberReader;
@@ -35,14 +37,28 @@
 
 import javax.xml.transform.Source;
 
-import org.w3c.dom.Document;
-
 import org.apache.commons.io.IOUtils;
 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.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
+import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
+import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
+import org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
 import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.ImageEncoder;
 import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSImageUtils;
 import org.apache.xmlgraphics.ps.PSProcSets;
 import org.apache.xmlgraphics.ps.PSResource;
 import org.apache.xmlgraphics.ps.PSState;
@@ -56,7 +72,6 @@
 import org.apache.fop.area.Area;
 import org.apache.fop.area.BlockViewport;
 import org.apache.fop.area.CTM;
-import org.apache.fop.area.LineArea;
 import org.apache.fop.area.OffDocumentExtensionAttachment;
 import org.apache.fop.area.OffDocumentItem;
 import org.apache.fop.area.PageViewport;
@@ -69,15 +84,12 @@
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.area.inline.TextArea;
 import org.apache.fop.area.inline.WordArea;
+import org.apache.fop.datatypes.URISpecification;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.LazyFont;
 import org.apache.fop.fonts.Typeface;
-import org.apache.fop.image.EPSImage;
-import org.apache.fop.image.FopImage;
-import org.apache.fop.image.ImageFactory;
-import org.apache.fop.image.XMLImage;
 import org.apache.fop.render.AbstractPathOrientedRenderer;
 import org.apache.fop.render.Graphics2DAdapter;
 import org.apache.fop.render.ImageAdapter;
@@ -108,7 +120,8 @@
  * @author <a href="mailto:fop-dev@xmlgraphics.apache.org">Apache FOP Development Team</a>
  * @version $Id$
  */
-public class PSRenderer extends AbstractPathOrientedRenderer implements ImageAdapter {
+public class PSRenderer extends AbstractPathOrientedRenderer
+            implements ImageAdapter, PSSupportedFlavors {
 
     /** logging instance */
     private static Log log = LogFactory.getLog(PSRenderer.class);
@@ -313,15 +326,7 @@
         writeln("clip newpath");
     }
     
-    /**
-     * Clip an area.
-     * Write a clipping operation given coordinates in the current
-     * transform.
-     * @param x the x coordinate
-     * @param y the y coordinate
-     * @param width the width of the area
-     * @param height the height of the area
-     */
+    /** {@inheritDoc} */
     protected void clipRect(float x, float y, float width, float height) {
         try {
             gen.defineRect(x, y, width, height);
@@ -377,58 +382,183 @@
         }
     }
 
+    /**
+     * Indicates whether an image should be inlined or added as a PostScript form.
+     * @param uri the URI of the image
+     * @return true if the image should be inlined rather than added as a form
+     */
+    protected boolean isImageInlined(String uri) {
+        return !isOptimizeResources() || uri == null || "".equals(uri);
+    }
+    
+    /**
+     * Indicates whether an image should be inlined or added as a PostScript form.
+     * @param info the ImageInfo object of the image
+     * @return true if the image should be inlined rather than added as a form
+     */
+    protected boolean isImageInlined(ImageInfo info) {
+        if (isImageInlined(info.getOriginalURI())) {
+            return true;
+        }
+        
+        if (!isOptimizeResources()) {
+            throw new IllegalStateException("Must not get here if form support is enabled");
+        }
+
+        //Investigate choice for inline mode
+        ImageFlavor[] inlineFlavors = getInlineFlavors();
+        ImageManager manager = getUserAgent().getFactory().getImageManager();
+        ImageProviderPipeline[] inlineCandidates
+            = manager.getPipelineFactory().determineCandidatePipelines(
+                    info, inlineFlavors);
+        ImageProviderPipeline inlineChoice = manager.choosePipeline(inlineCandidates);
+        ImageFlavor inlineFlavor = (inlineChoice != null ? inlineChoice.getTargetFlavor() : null);
+        
+        //Investigate choice for form mode
+        ImageFlavor[] formFlavors = getFormFlavors();
+        ImageProviderPipeline[] formCandidates
+            = manager.getPipelineFactory().determineCandidatePipelines(
+                    info, formFlavors);
+        ImageProviderPipeline formChoice = manager.choosePipeline(formCandidates);
+        ImageFlavor formFlavor = (formChoice != null ? formChoice.getTargetFlavor() : null);
+        
+        //Inline if form is not supported or if a better choice is available with inline mode
+        return formFlavor == null || !formFlavor.equals(inlineFlavor);
+    }
+    
     /** {@inheritDoc} */
     protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
         endTextObject();
-        uri = ImageFactory.getURL(uri);
-        ImageFactory fact = userAgent.getFactory().getImageFactory();
-        FopImage fopimage = fact.getImage(uri, userAgent);
-        if (fopimage == null) {
-            return;
-        }
-        if (!fopimage.load(FopImage.DIMENSIONS)) {
-            return;
+        int x = currentIPPosition + (int)Math.round(pos.getX());
+        int y = currentBPPosition + (int)Math.round(pos.getY());
+        uri = URISpecification.getURL(uri);
+        if (log.isDebugEnabled()) {
+            log.debug("Handling image: " + uri);
         }
-        float x = (float)pos.getX() / 1000f;
-        x += currentIPPosition / 1000f;
-        float y = (float)pos.getY() / 1000f;
-        y += currentBPPosition / 1000f;
-        float w = (float)pos.getWidth() / 1000f;
-        float h = (float)pos.getHeight() / 1000f;
+        
+        ImageManager manager = getUserAgent().getFactory().getImageManager();
+        ImageInfo info = null;
         try {
-            String mime = fopimage.getMimeType();
-            if ("text/xml".equals(mime)) {
-                if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
-                    return;
+            ImageSessionContext sessionContext = getUserAgent().getImageSessionContext();
+            info = manager.getImageInfo(uri, sessionContext);
+            int width = (int)pos.getWidth();
+            int height = (int)pos.getHeight();
+            
+            //millipoints --> points for PostScript
+            float ptx = x / 1000f;
+            float pty = y / 1000f;
+            float ptw = width / 1000f;
+            float pth = height / 1000f;
+
+            if (isImageInlined(info)) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Image " + info + " is inlined");
                 }
-                Document doc = ((XMLImage) fopimage).getDocument();
-                String ns = ((XMLImage) fopimage).getNameSpace();
-
-                renderDocument(doc, ns, pos, foreignAttributes);
-            } else if ("image/svg+xml".equals(mime)) {
-                if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
-                    return;
+                //Only now fully load/prepare the image
+                Map hints = ImageUtil.getDefaultHints(sessionContext);
+                org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
+                        info, getInlineFlavors(), hints, sessionContext);
+                
+                //...and embed as inline image
+                if (img instanceof ImageGraphics2D) {
+                    ImageGraphics2D imageG2D = (ImageGraphics2D)img;
+                    RendererContext context = createRendererContext(
+                            x, y, width, height, foreignAttributes);
+                    getGraphics2DAdapter().paintImage(imageG2D.getGraphics2DImagePainter(),
+                            context, x, y, width, height);
+                } else if (img instanceof ImageRendered) {
+                    ImageRendered imgRend = (ImageRendered)img;
+                    RenderedImage ri = imgRend.getRenderedImage();
+                    PSImageUtils.renderBitmapImage(ri, ptx, pty, ptw, pth, gen);
+                } else if (img instanceof ImageXMLDOM) {
+                    ImageXMLDOM imgXML = (ImageXMLDOM)img;
+                    renderDocument(imgXML.getDocument(), imgXML.getRootNamespace(),
+                            pos, foreignAttributes);
+                } else if (img instanceof ImageRawStream) {
+                    final ImageRawStream raw = (ImageRawStream)img;
+                    if (raw instanceof ImageRawEPS) {
+                        ImageRawEPS eps = (ImageRawEPS)raw;
+                        Rectangle2D bbox = eps.getBoundingBox(); 
+                        InputStream in = raw.createInputStream();
+                        try {
+                            PSImageUtils.renderEPS(in, uri,
+                                    new Rectangle2D.Float(ptx, pty, ptw, pth),
+                                    bbox,
+                                    gen);
+                        } finally {
+                            IOUtils.closeQuietly(in);
+                        }
+                    } else if (raw instanceof ImageRawCCITTFax) {
+                        final ImageRawCCITTFax ccitt = (ImageRawCCITTFax)raw;
+                        ImageEncoder encoder = new ImageEncoderCCITTFax(ccitt);
+                        Rectangle2D targetRect = new Rectangle2D.Float(
+                                ptx, pty, ptw, pth);
+                        PSImageUtils.writeImage(encoder, info.getSize().getDimensionPx(),
+                                uri, targetRect,
+                                ccitt.getColorSpace(), 1, false, gen);
+                    } else if (raw instanceof ImageRawJPEG) {
+                        ImageRawJPEG jpeg = (ImageRawJPEG)raw;
+                        ImageEncoder encoder = new ImageEncoderJPEG(jpeg);
+                        Rectangle2D targetRect = new Rectangle2D.Float(
+                                ptx, pty, ptw, pth);
+                        PSImageUtils.writeImage(encoder, info.getSize().getDimensionPx(),
+                                uri, targetRect,
+                                jpeg.getColorSpace(), 8, jpeg.isInverted(), gen);
+                    } else {
+                        throw new UnsupportedOperationException("Unsupported raw image: " + info);
+                    }
+                } else {
+                    throw new UnsupportedOperationException("Unsupported image type: " + img);
                 }
-                Document doc = ((XMLImage) fopimage).getDocument();
-                String ns = ((XMLImage) fopimage).getNameSpace();
-
-                renderDocument(doc, ns, pos, foreignAttributes);
-            } else if (fopimage instanceof EPSImage) {
-                PSImageUtils.renderEPS((EPSImage)fopimage, x, y, w, h, gen);
             } else {
-                if (isImageInlined(uri, fopimage)) {
-                    PSImageUtils.renderBitmapImage(fopimage, x, y, w, h, gen);
-                } else {
-                    PSResource form = getFormForImage(uri, fopimage);
-                    PSImageUtils.renderForm(fopimage, form, x, y, w, h, gen);
+                if (log.isDebugEnabled()) {
+                    log.debug("Image " + info + " is embedded as a form later");
                 }
+                //Don't load image at this time, just put a form placeholder in the stream
+                PSResource form = getFormForImage(uri);   
+                Rectangle2D targetRect = new Rectangle2D.Double(ptx, pty, ptw, pth);
+                PSImageUtils.paintForm(form, info.getSize().getDimensionPt(), targetRect, gen);   
             }
+
+        } catch (ImageException ie) {
+            log.error("Error while processing image: "
+                    + (info != null ? info.toString() : uri), ie);
+        } catch (FileNotFoundException fe) {
+            log.error(fe.getMessage());
         } catch (IOException ioe) {
             handleIOTrouble(ioe);
         }
     }
 
-    protected PSResource getFormForImage(String uri, FopImage fopimage) {
+    private ImageFlavor[] getInlineFlavors() {
+        ImageFlavor[] flavors;
+        if (gen.getPSLevel() >= 3) {
+            flavors = LEVEL_3_FLAVORS_INLINE;
+        } else {
+            flavors = LEVEL_2_FLAVORS_INLINE;
+        }
+        return flavors;
+    }
+
+    private ImageFlavor[] getFormFlavors() {
+        ImageFlavor[] flavors;
+        if (gen.getPSLevel() >= 3) {
+            flavors = LEVEL_3_FLAVORS_FORM;
+        } else {
+            flavors = LEVEL_2_FLAVORS_FORM;
+        }
+        return flavors;
+    }
+
+    /**
+     * Returns a PSResource instance representing a image as a PostScript form.
+     * @param uri the image URI
+     * @return a PSResource instance
+     */
+    protected PSResource getFormForImage(String uri) {
+        if (uri == null || "".equals(uri)) {
+            throw new IllegalArgumentException("uri must not be empty or null");
+        }
         if (this.formResources == null) {
             this.formResources = new java.util.HashMap();
         }
@@ -439,11 +569,7 @@
         }
         return form;
     }
-    
-    protected boolean isImageInlined(String uri, FopImage image) {
-        return !isOptimizeResources();
-    }
-    
+
     /** {@inheritDoc} */
     public void paintImage(RenderedImage image, RendererContext context, 
             int x, int y, int width, int height) throws IOException {
@@ -485,6 +611,7 @@
     /** Restores the last graphics state of the rendering engine. */
     public void restoreGraphicsState() {
         try {
+            endTextObject();
             //delegate
             gen.restoreGraphicsState();
         } catch (IOException ioe) {
@@ -523,6 +650,15 @@
         }
     }
 
+    /** {@inheritDoc} */
+    protected void concatenateTransformationMatrix(AffineTransform at) {
+        try {
+            gen.concatMatrix(at);
+        } catch (IOException ioe) {
+            handleIOTrouble(ioe);
+        }
+    }
+    
     private String getPostScriptNameForFontKey(String key) {
         Map fonts = fontInfo.getFonts();
         Typeface tf = (Typeface)fonts.get(key);
@@ -945,11 +1081,6 @@
         super.processOffDocumentItem(oDI);
     }
     
-    /** {@inheritDoc} */
-    public void startPageSequence(LineArea seqTitle) {
-        super.startPageSequence(seqTitle);
-    }
-    
     /**
      * Formats and writes a List of PSSetupCode instances to the output stream.
      * @param setupCodeList a List of PSSetupCode instances
@@ -1150,9 +1281,9 @@
     /** Indicates the end of a text object. */
     protected void endTextObject() {
         if (inTextMode) {
+            inTextMode = false; //set before restoreGraphicsState() to avoid recursion
             writeln("ET");
             restoreGraphicsState();
-            inTextMode = false;
         }
     }
 
@@ -1332,7 +1463,6 @@
      * {@inheritDoc}
      */
     protected void endVParea() {
-        endTextObject();
         restoreGraphicsState();
     }
 

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java Thu Feb 14 13:55:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render.ps;
 

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererMaker.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererMaker.java Thu Feb 14 13:55:44 2008
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.ps;
-
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.render.AbstractRendererMaker;
-import org.apache.fop.render.Renderer;
-import org.apache.fop.render.RendererConfigurator;
-
-/**
- * RendererMaker for the PostScript Renderer.
- */
-public class PSRendererMaker extends AbstractRendererMaker {
-
-    private static final String[] MIMES = new String[] {MimeConstants.MIME_POSTSCRIPT};
-    
-    /** {@inheritDoc} */
-    public Renderer makeRenderer(FOUserAgent userAgent) {
-        return new PSRenderer();
-    }
-
-    /** {@inheritDoc} */
-    public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
-        return new PSRendererConfigurator(userAgent);
-    }
-
-    /** {@inheritDoc} */
-    public boolean needsOutputStream() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public String[] getSupportedMimeTypes() {
-        return MIMES;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps;
+
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.AbstractRendererMaker;
+import org.apache.fop.render.Renderer;
+import org.apache.fop.render.RendererConfigurator;
+
+/**
+ * RendererMaker for the PostScript Renderer.
+ */
+public class PSRendererMaker extends AbstractRendererMaker {
+
+    private static final String[] MIMES = new String[] {MimeConstants.MIME_POSTSCRIPT};
+    
+    /** {@inheritDoc} */
+    public Renderer makeRenderer(FOUserAgent userAgent) {
+        return new PSRenderer();
+    }
+
+    /** {@inheritDoc} */
+    public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
+        return new PSRendererConfigurator(userAgent);
+    }
+
+    /** {@inheritDoc} */
+    public boolean needsOutputStream() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    public String[] getSupportedMimeTypes() {
+        return MIMES;
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRendererMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java Thu Feb 14 13:55:44 2008
@@ -19,6 +19,8 @@
 
 package org.apache.fop.render.ps;
 
+import java.awt.geom.Dimension2D;
+import java.awt.image.RenderedImage;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.io.InputStream;
@@ -27,8 +29,25 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.xmlgraphics.image.loader.ImageException;
+import org.apache.xmlgraphics.image.loader.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
+import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
+import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
 import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.FormGenerator;
+import org.apache.xmlgraphics.ps.ImageEncoder;
+import org.apache.xmlgraphics.ps.ImageFormGenerator;
 import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSProcSets;
 import org.apache.xmlgraphics.ps.dsc.DSCException;
 import org.apache.xmlgraphics.ps.dsc.DSCFilter;
 import org.apache.xmlgraphics.ps.dsc.DSCParser;
@@ -50,8 +69,6 @@
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.image.FopImage;
-import org.apache.fop.image.ImageFactory;
 
 /**
  * This class is used when two-pass production is used to generate the PostScript file (setting
@@ -59,7 +76,7 @@
  * temporary file generated by the PSRenderer and adds all used fonts and images as resources
  * to the PostScript file.
  */
-public class ResourceHandler implements DSCParserConstants {
+public class ResourceHandler implements DSCParserConstants, PSSupportedFlavors {
 
     /**
      * Rewrites the temporary PostScript file generated by PSRenderer adding all needed resources
@@ -208,13 +225,129 @@
         Iterator iter = formResources.values().iterator();
         while (iter.hasNext()) {
             PSImageFormResource form = (PSImageFormResource)iter.next();
-            ImageFactory fact = userAgent.getFactory().getImageFactory();
-            FopImage image = fact.getImage(form.getImageURI(), userAgent);
-            if (image == null) {
-                throw new NullPointerException("Image not found: " + form.getImageURI());
+            final String uri = form.getImageURI();
+            
+            ImageManager manager = userAgent.getFactory().getImageManager();
+            ImageInfo info = null;
+            try {
+                ImageSessionContext sessionContext = userAgent.getImageSessionContext();
+                info = manager.getImageInfo(uri, sessionContext);
+                
+                ImageFlavor[] flavors;
+                if (gen.getPSLevel() >= 3) {
+                    flavors = LEVEL_3_FLAVORS_FORM;
+                } else {
+                    flavors = LEVEL_2_FLAVORS_FORM;
+                }
+                Map hints = ImageUtil.getDefaultHints(sessionContext);
+                org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
+                        info, flavors, hints, sessionContext);
+                
+                String imageDescription = info.getMimeType() + " " + info.getOriginalURI();
+                final Dimension2D dimensionsPt = info.getSize().getDimensionPt();
+                final Dimension2D dimensionsMpt = info.getSize().getDimensionMpt();
+
+                if (img instanceof ImageGraphics2D) {
+                    final ImageGraphics2D imageG2D = (ImageGraphics2D)img;
+                    FormGenerator formGen = new FormGenerator(
+                            form.getName(), imageDescription, dimensionsPt) {
+
+                        protected void generatePaintProc(PSGenerator gen)
+                                throws IOException {
+                            gen.getResourceTracker().notifyResourceUsageOnPage(
+                                    PSProcSets.EPS_PROCSET);
+                            gen.writeln("BeginEPSF");
+                            PSGraphics2DAdapter adapter = new PSGraphics2DAdapter(gen, false);
+                            adapter.paintImage(imageG2D.getGraphics2DImagePainter(),
+                                    null,
+                                    0, 0, 
+                                    (int)Math.round(dimensionsMpt.getWidth()),
+                                    (int)Math.round(dimensionsMpt.getHeight()));
+                            gen.writeln("EndEPSF");
+                        }
+                        
+                    };
+                    formGen.generate(gen);
+                } else if (img instanceof ImageRendered) {
+                    ImageRendered imgRend = (ImageRendered)img;
+                    RenderedImage ri = imgRend.getRenderedImage();
+                    FormGenerator formGen = new ImageFormGenerator(
+                            form.getName(), imageDescription,
+                            info.getSize().getDimensionPt(),
+                            ri, false);
+                    formGen.generate(gen);
+                } else if (img instanceof ImageXMLDOM) {
+                    throw new UnsupportedOperationException(
+                            "Embedding an ImageXMLDOM as a form isn't supported, yet");
+                } else if (img instanceof ImageRawStream) {
+                    final ImageRawStream raw = (ImageRawStream)img;
+                    if (raw instanceof ImageRawEPS) {
+                        final ImageRawEPS eps = (ImageRawEPS)raw;
+                        throw new UnsupportedOperationException(
+                                "Embedding EPS as forms isn't supported, yet");
+                        /*
+                        InputStream in = eps.createInputStream();
+                        try {
+                            FormGenerator formGen = new EPSFormGenerator(form.getName(),
+                                    imageDescription, dimensions, in);
+                            formGen.generate(gen);
+                        } finally {
+                            IOUtils.closeQuietly(in);
+                        }*/
+                    } else if (raw instanceof ImageRawCCITTFax) {
+                        ImageRawCCITTFax jpeg = (ImageRawCCITTFax)raw;
+                        ImageEncoder encoder = new ImageEncoderCCITTFax(jpeg);
+                        FormGenerator formGen = new ImageFormGenerator(
+                                form.getName(), imageDescription,
+                                info.getSize().getDimensionPt(),
+                                info.getSize().getDimensionPx(),
+                                encoder,
+                                jpeg.getColorSpace(), 1, false);
+                        formGen.generate(gen);
+                    } else if (raw instanceof ImageRawJPEG) {
+                        ImageRawJPEG jpeg = (ImageRawJPEG)raw;
+                        ImageEncoder encoder = new ImageEncoderJPEG(jpeg);
+                        FormGenerator formGen = new ImageFormGenerator(
+                                form.getName(), imageDescription,
+                                info.getSize().getDimensionPt(),
+                                info.getSize().getDimensionPx(),
+                                encoder,
+                                jpeg.getColorSpace(), jpeg.isInverted());
+                        formGen.generate(gen);
+                    } else {
+                        throw new UnsupportedOperationException("Unsupported raw image: " + info);
+                    }
+                } else {
+                    throw new UnsupportedOperationException("Unsupported image type: " + img);
+                }
+            } catch (ImageException ie) {
+                throw new IOException("Error while generating form for image: " + ie.getMessage());
             }
-            PSImageUtils.generateFormResourceForImage(image, form, gen);
         }
     }
 
+    private static FormGenerator createMissingForm(String formName, final Dimension2D dimensions) {
+        FormGenerator formGen = new FormGenerator(formName, null, dimensions) {
+
+            protected void generatePaintProc(PSGenerator gen) throws IOException {
+                gen.writeln("0 setgray");
+                gen.writeln("0 setlinewidth");
+                String w = gen.formatDouble(dimensions.getWidth());
+                String h = gen.formatDouble(dimensions.getHeight());
+                gen.writeln(w + " " + h  + " scale");
+                gen.writeln("0 0 1 1 rectstroke");
+                gen.writeln("newpath");
+                gen.writeln("0 0 moveto");
+                gen.writeln("1 1 lineto");
+                gen.writeln("stroke");
+                gen.writeln("newpath");
+                gen.writeln("0 1 moveto");
+                gen.writeln("1 0 lineto");
+                gen.writeln("stroke");
+            }
+            
+        };
+        return formGen;
+    }
+    
 }

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java Thu Feb 14 13:55:44 2008
@@ -1,133 +1,133 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: AbstractPSExtensionObject.java 426576 2006-07-28 15:44:37Z jeremias $ */
- 
-package org.apache.fop.render.ps.extensions;
-
-// FOP
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.extensions.ExtensionAttachment;
-
-import org.xml.sax.Locator;
-
-/**
- * Base class for the PostScript-specific extension elements.
- */
-public abstract class AbstractPSExtensionElement extends FONode {
-
-    /**
-     * extension attachment
-     */
-    protected PSExtensionAttachment attachment;
-    
-    /**
-     * Default constructor
-     * 
-     * @param parent parent of this node
-     * @see org.apache.fop.fo.FONode#FONode(FONode)
-     */
-    public AbstractPSExtensionElement(FONode parent) {
-        super(parent);
-    }
-
-    /**
-     * Blocks XSL FO's from having non-FO parents.
-     * 
-     * @param loc location in the FO source file
-     * @param nsURI namespace of incoming node
-     * @param localName (e.g. "table" for "fo:table")
-     * @throws ValidationException if incoming node not valid for parent
-     * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
-     */
-    protected void validateChildNode(Locator loc, String nsURI, String localName) 
-                throws ValidationException {
-        if (FO_URI.equals(nsURI)) {
-            invalidChildError(loc, nsURI, localName);
-        }
-    }
-
-    /**
-     * Adds characters (does nothing here)
-     * @param data array of characters containing text to be added
-     * @param start starting array element to add
-     * @param length of data array to add
-     * @param pList currently applicable PropertyList 
-     * @param locator location in fo source file.
-     * @see org.apache.fop.fo.FONode#addCharacters(char[], int, int, PropertyList, Locator)
-     */
-    protected void addCharacters(char[] data, int start, int length,
-                                 PropertyList pList, Locator locator) {
-        PSExtensionAttachment a = (PSExtensionAttachment)getExtensionAttachment();
-        if (a.getContent() != null) {
-            StringBuffer sb = new StringBuffer(a.getContent());
-            sb.append(data, start, length - start);
-            a.setContent(sb.toString());
-        } else {
-            a.setContent(new String(data, start, length - start));
-        }
-    }
-
-    /**
-     * @return a String representation of this object
-     * @see org.apache.fop.fo.FONode#getNamespaceURI()
-     */
-    public String getNamespaceURI() {
-        return PSExtensionElementMapping.NAMESPACE;
-    }
-    
-    /**
-     * @return a String representation of this object
-     * @see org.apache.fop.fo.FONode#getNormalNamespacePrefix()
-     */
-    public String getNormalNamespacePrefix() {
-        return "fox";
-    }
-
-    /**
-     * @see org.apache.fop.fo.FONode#endOfNode()
-     * @throws FOPException if there's a problem during processing
-     */
-    protected void endOfNode() throws FOPException {
-        super.endOfNode();
-        String s = ((PSExtensionAttachment)getExtensionAttachment()).getContent();
-        if (s == null || s.length() == 0) {
-            missingChildElementError("#PCDATA");
-        }
-    }
-    
-    /**
-     * @return the extension attachment if one is created by the extension element, null otherwise.
-     * @see org.apache.fop.fo.FONode#getExtensionAttachment()
-     */
-    public ExtensionAttachment getExtensionAttachment() {
-        if (attachment == null) {
-            this.attachment = (PSExtensionAttachment)instantiateExtensionAttachment();
-        }
-        return this.attachment;
-    }
-    
-    /**
-     * Instantiates extension attachment object
-     * @return extension attachment
-     */
-    protected abstract ExtensionAttachment instantiateExtensionAttachment();
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+ 
+package org.apache.fop.render.ps.extensions;
+
+// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.extensions.ExtensionAttachment;
+
+import org.xml.sax.Locator;
+
+/**
+ * Base class for the PostScript-specific extension elements.
+ */
+public abstract class AbstractPSExtensionElement extends FONode {
+
+    /**
+     * extension attachment
+     */
+    protected PSExtensionAttachment attachment;
+    
+    /**
+     * Default constructor
+     * 
+     * @param parent parent of this node
+     * @see org.apache.fop.fo.FONode#FONode(FONode)
+     */
+    public AbstractPSExtensionElement(FONode parent) {
+        super(parent);
+    }
+
+    /**
+     * Blocks XSL FO's from having non-FO parents.
+     * 
+     * @param loc location in the FO source file
+     * @param nsURI namespace of incoming node
+     * @param localName (e.g. "table" for "fo:table")
+     * @throws ValidationException if incoming node not valid for parent
+     * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+     */
+    protected void validateChildNode(Locator loc, String nsURI, String localName) 
+                throws ValidationException {
+        if (FO_URI.equals(nsURI)) {
+            invalidChildError(loc, nsURI, localName);
+        }
+    }
+
+    /**
+     * Adds characters (does nothing here)
+     * @param data array of characters containing text to be added
+     * @param start starting array element to add
+     * @param length of data array to add
+     * @param pList currently applicable PropertyList 
+     * @param locator location in fo source file.
+     * @see org.apache.fop.fo.FONode#addCharacters(char[], int, int, PropertyList, Locator)
+     */
+    protected void addCharacters(char[] data, int start, int length,
+                                 PropertyList pList, Locator locator) {
+        PSExtensionAttachment a = (PSExtensionAttachment)getExtensionAttachment();
+        if (a.getContent() != null) {
+            StringBuffer sb = new StringBuffer(a.getContent());
+            sb.append(data, start, length - start);
+            a.setContent(sb.toString());
+        } else {
+            a.setContent(new String(data, start, length - start));
+        }
+    }
+
+    /**
+     * @return a String representation of this object
+     * @see org.apache.fop.fo.FONode#getNamespaceURI()
+     */
+    public String getNamespaceURI() {
+        return PSExtensionElementMapping.NAMESPACE;
+    }
+    
+    /**
+     * @return a String representation of this object
+     * @see org.apache.fop.fo.FONode#getNormalNamespacePrefix()
+     */
+    public String getNormalNamespacePrefix() {
+        return "fox";
+    }
+
+    /**
+     * @see org.apache.fop.fo.FONode#endOfNode()
+     * @throws FOPException if there's a problem during processing
+     */
+    protected void endOfNode() throws FOPException {
+        super.endOfNode();
+        String s = ((PSExtensionAttachment)getExtensionAttachment()).getContent();
+        if (s == null || s.length() == 0) {
+            missingChildElementError("#PCDATA");
+        }
+    }
+    
+    /**
+     * @return the extension attachment if one is created by the extension element, null otherwise.
+     * @see org.apache.fop.fo.FONode#getExtensionAttachment()
+     */
+    public ExtensionAttachment getExtensionAttachment() {
+        if (attachment == null) {
+            this.attachment = (PSExtensionAttachment)instantiateExtensionAttachment();
+        }
+        return this.attachment;
+    }
+    
+    /**
+     * Instantiates extension attachment object
+     * @return extension attachment
+     */
+    protected abstract ExtensionAttachment instantiateExtensionAttachment();
+}
+

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java Thu Feb 14 13:55:44 2008
@@ -1,110 +1,110 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: $ */
-
-package org.apache.fop.render.ps.extensions;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-import org.apache.xmlgraphics.util.XMLizable;
-
-import org.apache.fop.fo.extensions.ExtensionAttachment;
-
-/**
- * This is the pass-through value object for the PostScript extension.
- */
-public abstract class PSExtensionAttachment implements ExtensionAttachment, XMLizable {
-    
-    /** extension node content */
-    protected String content;
-
-    /** The category URI for this extension attachment. */
-    public static final String CATEGORY = "apache:fop:extensions:postscript";
-
-    /**
-     * Default constructor.
-     * @param content the content of the setup code object
-     */
-    public PSExtensionAttachment(String content) {
-        this.content = content;
-    }
-
-    /**
-     * No-argument contructor.
-     */
-    public PSExtensionAttachment() {
-    }
-
-    /**
-     * @return the category URI
-     * @see org.apache.fop.fo.extensions.ExtensionAttachment#getCategory()
-     */
-    public String getCategory() {
-        return CATEGORY;
-    }
-    
-    /** @return the content */
-    public String getContent() {
-        return content;
-    }
-    
-    /**
-     * Sets the content for the setup code object.
-     * @param content The content to set.
-     */
-    public void setContent(String content) {
-        this.content = content;
-    }
-           
-    /**
-     * Generates SAX events representing the object's state.
-     * 
-     * @param handler ContentHandler instance to send the SAX events to
-     * @throws SAXException if there's a problem generating the SAX events
-     * @see org.apache.fop.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
-     */
-    public void toSAX(ContentHandler handler) throws SAXException {
-        AttributesImpl atts = new AttributesImpl();
-        String element = getElement();
-        handler.startElement(CATEGORY, element, element, atts);
-        if (content != null && content.length() > 0) {
-            char[] chars = content.toCharArray();
-            handler.characters(chars, 0, chars.length);
-        }
-        handler.endElement(CATEGORY, element, element);
-    }
-
-    /** @return type name */
-    public String getType() {
-        String className = getClass().getName();
-        return className.substring(className.lastIndexOf('.') + 3);
-    }
-    
-    /**
-     * @return a string representation of this object
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return getType() + ": content=" + content;
-    }
-
-    /** @return element */
-    protected abstract String getElement();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps.extensions;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.xmlgraphics.util.XMLizable;
+
+import org.apache.fop.fo.extensions.ExtensionAttachment;
+
+/**
+ * This is the pass-through value object for the PostScript extension.
+ */
+public abstract class PSExtensionAttachment implements ExtensionAttachment, XMLizable {
+    
+    /** extension node content */
+    protected String content;
+
+    /** The category URI for this extension attachment. */
+    public static final String CATEGORY = "apache:fop:extensions:postscript";
+
+    /**
+     * Default constructor.
+     * @param content the content of the setup code object
+     */
+    public PSExtensionAttachment(String content) {
+        this.content = content;
+    }
+
+    /**
+     * No-argument contructor.
+     */
+    public PSExtensionAttachment() {
+    }
+
+    /**
+     * @return the category URI
+     * @see org.apache.fop.fo.extensions.ExtensionAttachment#getCategory()
+     */
+    public String getCategory() {
+        return CATEGORY;
+    }
+    
+    /** @return the content */
+    public String getContent() {
+        return content;
+    }
+    
+    /**
+     * Sets the content for the setup code object.
+     * @param content The content to set.
+     */
+    public void setContent(String content) {
+        this.content = content;
+    }
+           
+    /**
+     * Generates SAX events representing the object's state.
+     * 
+     * @param handler ContentHandler instance to send the SAX events to
+     * @throws SAXException if there's a problem generating the SAX events
+     * @see org.apache.fop.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
+     */
+    public void toSAX(ContentHandler handler) throws SAXException {
+        AttributesImpl atts = new AttributesImpl();
+        String element = getElement();
+        handler.startElement(CATEGORY, element, element, atts);
+        if (content != null && content.length() > 0) {
+            char[] chars = content.toCharArray();
+            handler.characters(chars, 0, chars.length);
+        }
+        handler.endElement(CATEGORY, element, element);
+    }
+
+    /** @return type name */
+    public String getType() {
+        String className = getClass().getName();
+        return className.substring(className.lastIndexOf('.') + 3);
+    }
+    
+    /**
+     * @return a string representation of this object
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return getType() + ": content=" + content;
+    }
+
+    /** @return element */
+    protected abstract String getElement();
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java Thu Feb 14 13:55:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render.ps.extensions;
 

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java Thu Feb 14 13:55:44 2008
@@ -1,114 +1,114 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: $ */
-
-package org.apache.fop.render.ps.extensions;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Element for postscript setpagedevice instruction
- * This is a an extension which provides a pass-through value
- * dictionary object for the postscript setpagedevice instruction.
- */
-public class PSSetPageDevice extends PSExtensionAttachment {
-    /** element name */
-    protected static final String ELEMENT = "ps-setpagedevice";
-
-    private static final String ATT_NAME = "name";
-
-    /**
-     * name attribute
-     */
-    protected String name = null;
-
-    /**
-     * default constructor
-     * @param content set page device dictionary
-     */
-    public PSSetPageDevice(String content) {
-        super(content);
-    }
-
-    /**
-     * constructor
-     * @param name name attribute of this setpagedevice content
-     * @param content set page device dictionary
-     */
-    public PSSetPageDevice(String name, String content) {
-        this(content);
-        this.name = name;
-    }
-
-    /**
-     * constructor
-     */
-    public PSSetPageDevice() {
-    }
-    
-    /** @return the name */
-    public String getName() {
-        return name;
-    }
-    
-    /**
-     * Sets the name of the setup code object.
-     * @param name The name to set.
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * @return a string representation of this object 
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return "PSSetPageDevice(name=" + getName() + ", content='" + getContent() + "')";
-    }
-
-    /**
-     * @return a string representation of this object
-     * @see org.apache.fop.render.ps.extensions.PSExtensionAttachment#getElement()
-     */
-    protected String getElement() {
-        return ELEMENT;
-    }
-
-    /**
-     * Generates SAX events representing the object's state.
-     * @param handler ContentHandler instance to send the SAX events to
-     * @throws SAXException if there's a problem generating the SAX events
-     * @see org.apache.xmlgraphics.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
-     */
-    public void toSAX(ContentHandler handler) throws SAXException {
-        AttributesImpl atts = new AttributesImpl();
-        if (name != null && name.length() > 0) {
-            atts.addAttribute(null, ATT_NAME, ATT_NAME, "CDATA", name);
-        }
-        String element = getElement();
-        handler.startElement(CATEGORY, element, element, atts);
-        if (content != null && content.length() > 0) {
-            char[] chars = content.toCharArray();
-            handler.characters(chars, 0, chars.length);
-        }
-        handler.endElement(CATEGORY, element, element);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps.extensions;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Element for postscript setpagedevice instruction
+ * This is a an extension which provides a pass-through value
+ * dictionary object for the postscript setpagedevice instruction.
+ */
+public class PSSetPageDevice extends PSExtensionAttachment {
+    /** element name */
+    protected static final String ELEMENT = "ps-setpagedevice";
+
+    private static final String ATT_NAME = "name";
+
+    /**
+     * name attribute
+     */
+    protected String name = null;
+
+    /**
+     * default constructor
+     * @param content set page device dictionary
+     */
+    public PSSetPageDevice(String content) {
+        super(content);
+    }
+
+    /**
+     * constructor
+     * @param name name attribute of this setpagedevice content
+     * @param content set page device dictionary
+     */
+    public PSSetPageDevice(String name, String content) {
+        this(content);
+        this.name = name;
+    }
+
+    /**
+     * constructor
+     */
+    public PSSetPageDevice() {
+    }
+    
+    /** @return the name */
+    public String getName() {
+        return name;
+    }
+    
+    /**
+     * Sets the name of the setup code object.
+     * @param name The name to set.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return a string representation of this object 
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "PSSetPageDevice(name=" + getName() + ", content='" + getContent() + "')";
+    }
+
+    /**
+     * @return a string representation of this object
+     * @see org.apache.fop.render.ps.extensions.PSExtensionAttachment#getElement()
+     */
+    protected String getElement() {
+        return ELEMENT;
+    }
+
+    /**
+     * Generates SAX events representing the object's state.
+     * @param handler ContentHandler instance to send the SAX events to
+     * @throws SAXException if there's a problem generating the SAX events
+     * @see org.apache.xmlgraphics.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
+     */
+    public void toSAX(ContentHandler handler) throws SAXException {
+        AttributesImpl atts = new AttributesImpl();
+        if (name != null && name.length() > 0) {
+            atts.addAttribute(null, ATT_NAME, ATT_NAME, "CDATA", name);
+        }
+        String element = getElement();
+        handler.startElement(CATEGORY, element, element, atts);
+        if (content != null && content.length() > 0) {
+            char[] chars = content.toCharArray();
+            handler.characters(chars, 0, chars.length);
+        }
+        handler.endElement(CATEGORY, element, element);
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java Thu Feb 14 13:55:44 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: $ */
-
-package org.apache.fop.render.ps.extensions;
-
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.extensions.ExtensionAttachment;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
-/**
- * Extension element for ps:ps-setpagedevice. 
- */
-public class PSSetPageDeviceElement extends AbstractPSExtensionElement {
-
-    protected static final String ELEMENT = "ps-setpagedevice";
-
-    /**
-     * Main constructor
-     * @param parent parent FO node
-     */
-    protected PSSetPageDeviceElement(FONode parent) {
-        super(parent);
-    }
-
-    /**
-     * Called after processNode() is called. Subclasses can do additional processing.
-     * @throws FOPException if there's a problem during processing
-     * @see org.apache.fop.fo.FONode#startOfNode()
-     */
-    protected void startOfNode() throws FOPException {
-        super.startOfNode();
-        if ( !((parent.getNameId() == Constants.FO_DECLARATIONS)
-                || (parent.getNameId() == Constants.FO_SIMPLE_PAGE_MASTER)) ) {
-            throw new ValidationException( getName()
-                    + " must be a child of fo:declarations or fo:simple-page-master.");
-        }
-    }
-
-    /**
-     * Initialize the node with its name, location information, and attributes
-     * The attributes must be used immediately as the sax attributes
-     * will be altered for the next element.
-     * @param elementName element name (e.g., "fo:block")
-     * @param locator Locator object (ignored by default)
-     * @param attlist Collection of attributes passed to us from the parser.
-     * @param propertyList property list
-     * @throws FOPException if there's a problem during processing
-     * @see org.apache.fop.fo.FONode#processNode
-     */
-    public void processNode(String elementName, Locator locator, 
-                            Attributes attlist, PropertyList propertyList)
-                                throws FOPException {
-        String name = attlist.getValue("name");
-        if (name != null && name.length() > 0) {
-            ((PSSetPageDevice)getExtensionAttachment()).setName(name);
-        }
-    }
-
-    /**
-     * @return local name 
-     * @see org.apache.fop.fo.FONode#getLocalName() */
-    public String getLocalName() {
-        return ELEMENT;
-    }
-
-    /**
-     * @return a new PSSetPageDevice object
-     * @see org.apache.fop.render.ps.extensions.AbstractPSExtensionElement
-     * #instantiateExtensionAttachment()
-     */
-    protected ExtensionAttachment instantiateExtensionAttachment() {
-        return new PSSetPageDevice();
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps.extensions;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * Extension element for ps:ps-setpagedevice. 
+ */
+public class PSSetPageDeviceElement extends AbstractPSExtensionElement {
+
+    protected static final String ELEMENT = "ps-setpagedevice";
+
+    /**
+     * Main constructor
+     * @param parent parent FO node
+     */
+    protected PSSetPageDeviceElement(FONode parent) {
+        super(parent);
+    }
+
+    /**
+     * Called after processNode() is called. Subclasses can do additional processing.
+     * @throws FOPException if there's a problem during processing
+     * @see org.apache.fop.fo.FONode#startOfNode()
+     */
+    protected void startOfNode() throws FOPException {
+        super.startOfNode();
+        if ( !((parent.getNameId() == Constants.FO_DECLARATIONS)
+                || (parent.getNameId() == Constants.FO_SIMPLE_PAGE_MASTER)) ) {
+            throw new ValidationException( getName()
+                    + " must be a child of fo:declarations or fo:simple-page-master.");
+        }
+    }
+
+    /**
+     * Initialize the node with its name, location information, and attributes
+     * The attributes must be used immediately as the sax attributes
+     * will be altered for the next element.
+     * @param elementName element name (e.g., "fo:block")
+     * @param locator Locator object (ignored by default)
+     * @param attlist Collection of attributes passed to us from the parser.
+     * @param propertyList property list
+     * @throws FOPException if there's a problem during processing
+     * @see org.apache.fop.fo.FONode#processNode
+     */
+    public void processNode(String elementName, Locator locator, 
+                            Attributes attlist, PropertyList propertyList)
+                                throws FOPException {
+        String name = attlist.getValue("name");
+        if (name != null && name.length() > 0) {
+            ((PSSetPageDevice)getExtensionAttachment()).setName(name);
+        }
+    }
+
+    /**
+     * @return local name 
+     * @see org.apache.fop.fo.FONode#getLocalName() */
+    public String getLocalName() {
+        return ELEMENT;
+    }
+
+    /**
+     * @return a new PSSetPageDevice object
+     * @see org.apache.fop.render.ps.extensions.AbstractPSExtensionElement
+     * #instantiateExtensionAttachment()
+     */
+    protected ExtensionAttachment instantiateExtensionAttachment() {
+        return new PSSetPageDevice();
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java Thu Feb 14 13:55:44 2008
@@ -24,6 +24,7 @@
 
 //FOP
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.FixedLength;
 
 
 /**  Converts XSL-FO units to RTF units
@@ -51,10 +52,10 @@
     /** conversion factors keyed by xsl:fo units names */
     private static final Map TWIP_FACTORS = new HashMap();
     static {
-        TWIP_FACTORS.put("mm", new Float(MM_TO_TWIPS));
-        TWIP_FACTORS.put("cm", new Float(CM_TO_TWIPS));
-        TWIP_FACTORS.put("pt", new Float(POINT_TO_TWIPS));
-        TWIP_FACTORS.put("in", new Float(IN_TO_TWIPS));
+        TWIP_FACTORS.put(FixedLength.MM, new Float(MM_TO_TWIPS));
+        TWIP_FACTORS.put(FixedLength.CM, new Float(CM_TO_TWIPS));
+        TWIP_FACTORS.put(FixedLength.POINT, new Float(POINT_TO_TWIPS));
+        TWIP_FACTORS.put(FixedLength.INCH, new Float(IN_TO_TWIPS));
     }
 
     /** singleton pattern */
@@ -125,7 +126,7 @@
     /** convert a font size given in points like "12pt" */
     int convertFontSize(String size) throws FOPException {
         size = size.trim();
-        final String sFONTSUFFIX = "pt";
+        final String sFONTSUFFIX = FixedLength.POINT;
         if (!size.endsWith(sFONTSUFFIX)) {
             throw new FOPException("Invalid font size '" + size + "', must end with '"
                                    + sFONTSUFFIX + "'");

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java Thu Feb 14 13:55:44 2008
@@ -1,66 +1,66 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.rtf;
-
-import java.io.OutputStream;
-
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.fo.FOEventHandler;
-import org.apache.fop.render.AbstractFOEventHandlerMaker;
-
-/**
- * Maker class for RTF support.
- */
-public class RTFFOEventHandlerMaker extends AbstractFOEventHandlerMaker {
-
-    private static final String[] MIMES = new String[] {
-        MimeConstants.MIME_RTF,
-        MimeConstants.MIME_RTF_ALT1,
-        MimeConstants.MIME_RTF_ALT2};
-    
-    
-    /**
-     * {@inheritDoc}
-     * @param ua FOUserAgent
-     * @param out OutputStream
-     * @return created RTFHandler
-     */
-    public FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out) {
-        return new RTFHandler(ua, out);
-    }
-
-    /**
-     * {@inheritDoc}
-     * @return true, if an outputstream is needed
-     */
-    public boolean needsOutputStream() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     * @return array of MIME types
-     */
-    public String[] getSupportedMimeTypes() {
-        return MIMES;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.rtf;
+
+import java.io.OutputStream;
+
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.fo.FOEventHandler;
+import org.apache.fop.render.AbstractFOEventHandlerMaker;
+
+/**
+ * Maker class for RTF support.
+ */
+public class RTFFOEventHandlerMaker extends AbstractFOEventHandlerMaker {
+
+    private static final String[] MIMES = new String[] {
+        MimeConstants.MIME_RTF,
+        MimeConstants.MIME_RTF_ALT1,
+        MimeConstants.MIME_RTF_ALT2};
+    
+    
+    /**
+     * {@inheritDoc}
+     * @param ua FOUserAgent
+     * @param out OutputStream
+     * @return created RTFHandler
+     */
+    public FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out) {
+        return new RTFHandler(ua, out);
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return true, if an outputstream is needed
+     */
+    public boolean needsOutputStream() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return array of MIME types
+     */
+    public String[] getSupportedMimeTypes() {
+        return MIMES;
+    }
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
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