aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorSteve Coffman <gears@apache.org>2001-08-06 17:56:35 +0000
committerSteve Coffman <gears@apache.org>2001-08-06 17:56:35 +0000
commit503e563a5bf474c2a046346261273c1d44b98c69 (patch)
tree959256427d2898ec4fa55783de14c5c22b05a859 /src/org/apache
parent8a3bc2543bd1c31e78da3b8fa919e53e4f3dd1ee (diff)
downloadxmlgraphics-fop-503e563a5bf474c2a046346261273c1d44b98c69.tar.gz
xmlgraphics-fop-503e563a5bf474c2a046346261273c1d44b98c69.zip
This just moves the marker supporting code from before Mark's patch into
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
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/apps/StreamRenderer.java41
-rw-r--r--src/org/apache/fop/layout/AreaTree.java4
2 files changed, 43 insertions, 2 deletions
diff --git a/src/org/apache/fop/apps/StreamRenderer.java b/src/org/apache/fop/apps/StreamRenderer.java
index 899e874b8..448ec0d66 100644
--- a/src/org/apache/fop/apps/StreamRenderer.java
+++ b/src/org/apache/fop/apps/StreamRenderer.java
@@ -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;
+ }
}
diff --git a/src/org/apache/fop/layout/AreaTree.java b/src/org/apache/fop/layout/AreaTree.java
index 0f4d3ea56..85a987b45 100644
--- a/src/org/apache/fop/layout/AreaTree.java
+++ b/src/org/apache/fop/layout/AreaTree.java
@@ -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)