Ejemplo n.º 1
0
        /**
         * Create a new Shape
         *
         * @param isChild   <code>true</code> if the Line is inside a group, <code>false</code> otherwise
         * @return the record Container which holds this shape
         */
        protected EscherContainerRecord CreateSpContainer(bool IsChild)
        {
            _escherContainer = new EscherContainerRecord();
            _escherContainer.SetRecordId(EscherContainerRecord.SP_CONTAINER);
            _escherContainer.SetOptions((short)15);

            EscherSpRecord sp    = new EscherSpRecord();
            int            flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;

            if (isChild)
            {
                flags |= EscherSpRecord.FLAG_CHILD;
            }
            sp.SetFlags(flags);
            _escherContainer.AddChildRecord(sp);

            EscherOptRecord opt = new EscherOptRecord();

            opt.SetRecordId(EscherOptRecord.RECORD_ID);
            _escherContainer.AddChildRecord(opt);

            EscherRecord anchor;

            if (isChild)
            {
                anchor = new EscherChildAnchorRecord();
            }
            else
            {
                anchor = new EscherClientAnchorRecord();

                //hack. internal variable EscherClientAnchorRecord.shortRecord can be
                //Initialized only in FillFields(). We need to Set shortRecord=false;
                byte[] header = new byte[16];
                LittleEndian.PutUshort(header, 0, 0);
                LittleEndian.PutUshort(header, 2, 0);
                LittleEndian.PutInt(header, 4, 8);
                anchor.FillFields(header, 0, null);
            }
            _escherContainer.AddChildRecord(anchor);

            return(_escherContainer);
        }
Ejemplo n.º 2
0
    /**
     * Create a new ShapeGroup and create an instance of <code>EscherSpgrContainer</code> which represents a group of shapes
     */
    protected EscherContainerRecord CreateSpContainer(bool 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;
    }