use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFSimpleShape method getLineCompound.
/**
* Gets the line compound style
*
* @return the compound style of the line.
*/
public LineCompound getLineCompound() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTYLE);
return (prop == null) ? LineCompound.SINGLE : LineCompound.fromNativeId(prop.getPropertyValue());
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFSimpleShape method createSpContainer.
/**
* Create a new Shape
*
* @param isChild <code>true</code> if the Line is inside a group, <code>false</code> otherwise
* @return the record container which holds this shape
*/
@Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(isChild);
ecr.setRecordId(EscherContainerRecord.SP_CONTAINER);
EscherSpRecord sp = new EscherSpRecord();
int flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
if (isChild) {
flags |= EscherSpRecord.FLAG_CHILD;
}
sp.setFlags(flags);
ecr.addChildRecord(sp);
AbstractEscherOptRecord opt = new EscherOptRecord();
opt.setRecordId(EscherOptRecord.RECORD_ID);
ecr.addChildRecord(opt);
EscherRecord anchor;
if (isChild) {
anchor = new EscherChildAnchorRecord();
} else {
anchor = new EscherClientAnchorRecord();
//hack. internal variable EscherClientAnchorRecord.shortRecord can be
//initialized only in fillFields(). We need to set shortRecord=false;
byte[] header = new byte[16];
LittleEndian.putUShort(header, 0, 0);
LittleEndian.putUShort(header, 2, 0);
LittleEndian.putInt(header, 4, 8);
anchor.fillFields(header, 0, null);
}
ecr.addChildRecord(anchor);
return ecr;
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFSimpleShape method getLineColor.
/**
* @return color of the line. If color is not set returns {@code null}
*/
public Color getLineColor() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = getEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
if (p != null && (p.getPropertyValue() & 0x8) == 0) {
return null;
}
Color clr = getColor(EscherProperties.LINESTYLE__COLOR, EscherProperties.LINESTYLE__OPACITY, -1);
return clr == null ? null : clr;
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFSimpleShape method getLineBackgroundColor.
/**
* @return background color of the line. If color is not set returns {@code null}
*/
public Color getLineBackgroundColor() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty p = getEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
if (p != null && (p.getPropertyValue() & 0x8) == 0) {
return null;
}
Color clr = getColor(EscherProperties.LINESTYLE__BACKCOLOR, EscherProperties.LINESTYLE__OPACITY, -1);
return clr == null ? null : clr;
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFSimpleShape method getShadowAngle.
public double getShadowAngle() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETX);
int offX = (prop == null) ? 0 : prop.getPropertyValue();
prop = getEscherProperty(opt, EscherProperties.SHADOWSTYLE__OFFSETY);
int offY = (prop == null) ? 0 : prop.getPropertyValue();
return Math.toDegrees(Math.atan2(offY, offX));
}
Aggregations