You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ke...@apache.org on 2002/05/17 16:47:13 UTC
cvs commit: xml-fop/src/org/apache/fop/render AbstractRenderer.java
keiron 02/05/17 07:47:13
Modified: src/org/apache/fop/apps StreamRenderer.java
src/org/apache/fop/area AreaTree.java BodyRegion.java
Page.java PageViewport.java RegionReference.java
RegionViewport.java
src/org/apache/fop/area/inline Unresolved.java
UnresolvedPageNumber.java
src/org/apache/fop/extensions ExtensionElementMapping.java
ExtensionObj.java Label.java Outline.java
src/org/apache/fop/layout PageMaster.java
src/org/apache/fop/layoutmgr PageLayoutManager.java
src/org/apache/fop/pdf PDFDocument.java
src/org/apache/fop/render AbstractRenderer.java
Added: src/org/apache/fop/area Resolveable.java TreeExt.java
src/org/apache/fop/extensions BookmarkData.java
Bookmarks.java
Removed: src/org/apache/fop/area Region.java
Log:
cleaned up bookmark extension a bit
make multi page sequences work properly
Revision Changes Path
1.12 +4 -3 xml-fop/src/org/apache/fop/apps/StreamRenderer.java
Index: StreamRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/StreamRenderer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StreamRenderer.java 11 Apr 2002 09:33:28 -0000 1.11
+++ StreamRenderer.java 17 May 2002 14:47:12 -0000 1.12
@@ -99,6 +99,10 @@
public StreamRenderer(OutputStream outputStream, Renderer renderer) {
this.outputStream = outputStream;
this.renderer = renderer;
+
+ this.areaTree = new AreaTree();
+ this.atModel = AreaTree.createStorePagesModel();
+ areaTree.setTreeModel(atModel);
}
public void setLogger(Logger logger) {
@@ -183,9 +187,6 @@
*/
public void render(PageSequence pageSequence)
throws FOPException {
- this.areaTree = new AreaTree();
- this.atModel = AreaTree.createStorePagesModel();
- areaTree.setTreeModel(atModel);
//areaTree.setFontInfo(fontInfo);
// for(Enumeration e = extensions.elements(); e.hasMoreElements(); ) {
1.4 +35 -2 xml-fop/src/org/apache/fop/area/AreaTree.java
Index: AreaTree.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/AreaTree.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AreaTree.java 12 Nov 2001 13:10:11 -0000 1.3
+++ AreaTree.java 17 May 2002 14:47:12 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: AreaTree.java,v 1.3 2001/11/12 13:10:11 keiron Exp $
+ * $Id: AreaTree.java,v 1.4 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -10,6 +10,7 @@
import org.apache.fop.render.Renderer;
import java.util.ArrayList;
+import java.util.HashMap;
/**
* Area tree for formatting objects.
@@ -33,6 +34,12 @@
// in different situations
AreaTreeModel model;
+ // hashmap of arraylists containing pages with id area
+ HashMap idLocations = new HashMap();
+ // list of id's yet to be resolved and arraylists of pages
+ HashMap resolve = new HashMap();
+ ArrayList treeExtensions = new ArrayList();
+
public RenderPagesModel createRenderPagesModel(Renderer rend) {
return new RenderPagesModel(rend);
}
@@ -53,6 +60,28 @@
model.addPage(page);
}
+ public void addTreeExtension(TreeExt ext) {
+ treeExtensions.add(ext);
+ if(ext.isResolveable()) {
+ Resolveable res = (Resolveable)ext;
+ String[] ids = res.getIDs();
+ for(int count = 0; count < ids.length; count++) {
+ if(idLocations.containsKey(ids[count])) {
+ res.resolve(ids[count], (ArrayList)idLocations.get(ids[count]));
+ } else {
+ ArrayList todo = (ArrayList)resolve.get(ids[count]);
+ if(todo == null) {
+ todo = new ArrayList();
+ todo.add(ext);
+ resolve.put(ids[count], todo);
+ } else {
+ todo.add(ext);
+ }
+ }
+ }
+ }
+ }
+
// this is the model for the area tree object
public static abstract class AreaTreeModel {
public abstract void startPageSequence(Title title);
@@ -119,7 +148,11 @@
public void addPage(PageViewport page) {
super.addPage(page);
// if page finished
- //renderer.renderPage(page);
+ try {
+ renderer.renderPage(page);
+ } catch(Exception e) {
+ // use error handler to handle this FOP or IO Exception
+ }
page.clear();
// else prepare
//renderer.preparePage(page);
1.6 +10 -1 xml-fop/src/org/apache/fop/area/BodyRegion.java
Index: BodyRegion.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BodyRegion.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BodyRegion.java 28 Apr 2002 21:28:01 -0000 1.5
+++ BodyRegion.java 17 May 2002 14:47:12 -0000 1.6
@@ -1,5 +1,5 @@
/*
- * $Id: BodyRegion.java,v 1.5 2002/04/28 21:28:01 klease Exp $
+ * $Id: BodyRegion.java,v 1.6 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -79,5 +79,14 @@
public MinOptMax getMaxBPD() {
return maxBPD;
+ }
+
+ public Object clone() {
+ BodyRegion br = new BodyRegion();
+ br.setCTM(getCTM());
+ br.setIPD(getIPD());
+ br.columnGap = columnGap;
+ br.columnCount = columnCount;
+ return br;
}
}
1.4 +23 -2 xml-fop/src/org/apache/fop/area/Page.java
Index: Page.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Page.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Page.java 9 Nov 2001 22:02:34 -0000 1.3
+++ Page.java 17 May 2002 14:47:12 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: Page.java,v 1.3 2001/11/09 22:02:34 klease Exp $
+ * $Id: Page.java,v 1.4 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,8 +8,9 @@
package org.apache.fop.area;
import java.io.Serializable;
+import java.util.HashMap;
-public class Page implements Serializable {
+public class Page implements Serializable, Cloneable {
// contains before, start, body, end and after regions
RegionViewport regionBefore = null;
RegionViewport regionStart = null;
@@ -17,6 +18,11 @@
RegionViewport regionEnd = null;
RegionViewport regionAfter = null;
+ // hashmap of markers for this page
+ // start and end are added by the fo that contains the markers
+ HashMap markerStart = null;
+ HashMap markerEnd = null;
+
public void setRegion(int areaclass, RegionViewport port) {
if (areaclass == RegionReference.BEFORE) {
regionBefore = port;
@@ -46,4 +52,19 @@
return null;
}
+ public Object clone() {
+ Page p = new Page();
+ if(regionBefore != null)
+ p.regionBefore = (RegionViewport)regionBefore.clone();
+ if(regionStart != null)
+ p.regionStart = (RegionViewport)regionStart.clone();
+ if(regionBody != null)
+ p.regionBody = (RegionViewport)regionBody.clone();
+ if(regionEnd != null)
+ p.regionEnd = (RegionViewport)regionEnd.clone();
+ if(regionAfter != null)
+ p.regionAfter = (RegionViewport)regionAfter.clone();
+
+ return p;
+ }
}
1.5 +10 -4 xml-fop/src/org/apache/fop/area/PageViewport.java
Index: PageViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/PageViewport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PageViewport.java 12 Nov 2001 13:10:11 -0000 1.4
+++ PageViewport.java 17 May 2002 14:47:12 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: PageViewport.java,v 1.4 2001/11/12 13:10:11 keiron Exp $
+ * $Id: PageViewport.java,v 1.5 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -14,7 +14,7 @@
// this is the level that creates the page
// the page (reference area) is then rendered inside the page object
-public class PageViewport {
+public class PageViewport implements Cloneable {
Page page;
Rectangle2D viewArea;
boolean clip = false;
@@ -29,7 +29,7 @@
ArrayList idReferences = null;
// this keeps a list of currently unresolved areas or extensions
- // once the things is resolved it is removed
+ // once the thing is resolved it is removed
// when this is empty the page can be rendered
ArrayList unresolved = null;
@@ -55,9 +55,15 @@
page = (Page) in.readObject();
}
+ public Object clone() {
+ Page p = (Page)page.clone();
+ PageViewport ret = new PageViewport(p, (Rectangle2D)viewArea.clone());
+ return ret;
+ }
+
/**
* Clear the page contents to save memory.
- * THis objects is kept for the life of the area tree since
+ * This object is kept for the life of the area tree since
* it holds id information and is used as a key.
*/
public void clear() {
1.4 +8 -2 xml-fop/src/org/apache/fop/area/RegionReference.java
Index: RegionReference.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionReference.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RegionReference.java 23 Feb 2002 16:47:37 -0000 1.3
+++ RegionReference.java 17 May 2002 14:47:12 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: RegionReference.java,v 1.3 2002/02/23 16:47:37 klease Exp $
+ * $Id: RegionReference.java,v 1.4 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -11,7 +11,7 @@
import java.util.ArrayList;
import java.util.List;
-public class RegionReference extends Area implements Serializable {
+public class RegionReference extends Area implements Serializable, Cloneable {
public static final int BEFORE = 0;
public static final int START = 1;
public static final int BODY = 2;
@@ -55,4 +55,10 @@
blocks.add(block);
}
+ public Object clone() {
+ RegionReference rr = new RegionReference(regionClass);
+ rr.ctm = ctm;
+ rr.setIPD(getIPD());
+ return rr;
+ }
}
1.4 +9 -3 xml-fop/src/org/apache/fop/area/RegionViewport.java
Index: RegionViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionViewport.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RegionViewport.java 9 Nov 2001 22:02:34 -0000 1.3
+++ RegionViewport.java 17 May 2002 14:47:12 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: RegionViewport.java,v 1.3 2001/11/09 22:02:34 klease Exp $
+ * $Id: RegionViewport.java,v 1.4 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -11,7 +11,7 @@
import java.io.Serializable;
import java.io.IOException;
-public class RegionViewport extends Area implements Serializable {
+public class RegionViewport extends Area implements Serializable, Cloneable {
// this rectangle is relative to the page
RegionReference region;
Rectangle2D viewArea;
@@ -19,7 +19,7 @@
public RegionViewport(Rectangle2D viewArea) {
- this.viewArea =viewArea;
+ this.viewArea = viewArea;
}
public void setRegion(RegionReference reg) {
@@ -57,4 +57,10 @@
setRegion( (RegionReference) in.readObject());
}
+ public Object clone() {
+ RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone());
+ rv.region = (RegionReference)region.clone();
+ rv.region.setParent(rv);
+ return rv;
+ }
}
1.1 xml-fop/src/org/apache/fop/area/Resolveable.java
Index: Resolveable.java
===================================================================
/*
* $Id: Resolveable.java,v 1.1 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
import java.util.ArrayList;
public interface Resolveable {
public boolean isResolved();
public String[] getIDs();
/**
* This resolves reference with a list of pages.
* The pages (PageViewport) contain the rectangle of the area.
* @param id the id to resolve
* @param pages the list of pages with the id area
* may be null if not found
*/
public void resolve(String id, ArrayList pages);
}
1.1 xml-fop/src/org/apache/fop/area/TreeExt.java
Index: TreeExt.java
===================================================================
/*
* $Id: TreeExt.java,v 1.1 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
/**
*/
public interface TreeExt {
public boolean isResolveable();
public String getMimeType();
public String getName();
}
1.2 +7 -8 xml-fop/src/org/apache/fop/area/inline/Unresolved.java
Index: Unresolved.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Unresolved.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Unresolved.java 22 Oct 2001 09:30:31 -0000 1.1
+++ Unresolved.java 17 May 2002 14:47:12 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: Unresolved.java,v 1.1 2001/10/22 09:30:31 keiron Exp $
+ * $Id: Unresolved.java,v 1.2 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -7,14 +7,13 @@
package org.apache.fop.area.inline;
-public class Unresolved extends InlineArea {
- boolean resolved = false;
-
- // id ref
- // resolve
- // resolve without area
+import org.apache.fop.area.Resolveable;
- public void resolve() {
+public abstract class Unresolved extends InlineArea implements Resolveable {
+ boolean resolved = false;
+ public boolean isResolved() {
+ return resolved;
}
+
}
1.2 +14 -4 xml-fop/src/org/apache/fop/area/inline/UnresolvedPageNumber.java
Index: UnresolvedPageNumber.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/UnresolvedPageNumber.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnresolvedPageNumber.java 22 Oct 2001 09:30:31 -0000 1.1
+++ UnresolvedPageNumber.java 17 May 2002 14:47:12 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: UnresolvedPageNumber.java,v 1.1 2001/10/22 09:30:31 keiron Exp $
+ * $Id: UnresolvedPageNumber.java,v 1.2 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -7,10 +7,20 @@
package org.apache.fop.area.inline;
+import java.util.ArrayList;
+
public class UnresolvedPageNumber extends Unresolved {
+ String pageRefId;
+
+ public UnresolvedPageNumber(String id) {
+ pageRefId = id;
+ }
- // id ref
- // resolve
- // resolve without area
+ public String[] getIDs() {
+ return new String[] {pageRefId};
+ }
+ public void resolve(String id, ArrayList pages) {
+ resolved = true;
+ }
}
1.8 +11 -2 xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java
Index: ExtensionElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExtensionElementMapping.java 13 Dec 2001 09:40:04 -0000 1.7
+++ ExtensionElementMapping.java 17 May 2002 14:47:12 -0000 1.8
@@ -1,5 +1,5 @@
/*
- * $Id: ExtensionElementMapping.java,v 1.7 2001/12/13 09:40:04 keiron Exp $
+ * $Id: ExtensionElementMapping.java,v 1.8 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -22,14 +22,23 @@
private static synchronized void setupExt() {
if(foObjs == null) {
foObjs = new HashMap();
+ foObjs.put("bookmarks", new B());
foObjs.put("outline", new O());
foObjs.put("label", new L());
}
}
public void addToBuilder(FOTreeBuilder builder) {
- setupExt();
+ if(foObjs == null) {
+ setupExt();
+ }
builder.addMapping(URI, foObjs);
+ }
+
+ static class B extends ElementMapping.Maker {
+ public FONode make(FONode parent) {
+ return new Bookmarks(parent);
+ }
}
static class O extends ElementMapping.Maker {
1.5 +3 -27 xml-fop/src/org/apache/fop/extensions/ExtensionObj.java
Index: ExtensionObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/extensions/ExtensionObj.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ExtensionObj.java 9 Nov 2001 11:32:36 -0000 1.4
+++ ExtensionObj.java 17 May 2002 14:47:12 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: ExtensionObj.java,v 1.4 2001/11/09 11:32:36 keiron Exp $
+ * $Id: ExtensionObj.java,v 1.5 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -7,9 +7,8 @@
package org.apache.fop.extensions;
-import org.apache.fop.fo.*;
-import org.apache.fop.layout.*;
-import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
/**
* base class for extension objects
@@ -25,28 +24,5 @@
super(parent);
}
- /**
- * Called for extensions within a page sequence or flow. These extensions
- * are allowed to generate visible areas within the layout.
- *
- * @param area
- */
- public Status layout(Area area) throws FOPException {
- ExtensionArea extArea = new ExtensionArea(this);
- area.addChild(extArea);
- return new Status(Status.OK);
- }
-
- /**
- * Called for root extensions. Root extensions aren't allowed to generate
- * any visible areas. They are used for extra items that don't show up in
- * the page layout itself. For example: pdf outlines
- *
- * @param areaTree
- */
- public void format(AreaTree areaTree) throws FOPException {
- ExtensionArea extArea = new ExtensionArea(this);
- areaTree.addExtension(this);
- }
}
1.5 +5 -5 xml-fop/src/org/apache/fop/extensions/Label.java
Index: Label.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/extensions/Label.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Label.java 9 Nov 2001 11:32:36 -0000 1.4
+++ Label.java 17 May 2002 14:47:12 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: Label.java,v 1.4 2001/11/09 11:32:36 keiron Exp $
+ * $Id: Label.java,v 1.5 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -7,21 +7,21 @@
package org.apache.fop.extensions;
-import org.apache.fop.fo.*;
+import org.apache.fop.fo.FONode;
public class Label extends ExtensionObj {
- private String _label = "";
+ private String label = "";
public Label(FONode parent) {
super(parent);
}
protected void addCharacters(char data[], int start, int end) {
- _label += new String(data, start, end - start);
+ label += new String(data, start, end - start);
}
public String toString() {
- return _label;
+ return label;
}
}
1.7 +24 -55 xml-fop/src/org/apache/fop/extensions/Outline.java
Index: Outline.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/extensions/Outline.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Outline.java 9 Nov 2001 11:32:36 -0000 1.6
+++ Outline.java 17 May 2002 14:47:12 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * $Id: Outline.java,v 1.6 2001/11/09 11:32:36 keiron Exp $
+ * $Id: Outline.java,v 1.7 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -7,10 +7,7 @@
package org.apache.fop.extensions;
-import org.apache.fop.fo.*;
-import org.apache.fop.pdf.PDFGoTo;
-import org.apache.fop.pdf.PDFAction;
-import org.apache.fop.datatypes.IDReferences;
+import org.apache.fop.fo.FONode;
import org.apache.fop.apps.FOPException;
import java.util.*;
@@ -18,79 +15,51 @@
import org.xml.sax.Attributes;
public class Outline extends ExtensionObj {
- private Label _label;
- private ArrayList _outlines = new ArrayList();
+ private Label label;
+ private ArrayList outlines = new ArrayList();
- private String _internalDestination;
- private String _externalDestination;
-
- /**
- * The parent outline object if it exists
- */
- private Outline _parentOutline;
-
- /**
- * an opaque renderer context object, e.g. PDFOutline for PDFRenderer
- */
- private Object _rendererObject;
+ private String internalDestination;
+ private String externalDestination;
public Outline(FONode parent) {
super(parent);
}
public void handleAttrs(Attributes attlist) throws FOPException {
- _internalDestination =
- attlist.getValue(null, "internal-destination");
- _externalDestination =
- attlist.getValue(null, "external-destination");
- if (_externalDestination != null &&!_externalDestination.equals("")) {
+ internalDestination =
+ attlist.getValue("internal-destination");
+ externalDestination =
+ attlist.getValue("external-destination");
+ if (externalDestination != null &&!externalDestination.equals("")) {
log.warn("fox:outline external-destination not supported currently.");
}
- if (_internalDestination == null || _internalDestination.equals("")) {
+ if (internalDestination == null || internalDestination.equals("")) {
log.warn("fox:outline requires an internal-destination.");
}
- for (FONode node = getParent(); node != null;
- node = node.getParent()) {
- if (node instanceof Outline) {
- _parentOutline = (Outline)node;
- break;
- }
- }
-
}
protected void addChild(FONode obj) {
if (obj instanceof Label) {
- _label = (Label)obj;
+ label = (Label)obj;
} else if (obj instanceof Outline) {
- _outlines.add(obj);
+ outlines.add(obj);
}
}
- public void setRendererObject(Object o) {
- _rendererObject = o;
- }
-
- public Object getRendererObject() {
- return _rendererObject;
- }
-
- public Outline getParentOutline() {
- return _parentOutline;
- }
-
- public Label getLabel() {
- return _label == null ? new Label(this) : _label;
- }
-
- public ArrayList getOutlines() {
- return _outlines;
+ public BookmarkData getData() {
+ BookmarkData data = new BookmarkData(internalDestination);
+ data.setLabel(getLabel());
+ for(int count = 0; count < outlines.size(); count++) {
+ Outline out = (Outline)outlines.get(count);
+ data.addSubData(out.getData());
+ }
+ return data;
}
- public String getInternalDestination() {
- return _internalDestination;
+ public String getLabel() {
+ return label == null ? "" : label.toString();
}
}
1.1 xml-fop/src/org/apache/fop/extensions/BookmarkData.java
Index: BookmarkData.java
===================================================================
/*
* $Id: BookmarkData.java,v 1.1 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.extensions;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Resolveable;
import org.apache.fop.area.TreeExt;
import java.util.*;
public class BookmarkData implements Resolveable, TreeExt {
private ArrayList subData = new ArrayList();
private HashMap idRefs = new HashMap();
String idRef;
PageViewport pageRef = null;
String label = null;
public BookmarkData() {
idRef = null;
}
public BookmarkData(String id) {
idRef = id;
idRefs.put(idRef, this);
}
public String getID() {
return idRef;
}
public void addSubData(BookmarkData sub) {
subData.add(sub);
idRefs.put(sub.getID(), sub);
}
public void setLabel(String l) {
label = l;
}
public boolean isResolveable() {
return true;
}
public String getMimeType() {
return "application/pdf";
}
public String getName() {
return "Bookmark";
}
public boolean isResolved() {
return idRefs == null;
}
public String[] getIDs() {
return (String[])idRefs.keySet().toArray(new String[] {});
}
public void resolve(String id, ArrayList pages) {
if(!id.equals(idRef)) {
BookmarkData bd = (BookmarkData)idRefs.get(id);
bd.resolve(id, pages);
if(bd.isResolved()) {
idRefs.remove(id);
if(idRefs.size() == 0) {
idRefs = null;
}
}
} else {
if(pages != null) {
pageRef = (PageViewport)pages.get(0);
}
// TODO
// get rect area of id on page
idRefs.remove(idRef);
if(idRefs.size() == 0) {
idRefs = null;
}
}
}
}
1.1 xml-fop/src/org/apache/fop/extensions/Bookmarks.java
Index: Bookmarks.java
===================================================================
/*
* $Id: Bookmarks.java,v 1.1 2002/05/17 14:47:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.extensions;
import org.apache.fop.fo.FONode;
import java.util.*;
import org.xml.sax.Attributes;
public class Bookmarks extends ExtensionObj {
private ArrayList outlines = new ArrayList();
private BookmarkData data;
public Bookmarks(FONode parent) {
super(parent);
}
protected void addChild(FONode obj) {
if (obj instanceof Outline) {
outlines.add(obj);
}
}
public BookmarkData getData() {
return data;
}
public void end() {
log.debug("adding bookmarks to area tree");
data = new BookmarkData();
for(int count = 0; count < outlines.size(); count++) {
Outline out = (Outline)outlines.get(count);
data.addSubData(out.getData());
}
// add data to area tree for resolving and handling
}
}
1.13 +4 -60 xml-fop/src/org/apache/fop/layout/PageMaster.java
Index: PageMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/PageMaster.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PageMaster.java 9 Nov 2001 22:21:28 -0000 1.12
+++ PageMaster.java 17 May 2002 14:47:13 -0000 1.13
@@ -1,5 +1,5 @@
/*
- * $Id: PageMaster.java,v 1.12 2001/11/09 22:21:28 klease Exp $
+ * $Id: PageMaster.java,v 1.13 2002/05/17 14:47:13 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -16,68 +16,12 @@
private PageViewport pageVP ;
public PageMaster(PageViewport pageVP) {
- this.pageVP = pageVP;
+ this.pageVP = pageVP;
}
-
- // Use serialization to make a clone of the master
+ // make a clone of the master
public PageViewport makePage() {
- try {
- System.err.println("PageMaster.makePage");
- PipedOutputStream outputStream = new PipedOutputStream();
- PipedInputStream inputStream = new PipedInputStream(outputStream);
- //System.err.println("PageMaster.makePage made piped streams");
-
- ObjectOutputStream objOut =
- new ObjectOutputStream(new BufferedOutputStream(outputStream));
- /* ObjectInputStream objIn =
- new ObjectInputStream(new BufferedInputStream(inputStream));*/
-
- //System.err.println("PageMaster.makePage: streams made");
- PageViewport newPageVP = new PageViewport(pageVP.getPage(),
- pageVP.getViewArea());
- //System.err.println("PageMaster.makePage: newPageVP made");
- Thread reader = new Thread(new PageReader(inputStream, newPageVP));
- //System.err.println("Start serialize");
- reader.start();
-
- //System.err.println("Save page");
- pageVP.savePage(objOut);
- objOut.close();
- //System.err.println("Save page done");
- reader.join();
- //System.err.println("join done");
-
- // objIn.close();
- return newPageVP;
- } catch (Exception e) {
- System.err.println("PageMaster.makePage(): " + e.getMessage());
- return null;
- }
- }
-
- static private class PageReader implements Runnable {
- private InputStream is;
- private PageViewport pvp;
-
- PageReader(InputStream is, PageViewport pvp) {
- //System.err.println("PageReader object made");
- this.is = is;
- this.pvp = pvp;
- }
-
- public void run() {
- try {
- //System.err.println("PageReader make ObjectInputStream");
- ObjectInputStream ois = new ObjectInputStream(is);
- //System.err.println("Load page");
- pvp.loadPage(ois);
- //System.err.println("Load page done");
- } catch (Exception e) {
- System.err.println("Error copying PageViewport: " +
- e);
- }
- }
+ return (PageViewport)pageVP.clone();
}
}
1.7 +2 -1 xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PageLayoutManager.java 26 Apr 2002 09:40:57 -0000 1.6
+++ PageLayoutManager.java 17 May 2002 14:47:13 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * $Id: PageLayoutManager.java,v 1.6 2002/04/26 09:40:57 keiron Exp $
+ * $Id: PageLayoutManager.java,v 1.7 2002/05/17 14:47:13 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -65,6 +65,7 @@
*/
public void run() {
generateAreas();
+ flush();
}
1.37 +2 -2 xml-fop/src/org/apache/fop/pdf/PDFDocument.java
Index: PDFDocument.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- PDFDocument.java 16 Nov 2001 19:40:32 -0000 1.36
+++ PDFDocument.java 17 May 2002 14:47:13 -0000 1.37
@@ -1,5 +1,5 @@
/*
- * $Id: PDFDocument.java,v 1.36 2001/11/16 19:40:32 tore Exp $
+ * $Id: PDFDocument.java,v 1.37 2002/05/17 14:47:13 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -1132,7 +1132,7 @@
* Make an outline object and add it to the given outline
* @param parent parent PDFOutline object
* @param label the title for the new outline object
- * @param action the PDFAction to reference
+ * @param destination the reference string for the action to go to
*/
public PDFOutline makeOutline(PDFOutline parent, String label,
String destination) {
1.16 +2 -2 xml-fop/src/org/apache/fop/render/AbstractRenderer.java
Index: AbstractRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/AbstractRenderer.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractRenderer.java 10 May 2002 12:38:15 -0000 1.15
+++ AbstractRenderer.java 17 May 2002 14:47:13 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: AbstractRenderer.java,v 1.15 2002/05/10 12:38:15 klease Exp $
+ * $Id: AbstractRenderer.java,v 1.16 2002/05/17 14:47:13 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -142,7 +142,7 @@
RegionReference region = port.getRegion();
startVParea(region.getCTM());
- if (region.getRegionClass() == Region.BODY) {
+ if (region.getRegionClass() == RegionReference.BODY) {
renderBodyRegion((BodyRegion) region);
} else {
renderRegion(region);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org