use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.
the class XSLFFreeformShape method prototype.
/**
* @param shapeId 1-based shapeId
*/
static CTShape prototype(int shapeId) {
CTShape ct = CTShape.Factory.newInstance();
CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
cnv.setName("Freeform " + shapeId);
cnv.setId(shapeId + 1);
nvSpPr.addNewCNvSpPr();
nvSpPr.addNewNvPr();
CTShapeProperties spPr = ct.addNewSpPr();
CTCustomGeometry2D geom = spPr.addNewCustGeom();
geom.addNewAvLst();
geom.addNewGdLst();
geom.addNewAhLst();
geom.addNewCxnLst();
CTGeomRect rect = geom.addNewRect();
rect.setR("r");
rect.setB("b");
rect.setT("t");
rect.setL("l");
geom.addNewPathLst();
return ct;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.
the class XSLFAutoShape method getTextBody.
protected CTTextBody getTextBody(boolean create) {
CTShape shape = (CTShape) getXmlObject();
CTTextBody txBody = shape.getTxBody();
if (txBody == null && create) {
txBody = shape.addNewTxBody();
initTextBody(txBody);
}
return txBody;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.
the class XSLFGroupShape method removeShape.
/**
* Remove the specified shape from this group
*/
@Override
public boolean removeShape(XSLFShape xShape) {
XmlObject obj = xShape.getXmlObject();
CTGroupShape grpSp = (CTGroupShape) getXmlObject();
if (obj instanceof CTShape) {
grpSp.getSpList().remove(obj);
} else if (obj instanceof CTGroupShape) {
grpSp.getGrpSpList().remove(obj);
} else if (obj instanceof CTConnector) {
grpSp.getCxnSpList().remove(obj);
} else if (obj instanceof CTGraphicalObjectFrame) {
grpSp.getGraphicFrameList().remove(obj);
} else if (obj instanceof CTPicture) {
XSLFPictureShape ps = (XSLFPictureShape) xShape;
XSLFSheet sh = getSheet();
if (sh != null) {
sh.removePictureRelation(ps);
}
grpSp.getPicList().remove(obj);
} else {
throw new IllegalArgumentException("Unsupported shape: " + xShape);
}
return _shapes.remove(xShape);
}
Aggregations