use of org.apache.poi.sl.draw.geom.Guide in project poi by apache.
the class HSLFSimpleShape method getAdjustValue.
@Override
public Guide getAdjustValue(String name) {
if (name == null || !name.matches("adj([1-9]|10)?")) {
LOG.log(POILogger.INFO, "Adjust value '" + name + "' not supported. Using default value.");
return null;
}
name = name.replace("adj", "");
if ("".equals(name)) {
name = "1";
}
short escherProp;
switch(Integer.parseInt(name)) {
case 1:
escherProp = EscherProperties.GEOMETRY__ADJUSTVALUE;
break;
case 2:
escherProp = EscherProperties.GEOMETRY__ADJUST2VALUE;
break;
case 3:
escherProp = EscherProperties.GEOMETRY__ADJUST3VALUE;
break;
case 4:
escherProp = EscherProperties.GEOMETRY__ADJUST4VALUE;
break;
case 5:
escherProp = EscherProperties.GEOMETRY__ADJUST5VALUE;
break;
case 6:
escherProp = EscherProperties.GEOMETRY__ADJUST6VALUE;
break;
case 7:
escherProp = EscherProperties.GEOMETRY__ADJUST7VALUE;
break;
case 8:
escherProp = EscherProperties.GEOMETRY__ADJUST8VALUE;
break;
case 9:
escherProp = EscherProperties.GEOMETRY__ADJUST9VALUE;
break;
case 10:
escherProp = EscherProperties.GEOMETRY__ADJUST10VALUE;
break;
default:
throw new HSLFException();
}
// TODO: the adjust values need to be corrected somehow depending on the shape width/height
// see https://social.msdn.microsoft.com/Forums/en-US/3f69ebb3-62a0-4fdd-b367-64790dfb2491/presetshapedefinitionsxml-does-not-specify-width-and-height-form-some-autoshapes?forum=os_binaryfile
// the adjust value can be format dependent, e.g. hexagon has different values,
// other shape types have the same adjust values in OOXML and native
int adjval = getEscherProperty(escherProp, -1);
return (adjval == -1) ? null : new Guide(name, "val " + adjval);
}
Aggregations