diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2013-04-08 11:51:52 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2013-04-08 11:51:52 +0000 |
commit | ce39d4c2fb899be5d8d705fe72e0153fde21e592 (patch) | |
tree | c16721a9a7f5313aaadafb0529370d278067eaa4 | |
parent | e3c9f13598dc3bbcbe1ea34920972910625567c0 (diff) | |
download | xmlgraphics-fop-ce39d4c2fb899be5d8d705fe72e0153fde21e592.tar.gz xmlgraphics-fop-ce39d4c2fb899be5d8d705fe72e0153fde21e592.zip |
FOP #2234: NPE when rendering a document with markers and accessibility is enabled
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1465599 13f79535-47bb-0310-9956-ffa450edef68
87 files changed, 717 insertions, 170 deletions
diff --git a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java b/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java index c63c721e5..be1177635 100644 --- a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java +++ b/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java @@ -42,7 +42,7 @@ public final class DummyStructureTreeEventHandler implements StructureTreeEventH } /** {@inheritDoc} */ - public StructureTreeElement startNode(String name, Attributes attributes) { + public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) { return null; } @@ -51,12 +51,12 @@ public final class DummyStructureTreeEventHandler implements StructureTreeEventH } /** {@inheritDoc} */ - public StructureTreeElement startImageNode(String name, Attributes attributes) { + public StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent) { return null; } /** {@inheritDoc} */ - public StructureTreeElement startReferencedNode(String name, Attributes attributes) { + public StructureTreeElement startReferencedNode(String name, Attributes attributes, StructureTreeElement parent) { return null; } diff --git a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java b/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java index 7a375ef20..0b8073e57 100644 --- a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java +++ b/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java @@ -87,7 +87,7 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } /** {@inheritDoc} */ - public StructureTreeElement startNode(String name, Attributes attributes) { + public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) { try { if (name.equals("#PCDATA")) { name = "marked-content"; @@ -115,13 +115,13 @@ public final class StructureTree2SAXEventAdapter implements StructureTreeEventHa } /** {@inheritDoc} */ - public StructureTreeElement startImageNode(String name, Attributes attributes) { - return startNode(name, attributes); + public StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent) { + return startNode(name, attributes, null); } /** {@inheritDoc} */ - public StructureTreeElement startReferencedNode(String name, Attributes attributes) { - return startNode(name, attributes); + public StructureTreeElement startReferencedNode(String name, Attributes attributes, StructureTreeElement parent) { + return startNode(name, attributes, null); } } diff --git a/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java b/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java index 46b724626..53c27130c 100644 --- a/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java +++ b/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java @@ -43,9 +43,11 @@ public interface StructureTreeEventHandler { * * @param name the name of the structure tree node * @param attributes the node properties + * @param parent the parent of the node. May be null, in which case the parent node is + * the node corresponding to the previous call to this method * @return the corresponding structure tree element */ - StructureTreeElement startNode(String name, Attributes attributes); + StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent); /** * Ends a structure tree node. @@ -59,9 +61,11 @@ public interface StructureTreeEventHandler { * * @param name the name of the structure tree node * @param attributes the node properties + * @param parent the parent of the node. May be null, in which case the parent node is + * the node corresponding to the previous call to this method * @return the corresponding structure tree element */ - StructureTreeElement startImageNode(String name, Attributes attributes); + StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent); /** * Starts a node that can be referenced by other nodes. This is usually a @@ -69,9 +73,11 @@ public interface StructureTreeEventHandler { * * @param name the name of the structure tree node * @param attributes the node properties + * @param parent the parent of the node. May be null, in which case the parent node is + * the node corresponding to the previous call to this method * @return the corresponding structure tree element */ - StructureTreeElement startReferencedNode(String name, Attributes attributes); + StructureTreeElement startReferencedNode(String name, Attributes attributes, StructureTreeElement parent); /** * Ends a page sequence structure tree node. diff --git a/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java b/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java index aaf112cb5..4614a7005 100644 --- a/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java +++ b/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java @@ -19,6 +19,8 @@ package org.apache.fop.accessibility.fo; +import java.util.HashMap; +import java.util.Map; import java.util.Stack; import org.xml.sax.SAXException; @@ -29,6 +31,7 @@ import org.apache.fop.fo.DelegatingFOEventHandler; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.FOText; import org.apache.fop.fo.extensions.ExternalDocument; +import org.apache.fop.fo.flow.AbstractRetrieveMarker; import org.apache.fop.fo.flow.BasicLink; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.BlockContainer; @@ -46,6 +49,8 @@ import org.apache.fop.fo.flow.ListItemLabel; import org.apache.fop.fo.flow.PageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.RetrieveTableMarker; import org.apache.fop.fo.flow.Wrapper; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; @@ -70,14 +75,30 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { /** The top of the {@link converters} stack. */ private FOEventHandler converter; - private final Stack<FOEventHandler> converters = new Stack<FOEventHandler>(); + private Stack<FOEventHandler> converters = new Stack<FOEventHandler>(); - private final FOEventHandler structureTreeEventTrigger; + private final StructureTreeEventTrigger structureTreeEventTrigger; /** The descendants of some elements like fo:leader must be ignored. */ private final FOEventHandler eventSwallower = new FOEventHandler() { }; + private final Map<AbstractRetrieveMarker, State> states = new HashMap<AbstractRetrieveMarker, State>(); + + private static final class State { + + private final FOEventHandler converter; + + private final Stack<FOEventHandler> converters; + + @SuppressWarnings("unchecked") + State(FO2StructureTreeConverter o) { + this.converter = o.converter; + this.converters = (Stack<FOEventHandler>) o.converters.clone(); + } + + } + /** * Creates a new instance. * @@ -459,6 +480,57 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { } @Override + public void startRetrieveMarker(RetrieveMarker retrieveMarker) { + converter.startRetrieveMarker(retrieveMarker); + saveState(retrieveMarker); + super.startRetrieveMarker(retrieveMarker); + } + + private void saveState(AbstractRetrieveMarker retrieveMarker) { + states.put(retrieveMarker, new State(this)); + } + + @Override + public void endRetrieveMarker(RetrieveMarker retrieveMarker) { + converter.endRetrieveMarker(retrieveMarker); + super.endRetrieveMarker(retrieveMarker); + } + + @Override + public void restoreState(RetrieveMarker retrieveMarker) { + restoreRetrieveMarkerState(retrieveMarker); + converter.restoreState(retrieveMarker); + super.restoreState(retrieveMarker); + } + + @SuppressWarnings("unchecked") + private void restoreRetrieveMarkerState(AbstractRetrieveMarker retrieveMarker) { + State state = states.get(retrieveMarker); + this.converter = state.converter; + this.converters = (Stack<FOEventHandler>) state.converters.clone(); + } + + @Override + public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + converter.startRetrieveTableMarker(retrieveTableMarker); + saveState(retrieveTableMarker); + super.startRetrieveTableMarker(retrieveTableMarker); + } + + @Override + public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + converter.endRetrieveTableMarker(retrieveTableMarker); + super.endRetrieveTableMarker(retrieveTableMarker); + } + + @Override + public void restoreState(RetrieveTableMarker retrieveTableMarker) { + restoreRetrieveMarkerState(retrieveTableMarker); + converter.restoreState(retrieveTableMarker); + super.restoreState(retrieveTableMarker); + } + + @Override public void character(Character c) { converter.character(c); super.character(c); diff --git a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java index 6a763a6f6..1a59bebfb 100644 --- a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java +++ b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java @@ -19,7 +19,9 @@ package org.apache.fop.accessibility.fo; +import java.util.HashMap; import java.util.Locale; +import java.util.Map; import java.util.Stack; import javax.xml.XMLConstants; @@ -34,6 +36,7 @@ import org.apache.fop.fo.FOText; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fo.extensions.InternalElementMapping; import org.apache.fop.fo.flow.AbstractGraphics; +import org.apache.fop.fo.flow.AbstractRetrieveMarker; import org.apache.fop.fo.flow.BasicLink; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.BlockContainer; @@ -50,6 +53,8 @@ import org.apache.fop.fo.flow.ListItemLabel; import org.apache.fop.fo.flow.PageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.RetrieveTableMarker; import org.apache.fop.fo.flow.Wrapper; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; @@ -76,11 +81,30 @@ class StructureTreeEventTrigger extends FOEventHandler { private LayoutMasterSet layoutMasterSet; - private final Stack<Table> tables = new Stack<Table>(); + private Stack<Table> tables = new Stack<Table>(); - private final Stack<Boolean> inTableHeader = new Stack<Boolean>(); + private Stack<Boolean> inTableHeader = new Stack<Boolean>(); - private final Stack<Locale> locales = new Stack<Locale>(); + private Stack<Locale> locales = new Stack<Locale>(); + + private final Map<AbstractRetrieveMarker, State> states = new HashMap<AbstractRetrieveMarker, State>(); + + private static final class State { + + private final Stack<Table> tables; + + private final Stack<Boolean> inTableHeader; + + private final Stack<Locale> locales; + + @SuppressWarnings("unchecked") + State(StructureTreeEventTrigger o) { + this.tables = (Stack<Table>) o.tables.clone(); + this.inTableHeader = (Stack<Boolean>) o.inTableHeader.clone(); + this.locales = (Stack<Locale>) o.locales.clone(); + } + + } public StructureTreeEventTrigger(StructureTreeEventHandler structureTreeEventHandler) { this.structureTreeEventHandler = structureTreeEventHandler; @@ -415,6 +439,50 @@ class StructureTreeEventTrigger extends FOEventHandler { } @Override + public void startRetrieveMarker(RetrieveMarker retrieveMarker) { + startElementWithID(retrieveMarker); + saveState(retrieveMarker); + } + + void saveState(AbstractRetrieveMarker retrieveMarker) { + states.put(retrieveMarker, new State(this)); + } + + @Override + public void endRetrieveMarker(RetrieveMarker retrieveMarker) { + endElement(retrieveMarker); + } + + @Override + public void restoreState(RetrieveMarker retrieveMarker) { + restoreRetrieveMarkerState(retrieveMarker); + } + + @SuppressWarnings("unchecked") + private void restoreRetrieveMarkerState(AbstractRetrieveMarker retrieveMarker) { + State state = states.get(retrieveMarker); + tables = (Stack<Table>) state.tables.clone(); + inTableHeader = (Stack<Boolean>) state.inTableHeader.clone(); + locales = (Stack<Locale>) state.locales.clone(); + } + + @Override + public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + startElementWithID(retrieveTableMarker); + saveState(retrieveTableMarker); + } + + @Override + public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + endElement(retrieveTableMarker); + } + + @Override + public void restoreState(RetrieveTableMarker retrieveTableMarker) { + restoreRetrieveMarkerState(retrieveTableMarker); + } + + @Override public void character(Character c) { AttributesImpl attributes = createLangAttribute(c.getCommonHyphenation()); startElementWithID(c, attributes); @@ -429,8 +497,8 @@ class StructureTreeEventTrigger extends FOEventHandler { } - private void startElement(FONode node) { - startElement(node, new AttributesImpl()); + private StructureTreeElement startElement(FONode node) { + return startElement(node, new AttributesImpl()); } private void startElementWithID(FONode node) { @@ -443,7 +511,8 @@ class StructureTreeEventTrigger extends FOEventHandler { addRole((CommonAccessibilityHolder) node, attributes); } node.setStructureTreeElement( - structureTreeEventHandler.startReferencedNode(localName, attributes)); + structureTreeEventHandler.startReferencedNode(localName, attributes, + node.getParent().getStructureTreeElement())); } private void startElementWithIDAndAltText(AbstractGraphics node) { @@ -453,7 +522,8 @@ class StructureTreeEventTrigger extends FOEventHandler { addAttribute(attributes, ExtensionElementMapping.URI, "alt-text", ExtensionElementMapping.STANDARD_PREFIX, node.getAltText()); node.setStructureTreeElement( - structureTreeEventHandler.startImageNode(localName, attributes)); + structureTreeEventHandler.startImageNode(localName, attributes, + node.getParent().getStructureTreeElement())); } private StructureTreeElement startElement(FONode node, AttributesImpl attributes) { @@ -461,7 +531,8 @@ class StructureTreeEventTrigger extends FOEventHandler { if (node instanceof CommonAccessibilityHolder) { addRole((CommonAccessibilityHolder) node, attributes); } - return structureTreeEventHandler.startNode(localName, attributes); + return structureTreeEventHandler.startNode(localName, attributes, + node.getParent().getStructureTreeElement()); } private void addNoNamespaceAttribute(AttributesImpl attributes, String name, String value) { diff --git a/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java b/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java index bb0a1ba75..4cf6ddd15 100644 --- a/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java +++ b/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java @@ -41,6 +41,8 @@ import org.apache.fop.fo.flow.ListItemLabel; import org.apache.fop.fo.flow.PageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.RetrieveTableMarker; import org.apache.fop.fo.flow.Wrapper; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; @@ -383,6 +385,36 @@ public abstract class DelegatingFOEventHandler extends FOEventHandler { } @Override + public void startRetrieveMarker(RetrieveMarker retrieveMarker) { + delegate.startRetrieveMarker(retrieveMarker); + } + + @Override + public void endRetrieveMarker(RetrieveMarker retrieveMarker) { + delegate.endRetrieveMarker(retrieveMarker); + } + + @Override + public void restoreState(RetrieveMarker retrieveMarker) { + delegate.restoreState(retrieveMarker); + } + + @Override + public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + delegate.startRetrieveTableMarker(retrieveTableMarker); + } + + @Override + public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + delegate.endRetrieveTableMarker(retrieveTableMarker); + } + + @Override + public void restoreState(RetrieveTableMarker retrieveTableMarker) { + delegate.restoreState(retrieveTableMarker); + } + + @Override public void character(Character c) { delegate.character(c); } diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/java/org/apache/fop/fo/FOEventHandler.java index ad647e42a..0be90dd04 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/java/org/apache/fop/fo/FOEventHandler.java @@ -41,6 +41,8 @@ import org.apache.fop.fo.flow.ListItemLabel; import org.apache.fop.fo.flow.PageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.RetrieveTableMarker; import org.apache.fop.fo.flow.Wrapper; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; @@ -535,6 +537,56 @@ public abstract class FOEventHandler { } /** + * Process the start of a retrieve-marker. + * + * @param retrieveMarker the retrieve-marker that is starting + */ + public void startRetrieveMarker(RetrieveMarker retrieveMarker) { + } + + + /** + * Process the ending of a retrieve-marker. + * + * @param retrieveMarker the retrieve-marker that is ending + */ + public void endRetrieveMarker(RetrieveMarker retrieveMarker) { + } + + /** + * Restore the state of this event handler as it was when the given fo:retrieve-marker + * element was processed. This method is called at marker retrieval time, so that + * events for the marker descendants are fired within the proper context. + * <p>The default implementation of this method does nothing.</p> + * + * @param retrieveMarker the fo:retrieve-marker element that is retrieving markers + */ + public void restoreState(RetrieveMarker retrieveMarker) { + } + + /** + * Process the start of a retrieve-table-marker. + * + * @param retrieveTableMarker the retrieve-table-marker that is starting + */ + public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + } + + /** + * Process the ending of a retrieve-table-marker. + * + * @param retrieveTableMarker the retrieve-table-marker that is ending + */ + public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { + } + + /** + * See {@link #restoreState(RetrieveMarker)}. + */ + public void restoreState(RetrieveTableMarker retrieveTableMarker) { + } + + /** * Process a Character. * @param c Character to process. */ diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 2fae054fe..c9fd7e59a 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -311,7 +311,7 @@ public abstract class FONode implements Cloneable { * * @throws FOPException if there's a problem during processing */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { // do nothing by default } @@ -327,7 +327,7 @@ public abstract class FONode implements Cloneable { * * @throws FOPException if there's a problem during processing */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { this.finalizeNode(); } @@ -1093,4 +1093,13 @@ public abstract class FONode implements Cloneable { throw new UnsupportedOperationException(); } + /** + * Returns the structure tree element associated to this object. + * + * @return the structure tree element + */ + public StructureTreeElement getStructureTreeElement() { + return null; + } + } diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index 5dfe0766b..6806d752d 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -193,7 +193,7 @@ public class FOText extends FONode implements CharSequence { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if ( charBuffer != null ) { charBuffer.rewind(); } @@ -726,7 +726,7 @@ public class FOText extends FONode implements CharSequence { this.structureTreeElement = structureTreeElement; } - /** @return the structure tree element. */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index 9040c464a..84d03db83 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -321,7 +321,8 @@ public class FOTreeBuilder extends DefaultHandler { // fo:characters can potentially be removed during // white-space handling. // Do not notify the FOEventHandler. - if (currentFObj.getNameId() != Constants.FO_CHARACTER) { + if (currentFObj.getNameId() != Constants.FO_CHARACTER + && (!builderContext.inMarker() || currentFObj.getNameId() == Constants.FO_MARKER)) { currentFObj.startOfNode(); } } @@ -343,7 +344,8 @@ public class FOTreeBuilder extends DefaultHandler { // fo:characters can potentially be removed during // white-space handling. // Do not notify the FOEventHandler. - if (currentFObj.getNameId() != Constants.FO_CHARACTER) { + if (currentFObj.getNameId() != Constants.FO_CHARACTER + && (!builderContext.inMarker() || currentFObj.getNameId() == Constants.FO_MARKER)) { currentFObj.endOfNode(); } diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index a316a2260..e7b4fc2e9 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -179,7 +179,7 @@ public abstract class FObj extends FONode implements Constants { * {@inheritDoc} * @throws FOPException FOP Exception */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { if (id != null) { checkId(id); } diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index e582e8689..f0a4e2695 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -49,6 +49,16 @@ public abstract class FObjMixed extends FObj { super(parent); } + @Override + public FONode clone(FONode parent, boolean removeChildren) throws FOPException { + flushText(); + FObjMixed clone = (FObjMixed) super.clone(parent, removeChildren); + if (removeChildren) { + clone.currentTextNode = null; + } + return clone; + } + /** {@inheritDoc} */ @Override protected void characters(char[] data, int start, int length, @@ -66,7 +76,7 @@ public abstract class FObjMixed extends FObj { /** {@inheritDoc} */ @Override - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); if (!inMarker() || getNameId() == FO_MARKER) { diff --git a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java index a6f5e7680..b450c21ce 100644 --- a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java +++ b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java @@ -86,7 +86,7 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr * @throws FOPException in case of processing exception * @see org.apache.fop.fo.FONode#startOfNode() */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startExternalDocument(this); } @@ -95,7 +95,7 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr * @throws FOPException in case of processing exception * @see org.apache.fop.fo.FONode#endOfNode() */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { getFOEventHandler().endExternalDocument(this); super.endOfNode(); } diff --git a/src/java/org/apache/fop/fo/extensions/destination/Destination.java b/src/java/org/apache/fop/fo/extensions/destination/Destination.java index 98114bb23..95ae64c7d 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/Destination.java +++ b/src/java/org/apache/fop/fo/extensions/destination/Destination.java @@ -61,7 +61,7 @@ public class Destination extends FONode { /** * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { root.addDestination(this); } diff --git a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java index 3d93eaa8f..2bf0061b0 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java +++ b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java @@ -234,7 +234,7 @@ public abstract class AbstractGraphics extends FObj this.structureTreeElement = structureTreeElement; } - /** {@inheritDoc} */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java b/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java index 0e99bfe96..c8e8fc620 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java +++ b/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java @@ -83,7 +83,7 @@ public abstract class AbstractListItemPart extends FObj implements CommonAccessi } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!this.blockItemFound) { String contentModel = "marker* (%block;)+"; getFOValidationEventProducer().missingChildElement(this, getName(), diff --git a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java index ec3891632..68582a430 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java @@ -160,7 +160,7 @@ public abstract class AbstractPageNumberCitation extends FObj this.structureTreeElement = structureTreeElement; } - /** {@inheritDoc} */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java index 636bc04df..018f6bb73 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java @@ -23,6 +23,7 @@ import java.util.Iterator; import org.xml.sax.Locator; +import org.apache.fop.accessibility.StructureTreeElement; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOText; @@ -51,6 +52,8 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { private int boundary; private String boundaryLabel; + private StructureTreeElement structureTreeElement; + /** * Create a new AbstractRetrieveMarker instance that * is a child of the given {@link FONode} @@ -86,6 +89,16 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { this.propertyList = pList.getParentPropertyList(); } + @Override + public void setStructureTreeElement(StructureTreeElement structureTreeElement) { + this.structureTreeElement = structureTreeElement; + } + + @Override + public StructureTreeElement getStructureTreeElement() { + return structureTreeElement; + } + private PropertyList createPropertyListFor(FObj fo, PropertyList parent) { return getBuilderContext().getPropertyListMaker().make(fo, parent); } @@ -108,6 +121,7 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { pList, newPropertyList); addChildTo(newChild, newParent); + newChild.startOfNode(); switch ( newChild.getNameId() ) { case FO_TABLE: Table t = (Table) child; @@ -132,17 +146,22 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { newChild, marker, newPropertyList); break; } + newChild.endOfNode(); } else if (child instanceof FOText) { FOText ft = (FOText) newChild; ft.bind(parentPropertyList); addChildTo(newChild, newParent); + if (newParent instanceof AbstractRetrieveMarker) { + /* + * Otherwise the parent of newChild is a cloned FObjMixed that will + * call this FOText's endOfNode when its own endOfNode method is + * called. + */ + newChild.endOfNode(); + } } else if (child instanceof XMLObj) { addChildTo(newChild, newParent); } - - // trigger end-of-node white-space handling - // and finalization for table-FOs - newChild.finalizeNode(); } } @@ -191,6 +210,7 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { } if (marker.getChildNodes() != null) { try { + restoreFOEventHandlerState(); cloneFromMarker(marker); } catch (FOPException exc) { getFOValidationEventProducer().markerCloningFailed(this, @@ -201,6 +221,8 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { } } + protected abstract void restoreFOEventHandlerState(); + /** * Return the value for the <code>retrieve-class-name</code> * property diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 0d6d5d9b4..3394842fb 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -96,13 +96,13 @@ public class BasicLink extends InlineLevel implements StructureTreeElementHolder } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startLink(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endLink(this); } @@ -148,7 +148,7 @@ public class BasicLink extends InlineLevel implements StructureTreeElementHolder this.structureTreeElement = structureTreeElement; } - /** {@inheritDoc} */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index d93821ca6..13b218b55 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -140,13 +140,13 @@ public class Block extends FObjMixed implements BreakPropertySet, } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startBlock(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endBlock(this); } diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index cdeb99081..005f9289a 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -103,7 +103,7 @@ public class BlockContainer extends FObj implements BreakPropertySet, WritingMod } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startBlockContainer(this); } @@ -138,7 +138,7 @@ public class BlockContainer extends FObj implements BreakPropertySet, WritingMod } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!blockItemFound) { missingChildElementError("marker* (%block;)+"); } diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index f48ff289e..2d0814301 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -116,7 +116,7 @@ public class Character extends FObj implements StructureTreeElementHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().character(this); } @@ -217,7 +217,7 @@ public class Character extends FObj implements StructureTreeElementHolder { this.structureTreeElement = structureTreeElement; } - /** {@inheritDoc} */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index dc8584abc..b564526b4 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -104,7 +104,7 @@ public class ExternalGraphic extends AbstractGraphics { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().image(this); } diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index 5d8fcdc2c..c12998144 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -74,7 +74,7 @@ public class Float extends FObj { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(%block;)+"); } diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index 5953363ed..3aa2097a2 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -56,7 +56,7 @@ public class Footnote extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { getFOEventHandler().startFootnote(this); } @@ -66,7 +66,7 @@ public class Footnote extends FObj implements CommonAccessibilityHolder { * * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); if (footnoteCitation == null || footnoteBody == null) { missingChildElementError("(inline,footnote-body)"); diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index 1c103b6b5..af2bc2bcf 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -54,7 +54,7 @@ public class FootnoteBody extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { getFOEventHandler().startFootnoteBody(this); } @@ -64,7 +64,7 @@ public class FootnoteBody extends FObj implements CommonAccessibilityHolder { * end of the footnote-body. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(%block;)+"); } diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index 941850cdd..d115f469a 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -69,7 +69,7 @@ public class Inline extends InlineLevel { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); /* Check to see if this node can have block-level children. @@ -94,7 +94,7 @@ public class Inline extends InlineLevel { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endInline(this); } diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index b79d66bb0..b8e9fd09a 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -119,7 +119,7 @@ public class InlineContainer extends FObj { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!blockItemFound) { missingChildElementError("marker* (%block;)+"); } diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 33164188f..9f88b9478 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -60,7 +60,7 @@ public class InstreamForeignObject extends AbstractGraphics { } @Override - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startInstreamForeignObject(this); } @@ -71,7 +71,7 @@ public class InstreamForeignObject extends AbstractGraphics { * the end of the instream-foreign-object. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("one (1) non-XSL namespace child"); } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index 4062d6562..c1fd98002 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -191,13 +191,13 @@ public class Leader extends InlineLevel { } @Override - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startLeader(this); } @Override - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endLeader(this); } diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 35288ec80..647891131 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -89,7 +89,7 @@ public class ListBlock extends FObj implements BreakPropertySet, CommonAccessibi } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startList(this); } @@ -100,7 +100,7 @@ public class ListBlock extends FObj implements BreakPropertySet, CommonAccessibi * of the list-block. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!hasListItem) { missingChildElementError("marker* (list-item)+"); } diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index f61254874..bfd512f4d 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -83,13 +83,13 @@ public class ListItem extends FObj implements BreakPropertySet, CommonAccessibil } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startListItem(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (label == null || body == null) { missingChildElementError("marker* (list-item-label,list-item-body)"); } diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index 3007f9ba3..5b121f53c 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -36,13 +36,13 @@ public class ListItemBody extends AbstractListItemPart { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startListBody(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endListBody(this); } diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index 10436afa6..53dfab84e 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -38,13 +38,13 @@ public class ListItemLabel extends AbstractListItemPart { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startListLabel(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endListLabel(this); } diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index de806e986..5d525ee8c 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -83,7 +83,7 @@ public class Marker extends FObjMixed { } /** {@inheritDoc} */ - protected void startOfNode() { + public void startOfNode() { FOTreeBuilderContext builderContext = getBuilderContext(); // Push a new property list maker which will make MarkerPropertyLists. savePropertyListMaker = builderContext.getPropertyListMaker(); @@ -97,7 +97,7 @@ public class Marker extends FObjMixed { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); // Pop the MarkerPropertyList maker. getBuilderContext().setPropertyListMaker(savePropertyListMaker); diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 3e2e57d97..ff8192006 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -59,7 +59,7 @@ public class MultiProperties extends FObj { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!hasMultiPropertySet || !hasWrapper) { missingChildElementError("(multi-property-set+, wrapper)"); } diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index aa18d6cdf..d8ebee4cb 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -64,7 +64,7 @@ public class MultiSwitch extends FObj { /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(multi-case+)"); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index fe3e80a75..33b34e2d5 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -106,13 +106,13 @@ public class PageNumber extends FObj } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startPageNumber(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { getFOEventHandler().endPageNumber(this); } @@ -182,7 +182,7 @@ public class PageNumber extends FObj this.structureTreeElement = structureTreeElement; } - /** {@inheritDoc} */ + @Override public StructureTreeElement getStructureTreeElement() { return structureTreeElement; } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 0ebb6eb3d..ee7b59a15 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -41,13 +41,13 @@ public class PageNumberCitation extends AbstractPageNumberCitation { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startPageNumberCitation(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endPageNumberCitation(this); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java b/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java index 6a08568b1..b6e209202 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java @@ -42,13 +42,13 @@ public class PageNumberCitationLast extends AbstractPageNumberCitation { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startPageNumberCitationLast(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endPageNumberCitationLast(this); } diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index b001a41ee..2f2b7e5a4 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -71,6 +71,18 @@ public class RetrieveMarker extends AbstractRetrieveMarker { setBoundaryLabel((String) pList.get(PR_RETRIEVE_BOUNDARY).getObject()); } + @Override + public void startOfNode() throws FOPException { + super.startOfNode(); + getFOEventHandler().startRetrieveMarker(this); + } + + @Override + public void endOfNode() throws FOPException { + super.endOfNode(); + getFOEventHandler().endRetrieveMarker(this); + } + /** * Return the value for the <code>retrieve-position</code> * property @@ -108,4 +120,10 @@ public class RetrieveMarker extends AbstractRetrieveMarker { public int getNameId() { return FO_RETRIEVE_MARKER; } + + @Override + protected void restoreFOEventHandlerState() { + getFOEventHandler().restoreState(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java index efacba864..d4bc7c687 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java @@ -68,6 +68,18 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { setBoundaryLabel((String) pList.get(PR_RETRIEVE_BOUNDARY_WITHIN_TABLE).getObject()); } + @Override + public void startOfNode() throws FOPException { + super.startOfNode(); + getFOEventHandler().startRetrieveTableMarker(this); + } + + @Override + public void endOfNode() throws FOPException { + super.endOfNode(); + getFOEventHandler().endRetrieveTableMarker(this); + } + /** * Return the value for the <code>retrieve-position-within-table</code> * property @@ -113,4 +125,9 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { this.lastFOTextProcessed = null; } + @Override + protected void restoreFOEventHandlerState() { + getFOEventHandler().restoreState(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index 0aec7ce16..dd15187f2 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -61,13 +61,13 @@ public class Wrapper extends FObjMixed implements CommonAccessibilityHolder { } @Override - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startWrapper(this); } @Override - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endWrapper(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/java/org/apache/fop/fo/flow/table/Table.java index a574723b1..f23ac1cc4 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -179,7 +179,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startTable(this); } @@ -238,7 +238,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endTable(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java index 51db27e4e..667138e00 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java @@ -87,7 +87,7 @@ public class TableAndCaption extends FObj implements CommonAccessibilityHolder { * FOEventHandler that we are at the end of the flow. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!tableFound) { missingChildElementError("marker* table-caption? table"); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableBody.java b/src/java/org/apache/fop/fo/flow/table/TableBody.java index d69081e48..63e927952 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/table/TableBody.java @@ -38,13 +38,13 @@ public class TableBody extends TablePart { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startBody(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endBody(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/java/org/apache/fop/fo/flow/table/TableCaption.java index 380b27f34..def1c1093 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCaption.java @@ -78,7 +78,7 @@ public class TableCaption extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("marker* (%block;)"); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/java/org/apache/fop/fo/flow/table/TableCell.java index f198f3aad..20a80d135 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCell.java @@ -96,7 +96,7 @@ public class TableCell extends TableFObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startCell(this); } @@ -106,7 +106,7 @@ public class TableCell extends TableFObj implements CommonAccessibilityHolder { * FOEventHandler that we are at the end of the table-cell. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endCell(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableFooter.java b/src/java/org/apache/fop/fo/flow/table/TableFooter.java index cfd0136dc..e12b75c5c 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFooter.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFooter.java @@ -41,13 +41,13 @@ public class TableFooter extends TablePart { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startFooter(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endFooter(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableHeader.java b/src/java/org/apache/fop/fo/flow/table/TableHeader.java index a0ad40798..73b43f301 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableHeader.java +++ b/src/java/org/apache/fop/fo/flow/table/TableHeader.java @@ -40,13 +40,13 @@ public class TableHeader extends TablePart { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startHeader(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endHeader(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableRow.java b/src/java/org/apache/fop/fo/flow/table/TableRow.java index dd9f7c6d4..2beaf2f99 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/table/TableRow.java @@ -98,13 +98,13 @@ public class TableRow extends TableCellContainer implements BreakPropertySet { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startRow(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endRow(this); } diff --git a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java index d1ccf7273..c74be7d7e 100644 --- a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java @@ -82,7 +82,7 @@ public abstract class AbstractPageSequence extends FObj implements CommonAccessi } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { this.pageNumberGenerator = new PageNumberGenerator( format, groupingSeparator, groupingSize, letterValue, numberConversionFeatures, language, country); diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index da92c7439..b83a72a11 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -72,7 +72,7 @@ public class ConditionalPageMasterReference extends FObj { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { getConcreteParent().addConditionalPageMasterReference(this); } diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index 9c68043ff..12d95c131 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -75,7 +75,7 @@ public class Declarations extends FObj { * a hashmap of color profiles and a list of extension attachments. * @throws FOPException if there's a problem during processing */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild != null) { for (FONodeIterator iter = getChildNodes(); iter.hasNext();) { FONode node = iter.nextNode(); diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 45c8f7804..8a52b9a9e 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -62,7 +62,7 @@ public class Flow extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { if (flowName == null || flowName.equals("")) { missingPropertyError(FLOW_NAME); } @@ -88,7 +88,7 @@ public class Flow extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!blockItemFound) { missingChildElementError("marker* (%block;)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 8b109dd0e..905291b35 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -62,14 +62,14 @@ public class LayoutMasterSet extends FObj { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { getRoot().setLayoutMasterSet(this); simplePageMasters = new java.util.HashMap<String, SimplePageMaster>(); pageSequenceMasters = new java.util.HashMap<String, PageSequenceMaster>(); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(simple-page-master|page-sequence-master)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 6039dafeb..6b1ee2ef4 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -103,7 +103,7 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); flowMap = new java.util.HashMap<String, FONode>(); @@ -121,7 +121,7 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (mainFlow == null) { missingChildElementError("(title?,static-content*,flow)"); } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 080d663d7..6fa9b4261 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -79,14 +79,14 @@ public class PageSequenceMaster extends FObj { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { subSequenceSpecifiers = new java.util.ArrayList<SubSequenceSpecifier>(); layoutMasterSet = parent.getRoot().getLayoutMasterSet(); layoutMasterSet.addPageSequenceMaster(masterName, this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(single-page-master-reference|" + "repeatable-page-master-reference|repeatable-page-master-alternatives)+"); diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index 8ade4d34a..439ed2859 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -68,7 +68,7 @@ public class RepeatablePageMasterAlternatives extends FObj } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { conditionalPageMasterRefs = new java.util.ArrayList<ConditionalPageMasterReference>(); assert parent.getName().equals("fo:page-sequence-master"); //Validation by the parent @@ -77,7 +77,7 @@ public class RepeatablePageMasterAlternatives extends FObj } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null) { missingChildElementError("(conditional-page-master-reference+)"); } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index c3f2368ea..9ea1ab50a 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -70,7 +70,7 @@ public class RepeatablePageMasterReference extends FObj } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; if (masterReference == null) { diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 6db8d6db1..64a6b039d 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -97,12 +97,12 @@ public class Root extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { foEventHandler.startRoot(this); } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!pageSequenceFound || layoutMasterSet == null) { missingChildElementError("(layout-master-set, declarations?, " + "bookmark-tree?, (page-sequence|fox:external-document)+)"); diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 79c8c3358..637289cde 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -89,7 +89,7 @@ public class SimplePageMaster extends FObj { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent; if (masterName == null) { @@ -103,7 +103,7 @@ public class SimplePageMaster extends FObj { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (!hasRegionBody) { missingChildElementError( "(region-body, region-before?, region-after?, region-start?, region-end?)"); diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 38b56af19..ed0c041dd 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -71,7 +71,7 @@ public class SinglePageMasterReference extends FObj } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; pageSequenceMaster.addSubsequenceSpecifier(this); } diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java index 412cdbcca..d85ab5f30 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -40,7 +40,7 @@ public class StaticContent extends Flow { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { if (getFlowName() == null || getFlowName().equals("")) { missingPropertyError(FLOW_NAME); } @@ -52,7 +52,7 @@ public class StaticContent extends Flow { * FOEventHandler that we are at the end of the flow. * {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (firstChild == null && getUserAgent().validateStrictly()) { missingChildElementError("(%block;)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java index 9e7d80cea..9cefe85b4 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java @@ -102,7 +102,7 @@ public class Bookmark extends FObj implements CommonAccessibilityHolder { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (bookmarkTitle == null) { missingChildElementError("(bookmark-title, bookmark*)"); } diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java index 22bf0769b..c5594bff0 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java @@ -56,7 +56,7 @@ public class BookmarkTree extends FObj { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { if (bookmarks == null) { missingChildElementError("(fo:bookmark+)"); } diff --git a/src/java/org/apache/fop/pdf/PDFStructElem.java b/src/java/org/apache/fop/pdf/PDFStructElem.java index 8250318d7..badf53060 100644 --- a/src/java/org/apache/fop/pdf/PDFStructElem.java +++ b/src/java/org/apache/fop/pdf/PDFStructElem.java @@ -37,7 +37,7 @@ public class PDFStructElem extends StructureHierarchyMember private StructureType structureType; - private PDFStructElem parentElement; + protected PDFStructElem parentElement; /** * Elements to be added to the kids array. @@ -231,6 +231,9 @@ public class PDFStructElem extends StructureHierarchyMember textBuffer.append(' '); } Object obj = kids.get(i); + if (obj instanceof PDFStructElem) { + ((PDFStructElem) obj).setParent(parentElement); + } formatObject(obj, out, textBuffer); } } diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java b/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java index c5079b2bd..71765bb7d 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java @@ -54,7 +54,7 @@ public class AFPIncludeFormMapElement extends AbstractAFPExtensionObject { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (parent.getNameId() != Constants.FO_DECLARATIONS) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java b/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java index 813cf6ddd..e40d3da34 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java @@ -40,7 +40,7 @@ public class AFPInvokeMediumMapElement extends AbstractAFPExtensionObject { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (parent.getNameId() != Constants.FO_PAGE_SEQUENCE && parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java index 0b9645236..59df1529e 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java @@ -57,7 +57,7 @@ public class AFPPageOverlayElement extends AbstractAFPExtensionObject { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(getLocalName())) { if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER 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 9b325c5cd..e3aa3ca57 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java @@ -54,7 +54,7 @@ public class AFPPageSetupElement extends AbstractAFPExtensionObject { /** {@inheritDoc} */ @Override - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(getLocalName())) { if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER diff --git a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java b/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java index e35a13ec6..388ea3f44 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java +++ b/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java @@ -86,7 +86,7 @@ public abstract class AbstractAFPExtensionObject extends FONode { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); } diff --git a/src/java/org/apache/fop/render/intermediate/IFParser.java b/src/java/org/apache/fop/render/intermediate/IFParser.java index 5753dad01..484e8d559 100644 --- a/src/java/org/apache/fop/render/intermediate/IFParser.java +++ b/src/java/org/apache/fop/render/intermediate/IFParser.java @@ -163,25 +163,15 @@ public class IFParser implements IFConstants { private Map<String, StructureTreeElement> structureTreeElements = new HashMap<String, StructureTreeElement>(); - private final class StructureTreeHandler extends DefaultHandler { + private class StructureTreeHandler extends DefaultHandler { - private final Locale pageSequenceLanguage; - - private final StructureTreeEventHandler structureTreeEventHandler; + protected final StructureTreeEventHandler structureTreeEventHandler; - private StructureTreeHandler(StructureTreeEventHandler structureTreeEventHandler, - Locale pageSequenceLanguage) throws SAXException { - this.pageSequenceLanguage = pageSequenceLanguage; + StructureTreeHandler(StructureTreeEventHandler structureTreeEventHandler) { this.structureTreeEventHandler = structureTreeEventHandler; } void startStructureTree(String type) { - structureTreeEventHandler.startPageSequence(pageSequenceLanguage, type); - } - - public void endDocument() throws SAXException { - startIFElement(EL_PAGE_SEQUENCE, pageSequenceAttributes); - pageSequenceAttributes = null; } @Override @@ -191,18 +181,19 @@ public class IFParser implements IFConstants { if (localName.equals("marked-content")) { localName = "#PCDATA"; } + StructureTreeElement parent = getStructureTreeElement(attributes); String structID = attributes.getValue(InternalElementMapping.URI, InternalElementMapping.STRUCT_ID); if (structID == null) { - structureTreeEventHandler.startNode(localName, attributes); + structureTreeEventHandler.startNode(localName, attributes, parent); } else if (localName.equals("external-graphic") || localName.equals("instream-foreign-object")) { StructureTreeElement structureTreeElement - = structureTreeEventHandler.startImageNode(localName, attributes); + = structureTreeEventHandler.startImageNode(localName, attributes, parent); structureTreeElements.put(structID, structureTreeElement); } else { StructureTreeElement structureTreeElement = structureTreeEventHandler - .startReferencedNode(localName, attributes); + .startReferencedNode(localName, attributes, parent); structureTreeElements.put(structID, structureTreeElement); } } @@ -217,6 +208,28 @@ public class IFParser implements IFConstants { } } + private class MainStructureTreeHandler extends StructureTreeHandler { + + private final Locale pageSequenceLanguage; + + MainStructureTreeHandler(StructureTreeEventHandler structureTreeEventHandler, + Locale pageSequenceLanguage) throws SAXException { + super(structureTreeEventHandler); + this.pageSequenceLanguage = pageSequenceLanguage; + } + + @Override + void startStructureTree(String type) { + structureTreeEventHandler.startPageSequence(pageSequenceLanguage, type); + } + + public void endDocument() throws SAXException { + startIFElement(EL_PAGE_SEQUENCE, pageSequenceAttributes); + pageSequenceAttributes = null; + } + + } + public Handler(IFDocumentHandler documentHandler, FOUserAgent userAgent, ElementMappingRegistry elementMappingRegistry) { this.documentHandler = documentHandler; @@ -264,7 +277,7 @@ public class IFParser implements IFConstants { if (localName.equals(EL_PAGE_SEQUENCE) && userAgent.isAccessibilityEnabled()) { pageSequenceAttributes = new AttributesImpl(attributes); Locale language = getLanguage(attributes); - structureTreeHandler = new StructureTreeHandler( + structureTreeHandler = new MainStructureTreeHandler( userAgent.getStructureTreeEventHandler(), language); } else if (localName.equals(EL_STRUCTURE_TREE)) { @@ -520,6 +533,7 @@ public class IFParser implements IFConstants { public void startElement(Attributes attributes) throws IFException { documentHandler.startPageHeader(); + structureTreeHandler = new StructureTreeHandler(userAgent.getStructureTreeEventHandler()); } public void endElement() throws IFException { @@ -842,12 +856,19 @@ public class IFParser implements IFConstants { } private void establishStructureTreeElement(Attributes attributes) { - String structRef = attributes.getValue(InternalElementMapping.URI, - InternalElementMapping.STRUCT_REF); + StructureTreeElement element = getStructureTreeElement(attributes); + if (element != null) { + documentHandler.getContext().setStructureTreeElement(element); + } + } + + private StructureTreeElement getStructureTreeElement(Attributes attributes) { + String structRef = attributes.getValue(InternalElementMapping.URI, InternalElementMapping.STRUCT_REF); if (structRef != null && structRef.length() > 0) { assert structureTreeElements.containsKey(structRef); - StructureTreeElement structureTreeElement = structureTreeElements.get(structRef); - documentHandler.getContext().setStructureTreeElement(structureTreeElement); + return structureTreeElements.get(structRef); + } else { + return null; } } diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index ff3f761bf..bba8c744d 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -314,6 +314,9 @@ implements IFConstants, IFPainter, IFDocumentNavigationHandler { public void startPageHeader() throws IFException { try { handler.startElement(EL_PAGE_HEADER); + if (this.getUserAgent().isAccessibilityEnabled()) { + structureTreeBuilder.replayEventsForRetrievedMarkers(handler); + } } catch (SAXException e) { throw new IFException("SAX error in startPageHeader()", e); } diff --git a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java b/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java index 9ba9afd81..f7049997e 100644 --- a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java +++ b/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java @@ -33,6 +33,7 @@ import org.apache.fop.accessibility.StructureTree2SAXEventAdapter; import org.apache.fop.accessibility.StructureTreeElement; import org.apache.fop.accessibility.StructureTreeEventHandler; import org.apache.fop.fo.extensions.InternalElementMapping; +import org.apache.fop.util.XMLConstants; import org.apache.fop.util.XMLUtil; /** @@ -176,6 +177,8 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { private final List<SAXEventRecorder> pageSequenceEventRecorders = new ArrayList<SAXEventRecorder>(); + private SAXEventRecorder retrievedMarkersEventRecorder; + private int idCounter; /** @@ -189,6 +192,16 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { pageSequenceEventRecorders.get(pageSequenceIndex).replay(handler); } + public void replayEventsForRetrievedMarkers(ContentHandler handler) throws SAXException { + if (!retrievedMarkersEventRecorder.events.isEmpty()) { + delegate = StructureTree2SAXEventAdapter.newInstance(handler); + delegate.startPageSequence(null, null); + retrievedMarkersEventRecorder.replay(handler); + delegate.endPageSequence(); + prepareRetrievedMarkersEventRecorder(); + } + } + public void startPageSequence(Locale locale, String role) { SAXEventRecorder eventRecorder = new SAXEventRecorder(); pageSequenceEventRecorders.add(eventRecorder); @@ -198,28 +211,51 @@ final class IFStructureTreeBuilder implements StructureTreeEventHandler { public void endPageSequence() { delegate.endPageSequence(); + prepareRetrievedMarkersEventRecorder(); + } + + private void prepareRetrievedMarkersEventRecorder() { + SAXEventRecorder eventRecorder = new SAXEventRecorder(); + retrievedMarkersEventRecorder = eventRecorder; + delegate = StructureTree2SAXEventAdapter.newInstance(eventRecorder); } - public StructureTreeElement startNode(String name, Attributes attributes) { - delegate.startNode(name, attributes); + public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) { + if (parent != null) { + attributes = addParentAttribute(new AttributesImpl(attributes), parent); + } + delegate.startNode(name, attributes, null); return new IFStructureTreeElement(); } + private AttributesImpl addParentAttribute(AttributesImpl attributes, StructureTreeElement parent) { + if (parent != null) { + attributes.addAttribute(InternalElementMapping.URI, + InternalElementMapping.STRUCT_REF, + InternalElementMapping.STANDARD_PREFIX + ":" + InternalElementMapping.STRUCT_REF, + XMLConstants.CDATA, + ((IFStructureTreeElement) parent).getId()); + } + return attributes; + } + public void endNode(String name) { delegate.endNode(name); } - public StructureTreeElement startImageNode(String name, Attributes attributes) { + public StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent) { String id = getNextID(); AttributesImpl atts = addIDAttribute(attributes, id); - delegate.startImageNode(name, atts); + addParentAttribute(atts, parent); + delegate.startImageNode(name, atts, null); return new IFStructureTreeElement(id); } - public StructureTreeElement startReferencedNode(String name, Attributes attributes) { + public StructureTreeElement startReferencedNode(String name, Attributes attributes, StructureTreeElement parent) { String id = getNextID(); AttributesImpl atts = addIDAttribute(attributes, id); - delegate.startReferencedNode(name, atts); + addParentAttribute(atts, parent); + delegate.startReferencedNode(name, atts, null); return new IFStructureTreeElement(id); } diff --git a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java b/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java index c532a05a4..2eb5bc8aa 100644 --- a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java @@ -128,9 +128,10 @@ class PDFLogicalStructureHandler { } private MarkedContentInfo addToParentTree(PDFStructElem structureTreeElement) { - PDFStructElem parent = (structureTreeElement instanceof PDFStructElem.Placeholder) - ? structureTreeElement.getParentStructElem() - : structureTreeElement; + PDFStructElem parent = structureTreeElement; + while (parent instanceof PDFStructElem.Placeholder) { + parent = parent.getParentStructElem(); + } pageParentTreeArray.add(parent); String type = parent.getStructureType().getName().toString(); int mcid = pageParentTreeArray.length() - 1; diff --git a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java index 08aad08f6..4d34b8be4 100644 --- a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java +++ b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java @@ -96,8 +96,11 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler { addBuilder("float", StandardStructureTypes.Grouping.DIV); addBuilder("footnote", StandardStructureTypes.InlineLevelStructure.NOTE); addBuilder("footnote-body", StandardStructureTypes.Grouping.SECT); + // Other Formatting Objects addBuilder("wrapper", StandardStructureTypes.InlineLevelStructure.SPAN); addBuilder("marker", StandardStructureTypes.Grouping.PRIVATE); + addBuilder("retrieve-marker", new PlaceholderBuilder()); + addBuilder("retrieve-table-marker", new PlaceholderBuilder()); addBuilder("#PCDATA", new PlaceholderBuilder()); } @@ -354,9 +357,9 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler { public void endPageSequence() { } - public StructureTreeElement startNode(String name, Attributes attributes) { - PDFStructElem parent = ancestors.getFirst(); - PDFStructElem structElem = createStructureElement(name, parent, attributes, + public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) { + PDFStructElem parentElem = parent == null ? ancestors.getFirst() : (PDFStructElem) parent; + PDFStructElem structElem = createStructureElement(name, parentElem, attributes, pdfFactory, eventBroadcaster); ancestors.addFirst(structElem); return structElem; @@ -366,12 +369,12 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler { ancestors.removeFirst(); } - public StructureTreeElement startImageNode(String name, Attributes attributes) { - return startNode(name, attributes); + public StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent) { + return startNode(name, attributes, parent); } - public StructureTreeElement startReferencedNode(String name, Attributes attributes) { - return startNode(name, attributes); + public StructureTreeElement startReferencedNode(String name, Attributes attributes, StructureTreeElement parent) { + return startNode(name, attributes, parent); } } diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java index b2d85dd10..36d7c18d2 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java @@ -49,7 +49,7 @@ public class PDFEmbeddedFileElement extends AbstractPDFExtensionElement { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (parent.getNameId() != Constants.FO_DECLARATIONS) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java b/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java index a8bab26b6..11b2e5f7b 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java +++ b/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java @@ -42,7 +42,7 @@ public abstract class AbstractPSCommentElement extends AbstractPSExtensionElemen * @throws FOPException if there's a problem during processing * @see org.apache.fop.fo.FONode#startOfNode() */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { if (parent.getNameId() != Constants.FO_DECLARATIONS && parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java b/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java index 3f534af7e..c79d31613 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java +++ b/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java @@ -97,7 +97,7 @@ public abstract class AbstractPSExtensionElement extends FONode { * @see org.apache.fop.fo.FONode#endOfNode() * @throws FOPException if there's a problem during processing */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); String s = ((PSExtensionAttachment)getExtensionAttachment()).getContent(); if (s == null || s.length() == 0) { diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java b/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java index d097e7b5e..1ee48d9d6 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java +++ b/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java @@ -86,7 +86,7 @@ public abstract class AbstractPSExtensionObject extends FONode { } /** {@inheritDoc} */ - protected void endOfNode() throws FOPException { + public void endOfNode() throws FOPException { super.endOfNode(); String s = setupCode.getContent(); if (s == null || s.length() == 0) { diff --git a/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java b/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java index 686667c3d..cf2ea9444 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java +++ b/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java @@ -40,7 +40,7 @@ public class PSPageSetupCodeElement extends AbstractPSExtensionObject { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java b/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java index 6cdd1c60c..ebae5baaf 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java +++ b/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java @@ -49,7 +49,7 @@ public class PSSetPageDeviceElement extends AbstractPSExtensionElement { * @throws FOPException if there's a problem during processing * @see org.apache.fop.fo.FONode#startOfNode() */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if ( !((parent.getNameId() == Constants.FO_DECLARATIONS) || (parent.getNameId() == Constants.FO_SIMPLE_PAGE_MASTER)) ) { diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java b/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java index 4ac0af2b7..365275455 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java +++ b/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java @@ -40,7 +40,7 @@ public class PSSetupCodeElement extends AbstractPSExtensionObject { } /** {@inheritDoc} */ - protected void startOfNode() throws FOPException { + public void startOfNode() throws FOPException { super.startOfNode(); if (parent.getNameId() != Constants.FO_DECLARATIONS) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), diff --git a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java index 6819fed79..4df3fe278 100644 --- a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java @@ -90,7 +90,7 @@ public class IFStructureTreeBuilderTestCase { final ContentHandler handler = mock(ContentHandler.class); sut.startPageSequence(null, null); - sut.startNode(nodeName, createSimpleAttributes(attributes)); + sut.startNode(nodeName, createSimpleAttributes(attributes), null); sut.endPageSequence(); sut.replayEventsForPageSequence(handler, 0); diff --git a/test/pdf/accessibility/markers.fo b/test/pdf/accessibility/markers.fo new file mode 100644 index 000000000..67dbfc3d4 --- /dev/null +++ b/test/pdf/accessibility/markers.fo @@ -0,0 +1,169 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xml:lang="en-GB"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="200pt" page-width="280pt" margin="10pt"> + <fo:region-body/> + <fo:region-after extent="100pt" display-align="after"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:static-content flow-name="xsl-region-after" line-height="10pt" font-size="8pt"> + <fo:block>Retrieving the marker:</fo:block> + <fo:retrieve-marker retrieve-class-name="marker"/> + <fo:block>Marker retrieved.</fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body"> + <fo:block><fo:marker marker-class-name="marker"> + <fo:table width="100%" table-layout="fixed"> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block-container> + <fo:block>Inside a block-container.</fo:block> + </fo:block-container> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>A character: <fo:character character="c" color="blue"/>.</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block text-align="center"><fo:instream-foreign-object fox:alt-text="Nice + circles." width="30pt" overflow="hidden" display-align="center" + content-width="30pt"> + <svg xmlns="http://www.w3.org/2000/svg" width="319" height="286.6"> + <g style="fill-opacity:0.7; stroke:black; stroke-width:3" + transform="translate(0, 286.6) scale(1, -1) translate(100, 100)"> + <circle cx="50" cy="86.6" r="80" style="fill:red;"/> + <circle cx="0" cy="0" r="80" style="fill:green;"/> + <circle cx="100" cy="0" r="80" style="fill:blue;"/> + </g> + </svg> + </fo:instream-foreign-object></fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block text-align-last="justify">Lead<fo:leader leader-pattern="dots" + leader-length.minimum="0" leader-length.optimum="100%"/>er.</fo:block> + <fo:block>Page <fo:page-number/>.</fo:block> + <fo:block-container absolute-position="absolute" width="35pt" height="10pt" top="20pt" + right="2pt" color="purple" text-align="right"> + <fo:block>Absolute.</fo:block> + </fo:block-container> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block>1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.2</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.3</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.4</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block>2.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.2</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.3</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.4</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table></fo:marker>Text in the region-body.</fo:block> + </fo:flow> + </fo:page-sequence> + + <fo:page-sequence master-reference="page"> + <fo:static-content flow-name="xsl-region-after" line-height="10pt" font-size="8pt" + role="artifact"> + <fo:block>This whole page footer should neither appear in the structure tree nor be read out + loud.</fo:block> + <fo:block>Retrieving the marker:</fo:block> + <fo:retrieve-marker retrieve-class-name="marker"/> + <fo:block>Marker retrieved.</fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body"> + <fo:block><fo:marker marker-class-name="marker"> + <fo:table width="100%" table-layout="fixed"> + <fo:table-header> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block-container> + <fo:block>Inside a block-container.</fo:block> + </fo:block-container> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>A character: <fo:character character="c" color="blue"/>.</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block text-align="center"><fo:instream-foreign-object fox:alt-text="Nice + circles." width="30pt" overflow="hidden" display-align="center" + content-width="30pt"> + <svg xmlns="http://www.w3.org/2000/svg" width="319" height="286.6"> + <g style="fill-opacity:0.7; stroke:black; stroke-width:3" + transform="translate(0, 286.6) scale(1, -1) translate(100, 100)"> + <circle cx="50" cy="86.6" r="80" style="fill:red;"/> + <circle cx="0" cy="0" r="80" style="fill:green;"/> + <circle cx="100" cy="0" r="80" style="fill:blue;"/> + </g> + </svg> + </fo:instream-foreign-object></fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block text-align-last="justify">Lead<fo:leader leader-pattern="dots" + leader-length.minimum="0" leader-length.optimum="100%"/>er.</fo:block> + <fo:block>Page <fo:page-number/>.</fo:block> + <fo:block-container absolute-position="absolute" width="35pt" height="10pt" top="20pt" + right="2pt" color="purple" text-align="right"> + <fo:block>Absolute.</fo:block> + </fo:block-container> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block>1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.2</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.3</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>1.4</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block>2.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.2</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.3</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>2.4</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table></fo:marker>Text in the region-body.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/test/pdf/accessibility/pdf/markers.pdf b/test/pdf/accessibility/pdf/markers.pdf Binary files differnew file mode 100644 index 000000000..752fbd10d --- /dev/null +++ b/test/pdf/accessibility/pdf/markers.pdf |