]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Revamped marker handling. Retrieving markers works now always for
authorJoerg Pietschmann <pietsch@apache.org>
Mon, 17 Feb 2003 00:09:43 +0000 (00:09 +0000)
committerJoerg Pietschmann <pietsch@apache.org>
Mon, 17 Feb 2003 00:09:43 +0000 (00:09 +0000)
all retrieve boundaries. Long markers should also work now.
First-including-carryover does not work yet. Last-ending-within-page
probably doesn't work yet either.
Submitted by: Based on patch submitted by Marc C. Allman

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195958 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
src/org/apache/fop/apps/StreamRenderer.java
src/org/apache/fop/fo/FONode.java
src/org/apache/fop/fo/FObj.java
src/org/apache/fop/fo/flow/AbstractTableBody.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/Marker.java
src/org/apache/fop/fo/flow/RetrieveMarker.java
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/layout/Area.java
src/org/apache/fop/layout/AreaTree.java
src/org/apache/fop/layout/Page.java
src/org/apache/fop/render/xml/XMLRenderer.java
src/org/apache/fop/svg/PDFGraphics2D.java

index 64b71e0003b3d3b99f325f07955e83a4bc617af4..cc574687d4c486a1bd32699f867222e0dbc0bb15 100644 (file)
@@ -13,13 +13,14 @@ import java.util.Iterator;
 
 import org.xml.sax.SAXException;
 
-import org.apache.fop.layout.FontInfo;
-import org.apache.fop.layout.Page;
-import org.apache.fop.render.Renderer;
-import org.apache.fop.layout.AreaTree;
 import org.apache.fop.datatypes.IDReferences;
 import org.apache.fop.extensions.ExtensionObj;
+import org.apache.fop.fo.flow.Marker;
 import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.layout.AreaTree;
+import org.apache.fop.layout.FontInfo;
+import org.apache.fop.layout.Page;
+import org.apache.fop.render.Renderer;
 
 import org.apache.avalon.framework.logger.Logger;
 
@@ -98,6 +99,13 @@ public class StreamRenderer {
      */
     private ArrayList extensions = new ArrayList();
 
+    /**
+     * The list of markers.
+     */
+    private ArrayList documentMarkers;
+    private ArrayList currentPageSequenceMarkers;
+    private PageSequence currentPageSequence;
+    
     private Logger log;
 
     public StreamRenderer(OutputStream outputStream, Renderer renderer) {
@@ -126,7 +134,7 @@ public class StreamRenderer {
         pageCount = 0;
 
         if (MEM_PROFILE_WITH_GC)
-            System.gc();               // This takes time but gives better results
+            System.gc();       // This takes time but gives better results
 
         initialMemory = runtime.totalMemory() - runtime.freeMemory();
         startTime = System.currentTimeMillis();
@@ -158,7 +166,7 @@ public class StreamRenderer {
         }
 
         if (MEM_PROFILE_WITH_GC)
-            System.gc();               // This takes time but gives better results
+            System.gc();       // This takes time but gives better results
 
         long memoryNow = runtime.totalMemory() - runtime.freeMemory();
         long memoryUsed = (memoryNow - initialMemory) / 1024L;
@@ -217,33 +225,50 @@ public class StreamRenderer {
 
     public synchronized void queuePage(Page page)
     throws FOPException, IOException {
+
+        // process markers
+        PageSequence pageSequence = page.getPageSequence();
+        if (pageSequence != currentPageSequence) {
+            currentPageSequence = pageSequence;
+            currentPageSequenceMarkers = null;
+        }
+        ArrayList markers = page.getMarkers();
+        if (markers != null) {
+            if (documentMarkers == null) {
+                documentMarkers = new ArrayList();
+            }
+            if (currentPageSequenceMarkers == null) {
+                currentPageSequenceMarkers = new ArrayList();
+            }
+            for (int i=0;i<markers.size();i++) {
+                Marker marker = (Marker)markers.get(i);
+                marker.releaseRegistryArea();
+                currentPageSequenceMarkers.add(marker);
+                documentMarkers.add(marker);
+            }
+        }
+        
         /*
           Try to optimise on the common case that there are
           no pages pending and that all ID references are
           valid on the current pages. This short-cuts the
           pipeline and renders the area immediately.
         */
-        if ((renderQueue.size() == 0) && idReferences.isEveryIdValid())
+        if ((renderQueue.size() == 0) && idReferences.isEveryIdValid()) {
             renderer.render(page, outputStream);
-        else
-            addToRenderQueue(page);
-
+        } else {
+            RenderQueueEntry entry = new RenderQueueEntry(page);
+            renderQueue.add(entry);
+            /*
+              The just-added entry could (possibly) resolve the
+              waiting entries, so we try to process the queue
+              now to see.
+            */
+            processQueue(false);
+        }
         pageCount++;
     }
 
-    private synchronized void addToRenderQueue(Page page)
-    throws FOPException, IOException {
-        RenderQueueEntry entry = new RenderQueueEntry(page);
-        renderQueue.add(entry);
-
-        /*
-          The just-added entry could (possibly) resolve the
-          waiting entries, so we try to process the queue
-          now to see.
-        */
-        processQueue(false);
-    }
-
     /**
       Try to process the queue from the first entry forward.
       If an entry can't be processed, then the queue can't
@@ -266,7 +291,7 @@ public class StreamRenderer {
       plus a list of outstanding ID references that need to be
       resolved before the Page can be renderered.<P>
     */
-    class RenderQueueEntry extends Object {
+    class RenderQueueEntry {
         /*
           The Page that has outstanding ID references.
         */
@@ -309,55 +334,18 @@ public class StreamRenderer {
         }
     }
 
-  // unused and broken
-//      public Page getNextPage(Page current, boolean isWithinPageSequence,
-//                              boolean isFirstCall) {
-//          Page nextPage = null;
-//          int pageIndex = 0;
-//          if (isFirstCall)
-//              pageIndex = renderQueue.size();
-//          else
-//              pageIndex = renderQueue.indexOf(current);
-//          if ((pageIndex + 1) < renderQueue.size()) {
-//              nextPage = ((RenderQueueEntry)renderQueue
-//                          .get(pageIndex + 1)).getPage();
-//              if (isWithinPageSequence
-//                      &&!nextPage.getPageSequence().equals(current.getPageSequence())) {
-//                  nextPage = null;
-//              }
-//          }
-//          return nextPage;
-//      }
-
-    public Page getPreviousPage(Page current, boolean isWithinPageSequence,
-                                boolean isFirstCall) {
-        if (isFirstCall) {
-            int pageIndex = renderQueue.size();
-            if (pageIndex > 0) {
-                Page previousPage = ((RenderQueueEntry)renderQueue
-                                     .get(pageIndex - 1)).getPage();
-                PageSequence currentPS = current.getPageSequence();
-                PageSequence previousPS = previousPage.getPageSequence();
-                if (!isWithinPageSequence || previousPS.equals(currentPS)) {
-                   return previousPage;
-                }
-            }
-        } else {
-            for (int pageIndex=renderQueue.size()-1;pageIndex>0;pageIndex--) {
-                Page page = ((RenderQueueEntry)renderQueue
-                             .get(pageIndex)).getPage();
-                if (current.equals(page)) {
-                    Page previousPage = ((RenderQueueEntry)renderQueue
-                                         .get(pageIndex - 1)).getPage();
-                    PageSequence currentPS = current.getPageSequence();
-                    PageSequence previousPS = previousPage.getPageSequence();
-                    if (!isWithinPageSequence || previousPS.equals(currentPS)) {
-                        return previousPage;
-                    }
-                    return null;
-                }
-            }
-        }
-        return null;
+    // Auxillary function for retrieving markers.
+    public ArrayList getDocumentMarkers() {
+        return documentMarkers;
+    }
+
+    // Auxillary function for retrieving markers.
+    public PageSequence getCurrentPageSequence() {
+        return currentPageSequence;
+    }
+
+    // Auxillary function for retrieving markers.
+    public ArrayList getCurrentPageSequenceMarkers() {
+        return currentPageSequenceMarkers;
     }
 }
index 90634741a7d75d11f3629ae740357c3e2fff0514..1f9e1bcf3eb4c5bc879f679e65e53f977d3d50d5 100644 (file)
@@ -109,6 +109,7 @@ abstract public class FONode {
 
     public void resetMarker() {
         this.marker = START;
+        this.areasGenerated=0;
         int numChildren = this.children.size();
         for (int i = 0; i < numChildren; i++) {
             ((FONode)children.get(i)).resetMarker();
index a9f3fede337ef4c536cd1ce305554e3c5b104e7d..9b71d2341432918df14d30dcc93ffc6e7ed3ca79 100644 (file)
@@ -14,7 +14,7 @@ import org.apache.fop.datatypes.IDReferences;
 import org.apache.fop.fo.flow.Marker;
 
 // Java
-import java.util.HashMap;
+import java.util.HashSet;
 import java.util.ArrayList;
 
 /**
@@ -32,7 +32,7 @@ public abstract class FObj extends FONode {
     protected PropertyManager propMgr;
 
     // markers
-    private HashMap markers;
+    private HashSet markerClassNames;
 
     protected FObj(FObj parent, PropertyList propertyList) {
         super(parent);
@@ -151,40 +151,40 @@ public abstract class FObj extends FONode {
     }
 
 
-    public void addMarker(Marker marker) throws FOPException {
-        String mcname = marker.getMarkerClassName();
-        if (children != null) {
-            for (int i = 0; i < children.size(); i++) {
-                FONode child = (FONode)children.get(i);
-                if (!child.mayPrecedeMarker()) {
-                  throw new FOPException("A fo:marker must be an initial child of '"
-                                         + getName()+"'");
-                }
-            }
-        }
-        if (markers==null) {
-            markers = new HashMap();
-            markers.put(mcname, marker);
-        } else if (!markers.containsKey(mcname) ) {
-            markers.put(mcname, marker);
-        } else {
-            throw new FOPException("marker-class-name '"
-                                   + mcname
-                                   + "' already exists for this parent");
-        }
-    }
-
-    public boolean hasMarkers() {
-        return markers!=null;
-    }
-
-    public ArrayList getMarkers() {
-        if (markers==null) {
-            log.debug("GetMarkers failed (no markers). Should not happen.");
-            return null;
-        } else {
-            return new ArrayList(markers.values());
-        }
-    }
+     public void addMarker(String markerClassName) throws FOPException {
+//         String mcname = marker.getMarkerClassName();
+         if (children != null) {
+             for (int i = 0; i < children.size(); i++) {
+                 FONode child = (FONode)children.get(i);
+                 if (!child.mayPrecedeMarker()) {
+                   throw new FOPException("A fo:marker must be an initial child of '"
+                                          + getName()+"'");
+                 }
+             }
+         }
+         if (markerClassNames==null) {
+             markerClassNames = new HashSet();
+             markerClassNames.add(markerClassName);
+         } else if (!markerClassNames.contains(markerClassName) ) {
+             markerClassNames.add(markerClassName);
+         } else {
+             throw new FOPException("marker-class-name '"
+                                    + markerClassName
+                                    + "' already exists for this parent");
+         }
+     }
+
+//     public boolean hasMarkers() {
+//         return markers!=null;
+//     }
+
+//     public ArrayList getMarkers() {
+//         if (markers==null) {
+//             log.debug("GetMarkers failed (no markers). Should not happen.");
+//             return null;
+//         } else {
+//             return new ArrayList(markers.values());
+//         }
+//     }
 }
 
index 329172512de0a5279a04c3b39a845c09d99219e3..0a9d769de803f29b7df63c6fa499f50ee74f9991 100644 (file)
@@ -138,6 +138,10 @@ public abstract class AbstractTableBody extends FObj {
         boolean endKeepGroup = true;
         for (int i = this.marker; i < numChildren; i++) {
             Object child = children.get(i);
+            if (child instanceof Marker) {
+                ((Marker)child).layout(area);
+                continue;
+            }
             if (!(child instanceof TableRow)) {
                 throw new FOPException("Currently only Table Rows are supported in table body, header and footer");
             }
index b9194d23aad3b209c08096d0bf2da7c7132551c0..83b8acba981e4b7902a0de19ec9f639baf9620fc 100644 (file)
@@ -181,11 +181,11 @@ public class Block extends FObjMixed {
         if (this.areasGenerated == 1)
             blockArea.isFirst(true);
         // for normal areas this should be the only pair
-        blockArea.addLineagePair(this, this.areasGenerated);
+//        blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            blockArea.addMarkers(this.getMarkers());
+//         if (this.hasMarkers())
+//             blockArea.addMarkers(this.getMarkers());
 
         blockArea.setParent(area);    // BasicLink needs it
         blockArea.setPage(area.getPage());
index 139db6bab584da9b20b8c1e42a9a73935cb6f8bd..d39fac0783a606214b18516ec4168a3e13eb2442 100644 (file)
@@ -124,11 +124,11 @@ public class ListBlock extends FObj {
         if (this.areasGenerated == 1)
             blockArea.isFirst(true);
             // for normal areas this should be the only pair
-        blockArea.addLineagePair(this, this.areasGenerated);
+//        blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            blockArea.addMarkers(this.getMarkers());
+//         if (this.hasMarkers())
+//             blockArea.addMarkers(this.getMarkers());
 
 
         blockArea.setParent(area);
index 088a524150b56800288b84f2164866d8196de344..0ec9eb9c127f50dcf99dc93f3c672e85d876877d 100644 (file)
@@ -113,11 +113,11 @@ public class ListItem extends FObj {
         if (this.areasGenerated == 1)
             this.blockArea.isFirst(true);
             // for normal areas this should be the only pair
-        this.blockArea.addLineagePair(this, this.areasGenerated);
+//        this.blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            this.blockArea.addMarkers(this.getMarkers());
+//         if (this.hasMarkers())
+//             this.blockArea.addMarkers(this.getMarkers());
 
         blockArea.setParent(area);
         blockArea.setPage(area.getPage());
index 5b113a1faab2c0be4fbea8b71d2f85e67771841b..99a07166499b45d368b6154fee0cecb32e0a2e5a 100644 (file)
@@ -18,6 +18,8 @@ public class Marker extends FObjMixed {
 
     private String markerClassName;
     private Area registryArea;
+    private boolean isFirst;
+    private boolean isLast;
 
     public static class Maker extends FObj.Maker {
         public FObj make(FObj parent,
@@ -42,7 +44,7 @@ public class Marker extends FObjMixed {
 
         // check to ensure that no other marker with same parent
         // has this 'marker-class-name' is in addMarker() method
-        parent.addMarker(this);
+        parent.addMarker(this.markerClassName);
     }
 
     public String getName() {
@@ -52,9 +54,7 @@ public class Marker extends FObjMixed {
     public int layout(Area area) throws FOPException {
         // no layout action desired
         this.registryArea = area;
-        area.addMarker(this);
         area.getPage().registerMarker(this);
-        // System.out.println("Marker being registered in area '" + area + "'");
         return Status.OK;
     }
 
@@ -87,4 +87,33 @@ public class Marker extends FObjMixed {
     public boolean mayPrecedeMarker() {
         return true;
     }  
+
+    // The page the marker was registered is put into the renderer
+    // queue. The marker is transferred to it's own marker list,
+    // release the area for GC. We also know now whether the area is
+    // first/last.
+    public void releaseRegistryArea() {
+        isFirst = registryArea.isFirst();
+        isLast = registryArea.isLast();
+        registryArea = null;
+    }
+    
+    // This has actually nothing to do with resseting this marker,
+    // but the 'marker' from FONode, marking layout status.
+    // Called in case layout is to be rolled back. Unregister this
+    // marker from the page, it isn't laid aout anyway.
+    public void resetMarker() {
+        if (registryArea != null ) {
+            Page page=registryArea.getPage();
+            if (page != null) {
+                page.unregisterMarker(this);
+            }
+        }
+    }
+
+    // More hackery: reset layout status marker. Called before the
+    // content is laid out from RetrieveMarker.
+    public void resetMarkerContent() {
+        super.resetMarker();
+    }
 }
index a9cdcd6750b334bb09e811f4d7ce28ae3ecc57d5..b9bb274acd6c8346f0924860d3bbd1ccbe7783ac 100644 (file)
@@ -8,10 +8,15 @@
 package org.apache.fop.fo.flow;
 
 // FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.*;
-import org.apache.fop.datatypes.*;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.Status;
+import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.properties.RetrieveBoundary;
+import org.apache.fop.fo.properties.RetrievePosition;
+import org.apache.fop.layout.Area;
+import org.apache.fop.layout.AreaTree;
+import org.apache.fop.layout.Page;
 import org.apache.fop.apps.FOPException;
 
 // Java
@@ -22,6 +27,7 @@ public class RetrieveMarker extends FObj {
     private String retrieveClassName;
     private int retrievePosition;
     private int retrieveBoundary;
+    private Marker bestMarker;
 
     public static class Maker extends FObj.Maker {
         public FObj make(FObj parent,
@@ -51,69 +57,63 @@ public class RetrieveMarker extends FObj {
     }
 
     public int layout(Area area) throws FOPException {
-        // locate qualifying areas by 'marker-class-name' and
-        // 'retrieve-boundary'. Initially we will always check
-        // the containing page
-        Page containingPage = area.getPage();
-        Marker bestMarker = searchPage(containingPage, true);
-
-        // if marker not yet found, and 'retrieve-boundary' permits,
-        // search backward by Page
-        if (bestMarker == null) {
-            if (retrieveBoundary != RetrieveBoundary.PAGE) {
-//                System.out.println("Null bestMarker and searching...");
-                Page currentPage = containingPage;
-                boolean isFirstCall = true;
-                while (bestMarker == null) {
-                    Page previousPage = locatePreviousPage(currentPage,
-                                                           retrieveBoundary,
-                                                           isFirstCall);
-                    isFirstCall = false;
-                    if (previousPage!=null) {
-                        bestMarker = searchPage(previousPage, false);
-                        currentPage = previousPage;
-                    } else {
-                        return Status.OK;
-                    }
+        if (marker == START) {
+            marker = 0;
+            // locate qualifying areas by 'marker-class-name' and
+            // 'retrieve-boundary'. Initially we will always check
+            // the containing page
+            Page containingPage = area.getPage();
+            bestMarker = searchPage(containingPage);
+
+            if (bestMarker != null) {
+                bestMarker.resetMarkerContent();
+                return bestMarker.layoutMarker(area);
+            }
+            // If marker not yet found, and 'retrieve-boundary' permits,
+            // search backward.
+            AreaTree areaTree = containingPage.getAreaTree();
+            if (retrieveBoundary == RetrieveBoundary.PAGE_SEQUENCE) {
+                PageSequence pageSequence = areaTree.getCurrentPageSequence();
+                if (pageSequence == containingPage.getPageSequence() ) {
+                    return layoutBestMarker(areaTree.getCurrentPageSequenceMarkers(),area);
                 }
+            } else if (retrieveBoundary == RetrieveBoundary.DOCUMENT) {
+                return layoutBestMarker(areaTree.getDocumentMarkers(),area);
             } else {
-                return Status.OK;
+                throw new FOPException("Illegal 'retrieve-boundary' value");
             }
+        } else if (bestMarker != null) {
+            return bestMarker.layoutMarker(area);
         }
-
-        int status = Status.OK;
-        // System.out.println("Laying out marker '" + bestMarker + "' in area '" + area + "'");
-        // the 'markers' referred to in this method are internal; they have
-        // nothing to do with fo:marker
-        bestMarker.resetMarker();
-        status = bestMarker.layoutMarker(area);
-        return status;
+        return Status.OK;
     }
 
-    private Marker searchPage(Page page,
-                              boolean isContainingPage) throws FOPException {
-        ArrayList pageMarkers = page.getMarkers();
-        if (pageMarkers.isEmpty()) {
-            // System.out.println("No markers on page");
-            return null;
-        }
-
-        // if no longer the containing page (fo:retrieve-marker, or the page
-        // being processed), grab the last qualifying marker on this one
-        if (!isContainingPage) {
-            for (int c = pageMarkers.size(); c > 0; c--) {
-                Marker currentMarker = (Marker)pageMarkers.get(c - 1);
+    private int layoutBestMarker(ArrayList markers, Area area)
+        throws FOPException {
+        if (markers!=null) {
+            for (int i = markers.size() - 1; i >= 0; i--) {
+                Marker currentMarker = (Marker)markers.get(i);
                 if (currentMarker.getMarkerClassName().equals(retrieveClassName)) {
-                    return currentMarker;
+                    bestMarker = currentMarker;
+                    bestMarker.resetMarkerContent();
+                    return bestMarker.layoutMarker(area);
                 }
             }
         }
+        return Status.OK;
+    }
+    
+    private Marker searchPage(Page page) throws FOPException {
+        ArrayList pageMarkers = page.getMarkers();
+        if (pageMarkers.isEmpty()) {
+            return null;
+        }
 
         // search forward if 'first-starting-within-page' or
         // 'first-including-carryover'
         if (retrievePosition == RetrievePosition.FIC) {
-            for (int c = 0; c < pageMarkers.size(); c++) {
-                Marker currentMarker = (Marker)pageMarkers.get(c);
+            for (int i = 0; i < pageMarkers.size(); i++) {
+                Marker currentMarker = (Marker)pageMarkers.get(i);
                 if (currentMarker.getMarkerClassName().equals(retrieveClassName)) {
                     return currentMarker;
                 }
@@ -128,8 +128,8 @@ public class RetrieveMarker extends FObj {
                 }
             }
         } else if (retrievePosition == RetrievePosition.LSWP) {
-            for (int i = pageMarkers.size(); i > 0; i--) {
-                Marker currentMarker = (Marker)pageMarkers.get(i - 1);
+            for (int i = pageMarkers.size() - 1; i >= 0; i--) {
+                Marker currentMarker = (Marker)pageMarkers.get(i);
                 if (currentMarker.getMarkerClassName().equals(retrieveClassName)) {
                     if (currentMarker.getRegistryArea().isFirst()) {
                         return currentMarker;
@@ -138,8 +138,8 @@ public class RetrieveMarker extends FObj {
             }
 
         } else if (retrievePosition == RetrievePosition.LEWP) {
-            for (int c = pageMarkers.size(); c > 0; c--) {
-                Marker currentMarker = (Marker)pageMarkers.get(c - 1);
+            for (int i = pageMarkers.size() - 1; i >= 0; i--) {
+                Marker currentMarker = (Marker)pageMarkers.get(i);
                 if (currentMarker.getMarkerClassName().equals(retrieveClassName)) {
                     if (currentMarker.getRegistryArea().isLast()) {
                         return currentMarker;
@@ -153,13 +153,4 @@ public class RetrieveMarker extends FObj {
         return null;
     }
 
-    private Page locatePreviousPage(Page page, int retrieveBoundary,
-                                    boolean isFirstCall) {
-        boolean pageWithinSequence = true;
-        if (retrieveBoundary == RetrieveBoundary.DOCUMENT)
-            pageWithinSequence = false;
-        return page.getAreaTree().getPreviousPage(page, pageWithinSequence,
-        isFirstCall);
-    }
-
 }
index 89f36f2f7cee77a82765d21e0c2c3a51cb795701..6178df07bff214f5e4c66d32d93f3502ae4341d9 100644 (file)
@@ -200,6 +200,10 @@ public class Table extends FObj {
         
         for (int i = this.marker; i < numChildren; i++) {
             FONode fo = (FONode)children.get(i);
+            if (fo instanceof Marker) {
+                 ((Marker)fo).layout(area);
+                 continue;
+             }
             if (fo instanceof TableHeader) {
                 if (columns.size() == 0) {
                     log.warn("current implementation of tables requires a table-column for each column, indicating column-width");
@@ -344,11 +348,6 @@ public class Table extends FObj {
         return Status.OK;
     }
 
-    public void resetMarker() {
-        this.areasGenerated=0;
-        super.resetMarker();
-    }
-
     protected void setupColumnHeights() {
         for (int i = 0; i < columns.size(); i++) {
             TableColumn c = (TableColumn)columns.get(i);
index b5d8cffc8b2e79adcb8ea2856f3f96efdf5fb915..ce5c110f25879c7a7baf4d36b4ae5aec433435c7 100644 (file)
@@ -9,7 +9,7 @@ package org.apache.fop.layout;
 
 // FOP
 import org.apache.fop.datatypes.*;
-import org.apache.fop.fo.flow.Marker;
+//import org.apache.fop.fo.flow.Marker;
 import org.apache.fop.layout.inline.InlineSpace;
 
 // Java
@@ -55,11 +55,11 @@ abstract public class Area extends Box {
 
     private IDReferences idReferences;
 
-    protected ArrayList markers;
+//    protected ArrayList markers;
 
     // as defined in Section 6.1.1
     protected org.apache.fop.fo.FObj generatedBy;    // corresponds to 'generated-by' trait
-    protected HashMap returnedBy;
+//    protected HashMap returnedBy;
 
     // as defined in Section 6.1.1
     protected String areaClass;
@@ -78,8 +78,8 @@ abstract public class Area extends Box {
 
     public Area(FontState fontState) {
         setFontState(fontState);
-        this.markers = new ArrayList();
-        this.returnedBy = new HashMap();
+//        this.markers = new ArrayList();
+//        this.returnedBy = new HashMap();
     }
 
     /**
@@ -96,8 +96,8 @@ abstract public class Area extends Box {
         this.allocationWidth = allocationWidth;
         this.contentRectangleWidth = allocationWidth;
         this.maxHeight = maxHeight;
-        this.markers = new ArrayList();
-        this.returnedBy = new HashMap();
+//        this.markers = new ArrayList();
+//        this.returnedBy = new HashMap();
     }
 
     private void setFontState(FontState fontState) {
@@ -399,21 +399,21 @@ abstract public class Area extends Box {
         return bp;
     }
 
-    public void addMarker(Marker marker) {
-        markers.add(marker);
-    }
+//     public void addMarker(Marker marker) {
+//         markers.add(marker);
+//     }
 
-    public void addMarkers(ArrayList markers) {
-        markers.addAll(markers);
-    }
+//     public void addMarkers(ArrayList markers) {
+//         markers.addAll(markers);
+//     }
 
-    public void addLineagePair(org.apache.fop.fo.FObj fo, int areaPosition) {
-        returnedBy.put(fo, new Integer(areaPosition));
-    }
+//     public ArrayList getMarkers() {
+//         return markers;
+//     }
 
-    public ArrayList getMarkers() {
-        return markers;
-    }
+//     public void addLineagePair(org.apache.fop.fo.FObj fo, int areaPosition) {
+//         returnedBy.put(fo, new Integer(areaPosition));
+//     }
 
     public void setGeneratedBy(org.apache.fop.fo.FObj generatedBy) {
         this.generatedBy = generatedBy;
index 73a2a78d1faaad5f50a578aaf3d9c183829006c8..6d05701bf26cd309c1f935fd86220e56c9a257c3 100644 (file)
@@ -60,16 +60,6 @@ public class AreaTree {
         return this.fontInfo;
     }
 
-//      public Page getNextPage(Page current, boolean isWithinPageSequence,
-//                              boolean isFirstCall) {
-//          return streamRenderer.getNextPage(current, isWithinPageSequence,isFirstCall);
-//      }
-
-    public Page getPreviousPage(Page current, boolean isWithinPageSequence,
-                                boolean isFirstCall) {
-        return streamRenderer.getPreviousPage(current,isWithinPageSequence,isFirstCall);
-    }
-
     public void addPage(Page page)
     throws FOPException {
         try {
@@ -92,4 +82,18 @@ public class AreaTree {
         rootExtensions.add(obj);
     }
 
+    // Auxillary function for retrieving markers.
+    public ArrayList getDocumentMarkers() {
+        return streamRenderer.getDocumentMarkers();
+    }
+
+    // Auxillary function for retrieving markers.
+    public PageSequence getCurrentPageSequence() {
+        return streamRenderer.getCurrentPageSequence();
+    }
+
+    // Auxillary function for retrieving markers.
+    public ArrayList getCurrentPageSequenceMarkers() {
+        return streamRenderer.getCurrentPageSequenceMarkers();
+    }
 }
index 7101124122764713ffd2637f1d2d09b6468a2669..79c2e6a7ee8845c9bfd3b429ec3b7a5f4e5a7626 100644 (file)
@@ -216,6 +216,10 @@ public class Page {
         markers.add(marker);
     }
 
+    public void unregisterMarker(Marker marker) {
+        markers.remove(marker);
+    }
+
     public ArrayList getMarkers() {
         return this.markers;
     }
index 7cd4e0eb40e656777f3dbbc9d48678034b9cbdfd..2de844c3a4081e22268068d5ed5ec58f6e49e503 100644 (file)
@@ -273,22 +273,22 @@ public class XMLRenderer implements Renderer {
         writeStartTag(baText.toString());
 
         // write out marker info
-        List markers = area.getMarkers();
-        if (!markers.isEmpty()) {
-            writeStartTag("<Markers>");
-            for (int i = 0; i < markers.size(); i++) {
-                org.apache.fop.fo.flow.Marker marker =
-                    (org.apache.fop.fo.flow.Marker)markers.get(i);
-                StringBuffer maText = new StringBuffer();
-                maText.append("<Marker marker-class-name=\""
-                              + marker.getMarkerClassName() + "\"");
-                maText.append(" RegisteredArea=\"" + marker.getRegistryArea()
-                              + "\"");
-                maText.append("/>");
-                writeEmptyElementTag(maText.toString());
-            }
-            writeEndTag("</Markers>");
-        }
+//         List markers = area.getMarkers();
+//         if (!markers.isEmpty()) {
+//             writeStartTag("<Markers>");
+//             for (int i = 0; i < markers.size(); i++) {
+//                 org.apache.fop.fo.flow.Marker marker =
+//                     (org.apache.fop.fo.flow.Marker)markers.get(i);
+//                 StringBuffer maText = new StringBuffer();
+//                 maText.append("<Marker marker-class-name=\""
+//                               + marker.getMarkerClassName() + "\"");
+//                 maText.append(" RegisteredArea=\"" + marker.getRegistryArea()
+//                               + "\"");
+//                 maText.append("/>");
+//                 writeEmptyElementTag(maText.toString());
+//             }
+//             writeEndTag("</Markers>");
+//         }
 
         List children = area.getChildren();
         for (int i = 0; i < children.size(); i++) {
@@ -311,22 +311,22 @@ public class XMLRenderer implements Renderer {
         writeStartTag(iaText.toString());
 
         // write out marker info
-        List markers = area.getMarkers();
-        if (!markers.isEmpty()) {
-            writeStartTag("<Markers>");
-            for (int i = 0; i < markers.size(); i++) {
-                org.apache.fop.fo.flow.Marker marker =
-                    (org.apache.fop.fo.flow.Marker)markers.get(i);
-                StringBuffer maText = new StringBuffer();
-                maText.append("<Marker marker-class-name=\""
-                              + marker.getMarkerClassName() + "\"");
-                maText.append(" RegisteredArea=\"" + marker.getRegistryArea()
-                              + "\"");
-                maText.append("/>");
-                writeEmptyElementTag(maText.toString());
-            }
-            writeEndTag("</Markers>");
-        }
+//         List markers = area.getMarkers();
+//         if (!markers.isEmpty()) {
+//             writeStartTag("<Markers>");
+//             for (int i = 0; i < markers.size(); i++) {
+//                 org.apache.fop.fo.flow.Marker marker =
+//                     (org.apache.fop.fo.flow.Marker)markers.get(i);
+//                 StringBuffer maText = new StringBuffer();
+//                 maText.append("<Marker marker-class-name=\""
+//                               + marker.getMarkerClassName() + "\"");
+//                 maText.append(" RegisteredArea=\"" + marker.getRegistryArea()
+//                               + "\"");
+//                 maText.append("/>");
+//                 writeEmptyElementTag(maText.toString());
+//             }
+//             writeEndTag("</Markers>");
+//         }
 
         List children = area.getChildren();
         for (int i = 0; i < children.size(); i++) {
index 6ae06b5a516926142b3e05ba89258fb5250f6d46..631a5cc63199a1bd649606731aeff7f70d3009de 100644 (file)
@@ -1285,9 +1285,11 @@ System.out.println("getting getNormalizingTransform");
         }
 
         // needed for compiling under jdk1.4
+        @jdk14codestart@
         public java.awt.image.VolatileImage createCompatibleVolatileImage(int width, int height) {
             return null;
         }
+        @jdk14codeend@
     }
 
     /**