Apache FOP's ODT render
This page describes the design of Apache FOP's ODT render. The appropriate opened issue can be found at: https://issues.apache.org/bugzilla/show_bug.cgi?id=53400.
Integration with FOP
ODT render is integrated with FOP as ODTFOEventHandlerMaker, implementation of FOEventHandler, similar to RTFFOEventHandlerMaker. However, ODT Converter is using only the endPageSequence event to go through the tree separately. Integration can be seen as point for review.
Odt render is for its work is using odfdom-java-0.8.7.jar that provides the DOM implementation of odt document. The reference: http://incubator.apache.org/odftoolkit/odfdom/index.html
FopOdtConverter is a real entry point for the render. Initialization creates a new ODT document. At the end of generation we should use method writeToOutputStream. In the meantime, just once we should put the highest FONode of the FOP tree.
The method is recursively asking the TagFactory for an appropriate Tag (converter of one type of xslfo element to odt element) to encountered FONode. During the initialization each Tag get to know its "parent" Tag in any purpose. Special execution depending on the parent Tag is implemented thanks to Visitor design pattern (TagExecutable and TagExecutor).
Each Tag has its Style element that collects all xslfo attributes (Property) preformatted to use directly in odt document. Each Style knows the Style of the parent Tag in case of inheritance of xslfo attributes.
Properties are implemented as a sort of Flyweight pattern to avoid, in our case, the initialization time of many classes. Properties are responsible for attributes conversion to odt attributes.
Although, the architecture of ODT render seems to be stable, it is still in initial state of development. Render requires the implementation of each attribute (more than 200) sometimes depending on the Tag they belongs to.
The implementation state can be kept track in: https://docs.google.com/spreadsheet/ccc?key=0Ahy7yhoOWhbidGtxSXVXb1hWU2hEbzczZlFVNTNwS0E or in html format: https://docs.google.com/spreadsheet/pub?key=0Ahy7yhoOWhbidGtxSXVXb1hWU2hEbzczZlFVNTNwS0E&single=true&gid=0&output=html