*/
private IDReferences idReferences = new IDReferences();
+ /**
+ * The list of extensions.
+ */
+ private Vector extensions = new Vector();
+
private Logger log;
public StreamRenderer(OutputStream outputStream, Renderer renderer) {
return idReferences;
}
+ public void addExtension(ExtensionObj ext) {
+ extensions.addElement(ext);
+ }
+
public void startRenderer()
throws SAXException {
pageCount = 0;
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) {
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.*;
_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;
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;
// 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();
}
*
* @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;
public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) {
this.layoutMasterSet = layoutMasterSet;
}
-
+/*
public void format(AreaTree areaTree) throws FOPException {
// log.debug(" Root[" + marker + "] ");
if (layoutMasterSet == null) {
}
}
}
-
+*/
}
*/
protected Hashtable options;
+ protected Vector extensions = null;
+
/**
* create the PDF renderer
*/
public void stopRenderer(OutputStream stream)
throws IOException {
+ renderRootExtensions(extensions);
FontSetup.addToResources(this.pdfDoc, fontInfo);
pdfDoc.outputTrailer(stream);
}
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);
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) {