]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
put back bookmark extension - not complete
authorKeiron Liddle <keiron@apache.org>
Tue, 21 Aug 2001 08:26:11 +0000 (08:26 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 21 Aug 2001 08:26:11 +0000 (08:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194438 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/apps/StreamRenderer.java
src/org/apache/fop/extensions/Outline.java
src/org/apache/fop/fo/FOTreeBuilder.java
src/org/apache/fop/fo/pagination/Root.java
src/org/apache/fop/render/pdf/PDFRenderer.java

index d18ddd6cdb9812ad7f31c0457a179535adb720c6..1c22a2e4569fa2e6f4369a52a9402e1822de3e83 100644 (file)
@@ -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) {
index 136bc2155bd6559c3fea671bd4ee24f5b8d363c0..e9c8a0ca22eaa01f8c1417af59908c4a93714a8e 100644 (file)
@@ -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;
index 8b9d8e955df64e6793b9ea8af7305785a1fff201..72ac6f146155b773498cd309c615d302dd591309 100644 (file)
@@ -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;
index 7f054162a7c86798aceeaae0a9dbb04aecd64e9b..eecfb57b3c3805b5ab58c2535023684d532e75c5 100644 (file)
@@ -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 {
             }
         }
     }
-
+*/
 }
index b76b1b77d1ab3487a7f39f01d61ce926d68a841e..d411ceecdac9df5c79a57f0d5961d90847c42df4 100644 (file)
@@ -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) {