From: Keiron Liddle Date: Tue, 21 Aug 2001 08:26:11 +0000 (+0000) Subject: put back bookmark extension - not complete X-Git-Tag: fop-0_20_3~80 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8c62f8ed4a384560ef9e6a73ab69cbb793d4cfb;p=xmlgraphics-fop.git put back bookmark extension - not complete git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194438 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/apps/StreamRenderer.java b/src/org/apache/fop/apps/StreamRenderer.java index d18ddd6cd..1c22a2e45 100644 --- a/src/org/apache/fop/apps/StreamRenderer.java +++ b/src/org/apache/fop/apps/StreamRenderer.java @@ -82,6 +82,11 @@ public class StreamRenderer { */ private IDReferences idReferences = new IDReferences(); + /** + * The list of extensions. + */ + private Vector extensions = new Vector(); + private Logger log; public StreamRenderer(OutputStream outputStream, Renderer renderer) { @@ -97,6 +102,10 @@ public class StreamRenderer { return idReferences; } + public void addExtension(ExtensionObj ext) { + extensions.addElement(ext); + } + public void startRenderer() throws SAXException { pageCount = 0; @@ -169,6 +178,15 @@ public class StreamRenderer { AreaTree a = new AreaTree(this); a.setFontInfo(fontInfo); + for(Enumeration e = extensions.elements(); e.hasMoreElements(); ) { + ExtensionObj ext = (ExtensionObj)e.nextElement(); + try { + ext.format(a); + } catch (FOPException fope) { + throw new SAXException(fope); + } + } + try { pageSequence.format(a); } catch (FOPException e) { diff --git a/src/org/apache/fop/extensions/Outline.java b/src/org/apache/fop/extensions/Outline.java index 136bc2155..e9c8a0ca2 100644 --- a/src/org/apache/fop/extensions/Outline.java +++ b/src/org/apache/fop/extensions/Outline.java @@ -11,7 +11,6 @@ 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.messaging.MessageHandler; import java.util.*; @@ -53,11 +52,11 @@ public class Outline extends ExtensionObj { _externalDestination = this.properties.get("external-destination").getString(); if (_externalDestination != null &&!_externalDestination.equals("")) { - MessageHandler.errorln("WARNING: fox:outline external-destination not supported currently."); + log.warn("fox:outline external-destination not supported currently."); } if (_internalDestination == null || _internalDestination.equals("")) { - MessageHandler.errorln("WARNING: fox:outline requires an internal-destination."); + log.warn("fox:outline requires an internal-destination."); } for (FONode node = getParent(); node != null; diff --git a/src/org/apache/fop/fo/FOTreeBuilder.java b/src/org/apache/fop/fo/FOTreeBuilder.java index 8b9d8e955..72ac6f146 100644 --- a/src/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/org/apache/fop/fo/FOTreeBuilder.java @@ -14,6 +14,7 @@ import org.apache.fop.apps.StreamRenderer; import org.apache.fop.fo.pagination.Root; import org.apache.fop.system.BufferManager; import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.extensions.ExtensionObj; import org.apache.log.Logger; @@ -159,8 +160,13 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { // mark-fop@inomial.com - tell the stream renderer to render // this page-sequence // - if(currentFObj instanceof PageSequence) + if(currentFObj instanceof PageSequence) { streamRenderer.render((PageSequence) currentFObj); + } else if(currentFObj instanceof ExtensionObj) { + if(!(currentFObj.getParent() instanceof ExtensionObj)) { + streamRenderer.addExtension((ExtensionObj)currentFObj); + } + } currentFObj = (FObj)currentFObj.getParent(); } @@ -246,12 +252,12 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { * * @param areaTree the area tree to format into */ - public void format(AreaTree areaTree) throws FOPException { +/* public void format(AreaTree areaTree) throws FOPException { log.info("formatting FOs into areas"); this.bufferManager.readComplete(); ((Root)this.rootFObj).format(areaTree); } - +*/ public void reset() { currentFObj = null; rootFObj = null; diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java index 7f054162a..eecfb57b3 100644 --- a/src/org/apache/fop/fo/pagination/Root.java +++ b/src/org/apache/fop/fo/pagination/Root.java @@ -101,7 +101,7 @@ public class Root extends FObj { public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) { this.layoutMasterSet = layoutMasterSet; } - +/* public void format(AreaTree areaTree) throws FOPException { // log.debug(" Root[" + marker + "] "); if (layoutMasterSet == null) { @@ -118,5 +118,5 @@ public class Root extends FObj { } } } - +*/ } diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index b76b1b77d..d411ceecd 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -122,6 +122,8 @@ public class PDFRenderer extends PrintRenderer { */ protected Hashtable options; + protected Vector extensions = null; + /** * create the PDF renderer */ @@ -152,6 +154,7 @@ public class PDFRenderer extends PrintRenderer { public void stopRenderer(OutputStream stream) throws IOException { + renderRootExtensions(extensions); FontSetup.addToResources(this.pdfDoc, fontInfo); pdfDoc.outputTrailer(stream); } @@ -686,10 +689,10 @@ public class PDFRenderer extends PrintRenderer { this.pdfDoc.setIDReferences(idReferences); this.renderPage(page); - //FontSetup.addToResources(this.pdfDoc, fontInfo); - - // TODO: this needs to be implemented - renderRootExtensions(page); + Vector exts = page.getExtensions(); + if(exts != null) { + extensions = exts; + } // log.debug("writing out PDF"); this.pdfDoc.output(outputStream); @@ -797,10 +800,9 @@ public class PDFRenderer extends PrintRenderer { return rs; } - protected void renderRootExtensions(Page page) { - Vector v = page.getExtensions(); - if (v != null) { - Enumeration e = v.elements(); + protected void renderRootExtensions(Vector exts) { + if (exts != null) { + Enumeration e = exts.elements(); while (e.hasMoreElements()) { ExtensionObj ext = (ExtensionObj)e.nextElement(); if (ext instanceof Outline) {