@Override public ShapeType getShapeType(){ XSLFGeometryProperties gp = XSLFPropertiesDelegate.getGeometryDelegate(getShapeProperties()); if (gp != null && gp.isSetPrstGeom()) { STShapeType.Enum geom = gp.getPrstGeom().getPrst(); if (geom != null) { return ShapeType.forId(geom.intValue(), true); } } return null; }
/** name of the presetShapeDefinit(i)on entry */ public String getOoxmlName() { if (this == SEAL) return STAR_16.getOoxmlName(); if (ooxmlId == -1) { return (name().startsWith("TEXT")) ? RECT.getOoxmlName() : null; } StringBuilder sb = new StringBuilder(); boolean toLower = true; for (char ch : name().toCharArray()) { if (ch == '_') { toLower = false; continue; } sb.append(toLower ? StringUtil.toLowerCase(ch) : StringUtil.toUpperCase(ch)); toLower = true; } return sb.toString(); }
public static ShapeType forId(int id, boolean isOoxmlId){ // exemption for #60294 if (!isOoxmlId && id == 0x0FFF) { return NOT_PRIMITIVE; } for(ShapeType t : values()){ if((isOoxmlId && t.ooxmlId == id) || (!isOoxmlId && t.nativeId == id)) return t; } throw new IllegalArgumentException("Unknown shape type: " + id); } }
@Override public CustomGeometry getGeometry() { PresetGeometries dict = PresetGeometries.getInstance(); ShapeType st = getShapeType(); String name = (st != null) ? st.getOoxmlName() : null; CustomGeometry geom = dict.get(name); if (geom == null) { if (name == null) { name = (st != null) ? st.toString() : "<unknown>"; } LOG.log(POILogger.WARN, "No preset shape definition for shapeType: "+name); } return geom; }
/** name of the presetShapeDefinit(i)on entry */ public String getOoxmlName() { if (this == SEAL) return STAR_16.getOoxmlName(); if (ooxmlId == -1) { return (name().startsWith("TEXT")) ? RECT.getOoxmlName() : null; } StringBuilder sb = new StringBuilder(); boolean toLower = true; for (char ch : name().toCharArray()) { if (ch == '_') { toLower = false; continue; } sb.append(toLower ? StringUtil.toLowerCase(ch) : StringUtil.toUpperCase(ch)); toLower = true; } return sb.toString(); }
public static ShapeType forId(int id, boolean isOoxmlId){ // exemption for #60294 if (!isOoxmlId && id == 0x0FFF) { return NOT_PRIMITIVE; } for(ShapeType t : values()){ if((isOoxmlId && t.ooxmlId == id) || (!isOoxmlId && t.nativeId == id)) return t; } throw new IllegalArgumentException("Unknown shape type: " + id); } }
/** * Return type of the shape. * In most cases shape group type is {@link org.apache.poi.sl.usermodel.ShapeType#NOT_PRIMITIVE} * * @return type of the shape. */ @Override public ShapeType getShapeType(){ EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID); int nativeId = spRecord.getOptions() >> 4; return ShapeType.forId(nativeId, false); }
public ShapeType getShapeType(){ EscherSpRecord spRecord = getEscherChild(EscherSpRecord.RECORD_ID); return ShapeType.forId(spRecord.getShapeType(), false); }
@Override public ShapeType getShapeType(){ XSLFGeometryProperties gp = XSLFPropertiesDelegate.getGeometryDelegate(getShapeProperties()); if (gp != null && gp.isSetPrstGeom()) { STShapeType.Enum geom = gp.getPrstGeom().getPrst(); if (geom != null) { return ShapeType.forId(geom.intValue(), true); } } return null; }
EscherSpRecord spRecord = spContainer.getChildById(EscherSpRecord.RECORD_ID); ShapeType type = ShapeType.forId(spRecord.getShapeType(), false); switch (type){ case TEXT_BOX: