From f4ca12c13b8a7a829fc599b8823718ca4405602a Mon Sep 17 00:00:00 2001 From: Joerg Pietschmann Date: Mon, 17 Feb 2003 00:09:43 +0000 Subject: [PATCH] Revamped marker handling. Retrieving markers works now always for 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 --- src/org/apache/fop/apps/StreamRenderer.java | 136 ++++++++---------- src/org/apache/fop/fo/FONode.java | 1 + src/org/apache/fop/fo/FObj.java | 74 +++++----- .../apache/fop/fo/flow/AbstractTableBody.java | 4 + src/org/apache/fop/fo/flow/Block.java | 6 +- src/org/apache/fop/fo/flow/ListBlock.java | 6 +- src/org/apache/fop/fo/flow/ListItem.java | 6 +- src/org/apache/fop/fo/flow/Marker.java | 35 ++++- .../apache/fop/fo/flow/RetrieveMarker.java | 123 ++++++++-------- src/org/apache/fop/fo/flow/Table.java | 9 +- src/org/apache/fop/layout/Area.java | 38 ++--- src/org/apache/fop/layout/AreaTree.java | 24 ++-- src/org/apache/fop/layout/Page.java | 4 + .../apache/fop/render/xml/XMLRenderer.java | 64 ++++----- src/org/apache/fop/svg/PDFGraphics2D.java | 2 + 15 files changed, 277 insertions(+), 255 deletions(-) diff --git a/src/org/apache/fop/apps/StreamRenderer.java b/src/org/apache/fop/apps/StreamRenderer.java index 64b71e000..cc574687d 100644 --- a/src/org/apache/fop/apps/StreamRenderer.java +++ b/src/org/apache/fop/apps/StreamRenderer.java @@ -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 */ - 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; } } diff --git a/src/org/apache/fop/fo/FONode.java b/src/org/apache/fop/fo/FONode.java index 90634741a..1f9e1bcf3 100644 --- a/src/org/apache/fop/fo/FONode.java +++ b/src/org/apache/fop/fo/FONode.java @@ -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(); diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java index a9f3fede3..9b71d2341 100644 --- a/src/org/apache/fop/fo/FObj.java +++ b/src/org/apache/fop/fo/FObj.java @@ -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()); +// } +// } } diff --git a/src/org/apache/fop/fo/flow/AbstractTableBody.java b/src/org/apache/fop/fo/flow/AbstractTableBody.java index 329172512..0a9d769de 100644 --- a/src/org/apache/fop/fo/flow/AbstractTableBody.java +++ b/src/org/apache/fop/fo/flow/AbstractTableBody.java @@ -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"); } diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index b9194d23a..83b8acba9 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java index 139db6bab..d39fac078 100644 --- a/src/org/apache/fop/fo/flow/ListBlock.java +++ b/src/org/apache/fop/fo/flow/ListBlock.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java index 088a52415..0ec9eb9c1 100644 --- a/src/org/apache/fop/fo/flow/ListItem.java +++ b/src/org/apache/fop/fo/flow/ListItem.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/Marker.java b/src/org/apache/fop/fo/flow/Marker.java index 5b113a1fa..99a071664 100644 --- a/src/org/apache/fop/fo/flow/Marker.java +++ b/src/org/apache/fop/fo/flow/Marker.java @@ -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(); + } } diff --git a/src/org/apache/fop/fo/flow/RetrieveMarker.java b/src/org/apache/fop/fo/flow/RetrieveMarker.java index a9cdcd675..b9bb274ac 100644 --- a/src/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/org/apache/fop/fo/flow/RetrieveMarker.java @@ -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); - } - } diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 89f36f2f7..6178df07b 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -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); diff --git a/src/org/apache/fop/layout/Area.java b/src/org/apache/fop/layout/Area.java index b5d8cffc8..ce5c110f2 100644 --- a/src/org/apache/fop/layout/Area.java +++ b/src/org/apache/fop/layout/Area.java @@ -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; diff --git a/src/org/apache/fop/layout/AreaTree.java b/src/org/apache/fop/layout/AreaTree.java index 73a2a78d1..6d05701bf 100644 --- a/src/org/apache/fop/layout/AreaTree.java +++ b/src/org/apache/fop/layout/AreaTree.java @@ -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(); + } } diff --git a/src/org/apache/fop/layout/Page.java b/src/org/apache/fop/layout/Page.java index 710112412..79c2e6a7e 100644 --- a/src/org/apache/fop/layout/Page.java +++ b/src/org/apache/fop/layout/Page.java @@ -216,6 +216,10 @@ public class Page { markers.add(marker); } + public void unregisterMarker(Marker marker) { + markers.remove(marker); + } + public ArrayList getMarkers() { return this.markers; } diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index 7cd4e0eb4..2de844c3a 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -273,22 +273,22 @@ public class XMLRenderer implements Renderer { writeStartTag(baText.toString()); // write out marker info - List markers = area.getMarkers(); - if (!markers.isEmpty()) { - writeStartTag(""); - 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(""); - writeEmptyElementTag(maText.toString()); - } - writeEndTag(""); - } +// List markers = area.getMarkers(); +// if (!markers.isEmpty()) { +// writeStartTag(""); +// 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(""); +// writeEmptyElementTag(maText.toString()); +// } +// writeEndTag(""); +// } 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(""); - 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(""); - writeEmptyElementTag(maText.toString()); - } - writeEndTag(""); - } +// List markers = area.getMarkers(); +// if (!markers.isEmpty()) { +// writeStartTag(""); +// 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(""); +// writeEmptyElementTag(maText.toString()); +// } +// writeEndTag(""); +// } List children = area.getChildren(); for (int i = 0; i < children.size(); i++) { diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java index 6ae06b5a5..631a5cc63 100644 --- a/src/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -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@ } /** -- 2.39.5