Complex classes like PowerPoint97 often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PowerPoint97, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 36 | class PowerPoint97 implements ReaderInterface |
||
| 37 | { |
||
| 38 | const OFFICEARTBLIPEMF = 0xF01A; |
||
| 39 | const OFFICEARTBLIPWMF = 0xF01B; |
||
| 40 | const OFFICEARTBLIPPICT = 0xF01C; |
||
| 41 | const OFFICEARTBLIPJPG = 0xF01D; |
||
| 42 | const OFFICEARTBLIPPNG = 0xF01E; |
||
| 43 | const OFFICEARTBLIPDIB = 0xF01F; |
||
| 44 | const OFFICEARTBLIPTIFF = 0xF029; |
||
| 45 | const OFFICEARTBLIPJPEG = 0xF02A; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @link http://msdn.microsoft.com/en-us/library/dd945336(v=office.12).aspx |
||
| 49 | */ |
||
| 50 | const RT_ANIMATIONINFO = 0x1014; |
||
| 51 | const RT_ANIMATIONINFOATOM = 0x0FF1; |
||
| 52 | const RT_BINARYTAGDATABLOB = 0x138B; |
||
| 53 | const RT_BLIPCOLLECTION9 = 0x07F8; |
||
| 54 | const RT_BLIPENTITY9ATOM = 0x07F9; |
||
| 55 | const RT_BOOKMARKCOLLECTION = 0x07E3; |
||
| 56 | const RT_BOOKMARKENTITYATOM = 0x0FD0; |
||
| 57 | const RT_BOOKMARKSEEDATOM = 0x07E9; |
||
| 58 | const RT_BROADCASTDOCINFO9 = 0x177E; |
||
| 59 | const RT_BROADCASTDOCINFO9ATOM = 0x177F; |
||
| 60 | const RT_BUILDATOM = 0x2B03; |
||
| 61 | const RT_BUILDLIST = 0x2B02; |
||
| 62 | const RT_CHARTBUILD = 0x2B04; |
||
| 63 | const RT_CHARTBUILDATOM = 0x2B05; |
||
| 64 | const RT_COLORSCHEMEATOM = 0x07F0; |
||
| 65 | const RT_COMMENT10 = 0x2EE0; |
||
| 66 | const RT_COMMENT10ATOM = 0x2EE1; |
||
| 67 | const RT_COMMENTINDEX10 = 0x2EE4; |
||
| 68 | const RT_COMMENTINDEX10ATOM = 0x2EE5; |
||
| 69 | const RT_CRYPTSESSION10CONTAINER = 0x2F14; |
||
| 70 | const RT_CURRENTUSERATOM = 0x0FF6; |
||
| 71 | const RT_CSTRING = 0x0FBA; |
||
| 72 | const RT_DATETIMEMETACHARATOM = 0x0FF7; |
||
| 73 | const RT_DEFAULTRULERATOM = 0x0FAB; |
||
| 74 | const RT_DOCROUTINGSLIPATOM = 0x0406; |
||
| 75 | const RT_DIAGRAMBUILD = 0x2B06; |
||
| 76 | const RT_DIAGRAMBUILDATOM = 0x2B07; |
||
| 77 | const RT_DIFF10 = 0x2EED; |
||
| 78 | const RT_DIFF10ATOM = 0x2EEE; |
||
| 79 | const RT_DIFFTREE10 = 0x2EEC; |
||
| 80 | const RT_DOCTOOLBARSTATES10ATOM = 0x36B1; |
||
| 81 | const RT_DOCUMENT = 0x03E8; |
||
| 82 | const RT_DOCUMENTATOM = 0x03E9; |
||
| 83 | const RT_DRAWING = 0x040C; |
||
| 84 | const RT_DRAWINGGROUP = 0x040B; |
||
| 85 | const RT_ENDDOCUMENTATOM = 0x03EA; |
||
| 86 | const RT_EXTERNALAVIMOVIE = 0x1006; |
||
| 87 | const RT_EXTERNALCDAUDIO = 0x100E; |
||
| 88 | const RT_EXTERNALCDAUDIOATOM = 0x1012; |
||
| 89 | const RT_EXTERNALHYPERLINK = 0x0FD7; |
||
| 90 | const RT_EXTERNALHYPERLINK9 = 0x0FE4; |
||
| 91 | const RT_EXTERNALHYPERLINKATOM = 0x0FD3; |
||
| 92 | const RT_EXTERNALHYPERLINKFLAGSATOM = 0x1018; |
||
| 93 | const RT_EXTERNALMCIMOVIE = 0x1007; |
||
| 94 | const RT_EXTERNALMEDIAATOM = 0x1004; |
||
| 95 | const RT_EXTERNALMIDIAUDIO = 0x100D; |
||
| 96 | const RT_EXTERNALOBJECTLIST = 0x0409; |
||
| 97 | const RT_EXTERNALOBJECTLISTATOM = 0x040A; |
||
| 98 | const RT_EXTERNALOBJECTREFATOM = 0x0BC1; |
||
| 99 | const RT_EXTERNALOLECONTROL = 0x0FEE; |
||
| 100 | const RT_EXTERNALOLECONTROLATOM = 0x0FFB; |
||
| 101 | const RT_EXTERNALOLEEMBED = 0x0FCC; |
||
| 102 | const RT_EXTERNALOLEEMBEDATOM = 0x0FCD; |
||
| 103 | const RT_EXTERNALOLELINK = 0x0FCE; |
||
| 104 | const RT_EXTERNALOLELINKATOM = 0x0FD1; |
||
| 105 | const RT_EXTERNALOLEOBJECTATOM = 0x0FC3; |
||
| 106 | const RT_EXTERNALOLEOBJECTSTG = 0x1011; |
||
| 107 | const RT_EXTERNALVIDEO = 0x1005; |
||
| 108 | const RT_EXTERNALWAVAUDIOEMBEDDED = 0x100F; |
||
| 109 | const RT_EXTERNALWAVAUDIOEMBEDDEDATOM = 0x1013; |
||
| 110 | const RT_EXTERNALWAVAUDIOLINK = 0x1010; |
||
| 111 | const RT_ENVELOPEDATA9ATOM = 0x1785; |
||
| 112 | const RT_ENVELOPEFLAGS9ATOM = 0x1784; |
||
| 113 | const RT_ENVIRONMENT = 0x03F2; |
||
| 114 | const RT_FONTCOLLECTION = 0x07D5; |
||
| 115 | const RT_FONTCOLLECTION10 = 0x07D6; |
||
| 116 | const RT_FONTEMBEDDATABLOB = 0x0FB8; |
||
| 117 | const RT_FONTEMBEDFLAGS10ATOM = 0x32C8; |
||
| 118 | const RT_FILTERPRIVACYFLAGS10ATOM = 0x36B0; |
||
| 119 | const RT_FONTENTITYATOM = 0x0FB7; |
||
| 120 | const RT_FOOTERMETACHARATOM = 0x0FFA; |
||
| 121 | const RT_GENERICDATEMETACHARATOM = 0x0FF8; |
||
| 122 | const RT_GRIDSPACING10ATOM = 0x040D; |
||
| 123 | const RT_GUIDEATOM = 0x03FB; |
||
| 124 | const RT_HANDOUT = 0x0FC9; |
||
| 125 | const RT_HASHCODEATOM = 0x2B00; |
||
| 126 | const RT_HEADERSFOOTERS = 0x0FD9; |
||
| 127 | const RT_HEADERSFOOTERSATOM = 0x0FDA; |
||
| 128 | const RT_HEADERMETACHARATOM = 0x0FF9; |
||
| 129 | const RT_HTMLDOCINFO9ATOM = 0x177B; |
||
| 130 | const RT_HTMLPUBLISHINFOATOM = 0x177C; |
||
| 131 | const RT_HTMLPUBLISHINFO9 = 0x177D; |
||
| 132 | const RT_INTERACTIVEINFO = 0x0FF2; |
||
| 133 | const RT_INTERACTIVEINFOATOM = 0x0FF3; |
||
| 134 | const RT_KINSOKU = 0x0FC8; |
||
| 135 | const RT_KINSOKUATOM = 0x0FD2; |
||
| 136 | const RT_LEVELINFOATOM = 0x2B0A; |
||
| 137 | const RT_LINKEDSHAPE10ATOM = 0x2EE6; |
||
| 138 | const RT_LINKEDSLIDE10ATOM = 0x2EE7; |
||
| 139 | const RT_LIST = 0x07D0; |
||
| 140 | const RT_MAINMASTER = 0x03F8; |
||
| 141 | const RT_MASTERTEXTPROPATOM = 0x0FA2; |
||
| 142 | const RT_METAFILE = 0x0FC1; |
||
| 143 | const RT_NAMEDSHOW = 0x0411; |
||
| 144 | const RT_NAMEDSHOWS = 0x0410; |
||
| 145 | const RT_NAMEDSHOWSLIDESATOM = 0x0412; |
||
| 146 | const RT_NORMALVIEWSETINFO9 = 0x0414; |
||
| 147 | const RT_NORMALVIEWSETINFO9ATOM = 0x0415; |
||
| 148 | const RT_NOTES= 0x03F0; |
||
| 149 | const RT_NOTESATOM = 0x03F1; |
||
| 150 | const RT_NOTESTEXTVIEWINFO9 = 0x0413; |
||
| 151 | const RT_OUTLINETEXTPROPS9 = 0x0FAE; |
||
| 152 | const RT_OUTLINETEXTPROPS10 = 0x0FB3; |
||
| 153 | const RT_OUTLINETEXTPROPS11 = 0x0FB5; |
||
| 154 | const RT_OUTLINETEXTPROPSHEADER9ATOM = 0x0FAF; |
||
| 155 | const RT_OUTLINETEXTREFATOM = 0x0F9E; |
||
| 156 | const RT_OUTLINEVIEWINFO = 0x0407; |
||
| 157 | const RT_PERSISTDIRECTORYATOM = 0x1772; |
||
| 158 | const RT_PARABUILD = 0x2B08; |
||
| 159 | const RT_PARABUILDATOM = 0x2B09; |
||
| 160 | const RT_PHOTOALBUMINFO10ATOM = 0x36B2; |
||
| 161 | const RT_PLACEHOLDERATOM = 0x0BC3; |
||
| 162 | const RT_PRESENTATIONADVISORFLAGS9ATOM = 0x177A; |
||
| 163 | const RT_PRINTOPTIONSATOM = 0x1770; |
||
| 164 | const RT_PROGBINARYTAG = 0x138A; |
||
| 165 | const RT_PROGSTRINGTAG = 0x1389; |
||
| 166 | const RT_PROGTAGS = 0x1388; |
||
| 167 | const RT_RECOLORINFOATOM = 0x0FE7; |
||
| 168 | const RT_RTFDATETIMEMETACHARATOM = 0x1015; |
||
| 169 | const RT_ROUNDTRIPANIMATIONATOM12ATOM = 0x2B0B; |
||
| 170 | const RT_ROUNDTRIPANIMATIONHASHATOM12ATOM = 0x2B0D; |
||
| 171 | const RT_ROUNDTRIPCOLORMAPPING12ATOM = 0x040F; |
||
| 172 | const RT_ROUNDTRIPCOMPOSITEMASTERID12ATOM = 0x041D; |
||
| 173 | const RT_ROUNDTRIPCONTENTMASTERID12ATOM = 0x0422; |
||
| 174 | const RT_ROUNDTRIPCONTENTMASTERINFO12ATOM = 0x041E; |
||
| 175 | const RT_ROUNDTRIPCUSTOMTABLESTYLES12ATOM = 0x0428; |
||
| 176 | const RT_ROUNDTRIPDOCFLAGS12ATOM = 0x0425; |
||
| 177 | const RT_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM = 0x0424; |
||
| 178 | const RT_ROUNDTRIPHFPLACEHOLDER12ATOM = 0x0420; |
||
| 179 | const RT_ROUNDTRIPNEWPLACEHOLDERID12ATOM = 0x0BDD; |
||
| 180 | const RT_ROUNDTRIPNOTESMASTERTEXTSTYLES12ATOM = 0x0427; |
||
| 181 | const RT_ROUNDTRIPOARTTEXTSTYLES12ATOM = 0x0423; |
||
| 182 | const RT_ROUNDTRIPORIGINALMAINMASTERID12ATOM = 0x041C; |
||
| 183 | const RT_ROUNDTRIPSHAPECHECKSUMFORCL12ATOM = 0x0426; |
||
| 184 | const RT_ROUNDTRIPSHAPEID12ATOM = 0x041F; |
||
| 185 | const RT_ROUNDTRIPSLIDESYNCINFO12 = 0x3714; |
||
| 186 | const RT_ROUNDTRIPSLIDESYNCINFOATOM12 = 0x3715; |
||
| 187 | const RT_ROUNDTRIPTHEME12ATOM = 0x040E; |
||
| 188 | const RT_SHAPEATOM = 0x0BDB; |
||
| 189 | const RT_SHAPEFLAGS10ATOM = 0x0BDC; |
||
| 190 | const RT_SLIDE = 0x03EE; |
||
| 191 | const RT_SLIDEATOM = 0x03EF; |
||
| 192 | const RT_SLIDEFLAGS10ATOM = 0x2EEA; |
||
| 193 | const RT_SLIDELISTENTRY10ATOM = 0x2EF0; |
||
| 194 | const RT_SLIDELISTTABLE10 = 0x2EF1; |
||
| 195 | const RT_SLIDELISTWITHTEXT = 0x0FF0; |
||
| 196 | const RT_SLIDELISTTABLESIZE10ATOM = 0x2EEF; |
||
| 197 | const RT_SLIDENUMBERMETACHARATOM = 0x0FD8; |
||
| 198 | const RT_SLIDEPERSISTATOM = 0x03F3; |
||
| 199 | const RT_SLIDESHOWDOCINFOATOM = 0x0401; |
||
| 200 | const RT_SLIDESHOWSLIDEINFOATOM = 0x03F9; |
||
| 201 | const RT_SLIDETIME10ATOM = 0x2EEB; |
||
| 202 | const RT_SLIDEVIEWINFO = 0x03FA; |
||
| 203 | const RT_SLIDEVIEWINFOATOM = 0x03FE; |
||
| 204 | const RT_SMARTTAGSTORE11CONTAINER = 0x36B3; |
||
| 205 | const RT_SOUND = 0x07E6; |
||
| 206 | const RT_SOUNDCOLLECTION = 0x07E4; |
||
| 207 | const RT_SOUNDCOLLECTIONATOM = 0x07E5; |
||
| 208 | const RT_SOUNDDATABLOB = 0x07E7; |
||
| 209 | const RT_SORTERVIEWINFO = 0x0408; |
||
| 210 | const RT_STYLETEXTPROPATOM = 0x0FA1; |
||
| 211 | const RT_STYLETEXTPROP10ATOM = 0x0FB1; |
||
| 212 | const RT_STYLETEXTPROP11ATOM = 0x0FB6; |
||
| 213 | const RT_STYLETEXTPROP9ATOM = 0x0FAC; |
||
| 214 | const RT_SUMMARY = 0x0402; |
||
| 215 | const RT_TEXTBOOKMARKATOM = 0x0FA7; |
||
| 216 | const RT_TEXTBYTESATOM = 0x0FA8; |
||
| 217 | const RT_TEXTCHARFORMATEXCEPTIONATOM = 0x0FA4; |
||
| 218 | const RT_TEXTCHARSATOM = 0x0FA0; |
||
| 219 | const RT_TEXTDEFAULTS10ATOM = 0x0FB4; |
||
| 220 | const RT_TEXTDEFAULTS9ATOM = 0x0FB0; |
||
| 221 | const RT_TEXTHEADERATOM = 0x0F9F; |
||
| 222 | const RT_TEXTINTERACTIVEINFOATOM = 0x0FDF; |
||
| 223 | const RT_TEXTMASTERSTYLEATOM = 0x0FA3; |
||
| 224 | const RT_TEXTMASTERSTYLE10ATOM = 0x0FB2; |
||
| 225 | const RT_TEXTMASTERSTYLE9ATOM = 0x0FAD; |
||
| 226 | const RT_TEXTPARAGRAPHFORMATEXCEPTIONATOM = 0x0FA5; |
||
| 227 | const RT_TEXTRULERATOM = 0x0FA6; |
||
| 228 | const RT_TEXTSPECIALINFOATOM = 0x0FAA; |
||
| 229 | const RT_TEXTSPECIALINFODEFAULTATOM = 0x0FA9; |
||
| 230 | const RT_TIMEANIMATEBEHAVIOR = 0xF134; |
||
| 231 | const RT_TIMEANIMATEBEHAVIORCONTAINER = 0xF12B; |
||
| 232 | const RT_TIMEANIMATIONVALUE = 0xF143; |
||
| 233 | const RT_TIMEANIMATIONVALUELIST = 0xF13F; |
||
| 234 | const RT_TIMEBEHAVIOR = 0xF133; |
||
| 235 | const RT_TIMEBEHAVIORCONTAINER = 0xF12A; |
||
| 236 | const RT_TIMECOLORBEHAVIOR = 0xF135; |
||
| 237 | const RT_TIMECOLORBEHAVIORCONTAINER = 0xF12C; |
||
| 238 | const RT_TIMECLIENTVISUALELEMENT = 0xF13C; |
||
| 239 | const RT_TIMECOMMANDBEHAVIOR = 0xF13B; |
||
| 240 | const RT_TIMECOMMANDBEHAVIORCONTAINER = 0xF132; |
||
| 241 | const RT_TIMECONDITION = 0xF128; |
||
| 242 | const RT_TIMECONDITIONCONTAINER = 0xF125; |
||
| 243 | const RT_TIMEEFFECTBEHAVIOR = 0xF136; |
||
| 244 | const RT_TIMEEFFECTBEHAVIORCONTAINER = 0xF12D; |
||
| 245 | const RT_TIMEEXTTIMENODECONTAINER = 0xF144; |
||
| 246 | const RT_TIMEITERATEDATA = 0xF140; |
||
| 247 | const RT_TIMEMODIFIER = 0xF129; |
||
| 248 | const RT_TIMEMOTIONBEHAVIOR = 0xF137; |
||
| 249 | const RT_TIMEMOTIONBEHAVIORCONTAINER = 0xF12E; |
||
| 250 | const RT_TIMENODE = 0xF127; |
||
| 251 | const RT_TIMEPROPERTYLIST = 0xF13D; |
||
| 252 | const RT_TIMEROTATIONBEHAVIOR = 0xF138; |
||
| 253 | const RT_TIMEROTATIONBEHAVIORCONTAINER = 0xF12F; |
||
| 254 | const RT_TIMESCALEBEHAVIOR = 0xF139; |
||
| 255 | const RT_TIMESCALEBEHAVIORCONTAINER = 0xF130; |
||
| 256 | const RT_TIMESEQUENCEDATA = 0xF141; |
||
| 257 | const RT_TIMESETBEHAVIOR = 0xF13A; |
||
| 258 | const RT_TIMESETBEHAVIORCONTAINER = 0xF131; |
||
| 259 | const RT_TIMESUBEFFECTCONTAINER = 0xF145; |
||
| 260 | const RT_TIMEVARIANT = 0xF142; |
||
| 261 | const RT_TIMEVARIANTLIST = 0xF13E; |
||
| 262 | const RT_USEREDITATOM = 0x0FF5; |
||
| 263 | const RT_VBAINFO = 0x03FF; |
||
| 264 | const RT_VBAINFOATOM = 0x0400; |
||
| 265 | const RT_VIEWINFOATOM = 0x03FD; |
||
| 266 | const RT_VISUALPAGEATOM = 0x2B01; |
||
| 267 | const RT_VISUALSHAPEATOM = 0x2AFB; |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @var http://msdn.microsoft.com/en-us/library/dd926394(v=office.12).aspx |
||
| 271 | */ |
||
| 272 | const SL_BIGOBJECT = 0x0000000F; |
||
| 273 | const SL_BLANK = 0x00000010; |
||
| 274 | const SL_COLUMNTWOROWS = 0x0000000A; |
||
| 275 | const SL_FOUROBJECTS = 0x0000000E; |
||
| 276 | const SL_MASTERTITLE = 0x00000002; |
||
| 277 | const SL_TITLEBODY = 0x00000001; |
||
| 278 | const SL_TITLEONLY = 0x00000007; |
||
| 279 | const SL_TITLESLIDE = 0x00000000; |
||
| 280 | const SL_TWOCOLUMNS = 0x00000008; |
||
| 281 | const SL_TWOCOLUMNSROW = 0x0000000D; |
||
| 282 | const SL_TWOROWS = 0x00000009; |
||
| 283 | const SL_TWOROWSCOLUMN = 0x0000000B; |
||
| 284 | const SL_VERTICALTITLEBODY = 0x00000011; |
||
| 285 | const SL_VERTICALTWOROWS = 0x00000012; |
||
| 286 | |||
| 287 | /** |
||
| 288 | * Array with Fonts |
||
| 289 | */ |
||
| 290 | private $arrayFonts = array(); |
||
| 291 | /** |
||
| 292 | * Array with Hyperlinks |
||
| 293 | */ |
||
| 294 | private $arrayHyperlinks = array(); |
||
| 295 | /** |
||
| 296 | * Array with Notes |
||
| 297 | */ |
||
| 298 | private $arrayNotes = array(); |
||
| 299 | /** |
||
| 300 | * Array with Pictures |
||
| 301 | */ |
||
| 302 | private $arrayPictures = array(); |
||
| 303 | /** |
||
| 304 | * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the UserEditAtom record for the most recent user edit. |
||
| 305 | * @var int |
||
| 306 | */ |
||
| 307 | private $offsetToCurrentEdit; |
||
| 308 | /** |
||
| 309 | * A structure that specifies a compressed table of sequential persist object identifiers and stream offsets to associated persist objects. |
||
| 310 | * @var int[] |
||
| 311 | */ |
||
| 312 | private $rgPersistDirEntry; |
||
| 313 | /** |
||
| 314 | * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the PersistDirectoryAtom record for this user edit |
||
| 315 | * @var int |
||
| 316 | */ |
||
| 317 | private $offsetPersistDirectory; |
||
| 318 | /** |
||
| 319 | * Output Object |
||
| 320 | * @var PhpPresentation |
||
| 321 | */ |
||
| 322 | private $oPhpPresentation; |
||
| 323 | /** |
||
| 324 | * Group Object |
||
| 325 | * @var Group |
||
| 326 | */ |
||
| 327 | private $oCurrentGroup; |
||
| 328 | /** |
||
| 329 | * @var boolean |
||
| 330 | */ |
||
| 331 | private $bFirstShapeGroup = false; |
||
| 332 | /** |
||
| 333 | * Stream "Powerpoint Document" |
||
| 334 | * @var string |
||
| 335 | */ |
||
| 336 | private $streamPowerpointDocument; |
||
| 337 | /** |
||
| 338 | * Stream "Current User" |
||
| 339 | * @var string |
||
| 340 | */ |
||
| 341 | private $streamCurrentUser; |
||
| 342 | /** |
||
| 343 | * Stream "Summary Information" |
||
| 344 | * @var string |
||
| 345 | */ |
||
| 346 | private $streamSummaryInformation; |
||
| 347 | /** |
||
| 348 | * Stream "Document Summary Information" |
||
| 349 | * @var string |
||
| 350 | */ |
||
| 351 | private $streamDocumentSummaryInformation; |
||
| 352 | /** |
||
| 353 | * Stream "Pictures" |
||
| 354 | * @var string |
||
| 355 | */ |
||
| 356 | private $streamPictures; |
||
| 357 | /** |
||
| 358 | * @var integer |
||
| 359 | */ |
||
| 360 | private $inMainType; |
||
| 361 | /** |
||
| 362 | * @var integer |
||
| 363 | */ |
||
| 364 | private $currentNote; |
||
| 365 | |||
| 366 | /** |
||
| 367 | * Can the current \PhpOffice\PhpPresentation\Reader\ReaderInterface read the file? |
||
| 368 | * |
||
| 369 | * @param string $pFilename |
||
| 370 | * @throws \Exception |
||
| 371 | * @return boolean |
||
| 372 | */ |
||
| 373 | 3 | public function canRead($pFilename) |
|
| 374 | { |
||
| 375 | 3 | return $this->fileSupportsUnserializePhpPresentation($pFilename); |
|
| 376 | } |
||
| 377 | |||
| 378 | /** |
||
| 379 | * Does a file support UnserializePhpPresentation ? |
||
| 380 | * |
||
| 381 | * @param string $pFilename |
||
| 382 | * @throws \Exception |
||
| 383 | * @return boolean |
||
| 384 | */ |
||
| 385 | 10 | public function fileSupportsUnserializePhpPresentation($pFilename = '') |
|
| 386 | { |
||
| 387 | // Check if file exists |
||
| 388 | 10 | if (!file_exists($pFilename)) { |
|
| 389 | 2 | throw new \Exception('Could not open ' . $pFilename . ' for reading! File does not exist.'); |
|
| 390 | } |
||
| 391 | |||
| 392 | try { |
||
| 393 | // Use ParseXL for the hard work. |
||
| 394 | 8 | $ole = new OLERead(); |
|
| 395 | // get excel data |
||
| 396 | 8 | $ole->read($pFilename); |
|
| 397 | 5 | return true; |
|
| 398 | 3 | } catch (\Exception $e) { |
|
| 399 | 3 | return false; |
|
| 400 | } |
||
| 401 | } |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Loads PhpPresentation Serialized file |
||
| 405 | * |
||
| 406 | * @param string $pFilename |
||
| 407 | * @return \PhpOffice\PhpPresentation\PhpPresentation |
||
| 408 | * @throws \Exception |
||
| 409 | */ |
||
| 410 | 6 | public function load($pFilename) |
|
| 411 | { |
||
| 412 | // Unserialize... First make sure the file supports it! |
||
| 413 | 6 | if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { |
|
| 414 | 1 | throw new \Exception("Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint97: " . $pFilename . '.'); |
|
| 415 | } |
||
| 416 | |||
| 417 | 4 | return $this->loadFile($pFilename); |
|
| 418 | } |
||
| 419 | |||
| 420 | /** |
||
| 421 | * Load PhpPresentation Serialized file |
||
| 422 | * |
||
| 423 | * @param string $pFilename |
||
| 424 | * @return \PhpOffice\PhpPresentation\PhpPresentation |
||
| 425 | * @throws \Exception |
||
| 426 | */ |
||
| 427 | 4 | private function loadFile($pFilename) |
|
| 443 | |||
| 444 | /** |
||
| 445 | * Read OLE Part |
||
| 446 | * @param string $pFilename |
||
| 447 | * @throws \Exception |
||
| 448 | */ |
||
| 449 | 4 | private function loadOLE($pFilename) |
|
| 470 | |||
| 471 | /** |
||
| 472 | * Stream Pictures |
||
| 473 | * @link http://msdn.microsoft.com/en-us/library/dd920746(v=office.12).aspx |
||
| 474 | */ |
||
| 475 | 4 | private function loadPicturesStream() |
|
| 501 | |||
| 502 | /** |
||
| 503 | * Stream Current User |
||
| 504 | * @link http://msdn.microsoft.com/en-us/library/dd908567(v=office.12).aspx |
||
| 505 | */ |
||
| 506 | 4 | private function loadCurrentUserStream() |
|
| 599 | |||
| 600 | /** |
||
| 601 | * Stream Powerpoint Document |
||
| 602 | * @link http://msdn.microsoft.com/en-us/library/dd921564(v=office.12).aspx |
||
| 603 | */ |
||
| 604 | 4 | private function loadPowerpointDocumentStream() |
|
| 633 | |||
| 634 | /** |
||
| 635 | * Read a record header |
||
| 636 | * @param string $stream |
||
| 637 | * @param integer $pos |
||
| 638 | * @return array |
||
| 639 | */ |
||
| 640 | 4 | private function loadRecordHeader($stream, $pos) |
|
| 652 | |||
| 653 | /** |
||
| 654 | * Read 8-bit unsigned integer |
||
| 655 | * |
||
| 656 | * @param string $data |
||
| 657 | * @param int $pos |
||
| 658 | * @return int |
||
| 659 | */ |
||
| 660 | 4 | public static function getInt1d($data, $pos) |
|
| 664 | |||
| 665 | /** |
||
| 666 | * Read 16-bit unsigned integer |
||
| 667 | * |
||
| 668 | * @param string $data |
||
| 669 | * @param int $pos |
||
| 670 | * @return int |
||
| 671 | */ |
||
| 672 | 4 | public static function getInt2d($data, $pos) |
|
| 676 | |||
| 677 | /** |
||
| 678 | * Read 32-bit signed integer |
||
| 679 | * |
||
| 680 | * @param string $data |
||
| 681 | * @param int $pos |
||
| 682 | * @return int |
||
| 683 | */ |
||
| 684 | 4 | public static function getInt4d($data, $pos) |
|
| 698 | |||
| 699 | /** |
||
| 700 | * A container record that specifies the animation and sound information for a shape. |
||
| 701 | * @param string $stream |
||
| 702 | * @param integer $pos |
||
| 703 | * @return array |
||
| 704 | * @throws \Exception |
||
| 705 | * @link https://msdn.microsoft.com/en-us/library/dd772900(v=office.12).aspx |
||
| 706 | */ |
||
| 707 | 4 | private function readRecordAnimationInfoContainer($stream, $pos) |
|
| 724 | |||
| 725 | /** |
||
| 726 | * A container record that specifies information about the document. |
||
| 727 | * @param string $stream |
||
| 728 | * @param integer $pos |
||
| 729 | * @throws \Exception |
||
| 730 | * @link http://msdn.microsoft.com/en-us/library/dd947357(v=office.12).aspx |
||
| 731 | */ |
||
| 732 | 4 | private function readRecordDocumentContainer($stream, $pos) |
|
| 1010 | |||
| 1011 | /** |
||
| 1012 | * An atom record that specifies information about a slide. |
||
| 1013 | * @param string $stream |
||
| 1014 | * @param integer $pos |
||
| 1015 | * @return array |
||
| 1016 | * @throws \Exception |
||
| 1017 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 1018 | */ |
||
| 1019 | 4 | private function readRecordDrawingContainer($stream, $pos) |
|
| 1035 | |||
| 1036 | 4 | private function readRecordDrawingGroupContainer($stream, $pos) |
|
| 1051 | |||
| 1052 | /** |
||
| 1053 | * An atom record that specifies a reference to an external object. |
||
| 1054 | * @param string $stream |
||
| 1055 | * @param integer $pos |
||
| 1056 | * @return array |
||
| 1057 | * @link https://msdn.microsoft.com/en-us/library/dd910388(v=office.12).aspx |
||
| 1058 | */ |
||
| 1059 | 4 | private function readRecordExObjRefAtom($stream, $pos) |
|
| 1075 | |||
| 1076 | /** |
||
| 1077 | * An atom record that specifies a type of action to be performed. |
||
| 1078 | * @param string $stream |
||
| 1079 | * @param integer $pos |
||
| 1080 | * @return array |
||
| 1081 | * @link https://msdn.microsoft.com/en-us/library/dd953300(v=office.12).aspx |
||
| 1082 | */ |
||
| 1083 | 1 | private function readRecordInteractiveInfoAtom($stream, $pos) |
|
| 1118 | |||
| 1119 | /** |
||
| 1120 | * An atom record that specifies the name of a macro, a file name, or a named show. |
||
| 1121 | * @param string $stream |
||
| 1122 | * @param integer $pos |
||
| 1123 | * @return array |
||
| 1124 | * @link https://msdn.microsoft.com/en-us/library/dd925121(v=office.12).aspx |
||
| 1125 | */ |
||
| 1126 | 1 | private function readRecordMacroNameAtom($stream, $pos) |
|
| 1142 | |||
| 1143 | /** |
||
| 1144 | * A container record that specifies what actions to perform when interacting with an object by means of a mouse click. |
||
| 1145 | * @param string $stream |
||
| 1146 | * @param integer $pos |
||
| 1147 | * @return array |
||
| 1148 | * @link https://msdn.microsoft.com/en-us/library/dd952348(v=office.12).aspx |
||
| 1149 | */ |
||
| 1150 | 4 | private function readRecordMouseClickInteractiveInfoContainer($stream, $pos) |
|
| 1173 | |||
| 1174 | /** |
||
| 1175 | * A container record that specifies what actions to perform when interacting with an object by moving the mouse cursor over it. |
||
| 1176 | * @param string $stream |
||
| 1177 | * @param integer $pos |
||
| 1178 | * @return array |
||
| 1179 | * @throws \Exception |
||
| 1180 | * @link https://msdn.microsoft.com/en-us/library/dd925811(v=office.12).aspx |
||
| 1181 | */ |
||
| 1182 | 4 | private function readRecordMouseOverInteractiveInfoContainer($stream, $pos) |
|
| 1199 | |||
| 1200 | /** |
||
| 1201 | * The OfficeArtBlip record specifies BLIP file data. |
||
| 1202 | * @param string $stream |
||
| 1203 | * @param integer $pos |
||
| 1204 | * @return array |
||
| 1205 | * @throws \Exception |
||
| 1206 | * @link https://msdn.microsoft.com/en-us/library/dd910081(v=office.12).aspx |
||
| 1207 | */ |
||
| 1208 | 4 | private function readRecordOfficeArtBlip($stream, $pos) |
|
| 1245 | |||
| 1246 | /** |
||
| 1247 | * The OfficeArtChildAnchor record specifies four signed integers that specify the anchor for the shape that contains this record. |
||
| 1248 | * @param string $stream |
||
| 1249 | * @param integer $pos |
||
| 1250 | * @return array |
||
| 1251 | * @link https://msdn.microsoft.com/en-us/library/dd922720(v=office.12).aspx |
||
| 1252 | */ |
||
| 1253 | 4 | private function readRecordOfficeArtChildAnchor($stream, $pos) |
|
| 1276 | |||
| 1277 | /** |
||
| 1278 | * An atom record that specifies the location of a shape. |
||
| 1279 | * @param string $stream |
||
| 1280 | * @param integer $pos |
||
| 1281 | * @return array |
||
| 1282 | * @throws \Exception |
||
| 1283 | * @link https://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx |
||
| 1284 | */ |
||
| 1285 | 4 | private function readRecordOfficeArtClientAnchor($stream, $pos) |
|
| 1315 | |||
| 1316 | /** |
||
| 1317 | * A container record that specifies text related data for a shape. |
||
| 1318 | * @param string $stream |
||
| 1319 | * @param integer $pos |
||
| 1320 | * @return array |
||
| 1321 | * @throws \Exception |
||
| 1322 | * @link https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx |
||
| 1323 | */ |
||
| 1324 | 4 | private function readRecordOfficeArtClientTextbox($stream, $pos) |
|
| 1463 | |||
| 1464 | /** |
||
| 1465 | * The OfficeArtSpContainer record specifies a shape container. |
||
| 1466 | * @param string $stream |
||
| 1467 | * @param integer $pos |
||
| 1468 | * @return array |
||
| 1469 | * @throws \Exception |
||
| 1470 | * @link https://msdn.microsoft.com/en-us/library/dd943794(v=office.12).aspx |
||
| 1471 | */ |
||
| 1472 | 4 | private function readRecordOfficeArtSpContainer($stream, $pos) |
|
| 1719 | |||
| 1720 | /** |
||
| 1721 | * The OfficeArtSpgrContainer record specifies a container for groups of shapes. |
||
| 1722 | * @param string $stream |
||
| 1723 | * @param integer $pos |
||
| 1724 | * @param boolean $bInGroup |
||
| 1725 | * @return array |
||
| 1726 | * @throws \Exception |
||
| 1727 | * @link : https://msdn.microsoft.com/en-us/library/dd910416(v=office.12).aspx |
||
| 1728 | */ |
||
| 1729 | 4 | private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false) |
|
| 1793 | |||
| 1794 | /** |
||
| 1795 | * The OfficeArtTertiaryFOPT record specifies a table of OfficeArtRGFOPTE records,. |
||
| 1796 | * @param string $stream |
||
| 1797 | * @param integer $pos |
||
| 1798 | * @return array |
||
| 1799 | * @throws \Exception |
||
| 1800 | * @link https://msdn.microsoft.com/en-us/library/dd950206(v=office.12).aspx |
||
| 1801 | */ |
||
| 1802 | 4 | private function readRecordOfficeArtTertiaryFOPT($stream, $pos) |
|
| 1858 | |||
| 1859 | /** |
||
| 1860 | * The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing. |
||
| 1861 | * @param string $stream |
||
| 1862 | * @param integer $pos |
||
| 1863 | * @return array |
||
| 1864 | * @throws \Exception |
||
| 1865 | * @link : https://msdn.microsoft.com/en-us/library/dd924455(v=office.12).aspx |
||
| 1866 | */ |
||
| 1867 | 4 | private function readRecordOfficeArtDgContainer($stream, $pos) |
|
| 1898 | |||
| 1899 | /** |
||
| 1900 | * The OfficeArtFDG record specifies the number of shapes, the drawing identifier, and the shape identifier of the last shape in a drawing. |
||
| 1901 | * @param string $stream |
||
| 1902 | * @param integer $pos |
||
| 1903 | * @return array |
||
| 1904 | * @link : https://msdn.microsoft.com/en-us/library/dd946757(v=office.12).aspx |
||
| 1905 | */ |
||
| 1906 | 4 | private function readRecordOfficeArtFDG($stream, $pos) |
|
| 1922 | |||
| 1923 | /** |
||
| 1924 | * The OfficeArtFOPT record specifies a table of OfficeArtRGFOPTE records. |
||
| 1925 | * @param string $stream |
||
| 1926 | * @param integer $pos |
||
| 1927 | * @return array |
||
| 1928 | * @link https://msdn.microsoft.com/en-us/library/dd943404(v=office.12).aspx |
||
| 1929 | */ |
||
| 1930 | 4 | private function readRecordOfficeArtFOPT($stream, $pos) |
|
| 1931 | { |
||
| 1932 | $arrayReturn = array( |
||
| 1933 | 4 | 'length' => 0, |
|
| 1934 | ); |
||
| 1935 | |||
| 1936 | 4 | $data = $this->loadRecordHeader($stream, $pos); |
|
| 1937 | 4 | if ($data['recVer'] == 0x3 && $data['recType'] == 0xF00B) { |
|
| 1938 | // Record Header |
||
| 1939 | 4 | $arrayReturn['length'] += 8; |
|
| 1940 | |||
| 1941 | //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx |
||
| 1942 | 4 | $officeArtFOPTE = array(); |
|
| 1943 | 4 | for ($inc = 0; $inc < $data['recInstance']; $inc++) { |
|
| 1944 | 4 | $opid = self::getInt2d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); |
|
| 1945 | 4 | $arrayReturn['length'] += 2; |
|
| 1946 | 4 | $data['recLen'] -= 2; |
|
| 1947 | 4 | $optOp = self::getInt4d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); |
|
| 1948 | 4 | $arrayReturn['length'] += 4; |
|
| 1949 | 4 | $data['recLen'] -= 4; |
|
| 1950 | 4 | $officeArtFOPTE[] = array( |
|
| 1951 | 4 | 'opid' => ($opid >> 0) & bindec('11111111111111'), |
|
| 1952 | 4 | 'fBid' => ($opid >> 14) & bindec('1'), |
|
| 1953 | 4 | 'fComplex' => ($opid >> 15) & bindec('1'), |
|
| 1954 | 4 | 'op' => $optOp, |
|
| 1955 | ); |
||
| 1956 | } |
||
| 1957 | //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID |
||
| 1958 | 4 | foreach ($officeArtFOPTE as $opt) { |
|
| 1959 | // echo $opt['opid'].'-0x'.dechex($opt['opid']).EOL; |
||
| 1960 | 4 | switch ($opt['opid']) { |
|
| 1961 | 4 | case 0x0004: |
|
| 1962 | // Transform : rotation |
||
| 1963 | //@link : https://msdn.microsoft.com/en-us/library/dd949750(v=office.12).aspx |
||
| 1964 | $arrayReturn['rotation'] = $opt['op']; |
||
| 1965 | break; |
||
| 1966 | 4 | case 0x007F: |
|
| 1967 | // Transform : Protection Boolean Properties |
||
| 1968 | //@link : http://msdn.microsoft.com/en-us/library/dd909131(v=office.12).aspx |
||
| 1969 | 4 | break; |
|
| 1970 | 4 | case 0x0080: |
|
| 1971 | // Text : ltxid |
||
| 1972 | //@link : http://msdn.microsoft.com/en-us/library/dd947446(v=office.12).aspx |
||
| 1973 | 4 | break; |
|
| 1974 | 4 | case 0x0081: |
|
| 1975 | // Text : dxTextLeft |
||
| 1976 | //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx |
||
| 1977 | 4 | $arrayReturn['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1978 | 4 | break; |
|
| 1979 | 4 | case 0x0082: |
|
| 1980 | // Text : dyTextTop |
||
| 1981 | //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx |
||
| 1982 | 4 | $arrayReturn['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1983 | 4 | break; |
|
| 1984 | 4 | case 0x0083: |
|
| 1985 | // Text : dxTextRight |
||
| 1986 | //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx |
||
| 1987 | 4 | $arrayReturn['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1988 | 4 | break; |
|
| 1989 | 4 | case 0x0084: |
|
| 1990 | // Text : dyTextBottom |
||
| 1991 | //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx |
||
| 1992 | 4 | $arrayReturn['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1993 | 4 | break; |
|
| 1994 | 4 | case 0x0085: |
|
| 1995 | // Text : WrapText |
||
| 1996 | //@link : http://msdn.microsoft.com/en-us/library/dd924770(v=office.12).aspx |
||
| 1997 | 4 | break; |
|
| 1998 | 4 | case 0x0087: |
|
| 1999 | // Text : anchorText |
||
| 2000 | //@link : http://msdn.microsoft.com/en-us/library/dd948575(v=office.12).aspx |
||
| 2001 | 4 | break; |
|
| 2002 | 4 | case 0x00BF: |
|
| 2003 | // Text : Text Boolean Properties |
||
| 2004 | //@link : http://msdn.microsoft.com/en-us/library/dd950905(v=office.12).aspx |
||
| 2005 | 4 | break; |
|
| 2006 | 4 | case 0x0104: |
|
| 2007 | // Blip : pib |
||
| 2008 | //@link : http://msdn.microsoft.com/en-us/library/dd772837(v=office.12).aspx |
||
| 2009 | 4 | if ($opt['fComplex'] == 0) { |
|
| 2010 | 4 | $arrayReturn['pib'] = $opt['op']; |
|
| 2011 | 4 | $data['recLen'] -= $opt['op']; |
|
| 2012 | } else { |
||
| 2013 | // pib Complex |
||
| 2014 | } |
||
| 2015 | 4 | break; |
|
| 2016 | 4 | case 0x13F: |
|
| 2017 | // Blip Boolean Properties |
||
| 2018 | //@link : https://msdn.microsoft.com/en-us/library/dd944215(v=office.12).aspx |
||
| 2019 | break; |
||
| 2020 | 4 | case 0x140: |
|
| 2021 | // Geometry : geoLeft |
||
| 2022 | //@link : http://msdn.microsoft.com/en-us/library/dd947489(v=office.12).aspx |
||
| 2023 | // print_r('geoLeft : '.$opt['op'].EOL); |
||
| 2024 | 2 | break; |
|
| 2025 | 4 | case 0x141: |
|
| 2026 | // Geometry : geoTop |
||
| 2027 | //@link : http://msdn.microsoft.com/en-us/library/dd949459(v=office.12).aspx |
||
| 2028 | // print_r('geoTop : '.$opt['op'].EOL); |
||
| 2029 | 2 | break; |
|
| 2030 | 4 | case 0x142: |
|
| 2031 | // Geometry : geoRight |
||
| 2032 | //@link : http://msdn.microsoft.com/en-us/library/dd947117(v=office.12).aspx |
||
| 2033 | // print_r('geoRight : '.$opt['op'].EOL); |
||
| 2034 | 2 | break; |
|
| 2035 | 4 | case 0x143: |
|
| 2036 | // Geometry : geoBottom |
||
| 2037 | //@link : http://msdn.microsoft.com/en-us/library/dd948602(v=office.12).aspx |
||
| 2038 | // print_r('geoBottom : '.$opt['op'].EOL); |
||
| 2039 | 2 | break; |
|
| 2040 | 4 | case 0x144: |
|
| 2041 | // Geometry : shapePath |
||
| 2042 | //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx |
||
| 2043 | 1 | $arrayReturn['line'] = true; |
|
| 2044 | 1 | break; |
|
| 2045 | 4 | case 0x145: |
|
| 2046 | // Geometry : pVertices |
||
| 2047 | //@link : http://msdn.microsoft.com/en-us/library/dd949814(v=office.12).aspx |
||
| 2048 | 2 | if ($opt['fComplex'] == 1) { |
|
| 2049 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 2050 | 2 | $data['recLen'] -= $opt['op']; |
|
| 2051 | } |
||
| 2052 | 2 | break; |
|
| 2053 | 4 | case 0x146: |
|
| 2054 | // Geometry : pSegmentInfo |
||
| 2055 | //@link : http://msdn.microsoft.com/en-us/library/dd905742(v=office.12).aspx |
||
| 2056 | 2 | if ($opt['fComplex'] == 1) { |
|
| 2057 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 2058 | 2 | $data['recLen'] -= $opt['op']; |
|
| 2059 | } |
||
| 2060 | 2 | break; |
|
| 2061 | 4 | case 0x155: |
|
| 2062 | // Geometry : pAdjustHandles |
||
| 2063 | //@link : http://msdn.microsoft.com/en-us/library/dd905890(v=office.12).aspx |
||
| 2064 | 2 | if ($opt['fComplex'] == 1) { |
|
| 2065 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 2066 | 2 | $data['recLen'] -= $opt['op']; |
|
| 2067 | } |
||
| 2068 | 2 | break; |
|
| 2069 | 4 | case 0x156: |
|
| 2070 | // Geometry : pGuides |
||
| 2071 | //@link : http://msdn.microsoft.com/en-us/library/dd910801(v=office.12).aspx |
||
| 2072 | 2 | if ($opt['fComplex'] == 1) { |
|
| 2073 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 2074 | 2 | $data['recLen'] -= $opt['op']; |
|
| 2075 | } |
||
| 2076 | 2 | break; |
|
| 2077 | 4 | case 0x157: |
|
| 2078 | // Geometry : pInscribe |
||
| 2079 | //@link : http://msdn.microsoft.com/en-us/library/dd904889(v=office.12).aspx |
||
| 2080 | 2 | if ($opt['fComplex'] == 1) { |
|
| 2081 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 2082 | 2 | $data['recLen'] -= $opt['op']; |
|
| 2083 | } |
||
| 2084 | 2 | break; |
|
| 2085 | 4 | case 0x17F: |
|
| 2086 | // Geometry Boolean Properties |
||
| 2087 | //@link : http://msdn.microsoft.com/en-us/library/dd944968(v=office.12).aspx |
||
| 2088 | 1 | break; |
|
| 2089 | 4 | case 0x0180: |
|
| 2090 | // Fill : fillType |
||
| 2091 | //@link : http://msdn.microsoft.com/en-us/library/dd947909(v=office.12).aspx |
||
| 2092 | 4 | break; |
|
| 2093 | 4 | case 0x0181: |
|
| 2094 | // Fill : fillColor |
||
| 2095 | //@link : http://msdn.microsoft.com/en-us/library/dd921332(v=office.12).aspx |
||
| 2096 | 4 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2097 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2098 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2099 | // echo 'fillColor : '.$strColor.EOL; |
||
| 2100 | 4 | break; |
|
| 2101 | 4 | case 0x0183: |
|
| 2102 | // Fill : fillBackColor |
||
| 2103 | //@link : http://msdn.microsoft.com/en-us/library/dd950634(v=office.12).aspx |
||
| 2104 | 4 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2105 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2106 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2107 | // echo 'fillBackColor : '.$strColor.EOL; |
||
| 2108 | 4 | break; |
|
| 2109 | 4 | case 0x0193: |
|
| 2110 | // Fill : fillRectRight |
||
| 2111 | //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx |
||
| 2112 | // echo 'fillRectRight : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; |
||
| 2113 | 4 | break; |
|
| 2114 | 4 | case 0x0194: |
|
| 2115 | // Fill : fillRectBottom |
||
| 2116 | //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx |
||
| 2117 | // echo 'fillRectBottom : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; |
||
| 2118 | 4 | break; |
|
| 2119 | 4 | case 0x01BF: |
|
| 2120 | // Fill : Fill Style Boolean Properties |
||
| 2121 | //@link : http://msdn.microsoft.com/en-us/library/dd909380(v=office.12).aspx |
||
| 2122 | 4 | break; |
|
| 2123 | 4 | case 0x01C0: |
|
| 2124 | // Line Style : lineColor |
||
| 2125 | //@link : http://msdn.microsoft.com/en-us/library/dd920397(v=office.12).aspx |
||
| 2126 | 4 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2127 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2128 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 2129 | 4 | $arrayReturn['lineColor'] = $strColor; |
|
| 2130 | 4 | break; |
|
| 2131 | 4 | case 0x01C1: |
|
| 2132 | // Line Style : lineOpacity |
||
| 2133 | //@link : http://msdn.microsoft.com/en-us/library/dd923433(v=office.12).aspx |
||
| 2134 | // echo 'lineOpacity : '.dechex($opt['op']).EOL; |
||
| 2135 | 4 | break; |
|
| 2136 | 4 | case 0x01C2: |
|
| 2137 | // Line Style : lineBackColor |
||
| 2138 | //@link : http://msdn.microsoft.com/en-us/library/dd947669(v=office.12).aspx |
||
| 2139 | 4 | break; |
|
| 2140 | 4 | case 0x01CB: |
|
| 2141 | // Line Style : lineWidth |
||
| 2142 | //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx |
||
| 2143 | 2 | $arrayReturn['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 2144 | 2 | break; |
|
| 2145 | 4 | case 0x01D6: |
|
| 2146 | // Line Style : lineJoinStyle |
||
| 2147 | //@link : http://msdn.microsoft.com/en-us/library/dd909643(v=office.12).aspx |
||
| 2148 | 4 | break; |
|
| 2149 | 4 | case 0x01D7: |
|
| 2150 | // Line Style : lineEndCapStyle |
||
| 2151 | //@link : http://msdn.microsoft.com/en-us/library/dd925071(v=office.12).aspx |
||
| 2152 | 4 | break; |
|
| 2153 | 4 | case 0x01FF: |
|
| 2154 | // Line Style : Line Style Boolean Properties |
||
| 2155 | //@link : http://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx |
||
| 2156 | 4 | break; |
|
| 2157 | 4 | case 0x0201: |
|
| 2158 | // Shadow Style : shadowColor |
||
| 2159 | //@link : http://msdn.microsoft.com/en-us/library/dd923454(v=office.12).aspx |
||
| 2160 | 4 | break; |
|
| 2161 | 4 | case 0x0204: |
|
| 2162 | // Shadow Style : shadowOpacity |
||
| 2163 | //@link : http://msdn.microsoft.com/en-us/library/dd920720(v=office.12).aspx |
||
| 2164 | 3 | break; |
|
| 2165 | 4 | case 0x0205: |
|
| 2166 | // Shadow Style : shadowOffsetX |
||
| 2167 | //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx |
||
| 2168 | 3 | $arrayReturn['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 2169 | 3 | break; |
|
| 2170 | 4 | case 0x0206: |
|
| 2171 | // Shadow Style : shadowOffsetY |
||
| 2172 | //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx |
||
| 2173 | 3 | $arrayReturn['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 2174 | 3 | break; |
|
| 2175 | 4 | case 0x023F: |
|
| 2176 | // Shadow Style : Shadow Style Boolean Properties |
||
| 2177 | //@link : http://msdn.microsoft.com/en-us/library/dd947887(v=office.12).aspx |
||
| 2178 | 4 | break; |
|
| 2179 | 4 | case 0x0304: |
|
| 2180 | // Shape : bWMode |
||
| 2181 | //@link : http://msdn.microsoft.com/en-us/library/dd947659(v=office.12).aspx |
||
| 2182 | 4 | break; |
|
| 2183 | 4 | case 0x033F: |
|
| 2184 | // Shape Boolean Properties |
||
| 2185 | //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx |
||
| 2186 | 4 | break; |
|
| 2187 | 1 | case 0x0380: |
|
| 2188 | // Group Shape Property Set : wzName |
||
| 2189 | //@link : http://msdn.microsoft.com/en-us/library/dd950681(v=office.12).aspx |
||
| 2190 | if ($opt['fComplex'] == 1) { |
||
| 2191 | $arrayReturn['length'] += $opt['op']; |
||
| 2192 | $data['recLen'] -= $opt['op']; |
||
| 2193 | } |
||
| 2194 | break; |
||
| 2195 | 1 | case 0x03BF: |
|
| 2196 | // Group Shape Property Set : Group Shape Boolean Properties |
||
| 2197 | //@link : http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx |
||
| 2198 | break; |
||
| 2199 | default: |
||
| 2200 | // throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); |
||
| 2201 | } |
||
| 2202 | } |
||
| 2203 | 4 | if ($data['recLen'] > 0) { |
|
| 2204 | 2 | $arrayReturn['length'] += $data['recLen']; |
|
| 2205 | } |
||
| 2206 | } |
||
| 2207 | |||
| 2208 | 4 | return $arrayReturn; |
|
| 2209 | } |
||
| 2210 | |||
| 2211 | /** |
||
| 2212 | * The OfficeArtFPSPL record specifies the former hierarchical position of the containing object that is either a shape or a group of shapes. |
||
| 2213 | * @param string $stream |
||
| 2214 | * @param integer $pos |
||
| 2215 | * @return array |
||
| 2216 | * @link https://msdn.microsoft.com/en-us/library/dd947479(v=office.12).aspx |
||
| 2217 | */ |
||
| 2218 | private function readRecordOfficeArtFPSPL($stream, $pos) |
||
| 2232 | |||
| 2233 | /** |
||
| 2234 | * The OfficeArtFSP record specifies an instance of a shape. |
||
| 2235 | * @param string $stream |
||
| 2236 | * @param integer $pos |
||
| 2237 | * @return array |
||
| 2238 | * @link https://msdn.microsoft.com/en-us/library/dd925898(v=office.12).aspx |
||
| 2239 | */ |
||
| 2240 | 4 | private function readRecordOfficeArtFSP($stream, $pos) |
|
| 2262 | |||
| 2263 | /** |
||
| 2264 | * The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in. |
||
| 2265 | * @param string $stream |
||
| 2266 | * @param integer $pos |
||
| 2267 | * @return array |
||
| 2268 | * @link https://msdn.microsoft.com/en-us/library/dd925381(v=office.12).aspx |
||
| 2269 | */ |
||
| 2270 | 4 | private function readRecordOfficeArtFSPGR($stream, $pos) |
|
| 2291 | |||
| 2292 | /** |
||
| 2293 | * The OfficeArtSecondaryFOPT record specifies a table of OfficeArtRGFOPTE records. |
||
| 2294 | * @param string $stream |
||
| 2295 | * @param integer $pos |
||
| 2296 | * @return array |
||
| 2297 | * @link https://msdn.microsoft.com/en-us/library/dd950259(v=office.12).aspx |
||
| 2298 | */ |
||
| 2299 | 4 | private function readRecordOfficeArtSecondaryFOPT($stream, $pos) |
|
| 2314 | |||
| 2315 | /** |
||
| 2316 | * A container record that specifies information about a shape. |
||
| 2317 | * @param string $stream |
||
| 2318 | * @param integer $pos |
||
| 2319 | * @return array |
||
| 2320 | * @throws \Exception |
||
| 2321 | * @link : https://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx |
||
| 2322 | */ |
||
| 2323 | 4 | private function readRecordOfficeArtClientData($stream, $pos) |
|
| 2397 | |||
| 2398 | /** |
||
| 2399 | * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. |
||
| 2400 | * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx |
||
| 2401 | * @param string $stream |
||
| 2402 | * @param integer $pos |
||
| 2403 | * @throws \Exception |
||
| 2404 | */ |
||
| 2405 | 4 | private function readRecordPersistDirectoryAtom($stream, $pos) |
|
| 2430 | |||
| 2431 | /** |
||
| 2432 | * A container record that specifies information about the headers (1) and footers within a slide. |
||
| 2433 | * @param string $stream |
||
| 2434 | * @param integer $pos |
||
| 2435 | * @link https://msdn.microsoft.com/en-us/library/dd904856(v=office.12).aspx |
||
| 2436 | * @return array |
||
| 2437 | */ |
||
| 2438 | 4 | private function readRecordPerSlideHeadersFootersContainer($stream, $pos) |
|
| 2454 | |||
| 2455 | /** |
||
| 2456 | * An atom record that specifies whether a shape is a placeholder shape. |
||
| 2457 | * @param string $stream |
||
| 2458 | * @param integer $pos |
||
| 2459 | * @link https://msdn.microsoft.com/en-us/library/dd923930(v=office.12).aspx |
||
| 2460 | * @return array |
||
| 2461 | */ |
||
| 2462 | 4 | private function readRecordPlaceholderAtom($stream, $pos) |
|
| 2478 | |||
| 2479 | /** |
||
| 2480 | * An atom record that specifies a collection of re-color mappings for a metafile ([MS-WMF]). |
||
| 2481 | * @param string $stream |
||
| 2482 | * @param integer $pos |
||
| 2483 | * @link https://msdn.microsoft.com/en-us/library/dd904899(v=office.12).aspx |
||
| 2484 | * @return array |
||
| 2485 | */ |
||
| 2486 | 4 | private function readRecordRecolorInfoAtom($stream, $pos) |
|
| 2502 | |||
| 2503 | /** |
||
| 2504 | * An atom record that specifies that a shape is a header or footerplaceholder shape. |
||
| 2505 | * @param string $stream |
||
| 2506 | * @param integer $pos |
||
| 2507 | * @link https://msdn.microsoft.com/en-us/library/dd910800(v=office.12).aspx |
||
| 2508 | * @return array |
||
| 2509 | */ |
||
| 2510 | private function readRecordRoundTripHFPlaceholder12Atom($stream, $pos) |
||
| 2526 | |||
| 2527 | /** |
||
| 2528 | * An atom record that specifies a shape identifier. |
||
| 2529 | * @param string $stream |
||
| 2530 | * @param integer $pos |
||
| 2531 | * @link https://msdn.microsoft.com/en-us/library/dd772926(v=office.12).aspx |
||
| 2532 | * @return array |
||
| 2533 | */ |
||
| 2534 | private function readRecordRoundTripShapeId12Atom($stream, $pos) |
||
| 2550 | |||
| 2551 | /** |
||
| 2552 | * A container record that specifies information about a slide that synchronizes to a slide in a slide library. |
||
| 2553 | * @param string $stream |
||
| 2554 | * @param integer $pos |
||
| 2555 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 2556 | * @return array |
||
| 2557 | */ |
||
| 2558 | 4 | private function readRecordRoundTripSlideSyncInfo12Container($stream, $pos) |
|
| 2574 | |||
| 2575 | /** |
||
| 2576 | * An atom record that specifies shape-level Boolean flags. |
||
| 2577 | * @param string $stream |
||
| 2578 | * @param integer $pos |
||
| 2579 | * @link https://msdn.microsoft.com/en-us/library/dd908949(v=office.12).aspx |
||
| 2580 | * @return array |
||
| 2581 | */ |
||
| 2582 | 4 | private function readRecordShapeFlags10Atom($stream, $pos) |
|
| 2598 | |||
| 2599 | /** |
||
| 2600 | * An atom record that specifies shape-level Boolean flags. |
||
| 2601 | * @param string $stream |
||
| 2602 | * @param integer $pos |
||
| 2603 | * @link https://msdn.microsoft.com/en-us/library/dd925824(v=office.12).aspx |
||
| 2604 | * @return array |
||
| 2605 | */ |
||
| 2606 | 4 | private function readRecordShapeFlagsAtom($stream, $pos) |
|
| 2622 | |||
| 2623 | /** |
||
| 2624 | * A container record that specifies programmable tags with additional binary shape data. |
||
| 2625 | * @param string $stream |
||
| 2626 | * @param integer $pos |
||
| 2627 | * @link https://msdn.microsoft.com/en-us/library/dd911033(v=office.12).aspx |
||
| 2628 | * @return array |
||
| 2629 | */ |
||
| 2630 | private function readRecordShapeProgBinaryTagContainer($stream, $pos) |
||
| 2646 | |||
| 2647 | /** |
||
| 2648 | * A container record that specifies programmable tags with additional shape data. |
||
| 2649 | * @param string $stream |
||
| 2650 | * @param integer $pos |
||
| 2651 | * @return array |
||
| 2652 | * @throws \Exception |
||
| 2653 | * @link https://msdn.microsoft.com/en-us/library/dd911266(v=office.12).aspx |
||
| 2654 | */ |
||
| 2655 | private function readRecordShapeProgTagsContainer($stream, $pos) |
||
| 2685 | |||
| 2686 | /** |
||
| 2687 | * An atom record that specifies information about a slide. |
||
| 2688 | * @param string $stream |
||
| 2689 | * @param integer $pos |
||
| 2690 | * @return array |
||
| 2691 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 2692 | */ |
||
| 2693 | 4 | private function readRecordSlideAtom($stream, $pos) |
|
| 2724 | |||
| 2725 | /** |
||
| 2726 | * A container record that specifies a presentation slide or title master slide. |
||
| 2727 | * @param string $stream |
||
| 2728 | * @param int $pos |
||
| 2729 | * @throws \Exception |
||
| 2730 | * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx |
||
| 2731 | */ |
||
| 2732 | 4 | private function readRecordSlideContainer($stream, $pos) |
|
| 2778 | |||
| 2779 | /** |
||
| 2780 | * An atom record that specifies the name of a slide. |
||
| 2781 | * @param string $stream |
||
| 2782 | * @param integer $pos |
||
| 2783 | * @link https://msdn.microsoft.com/en-us/library/dd906297(v=office.12).aspx |
||
| 2784 | * @return array |
||
| 2785 | */ |
||
| 2786 | 4 | private function readRecordSlideNameAtom($stream, $pos) |
|
| 2808 | |||
| 2809 | /** |
||
| 2810 | * An atom record that specifies a slide number metacharacter. |
||
| 2811 | * @param string $stream |
||
| 2812 | * @param integer $pos |
||
| 2813 | * @link https://msdn.microsoft.com/en-us/library/dd945703(v=office.12).aspx |
||
| 2814 | * @return array |
||
| 2815 | */ |
||
| 2816 | 4 | private function readRecordSlideNumberMCAtom($stream, $pos) |
|
| 2832 | |||
| 2833 | /** |
||
| 2834 | * A container record that specifies programmable tags with additional slide data. |
||
| 2835 | * @param string $stream |
||
| 2836 | * @param integer $pos |
||
| 2837 | * @link https://msdn.microsoft.com/en-us/library/dd951946(v=office.12).aspx |
||
| 2838 | * @return array |
||
| 2839 | */ |
||
| 2840 | 4 | private function readRecordSlideProgTagsContainer($stream, $pos) |
|
| 2856 | |||
| 2857 | /** |
||
| 2858 | * A container record that specifies the color scheme used by a slide. |
||
| 2859 | * @param string $stream |
||
| 2860 | * @param integer $pos |
||
| 2861 | * @link https://msdn.microsoft.com/en-us/library/dd949420(v=office.12).aspx |
||
| 2862 | * @return array |
||
| 2863 | */ |
||
| 2864 | 4 | private function readRecordSlideSchemeColorSchemeAtom($stream, $pos) |
|
| 2888 | |||
| 2889 | /** |
||
| 2890 | * An atom record that specifies what transition effect to perform during a slide show, and how to advance to the next presentation slide. |
||
| 2891 | * @param string $stream |
||
| 2892 | * @param integer $pos |
||
| 2893 | * @link https://msdn.microsoft.com/en-us/library/dd943408(v=office.12).aspx |
||
| 2894 | * @return array |
||
| 2895 | */ |
||
| 2896 | 4 | private function readRecordSlideShowSlideInfoAtom($stream, $pos) |
|
| 2912 | |||
| 2913 | /** |
||
| 2914 | * UserEditAtom |
||
| 2915 | * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx |
||
| 2916 | * @param string $stream |
||
| 2917 | * @param integer $pos |
||
| 2918 | * @throws \Exception |
||
| 2919 | */ |
||
| 2920 | 4 | private function readRecordUserEditAtom($stream, $pos) |
|
| 2967 | |||
| 2968 | /** |
||
| 2969 | * A structure that specifies the character-level formatting of a run of text. |
||
| 2970 | * @param string $stream |
||
| 2971 | * @param int $pos |
||
| 2972 | * @param int $strLenRT |
||
| 2973 | * @return array |
||
| 2974 | * @throws \Exception |
||
| 2975 | * @link https://msdn.microsoft.com/en-us/library/dd945870(v=office.12).aspx |
||
| 2976 | */ |
||
| 2977 | 4 | private function readStructureTextCFRun($stream, $pos, $strLenRT) |
|
| 3084 | |||
| 3085 | /** |
||
| 3086 | * A structure that specifies the paragraph-level formatting of a run of text. |
||
| 3087 | * @param string $stream |
||
| 3088 | * @param integer $pos |
||
| 3089 | * @param integer $strLenRT |
||
| 3090 | * @return array |
||
| 3091 | * @throws \Exception |
||
| 3092 | * @link https://msdn.microsoft.com/en-us/library/dd923535(v=office.12).aspx |
||
| 3093 | */ |
||
| 3094 | 4 | private function readStructureTextPFRun($stream, $pos, $strLenRT) |
|
| 3095 | { |
||
| 3096 | $arrayReturn = array( |
||
| 3097 | 4 | 'length' => 0, |
|
| 3098 | 4 | 'strLenRT' => $strLenRT, |
|
| 3099 | ); |
||
| 3100 | |||
| 3101 | // rgTextPFRun |
||
| 3102 | 4 | $countRgTextPFRun = self::getInt4d($stream, $pos + $arrayReturn['length']); |
|
| 3103 | 4 | $arrayReturn['strLenRT'] -= $countRgTextPFRun; |
|
| 3104 | 4 | $arrayReturn['length'] += 4; |
|
| 3105 | |||
| 3106 | // indent |
||
| 3107 | 4 | $arrayReturn['length'] += 2; |
|
| 3108 | |||
| 3109 | 4 | $masks = self::getInt4d($stream, $pos + $arrayReturn['length']); |
|
| 3110 | 4 | $arrayReturn['length'] += 4; |
|
| 3111 | |||
| 3112 | 4 | $masksData = array(); |
|
| 3113 | 4 | $masksData['hasBullet'] = ($masks >> 0) & bindec('1'); |
|
| 3114 | 4 | $masksData['bulletHasFont'] = ($masks >> 1) & bindec('1'); |
|
| 3115 | 4 | $masksData['bulletHasColor'] = ($masks >> 2) & bindec('1'); |
|
| 3116 | 4 | $masksData['bulletHasSize'] = ($masks >> 3) & bindec('1'); |
|
| 3117 | 4 | $masksData['bulletFont'] = ($masks >> 4) & bindec('1'); |
|
| 3118 | 4 | $masksData['bulletColor'] = ($masks >> 5) & bindec('1'); |
|
| 3119 | 4 | $masksData['bulletSize'] = ($masks >> 6) & bindec('1'); |
|
| 3120 | 4 | $masksData['bulletChar'] = ($masks >> 7) & bindec('1'); |
|
| 3121 | 4 | $masksData['leftMargin'] = ($masks >> 8) & bindec('1'); |
|
| 3122 | 4 | $masksData['unused'] = ($masks >> 9) & bindec('1'); |
|
| 3123 | 4 | $masksData['indent'] = ($masks >> 10) & bindec('1'); |
|
| 3124 | 4 | $masksData['align'] = ($masks >> 11) & bindec('1'); |
|
| 3125 | 4 | $masksData['lineSpacing'] = ($masks >> 12) & bindec('1'); |
|
| 3126 | 4 | $masksData['spaceBefore'] = ($masks >> 13) & bindec('1'); |
|
| 3127 | 4 | $masksData['spaceAfter'] = ($masks >> 14) & bindec('1'); |
|
| 3128 | 4 | $masksData['defaultTabSize'] = ($masks >> 15) & bindec('1'); |
|
| 3129 | 4 | $masksData['fontAlign'] = ($masks >> 16) & bindec('1'); |
|
| 3130 | 4 | $masksData['charWrap'] = ($masks >> 17) & bindec('1'); |
|
| 3131 | 4 | $masksData['wordWrap'] = ($masks >> 18) & bindec('1'); |
|
| 3132 | 4 | $masksData['overflow'] = ($masks >> 19) & bindec('1'); |
|
| 3133 | 4 | $masksData['tabStops'] = ($masks >> 20) & bindec('1'); |
|
| 3134 | 4 | $masksData['textDirection'] = ($masks >> 21) & bindec('1'); |
|
| 3135 | 4 | $masksData['reserved1'] = ($masks >> 22) & bindec('1'); |
|
| 3136 | 4 | $masksData['bulletBlip'] = ($masks >> 23) & bindec('1'); |
|
| 3137 | 4 | $masksData['bulletScheme'] = ($masks >> 24) & bindec('1'); |
|
| 3138 | 4 | $masksData['bulletHasScheme'] = ($masks >> 25) & bindec('1'); |
|
| 3139 | |||
| 3140 | 4 | $bulletFlags = array(); |
|
| 3141 | 4 | if ($masksData['hasBullet'] == 1 || $masksData['bulletHasFont'] == 1 || $masksData['bulletHasColor'] == 1 || $masksData['bulletHasSize'] == 1) { |
|
| 3142 | 4 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3143 | 4 | $arrayReturn['length'] += 2; |
|
| 3144 | |||
| 3145 | 4 | $bulletFlags['fHasBullet'] = ($data >> 0) & bindec('1'); |
|
| 3146 | 4 | $bulletFlags['fBulletHasFont'] = ($data >> 1) & bindec('1'); |
|
| 3147 | 4 | $bulletFlags['fBulletHasColor'] = ($data >> 2) & bindec('1'); |
|
| 3148 | 4 | $bulletFlags['fBulletHasSize'] = ($data >> 3) & bindec('1'); |
|
| 3149 | } |
||
| 3150 | 4 | if ($masksData['bulletChar'] == 1) { |
|
| 3151 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3152 | 1 | $arrayReturn['length'] += 2; |
|
| 3153 | 1 | $arrayReturn['bulletChar'] = chr($data); |
|
| 3154 | } |
||
| 3155 | 4 | if ($masksData['bulletFont'] == 1) { |
|
| 3156 | // $data = self::getInt2d($stream, $pos); |
||
| 3157 | 1 | $arrayReturn['length'] += 2; |
|
| 3158 | } |
||
| 3159 | 4 | if ($masksData['bulletSize'] == 1) { |
|
| 3160 | // $data = self::getInt2d($stream, $pos); |
||
| 3161 | 2 | $arrayReturn['length'] += 2; |
|
| 3162 | } |
||
| 3163 | 4 | if ($masksData['bulletColor'] == 1) { |
|
| 3164 | 1 | $red = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 3165 | 1 | $arrayReturn['length'] += 1; |
|
| 3166 | 1 | $green = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 3167 | 1 | $arrayReturn['length'] += 1; |
|
| 3168 | 1 | $blue = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 3169 | 1 | $arrayReturn['length'] += 1; |
|
| 3170 | 1 | $index = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 3171 | 1 | $arrayReturn['length'] += 1; |
|
| 3172 | |||
| 3173 | 1 | if ($index == 0xFE) { |
|
| 3174 | 1 | $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); |
|
| 3175 | 1 | $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); |
|
| 3176 | 1 | $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); |
|
| 3177 | } |
||
| 3178 | } |
||
| 3179 | 4 | if ($masksData['align'] == 1) { |
|
| 3180 | 4 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3181 | 4 | $arrayReturn['length'] += 2; |
|
| 3182 | 4 | switch ($data) { |
|
| 3183 | 4 | case 0x0000: |
|
| 3184 | 1 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_LEFT; |
|
| 3185 | 1 | break; |
|
| 3186 | 4 | case 0x0001: |
|
| 3187 | 2 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_CENTER; |
|
| 3188 | 2 | break; |
|
| 3189 | 4 | case 0x0002: |
|
| 3190 | 4 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_RIGHT; |
|
| 3191 | 4 | break; |
|
| 3192 | case 0x0003: |
||
| 3193 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; |
||
| 3194 | break; |
||
| 3195 | case 0x0004: |
||
| 3196 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; |
||
| 3197 | break; |
||
| 3198 | case 0x0005: |
||
| 3199 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; |
||
| 3200 | break; |
||
| 3201 | case 0x0006: |
||
| 3202 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; |
||
| 3203 | break; |
||
| 3204 | default: |
||
| 3205 | break; |
||
| 3206 | } |
||
| 3207 | } |
||
| 3208 | 4 | if ($masksData['lineSpacing'] == 1) { |
|
| 3209 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3210 | 4 | $arrayReturn['length'] += 2; |
|
| 3211 | } |
||
| 3212 | 4 | if ($masksData['spaceBefore'] == 1) { |
|
| 3213 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3214 | 2 | $arrayReturn['length'] += 2; |
|
| 3215 | } |
||
| 3216 | 4 | if ($masksData['spaceAfter'] == 1) { |
|
| 3217 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3218 | 2 | $arrayReturn['length'] += 2; |
|
| 3219 | } |
||
| 3220 | 4 | if ($masksData['leftMargin'] == 1) { |
|
| 3221 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3222 | 1 | $arrayReturn['length'] += 2; |
|
| 3223 | 1 | $arrayReturn['leftMargin'] = (int)round($data/6); |
|
| 3224 | } |
||
| 3225 | 4 | if ($masksData['indent'] == 1) { |
|
| 3226 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3227 | 1 | $arrayReturn['length'] += 2; |
|
| 3228 | 1 | $arrayReturn['indent'] = (int)round($data/6); |
|
| 3229 | } |
||
| 3230 | 4 | if ($masksData['defaultTabSize'] == 1) { |
|
| 3231 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3232 | $arrayReturn['length'] += 2; |
||
| 3233 | } |
||
| 3234 | 4 | if ($masksData['tabStops'] == 1) { |
|
| 3235 | throw new \Exception('Feature not implemented (l.'.__LINE__.')'); |
||
| 3236 | } |
||
| 3237 | 4 | if ($masksData['fontAlign'] == 1) { |
|
| 3238 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3239 | $arrayReturn['length'] += 2; |
||
| 3240 | } |
||
| 3241 | 4 | if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { |
|
| 3242 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3243 | 4 | $arrayReturn['length'] += 2; |
|
| 3244 | } |
||
| 3245 | 4 | if ($masksData['textDirection'] == 1) { |
|
| 3246 | throw new \Exception('Feature not implemented (l.'.__LINE__.')'); |
||
| 3247 | } |
||
| 3248 | |||
| 3249 | 4 | return $arrayReturn; |
|
| 3250 | } |
||
| 3251 | |||
| 3252 | /** |
||
| 3253 | * A structure that specifies language and spelling information for a run of text. |
||
| 3254 | * @param string $stream |
||
| 3255 | * @param integer $pos |
||
| 3256 | * @param string $strLenRT |
||
| 3257 | * @return array |
||
| 3258 | * @throws \Exception |
||
| 3259 | * @link https://msdn.microsoft.com/en-us/library/dd909603(v=office.12).aspx |
||
| 3260 | */ |
||
| 3261 | 4 | private function readStructureTextSIRun($stream, $pos, $strLenRT) |
|
| 3313 | |||
| 3314 | /** |
||
| 3315 | * A structure that specifies tabbing, margins, and indentation for text. |
||
| 3316 | * @param string $stream |
||
| 3317 | * @param integer $pos |
||
| 3318 | * @return array |
||
| 3319 | * @throws \Exception |
||
| 3320 | * @link https://msdn.microsoft.com/en-us/library/dd922749(v=office.12).aspx |
||
| 3321 | */ |
||
| 3322 | 4 | private function readStructureTextRuler($stream, $pos) |
|
| 3410 | |||
| 3411 | /** |
||
| 3412 | * @param $stream |
||
| 3413 | * @param int $pos |
||
| 3414 | * @throws \Exception |
||
| 3415 | */ |
||
| 3416 | 4 | private function readRecordNotesContainer($stream, $pos) |
|
| 3431 | |||
| 3432 | /** |
||
| 3433 | * @param $stream |
||
| 3434 | * @param int $pos |
||
| 3435 | * @return array |
||
| 3436 | * @throws \Exception |
||
| 3437 | */ |
||
| 3438 | 4 | private function readRecordNotesAtom($stream, $pos) |
|
| 3465 | } |
||
| 3466 |