1 2 17 18 19 package org.apache.poi.ddf; 20 21 import org.apache.poi.util.HexDump; 22 import org.apache.poi.util.HexRead; 23 import org.apache.poi.util.LittleEndian; 24 25 import java.io.ByteArrayInputStream ; 26 import java.io.IOException ; 27 import java.io.InputStream ; 28 import java.io.PrintStream ; 29 import java.util.zip.InflaterInputStream ; 30 31 36 public class EscherDump 37 { 38 39 public EscherDump() 40 { 41 } 42 43 53 public void dump( byte[] data, int offset, int size, PrintStream out ) throws IOException , LittleEndian.BufferUnderrunException 54 { 55 EscherRecordFactory recordFactory = new DefaultEscherRecordFactory(); 56 int pos = offset; 57 while ( pos < offset + size ) 58 { 59 EscherRecord r = recordFactory.createRecord(data, pos); 60 int bytesRead = r.fillFields(data, pos, recordFactory ); 61 System.out.println( r.toString() ); 62 pos += bytesRead; 63 } 64 } 65 66 73 public void dumpOld( long maxLength, InputStream in, PrintStream out ) throws IOException , LittleEndian.BufferUnderrunException 74 { 75 long remainingBytes = maxLength; 76 short options; short recordId; 78 int recordBytesRemaining; StringBuffer stringBuf = new StringBuffer (); 80 short nDumpSize; 81 String recordName; 82 83 boolean atEOF = false; 84 85 while ( !atEOF && ( remainingBytes > 0 ) ) 86 { 87 stringBuf = new StringBuffer (); 88 options = LittleEndian.readShort( in ); 89 recordId = LittleEndian.readShort( in ); 90 recordBytesRemaining = LittleEndian.readInt( in ); 91 92 remainingBytes -= 2 + 2 + 4; 93 94 switch ( recordId ) 95 { 96 case (short) 0xF000: 97 recordName = "MsofbtDggContainer"; 98 break; 99 case (short) 0xF006: 100 recordName = "MsofbtDgg"; 101 break; 102 case (short) 0xF016: 103 recordName = "MsofbtCLSID"; 104 break; 105 case (short) 0xF00B: 106 recordName = "MsofbtOPT"; 107 break; 108 case (short) 0xF11A: 109 recordName = "MsofbtColorMRU"; 110 break; 111 case (short) 0xF11E: 112 recordName = "MsofbtSplitMenuColors"; 113 break; 114 case (short) 0xF001: 115 recordName = "MsofbtBstoreContainer"; 116 break; 117 case (short) 0xF007: 118 recordName = "MsofbtBSE"; 119 break; 120 case (short) 0xF002: 121 recordName = "MsofbtDgContainer"; 122 break; 123 case (short) 0xF008: 124 recordName = "MsofbtDg"; 125 break; 126 case (short) 0xF118: 127 recordName = "MsofbtRegroupItem"; 128 break; 129 case (short) 0xF120: 130 recordName = "MsofbtColorScheme"; 131 break; 132 case (short) 0xF003: 133 recordName = "MsofbtSpgrContainer"; 134 break; 135 case (short) 0xF004: 136 recordName = "MsofbtSpContainer"; 137 break; 138 case (short) 0xF009: 139 recordName = "MsofbtSpgr"; 140 break; 141 case (short) 0xF00A: 142 recordName = "MsofbtSp"; 143 break; 144 case (short) 0xF00C: 145 recordName = "MsofbtTextbox"; 146 break; 147 case (short) 0xF00D: 148 recordName = "MsofbtClientTextbox"; 149 break; 150 case (short) 0xF00E: 151 recordName = "MsofbtAnchor"; 152 break; 153 case (short) 0xF00F: 154 recordName = "MsofbtChildAnchor"; 155 break; 156 case (short) 0xF010: 157 recordName = "MsofbtClientAnchor"; 158 break; 159 case (short) 0xF011: 160 recordName = "MsofbtClientData"; 161 break; 162 case (short) 0xF11F: 163 recordName = "MsofbtOleObject"; 164 break; 165 case (short) 0xF11D: 166 recordName = "MsofbtDeletedPspl"; 167 break; 168 case (short) 0xF005: 169 recordName = "MsofbtSolverContainer"; 170 break; 171 case (short) 0xF012: 172 recordName = "MsofbtConnectorRule"; 173 break; 174 case (short) 0xF013: 175 recordName = "MsofbtAlignRule"; 176 break; 177 case (short) 0xF014: 178 recordName = "MsofbtArcRule"; 179 break; 180 case (short) 0xF015: 181 recordName = "MsofbtClientRule"; 182 break; 183 case (short) 0xF017: 184 recordName = "MsofbtCalloutRule"; 185 break; 186 case (short) 0xF119: 187 recordName = "MsofbtSelection"; 188 break; 189 case (short) 0xF122: 190 recordName = "MsofbtUDefProp"; 191 break; 192 default: 193 if ( recordId >= (short) 0xF018 && recordId <= (short) 0xF117 ) 194 recordName = "MsofbtBLIP"; 195 else if ( ( options & (short) 0x000F ) == (short) 0x000F ) 196 recordName = "UNKNOWN container"; 197 else 198 recordName = "UNKNOWN ID"; 199 } 200 201 stringBuf.append( " " ); 202 stringBuf.append( HexDump.toHex( recordId ) ); 203 stringBuf.append( " " ).append( recordName ).append( " [" ); 204 stringBuf.append( HexDump.toHex( options ) ); 205 stringBuf.append( ',' ); 206 stringBuf.append( HexDump.toHex( recordBytesRemaining ) ); 207 stringBuf.append( "] instance: " ); 208 stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) ); 209 out.println( stringBuf.toString() ); 210 211 212 if ( recordId == (short) 0xF007 && 36 <= remainingBytes && 36 <= recordBytesRemaining ) 213 { 216 byte n8; 217 220 stringBuf = new StringBuffer ( " btWin32: " ); 221 n8 = (byte) in.read(); 222 stringBuf.append( HexDump.toHex( n8 ) ); 223 stringBuf.append( getBlipType( n8 ) ); 224 stringBuf.append( " btMacOS: " ); 225 n8 = (byte) in.read(); 226 stringBuf.append( HexDump.toHex( n8 ) ); 227 stringBuf.append( getBlipType( n8 ) ); 228 out.println( stringBuf.toString() ); 229 230 out.println( " rgbUid:" ); 231 HexDump.dump( in, out, 0, 16 ); 232 233 out.print( " tag: " ); 234 outHex( 2, in, out ); 235 out.println(); 236 out.print( " size: " ); 237 outHex( 4, in, out ); 238 out.println(); 239 out.print( " cRef: " ); 240 outHex( 4, in, out ); 241 out.println(); 242 out.print( " offs: " ); 243 outHex( 4, in, out ); 244 out.println(); 245 out.print( " usage: " ); 246 outHex( 1, in, out ); 247 out.println(); 248 out.print( " cbName: " ); 249 outHex( 1, in, out ); 250 out.println(); 251 out.print( " unused2: " ); 252 outHex( 1, in, out ); 253 out.println(); 254 out.print( " unused3: " ); 255 outHex( 1, in, out ); 256 out.println(); 257 258 remainingBytes -= 36; 260 recordBytesRemaining = 0; } 263 else if ( recordId == (short) 0xF010 && 0x12 <= remainingBytes && 0x12 <= recordBytesRemaining ) 264 { 268 out.print( " Flag: " ); 269 outHex( 2, in, out ); 270 out.println(); 271 out.print( " Col1: " ); 272 outHex( 2, in, out ); 273 out.print( " dX1: " ); 274 outHex( 2, in, out ); 275 out.print( " Row1: " ); 276 outHex( 2, in, out ); 277 out.print( " dY1: " ); 278 outHex( 2, in, out ); 279 out.println(); 280 out.print( " Col2: " ); 281 outHex( 2, in, out ); 282 out.print( " dX2: " ); 283 outHex( 2, in, out ); 284 out.print( " Row2: " ); 285 outHex( 2, in, out ); 286 out.print( " dY2: " ); 287 outHex( 2, in, out ); 288 out.println(); 289 290 remainingBytes -= 18; 291 recordBytesRemaining -= 18; 292 293 } 294 else if ( recordId == (short) 0xF00B || recordId == (short) 0xF122 ) 295 { int nComplex = 0; 297 out.println( " PROPID VALUE" ); 298 while ( recordBytesRemaining >= 6 + nComplex && remainingBytes >= 6 + nComplex ) 299 { 300 short n16; 301 int n32; 302 n16 = LittleEndian.readShort( in ); 303 n32 = LittleEndian.readInt( in ); 304 305 recordBytesRemaining -= 6; 306 remainingBytes -= 6; 307 out.print( " " ); 308 out.print( HexDump.toHex( n16 ) ); 309 out.print( " (" ); 310 int propertyId = n16 & (short) 0x3FFF; 311 out.print( " " + propertyId ); 312 if ( ( n16 & (short) 0x8000 ) == 0 ) 313 { 314 if ( ( n16 & (short) 0x4000 ) != 0 ) 315 out.print( ", fBlipID" ); 316 out.print( ") " ); 317 318 out.print( HexDump.toHex( n32 ) ); 319 320 if ( ( n16 & (short) 0x4000 ) == 0 ) 321 { 322 out.print( " (" ); 323 out.print( dec1616( n32 ) ); 324 out.print( ')' ); 325 out.print( " {" + propName( (short)propertyId ) + "}" ); 326 } 327 out.println(); 328 } 329 else 330 { 331 out.print( ", fComplex) " ); 332 out.print( HexDump.toHex( n32 ) ); 333 out.print( " - Complex prop len" ); 334 out.println( " {" + propName( (short)propertyId ) + "}" ); 335 336 nComplex += n32; 337 } 338 339 } 340 while ( ( nComplex & remainingBytes ) > 0 ) 342 { 343 nDumpSize = ( nComplex > (int) remainingBytes ) ? (short) remainingBytes : (short) nComplex; 344 HexDump.dump( in, out, 0, nDumpSize ); 345 nComplex -= nDumpSize; 346 recordBytesRemaining -= nDumpSize; 347 remainingBytes -= nDumpSize; 348 } 349 } 350 else if ( recordId == (short) 0xF012 ) 351 { 352 out.print( " Connector rule: " ); 353 out.print( LittleEndian.readInt( in ) ); 354 out.print( " ShapeID A: " ); 355 out.print( LittleEndian.readInt( in ) ); 356 out.print( " ShapeID B: " ); 357 out.print( LittleEndian.readInt( in ) ); 358 out.print( " ShapeID connector: " ); 359 out.print( LittleEndian.readInt( in ) ); 360 out.print( " Connect pt A: " ); 361 out.print( LittleEndian.readInt( in ) ); 362 out.print( " Connect pt B: " ); 363 out.println( LittleEndian.readInt( in ) ); 364 365 recordBytesRemaining -= 24; 366 remainingBytes -= 24; 367 } 368 else if ( recordId >= (short) 0xF018 && recordId < (short) 0xF117 ) 369 { 370 out.println( " Secondary UID: " ); 371 HexDump.dump( in, out, 0, 16 ); 372 out.println( " Cache of size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 373 out.println( " Boundary top: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 374 out.println( " Boundary left: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 375 out.println( " Boundary width: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 376 out.println( " Boundary height: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 377 out.println( " X: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 378 out.println( " Y: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 379 out.println( " Cache of saved size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); 380 out.println( " Compression Flag: " + HexDump.toHex( (byte) in.read() ) ); 381 out.println( " Filter: " + HexDump.toHex( (byte) in.read() ) ); 382 out.println( " Data (after decompression): " ); 383 384 recordBytesRemaining -= 34 + 16; 385 remainingBytes -= 34 + 16; 386 387 nDumpSize = ( recordBytesRemaining > (int) remainingBytes ) ? (short) remainingBytes : (short) recordBytesRemaining; 388 389 390 byte[] buf = new byte[nDumpSize]; 391 int read = in.read( buf ); 392 while ( read != -1 && read < nDumpSize ) 393 read += in.read( buf, read, buf.length ); 394 ByteArrayInputStream bin = new ByteArrayInputStream ( buf ); 395 396 InputStream in1 = new InflaterInputStream ( bin ); 397 int bytesToDump = -1; 398 HexDump.dump( in1, out, 0, bytesToDump ); 399 400 recordBytesRemaining -= nDumpSize; 401 remainingBytes -= nDumpSize; 402 403 } 404 405 boolean isContainer = ( options & (short) 0x000F ) == (short) 0x000F; 406 if ( isContainer && remainingBytes >= 0 ) 407 { if ( recordBytesRemaining <= (int) remainingBytes ) 409 out.println( " completed within" ); 410 else 411 out.println( " continued elsewhere" ); 412 } 413 else if ( remainingBytes >= 0 ) 414 { 416 nDumpSize = ( recordBytesRemaining > (int) remainingBytes ) ? (short) remainingBytes : (short) recordBytesRemaining; 417 418 if ( nDumpSize != 0 ) 419 { 420 HexDump.dump( in, out, 0, nDumpSize ); 421 remainingBytes -= nDumpSize; 422 } 423 } 424 else 425 out.println( " >> OVERRUN <<" ); 426 } 427 428 } 429 430 437 private String propName( short propertyId ) 438 { 439 class PropName { 440 public PropName( int id, String name ) 441 { 442 this.id = id; 443 this.name = name; 444 } 445 446 int id; 447 String name; 448 } 449 450 final PropName[] props = new PropName[] { 451 new PropName(4, "transform.rotation"), 452 new PropName(119, "protection.lockrotation"), 453 new PropName(120, "protection.lockaspectratio"), 454 new PropName(121, "protection.lockposition"), 455 new PropName(122, "protection.lockagainstselect"), 456 new PropName(123, "protection.lockcropping"), 457 new PropName(124, "protection.lockvertices"), 458 new PropName(125, "protection.locktext"), 459 new PropName(126, "protection.lockadjusthandles"), 460 new PropName(127, "protection.lockagainstgrouping"), 461 new PropName(128, "text.textid"), 462 new PropName(129, "text.textleft"), 463 new PropName(130, "text.texttop"), 464 new PropName(131, "text.textright"), 465 new PropName(132, "text.textbottom"), 466 new PropName(133, "text.wraptext"), 467 new PropName(134, "text.scaletext"), 468 new PropName(135, "text.anchortext"), 469 new PropName(136, "text.textflow"), 470 new PropName(137, "text.fontrotation"), 471 new PropName(138, "text.idofnextshape"), 472 new PropName(139, "text.bidir"), 473 new PropName(187, "text.singleclickselects"), 474 new PropName(188, "text.usehostmargins"), 475 new PropName(189, "text.rotatetextwithshape"), 476 new PropName(190, "text.sizeshapetofittext"), 477 new PropName(191, "text.sizetexttofitshape"), 478 new PropName(192, "geotext.unicode"), 479 new PropName(193, "geotext.rtftext"), 480 new PropName(194, "geotext.alignmentoncurve"), 481 new PropName(195, "geotext.defaultpointsize"), 482 new PropName(196, "geotext.textspacing"), 483 new PropName(197, "geotext.fontfamilyname"), 484 new PropName(240, "geotext.reverseroworder"), 485 new PropName(241, "geotext.hastexteffect"), 486 new PropName(242, "geotext.rotatecharacters"), 487 new PropName(243, "geotext.kerncharacters"), 488 new PropName(244, "geotext.tightortrack"), 489 new PropName(245, "geotext.stretchtofitshape"), 490 new PropName(246, "geotext.charboundingbox"), 491 new PropName(247, "geotext.scaletextonpath"), 492 new PropName(248, "geotext.stretchcharheight"), 493 new PropName(249, "geotext.nomeasurealongpath"), 494 new PropName(250, "geotext.boldfont"), 495 new PropName(251, "geotext.italicfont"), 496 new PropName(252, "geotext.underlinefont"), 497 new PropName(253, "geotext.shadowfont"), 498 new PropName(254, "geotext.smallcapsfont"), 499 new PropName(255, "geotext.strikethroughfont"), 500 new PropName(256, "blip.cropfromtop"), 501 new PropName(257, "blip.cropfrombottom"), 502 new PropName(258, "blip.cropfromleft"), 503 new PropName(259, "blip.cropfromright"), 504 new PropName(260, "blip.bliptodisplay"), 505 new PropName(261, "blip.blipfilename"), 506 new PropName(262, "blip.blipflags"), 507 new PropName(263, "blip.transparentcolor"), 508 new PropName(264, "blip.contrastsetting"), 509 new PropName(265, "blip.brightnesssetting"), 510 new PropName(266, "blip.gamma"), 511 new PropName(267, "blip.pictureid"), 512 new PropName(268, "blip.doublemod"), 513 new PropName(269, "blip.picturefillmod"), 514 new PropName(270, "blip.pictureline"), 515 new PropName(271, "blip.printblip"), 516 new PropName(272, "blip.printblipfilename"), 517 new PropName(273, "blip.printflags"), 518 new PropName(316, "blip.nohittestpicture"), 519 new PropName(317, "blip.picturegray"), 520 new PropName(318, "blip.picturebilevel"), 521 new PropName(319, "blip.pictureactive"), 522 new PropName(320, "geometry.left"), 523 new PropName(321, "geometry.top"), 524 new PropName(322, "geometry.right"), 525 new PropName(323, "geometry.bottom"), 526 new PropName(324, "geometry.shapepath"), 527 new PropName(325, "geometry.vertices"), 528 new PropName(326, "geometry.segmentinfo"), 529 new PropName(327, "geometry.adjustvalue"), 530 new PropName(328, "geometry.adjust2value"), 531 new PropName(329, "geometry.adjust3value"), 532 new PropName(330, "geometry.adjust4value"), 533 new PropName(331, "geometry.adjust5value"), 534 new PropName(332, "geometry.adjust6value"), 535 new PropName(333, "geometry.adjust7value"), 536 new PropName(334, "geometry.adjust8value"), 537 new PropName(335, "geometry.adjust9value"), 538 new PropName(336, "geometry.adjust10value"), 539 new PropName(378, "geometry.shadowOK"), 540 new PropName(379, "geometry.3dok"), 541 new PropName(380, "geometry.lineok"), 542 new PropName(381, "geometry.geotextok"), 543 new PropName(382, "geometry.fillshadeshapeok"), 544 new PropName(383, "geometry.fillok"), 545 new PropName(384, "fill.filltype"), 546 new PropName(385, "fill.fillcolor"), 547 new PropName(386, "fill.fillopacity"), 548 new PropName(387, "fill.fillbackcolor"), 549 new PropName(388, "fill.backopacity"), 550 new PropName(389, "fill.crmod"), 551 new PropName(390, "fill.patterntexture"), 552 new PropName(391, "fill.blipfilename"), 553 new PropName(392, "fill.blipflags"), 554 new PropName(393, "fill.width"), 555 new PropName(394, "fill.height"), 556 new PropName(395, "fill.angle"), 557 new PropName(396, "fill.focus"), 558 new PropName(397, "fill.toleft"), 559 new PropName(398, "fill.totop"), 560 new PropName(399, "fill.toright"), 561 new PropName(400, "fill.tobottom"), 562 new PropName(401, "fill.rectleft"), 563 new PropName(402, "fill.recttop"), 564 new PropName(403, "fill.rectright"), 565 new PropName(404, "fill.rectbottom"), 566 new PropName(405, "fill.dztype"), 567 new PropName(406, "fill.shadepreset"), 568 new PropName(407, "fill.shadecolors"), 569 new PropName(408, "fill.originx"), 570 new PropName(409, "fill.originy"), 571 new PropName(410, "fill.shapeoriginx"), 572 new PropName(411, "fill.shapeoriginy"), 573 new PropName(412, "fill.shadetype"), 574 new PropName(443, "fill.filled"), 575 new PropName(444, "fill.hittestfill"), 576 new PropName(445, "fill.shape"), 577 new PropName(446, "fill.userect"), 578 new PropName(447, "fill.nofillhittest"), 579 new PropName(448, "linestyle.color"), 580 new PropName(449, "linestyle.opacity"), 581 new PropName(450, "linestyle.backcolor"), 582 new PropName(451, "linestyle.crmod"), 583 new PropName(452, "linestyle.linetype"), 584 new PropName(453, "linestyle.fillblip"), 585 new PropName(454, "linestyle.fillblipname"), 586 new PropName(455, "linestyle.fillblipflags"), 587 new PropName(456, "linestyle.fillwidth"), 588 new PropName(457, "linestyle.fillheight"), 589 new PropName(458, "linestyle.filldztype"), 590 new PropName(459, "linestyle.linewidth"), 591 new PropName(460, "linestyle.linemiterlimit"), 592 new PropName(461, "linestyle.linestyle"), 593 new PropName(462, "linestyle.linedashing"), 594 new PropName(463, "linestyle.linedashstyle"), 595 new PropName(464, "linestyle.linestartarrowhead"), 596 new PropName(465, "linestyle.lineendarrowhead"), 597 new PropName(466, "linestyle.linestartarrowwidth"), 598 new PropName(467, "linestyle.lineestartarrowlength"), 599 new PropName(468, "linestyle.lineendarrowwidth"), 600 new PropName(469, "linestyle.lineendarrowlength"), 601 new PropName(470, "linestyle.linejoinstyle"), 602 new PropName(471, "linestyle.lineendcapstyle"), 603 new PropName(507, "linestyle.arrowheadsok"), 604 new PropName(508, "linestyle.anyline"), 605 new PropName(509, "linestyle.hitlinetest"), 606 new PropName(510, "linestyle.linefillshape"), 607 new PropName(511, "linestyle.nolinedrawdash"), 608 new PropName(512, "shadowstyle.type"), 609 new PropName(513, "shadowstyle.color"), 610 new PropName(514, "shadowstyle.highlight"), 611 new PropName(515, "shadowstyle.crmod"), 612 new PropName(516, "shadowstyle.opacity"), 613 new PropName(517, "shadowstyle.offsetx"), 614 new PropName(518, "shadowstyle.offsety"), 615 new PropName(519, "shadowstyle.secondoffsetx"), 616 new PropName(520, "shadowstyle.secondoffsety"), 617 new PropName(521, "shadowstyle.scalextox"), 618 new PropName(522, "shadowstyle.scaleytox"), 619 new PropName(523, "shadowstyle.scalextoy"), 620 new PropName(524, "shadowstyle.scaleytoy"), 621 new PropName(525, "shadowstyle.perspectivex"), 622 new PropName(526, "shadowstyle.perspectivey"), 623 new PropName(527, "shadowstyle.weight"), 624 new PropName(528, "shadowstyle.originx"), 625 new PropName(529, "shadowstyle.originy"), 626 new PropName(574, "shadowstyle.shadow"), 627 new PropName(575, "shadowstyle.shadowobsured"), 628 new PropName(576, "perspective.type"), 629 new PropName(577, "perspective.offsetx"), 630 new PropName(578, "perspective.offsety"), 631 new PropName(579, "perspective.scalextox"), 632 new PropName(580, "perspective.scaleytox"), 633 new PropName(581, "perspective.scalextoy"), 634 new PropName(582, "perspective.scaleytox"), 635 new PropName(583, "perspective.perspectivex"), 636 new PropName(584, "perspective.perspectivey"), 637 new PropName(585, "perspective.weight"), 638 new PropName(586, "perspective.originx"), 639 new PropName(587, "perspective.originy"), 640 new PropName(639, "perspective.perspectiveon"), 641 new PropName(640, "3d.specularamount"), 642 new PropName(661, "3d.diffuseamount"), 643 new PropName(662, "3d.shininess"), 644 new PropName(663, "3d.edgethickness"), 645 new PropName(664, "3d.extrudeforward"), 646 new PropName(665, "3d.extrudebackward"), 647 new PropName(666, "3d.extrudeplane"), 648 new PropName(667, "3d.extrusioncolor"), 649 new PropName(648, "3d.crmod"), 650 new PropName(700, "3d.3deffect"), 651 new PropName(701, "3d.metallic"), 652 new PropName(702, "3d.useextrusioncolor"), 653 new PropName(703, "3d.lightface"), 654 new PropName(704, "3dstyle.yrotationangle"), 655 new PropName(705, "3dstyle.xrotationangle"), 656 new PropName(706, "3dstyle.rotationaxisx"), 657 new PropName(707, "3dstyle.rotationaxisy"), 658 new PropName(708, "3dstyle.rotationaxisz"), 659 new PropName(709, "3dstyle.rotationangle"), 660 new PropName(710, "3dstyle.rotationcenterx"), 661 new PropName(711, "3dstyle.rotationcentery"), 662 new PropName(712, "3dstyle.rotationcenterz"), 663 new PropName(713, "3dstyle.rendermode"), 664 new PropName(714, "3dstyle.tolerance"), 665 new PropName(715, "3dstyle.xviewpoint"), 666 new PropName(716, "3dstyle.yviewpoint"), 667 new PropName(717, "3dstyle.zviewpoint"), 668 new PropName(718, "3dstyle.originx"), 669 new PropName(719, "3dstyle.originy"), 670 new PropName(720, "3dstyle.skewangle"), 671 new PropName(721, "3dstyle.skewamount"), 672 new PropName(722, "3dstyle.ambientintensity"), 673 new PropName(723, "3dstyle.keyx"), 674 new PropName(724, "3dstyle.keyy"), 675 new PropName(725, "3dstyle.keyz"), 676 new PropName(726, "3dstyle.keyintensity"), 677 new PropName(727, "3dstyle.fillx"), 678 new PropName(728, "3dstyle.filly"), 679 new PropName(729, "3dstyle.fillz"), 680 new PropName(730, "3dstyle.fillintensity"), 681 new PropName(763, "3dstyle.constrainrotation"), 682 new PropName(764, "3dstyle.rotationcenterauto"), 683 new PropName(765, "3dstyle.parallel"), 684 new PropName(766, "3dstyle.keyharsh"), 685 new PropName(767, "3dstyle.fillharsh"), 686 new PropName(769, "shape.master"), 687 new PropName(771, "shape.connectorstyle"), 688 new PropName(772, "shape.blackandwhitesettings"), 689 new PropName(773, "shape.wmodepurebw"), 690 new PropName(774, "shape.wmodebw"), 691 new PropName(826, "shape.oleicon"), 692 new PropName(827, "shape.preferrelativeresize"), 693 new PropName(828, "shape.lockshapetype"), 694 new PropName(830, "shape.deleteattachedobject"), 695 new PropName(831, "shape.backgroundshape"), 696 new PropName(832, "callout.callouttype"), 697 new PropName(833, "callout.xycalloutgap"), 698 new PropName(834, "callout.calloutangle"), 699 new PropName(835, "callout.calloutdroptype"), 700 new PropName(836, "callout.calloutdropspecified"), 701 new PropName(837, "callout.calloutlengthspecified"), 702 new PropName(889, "callout.iscallout"), 703 new PropName(890, "callout.calloutaccentbar"), 704 new PropName(891, "callout.callouttextborder"), 705 new PropName(892, "callout.calloutminusx"), 706 new PropName(893, "callout.calloutminusy"), 707 new PropName(894, "callout.dropauto"), 708 new PropName(895, "callout.lengthspecified"), 709 new PropName(896, "groupshape.shapename"), 710 new PropName(897, "groupshape.description"), 711 new PropName(898, "groupshape.hyperlink"), 712 new PropName(899, "groupshape.wrappolygonvertices"), 713 new PropName(900, "groupshape.wrapdistleft"), 714 new PropName(901, "groupshape.wrapdisttop"), 715 new PropName(902, "groupshape.wrapdistright"), 716 new PropName(903, "groupshape.wrapdistbottom"), 717 new PropName(904, "groupshape.regroupid"), 718 new PropName(953, "groupshape.editedwrap"), 719 new PropName(954, "groupshape.behinddocument"), 720 new PropName(955, "groupshape.ondblclicknotify"), 721 new PropName(956, "groupshape.isbutton"), 722 new PropName(957, "groupshape.1dadjustment"), 723 new PropName(958, "groupshape.hidden"), 724 new PropName(959, "groupshape.print"), 725 }; 726 727 for ( int i = 0; i < props.length; i++ ) 728 { 729 if (props[i].id == propertyId) 730 { 731 return props[i].name; 732 } 733 } 734 735 return "unknown property"; 736 } 737 738 744 private String getBlipType( byte b ) 745 { 746 switch ( b ) 747 { 748 case 0: 749 return " ERROR"; 750 case 1: 751 return " UNKNOWN"; 752 case 2: 753 return " EMF"; 754 case 3: 755 return " WMF"; 756 case 4: 757 return " PICT"; 758 case 5: 759 return " JPEG"; 760 case 6: 761 return " PNG"; 762 case 7: 763 return " DIB"; 764 default: 765 if ( b < 32 ) 766 return " NotKnown"; 767 else 768 return " Client"; 769 } 770 } 771 772 775 private String dec1616( int n32 ) 776 { 777 String result = ""; 778 result += (short) ( n32 >> 16 ); 779 result += '.'; 780 result += (short) ( n32 & (short) 0xFFFF ); 781 return result; 782 } 783 784 791 private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException , LittleEndian.BufferUnderrunException 792 { 793 switch ( bytes ) 794 { 795 case 1: 796 out.print( HexDump.toHex( (byte) in.read() ) ); 797 break; 798 case 2: 799 out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); 800 break; 801 case 4: 802 out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); 803 break; 804 default: 805 throw new IOException ( "Unable to output variable of that width" ); 806 } 807 } 808 809 812 public static void main( String [] args ) throws IOException 813 { 814 String dump = 815 "0F 00 00 F0 89 07 00 00 00 00 06 F0 18 00 00 00 " + 816 "05 04 00 00 02 00 00 00 05 00 00 00 01 00 00 00 " + 817 "01 00 00 00 05 00 00 00 4F 00 01 F0 2F 07 00 00 " + 818 "42 00 07 F0 B7 01 00 00 03 04 3F 14 AE 6B 0F 65 " + 819 "B0 48 BF 5E 94 63 80 E8 91 73 FF 00 93 01 00 00 " + 820 "01 00 00 00 00 00 00 00 00 00 FF FF 20 54 1C F0 " + 821 "8B 01 00 00 3F 14 AE 6B 0F 65 B0 48 BF 5E 94 63 " + 822 "80 E8 91 73 92 0E 00 00 00 00 00 00 00 00 00 00 " + 823 "D1 07 00 00 DD 05 00 00 4A AD 6F 00 8A C5 53 00 " + 824 "59 01 00 00 00 FE 78 9C E3 9B C4 00 04 AC 77 D9 " + 825 "2F 32 08 32 FD E7 61 F8 FF 0F C8 FD 05 C5 30 19 " + 826 "10 90 63 90 FA 0F 06 0C 8C 0C 5C 70 19 43 30 EB " + 827 "0E FB 05 86 85 0C DB 18 58 80 72 8C 70 16 0B 83 " + 828 "05 56 51 29 88 C9 60 D9 69 0C 6C 20 26 23 03 C8 " + 829 "74 B0 A8 0E 03 07 FB 45 56 C7 A2 CC C4 1C 06 66 " + 830 "A0 0D 2C 40 39 5E 86 4C 06 3D A0 4E 10 D0 60 D9 " + 831 "C8 58 CC E8 CF B0 80 61 3A 8A 7E 0D C6 23 AC 4F " + 832 "E0 E2 98 B6 12 2B 06 73 9D 12 E3 52 56 59 F6 08 " + 833 "8A CC 52 66 A3 50 FF 96 2B 94 E9 DF 4C A1 FE 2D " + 834 "3A 03 AB 9F 81 C2 F0 A3 54 BF 0F 85 EE A7 54 FF " + 835 "40 FB 7F A0 E3 9F D2 F4 4F 71 FE 19 58 FF 2B 31 " + 836 "7F 67 36 3B 25 4F 99 1B 4E 53 A6 5F 89 25 95 E9 " + 837 "C4 00 C7 83 12 F3 1F 26 35 4A D3 D2 47 0E 0A C3 " + 838 "41 8E C9 8A 52 37 DC 15 A1 D0 0D BC 4C 06 0C 2B " + 839 "28 2C 13 28 D4 EF 43 61 5A A0 58 3F 85 71 E0 4B " + 840 "69 9E 64 65 FE 39 C0 E5 22 30 1D 30 27 0E 74 3A " + 841 "18 60 FD 4A CC B1 2C 13 7D 07 36 2D 2A 31 85 B2 " + 842 "6A 0D 74 1D 1D 22 4D 99 FE 60 0A F5 9B EC 1C 58 " + 843 "FD 67 06 56 3F 38 0D 84 3C A5 30 0E 28 D3 AF C4 " + 844 "A4 CA FA 44 7A 0D 65 6E 60 7F 4D A1 1B 24 58 F7 " + 845 "49 AF A5 CC 0D CC DF 19 FE 03 00 F0 B1 25 4D 42 " + 846 "00 07 F0 E1 01 00 00 03 04 39 50 BE 98 B0 6F 57 " + 847 "24 31 70 5D 23 2F 9F 10 66 FF 00 BD 01 00 00 01 " + 848 "00 00 00 00 00 00 00 00 00 FF FF 20 54 1C F0 B5 " + 849 "01 00 00 39 50 BE 98 B0 6F 57 24 31 70 5D 23 2F " + 850 "9F 10 66 DA 03 00 00 00 00 00 00 00 00 00 00 D1 " + 851 "07 00 00 DD 05 00 00 4A AD 6F 00 8A C5 53 00 83 " + 852 "01 00 00 00 FE 78 9C A5 52 BF 4B 42 51 14 3E F7 " + 853 "DC 77 7A 16 45 48 8B 3C 48 A8 16 15 0D 6C 88 D0 " + 854 "04 C3 40 A3 32 1C 84 96 08 21 04 A1 C5 5C A2 35 " + 855 "82 C0 35 6A AB 1C 6A 6B A8 24 5A 83 68 08 84 84 " + 856 "96 A2 86 A0 7F C2 86 5E E7 5E F5 41 E4 10 BC 03 " + 857 "1F E7 FB F1 CE B9 F7 F1 9E 7C 05 2E 7A 37 9B E0 " + 858 "45 7B 10 EC 6F 96 5F 1D 74 13 55 7E B0 6C 5D 20 " + 859 "60 C0 49 A2 9A BD 99 4F 50 83 1B 30 38 13 0E 33 " + 860 "60 A6 A7 6B B5 37 EB F4 10 FA 14 15 A0 B6 6B 37 " + 861 "0C 1E B3 49 73 5B A5 C2 26 48 3E C1 E0 6C 08 4A " + 862 "30 C9 93 AA 02 B8 20 13 62 05 4E E1 E8 D7 7C C0 " + 863 "B8 14 95 5E BE B8 A7 CF 1E BE 55 2C 56 B9 78 DF " + 864 "08 7E 88 4C 27 FF 7B DB FF 7A DD B7 1A 17 67 34 " + 865 "6A AE BA DA 35 D1 E7 72 BE FE EC 6E FE DA E5 7C " + 866 "3D EC 7A DE 03 FD 50 06 0B 23 F2 0E F3 B2 A5 11 " + 867 "91 0D 4C B5 B5 F3 BF 94 C1 8F 24 F7 D9 6F 60 94 " + 868 "3B C9 9A F3 1C 6B E7 BB F0 2E 49 B2 25 2B C6 B1 " + 869 "EE 69 EE 15 63 4F 71 7D CE 85 CC C8 35 B9 C3 28 " + 870 "28 CE D0 5C 67 79 F2 4A A2 14 23 A4 38 43 73 9D " + 871 "2D 69 2F C1 08 31 9F C5 5C 9B EB 7B C5 69 19 B3 " + 872 "B4 81 F3 DC E3 B4 8E 8B CC B3 94 53 5A E7 41 2A " + 873 "63 9A AA 38 C5 3D 48 BB EC 57 59 6F 2B AD 73 1F " + 874 "1D 60 92 AE 70 8C BB 8F CE 31 C1 3C 49 27 4A EB " + 875 "DC A4 5B 8C D1 0B 0E 73 37 E9 11 A7 99 C7 E8 41 " + 876 "69 B0 7F 00 96 F2 A7 E8 42 00 07 F0 B4 01 00 00 " + 877 "03 04 1A BA F9 D6 A9 B9 3A 03 08 61 E9 90 FF 7B " + 878 "9E E6 FF 00 90 01 00 00 01 00 00 00 00 00 00 00 " + 879 "00 00 FF FF 20 54 1C F0 88 01 00 00 1A BA F9 D6 " + 880 "A9 B9 3A 03 08 61 E9 90 FF 7B 9E E6 12 0E 00 00 " + 881 "00 00 00 00 00 00 00 00 D1 07 00 00 DD 05 00 00 " + 882 "4A AD 6F 00 8A C5 53 00 56 01 00 00 00 FE 78 9C " + 883 "E3 13 62 00 02 D6 BB EC 17 19 04 99 FE F3 30 FC " + 884 "FF 07 E4 FE 82 62 98 0C 08 C8 31 48 FD 07 03 06 " + 885 "46 06 2E B8 8C 21 98 75 87 FD 02 C3 42 86 6D 0C " + 886 "2C 40 39 46 38 8B 85 C1 02 AB A8 14 C4 64 B0 EC " + 887 "34 06 36 10 93 91 01 64 3A 58 54 87 81 83 FD 22 " + 888 "AB 63 51 66 62 0E 03 33 D0 06 16 A0 1C 2F 43 26 " + 889 "83 1E 50 27 08 68 B0 6C 64 2C 66 F4 67 58 C0 30 " + 890 "1D 45 BF 06 E3 11 D6 27 70 71 4C 5B 89 15 83 B9 " + 891 "4E 89 71 29 AB 2C 7B 04 45 66 29 B3 51 A8 7F CB " + 892 "15 CA F4 6F A6 50 FF 16 9D 81 D5 CF 40 61 F8 51 " + 893 "AA DF 87 42 F7 53 AA 7F A0 FD 3F D0 F1 4F 69 FA " + 894 "A7 38 FF 0C AC FF 95 98 BF 33 9B 9D 92 A7 CC 0D " + 895 "A7 29 D3 AF C4 92 CA 74 62 80 E3 41 89 F9 0F 93 " + 896 "1A A5 69 E9 23 07 85 E1 20 C7 64 45 A9 1B EE 8A " + 897 "50 E8 06 5E 26 03 86 15 14 96 09 14 EA F7 A1 30 " + 898 "2D 50 AC 9F C2 38 F0 A5 34 4F B2 32 FF 1C E0 72 " + 899 "11 98 0E 98 13 07 38 1D 28 31 C7 B2 4C F4 1D D8 " + 900 "B4 A0 C4 14 CA AA 35 D0 75 64 88 34 65 FA 83 29 " + 901 "D4 6F B2 73 60 F5 9F A1 54 FF 0E CA D3 40 C8 53 " + 902 "0A E3 E0 09 85 6E 50 65 7D 22 BD 86 32 37 B0 BF " + 903 "A6 D0 0D 12 AC FB A4 D7 52 E6 06 E6 EF 0C FF 01 " + 904 "97 1D 12 C7 42 00 07 F0 C3 01 00 00 03 04 BA 4C " + 905 "B6 23 BA 8B 27 BE C8 55 59 86 24 9F 89 D4 FF 00 " + 906 "9F 01 00 00 01 00 00 00 00 00 00 00 00 00 FF FF " + 907 "20 54 1C F0 97 01 00 00 BA 4C B6 23 BA 8B 27 BE " + 908 "C8 55 59 86 24 9F 89 D4 AE 0E 00 00 00 00 00 00 " + 909 "00 00 00 00 D1 07 00 00 DD 05 00 00 4A AD 6F 00 " + 910 "8A C5 53 00 65 01 00 00 00 FE 78 9C E3 5B C7 00 " + 911 "04 AC 77 D9 2F 32 08 32 FD E7 61 F8 FF 0F C8 FD " + 912 "05 C5 30 19 10 90 63 90 FA 0F 06 0C 8C 0C 5C 70 " + 913 "19 43 30 EB 0E FB 05 86 85 0C DB 18 58 80 72 8C " + 914 "70 16 0B 83 05 56 51 29 88 C9 60 D9 69 0C 6C 20 " + 915 "26 23 03 C8 74 B0 A8 0E 03 07 FB 45 56 C7 A2 CC " + 916 "C4 1C 06 66 A0 0D 2C 40 39 5E 86 4C 06 3D A0 4E " + 917 "10 D0 60 99 C6 B8 98 D1 9F 61 01 C3 74 14 FD 1A " + 918 "8C 2B D8 84 B1 88 4B A5 A5 75 03 01 50 DF 59 46 " + 919 "77 46 0F A8 3C A6 AB 88 15 83 B9 5E 89 B1 8B D5 " + 920 "97 2D 82 22 B3 94 29 D5 BF E5 CA C0 EA DF AC 43 " + 921 "A1 FD 14 EA 67 A0 30 FC 28 D5 EF 43 A1 FB 7D 87 " + 922 "B8 FF 07 3A FE 07 3A FD 53 EA 7E 0A C3 4F 89 F9 " + 923 "0E 73 EA 69 79 CA DC 70 8A 32 FD 4A 2C 5E 4C DF " + 924 "87 7A 3C BC E0 A5 30 1E 3E 31 C5 33 AC A0 30 2F " + 925 "52 A8 DF 87 C2 30 A4 54 3F A5 65 19 85 65 A9 12 " + 926 "D3 2B 16 0D 8A CB 13 4A F3 E3 27 E6 09 03 9D 0E " + 927 "06 58 BF 12 B3 13 CB C1 01 4E 8B 4A 4C 56 AC 91 " + 928 "03 5D 37 86 48 53 A6 3F 98 42 FD 26 3B 07 56 FF " + 929 "99 1D 14 EA A7 CC 7E 70 1A 08 79 42 61 1C 3C A5 " + 930 "D0 0D 9C 6C C2 32 6B 29 73 03 DB 6B CA DC C0 F8 " + 931 "97 F5 AD CC 1A CA DC C0 F4 83 32 37 B0 A4 30 CE " + 932 "FC C7 48 99 1B FE 33 32 FC 07 00 6C CC 2E 23 33 " + 933 "00 0B F0 12 00 00 00 BF 00 08 00 08 00 81 01 09 " + 934 "00 00 08 C0 01 40 00 00 08 40 00 1E F1 10 00 00 " + 935 "00 0D 00 00 08 0C 00 00 08 17 00 00 08 F7 00 00 " + 936 "10 "; 937 938 byte[] bytes = HexRead.readData( new ByteArrayInputStream ( dump.getBytes() ), -1 ); 940 EscherDump dumper = new EscherDump(); 942 dumper.dump(bytes, 0, bytes.length, System.out); 945 946 } 947 948 public void dump( int recordSize, byte[] data, PrintStream out ) throws IOException , LittleEndian.BufferUnderrunException 949 { 950 dump( data, 0, recordSize, System.out ); 953 } 954 } 955 | Popular Tags |