use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape in project poi by apache.
the class XSSFShapeGroup method createGroup.
/**
* Creates a group shape.
*
* @param anchor the client anchor describes how this group is attached to the group.
* @return the newly created group shape.
*/
public XSSFShapeGroup createGroup(XSSFChildAnchor anchor) {
CTGroupShape ctShape = ctGroup.addNewGrpSp();
ctShape.set(prototype());
XSSFShapeGroup shape = new XSSFShapeGroup(getDrawing(), ctShape);
shape.parent = this;
shape.anchor = anchor;
// TODO: calculate bounding rectangle on anchor and set off/ext correctly
CTGroupTransform2D xfrm = shape.getCTGroupShape().getGrpSpPr().getXfrm();
CTTransform2D t2 = anchor.getCTTransform2D();
xfrm.setOff(t2.getOff());
xfrm.setExt(t2.getExt());
// child offset is left to 0,0
xfrm.setChExt(t2.getExt());
xfrm.setFlipH(t2.getFlipH());
xfrm.setFlipV(t2.getFlipV());
return shape;
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape in project poi by apache.
the class XSLFCommonSlideData method getDrawingText.
public List<DrawingTextBody> getDrawingText() {
CTGroupShape gs = data.getSpTree();
List<DrawingTextBody> out = new ArrayList<DrawingTextBody>();
processShape(gs, out);
for (CTGroupShape shape : gs.getGrpSpArray()) {
processShape(shape, out);
}
for (CTGraphicalObjectFrame frame : gs.getGraphicFrameArray()) {
CTGraphicalObjectData data = frame.getGraphic().getGraphicData();
XmlCursor c = data.newCursor();
c.selectPath("declare namespace pic='" + CTTable.type.getName().getNamespaceURI() + "' .//pic:tbl");
while (c.toNextSelection()) {
XmlObject o = c.getObject();
if (o instanceof XmlAnyTypeImpl) {
// Pesky XmlBeans bug - see Bugzilla #49934
try {
o = CTTable.Factory.parse(o.toString(), DEFAULT_XML_OPTIONS);
} catch (XmlException e) {
throw new POIXMLException(e);
}
}
if (o instanceof CTTable) {
DrawingTable table = new DrawingTable((CTTable) o);
for (DrawingTableRow row : table.getRows()) {
for (DrawingTableCell cell : row.getCells()) {
DrawingTextBody textBody = cell.getTextBody();
out.add(textBody);
}
}
}
}
c.dispose();
}
return out;
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape in project poi by apache.
the class XSLFGroupShape method prototype.
/**
* @param shapeId 1-based shapeId
*/
static CTGroupShape prototype(int shapeId) {
CTGroupShape ct = CTGroupShape.Factory.newInstance();
CTGroupShapeNonVisual nvSpPr = ct.addNewNvGrpSpPr();
CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
cnv.setName("Group " + shapeId);
cnv.setId(shapeId + 1);
nvSpPr.addNewCNvGrpSpPr();
nvSpPr.addNewNvPr();
ct.addNewGrpSpPr();
return ct;
}
Aggregations