use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape in project poi by apache.
the class XSLFCommonSlideData method processShape.
private void processShape(CTGroupShape gs, List<DrawingTextBody> out) {
for (CTShape shape : gs.getSpArray()) {
CTTextBody ctTextBody = shape.getTxBody();
if (ctTextBody == null) {
continue;
}
DrawingTextBody textBody;
CTApplicationNonVisualDrawingProps nvpr = shape.getNvSpPr().getNvPr();
if (nvpr.isSetPh()) {
textBody = new DrawingTextPlaceholder(ctTextBody, nvpr.getPh());
} else {
textBody = new DrawingTextBody(ctTextBody);
}
out.add(textBody);
}
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape in project poi by apache.
the class XSLFSheet method removeShape.
/**
* Removes the specified shape from this sheet, if it is present
* (optional operation). If this sheet does not contain the element,
* it is unchanged.
*
* @param xShape shape to be removed from this sheet, if present
* @return <tt>true</tt> if this sheet contained the specified element
* @throws IllegalArgumentException if the type of the specified shape
* is incompatible with this sheet (optional)
*/
public boolean removeShape(XSLFShape xShape) {
XmlObject obj = xShape.getXmlObject();
CTGroupShape spTree = getSpTree();
if (obj instanceof CTShape) {
spTree.getSpList().remove(obj);
} else if (obj instanceof CTGroupShape) {
spTree.getGrpSpList().remove(obj);
} else if (obj instanceof CTConnector) {
spTree.getCxnSpList().remove(obj);
} else if (obj instanceof CTGraphicalObjectFrame) {
spTree.getGraphicFrameList().remove(obj);
} else if (obj instanceof CTPicture) {
XSLFPictureShape ps = (XSLFPictureShape) xShape;
removePictureRelation(ps);
spTree.getPicList().remove(obj);
} else {
throw new IllegalArgumentException("Unsupported shape: " + xShape);
}
return getShapes().remove(xShape);
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape in project poi by apache.
the class XSLFSheet method buildShapes.
protected static List<XSLFShape> buildShapes(CTGroupShape spTree, XSLFSheet sheet) {
List<XSLFShape> shapes = new ArrayList<XSLFShape>();
for (XmlObject ch : spTree.selectPath("*")) {
if (ch instanceof CTShape) {
// simple shape
XSLFAutoShape shape = XSLFAutoShape.create((CTShape) ch, sheet);
shapes.add(shape);
} else if (ch instanceof CTGroupShape) {
shapes.add(new XSLFGroupShape((CTGroupShape) ch, sheet));
} else if (ch instanceof CTConnector) {
shapes.add(new XSLFConnectorShape((CTConnector) ch, sheet));
} else if (ch instanceof CTPicture) {
shapes.add(new XSLFPictureShape((CTPicture) ch, sheet));
} else if (ch instanceof CTGraphicalObjectFrame) {
XSLFGraphicFrame shape = XSLFGraphicFrame.create((CTGraphicalObjectFrame) ch, sheet);
shapes.add(shape);
}
}
return shapes;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape 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.CTGroupShape in project poi by apache.
the class XSLFSheet method appendContent.
/**
* Append content to this sheet.
*
* @param src the source sheet
* @return modified <code>this</code>.
*/
public XSLFSheet appendContent(XSLFSheet src) {
CTGroupShape spTree = getSpTree();
int numShapes = getShapes().size();
CTGroupShape srcTree = src.getSpTree();
for (XmlObject ch : srcTree.selectPath("*")) {
if (ch instanceof CTShape) {
// simple shape
spTree.addNewSp().set(ch);
} else if (ch instanceof CTGroupShape) {
spTree.addNewGrpSp().set(ch);
} else if (ch instanceof CTConnector) {
spTree.addNewCxnSp().set(ch);
} else if (ch instanceof CTPicture) {
spTree.addNewPic().set(ch);
} else if (ch instanceof CTGraphicalObjectFrame) {
spTree.addNewGraphicFrame().set(ch);
}
}
_shapes = null;
_spTree = null;
_drawing = null;
_spTree = null;
_placeholders = null;
// recursively update each shape
List<XSLFShape> tgtShapes = getShapes();
List<XSLFShape> srcShapes = src.getShapes();
for (int i = 0; i < srcShapes.size(); i++) {
XSLFShape s1 = srcShapes.get(i);
XSLFShape s2 = tgtShapes.get(numShapes + i);
s2.copy(s1);
}
return this;
}
Aggregations