use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFSheet method getBackground.
/**
* Returns the background shape for this sheet.
*
* @return the background shape for this sheet.
*/
@Override
public HSLFBackground getBackground() {
if (_background == null) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = ppdrawing.getDgContainer();
EscherContainerRecord spContainer = dg.getChildById(EscherContainerRecord.SP_CONTAINER);
_background = new HSLFBackground(spContainer, null);
_background.setSheet(this);
}
return _background;
}
use of org.apache.poi.ddf.EscherContainerRecord 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.EscherContainerRecord in project poi by apache.
the class HSLFAutoShape method createSpContainer.
protected EscherContainerRecord createSpContainer(ShapeType shapeType, boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(isChild);
setShapeType(shapeType);
//set default properties for an autoshape
setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x40000);
setEscherProperty(EscherProperties.FILL__FILLCOLOR, 0x8000004);
setEscherProperty(EscherProperties.FILL__FILLCOLOR, 0x8000004);
setEscherProperty(EscherProperties.FILL__FILLBACKCOLOR, 0x8000000);
setEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x100010);
setEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
setEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);
setEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
return ecr;
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFLine method createSpContainer.
@Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(isChild);
setShapeType(ShapeType.LINE);
EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
short type = (short) ((ShapeType.LINE.nativeId << 4) | 0x2);
spRecord.setOptions(type);
//set default properties for a line
AbstractEscherOptRecord opt = getEscherOptRecord();
//default line properties
setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4);
setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK, 0x10000);
setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x100000);
setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, 0x8000001);
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0xA0008);
setEscherProperty(opt, EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
return ecr;
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFPictureShape method createSpContainer.
/**
* Create a new Picture and populate the inital structure of the <code>EscherSp</code> record which holds information about this picture.
* @param idx the index of the picture which refers to <code>EscherBSE</code> container.
* @return the create Picture object
*/
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(isChild);
EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setOptions((short) ((ShapeType.FRAME.nativeId << 4) | 0x2));
//set default properties for a picture
AbstractEscherOptRecord opt = getEscherOptRecord();
setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x800080);
//another weird feature of powerpoint: for picture id we must add 0x4000.
setEscherProperty(opt, (short) (EscherProperties.BLIP__BLIPTODISPLAY + 0x4000), idx);
return ecr;
}
Aggregations