use of org.openxmlformats.schemas.presentationml.x2006.main.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.presentationml.x2006.main.CTGroupShape in project poi by apache.
the class XSLFDrawing method createGroup.
public XSLFGroupShape createGroup() {
CTGroupShape obj = _spTree.addNewGrpSp();
obj.set(XSLFGroupShape.prototype(_shapeId++));
XSLFGroupShape shape = new XSLFGroupShape(obj, _sheet);
shape.setAnchor(new Rectangle2D.Double());
return shape;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape in project poi by apache.
the class XSLFGraphicFrame method getFallbackPicture.
@Override
public XSLFPictureShape getFallbackPicture() {
String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main'; " + "declare namespace mc='http://schemas.openxmlformats.org/markup-compatibility/2006' " + ".//mc:Fallback/*/p:pic";
XmlObject xo = selectProperty(XmlObject.class, xquery);
if (xo == null) {
return null;
}
CTGroupShape gs;
try {
gs = CTGroupShape.Factory.parse(xo.newDomNode());
} catch (XmlException e) {
LOG.log(POILogger.WARN, "Can't parse fallback picture stream of graphical frame", e);
return null;
}
if (gs.sizeOfPicArray() == 0) {
return null;
}
return new XSLFPictureShape(gs.getPicArray(0), getSheet());
}
use of org.openxmlformats.schemas.presentationml.x2006.main.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;
}
use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape 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