@Override public <T extends EscherRecord> T getEscherChild(int recordId){ EscherContainerRecord groupInfoContainer = (EscherContainerRecord)getSpContainer().getChild(0); return groupInfoContainer.getChildById((short)recordId); }
@Override public List<HSLFShape> getShapes() { // Our escher container record should contain several // SpContainers, the first of which is the group shape itself List<HSLFShape> shapeList = new ArrayList<>(); boolean isFirst = true; for (EscherRecord r : getSpContainer()) { if (isFirst) { // Don't include the first SpContainer, it is always NotPrimitive isFirst = false; continue; } if(r instanceof EscherContainerRecord) { // Create the Shape for it EscherContainerRecord container = (EscherContainerRecord)r; HSLFShape shape = HSLFShapeFactory.createShape(container, this); shape.setSheet(getSheet()); shapeList.add( shape ); } else { // Should we do anything special with these non // Container records? LOG.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName()); } } return shapeList; }
/** * Add a shape to this group. * * @param shape - the Shape to add */ @Override public void addShape(HSLFShape shape){ getSpContainer().addChildRecord(shape.getSpContainer()); HSLFSheet sheet = getSheet(); shape.setSheet(sheet); shape.setShapeId(sheet.allocateShapeId()); shape.afterInsert(sheet); }