예제 #1
0
        /// <summary> Interface method to remove a drawing from the group
        ///
        /// </summary>
        /// <param name="d">the drawing to remove
        /// </param>
        public virtual void  remove(Drawing d)
        {
            if (origin == READ)
            {
                origin   = READ_WRITE;
                numBlips = BStoreContainer.NumBlips;
                Dgg dgg = (Dgg)escherData.Children[0];
                drawingGroupId = dgg.getCluster(1).drawingGroupId - numBlips - 1;
            }

            // Get the blip
            EscherRecord[] children = BStoreContainer.Children;
            BlipStoreEntry bse      = (BlipStoreEntry)children[d.BlipId - 1];

            bse.dereference();

            if (bse.ReferenceCount == 0)
            {
                // Remove the blip
                BStoreContainer.remove(bse);

                // Adjust blipId on the other blips
                foreach (Drawing drawing in drawings)
                {
                    if (drawing.BlipId > d.BlipId)
                    {
                        drawing.setObjectId(drawing.getObjectId(), drawing.BlipId - 1);
                    }
                }


                numBlips--;
            }
        }
예제 #2
0
        private void  initialize()
        {
            int curpos = Pos + HEADER_LENGTH;
            int endpos = Pos + Length;

            EscherRecord newRecord = null;

            while (curpos < endpos)
            {
                EscherRecordData erd = new EscherRecordData(EscherStream, curpos);

                EscherRecordType type = erd.Type;
                if (type == EscherRecordType.DGG)
                {
                    newRecord = new Dgg(erd);
                }
                else if (type == EscherRecordType.DG)
                {
                    newRecord = new Dg(erd);
                }
                else if (type == EscherRecordType.BSTORE_CONTAINER)
                {
                    newRecord = new BStoreContainer(erd);
                }
                else if (type == EscherRecordType.SPGR_CONTAINER)
                {
                    newRecord = new SpgrContainer(erd);
                }
                else if (type == EscherRecordType.SP_CONTAINER)
                {
                    newRecord = new SpContainer(erd);
                }
                else if (type == EscherRecordType.SPGR)
                {
                    newRecord = new Spgr(erd);
                }
                else if (type == EscherRecordType.SP)
                {
                    newRecord = new Sp(erd);
                }
                else if (type == EscherRecordType.CLIENT_ANCHOR)
                {
                    newRecord = new ClientAnchor(erd);
                }
                else if (type == EscherRecordType.CLIENT_DATA)
                {
                    newRecord = new ClientData(erd);
                }
                else if (type == EscherRecordType.BSE)
                {
                    newRecord = new BlipStoreEntry(erd);
                }
                else if (type == EscherRecordType.OPT)
                {
                    newRecord = new Opt(erd);
                }
                else if (type == EscherRecordType.SPLIT_MENU_COLORS)
                {
                    newRecord = new SplitMenuColors(erd);
                }
                else
                {
                    newRecord = new EscherAtom(erd);
                }

                children.Add(newRecord);
                curpos += newRecord.Length;
            }

            initialized = true;
        }