use of org.openxmlformats.schemas.presentationml.x2006.main.CTSlide in project poi by apache.
the class XSLFSlideShow method getSlide.
/**
* Returns the low level slide object from
* the supplied slide reference
*/
@Internal
public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException {
PackagePart slidePart = getSlidePart(slide);
SldDocument slideDoc = SldDocument.Factory.parse(slidePart.getInputStream(), DEFAULT_XML_OPTIONS);
return slideDoc.getSld();
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTSlide in project poi by apache.
the class XSLFSlide method prototype.
private static CTSlide prototype() {
CTSlide ctSlide = CTSlide.Factory.newInstance();
CTCommonSlideData cSld = ctSlide.addNewCSld();
CTGroupShape spTree = cSld.addNewSpTree();
CTGroupShapeNonVisual nvGrpSpPr = spTree.addNewNvGrpSpPr();
CTNonVisualDrawingProps cnvPr = nvGrpSpPr.addNewCNvPr();
cnvPr.setId(1);
cnvPr.setName("");
nvGrpSpPr.addNewCNvGrpSpPr();
nvGrpSpPr.addNewNvPr();
CTGroupShapeProperties grpSpr = spTree.addNewGrpSpPr();
CTGroupTransform2D xfrm = grpSpr.addNewXfrm();
CTPoint2D off = xfrm.addNewOff();
off.setX(0);
off.setY(0);
CTPositiveSize2D ext = xfrm.addNewExt();
ext.setCx(0);
ext.setCy(0);
CTPoint2D choff = xfrm.addNewChOff();
choff.setX(0);
choff.setY(0);
CTPositiveSize2D chExt = xfrm.addNewChExt();
chExt.setCx(0);
chExt.setCy(0);
ctSlide.addNewClrMapOvr().addNewMasterClrMapping();
return ctSlide;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTSlide in project tika by apache.
the class XSLFPowerPointExtractorDecorator method getMainDocumentParts.
/**
* In PowerPoint files, slides have things embedded in them,
* and slide drawings which have the images
*/
@Override
protected List<PackagePart> getMainDocumentParts() throws TikaException {
List<PackagePart> parts = new ArrayList<>();
XSLFSlideShow document = null;
try {
document = new XSLFSlideShow(extractor.getPackage());
} catch (Exception e) {
// Shouldn't happen
throw new TikaException(e.getMessage());
}
CTSlideIdList ctSlideIdList = document.getSlideReferences();
if (ctSlideIdList != null) {
for (int i = 0; i < ctSlideIdList.sizeOfSldIdArray(); i++) {
CTSlideIdListEntry ctSlide = ctSlideIdList.getSldIdArray(i);
// 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);
}
addSlideParts(slidePart, parts);
}
}
//add full document to include macros
parts.add(document.getPackagePart());
for (String rel : new String[] { XSLFRelation.SLIDE_MASTER.getRelation(), HANDOUT_MASTER }) {
try {
PackageRelationshipCollection prc = document.getPackagePart().getRelationshipsByType(rel);
for (int i = 0; i < prc.size(); i++) {
PackagePart pp = document.getPackagePart().getRelatedPart(prc.getRelationship(i));
if (pp != null) {
parts.add(pp);
}
}
} catch (InvalidFormatException e) {
//log
}
}
return parts;
}
Aggregations