private XSLFDrawing getDrawing(){ if(_drawing == null) { _drawing = new XSLFDrawing(getSheet(), (CTGroupShape)getXmlObject()); } return _drawing; }
/** * Remove the specified shape from this group */ @Override public boolean removeShape(XSLFShape xShape) { XmlObject obj = xShape.getXmlObject(); CTGroupShape grpSp = (CTGroupShape)getXmlObject(); getSheet().deregisterShapeId(xShape.getShapeId()); if(obj instanceof CTShape){ grpSp.getSpList().remove(obj); } else if (obj instanceof CTGroupShape){ XSLFGroupShape gs = (XSLFGroupShape)xShape; new ArrayList<>(gs.getShapes()).forEach(gs::removeShape); 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); }
private XSLFDrawing getDrawing(){ if(_drawing == null) { _drawing = new XSLFDrawing(getSheet(), (CTGroupShape)getXmlObject()); } return _drawing; }
/** * Remove the specified shape from this group */ @Override public boolean removeShape(XSLFShape xShape) { XmlObject obj = xShape.getXmlObject(); CTGroupShape grpSp = (CTGroupShape)getXmlObject(); getSheet().deregisterShapeId(xShape.getShapeId()); if(obj instanceof CTShape){ grpSp.getSpList().remove(obj); } else if (obj instanceof CTGroupShape){ XSLFGroupShape gs = (XSLFGroupShape)xShape; new ArrayList<>(gs.getShapes()).forEach(gs::removeShape); 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); }