diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-03-02 10:19:01 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-03-02 10:19:01 +0000 |
commit | bdb4db0bbc0fdaa9f72af41b947f06fca76b250a (patch) | |
tree | b023199b649137865c013b83e0f865291f666d5b /src/java/org/apache/fop/render | |
parent | 593cb69d65d69473cf985ce627095387fa1450ec (diff) | |
download | xmlgraphics-fop-bdb4db0bbc0fdaa9f72af41b947f06fca76b250a.tar.gz xmlgraphics-fop-bdb4db0bbc0fdaa9f72af41b947f06fca76b250a.zip |
AFP Output: Tag Logical Element (TLE) is now also allowed on fo:page-sequence (page group level).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@749258 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
3 files changed, 41 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java index 1e08b917e..8d29145cf 100644 --- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java @@ -245,28 +245,36 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler public void handleExtensionObject(Object extension) throws IFException { if (extension instanceof AFPPageSetup) { AFPPageSetup aps = (AFPPageSetup)extension; - if (this.location != LOC_IN_PAGE_HEADER) { - throw new IFException( - "AFP page setup extension encountered outside the page header: " + aps, null); - } String element = aps.getElementName(); - if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) { - String overlay = aps.getName(); - if (overlay != null) { - dataStream.createIncludePageOverlay(overlay); + if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) { + if (this.location != LOC_IN_PAGE_HEADER + && this.location != LOC_FOLLOWING_PAGE_SEQUENCE) { + throw new IFException( + "TLE extension must be in the page header or between page-sequence" + + " and the first page: " + aps, null); } - } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) { - String name = aps.getName(); - String source = aps.getValue(); - pageSegmentMap.put(source, name); - } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) { String name = aps.getName(); String value = aps.getValue(); dataStream.createTagLogicalElement(name, value); - } else if (AFPElementMapping.NO_OPERATION.equals(element)) { - String content = aps.getContent(); - if (content != null) { - dataStream.createNoOperation(content); + } else { + if (this.location != LOC_IN_PAGE_HEADER) { + throw new IFException( + "AFP page setup extension encountered outside the page header: " + aps, null); + } + if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) { + String overlay = aps.getName(); + if (overlay != null) { + dataStream.createIncludePageOverlay(overlay); + } + } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) { + String name = aps.getName(); + String source = aps.getValue(); + pageSegmentMap.put(source, name); + } else if (AFPElementMapping.NO_OPERATION.equals(element)) { + String content = aps.getContent(); + if (content != null) { + dataStream.createNoOperation(content); + } } } } else if (extension instanceof AFPInvokeMediumMap) { diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java index 03e7a9977..94fd05dc8 100644 --- a/src/java/org/apache/fop/render/afp/AFPRenderer.java +++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java @@ -231,6 +231,11 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust if (mediumMap != null) { dataStream.createInvokeMediumMap(mediumMap); } + } else if (attachment instanceof AFPPageSetup) { + AFPPageSetup aps = (AFPPageSetup)attachment; + String name = aps.getName(); + String value = aps.getValue(); + dataStream.createTagLogicalElement(name, value); } } } diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java b/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java index 0774913b5..0c6dfadc4 100755 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java @@ -53,9 +53,17 @@ public class AFPPageSetupElement extends AbstractAFPExtensionObject { /** {@inheritDoc} */ protected void startOfNode() throws FOPException { super.startOfNode(); - if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { - invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), - "rule.childOfSPM"); + if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(getLocalName())) { + if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER + && parent.getNameId() != Constants.FO_PAGE_SEQUENCE) { + invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), + "rule.childOfPageSequenceOrSPM"); + } + } else { + if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { + invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), + "rule.childOfSPM"); + } } } |