protected void parse(
DirectoryNode root, XHTMLContentHandler xhtml)
throws IOException, SAXException, TikaException {
HSLFSlideShow ss = new HSLFSlideShow(root);
SlideShow _show = new SlideShow(ss);
Slide[] _slides = _show.getSlides();
xhtml.startElement("div", "class", "slideShow");
/* Iterate over slides and extract text */
for( Slide slide : _slides ) {
xhtml.startElement("div", "class", "slide");
// Slide header, if present
HeadersFooters hf = slide.getHeadersFooters();
if (hf != null && hf.isHeaderVisible() && hf.getHeaderText() != null) {
xhtml.startElement("p", "class", "slide-header");
xhtml.characters( hf.getHeaderText() );
xhtml.endElement("p");
}
// Slide master, if present
// TODO: re-enable this once we fix TIKA-712
MasterSheet master = slide.getMasterSheet();
if(master != null) {
xhtml.startElement("p", "class", "slide-master-content");
textRunsToText(xhtml, master.getTextRuns(), true );
xhtml.endElement("p");
}
// Slide text
{
xhtml.startElement("p", "class", "slide-content");
textRunsToText(xhtml, slide.getTextRuns(), false );
xhtml.endElement("p");
}
// Slide footer, if present
if (hf != null && hf.isFooterVisible() && hf.getFooterText() != null) {
xhtml.startElement("p", "class", "slide-footer");
xhtml.characters( hf.getFooterText() );
xhtml.endElement("p");
}
// Comments, if present
for( Comment comment : slide.getComments() ) {
xhtml.startElement("p", "class", "slide-comment");
if (comment.getAuthor() != null) {
xhtml.startElement("b");
xhtml.characters( comment.getAuthor() );
xhtml.endElement("b");
if (comment.getText() != null) {
xhtml.characters( " - ");
}
}
if (comment.getText() != null) {
xhtml.characters( comment.getText() );
}
xhtml.endElement("p");
}
// Now any embedded resources
handleSlideEmbeddedResources(slide, xhtml);
// TODO Find the Notes for this slide and extract inline
// Slide complete
xhtml.endElement("div");
}
// All slides done
xhtml.endElement("div");
/* notes */
xhtml.startElement("div", "class", "slideNotes");
HashSet<Integer> seenNotes = new HashSet<Integer>();
HeadersFooters hf = _show.getNotesHeadersFooters();
for (Slide slide : _slides) {
Notes notes = slide.getNotesSheet();
if (notes == null) {
continue;