git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1378049 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_0
/** The current page */ | /** The current page */ | ||||
private AbstractPageObject currentPage = null; | private AbstractPageObject currentPage = null; | ||||
/** Sequence number for TLE's.*/ | |||||
private int tleSequence = 0; | |||||
/** The MO:DCA interchange set in use (default to MO:DCA-P IS/2 set) */ | /** The MO:DCA interchange set in use (default to MO:DCA-P IS/2 set) */ | ||||
private InterchangeSet interchangeSet | private InterchangeSet interchangeSet | ||||
= InterchangeSet.valueOf(InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2); | = InterchangeSet.valueOf(InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2); | ||||
public void createPageTagLogicalElement(TagLogicalElement.State[] attributes) { | public void createPageTagLogicalElement(TagLogicalElement.State[] attributes) { | ||||
for (int i = 0; i < attributes.length; i++) { | for (int i = 0; i < attributes.length; i++) { | ||||
currentPage.createTagLogicalElement(attributes[i], tleSequence++); | |||||
currentPage.createTagLogicalElement(attributes[i]); | |||||
} | } | ||||
} | } | ||||
TagLogicalElement.State tleState = new TagLogicalElement.State(name, value, encoding); | TagLogicalElement.State tleState = new TagLogicalElement.State(name, value, encoding); | ||||
if (currentPage != null) { | if (currentPage != null) { | ||||
currentPage.createTagLogicalElement(tleState, tleSequence++); | |||||
currentPage.createTagLogicalElement(tleState); | |||||
} else { | } else { | ||||
currentPageGroup.createTagLogicalElement(tleState); | currentPageGroup.createTagLogicalElement(tleState); | ||||
*/ | */ | ||||
public void startPageGroup() throws IOException { | public void startPageGroup() throws IOException { | ||||
endPageGroup(); | endPageGroup(); | ||||
this.currentPageGroup = factory.createPageGroup(tleSequence); | |||||
this.currentPageGroup = factory.createPageGroup(); | |||||
} | } | ||||
/** | /** | ||||
public void endPageGroup() throws IOException { | public void endPageGroup() throws IOException { | ||||
if (currentPageGroup != null) { | if (currentPageGroup != null) { | ||||
currentPageGroup.endPageGroup(); | currentPageGroup.endPageGroup(); | ||||
tleSequence = currentPageGroup.getTleSequence(); | |||||
document.addPageGroup(currentPageGroup); | document.addPageGroup(currentPageGroup); | ||||
currentPageGroup = null; | currentPageGroup = null; | ||||
} | } |
/** | /** | ||||
* Creates a new MO:DCA {@link PageGroup} | * Creates a new MO:DCA {@link PageGroup} | ||||
* @param tleSequence current start tle sequence number within stream | |||||
* @return a new {@link PageGroup} | * @return a new {@link PageGroup} | ||||
*/ | */ | ||||
public PageGroup createPageGroup(int tleSequence) { | |||||
public PageGroup createPageGroup() { | |||||
String name = PAGE_GROUP_NAME_PREFIX | String name = PAGE_GROUP_NAME_PREFIX | ||||
+ StringUtils.lpad(String.valueOf(++pageGroupCount), '0', 5); | + StringUtils.lpad(String.valueOf(++pageGroupCount), '0', 5); | ||||
return new PageGroup(this, name, tleSequence); | |||||
return new PageGroup(this, name); | |||||
} | } | ||||
/** | /** | ||||
* Creates a MO:DCA {@link TagLogicalElement} | * Creates a MO:DCA {@link TagLogicalElement} | ||||
* | * | ||||
* @param state the attribute state for the TLE | * @param state the attribute state for the TLE | ||||
* @param tleSequence current start tle sequence number within stream* | |||||
* @return a new {@link TagLogicalElement} | * @return a new {@link TagLogicalElement} | ||||
*/ | */ | ||||
public TagLogicalElement createTagLogicalElement(TagLogicalElement.State state, | |||||
int tleSequence) { | |||||
TagLogicalElement tle = new TagLogicalElement(state, tleSequence); | |||||
public TagLogicalElement createTagLogicalElement(TagLogicalElement.State state) { | |||||
TagLogicalElement tle = new TagLogicalElement(state); | |||||
return tle; | return tle; | ||||
} | } | ||||
* Creates a TagLogicalElement on the page. | * Creates a TagLogicalElement on the page. | ||||
* | * | ||||
* @param state the state of the TLE | * @param state the state of the TLE | ||||
* @param tleID the id of the TLE | |||||
*/ | */ | ||||
public void createTagLogicalElement(TagLogicalElement.State state, int tleID) { | |||||
TagLogicalElement tle = new TagLogicalElement(state, tleID); | |||||
public void createTagLogicalElement(TagLogicalElement.State state) { | |||||
TagLogicalElement tle = new TagLogicalElement(state); | |||||
List list = getTagLogicalElements(); | List list = getTagLogicalElements(); | ||||
list.add(tle); | list.add(tle); | ||||
} | } |
*/ | */ | ||||
public class PageGroup extends AbstractResourceEnvironmentGroupContainer { | public class PageGroup extends AbstractResourceEnvironmentGroupContainer { | ||||
/** | |||||
* Sequence number for TLE's. | |||||
*/ | |||||
private int tleSequence = 0; | |||||
/** | /** | ||||
* Constructor for the PageGroup. | * Constructor for the PageGroup. | ||||
* | * | ||||
* @param factory the resource manager | * @param factory the resource manager | ||||
* @param name the name of the page group | * @param name the name of the page group | ||||
* @param tleSequence current start tle sequence number within stream | |||||
*/ | */ | ||||
public PageGroup(Factory factory, String name, int tleSequence) { | |||||
public PageGroup(Factory factory, String name) { | |||||
super(factory, name); | super(factory, name); | ||||
this.tleSequence = tleSequence; | |||||
} | } | ||||
/** | /** | ||||
* the state of the TLE | * the state of the TLE | ||||
*/ | */ | ||||
public void createTagLogicalElement(TagLogicalElement.State state) { | public void createTagLogicalElement(TagLogicalElement.State state) { | ||||
TagLogicalElement tle = factory.createTagLogicalElement(state, tleSequence); | |||||
TagLogicalElement tle = factory.createTagLogicalElement(state); | |||||
if (!getTagLogicalElements().contains(tle)) { | if (!getTagLogicalElements().contains(tle)) { | ||||
getTagLogicalElements().add(tle); | getTagLogicalElements().add(tle); | ||||
tleSequence++; | |||||
} | } | ||||
} | } | ||||
public String toString() { | public String toString() { | ||||
return this.getName(); | return this.getName(); | ||||
} | } | ||||
/** @return the TLE sequence number */ | |||||
public int getTleSequence() { | |||||
return tleSequence; | |||||
} | |||||
} | } |
* the params of the TLE | * the params of the TLE | ||||
*/ | */ | ||||
private State state; | private State state; | ||||
/** | |||||
* Sequence of TLE within document | |||||
*/ | |||||
private int tleID; | |||||
/** | /** | ||||
* Construct a tag logical element with the name and value specified. | * Construct a tag logical element with the name and value specified. | ||||
* | * | ||||
* @param state the state of the tag logical element | * @param state the state of the tag logical element | ||||
* @param tleID unique identifier for TLE within AFP stream | |||||
*/ | */ | ||||
public TagLogicalElement(State state, int tleID) { | |||||
public TagLogicalElement(State state) { | |||||
this.state = state; | this.state = state; | ||||
this.tleID = tleID; | |||||
} | } | ||||
private void setAttributeValue(String value) { | private void setAttributeValue(String value) { | ||||
state.key); | state.key); | ||||
setAttributeValue(state.value); | setAttributeValue(state.value); | ||||
setEncoding(state.encoding); | setEncoding(state.encoding); | ||||
setAttributeQualifier(tleID, 1); | |||||
byte[] data = new byte[SF_HEADER_LENGTH]; | byte[] data = new byte[SF_HEADER_LENGTH]; | ||||
copySF(data, Type.ATTRIBUTE, Category.PROCESS_ELEMENT); | copySF(data, Type.ATTRIBUTE, Category.PROCESS_ELEMENT); |
documents. Example: the fix of marks layering will be such a case when it's done. | documents. Example: the fix of marks layering will be such a case when it's done. | ||||
--> | --> | ||||
<release version="FOP Trunk" date="TBD"> | <release version="FOP Trunk" date="TBD"> | ||||
<action context="Renderers" dev="MH" type="fix" fixes-bug="53786"> | |||||
Removed the Attribute Qualifier on TLEs as they aren't used. | |||||
</action> | |||||
<action context="Renderers" dev="MH" type="fix" fixes-bug="48954" due-to="PH"> | <action context="Renderers" dev="MH" type="fix" fixes-bug="48954" due-to="PH"> | ||||
Support for character encoding of TLEs in AFP output | Support for character encoding of TLEs in AFP output | ||||
</action> | </action> |