Search in sources :

Example 1 with CommonObjectDataSubRecord

use of org.apache.poi.hssf.record.CommonObjectDataSubRecord 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 CommonObjectDataSubRecord

use of org.apache.poi.hssf.record.CommonObjectDataSubRecord in project poi by apache.

the class HSSFSimpleShape method createObjRecord.

@Override
protected ObjRecord createObjRecord() {
    ObjRecord obj = new ObjRecord();
    CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
    c.setLocked(true);
    c.setPrintable(true);
    c.setAutofill(true);
    c.setAutoline(true);
    EndSubRecord e = new EndSubRecord();
    obj.addSubRecord(c);
    obj.addSubRecord(e);
    return obj;
}
Also used : CommonObjectDataSubRecord(org.apache.poi.hssf.record.CommonObjectDataSubRecord) EndSubRecord(org.apache.poi.hssf.record.EndSubRecord) ObjRecord(org.apache.poi.hssf.record.ObjRecord)

Example 3 with CommonObjectDataSubRecord

use of org.apache.poi.hssf.record.CommonObjectDataSubRecord 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 4 with CommonObjectDataSubRecord

use of org.apache.poi.hssf.record.CommonObjectDataSubRecord in project poi by apache.

the class TestBugs method test51332.

/**
     * Test generator of ids for the CommonObjectDataSubRecord record.
     */
@Test
public void test51332() {
    HSSFClientAnchor anchor = new HSSFClientAnchor();
    HSSFSimpleShape shape;
    CommonObjectDataSubRecord cmo;
    shape = new HSSFTextbox(null, anchor);
    shape.setShapeId(1025);
    cmo = (CommonObjectDataSubRecord) shape.getObjRecord().getSubRecords().get(0);
    assertEquals(1, cmo.getObjectId());
    shape = new HSSFPicture(null, anchor);
    shape.setShapeId(1026);
    cmo = (CommonObjectDataSubRecord) shape.getObjRecord().getSubRecords().get(0);
    assertEquals(2, cmo.getObjectId());
    shape = new HSSFComment(null, anchor);
    shape.setShapeId(1027);
    cmo = (CommonObjectDataSubRecord) shape.getObjRecord().getSubRecords().get(0);
    assertEquals(1027, cmo.getObjectId());
}
Also used : CommonObjectDataSubRecord(org.apache.poi.hssf.record.CommonObjectDataSubRecord) Test(org.junit.Test)

Example 5 with CommonObjectDataSubRecord

use of org.apache.poi.hssf.record.CommonObjectDataSubRecord in project poi by apache.

the class HSSFComment method setShapeId.

@Override
void setShapeId(int shapeId) {
    if (shapeId > 65535) {
        throw new IllegalArgumentException("Cannot add more than " + 65535 + " shapes");
    }
    super.setShapeId(shapeId);
    CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) getObjRecord().getSubRecords().get(0);
    cod.setObjectId(shapeId);
    _note.setShapeId(shapeId);
}
Also used : CommonObjectDataSubRecord(org.apache.poi.hssf.record.CommonObjectDataSubRecord)

Aggregations

CommonObjectDataSubRecord (org.apache.poi.hssf.record.CommonObjectDataSubRecord)12 ObjRecord (org.apache.poi.hssf.record.ObjRecord)6 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)5 Test (org.junit.Test)5 EndSubRecord (org.apache.poi.hssf.record.EndSubRecord)3 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)2 FileNotFoundException (java.io.FileNotFoundException)1 Map (java.util.Map)1 EscherClientDataRecord (org.apache.poi.ddf.EscherClientDataRecord)1 EscherOptRecord (org.apache.poi.ddf.EscherOptRecord)1 EscherProperty (org.apache.poi.ddf.EscherProperty)1 EscherRecord (org.apache.poi.ddf.EscherRecord)1 InternalSheet (org.apache.poi.hssf.model.InternalSheet)1 InternalWorkbook (org.apache.poi.hssf.model.InternalWorkbook)1 AutoFilterInfoRecord (org.apache.poi.hssf.record.AutoFilterInfoRecord)1 EmbeddedObjectRefSubRecord (org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord)1 FtCblsSubRecord (org.apache.poi.hssf.record.FtCblsSubRecord)1 FtCfSubRecord (org.apache.poi.hssf.record.FtCfSubRecord)1 FtPioGrbitSubRecord (org.apache.poi.hssf.record.FtPioGrbitSubRecord)1 LbsDataSubRecord (org.apache.poi.hssf.record.LbsDataSubRecord)1