git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@685472 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -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++) { |
@@ -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"; |
@@ -60,6 +60,9 @@ import org.apache.fop.fonts.FontInfo; | |||
* ]* | |||
* endPageSequence() | |||
* ]* | |||
* startDocumentTrailer() | |||
* [handleExtension()]* | |||
* endDocumentTrailer() | |||
* endDocument() | |||
* | |||
* #box: | |||
@@ -148,6 +151,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) |
@@ -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 { |
@@ -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); |
@@ -98,6 +98,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 { |
@@ -146,10 +146,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter { | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
public void startDocumentHeader() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endDocumentHeader() throws IFException { | |||
pdfUtil.generateDefaultXMPMetadata(); | |||
@@ -207,14 +203,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter { | |||
generator.concatenate(basicPageTransform); | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageHeader() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPageHeader() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageContent() throws IFException { | |||
this.state = IFState.create(); | |||
@@ -225,14 +213,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter { | |||
assert this.state.pop() == null; | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageTrailer() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPageTrailer() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPage() throws IFException { | |||
try { |
@@ -117,6 +117,7 @@ public class SVGPainter extends AbstractSVGPainter { | |||
/** {@inheritDoc} */ | |||
public void endDocument() throws IFException { | |||
//nop | |||
} | |||
/** {@inheritDoc} */ | |||
@@ -218,14 +219,6 @@ public class SVGPainter extends AbstractSVGPainter { | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageHeader() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPageHeader() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageContent() throws IFException { | |||
super.startPageContent(); | |||
@@ -246,14 +239,6 @@ public class SVGPainter extends AbstractSVGPainter { | |||
super.endPageContent(); | |||
} | |||
/** {@inheritDoc} */ | |||
public void startPageTrailer() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPageTrailer() throws IFException { | |||
} | |||
/** {@inheritDoc} */ | |||
public void endPage() throws IFException { | |||
try { |