Author: jeremias
Date: Tue Apr 14 14:47:43 2009
New Revision: 764802

URL: http://svn.apache.org/viewvc?rev=764802&view=rev
Log:
Reverted changes for "ptr" to painter interface as announced in #46705. The 
pointer value is now provided through the IFContext so only the implementations 
that support it have to deal with it.
Also, the method signature changes in the renderers are now reverted. They are 
not necessary.
Found a few other smaller omissions (IFRenderer, IFSerializer) that didn't seem 
to have been merged properly from Trunk.

Modified:
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContext.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFParser.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFSerializer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSPainter.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/txt/TXTRenderer.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGPainter.java

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -834,10 +834,8 @@
      * @param url the URI/URL of the image
      * @param pos the position of the image
      * @param foreignAttributes an optional Map with foreign attributes, may 
be null
-     * @param ptr used for accessibility
      */
-    protected abstract void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes, 
-            String ptr);
+    protected abstract void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes);
 
     /**
      * Draw an image at the indicated location.
@@ -845,7 +843,7 @@
      * @param pos the position of the image
      */
     protected final void drawImage(String url, Rectangle2D pos) {
-        drawImage(url, pos, null, "");
+        drawImage(url, pos, null);
     }
 
     /**

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/AbstractRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -738,13 +738,11 @@
         currentBPPosition += viewport.getOffset();
         Rectangle2D contpos = viewport.getContentPosition();
         if (content instanceof Image) {
-            String ptr = (String) viewport.getTrait(Trait.PTR);
-            renderImage((Image) content, contpos, ptr);
+            renderImage((Image) content, contpos);
         } else if (content instanceof Container) {
             renderContainer((Container) content);
         } else if (content instanceof ForeignObject) {
-            String ptr = (String) viewport.getTrait(Trait.PTR);
-            renderForeignObject((ForeignObject) content, contpos, ptr);
+            renderForeignObject((ForeignObject) content, contpos);
         } else if (content instanceof InlineBlockParent) {
             renderInlineBlockParent((InlineBlockParent) content);
         }
@@ -757,10 +755,9 @@
      *
      * @param image  The image
      * @param pos    The target position of the image
-     * @param ptr  used for accessibility
      * (todo) Make renderImage() protected
      */
-    public void renderImage(Image image, Rectangle2D pos, String ptr) {
+    public void renderImage(Image image, Rectangle2D pos) {
         // Default: do nothing.
         // Some renderers (ex. Text) don't support images.
     }
@@ -784,10 +781,9 @@
      *
      * @param fo   The foreign object area
      * @param pos  The target position of the foreign object
-     * @param ptr  used for accessibility
      * (todo) Make renderForeignObject() protected
      */
-    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos, 
String ptr) {
+    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
         // Default: do nothing.
         // Some renderers (ex. Text) don't support foreign objects.
     }

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPPainter.java
 Tue Apr 14 14:47:43 2009
@@ -184,7 +184,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         String name = documentHandler.getPageSegmentNameFor(uri);
         if (name != null) {
             float[] srcPts = {rect.x, rect.y};
@@ -196,7 +196,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         drawImageUsingDocument(doc, rect);
     }
 
@@ -313,7 +313,7 @@
     /** {...@inheritdoc} */
     public void drawText(int x, int y,
             final int letterSpacing, final int wordSpacing, final int[] dx,
-            final String text, final String ptr) throws IFException {
+            final String text) throws IFException {
         final int fontSize = this.state.getFontSize();
         getPaintingState().setFontSize(fontSize);
 

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -395,7 +395,7 @@
         ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, 
ImageFlavor.RENDERED_IMAGE };
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, 
String ptr) {
+    public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
         uri = URISpecification.getURL(uri);
         paintingState.setImageUri(uri);
 
@@ -526,7 +526,7 @@
 
     /** {...@inheritdoc} */
     public void renderImage(Image image, Rectangle2D pos) {
-        drawImage(image.getURL(), pos, image.getForeignAttributes(),"");
+        drawImage(image.getURL(), pos, image.getForeignAttributes());
     }
 
     /** {...@inheritdoc} */

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContext.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContext.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContext.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContext.java
 Tue Apr 14 14:47:43 2009
@@ -43,6 +43,8 @@
     /** foreign attributes: Map<QName, Object> */
     private Map foreignAttributes = Collections.EMPTY_MAP;
 
+    private String structurePointer;
+
     /**
      * Main constructor.
      * @param ua the user agent
@@ -108,4 +110,20 @@
         setForeignAttributes(null);
     }
 
+    public void setStructurePointer(String ptr) {
+        this.structurePointer = ptr;
+    }
+
+    public void resetStructurePointer() {
+        setStructurePointer(null);
+    }
+
+    public String getStructurePointer() {
+        return this.structurePointer;
+    }
+
+    public boolean hasStructurePointer() {
+        return (this.structurePointer != null) && (structurePointer.length() > 
0);
+    }
+
 }

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java
 Tue Apr 14 14:47:43 2009
@@ -153,11 +153,10 @@
      * @param wordSpacing additional spacing between words (may be 0)
      * @param dx an array of adjustment values for each character in 
X-direction (may be null)
      * @param text the text
-     * @param ptr used for accessibility
      * @throws IFException if an error occurs while handling this event
      */
     void drawText(int x, int y, int letterSpacing, int wordSpacing,
-            int[] dx, String text, String ptr) throws IFException;
+            int[] dx, String text) throws IFException;
 
     /**
      * Restricts the current clipping region with the given rectangle.
@@ -206,20 +205,18 @@
      * an fo:external-graphic in XSL-FO.
      * @param uri the image's URI
      * @param rect the rectangle in which the image shall be painted
-     * @param ptr used for accessibility
      * @throws IFException if an error occurs while handling this event
      */
-    void drawImage(String uri, Rectangle rect, String ptr) throws IFException;
+    void drawImage(String uri, Rectangle rect) throws IFException;
 
     /**
      * Draws an image (represented by a DOM document) inside a given 
rectangle. This is the
      * equivalent to an fo:instream-foreign-object in XSL-FO.
      * @param doc the DOM document containing the foreign object
      * @param rect the rectangle in which the image shall be painted
-     * @param ptr used for accessibility 
      * @throws IFException if an error occurs while handling this event
      */
-    void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException;
+    void drawImage(Document doc, Rectangle rect) throws IFException;
     //Note: For now, all foreign objects are handled as DOM documents. At the 
moment, all known
     //implementations use a DOM anyway, so optimizing this to work with SAX 
wouldn't result in
     //any performance benefits. The IFRenderer itself has a DOM anyway. Only 
the IFParser could

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFParser.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFParser.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFParser.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFParser.java
 Tue Apr 14 14:47:43 2009
@@ -173,6 +173,14 @@
             documentHandler.getContext().resetForeignAttributes();
         }
 
+        private void establishStructurePointer(String ptr) {
+            documentHandler.getContext().setStructurePointer(ptr);
+        }
+
+        private void resetStructurePointer() {
+            documentHandler.getContext().resetStructurePointer();
+        }
+
         /** {...@inheritdoc} */
         public void startElement(String uri, String localName, String qName, 
Attributes attributes)
                     throws SAXException {
@@ -482,7 +490,9 @@
                 int wordSpacing = (s != null ? Integer.parseInt(s) : 0);
                 int[] dx = XMLUtil.getAttributeAsIntArray(lastAttributes, 
"dx");
                 String ptr = lastAttributes.getValue("ptr"); // used for 
accessibility
-                painter.drawText(x, y, letterSpacing, wordSpacing, dx, 
content.toString(), ptr);
+                establishStructurePointer(ptr);
+                painter.drawText(x, y, letterSpacing, wordSpacing, dx, 
content.toString());
+                resetStructurePointer();
             }
 
             public boolean ignoreCharacters() {
@@ -578,9 +588,10 @@
                 Map foreignAttributes = getForeignAttributes(lastAttributes);
                 establishForeignAttributes(foreignAttributes);
                 String ptr = lastAttributes.getValue("ptr"); // used for 
accessibility
+                establishStructurePointer(ptr);
                 if (foreignObject != null) {
                     painter.drawImage(foreignObject,
-                            new Rectangle(x, y, width, height), ptr);
+                            new Rectangle(x, y, width, height));
                     foreignObject = null;
                 } else {
                     String uri = lastAttributes.getValue(
@@ -588,9 +599,10 @@
                     if (uri == null) {
                         throw new IFException("xlink:href is missing on 
image", null);
                     }
-                    painter.drawImage(uri, new Rectangle(x, y, width, height), 
ptr);
+                    painter.drawImage(uri, new Rectangle(x, y, width, height));
                 }
                 resetForeignAttributes();
+                resetStructurePointer();
                 inForeignObject = false;
             }
 

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -53,6 +53,7 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.Area;
+import org.apache.fop.area.AreaTreeObject;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.BlockViewport;
 import org.apache.fop.area.BookmarkData;
@@ -500,7 +501,10 @@
                 documentHandler.endDocumentHeader();
                 this.inPageSequence = true;
             }
+            establishForeignAttributes(pageSequence.getForeignAttributes());
             documentHandler.startPageSequence(null);
+            resetForeignAttributes();
+            processExtensionAttachments(pageSequence);
         } catch (IFException e) {
             handleIFException(e);
         }
@@ -557,13 +561,7 @@
             documentHandler.startPageHeader();
 
             //Add page attachments to page header
-            if (page.hasExtensionAttachments()) {
-                for (Iterator iter = page.getExtensionAttachments().iterator();
-                    iter.hasNext();) {
-                    ExtensionAttachment attachment = (ExtensionAttachment) 
iter.next();
-                    this.documentHandler.handleExtensionObject(attachment);
-                }
-            }
+            processExtensionAttachments(page);
 
             documentHandler.endPageHeader();
             this.painter = documentHandler.startPageContent();
@@ -590,6 +588,16 @@
         }
     }
 
+    private void processExtensionAttachments(AreaTreeObject area) throws 
IFException {
+        if (area.hasExtensionAttachments()) {
+            for (Iterator iter = area.getExtensionAttachments().iterator();
+                iter.hasNext();) {
+                ExtensionAttachment attachment = (ExtensionAttachment) 
iter.next();
+                this.documentHandler.handleExtensionObject(attachment);
+            }
+        }
+    }
+
     private void establishForeignAttributes(Map foreignAttributes) {
         documentHandler.getContext().setForeignAttributes(foreignAttributes);
     }
@@ -598,6 +606,14 @@
         documentHandler.getContext().resetForeignAttributes();
     }
 
+    private void establishStructurePointer(String ptr) {
+        documentHandler.getContext().setStructurePointer(ptr);
+    }
+
+    private void resetStructurePointer() {
+        documentHandler.getContext().resetStructurePointer();
+    }
+
     /** {...@inheritdoc} */
     protected void saveGraphicsState() {
         graphicContextStack.push(graphicContext);
@@ -818,17 +834,20 @@
             currentIPPosition = saveIP;
             currentBPPosition = saveBP;
 
-            currentBPPosition += (bv.getAllocBPD());
+            currentBPPosition += bv.getAllocBPD();
         }
         viewportDimensionStack.pop();
     }
 
     /** {...@inheritdoc} */
     public void renderViewport(Viewport viewport) {
+        String ptr = (String) viewport.getTrait(Trait.PTR);
+        establishStructurePointer(ptr);
         Dimension dim = new Dimension(viewport.getIPD(), viewport.getBPD());
         viewportDimensionStack.push(dim);
         super.renderViewport(viewport);
         viewportDimensionStack.pop();
+        resetStructurePointer();
     }
 
     /** {...@inheritdoc} */
@@ -966,6 +985,7 @@
         String fontName = getInternalFontNameForArea(text);
         int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
         String ptr = (String)text.getTrait(Trait.PTR); // used for 
accessibility
+        establishStructurePointer(ptr);
 
         // This assumes that *all* CIDFonts use a /ToUnicode mapping
         Typeface tf = getTypeface(fontName);
@@ -984,9 +1004,10 @@
         textUtil.setStartPosition(rx, bl);
         textUtil.setSpacing(text.getTextLetterSpaceAdjust(), 
text.getTextWordSpaceAdjust());
         super.renderText(text);
-        textUtil.setPtr(ptr); // used for accessibility
+
         textUtil.flush();
         renderTextDecoration(tf, size, text, bl, rx);
+        resetStructurePointer();
     }
 
     /** {...@inheritdoc} */
@@ -1061,20 +1082,11 @@
         private int startx, starty;
         private int tls, tws;
         private final boolean combined = false;
-        private String ptr = null; // used for accessibility
 
         void addChar(char ch) {
             text.append(ch);
         }
 
-        /**
-         * used for accessibility
-         * @param inPtr to be stored
-         */
-        public void setPtr(String inPtr) {
-            ptr = inPtr;
-        }
-
         void adjust(int adjust) {
             if (adjust != 0) {
                 int idx = text.length();
@@ -1117,9 +1129,9 @@
                         System.arraycopy(dx, 0, effDX, 0, size);
                     }
                     if (combined) {
-                        painter.drawText(startx, starty, 0, 0, effDX, 
text.toString(), ptr);
+                        painter.drawText(startx, starty, 0, 0, effDX, 
text.toString());
                     } else {
-                        painter.drawText(startx, starty, tls, tws, effDX, 
text.toString(), ptr);
+                        painter.drawText(startx, starty, tls, tws, effDX, 
text.toString());
                     }
                 } catch (IFException e) {
                     handleIFException(e);
@@ -1130,12 +1142,12 @@
     }
 
     /** {...@inheritdoc} */
-    public void renderImage(Image image, Rectangle2D pos, String ptr) {
-        drawImage(image.getURL(), pos, image.getForeignAttributes(), ptr);
+    public void renderImage(Image image, Rectangle2D pos) {
+        drawImage(image.getURL(), pos, image.getForeignAttributes());
     }
 
     /** {...@inheritdoc} */
-    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes, String ptr) {
+    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes) {
         Rectangle posInt = new Rectangle(
                 currentIPPosition + (int)pos.getX(),
                 currentBPPosition + (int)pos.getY(),
@@ -1144,7 +1156,7 @@
         uri = URISpecification.getURL(uri);
         try {
             establishForeignAttributes(foreignAttributes);
-            painter.drawImage(uri, posInt, ptr);
+            painter.drawImage(uri, posInt);
             resetForeignAttributes();
         } catch (IFException ife) {
             handleIFException(ife);
@@ -1152,7 +1164,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void renderForeignObject(ForeignObject fo, Rectangle2D pos, String 
ptr) {
+    public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
         endTextObject();
         Rectangle posInt = new Rectangle(
                 currentIPPosition + (int)pos.getX(),
@@ -1162,7 +1174,7 @@
         Document doc = fo.getDocument();
         try {
             establishForeignAttributes(fo.getForeignAttributes());
-            painter.drawImage(doc, posInt, ptr);
+            painter.drawImage(doc, posInt);
             resetForeignAttributes();
         } catch (IFException ife) {
             handleIFException(ife);

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFSerializer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFSerializer.java
 Tue Apr 14 14:47:43 2009
@@ -267,7 +267,7 @@
             if (id != null) {
                 atts.addAttribute(XML_NAMESPACE, "id", "xml:id", 
XMLUtil.CDATA, id);
             }
-
+            addForeignAttributes(atts);
             handler.startElement(EL_PAGE_SEQUENCE, atts);
             if (this.getUserAgent().isAccessibilityEnabled()) {
                 if (doc == null) {
@@ -463,7 +463,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         try {
             AttributesImpl atts = new AttributesImpl();
             addAttribute(atts, XLINK_HREF, uri);
@@ -472,6 +472,7 @@
             addAttribute(atts, "width", Integer.toString(rect.width));
             addAttribute(atts, "height", Integer.toString(rect.height));
             addForeignAttributes(atts);
+            String ptr = getContext().getStructurePointer();
             if (ptr != null) {
                 addAttribute(atts, "ptr", ptr);  // used for accessibility
             }
@@ -493,7 +494,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         try {
             AttributesImpl atts = new AttributesImpl();
             addAttribute(atts, "x", Integer.toString(rect.x));
@@ -501,6 +502,7 @@
             addAttribute(atts, "width", Integer.toString(rect.width));
             addAttribute(atts, "height", Integer.toString(rect.height));
             addForeignAttributes(atts);
+            String ptr = getContext().getStructurePointer();
             if (ptr != null) {
                 addAttribute(atts, "ptr", ptr);  // used for accessibility
             }
@@ -602,7 +604,7 @@
 
     /** {...@inheritdoc} */
     public void drawText(int x, int y, int letterSpacing, int wordSpacing,
-            int[] dx, String text, String ptr) throws IFException {
+            int[] dx, String text) throws IFException {
         try {
             AttributesImpl atts = new AttributesImpl();
             XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
@@ -617,6 +619,7 @@
             if (dx != null) {
                 addAttribute(atts, "dx", IFUtil.toString(dx));
             }
+            String ptr = getContext().getStructurePointer();
             if (ptr != null) {
                 addAttribute(atts, "ptr", ptr);  // used for accessibility
             }

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DPainter.java
 Tue Apr 14 14:47:43 2009
@@ -156,7 +156,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         drawImageUsingURI(uri, rect);
     }
 
@@ -168,7 +168,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         drawImageUsingDocument(doc, rect);
     }
 
@@ -208,7 +208,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx, String text, String ptr)
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx, String text)
             throws IFException {
         g2dState.updateColor(state.getTextColor());
         FontTriplet triplet = new FontTriplet(

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -875,7 +875,7 @@
                                                       ImageFlavor.XML_DOM};
 
     /** {...@inheritdoc} */
-    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes, String ptr) {
+    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes) {
 
         int x = currentIPPosition + (int)Math.round(pos.getX());
         int y = currentBPPosition + (int)Math.round(pos.getY());

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLPainter.java
 Tue Apr 14 14:47:43 2009
@@ -154,7 +154,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         drawImageUsingURI(uri, rect);
     }
 
@@ -176,7 +176,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         drawImageUsingDocument(doc, rect);
     }
 
@@ -312,9 +312,8 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx, String text, String ptr)
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx, String text)
                 throws IFException {
-        //Note: ptr is ignored as it is only needed for accessibility
         try {
             FontTriplet triplet = new FontTriplet(
                     state.getFontFamily(), state.getFontStyle(), 
state.getFontWeight());
@@ -475,7 +474,7 @@
                 Java2DPainter painter = new Java2DPainter(g2d,
                         getContext(), parent.getFontInfo(), state);
                 try {
-                    painter.drawText(x, y, letterSpacing, wordSpacing, dx, 
text, "");
+                    painter.drawText(x, y, letterSpacing, wordSpacing, dx, 
text);
                 } catch (IFException e) {
                     //This should never happen with the Java2DPainter
                     throw new RuntimeException("Unexpected error while 
painting text", e);

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFPainter.java
 Tue Apr 14 14:47:43 2009
@@ -129,11 +129,12 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr)
+    public void drawImage(String uri, Rectangle rect)
             throws IFException {
         PDFXObject xobject = getPDFDoc().getXObject(uri);
         if (xobject != null) {
-            if (accessEnabled && ptr.length() > 0) {
+            if (accessEnabled && getContext().hasStructurePointer()) {
+                String ptr = getContext().getStructurePointer();
                 mcid = this.documentHandler.getMCID();
                 mcid++;                          // fix for Acro Checker
                 this.documentHandler.incMCID();  // simulating a parent text 
element
@@ -152,7 +153,8 @@
             }
             return;
         }
-        if (accessEnabled && ptr.length() > 0) {
+        if (accessEnabled && getContext().hasStructurePointer()) {
+            String ptr = getContext().getStructurePointer();
             mcid = this.documentHandler.getMCID();
             mcid++;                          // fix for Acro Checker
             this.documentHandler.incMCID();  // simulating a parent text 
element
@@ -221,8 +223,9 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
-        if (accessEnabled && ptr.length() > 0) {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
+        if (accessEnabled && getContext().hasStructurePointer()) {
+            String ptr = getContext().getStructurePointer();
             mcid = this.documentHandler.getMCID();
             mcid++;                          // fix for Acro Checker
             this.documentHandler.incMCID();  // simulating a parent text 
element
@@ -330,9 +333,10 @@
 
     /** {...@inheritdoc} */
     public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx,
-            String text, String ptr)
+            String text)
             throws IFException {
-        if (accessEnabled ) {
+        if (accessEnabled) {
+            String ptr = getContext().getStructurePointer();
             int mcId;
             String structElType = "";
             if (ptr != null && ptr.length() > 0) {

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -1074,7 +1074,7 @@
     }
 
     /** {...@inheritdoc} */
-    protected void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes, String ptr) {
+    protected void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes) {
         endTextObject();
         putImage(url, pos, foreignAttributes);
     }

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSPainter.java
 Tue Apr 14 14:47:43 2009
@@ -176,7 +176,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         try {
             endTextObject();
         } catch (IOException ioe) {
@@ -186,7 +186,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         try {
             endTextObject();
         } catch (IOException ioe) {
@@ -338,7 +338,7 @@
 
     /** {...@inheritdoc} */
     public void drawText(int x, int y, int letterSpacing, int wordSpacing,
-            int[] dx, String text, String ptr) throws IFException {
+            int[] dx, String text) throws IFException {
         try {
             //Note: dy is currently ignored
             PSGenerator generator = getGenerator();

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/ps/PSRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -345,7 +345,7 @@
     }
 
     /** {...@inheritdoc} */
-    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes, String ptr) {
+    protected void drawImage(String uri, Rectangle2D pos, Map 
foreignAttributes) {
         endTextObject();
         int x = currentIPPosition + (int)Math.round(pos.getX());
         int y = currentBPPosition + (int)Math.round(pos.getY());
@@ -1233,7 +1233,7 @@
      * {...@inheritdoc}
      */
     public void renderImage(Image image, Rectangle2D pos) {
-        drawImage(image.getURL(), pos, image.getForeignAttributes(), "");
+        drawImage(image.getURL(), pos, image.getForeignAttributes());
     }
 
     /**

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/txt/TXTRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/txt/TXTRenderer.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/txt/TXTRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/txt/TXTRenderer.java
 Tue Apr 14 14:47:43 2009
@@ -28,6 +28,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.xmlgraphics.util.UnitConv;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.CTM;
@@ -37,7 +39,6 @@
 import org.apache.fop.render.AbstractPathOrientedRenderer;
 import org.apache.fop.render.txt.border.AbstractBorderElement;
 import org.apache.fop.render.txt.border.BorderManager;
-import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Renderer that renders areas to plain text.
@@ -443,7 +444,7 @@
     }
 
     /** {...@inheritdoc} */
-    protected void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes, String ptr) {
+    protected void drawImage(String url, Rectangle2D pos, Map 
foreignAttributes) {
         //No images are painted here
     }
 

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGPainter.java?rev=764802&r1=764801&r2=764802&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
 Tue Apr 14 14:47:43 2009
@@ -193,7 +193,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(String uri, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(String uri, Rectangle rect) throws IFException {
         try {
             establish(MODE_NORMAL);
 
@@ -243,7 +243,7 @@
     }
 
     /** {...@inheritdoc} */
-    public void drawImage(Document doc, Rectangle rect, String ptr) throws 
IFException {
+    public void drawImage(Document doc, Rectangle rect) throws IFException {
         try {
             establish(MODE_NORMAL);
 
@@ -326,9 +326,8 @@
 
     /** {...@inheritdoc} */
 
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx, 
-            String text, String ptr) throws IFException {
-        //Note: ptr is ignored as it is only needed for accessibility
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, 
int[] dx,
+            String text) throws IFException {
         try {
             establish(MODE_TEXT);
             AttributesImpl atts = new AttributesImpl();



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to