aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-08-13 07:13:52 +0000
committerJeremias Maerki <jeremias@apache.org>2008-08-13 07:13:52 +0000
commit804a2ba264030f4ff6a25b3f23ff16cb47593ff1 (patch)
treeaf16fe1009198a14dd3ede6abc54fd6c68fa8408 /src/java/org/apache/fop
parent4f59ee68009fe338e969064e37673a36a3055186 (diff)
downloadxmlgraphics-fop-804a2ba264030f4ff6a25b3f23ff16cb47593ff1.tar.gz
xmlgraphics-fop-804a2ba264030f4ff6a25b3f23ff16cb47593ff1.zip
Added document-trailer element to the IF (for example for the bookmark tree).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@685472 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java40
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFConstants.java1
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFPainter.java20
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFParser.java13
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFSerializer.java18
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFPainter.java20
7 files changed, 94 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
index c7d6a578b..5f904858f 100644
--- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
+++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
@@ -83,6 +83,46 @@ public abstract class AbstractIFPainter implements IFPainter {
return this.userAgent;
}
+ /** {@inheritDoc} */
+ public void startDocumentHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startDocumentTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startPageHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endPageHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startPageTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endPageTrailer() throws IFException {
+ //nop
+ }
+
private AffineTransform combine(AffineTransform[] transforms) {
AffineTransform at = new AffineTransform();
for (int i = 0, c = transforms.length; i < c; i++) {
diff --git a/src/java/org/apache/fop/render/intermediate/IFConstants.java b/src/java/org/apache/fop/render/intermediate/IFConstants.java
index 60870fbd8..2ea97a231 100644
--- a/src/java/org/apache/fop/render/intermediate/IFConstants.java
+++ b/src/java/org/apache/fop/render/intermediate/IFConstants.java
@@ -35,6 +35,7 @@ public interface IFConstants extends XMLConstants {
String EL_DOCUMENT = "document";
String EL_HEADER = "header";
+ String EL_TRAILER = "trailer";
String EL_PAGE_SEQUENCE = "page-sequence";
String EL_PAGE = "page";
String EL_PAGE_HEADER = "page-header";
diff --git a/src/java/org/apache/fop/render/intermediate/IFPainter.java b/src/java/org/apache/fop/render/intermediate/IFPainter.java
index 5181d15c0..026f43a8e 100644
--- a/src/java/org/apache/fop/render/intermediate/IFPainter.java
+++ b/src/java/org/apache/fop/render/intermediate/IFPainter.java
@@ -60,6 +60,9 @@ import org.apache.fop.fonts.FontInfo;
* ]*
* endPageSequence()
* ]*
+ * startDocumentTrailer()
+ * [handleExtension()]*
+ * endDocumentTrailer()
* endDocument()
*
* #box:
@@ -149,6 +152,23 @@ public interface IFPainter {
void endDocumentHeader() throws IFException;
/**
+ * Indicates the start of the document trailer. This method is called after the last
+ * page sequence. Extensions sent to the painter between
+ * {@code #startDocumentTrailer()} and {@code #endDocumentTrailer()} apply to the document as
+ * a whole and is used for document-level content that is only known after all pages have
+ * been rendered (like named destinations or the bookmark tree).
+ * @throws IFException if an error occurs while handling this event
+ */
+ void startDocumentTrailer() throws IFException;
+
+ /**
+ * Indicates the end of the document trailer. This method is called right before the
+ * {@code #endDocument()} method.
+ * @throws IFException if an error occurs while handling this event
+ */
+ void endDocumentTrailer() throws IFException;
+
+ /**
* Indicates the start of a new page sequence.
* @param id the page sequence's identifier (or null if none is available)
* @throws IFException if an error occurs while handling this event
diff --git a/src/java/org/apache/fop/render/intermediate/IFParser.java b/src/java/org/apache/fop/render/intermediate/IFParser.java
index 6545371fd..9c615427f 100644
--- a/src/java/org/apache/fop/render/intermediate/IFParser.java
+++ b/src/java/org/apache/fop/render/intermediate/IFParser.java
@@ -124,6 +124,7 @@ public class IFParser implements IFConstants {
this.elementMappingRegistry = elementMappingRegistry;
elementHandlers.put(EL_DOCUMENT, new DocumentHandler());
elementHandlers.put(EL_HEADER, new DocumentHeaderHandler());
+ elementHandlers.put(EL_TRAILER, new DocumentTrailerHandler());
elementHandlers.put(EL_PAGE_SEQUENCE, new PageSequenceHandler());
elementHandlers.put(EL_PAGE, new PageHandler());
elementHandlers.put(EL_PAGE_HEADER, new PageHeaderHandler());
@@ -293,6 +294,18 @@ public class IFParser implements IFConstants {
}
+ private class DocumentTrailerHandler extends AbstractElementHandler {
+
+ public void startElement(Attributes attributes) throws IFException {
+ painter.startDocumentTrailer();
+ }
+
+ public void endElement() throws IFException {
+ painter.endDocumentTrailer();
+ }
+
+ }
+
private class PageSequenceHandler extends AbstractElementHandler {
public void startElement(Attributes attributes) throws IFException {
diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java
index 703b035d1..e5dcccf62 100644
--- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java
+++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java
@@ -232,10 +232,12 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
painter.endPageSequence();
this.inPageSequence = false;
}
+ painter.startDocumentTrailer();
finishOpenGoTos();
if (this.bookmarkTree != null) {
painter.handleExtensionObject(this.bookmarkTree);
}
+ painter.endDocumentTrailer();
painter.endDocument();
} catch (IFException e) {
handleIFExceptionWithIOException(e);
diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
index 3cd57435d..9ca242fb9 100644
--- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java
+++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
@@ -99,6 +99,24 @@ public class IFSerializer extends AbstractXMLWritingIFPainter implements IFConst
}
/** {@inheritDoc} */
+ public void startDocumentTrailer() throws IFException {
+ try {
+ startElement(EL_TRAILER);
+ } catch (SAXException e) {
+ throw new IFException("SAX error in startDocumentTrailer()", e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentTrailer() throws IFException {
+ try {
+ endElement(EL_TRAILER);
+ } catch (SAXException e) {
+ throw new IFException("SAX error in startDocumentTrailer()", e);
+ }
+ }
+
+ /** {@inheritDoc} */
public void endDocument() throws IFException {
try {
endElement(EL_DOCUMENT);
diff --git a/src/java/org/apache/fop/render/pdf/PDFPainter.java b/src/java/org/apache/fop/render/pdf/PDFPainter.java
index 1f087058e..5e57946fb 100644
--- a/src/java/org/apache/fop/render/pdf/PDFPainter.java
+++ b/src/java/org/apache/fop/render/pdf/PDFPainter.java
@@ -147,10 +147,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
}
/** {@inheritDoc} */
- public void startDocumentHeader() throws IFException {
- }
-
- /** {@inheritDoc} */
public void endDocumentHeader() throws IFException {
pdfUtil.generateDefaultXMPMetadata();
}
@@ -208,14 +204,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
}
/** {@inheritDoc} */
- public void startPageHeader() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageHeader() throws IFException {
- }
-
- /** {@inheritDoc} */
public void startPageContent() throws IFException {
this.state = IFState.create();
}
@@ -226,14 +214,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
}
/** {@inheritDoc} */
- public void startPageTrailer() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageTrailer() throws IFException {
- }
-
- /** {@inheritDoc} */
public void endPage() throws IFException {
try {
this.pdfDoc.registerObject(generator.getStream());