use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class TestShapes method lineWidth.
@Test
public void lineWidth() {
HSLFSimpleShape sh = new HSLFAutoShape(ShapeType.RT_TRIANGLE);
AbstractEscherOptRecord opt = sh.getEscherOptRecord();
EscherSimpleProperty prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNull(prop);
assertEquals(HSLFSimpleShape.DEFAULT_LINE_WIDTH, sh.getLineWidth(), 0);
sh.setLineWidth(1.0);
prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNotNull(prop);
assertEquals(1.0, sh.getLineWidth(), 0);
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFPictureShape method getPictureName.
/**
* Name of this picture.
*
* @return name of this picture
*/
public String getPictureName() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherComplexProperty prop = getEscherProperty(opt, EscherProperties.BLIP__BLIPFILENAME);
if (prop == null)
return null;
String name = StringUtil.getFromUnicodeLE(prop.getComplexData());
return name.trim();
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFPictureShape method getClipping.
@Override
public Insets getClipping() {
// The anchor specified by the escher properties is the displayed size,
// i.e. the size of the already clipped image
AbstractEscherOptRecord opt = getEscherOptRecord();
double top = getFractProp(opt, EscherProperties.BLIP__CROPFROMTOP);
double bottom = getFractProp(opt, EscherProperties.BLIP__CROPFROMBOTTOM);
double left = getFractProp(opt, EscherProperties.BLIP__CROPFROMLEFT);
double right = getFractProp(opt, EscherProperties.BLIP__CROPFROMRIGHT);
// if all crop values are zero (the default) then no crop rectangle is set, return null
return (top == 0 && bottom == 0 && left == 0 && right == 0) ? null : new Insets((int) (top * 100000), (int) (left * 100000), (int) (bottom * 100000), (int) (right * 100000));
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFPictureShape method getPictureIndex.
/**
* Returns index associated with this picture.
* Index starts with 1 and points to a EscherBSE record which
* holds information about this picture.
*
* @return the index to this picture (1 based).
*/
public int getPictureIndex() {
AbstractEscherOptRecord opt = getEscherOptRecord();
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.BLIP__BLIPTODISPLAY);
return prop == null ? 0 : prop.getPropertyValue();
}
use of org.apache.poi.ddf.AbstractEscherOptRecord in project poi by apache.
the class HSLFPictureShape method setPictureName.
/**
* Name of this picture.
*
* @param name of this picture
*/
public void setPictureName(String name) {
AbstractEscherOptRecord opt = getEscherOptRecord();
byte[] data = StringUtil.getToUnicodeLE(name + '