|
|
@@ -73,7 +73,7 @@ import org.apache.fop.fo.properties.CommonAccessibilityHolder; |
|
|
|
public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
|
|
|
|
/** The top of the {@link converters} stack. */ |
|
|
|
private FOEventHandler converter; |
|
|
|
protected FOEventHandler converter; |
|
|
|
|
|
|
|
private Stack<FOEventHandler> converters = new Stack<FOEventHandler>(); |
|
|
|
|
|
|
@@ -99,6 +99,42 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private Event root = new Event((Event) null); |
|
|
|
private Event currentNode = root; |
|
|
|
|
|
|
|
private void startContent(Event event, boolean hasContent) { |
|
|
|
if (getUserAgent().isKeepEmptyTags()) { |
|
|
|
event.run(); |
|
|
|
} else { |
|
|
|
Event node = new Event(currentNode); |
|
|
|
event.hasContent = hasContent; |
|
|
|
node.add(event); |
|
|
|
currentNode.add(node); |
|
|
|
currentNode = node; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void content(Event event, boolean hasContent) { |
|
|
|
if (getUserAgent().isKeepEmptyTags()) { |
|
|
|
event.run(); |
|
|
|
} else { |
|
|
|
currentNode.add(event); |
|
|
|
event.hasContent = hasContent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void endContent(Event event) { |
|
|
|
if (getUserAgent().isKeepEmptyTags()) { |
|
|
|
event.run(); |
|
|
|
} else { |
|
|
|
currentNode.add(event); |
|
|
|
currentNode = currentNode.parent; |
|
|
|
if (currentNode == root) { |
|
|
|
root.run(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Creates a new instance. |
|
|
|
* |
|
|
@@ -149,51 +185,83 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startPageNumber(PageNumber pagenum) { |
|
|
|
converter.startPageNumber(pagenum); |
|
|
|
public void startPageNumber(final PageNumber pagenum) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startPageNumber(pagenum); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startPageNumber(pagenum); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endPageNumber(PageNumber pagenum) { |
|
|
|
converter.endPageNumber(pagenum); |
|
|
|
public void endPageNumber(final PageNumber pagenum) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endPageNumber(pagenum); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endPageNumber(pagenum); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startPageNumberCitation(PageNumberCitation pageCite) { |
|
|
|
converter.startPageNumberCitation(pageCite); |
|
|
|
public void startPageNumberCitation(final PageNumberCitation pageCite) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startPageNumberCitation(pageCite); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startPageNumberCitation(pageCite); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endPageNumberCitation(PageNumberCitation pageCite) { |
|
|
|
converter.endPageNumberCitation(pageCite); |
|
|
|
public void endPageNumberCitation(final PageNumberCitation pageCite) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endPageNumberCitation(pageCite); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endPageNumberCitation(pageCite); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startPageNumberCitationLast(PageNumberCitationLast pageLast) { |
|
|
|
converter.startPageNumberCitationLast(pageLast); |
|
|
|
public void startPageNumberCitationLast(final PageNumberCitationLast pageLast) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startPageNumberCitationLast(pageLast); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startPageNumberCitationLast(pageLast); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endPageNumberCitationLast(PageNumberCitationLast pageLast) { |
|
|
|
converter.endPageNumberCitationLast(pageLast); |
|
|
|
public void endPageNumberCitationLast(final PageNumberCitationLast pageLast) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endPageNumberCitationLast(pageLast); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endPageNumberCitationLast(pageLast); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startStatic(StaticContent staticContent) { |
|
|
|
public void startStatic(final StaticContent staticContent) { |
|
|
|
handleStartArtifact(staticContent); |
|
|
|
converter.startStatic(staticContent); |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startStatic(staticContent); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startStatic(staticContent); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endStatic(StaticContent staticContent) { |
|
|
|
converter.endStatic(staticContent); |
|
|
|
public void endStatic(final StaticContent staticContent) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endStatic(staticContent); |
|
|
|
} |
|
|
|
}); |
|
|
|
handleEndArtifact(staticContent); |
|
|
|
super.endStatic(staticContent); |
|
|
|
} |
|
|
@@ -211,277 +279,457 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startBlock(Block bl) { |
|
|
|
converter.startBlock(bl); |
|
|
|
public void startBlock(final Block bl) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startBlock(bl); |
|
|
|
} |
|
|
|
}, false); |
|
|
|
super.startBlock(bl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endBlock(Block bl) { |
|
|
|
converter.endBlock(bl); |
|
|
|
public void endBlock(final Block bl) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endBlock(bl); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endBlock(bl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startBlockContainer(BlockContainer blc) { |
|
|
|
converter.startBlockContainer(blc); |
|
|
|
public void startBlockContainer(final BlockContainer blc) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startBlockContainer(blc); |
|
|
|
} |
|
|
|
}, false); |
|
|
|
super.startBlockContainer(blc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endBlockContainer(BlockContainer blc) { |
|
|
|
converter.endBlockContainer(blc); |
|
|
|
public void endBlockContainer(final BlockContainer blc) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endBlockContainer(blc); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endBlockContainer(blc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startInline(Inline inl) { |
|
|
|
converter.startInline(inl); |
|
|
|
public void startInline(final Inline inl) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startInline(inl); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startInline(inl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endInline(Inline inl) { |
|
|
|
converter.endInline(inl); |
|
|
|
public void endInline(final Inline inl) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endInline(inl); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endInline(inl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startTable(Table tbl) { |
|
|
|
converter.startTable(tbl); |
|
|
|
public void startTable(final Table tbl) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startTable(tbl); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startTable(tbl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endTable(Table tbl) { |
|
|
|
converter.endTable(tbl); |
|
|
|
public void endTable(final Table tbl) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endTable(tbl); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endTable(tbl); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startColumn(TableColumn tc) { |
|
|
|
converter.startColumn(tc); |
|
|
|
public void startColumn(final TableColumn tc) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startColumn(tc); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startColumn(tc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endColumn(TableColumn tc) { |
|
|
|
converter.endColumn(tc); |
|
|
|
public void endColumn(final TableColumn tc) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endColumn(tc); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endColumn(tc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startHeader(TableHeader header) { |
|
|
|
converter.startHeader(header); |
|
|
|
public void startHeader(final TableHeader header) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startHeader(header); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startHeader(header); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endHeader(TableHeader header) { |
|
|
|
converter.endHeader(header); |
|
|
|
public void endHeader(final TableHeader header) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endHeader(header); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endHeader(header); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startFooter(TableFooter footer) { |
|
|
|
converter.startFooter(footer); |
|
|
|
public void startFooter(final TableFooter footer) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startFooter(footer); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startFooter(footer); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endFooter(TableFooter footer) { |
|
|
|
converter.endFooter(footer); |
|
|
|
public void endFooter(final TableFooter footer) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endFooter(footer); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endFooter(footer); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startBody(TableBody body) { |
|
|
|
converter.startBody(body); |
|
|
|
public void startBody(final TableBody body) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startBody(body); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startBody(body); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endBody(TableBody body) { |
|
|
|
converter.endBody(body); |
|
|
|
public void endBody(final TableBody body) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endBody(body); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endBody(body); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startRow(TableRow tr) { |
|
|
|
converter.startRow(tr); |
|
|
|
public void startRow(final TableRow tr) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startRow(tr); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startRow(tr); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endRow(TableRow tr) { |
|
|
|
converter.endRow(tr); |
|
|
|
public void endRow(final TableRow tr) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endRow(tr); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endRow(tr); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startCell(TableCell tc) { |
|
|
|
converter.startCell(tc); |
|
|
|
public void startCell(final TableCell tc) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startCell(tc); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startCell(tc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endCell(TableCell tc) { |
|
|
|
converter.endCell(tc); |
|
|
|
public void endCell(final TableCell tc) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endCell(tc); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endCell(tc); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startList(ListBlock lb) { |
|
|
|
converter.startList(lb); |
|
|
|
public void startList(final ListBlock lb) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startList(lb); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startList(lb); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endList(ListBlock lb) { |
|
|
|
converter.endList(lb); |
|
|
|
public void endList(final ListBlock lb) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endList(lb); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endList(lb); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startListItem(ListItem li) { |
|
|
|
converter.startListItem(li); |
|
|
|
public void startListItem(final ListItem li) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startListItem(li); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startListItem(li); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endListItem(ListItem li) { |
|
|
|
converter.endListItem(li); |
|
|
|
public void endListItem(final ListItem li) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endListItem(li); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endListItem(li); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startListLabel(ListItemLabel listItemLabel) { |
|
|
|
converter.startListLabel(listItemLabel); |
|
|
|
public void startListLabel(final ListItemLabel listItemLabel) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startListLabel(listItemLabel); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startListLabel(listItemLabel); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endListLabel(ListItemLabel listItemLabel) { |
|
|
|
converter.endListLabel(listItemLabel); |
|
|
|
public void endListLabel(final ListItemLabel listItemLabel) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endListLabel(listItemLabel); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endListLabel(listItemLabel); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startListBody(ListItemBody listItemBody) { |
|
|
|
converter.startListBody(listItemBody); |
|
|
|
public void startListBody(final ListItemBody listItemBody) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startListBody(listItemBody); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startListBody(listItemBody); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endListBody(ListItemBody listItemBody) { |
|
|
|
converter.endListBody(listItemBody); |
|
|
|
public void endListBody(final ListItemBody listItemBody) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endListBody(listItemBody); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endListBody(listItemBody); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startMarkup() { |
|
|
|
converter.startMarkup(); |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startMarkup(); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startMarkup(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endMarkup() { |
|
|
|
converter.endMarkup(); |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endMarkup(); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endMarkup(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startLink(BasicLink basicLink) { |
|
|
|
converter.startLink(basicLink); |
|
|
|
public void startLink(final BasicLink basicLink) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startLink(basicLink); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startLink(basicLink); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endLink(BasicLink basicLink) { |
|
|
|
converter.endLink(basicLink); |
|
|
|
public void endLink(final BasicLink basicLink) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endLink(basicLink); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endLink(basicLink); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void image(ExternalGraphic eg) { |
|
|
|
converter.image(eg); |
|
|
|
public void image(final ExternalGraphic eg) { |
|
|
|
content(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.image(eg); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.image(eg); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void pageRef() { |
|
|
|
converter.pageRef(); |
|
|
|
content(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.pageRef(); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.pageRef(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startInstreamForeignObject(InstreamForeignObject ifo) { |
|
|
|
converter.startInstreamForeignObject(ifo); |
|
|
|
public void startInstreamForeignObject(final InstreamForeignObject ifo) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startInstreamForeignObject(ifo); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startInstreamForeignObject(ifo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endInstreamForeignObject(InstreamForeignObject ifo) { |
|
|
|
converter.endInstreamForeignObject(ifo); |
|
|
|
public void endInstreamForeignObject(final InstreamForeignObject ifo) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endInstreamForeignObject(ifo); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endInstreamForeignObject(ifo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startFootnote(Footnote footnote) { |
|
|
|
converter.startFootnote(footnote); |
|
|
|
public void startFootnote(final Footnote footnote) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startFootnote(footnote); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startFootnote(footnote); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endFootnote(Footnote footnote) { |
|
|
|
converter.endFootnote(footnote); |
|
|
|
public void endFootnote(final Footnote footnote) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endFootnote(footnote); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endFootnote(footnote); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startFootnoteBody(FootnoteBody body) { |
|
|
|
converter.startFootnoteBody(body); |
|
|
|
public void startFootnoteBody(final FootnoteBody body) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startFootnoteBody(body); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startFootnoteBody(body); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endFootnoteBody(FootnoteBody body) { |
|
|
|
converter.endFootnoteBody(body); |
|
|
|
public void endFootnoteBody(final FootnoteBody body) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endFootnoteBody(body); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endFootnoteBody(body); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startLeader(Leader l) { |
|
|
|
public void startLeader(final Leader l) { |
|
|
|
converters.push(converter); |
|
|
|
converter = eventSwallower; |
|
|
|
converter.startLeader(l); |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startLeader(l); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startLeader(l); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endLeader(Leader l) { |
|
|
|
converter.endLeader(l); |
|
|
|
public void endLeader(final Leader l) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endLeader(l); |
|
|
|
} |
|
|
|
}); |
|
|
|
converter = converters.pop(); |
|
|
|
super.endLeader(l); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startWrapper(Wrapper wrapper) { |
|
|
|
public void startWrapper(final Wrapper wrapper) { |
|
|
|
handleStartArtifact(wrapper); |
|
|
|
converter.startWrapper(wrapper); |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startWrapper(wrapper); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startWrapper(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endWrapper(Wrapper wrapper) { |
|
|
|
converter.endWrapper(wrapper); |
|
|
|
public void endWrapper(final Wrapper wrapper) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endWrapper(wrapper); |
|
|
|
} |
|
|
|
}); |
|
|
|
handleEndArtifact(wrapper); |
|
|
|
super.endWrapper(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startRetrieveMarker(RetrieveMarker retrieveMarker) { |
|
|
|
converter.startRetrieveMarker(retrieveMarker); |
|
|
|
public void startRetrieveMarker(final RetrieveMarker retrieveMarker) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startRetrieveMarker(retrieveMarker); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
saveState(retrieveMarker); |
|
|
|
super.startRetrieveMarker(retrieveMarker); |
|
|
|
} |
|
|
@@ -491,15 +739,23 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endRetrieveMarker(RetrieveMarker retrieveMarker) { |
|
|
|
converter.endRetrieveMarker(retrieveMarker); |
|
|
|
public void endRetrieveMarker(final RetrieveMarker retrieveMarker) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endRetrieveMarker(retrieveMarker); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endRetrieveMarker(retrieveMarker); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void restoreState(RetrieveMarker retrieveMarker) { |
|
|
|
public void restoreState(final RetrieveMarker retrieveMarker) { |
|
|
|
restoreRetrieveMarkerState(retrieveMarker); |
|
|
|
converter.restoreState(retrieveMarker); |
|
|
|
content(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.restoreState(retrieveMarker); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.restoreState(retrieveMarker); |
|
|
|
} |
|
|
|
|
|
|
@@ -511,46 +767,74 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { |
|
|
|
converter.startRetrieveTableMarker(retrieveTableMarker); |
|
|
|
public void startRetrieveTableMarker(final RetrieveTableMarker retrieveTableMarker) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startRetrieveTableMarker(retrieveTableMarker); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
saveState(retrieveTableMarker); |
|
|
|
super.startRetrieveTableMarker(retrieveTableMarker); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker) { |
|
|
|
converter.endRetrieveTableMarker(retrieveTableMarker); |
|
|
|
public void endRetrieveTableMarker(final RetrieveTableMarker retrieveTableMarker) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endRetrieveTableMarker(retrieveTableMarker); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endRetrieveTableMarker(retrieveTableMarker); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void restoreState(RetrieveTableMarker retrieveTableMarker) { |
|
|
|
public void restoreState(final RetrieveTableMarker retrieveTableMarker) { |
|
|
|
restoreRetrieveMarkerState(retrieveTableMarker); |
|
|
|
converter.restoreState(retrieveTableMarker); |
|
|
|
currentNode.add(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.restoreState(retrieveTableMarker); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.restoreState(retrieveTableMarker); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void character(Character c) { |
|
|
|
converter.character(c); |
|
|
|
public void character(final Character c) { |
|
|
|
content(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.character(c); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.character(c); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void characters(FOText foText) { |
|
|
|
converter.characters(foText); |
|
|
|
public void characters(final FOText foText) { |
|
|
|
content(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.characters(foText); |
|
|
|
} |
|
|
|
}, foText.length() > 0); |
|
|
|
super.characters(foText); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startExternalDocument(ExternalDocument document) { |
|
|
|
converter.startExternalDocument(document); |
|
|
|
public void startExternalDocument(final ExternalDocument document) { |
|
|
|
startContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.startExternalDocument(document); |
|
|
|
} |
|
|
|
}, true); |
|
|
|
super.startExternalDocument(document); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void endExternalDocument(ExternalDocument document) { |
|
|
|
converter.endExternalDocument(document); |
|
|
|
public void endExternalDocument(final ExternalDocument document) { |
|
|
|
endContent(new Event(this) { |
|
|
|
public void run() { |
|
|
|
eventHandler.endExternalDocument(document); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.endExternalDocument(document); |
|
|
|
} |
|
|
|
|