XMLSlideShow slideShow = (XMLSlideShow) extractor.getDocument();
XSLFSlideShow document = null;
try {
document = slideShow._getXSLFSlideShow(); // TODO Avoid this in future
} catch(Exception e) {
throw new TikaException(e.getMessage()); // Shouldn't happen
}
for (CTSlideIdListEntry ctSlide : document.getSlideReferences().getSldIdList()) {
// Add the slide
PackagePart slidePart;
try {
slidePart = document.getSlidePart(ctSlide);
} catch(IOException e) {
throw new TikaException("Broken OOXML file", e);
} catch(XmlException xe) {
throw new TikaException("Broken OOXML file", xe);
}
parts.add(slidePart);
// If it has drawings, return those too
try {
for(PackageRelationship rel : slidePart.getRelationshipsByType(XSLFRelation.VML_DRAWING.getRelation())) {
if(rel.getTargetMode() == TargetMode.INTERNAL) {
PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
parts.add( rel.getPackage().getPart(relName) );
}
}
} catch(InvalidFormatException e) {
throw new TikaException("Broken OOXML file", e);
}
}
return parts;
}