use of org.apache.poi.ddf.EscherSpgrRecord 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.EscherSpgrRecord in project poi by apache.
the class HSLFGroupShape method createSpContainer.
/**
* Create a new ShapeGroup and create an instance of <code>EscherSpgrContainer</code> which represents a group of shapes
*/
@Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
EscherContainerRecord ecr = super.createSpContainer(isChild);
ecr.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
//The group itself is a shape, and always appears as the first EscherSpContainer in the group container.
EscherContainerRecord spcont = new EscherContainerRecord();
spcont.setRecordId(EscherContainerRecord.SP_CONTAINER);
spcont.setOptions((short) 15);
EscherSpgrRecord spg = new EscherSpgrRecord();
spg.setOptions((short) 1);
spcont.addChildRecord(spg);
EscherSpRecord sp = new EscherSpRecord();
short type = (short) ((ShapeType.NOT_PRIMITIVE.nativeId << 4) + 2);
sp.setOptions(type);
sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_GROUP);
spcont.addChildRecord(sp);
EscherClientAnchorRecord anchor = new EscherClientAnchorRecord();
spcont.addChildRecord(anchor);
ecr.addChildRecord(spcont);
return ecr;
}
use of org.apache.poi.ddf.EscherSpgrRecord in project poi by apache.
the class HSLFGroupShape method setInteriorAnchor.
@Override
public void setInteriorAnchor(Rectangle2D anchor) {
EscherSpgrRecord spgr = getEscherChild(EscherSpgrRecord.RECORD_ID);
int x1 = Units.pointsToMaster(anchor.getX());
int y1 = Units.pointsToMaster(anchor.getY());
int x2 = Units.pointsToMaster(anchor.getX() + anchor.getWidth());
int y2 = Units.pointsToMaster(anchor.getY() + anchor.getHeight());
spgr.setRectX1(x1);
spgr.setRectY1(y1);
spgr.setRectX2(x2);
spgr.setRectY2(y2);
}
use of org.apache.poi.ddf.EscherSpgrRecord in project poi by apache.
the class EscherAggregate method buildBaseTree.
/**
* create base tree with such structure:
* EscherDgContainer
* -EscherSpgrContainer
* --EscherSpContainer
* ---EscherSpRecord
* ---EscherSpgrRecord
* ---EscherSpRecord
* -EscherDgRecord
*
* id of DgRecord and SpRecord are empty and must be set later by HSSFPatriarch
*/
private void buildBaseTree() {
EscherContainerRecord dgContainer = new EscherContainerRecord();
EscherContainerRecord spgrContainer = new EscherContainerRecord();
EscherContainerRecord spContainer1 = new EscherContainerRecord();
EscherSpgrRecord spgr = new EscherSpgrRecord();
EscherSpRecord sp1 = new EscherSpRecord();
dgContainer.setRecordId(EscherContainerRecord.DG_CONTAINER);
dgContainer.setOptions((short) 0x000F);
EscherDgRecord dg = new EscherDgRecord();
dg.setRecordId(EscherDgRecord.RECORD_ID);
short dgId = 1;
dg.setOptions((short) (dgId << 4));
dg.setNumShapes(0);
dg.setLastMSOSPID(1024);
spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
spgrContainer.setOptions((short) 0x000F);
spContainer1.setRecordId(EscherContainerRecord.SP_CONTAINER);
spContainer1.setOptions((short) 0x000F);
spgr.setRecordId(EscherSpgrRecord.RECORD_ID);
// version
spgr.setOptions((short) 0x0001);
spgr.setRectX1(0);
spgr.setRectY1(0);
spgr.setRectX2(1023);
spgr.setRectY2(255);
sp1.setRecordId(EscherSpRecord.RECORD_ID);
sp1.setOptions((short) 0x0002);
sp1.setVersion((short) 0x2);
sp1.setShapeId(-1);
sp1.setFlags(EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_PATRIARCH);
dgContainer.addChildRecord(dg);
dgContainer.addChildRecord(spgrContainer);
spgrContainer.addChildRecord(spContainer1);
spContainer1.addChildRecord(spgr);
spContainer1.addChildRecord(sp1);
addEscherRecord(dgContainer);
}
use of org.apache.poi.ddf.EscherSpgrRecord in project poi by apache.
the class HSLFGroupShape method getInteriorAnchor.
@Override
public Rectangle2D getInteriorAnchor() {
EscherSpgrRecord rec = getEscherChild(EscherSpgrRecord.RECORD_ID);
double x1 = Units.masterToPoints(rec.getRectX1());
double y1 = Units.masterToPoints(rec.getRectY1());
double x2 = Units.masterToPoints(rec.getRectX2());
double y2 = Units.masterToPoints(rec.getRectY2());
return new Rectangle2D.Double(x1, y1, x2 - x1, y2 - y1);
}
Aggregations