コード例 #1
0
ファイル: DrawingGroup.java プロジェクト: enenuki/phd
 /*  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:    */ }
コード例 #2
0
ファイル: DrawingGroup.java プロジェクト: enenuki/phd
 /* 209:    */
 /* 210:    */ public void write(File outputFile) /* 211:    */ throws IOException /* 212:    */ {
   /* 213:406 */ if (this.origin == Origin.WRITE)
   /* 214:    */ {
     /* 215:408 */ DggContainer dggContainer = new DggContainer();
     /* 216:    */
     /* 217:410 */ Dgg dgg = new Dgg(this.numBlips + this.numCharts + 1, this.numBlips);
     /* 218:    */
     /* 219:412 */ dgg.addCluster(1, 0);
     /* 220:413 */ dgg.addCluster(this.numBlips + 1, 0);
     /* 221:    */
     /* 222:415 */ dggContainer.add(dgg);
     /* 223:    */
     /* 224:417 */ int drawingsAdded = 0;
     /* 225:418 */ BStoreContainer bstoreCont = new BStoreContainer();
     /* 226:421 */ for (Iterator i = this.drawings.iterator(); i.hasNext(); )
     /* 227:    */ {
       /* 228:423 */ Object o = i.next();
       /* 229:424 */ if ((o instanceof Drawing))
       /* 230:    */ {
         /* 231:426 */ Drawing d = (Drawing) o;
         /* 232:427 */ BlipStoreEntry bse = new BlipStoreEntry(d);
         /* 233:    */
         /* 234:429 */ bstoreCont.add(bse);
         /* 235:430 */ drawingsAdded++;
         /* 236:    */ }
       /* 237:    */ }
     /* 238:433 */ if (drawingsAdded > 0)
     /* 239:    */ {
       /* 240:435 */ bstoreCont.setNumBlips(drawingsAdded);
       /* 241:436 */ dggContainer.add(bstoreCont);
       /* 242:    */ }
     /* 243:439 */ Opt opt = new Opt();
     /* 244:    */
     /* 245:441 */ dggContainer.add(opt);
     /* 246:    */
     /* 247:443 */ SplitMenuColors splitMenuColors = new SplitMenuColors();
     /* 248:444 */ dggContainer.add(splitMenuColors);
     /* 249:    */
     /* 250:446 */ this.drawingData = dggContainer.getData();
     /* 251:    */ }
   /* 252:448 */ else if (this.origin == Origin.READ_WRITE)
   /* 253:    */ {
     /* 254:450 */ DggContainer dggContainer = new DggContainer();
     /* 255:    */
     /* 256:452 */ Dgg dgg = new Dgg(this.numBlips + this.numCharts + 1, this.numBlips);
     /* 257:    */
     /* 258:454 */ dgg.addCluster(1, 0);
     /* 259:455 */ dgg.addCluster(this.drawingGroupId + this.numBlips + 1, 0);
     /* 260:    */
     /* 261:457 */ dggContainer.add(dgg);
     /* 262:    */
     /* 263:459 */ BStoreContainer bstoreCont = new BStoreContainer();
     /* 264:460 */ bstoreCont.setNumBlips(this.numBlips);
     /* 265:    */
     /* 266:    */
     /* 267:463 */ BStoreContainer readBStoreContainer = getBStoreContainer();
     /* 268:465 */ if (readBStoreContainer != null)
     /* 269:    */ {
       /* 270:467 */ EscherRecord[] children = readBStoreContainer.getChildren();
       /* 271:468 */ for (int i = 0; i < children.length; i++)
       /* 272:    */ {
         /* 273:470 */ BlipStoreEntry bse = (BlipStoreEntry) children[i];
         /* 274:471 */ bstoreCont.add(bse);
         /* 275:    */ }
       /* 276:    */ }
     /* 277:476 */ for (Iterator i = this.drawings.iterator(); i.hasNext(); )
     /* 278:    */ {
       /* 279:478 */ DrawingGroupObject dgo = (DrawingGroupObject) i.next();
       /* 280:479 */ if ((dgo instanceof Drawing))
       /* 281:    */ {
         /* 282:481 */ Drawing d = (Drawing) dgo;
         /* 283:482 */ if (d.getOrigin() == Origin.WRITE)
         /* 284:    */ {
           /* 285:484 */ BlipStoreEntry bse = new BlipStoreEntry(d);
           /* 286:485 */ bstoreCont.add(bse);
           /* 287:    */ }
         /* 288:    */ }
       /* 289:    */ }
     /* 290:490 */ dggContainer.add(bstoreCont);
     /* 291:    */
     /* 292:492 */ Opt opt = new Opt();
     /* 293:    */
     /* 294:494 */ opt.addProperty(191, false, false, 524296);
     /* 295:495 */ opt.addProperty(385, false, false, 134217737);
     /* 296:496 */ opt.addProperty(448, false, false, 134217792);
     /* 297:    */
     /* 298:498 */ dggContainer.add(opt);
     /* 299:    */
     /* 300:500 */ SplitMenuColors splitMenuColors = new SplitMenuColors();
     /* 301:501 */ dggContainer.add(splitMenuColors);
     /* 302:    */
     /* 303:503 */ this.drawingData = dggContainer.getData();
     /* 304:    */ }
   /* 305:506 */ MsoDrawingGroupRecord msodg = new MsoDrawingGroupRecord(this.drawingData);
   /* 306:507 */ outputFile.write(msodg);
   /* 307:    */ }