Hello!

Here is my patch about support for background properties of before, 
after, start and end regions and precedence attribute of before and 
after regions (lr-tb writing mode only). Actually this patch also adds 
start and end regions support for AWT renderer and tries to unify 
regions rendering in all renderers.

-- 
Oleg Tkachenko
Multiconn International, Israel
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 RegionAfter.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java   23 Apr 2002 
22:25:25 -0000      1.9.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java   13 Jul 2002 
+14:04:23 -0000
@@ -65,6 +65,20 @@
        return area;
     }
 
+    RegionArea makeRegionArea(int allocationRectangleXPosition,
+                              int allocationRectangleYPosition,
+                              int allocationRectangleWidth,
+                              int allocationRectangleHeight,
+                              int startExtent, int endExtent) {
+        if (getPrecedence() == false) {
+            allocationRectangleXPosition += startExtent;
+            allocationRectangleWidth -= startExtent + endExtent;
+        }
+        return makeRegionArea(allocationRectangleXPosition,
+                              allocationRectangleYPosition,
+                              allocationRectangleWidth,
+                              allocationRectangleHeight);
+    }
 
     protected String getDefaultRegionName() {
         return "xsl-region-after";
@@ -82,4 +96,7 @@
         return (precedence == Precedence.TRUE ? true : false);
     }
 
+    public int getExtent() {
+        return properties.get("extent").getLength().mvalue();
+    }
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 RegionBefore.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java  23 Apr 2002 
22:25:25 -0000      1.9.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java  13 Jul 2002 
+14:04:24 -0000
@@ -65,6 +65,20 @@
        return area;
     }
 
+    RegionArea makeRegionArea(int allocationRectangleXPosition,
+                              int allocationRectangleYPosition,
+                              int allocationRectangleWidth,
+                              int allocationRectangleHeight,
+                              int startExtent, int endExtent) {
+        if (getPrecedence() == false) {
+            allocationRectangleXPosition += startExtent;
+            allocationRectangleWidth -= startExtent + endExtent;
+        }
+        return makeRegionArea(allocationRectangleXPosition,
+                              allocationRectangleYPosition,
+                              allocationRectangleWidth,
+                              allocationRectangleHeight);
+    }
 
     protected String getDefaultRegionName() {
         return "xsl-region-before";
@@ -82,4 +96,7 @@
         return (precedence == Precedence.TRUE ? true : false);
     }
 
+    public int getExtent() {
+        return properties.get("extent").getLength().mvalue();
+    }
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 RegionEnd.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java     23 Apr 2002 
22:25:25 -0000      1.3.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java     13 Jul 2002 
+14:04:25 -0000
@@ -43,18 +43,18 @@
                               int allocationRectangleWidth,
                               int allocationRectangleHeight,
                               boolean beforePrecedence,
-                              boolean afterPrecedence, int beforeHeight,
-                              int afterHeight) {
+                              boolean afterPrecedence, int beforeExtent,
+                              int afterExtent) {
         int extent = this.properties.get("extent").getLength().mvalue();
 
         int startY = allocationRectangleYPosition;
         int startH = allocationRectangleHeight;
         if (beforePrecedence) {
-            startY -= beforeHeight;
-            startH -= beforeHeight;
+            startY -= beforeExtent;
+            startH -= beforeExtent;
         }
         if (afterPrecedence)
-            startH -= afterHeight;
+            startH -= afterExtent;
         RegionArea area = new RegionArea(allocationRectangleXPosition
                                         + allocationRectangleWidth - extent,
                                         startY, extent, startH);
@@ -98,4 +98,7 @@
         return REGION_CLASS;
     }
 
+    public int getExtent() {
+        return properties.get("extent").getLength().mvalue();
+    }
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 RegionStart.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java   23 Apr 2002 
22:25:25 -0000      1.3.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java   13 Jul 2002 
+14:04:25 -0000
@@ -43,18 +43,18 @@
                               int allocationRectangleWidth,
                               int allocationRectangleHeight,
                               boolean beforePrecedence,
-                              boolean afterPrecedence, int beforeHeight,
-                              int afterHeight) {
+                              boolean afterPrecedence, int beforeExtent,
+                              int afterExtent) {
         int extent = this.properties.get("extent").getLength().mvalue();
 
         int startY = allocationRectangleYPosition;
         int startH = allocationRectangleHeight;
         if (beforePrecedence) {
-            startY -= beforeHeight;
-            startH -= beforeHeight;
+            startY -= beforeExtent;
+            startH -= beforeExtent;
         }
         if (afterPrecedence)
-            startH -= afterHeight;
+            startH -= afterExtent;
         RegionArea area = new RegionArea(allocationRectangleXPosition,
                                         startY, extent, startH);
        area.setBackground(propMgr.getBackgroundProps());
@@ -96,4 +96,7 @@
         return REGION_CLASS;
     }
 
+    public int getExtent() {
+        return properties.get("extent").getLength().mvalue();
+    }
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
===================================================================
RCS file: 
/home/cvspublic/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
retrieving revision 1.15
diff -u -r1.15 SimplePageMaster.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java      11 Sep 
2001 10:04:25 -0000      1.15
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java      13 Jul 
+2002 14:04:28 -0000
@@ -43,10 +43,9 @@
     String masterName;
 
     // before and after data as required by start and end
-    boolean beforePrecedence;
-    int beforeHeight;
-    boolean afterPrecedence;
-    int afterHeight;
+    boolean beforePrecedence = false;
+    int beforeExtent, afterExtent, startExtent, endExtent;
+    boolean afterPrecedence = false;
 
     protected SimplePageMaster(FObj parent, PropertyList propertyList)
             throws FOPException {
@@ -88,63 +87,56 @@
                                     - mProps.marginRight;
         int contentRectangleHeight = pageHeight - mProps.marginTop
                                      - mProps.marginBottom;
-
         this.pageMaster = new PageMaster(pageWidth, pageHeight);
-        if (getRegion(RegionBody.REGION_CLASS) != null) {
-            BodyRegionArea body =
-                
(BodyRegionArea)getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
-                                          contentRectangleYPosition,
-                                          contentRectangleWidth,
-                                          contentRectangleHeight);
-            this.pageMaster.addBody(body);
-        } else {
+        Region body = getRegion(RegionBody.REGION_CLASS);
+        RegionBefore before = (RegionBefore)getRegion(RegionBefore.REGION_CLASS);
+        RegionAfter after = (RegionAfter)getRegion(RegionAfter.REGION_CLASS);
+        RegionStart start = (RegionStart)getRegion(RegionStart.REGION_CLASS);
+        RegionEnd end = (RegionEnd)getRegion(RegionEnd.REGION_CLASS);
+        if (before != null) {
+            beforePrecedence = before.getPrecedence();
+            beforeExtent = before.getExtent();
+        }
+        if (after != null) {
+            afterPrecedence = after.getPrecedence();
+            afterExtent = after.getExtent();
+        }
+        if (start != null)
+            startExtent = start.getExtent();
+        if (end != null)
+            endExtent = end.getExtent();
+
+        if (body != null)
+            this.pageMaster.addBody((BodyRegionArea)body.makeRegionArea(
+                    contentRectangleXPosition,
+                    contentRectangleYPosition,
+                    contentRectangleWidth,
+                    contentRectangleHeight));
+        else
             log.error("simple-page-master must have a region of class "
                                    + RegionBody.REGION_CLASS);
-        }
 
-        if (getRegion(RegionBefore.REGION_CLASS) != null) {
-            RegionArea before =
-                
getRegion(RegionBefore.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
+        if (before != null)
+            this.pageMaster.addBefore(before.makeRegionArea(contentRectangleXPosition,
                           contentRectangleYPosition, contentRectangleWidth,
-                          contentRectangleHeight);
-            this.pageMaster.addBefore(before);
-            beforePrecedence =
-                ((RegionBefore)getRegion(RegionBefore.REGION_CLASS)).getPrecedence();
-            beforeHeight = before.getHeight();
-        } else {
-            beforePrecedence = false;
-        }
+                          contentRectangleHeight, startExtent, endExtent));
 
-        if (getRegion(RegionAfter.REGION_CLASS) != null) {
-            RegionArea after =
-                
getRegion(RegionAfter.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
+        if (after != null)
+            this.pageMaster.addAfter(after.makeRegionArea(contentRectangleXPosition,
                           contentRectangleYPosition, contentRectangleWidth,
-                          contentRectangleHeight);
-            this.pageMaster.addAfter(after);
-            afterPrecedence =
-                ((RegionAfter)getRegion(RegionAfter.REGION_CLASS)).getPrecedence();
-            afterHeight = after.getHeight();
-        } else {
-            afterPrecedence = false;
-        }
+                          contentRectangleHeight, startExtent, endExtent));
 
-        if (getRegion(RegionStart.REGION_CLASS) != null) {
-            RegionArea start =
-                
((RegionStart)getRegion(RegionStart.REGION_CLASS)).makeRegionArea(contentRectangleXPosition,
+        if (start != null)
+            this.pageMaster.addStart(start.makeRegionArea(contentRectangleXPosition,
                     contentRectangleYPosition, contentRectangleWidth,
                     contentRectangleHeight, beforePrecedence,
-                    afterPrecedence, beforeHeight, afterHeight);
-            this.pageMaster.addStart(start);
-        }
+                    afterPrecedence, beforeExtent, afterExtent));
 
-        if (getRegion(RegionEnd.REGION_CLASS) != null) {
-            RegionArea end =
-                
((RegionEnd)getRegion(RegionEnd.REGION_CLASS)).makeRegionArea(contentRectangleXPosition,
+        if (end != null)
+            this.pageMaster.addEnd(end.makeRegionArea(contentRectangleXPosition,
                     contentRectangleYPosition, contentRectangleWidth,
                     contentRectangleHeight, beforePrecedence,
-                    afterPrecedence, beforeHeight, afterHeight);
-            this.pageMaster.addEnd(end);
-        }
+                    afterPrecedence, beforeExtent, afterExtent));
     }
 
     public PageMaster getPageMaster() {
Index: fop-cvs/xml-fop/src/org/apache/fop/layout/AreaContainer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/layout/Attic/AreaContainer.java,v
retrieving revision 1.14
diff -u -r1.14 AreaContainer.java
--- fop-cvs/xml-fop/src/org/apache/fop/layout/AreaContainer.java        30 Jul 2001 
20:29:27 -0000      1.14
+++ fop-cvs/xml-fop/src/org/apache/fop/layout/AreaContainer.java        13 Jul 2002 
+14:04:29 -0000
@@ -20,6 +20,7 @@
     private int xPosition;    // should be able to take value 'left' and 'right' too
     private int yPosition;    // should be able to take value 'top' and 'bottom' too
     private int position;
+    private boolean isRegionArea = false;
 
     // use this for identifying the general usage of the area,
     // like 'main-reference-area' or 'region-before'
@@ -34,8 +35,19 @@
         // setIsReferenceArea(true); // Should always be true!
     }
 
+    public AreaContainer(FontState fontState, int xPosition, int yPosition,
+                         int allocationWidth, int maxHeight, int position,
+                         boolean isRegionArea) {
+        this(fontState, xPosition, yPosition, allocationWidth, maxHeight,
+           position);
+        this.isRegionArea = isRegionArea;
+    }
+
     public void render(Renderer renderer) {
-        renderer.renderAreaContainer(this);
+        if (isRegionArea)
+            renderer.renderRegionAreaContainer(this);
+        else
+            renderer.renderAreaContainer(this);
     }
 
     public int getPosition() {
Index: fop-cvs/xml-fop/src/org/apache/fop/layout/RegionArea.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/layout/Attic/RegionArea.java,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 RegionArea.java
--- fop-cvs/xml-fop/src/org/apache/fop/layout/RegionArea.java   23 Apr 2002 22:26:10 
-0000      1.6.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/layout/RegionArea.java   13 Jul 2002 14:04:32 
+-0000
@@ -29,7 +29,7 @@
     public AreaContainer makeAreaContainer() {
        AreaContainer area =
            new AreaContainer(null, xPosition, yPosition, width, height,
-                             Position.ABSOLUTE);
+                             Position.ABSOLUTE, true);
        area.setBackground(getBackground());
        return area;
     }
@@ -44,6 +44,10 @@
 
     public int getHeight() {
         return height;
+    }
+
+    public int getWidth() {
+        return width;
     }
 
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/render/AbstractRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/AbstractRenderer.java,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 AbstractRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/AbstractRenderer.java     8 May 2002 
15:18:48 -0000       1.4.2.3
+++ fop-cvs/xml-fop/src/org/apache/fop/render/AbstractRenderer.java     13 Jul 2002 
+14:04:39 -0000
@@ -338,6 +338,45 @@
     }
 
     /**
+     * render region area container
+     *
+     * @param area the region area container to render
+     */
+    public void renderRegionAreaContainer(AreaContainer area) {
+        int saveY = this.currentYPosition;
+        int saveX = this.currentAreaContainerXPosition;
+
+        if (area.getPosition() == Position.ABSOLUTE) {
+            // Y position is computed assuming positive Y axis, adjust for negative 
+postscript one
+            this.currentYPosition = area.getYPosition();
+            this.currentAreaContainerXPosition = area.getXPosition();
+        } else if (area.getPosition() == Position.RELATIVE) {
+            this.currentYPosition -= area.getYPosition();
+            this.currentAreaContainerXPosition += area.getXPosition();
+        }
+
+        this.currentXPosition = this.currentAreaContainerXPosition;
+        int rx = this.currentAreaContainerXPosition;
+        int ry = this.currentYPosition;
+        int w = area.getAllocationWidth();
+        int h = area.getMaxHeight();
+
+        doBackground(area, rx, ry, w, h);
+
+        Enumeration e = area.getChildren().elements();
+        while (e.hasMoreElements()) {
+            Box b = (Box)e.nextElement();
+            b.render(this);    // span areas
+        }
+
+        if (area.getPosition() != Position.STATIC) {
+            this.currentYPosition = saveY;
+            this.currentAreaContainerXPosition = saveX;
+        } else
+            this.currentYPosition -= area.getHeight();
+    }
+
+    /**
      * render area container
      *
      * @param area the area container to render
@@ -439,5 +478,22 @@
 
         this.currentYPosition = ry - h;
         this.currentXPosition = rx;
+    }
+
+    /**
+     * render region areas
+     *
+     * @param page the page whose regions to render
+     */
+    public void renderRegions(Page page) {
+        page.getBody().render(this);
+        if (page.getBefore() != null)
+            page.getBefore().render(this);
+        if (page.getAfter() != null)
+            page.getAfter().render(this);
+        if (page.getStart() != null)
+            page.getStart().render(this);
+        if (page.getEnd() != null)
+            page.getEnd().render(this);
     }
 }
Index: fop-cvs/xml-fop/src/org/apache/fop/render/Renderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/Renderer.java,v
retrieving revision 1.19.2.2
diff -u -r1.19.2.2 Renderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/Renderer.java     11 Jun 2002 00:01:14 
-0000      1.19.2.2
+++ fop-cvs/xml-fop/src/org/apache/fop/render/Renderer.java     13 Jul 2002 14:04:40 
+-0000
@@ -66,6 +66,11 @@
     public void renderBodyAreaContainer(BodyAreaContainer area);
 
     /**
+     * render the given region area container
+     */
+    public void renderRegionAreaContainer(AreaContainer area);
+
+    /**
      * render the given span area
      */
     public void renderSpanArea(SpanArea area);
Index: fop-cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
retrieving revision 1.38.2.4
diff -u -r1.38.2.4 AWTRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java      11 Jun 2002 
00:01:14 -0000      1.38.2.4
+++ fop-cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java      13 Jul 2002 
+14:04:47 -0000
@@ -380,26 +380,11 @@
     }
 
     public void renderPage(Page page) {
-        BodyAreaContainer body;
-        AreaContainer before, after;
-
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
 
         this.currentFontName = "";
         this.currentFontSize = 0;
 
-        renderBodyAreaContainer(body);
-
-        if (before != null) {
-            renderAreaContainer(before);
-        }
-
-        if (after != null) {
-            renderAreaContainer(after);
-        }
-
+        renderRegions(page);
         // SG: Wollen wir Links abbilden?
         /*
          * if (page.hasLinks()) {
Index: fop-cvs/xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java
===================================================================
RCS file: 
/home/cvspublic/xml-fop/src/org/apache/fop/render/mif/Attic/MIFRenderer.java,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 MIFRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java      23 Apr 2002 
22:33:39 -0000      1.11.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java      13 Jul 2002 
+14:04:50 -0000
@@ -361,7 +361,7 @@
 
         this.mifDoc.createPage();
 
-        renderBodyAreaContainer(body);
+        body.render(this);
 
 
         // If the area is an instance of anything other than body, it goes into the
@@ -371,13 +371,13 @@
         if (before != null) {
 
             this.mifDoc.createTextRect(1);    // Create a rect with one col
-            renderAreaContainer(before);
+            before.render(this);
         }
 
         if (after != null) {
 
             this.mifDoc.createTextRect(1);    // Create a rect with one col
-            renderAreaContainer(after);
+            after.render(this);
         }
 
     }
Index: fop-cvs/xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 PCLRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java      23 Apr 2002 
22:33:39 -0000      1.13.2.1
+++ fop-cvs/xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java      13 Jul 2002 
+14:04:56 -0000
@@ -676,8 +676,6 @@
         if (debug)
             System.out.println("PCLRenderer.renderPage() page.Height() = "
                                + page.getHeight());
-        BodyAreaContainer body;
-        AreaContainer before, after, start, end;
 
         if (paperheight > 0 && divisions == -1)
             divisions = paperheight / (page.getHeight() / 100);
@@ -710,28 +708,10 @@
             currentStream.add("\033&k" + (leftmargin / 6f)
                               + "H\033&a1L\033&k12H");
 
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
-        start = page.getStart();
-        end = page.getEnd();
-
         this.currentFontName = "";
         this.currentFontSize = 0;
 
-        renderBodyAreaContainer(body);
-
-        if (before != null)
-            renderAreaContainer(before);
-
-        if (after != null)
-            renderAreaContainer(after);
-
-        if (start != null)
-            renderAreaContainer(start);
-
-        if (end != null)
-            renderAreaContainer(end);
+        renderRegions(page);
 
         // End page.
         if (++curdiv == divisions || divisions == -1) {
Index: fop-cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.91.2.5
diff -u -r1.91.2.5 PDFRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java      26 Jun 2002 
20:36:52 -0000      1.91.2.5
+++ fop-cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java      13 Jul 2002 
+14:05:04 -0000
@@ -828,41 +828,15 @@
      * @param page  page to render
      */
     public void renderPage(Page page) {
-        BodyAreaContainer body;
-        AreaContainer before;
-        AreaContainer after;
-        AreaContainer start;
-        AreaContainer end;
-
         currentStream = this.pdfDoc.makeStream();
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
-        start = page.getStart();
-        end = page.getEnd();
 
         this.currentFontName = "";
         this.currentFontSize = 0;
 
         currentStream.add("BT\n");
 
-        renderBodyAreaContainer(body);
-
-        if (before != null) {
-            renderAreaContainer(before);
-        }
-
-        if (after != null) {
-            renderAreaContainer(after);
-        }
-
-        if (start != null) {
-            renderAreaContainer(start);
-        }
+        renderRegions(page);
 
-        if (end != null) {
-            renderAreaContainer(end);
-        }
         closeText();
 
         float w = page.getWidth();
Index: fop-cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java,v
retrieving revision 1.15.2.5
diff -u -r1.15.2.5 PSRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java        12 Jun 2002 
05:41:02 -0000      1.15.2.5
+++ fop-cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java        13 Jul 2002 
+14:05:14 -0000
@@ -791,8 +791,6 @@
         this.pagecount++;
         this.idReferences = page.getIDReferences();
 
-        BodyAreaContainer body;
-        AreaContainer before, after;
         write("%%Page: " + page.getNumber() + " " + page.getNumber());
         write("%%PageBoundingBox: 0 0 " +
                 Math.round(page.getWidth() / 1000f) + " " +
@@ -802,16 +800,7 @@
         write("FOPFonts begin");
         write("0.001 0.001 scale");
         write("%%EndPageSetup");
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
-        if (before != null) {
-            renderAreaContainer(before);
-        }
-        renderBodyAreaContainer(body);
-        if (after != null) {
-            renderAreaContainer(after);
-        }
+        renderRegions(page);
         write("showpage");
         write("%%PageTrailer");
         write("%%EndPage"); //This is non-standard, but used by Adobe.
Index: fop-cvs/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 SVGRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java      11 Jun 2002 
00:01:15 -0000      1.3.2.2
+++ fop-cvs/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java      13 Jul 2002 
+14:05:20 -0000
@@ -261,25 +261,11 @@
     }
 
     public void renderPage(Page page) {
-        BodyAreaContainer body;
-        AreaContainer before, after;
-
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
 
         this.currentFontName = "";
         this.currentFontSize = 0;
 
-        renderBodyAreaContainer(body);
-
-        if (before != null) {
-            renderAreaContainer(before);
-        }
-
-        if (after != null) {
-            renderAreaContainer(after);
-        }
+        renderRegions(page);
     }
 
     protected void doFrame(org.apache.fop.layout.Area area) {
Index: fop-cvs/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java,v
retrieving revision 1.12.2.2
diff -u -r1.12.2.2 TXTRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java      23 Apr 2002 
22:33:40 -0000      1.12.2.2
+++ fop-cvs/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java      13 Jul 2002 
+14:05:39 -0000
@@ -1605,8 +1605,6 @@
         if (debug)
             System.out.println("TXTRenderer.renderPage() page.getHeight() = "
                                + page.getHeight());
-        BodyAreaContainer body;
-        AreaContainer before, after, start, end;
 
         maxX = (int)(textCPI * page.getWidth() / 72000 + 1);
         maxY = (int)(textLPI * page.getHeight() / 72000 + 1);
@@ -1626,29 +1624,11 @@
                                + " yFactor=" + yFactor + " paperHeight="
                                + pageHeight);
 
-        body = page.getBody();
-        before = page.getBefore();
-        after = page.getAfter();
-        start = page.getStart();
-        end = page.getEnd();
-
         this.currentFontName = "";
         this.currentFontSize = 0;
 
         // currentStream.add("BT\n");
-        renderBodyAreaContainer(body);
-
-        if (before != null)
-            renderAreaContainer(before);
-
-        if (after != null)
-            renderAreaContainer(after);
-
-        if (start != null)
-            renderAreaContainer(start);
-
-        if (end != null)
-            renderAreaContainer(end);
+        renderRegions(page);
 
         // Write out the buffers.
         for (int row = 0; row <= maxY; row++) {
Index: fop-cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java,v
retrieving revision 1.27.2.3
diff -u -r1.27.2.3 XMLRenderer.java
--- fop-cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java      11 Jun 2002 
00:01:15 -0000      1.27.2.3
+++ fop-cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java      13 Jul 2002 
+14:05:44 -0000
@@ -227,6 +227,15 @@
     }
 
     /**
+     * render a region area container to XML
+     *
+     * @param area the region area container to render
+     */
+    public void renderRegionAreaContainer(AreaContainer area) {
+        renderAreaContainer(area);
+    }
+
+    /**
      * render a span area to XML
      *
      * @param area the span area to render
@@ -434,18 +443,21 @@
      */
     public void renderPage(Page page) {
         BodyAreaContainer body;
-        AreaContainer before, after;
+        AreaContainer before, after, start, end;
         writeStartTag("<Page number=\"" + page.getFormattedNumber() + "\">");
         body = page.getBody();
         before = page.getBefore();
         after = page.getAfter();
-        if (before != null) {
-            renderAreaContainer(before);
-        }
-        renderBodyAreaContainer(body);
-        if (after != null) {
-            renderAreaContainer(after);
-        }
+        start = page.getStart();
+        end = page.getEnd();
+        if (before != null)
+            before.render(this);
+        if (after != null)
+            after.render(this);
+        if (start != null)
+            start.render(this);
+        if (end != null)
+            end.render(this);
         writeEndTag("</Page>");
     }
 

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

Reply via email to