Esempio n. 1
0
        /**
         * Interface method to remove a drawing from the group
         *
         * @param d the drawing to remove
         */
        public void remove(DrawingGroupObject d)
        {
            // Unless there are real images or some such, it is possible that
            // a BStoreContainer will not be present.  In that case simply return
            if (getBStoreContainer() == null)
            {
                return;
            }

            if (origin == Origin.READ)
            {
                origin   = Origin.READ_WRITE;
                numBlips = getBStoreContainer().getNumBlips();
                Dgg dgg = (Dgg)escherData.getChildren()[0];
                drawingGroupId = dgg.getCluster(1).drawingGroupId - numBlips - 1;
            }

            // Get the blip
            EscherRecord[] children = getBStoreContainer().getChildren();
            BlipStoreEntry bse      = (BlipStoreEntry)children[d.getBlipId() - 1];

            bse.dereference();

            if (bse.getReferenceCount() == 0)
            {
                // Remove the blip
                getBStoreContainer().remove(bse);

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

                numBlips--;
            }
        }