use of org.apache.poi.ddf.EscherRGBProperty in project poi by apache.
the class HSSFShape method setLineStyleColor.
@Override
public void setLineStyleColor(int red, int green, int blue) {
int lineStyleColor = ((blue) << 16) | ((green) << 8) | red;
setPropertyValue(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, lineStyleColor));
}
use of org.apache.poi.ddf.EscherRGBProperty in project poi by apache.
the class HSSFShape method setFillColor.
@Override
public void setFillColor(int red, int green, int blue) {
int fillColor = ((blue) << 16) | ((green) << 8) | red;
setPropertyValue(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, fillColor));
}
use of org.apache.poi.ddf.EscherRGBProperty 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.EscherRGBProperty in project poi by apache.
the class InternalWorkbook method createDrawingGroup.
/**
* Creates a primary drawing group record. If it already
* exists then it's modified.
*/
public void createDrawingGroup() {
if (drawingManager == null) {
EscherContainerRecord dggContainer = new EscherContainerRecord();
EscherDggRecord dgg = new EscherDggRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherSplitMenuColorsRecord splitMenuColors = new EscherSplitMenuColorsRecord();
dggContainer.setRecordId((short) 0xF000);
dggContainer.setOptions((short) 0x000F);
dgg.setRecordId(EscherDggRecord.RECORD_ID);
dgg.setOptions((short) 0x0000);
dgg.setShapeIdMax(1024);
dgg.setNumShapesSaved(0);
dgg.setDrawingsSaved(0);
dgg.setFileIdClusters(new EscherDggRecord.FileIdCluster[] {});
drawingManager = new DrawingManager2(dgg);
EscherContainerRecord bstoreContainer = null;
if (!escherBSERecords.isEmpty()) {
bstoreContainer = new EscherContainerRecord();
bstoreContainer.setRecordId(EscherContainerRecord.BSTORE_CONTAINER);
bstoreContainer.setOptions((short) ((escherBSERecords.size() << 4) | 0xF));
for (EscherRecord escherRecord : escherBSERecords) {
bstoreContainer.addChildRecord(escherRecord);
}
}
opt.setRecordId((short) 0xF00B);
opt.setOptions((short) 0x0033);
opt.addEscherProperty(new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296));
opt.addEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 0x08000041));
opt.addEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, 134217792));
splitMenuColors.setRecordId((short) 0xF11E);
splitMenuColors.setOptions((short) 0x0040);
splitMenuColors.setColor1(0x0800000D);
splitMenuColors.setColor2(0x0800000C);
splitMenuColors.setColor3(0x08000017);
splitMenuColors.setColor4(0x100000F7);
dggContainer.addChildRecord(dgg);
if (bstoreContainer != null) {
dggContainer.addChildRecord(bstoreContainer);
}
dggContainer.addChildRecord(opt);
dggContainer.addChildRecord(splitMenuColors);
int dgLoc = findFirstRecordLocBySid(DrawingGroupRecord.sid);
if (dgLoc == -1) {
DrawingGroupRecord drawingGroup = new DrawingGroupRecord();
drawingGroup.addEscherRecord(dggContainer);
int loc = findFirstRecordLocBySid(CountryRecord.sid);
getRecords().add(loc + 1, drawingGroup);
} else {
DrawingGroupRecord drawingGroup = new DrawingGroupRecord();
drawingGroup.addEscherRecord(dggContainer);
getRecords().set(dgLoc, drawingGroup);
}
}
}
use of org.apache.poi.ddf.EscherRGBProperty in project poi by apache.
the class HSSFSimpleShape method createSpContainer.
@Override
protected EscherContainerRecord createSpContainer() {
EscherContainerRecord spContainer = new EscherContainerRecord();
spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);
spContainer.setOptions((short) 0x000F);
EscherSpRecord sp = new EscherSpRecord();
sp.setRecordId(EscherSpRecord.RECORD_ID);
sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
sp.setVersion((short) 0x2);
EscherClientDataRecord clientData = new EscherClientDataRecord();
clientData.setRecordId(EscherClientDataRecord.RECORD_ID);
clientData.setOptions((short) (0x0000));
EscherOptRecord optRecord = new EscherOptRecord();
optRecord.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
optRecord.setEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
// optRecord.setEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
optRecord.setEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
optRecord.setEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
optRecord.setEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE));
optRecord.setEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
optRecord.setEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
optRecord.setEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
optRecord.setRecordId(EscherOptRecord.RECORD_ID);
EscherTextboxRecord escherTextbox = new EscherTextboxRecord();
escherTextbox.setRecordId(EscherTextboxRecord.RECORD_ID);
escherTextbox.setOptions((short) 0x0000);
spContainer.addChildRecord(sp);
spContainer.addChildRecord(optRecord);
spContainer.addChildRecord(getAnchor().getEscherAnchor());
spContainer.addChildRecord(clientData);
spContainer.addChildRecord(escherTextbox);
return spContainer;
}
Aggregations