Пример #1
0
  /**
   * Create a new ShapeGroup and create an instance of <code>EscherSpgrContainer</code> which
   * represents a group of shapes
   */
  protected EscherContainerRecord createSpContainer(boolean isChild) {
    EscherContainerRecord spgr = new EscherContainerRecord();
    spgr.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
    spgr.setOptions((short) 15);

    // 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 = (ShapeTypes.NotPrimitive << 4) + 2;
    sp.setOptions(type);
    sp.setFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_GROUP);
    spcont.addChildRecord(sp);

    EscherClientAnchorRecord anchor = new EscherClientAnchorRecord();
    spcont.addChildRecord(anchor);

    spgr.addChildRecord(spcont);
    return spgr;
  }