git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@800852 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -857,10 +857,10 @@ out = proc.getOutputStream();]]></source> | |||
]]></source> | |||
<p> | |||
The invoke-medium-map element is allowed as child of fo:page-sequence (page group | |||
level). It is NOT supported on document level (fo:root), yet. FOP also doesn't support | |||
specifying medium maps inside XML (using BMM/EMM). It can only reference an existing | |||
medium map by name. The medium map has to be constructed through different means and | |||
available on the target platform. | |||
level) or fo:simple-page-master. It is NOT supported on document level (fo:root), yet. | |||
FOP also doesn't support specifying medium maps inside XML (using BMM/EMM). It can | |||
only reference an existing medium map by name. The medium map has to be constructed | |||
through different means and available on the target platform. | |||
</p> | |||
</section> | |||
<section id="afp-form-maps"> |
@@ -77,6 +77,9 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
private Map/*<String,String>*/pageSegmentMap | |||
= new java.util.HashMap/*<String,String>*/(); | |||
/** Medium Map referenced on previous page **/ | |||
private String lastMediumMap; | |||
private static final int LOC_ELSEWHERE = 0; | |||
private static final int LOC_FOLLOWING_PAGE_SEQUENCE = 1; | |||
private static final int LOC_IN_PAGE_HEADER = 2; | |||
@@ -299,15 +302,19 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
} | |||
} | |||
} else if (extension instanceof AFPInvokeMediumMap) { | |||
if (this.location != LOC_FOLLOWING_PAGE_SEQUENCE) { | |||
if (this.location != LOC_FOLLOWING_PAGE_SEQUENCE | |||
&& this.location != LOC_IN_PAGE_HEADER) { | |||
throw new IFException( | |||
"AFP IMM extension must be between page-sequence and the first page: " | |||
+ extension, null); | |||
"AFP IMM extension must be between page-sequence" | |||
+ " and the first page or child of page-header: " | |||
+ extension, null); | |||
} | |||
AFPInvokeMediumMap imm = (AFPInvokeMediumMap)extension; | |||
String mediumMap = imm.getName(); | |||
if (mediumMap != null) { | |||
if (mediumMap != null && !mediumMap.equals(lastMediumMap)) { | |||
dataStream.createInvokeMediumMap(mediumMap); | |||
lastMediumMap = mediumMap; | |||
} | |||
} else if (extension instanceof AFPIncludeFormMap) { | |||
AFPIncludeFormMap formMap = (AFPIncludeFormMap)extension; |
@@ -181,6 +181,9 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust | |||
/** the shading mode for filled rectangles */ | |||
private AFPShadingMode shadingMode = AFPShadingMode.COLOR; | |||
/** medium map referenced used on previous page **/ | |||
private String lastMediumMap; | |||
/** | |||
* Constructor for AFPRenderer. | |||
*/ | |||
@@ -380,6 +383,9 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust | |||
int resolution = paintingState.getResolution(); | |||
// IMM should occur before BPG | |||
renderInvokeMediumMap(pageViewport); | |||
dataStream.startPage(pageWidth, pageHeight, pageRotation, | |||
resolution, resolution); | |||
@@ -703,6 +709,35 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust | |||
return MimeConstants.MIME_AFP; | |||
} | |||
/** | |||
* checks for IMM Extension and renders if found and different | |||
* from previous page | |||
* | |||
* @param pageViewport the page object | |||
*/ | |||
private void renderInvokeMediumMap(PageViewport pageViewport) { | |||
if (pageViewport.getExtensionAttachments() != null | |||
&& pageViewport.getExtensionAttachments().size() > 0) { | |||
Iterator it = pageViewport.getExtensionAttachments().iterator(); | |||
while (it.hasNext()) { | |||
ExtensionAttachment attachment = (ExtensionAttachment) it.next(); | |||
if (AFPExtensionAttachment.CATEGORY.equals(attachment.getCategory())) { | |||
AFPExtensionAttachment aea = (AFPExtensionAttachment)attachment; | |||
if (AFPElementMapping.INVOKE_MEDIUM_MAP.equals(aea.getElementName())) { | |||
AFPInvokeMediumMap imm = (AFPInvokeMediumMap)attachment; | |||
String mediumMap = imm.getName(); | |||
if (mediumMap != null) { | |||
if (!mediumMap.equals(lastMediumMap)) { | |||
dataStream.createInvokeMediumMap(mediumMap); | |||
lastMediumMap = mediumMap; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* Method to render the page extension. | |||
* <p> | |||
@@ -720,27 +755,29 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust | |||
while (it.hasNext()) { | |||
ExtensionAttachment attachment = (ExtensionAttachment) it.next(); | |||
if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) { | |||
AFPPageSetup aps = (AFPPageSetup) attachment; | |||
String element = aps.getElementName(); | |||
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.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); | |||
if (attachment instanceof AFPPageSetup) { | |||
AFPPageSetup aps = (AFPPageSetup) attachment; | |||
String element = aps.getElementName(); | |||
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.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); | |||
} | |||
} | |||
} | |||
} |
@@ -26,8 +26,8 @@ import org.apache.fop.fo.extensions.ExtensionAttachment; | |||
/** | |||
* This class represents an AFP-specific extension element to embed Invoke Medium Map (IMM) | |||
* fields at the beginning of a page group. The element is optional and expected as a direct child | |||
* of an fo:page-sequence. | |||
* fields at the beginning of a page group or just prior to a Page. The element is optional | |||
* and expected as a direct child of an fo:page-sequence or fo:simple-page-master | |||
*/ | |||
public class AFPInvokeMediumMapElement extends AbstractAFPExtensionObject { | |||
@@ -42,7 +42,9 @@ public class AFPInvokeMediumMapElement extends AbstractAFPExtensionObject { | |||
/** {@inheritDoc} */ | |||
protected void startOfNode() throws FOPException { | |||
super.startOfNode(); | |||
if (parent.getNameId() != Constants.FO_PAGE_SEQUENCE) { | |||
if (parent.getNameId() != Constants.FO_PAGE_SEQUENCE | |||
&& parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { | |||
invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), | |||
"rule.childOfPageSequence"); | |||
} |
@@ -58,6 +58,9 @@ | |||
documents. Example: the fix of marks layering will be such a case when it's done. | |||
--> | |||
<release version="FOP Trunk" date="TBD"> | |||
<action context="Renderers" dev="CB" type="add"> | |||
AFP Output: Added support for IMM Extension on fo:simple-page-master. | |||
</action> | |||
<action context="Renderers" dev="JM" type="add" fixes-bug="47311" due-to="Peter Coppens"> | |||
Added an initial set of extensions for prepress support (fox:bleed, fox:crop-offset, | |||
fox:crop-box and fox:scale). This is currently supported only by PDF and Java2D renderers. |