/* 145: */ /* 146: */ public void remove(DrawingGroupObject d) /* 147: */ { /* 148:304 */ if (getBStoreContainer() == null) { /* 149:306 */ return; /* 150: */ } /* 151:309 */ if (this.origin == Origin.READ) /* 152: */ { /* 153:311 */ this.origin = Origin.READ_WRITE; /* 154:312 */ this.numBlips = getBStoreContainer().getNumBlips(); /* 155:313 */ Dgg dgg = (Dgg) this.escherData.getChildren()[0]; /* 156:314 */ this.drawingGroupId = (dgg.getCluster(1).drawingGroupId - this.numBlips - 1); /* 157: */ } /* 158:318 */ EscherRecord[] children = getBStoreContainer().getChildren(); /* 159:319 */ BlipStoreEntry bse = (BlipStoreEntry) children[(d.getBlipId() - 1)]; /* 160: */ /* 161:321 */ bse.dereference(); /* 162:323 */ if (bse.getReferenceCount() == 0) /* 163: */ { /* 164:326 */ getBStoreContainer().remove(bse); /* 165:329 */ for (Iterator i = this.drawings.iterator(); i.hasNext(); ) /* 166: */ { /* 167:331 */ DrawingGroupObject drawing = (DrawingGroupObject) i.next(); /* 168:333 */ if (drawing.getBlipId() > d.getBlipId()) { /* 169:335 */ drawing.setObjectId( drawing.getObjectId(), drawing.getBlipId() - 1, drawing.getShapeId()); /* 170: */ } /* 171: */ } /* 172:341 */ this.numBlips -= 1; /* 173: */ } /* 174: */ }
/* 99: */ /* 100: */ public void add(DrawingGroupObject d) /* 101: */ { /* 102:233 */ if (this.origin == Origin.READ) /* 103: */ { /* 104:235 */ this.origin = Origin.READ_WRITE; /* 105:236 */ BStoreContainer bsc = getBStoreContainer(); /* 106:237 */ Dgg dgg = (Dgg) this.escherData.getChildren()[0]; /* 107:238 */ this.drawingGroupId = (dgg.getCluster(1).drawingGroupId - this.numBlips - 1); /* 108:239 */ this.numBlips = (bsc != null ? bsc.getNumBlips() : 0); /* 109:241 */ if (bsc != null) { /* 110:243 */ Assert.verify(this.numBlips == bsc.getNumBlips()); /* 111: */ } /* 112: */ } /* 113:247 */ if (!(d instanceof Drawing)) /* 114: */ { /* 115:251 */ this.maxObjectId += 1; /* 116:252 */ this.maxShapeId += 1; /* 117:253 */ d.setDrawingGroup(this); /* 118:254 */ d.setObjectId(this.maxObjectId, this.numBlips + 1, this.maxShapeId); /* 119:255 */ if (this.drawings.size() > this.maxObjectId) { /* 120:257 */ logger.warn( "drawings length " + this.drawings.size() + " exceeds the max object id " + this.maxObjectId); /* 121: */ } /* 122:261 */ return; /* 123: */ } /* 124:264 */ Drawing drawing = (Drawing) d; /* 125: */ /* 126: */ /* 127:267 */ Drawing refImage = (Drawing) this.imageFiles.get(d.getImageFilePath()); /* 128:270 */ if (refImage == null) /* 129: */ { /* 130:274 */ this.maxObjectId += 1; /* 131:275 */ this.maxShapeId += 1; /* 132:276 */ this.drawings.add(drawing); /* 133:277 */ drawing.setDrawingGroup(this); /* 134:278 */ drawing.setObjectId(this.maxObjectId, this.numBlips + 1, this.maxShapeId); /* 135:279 */ this.numBlips += 1; /* 136:280 */ this.imageFiles.put(drawing.getImageFilePath(), drawing); /* 137: */ } /* 138: */ else /* 139: */ { /* 140:287 */ refImage.setReferenceCount(refImage.getReferenceCount() + 1); /* 141:288 */ drawing.setDrawingGroup(this); /* 142:289 */ drawing.setObjectId( refImage.getObjectId(), refImage.getBlipId(), refImage.getShapeId()); /* 143: */ } /* 144: */ }
/* 87: */ /* 88: */ final void addDrawing(DrawingGroupObject d) /* 89: */ { /* 90:211 */ this.drawings.add(d); /* 91:212 */ this.maxObjectId = Math.max(this.maxObjectId, d.getObjectId()); /* 92:213 */ this.maxShapeId = Math.max(this.maxShapeId, d.getShapeId()); /* 93: */ }