/** * Constructor * * @param d the drawing * @exception IOException */ public BlipStoreEntry(Drawing d) throws IOException { super(EscherRecordType.BSE); type = BlipType.PNG; setVersion(2); setInstance(type.getValue()); byte[] imageData = d.getImageBytes(); imageDataLength = imageData.length; data = new byte[imageDataLength + IMAGE_DATA_OFFSET]; System.arraycopy(imageData, 0, data, IMAGE_DATA_OFFSET, imageDataLength); referenceCount = d.getReferenceCount(); write = true; }
/* 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: */ }