Search in sources :

Example 1 with EscherSpRecord

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);
}
Also used : CommonObjectDataSubRecord(org.apache.poi.hssf.record.CommonObjectDataSubRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord)

Example 2 with EscherSpRecord

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));
}
Also used : CommonObjectDataSubRecord(org.apache.poi.hssf.record.CommonObjectDataSubRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord)

Example 3 with EscherSpRecord

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);
}
Also used : EscherSpgrRecord(org.apache.poi.ddf.EscherSpgrRecord) EscherBoolProperty(org.apache.poi.ddf.EscherBoolProperty) EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherDgRecord(org.apache.poi.ddf.EscherDgRecord) EscherOptRecord(org.apache.poi.ddf.EscherOptRecord) EscherRGBProperty(org.apache.poi.ddf.EscherRGBProperty)

Example 4 with EscherSpRecord

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;
}
Also used : ExObjRefAtom(org.apache.poi.hslf.record.ExObjRefAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord)

Example 5 with EscherSpRecord

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);
}
Also used : ExObjRefAtom(org.apache.poi.hslf.record.ExObjRefAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord)

Aggregations

EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)31 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)17 EscherClientAnchorRecord (org.apache.poi.ddf.EscherClientAnchorRecord)5 EscherDgRecord (org.apache.poi.ddf.EscherDgRecord)5 EscherOptRecord (org.apache.poi.ddf.EscherOptRecord)5 CommonObjectDataSubRecord (org.apache.poi.hssf.record.CommonObjectDataSubRecord)5 AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)4 EscherChildAnchorRecord (org.apache.poi.ddf.EscherChildAnchorRecord)4 EscherRecord (org.apache.poi.ddf.EscherRecord)4 EscherTextboxRecord (org.apache.poi.ddf.EscherTextboxRecord)4 Test (org.junit.Test)4 EscherSimpleProperty (org.apache.poi.ddf.EscherSimpleProperty)3 EscherSpgrRecord (org.apache.poi.ddf.EscherSpgrRecord)3 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)3 EscherBoolProperty (org.apache.poi.ddf.EscherBoolProperty)2 EscherClientDataRecord (org.apache.poi.ddf.EscherClientDataRecord)2 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)2 EscherRGBProperty (org.apache.poi.ddf.EscherRGBProperty)2 ExObjRefAtom (org.apache.poi.hslf.record.ExObjRefAtom)2 Record (org.apache.poi.hslf.record.Record)2