use of org.apache.poi.ddf.EscherProperty in project poi by apache.
the class HSLFSimpleShape method getShadow.
@Override
public Shadow<HSLFShape, HSLFTextParagraph> getShadow() {
AbstractEscherOptRecord opt = getEscherOptRecord();
if (opt == null) {
return null;
}
EscherProperty shadowType = opt.lookup(EscherProperties.SHADOWSTYLE__TYPE);
if (shadowType == null) {
return null;
}
return new Shadow<HSLFShape, HSLFTextParagraph>() {
@Override
public SimpleShape<HSLFShape, HSLFTextParagraph> getShadowParent() {
return HSLFSimpleShape.this;
}
@Override
public double getDistance() {
return getShadowDistance();
}
@Override
public double getAngle() {
return getShadowAngle();
}
@Override
public double getBlur() {
// TODO Auto-generated method stub
return 0;
}
@Override
public SolidPaint getFillStyle() {
return DrawPaint.createSolidPaint(getShadowColor());
}
};
}
use of org.apache.poi.ddf.EscherProperty in project poi by apache.
the class HSLFShapeFactory method createNonPrimitive.
private static HSLFShape createNonPrimitive(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
AbstractEscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
if (prop != null) {
return new HSLFFreeformShape(spContainer, parent);
}
logger.log(POILogger.INFO, "Creating AutoShape for a NotPrimitive shape");
return new HSLFAutoShape(spContainer, parent);
}
use of org.apache.poi.ddf.EscherProperty in project poi by apache.
the class HSLFShapeFactory method createShapeGroup.
public static HSLFGroupShape createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
boolean isTable = false;
EscherContainerRecord ecr = (EscherContainerRecord) spContainer.getChild(0);
EscherRecord opt = HSLFShape.getEscherChild(ecr, RecordTypes.EscherUserDefined);
if (opt != null) {
EscherPropertyFactory f = new EscherPropertyFactory();
List<EscherProperty> props = f.createProperties(opt.serialize(), 8, opt.getInstance());
for (EscherProperty ep : props) {
if (ep.getPropertyNumber() == EscherProperties.GROUPSHAPE__TABLEPROPERTIES && ep instanceof EscherSimpleProperty && (((EscherSimpleProperty) ep).getPropertyValue() & 1) == 1) {
isTable = true;
break;
}
}
}
HSLFGroupShape group;
if (isTable) {
group = new HSLFTable(spContainer, parent);
} else {
group = new HSLFGroupShape(spContainer, parent);
}
return group;
}
use of org.apache.poi.ddf.EscherProperty in project poi by apache.
the class HSLFShape method setEscherProperty.
/**
* Set an escher property for this shape.
*
* @param opt The opt record to set the properties to.
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
* @param value value of the property. If value = -1 then the property is removed.
*/
public static void setEscherProperty(AbstractEscherOptRecord opt, short propId, int value) {
java.util.List<EscherProperty> props = opt.getEscherProperties();
for (Iterator<EscherProperty> iterator = props.iterator(); iterator.hasNext(); ) {
if (iterator.next().getPropertyNumber() == propId) {
iterator.remove();
break;
}
}
if (value != -1) {
opt.addEscherProperty(new EscherSimpleProperty(propId, value));
opt.sortProperties();
}
}
use of org.apache.poi.ddf.EscherProperty in project poi by apache.
the class HSSFShape method getShapeName.
/**
* @return the name of this shape
*/
public String getShapeName() {
EscherOptRecord eor = getOptRecord();
if (eor == null) {
return null;
}
EscherProperty ep = eor.lookup(EscherProperties.GROUPSHAPE__SHAPENAME);
if (ep instanceof EscherComplexProperty) {
return StringUtil.getFromUnicodeLE(((EscherComplexProperty) ep).getComplexData());
}
return null;
}
Aggregations