]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
This just moves the marker supporting code from before Mark's patch into
authorSteve Coffman <gears@apache.org>
Mon, 6 Aug 2001 17:56:35 +0000 (17:56 +0000)
committerSteve Coffman <gears@apache.org>
Mon, 6 Aug 2001 17:56:35 +0000 (17:56 +0000)
StreamRenderer. However, I'm not satisfied that it actually works the same.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194398 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/apps/StreamRenderer.java
src/org/apache/fop/layout/AreaTree.java

index 899e874b816c878f19713c6a14ad9832b3d995c6..448ec0d664a1ebb649871be3a5e1c7441f22f65e 100644 (file)
@@ -271,4 +271,45 @@ public class StreamRenderer extends Object {
             return true;
         }
     }
+    
+       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 = (Page)renderQueue.elementAt(pageIndex + 1);
+            if (isWithinPageSequence
+                    &&!nextPage.getPageSequence().equals(current.getPageSequence())) {
+                nextPage = null;
+            }
+        }
+        return nextPage;
+    }
+
+    public Page getPreviousPage(Page current, boolean isWithinPageSequence,
+                                boolean isFirstCall) {
+        Page previousPage = null;
+        int pageIndex = 0;
+        if (isFirstCall)
+            pageIndex = renderQueue.size();
+        else
+            pageIndex = renderQueue.indexOf(current);
+        // System.out.println("Page index = " + pageIndex);
+        if ((pageIndex - 1) >= 0) {
+            previousPage = (Page)renderQueue.elementAt(pageIndex - 1);
+            PageSequence currentPS = current.getPageSequence();
+            // System.out.println("Current PS = '" + currentPS + "'");
+            PageSequence previousPS = previousPage.getPageSequence();
+            // System.out.println("Previous PS = '" + previousPS + "'");
+            if (isWithinPageSequence &&!previousPS.equals(currentPS)) {
+                // System.out.println("Outside page sequence");
+                previousPage = null;
+            }
+        }
+        return previousPage;
+    }
 }
index 0f4d3ea5636271a22ee03013d68e18b50a1b36c7..85a987b456440d06ead2b74d3b1c0a427540b5eb 100644 (file)
@@ -65,12 +65,12 @@ public class AreaTree {
 
     public Page getNextPage(Page current, boolean isWithinPageSequence,
                             boolean isFirstCall) {
-        return current;
+        return streamRenderer.getNextPage(current, isWithinPageSequence,isFirstCall);
     }
 
     public Page getPreviousPage(Page current, boolean isWithinPageSequence,
                                 boolean isFirstCall) {
-        return current;
+        return streamRenderer.getPreviousPage(current,isWithinPageSequence,isFirstCall);
     }
 
     public void addPage(Page page)