Search in sources :

Example 1 with EscherSplitMenuColorsRecord

use of org.apache.poi.ddf.EscherSplitMenuColorsRecord 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);
        }
    }
}
Also used : EscherSplitMenuColorsRecord(org.apache.poi.ddf.EscherSplitMenuColorsRecord) DrawingGroupRecord(org.apache.poi.hssf.record.DrawingGroupRecord) EscherBoolProperty(org.apache.poi.ddf.EscherBoolProperty) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) EscherOptRecord(org.apache.poi.ddf.EscherOptRecord) EscherRGBProperty(org.apache.poi.ddf.EscherRGBProperty)

Aggregations

EscherBoolProperty (org.apache.poi.ddf.EscherBoolProperty)1 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)1 EscherOptRecord (org.apache.poi.ddf.EscherOptRecord)1 EscherRGBProperty (org.apache.poi.ddf.EscherRGBProperty)1 EscherRecord (org.apache.poi.ddf.EscherRecord)1 EscherSplitMenuColorsRecord (org.apache.poi.ddf.EscherSplitMenuColorsRecord)1 DrawingGroupRecord (org.apache.poi.hssf.record.DrawingGroupRecord)1