예제 #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;
        }