use of org.apache.poi.ddf.EscherSpRecord in project poi by apache.
the class HSSFSimpleShape method setShapeType.
/**
* @see HSSFShapeTypes
* @param value - shapeType
*/
public void setShapeType(int value) {
CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) getObjRecord().getSubRecords().get(0);
cod.setObjectType(OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING);
EscherSpRecord spRecord = getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
spRecord.setShapeType((short) value);
}
use of org.apache.poi.ddf.EscherSpRecord in project poi by apache.
the class HSSFShape method setShapeId.
/**
* @param shapeId - global shapeId which must be set to EscherSpRecord
*/
void setShapeId(int shapeId) {
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setShapeId(shapeId);
CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) _objRecord.getSubRecords().get(0);
cod.setObjectId((short) (shapeId % 1024));
}
use of org.apache.poi.ddf.EscherSpRecord in project poi by apache.
the class PPDrawing method create.
/**
* Create the Escher records associated with a new PPDrawing
*/
private void create() {
EscherContainerRecord dgContainer = new EscherContainerRecord();
dgContainer.setRecordId(EscherContainerRecord.DG_CONTAINER);
dgContainer.setOptions((short) 15);
dg = new EscherDgRecord();
dg.setOptions((short) 16);
dg.setNumShapes(1);
dgContainer.addChildRecord(dg);
EscherContainerRecord spgrContainer = new EscherContainerRecord();
spgrContainer.setOptions((short) 15);
spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
EscherContainerRecord spContainer = new EscherContainerRecord();
spContainer.setOptions((short) 15);
spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);
EscherSpgrRecord spgr = new EscherSpgrRecord();
spgr.setOptions((short) 1);
spContainer.addChildRecord(spgr);
EscherSpRecord sp = new EscherSpRecord();
sp.setOptions((short) ((ShapeType.NOT_PRIMITIVE.nativeId << 4) + 2));
sp.setFlags(EscherSpRecord.FLAG_PATRIARCH | EscherSpRecord.FLAG_GROUP);
spContainer.addChildRecord(sp);
spgrContainer.addChildRecord(spContainer);
dgContainer.addChildRecord(spgrContainer);
spContainer = new EscherContainerRecord();
spContainer.setOptions((short) 15);
spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);
sp = new EscherSpRecord();
sp.setOptions((short) ((ShapeType.RECT.nativeId << 4) + 2));
sp.setFlags(EscherSpRecord.FLAG_BACKGROUND | EscherSpRecord.FLAG_HASSHAPETYPE);
spContainer.addChildRecord(sp);
EscherOptRecord opt = new EscherOptRecord();
opt.setRecordId(EscherOptRecord.RECORD_ID);
opt.addEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 134217728));
opt.addEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLBACKCOLOR, 134217733));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.FILL__RECTRIGHT, 10064750));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.FILL__RECTBOTTOM, 7778750));
opt.addEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 1179666));
opt.addEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 524288));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.SHAPE__BLACKANDWHITESETTINGS, 9));
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.SHAPE__BACKGROUNDSHAPE, 65537));
spContainer.addChildRecord(opt);
dgContainer.addChildRecord(spContainer);
childRecords.add(dgContainer);
}
use of org.apache.poi.ddf.EscherSpRecord in project poi by apache.
the class ActiveXShape method createSpContainer.
/**
* Create a new Placeholder and initialize internal structures
*
* @return the created <code>EscherContainerRecord</code> which holds shape data
*/
@Override
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(idx, isChild);
EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE);
setShapeType(ShapeType.HOST_CONTROL);
setEscherProperty(EscherProperties.BLIP__PICTUREID, idx);
setEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
setEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);
setEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, -1);
HSLFEscherClientDataRecord cldata = getClientData(true);
cldata.addChild(new ExObjRefAtom());
return ecr;
}
use of org.apache.poi.ddf.EscherSpRecord in project poi by apache.
the class OLEShape method setObjectID.
/**
* Set the unique identifier for the OLE object and
* register it in the necessary structures
*
* @param objectId the unique identifier for the OLE object
*/
public void setObjectID(int objectId) {
setEscherProperty(EscherProperties.BLIP__PICTUREID, objectId);
EscherContainerRecord ecr = getSpContainer();
EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setFlags(spRecord.getFlags() | EscherSpRecord.FLAG_OLESHAPE);
HSLFEscherClientDataRecord cldata = getClientData(true);
ExObjRefAtom uer = null;
for (Record r : cldata.getHSLFChildRecords()) {
if (r.getRecordType() == RecordTypes.ExObjRefAtom.typeID) {
uer = (ExObjRefAtom) r;
break;
}
}
if (uer == null) {
uer = new ExObjRefAtom();
cldata.addChild(uer);
}
uer.setExObjIdRef(objectId);
}
Aggregations