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);
}
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;
}
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));
}
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());
}
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);
}
Aggregations