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 |
||
| 38 | class PowerPoint97 implements ReaderInterface |
||
| 39 | { |
||
| 40 | const OFFICEARTBLIPEMF = 0xF01A; |
||
| 41 | const OFFICEARTBLIPWMF = 0xF01B; |
||
| 42 | const OFFICEARTBLIPPICT = 0xF01C; |
||
| 43 | const OFFICEARTBLIPJPG = 0xF01D; |
||
| 44 | const OFFICEARTBLIPPNG = 0xF01E; |
||
| 45 | const OFFICEARTBLIPDIB = 0xF01F; |
||
| 46 | const OFFICEARTBLIPTIFF = 0xF029; |
||
| 47 | const OFFICEARTBLIPJPEG = 0xF02A; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @link http://msdn.microsoft.com/en-us/library/dd945336(v=office.12).aspx |
||
| 51 | */ |
||
| 52 | const RT_ANIMATIONINFO = 0x1014; |
||
| 53 | const RT_ANIMATIONINFOATOM = 0x0FF1; |
||
| 54 | const RT_BINARYTAGDATABLOB = 0x138B; |
||
| 55 | const RT_BLIPCOLLECTION9 = 0x07F8; |
||
| 56 | const RT_BLIPENTITY9ATOM = 0x07F9; |
||
| 57 | const RT_BOOKMARKCOLLECTION = 0x07E3; |
||
| 58 | const RT_BOOKMARKENTITYATOM = 0x0FD0; |
||
| 59 | const RT_BOOKMARKSEEDATOM = 0x07E9; |
||
| 60 | const RT_BROADCASTDOCINFO9 = 0x177E; |
||
| 61 | const RT_BROADCASTDOCINFO9ATOM = 0x177F; |
||
| 62 | const RT_BUILDATOM = 0x2B03; |
||
| 63 | const RT_BUILDLIST = 0x2B02; |
||
| 64 | const RT_CHARTBUILD = 0x2B04; |
||
| 65 | const RT_CHARTBUILDATOM = 0x2B05; |
||
| 66 | const RT_COLORSCHEMEATOM = 0x07F0; |
||
| 67 | const RT_COMMENT10 = 0x2EE0; |
||
| 68 | const RT_COMMENT10ATOM = 0x2EE1; |
||
| 69 | const RT_COMMENTINDEX10 = 0x2EE4; |
||
| 70 | const RT_COMMENTINDEX10ATOM = 0x2EE5; |
||
| 71 | const RT_CRYPTSESSION10CONTAINER = 0x2F14; |
||
| 72 | const RT_CURRENTUSERATOM = 0x0FF6; |
||
| 73 | const RT_CSTRING = 0x0FBA; |
||
| 74 | const RT_DATETIMEMETACHARATOM = 0x0FF7; |
||
| 75 | const RT_DEFAULTRULERATOM = 0x0FAB; |
||
| 76 | const RT_DOCROUTINGSLIPATOM = 0x0406; |
||
| 77 | const RT_DIAGRAMBUILD = 0x2B06; |
||
| 78 | const RT_DIAGRAMBUILDATOM = 0x2B07; |
||
| 79 | const RT_DIFF10 = 0x2EED; |
||
| 80 | const RT_DIFF10ATOM = 0x2EEE; |
||
| 81 | const RT_DIFFTREE10 = 0x2EEC; |
||
| 82 | const RT_DOCTOOLBARSTATES10ATOM = 0x36B1; |
||
| 83 | const RT_DOCUMENT = 0x03E8; |
||
| 84 | const RT_DOCUMENTATOM = 0x03E9; |
||
| 85 | const RT_DRAWING = 0x040C; |
||
| 86 | const RT_DRAWINGGROUP = 0x040B; |
||
| 87 | const RT_ENDDOCUMENTATOM = 0x03EA; |
||
| 88 | const RT_EXTERNALAVIMOVIE = 0x1006; |
||
| 89 | const RT_EXTERNALCDAUDIO = 0x100E; |
||
| 90 | const RT_EXTERNALCDAUDIOATOM = 0x1012; |
||
| 91 | const RT_EXTERNALHYPERLINK = 0x0FD7; |
||
| 92 | const RT_EXTERNALHYPERLINK9 = 0x0FE4; |
||
| 93 | const RT_EXTERNALHYPERLINKATOM = 0x0FD3; |
||
| 94 | const RT_EXTERNALHYPERLINKFLAGSATOM = 0x1018; |
||
| 95 | const RT_EXTERNALMCIMOVIE = 0x1007; |
||
| 96 | const RT_EXTERNALMEDIAATOM = 0x1004; |
||
| 97 | const RT_EXTERNALMIDIAUDIO = 0x100D; |
||
| 98 | const RT_EXTERNALOBJECTLIST = 0x0409; |
||
| 99 | const RT_EXTERNALOBJECTLISTATOM = 0x040A; |
||
| 100 | const RT_EXTERNALOBJECTREFATOM = 0x0BC1; |
||
| 101 | const RT_EXTERNALOLECONTROL = 0x0FEE; |
||
| 102 | const RT_EXTERNALOLECONTROLATOM = 0x0FFB; |
||
| 103 | const RT_EXTERNALOLEEMBED = 0x0FCC; |
||
| 104 | const RT_EXTERNALOLEEMBEDATOM = 0x0FCD; |
||
| 105 | const RT_EXTERNALOLELINK = 0x0FCE; |
||
| 106 | const RT_EXTERNALOLELINKATOM = 0x0FD1; |
||
| 107 | const RT_EXTERNALOLEOBJECTATOM = 0x0FC3; |
||
| 108 | const RT_EXTERNALOLEOBJECTSTG = 0x1011; |
||
| 109 | const RT_EXTERNALVIDEO = 0x1005; |
||
| 110 | const RT_EXTERNALWAVAUDIOEMBEDDED = 0x100F; |
||
| 111 | const RT_EXTERNALWAVAUDIOEMBEDDEDATOM = 0x1013; |
||
| 112 | const RT_EXTERNALWAVAUDIOLINK = 0x1010; |
||
| 113 | const RT_ENVELOPEDATA9ATOM = 0x1785; |
||
| 114 | const RT_ENVELOPEFLAGS9ATOM = 0x1784; |
||
| 115 | const RT_ENVIRONMENT = 0x03F2; |
||
| 116 | const RT_FONTCOLLECTION = 0x07D5; |
||
| 117 | const RT_FONTCOLLECTION10 = 0x07D6; |
||
| 118 | const RT_FONTEMBEDDATABLOB = 0x0FB8; |
||
| 119 | const RT_FONTEMBEDFLAGS10ATOM = 0x32C8; |
||
| 120 | const RT_FILTERPRIVACYFLAGS10ATOM = 0x36B0; |
||
| 121 | const RT_FONTENTITYATOM = 0x0FB7; |
||
| 122 | const RT_FOOTERMETACHARATOM = 0x0FFA; |
||
| 123 | const RT_GENERICDATEMETACHARATOM = 0x0FF8; |
||
| 124 | const RT_GRIDSPACING10ATOM = 0x040D; |
||
| 125 | const RT_GUIDEATOM = 0x03FB; |
||
| 126 | const RT_HANDOUT = 0x0FC9; |
||
| 127 | const RT_HASHCODEATOM = 0x2B00; |
||
| 128 | const RT_HEADERSFOOTERS = 0x0FD9; |
||
| 129 | const RT_HEADERSFOOTERSATOM = 0x0FDA; |
||
| 130 | const RT_HEADERMETACHARATOM = 0x0FF9; |
||
| 131 | const RT_HTMLDOCINFO9ATOM = 0x177B; |
||
| 132 | const RT_HTMLPUBLISHINFOATOM = 0x177C; |
||
| 133 | const RT_HTMLPUBLISHINFO9 = 0x177D; |
||
| 134 | const RT_INTERACTIVEINFO = 0x0FF2; |
||
| 135 | const RT_INTERACTIVEINFOATOM = 0x0FF3; |
||
| 136 | const RT_KINSOKU = 0x0FC8; |
||
| 137 | const RT_KINSOKUATOM = 0x0FD2; |
||
| 138 | const RT_LEVELINFOATOM = 0x2B0A; |
||
| 139 | const RT_LINKEDSHAPE10ATOM = 0x2EE6; |
||
| 140 | const RT_LINKEDSLIDE10ATOM = 0x2EE7; |
||
| 141 | const RT_LIST = 0x07D0; |
||
| 142 | const RT_MAINMASTER = 0x03F8; |
||
| 143 | const RT_MASTERTEXTPROPATOM = 0x0FA2; |
||
| 144 | const RT_METAFILE = 0x0FC1; |
||
| 145 | const RT_NAMEDSHOW = 0x0411; |
||
| 146 | const RT_NAMEDSHOWS = 0x0410; |
||
| 147 | const RT_NAMEDSHOWSLIDESATOM = 0x0412; |
||
| 148 | const RT_NORMALVIEWSETINFO9 = 0x0414; |
||
| 149 | const RT_NORMALVIEWSETINFO9ATOM = 0x0415; |
||
| 150 | const RT_NOTES= 0x03F0; |
||
| 151 | const RT_NOTESATOM = 0x03F1; |
||
| 152 | const RT_NOTESTEXTVIEWINFO9 = 0x0413; |
||
| 153 | const RT_OUTLINETEXTPROPS9 = 0x0FAE; |
||
| 154 | const RT_OUTLINETEXTPROPS10 = 0x0FB3; |
||
| 155 | const RT_OUTLINETEXTPROPS11 = 0x0FB5; |
||
| 156 | const RT_OUTLINETEXTPROPSHEADER9ATOM = 0x0FAF; |
||
| 157 | const RT_OUTLINETEXTREFATOM = 0x0F9E; |
||
| 158 | const RT_OUTLINEVIEWINFO = 0x0407; |
||
| 159 | const RT_PERSISTDIRECTORYATOM = 0x1772; |
||
| 160 | const RT_PARABUILD = 0x2B08; |
||
| 161 | const RT_PARABUILDATOM = 0x2B09; |
||
| 162 | const RT_PHOTOALBUMINFO10ATOM = 0x36B2; |
||
| 163 | const RT_PLACEHOLDERATOM = 0x0BC3; |
||
| 164 | const RT_PRESENTATIONADVISORFLAGS9ATOM = 0x177A; |
||
| 165 | const RT_PRINTOPTIONSATOM = 0x1770; |
||
| 166 | const RT_PROGBINARYTAG = 0x138A; |
||
| 167 | const RT_PROGSTRINGTAG = 0x1389; |
||
| 168 | const RT_PROGTAGS = 0x1388; |
||
| 169 | const RT_RECOLORINFOATOM = 0x0FE7; |
||
| 170 | const RT_RTFDATETIMEMETACHARATOM = 0x1015; |
||
| 171 | const RT_ROUNDTRIPANIMATIONATOM12ATOM = 0x2B0B; |
||
| 172 | const RT_ROUNDTRIPANIMATIONHASHATOM12ATOM = 0x2B0D; |
||
| 173 | const RT_ROUNDTRIPCOLORMAPPING12ATOM = 0x040F; |
||
| 174 | const RT_ROUNDTRIPCOMPOSITEMASTERID12ATOM = 0x041D; |
||
| 175 | const RT_ROUNDTRIPCONTENTMASTERID12ATOM = 0x0422; |
||
| 176 | const RT_ROUNDTRIPCONTENTMASTERINFO12ATOM = 0x041E; |
||
| 177 | const RT_ROUNDTRIPCUSTOMTABLESTYLES12ATOM = 0x0428; |
||
| 178 | const RT_ROUNDTRIPDOCFLAGS12ATOM = 0x0425; |
||
| 179 | const RT_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM = 0x0424; |
||
| 180 | const RT_ROUNDTRIPHFPLACEHOLDER12ATOM = 0x0420; |
||
| 181 | const RT_ROUNDTRIPNEWPLACEHOLDERID12ATOM = 0x0BDD; |
||
| 182 | const RT_ROUNDTRIPNOTESMASTERTEXTSTYLES12ATOM = 0x0427; |
||
| 183 | const RT_ROUNDTRIPOARTTEXTSTYLES12ATOM = 0x0423; |
||
| 184 | const RT_ROUNDTRIPORIGINALMAINMASTERID12ATOM = 0x041C; |
||
| 185 | const RT_ROUNDTRIPSHAPECHECKSUMFORCL12ATOM = 0x0426; |
||
| 186 | const RT_ROUNDTRIPSHAPEID12ATOM = 0x041F; |
||
| 187 | const RT_ROUNDTRIPSLIDESYNCINFO12 = 0x3714; |
||
| 188 | const RT_ROUNDTRIPSLIDESYNCINFOATOM12 = 0x3715; |
||
| 189 | const RT_ROUNDTRIPTHEME12ATOM = 0x040E; |
||
| 190 | const RT_SHAPEATOM = 0x0BDB; |
||
| 191 | const RT_SHAPEFLAGS10ATOM = 0x0BDC; |
||
| 192 | const RT_SLIDE = 0x03EE; |
||
| 193 | const RT_SLIDEATOM = 0x03EF; |
||
| 194 | const RT_SLIDEFLAGS10ATOM = 0x2EEA; |
||
| 195 | const RT_SLIDELISTENTRY10ATOM = 0x2EF0; |
||
| 196 | const RT_SLIDELISTTABLE10 = 0x2EF1; |
||
| 197 | const RT_SLIDELISTWITHTEXT = 0x0FF0; |
||
| 198 | const RT_SLIDELISTTABLESIZE10ATOM = 0x2EEF; |
||
| 199 | const RT_SLIDENUMBERMETACHARATOM = 0x0FD8; |
||
| 200 | const RT_SLIDEPERSISTATOM = 0x03F3; |
||
| 201 | const RT_SLIDESHOWDOCINFOATOM = 0x0401; |
||
| 202 | const RT_SLIDESHOWSLIDEINFOATOM = 0x03F9; |
||
| 203 | const RT_SLIDETIME10ATOM = 0x2EEB; |
||
| 204 | const RT_SLIDEVIEWINFO = 0x03FA; |
||
| 205 | const RT_SLIDEVIEWINFOATOM = 0x03FE; |
||
| 206 | const RT_SMARTTAGSTORE11CONTAINER = 0x36B3; |
||
| 207 | const RT_SOUND = 0x07E6; |
||
| 208 | const RT_SOUNDCOLLECTION = 0x07E4; |
||
| 209 | const RT_SOUNDCOLLECTIONATOM = 0x07E5; |
||
| 210 | const RT_SOUNDDATABLOB = 0x07E7; |
||
| 211 | const RT_SORTERVIEWINFO = 0x0408; |
||
| 212 | const RT_STYLETEXTPROPATOM = 0x0FA1; |
||
| 213 | const RT_STYLETEXTPROP10ATOM = 0x0FB1; |
||
| 214 | const RT_STYLETEXTPROP11ATOM = 0x0FB6; |
||
| 215 | const RT_STYLETEXTPROP9ATOM = 0x0FAC; |
||
| 216 | const RT_SUMMARY = 0x0402; |
||
| 217 | const RT_TEXTBOOKMARKATOM = 0x0FA7; |
||
| 218 | const RT_TEXTBYTESATOM = 0x0FA8; |
||
| 219 | const RT_TEXTCHARFORMATEXCEPTIONATOM = 0x0FA4; |
||
| 220 | const RT_TEXTCHARSATOM = 0x0FA0; |
||
| 221 | const RT_TEXTDEFAULTS10ATOM = 0x0FB4; |
||
| 222 | const RT_TEXTDEFAULTS9ATOM = 0x0FB0; |
||
| 223 | const RT_TEXTHEADERATOM = 0x0F9F; |
||
| 224 | const RT_TEXTINTERACTIVEINFOATOM = 0x0FDF; |
||
| 225 | const RT_TEXTMASTERSTYLEATOM = 0x0FA3; |
||
| 226 | const RT_TEXTMASTERSTYLE10ATOM = 0x0FB2; |
||
| 227 | const RT_TEXTMASTERSTYLE9ATOM = 0x0FAD; |
||
| 228 | const RT_TEXTPARAGRAPHFORMATEXCEPTIONATOM = 0x0FA5; |
||
| 229 | const RT_TEXTRULERATOM = 0x0FA6; |
||
| 230 | const RT_TEXTSPECIALINFOATOM = 0x0FAA; |
||
| 231 | const RT_TEXTSPECIALINFODEFAULTATOM = 0x0FA9; |
||
| 232 | const RT_TIMEANIMATEBEHAVIOR = 0xF134; |
||
| 233 | const RT_TIMEANIMATEBEHAVIORCONTAINER = 0xF12B; |
||
| 234 | const RT_TIMEANIMATIONVALUE = 0xF143; |
||
| 235 | const RT_TIMEANIMATIONVALUELIST = 0xF13F; |
||
| 236 | const RT_TIMEBEHAVIOR = 0xF133; |
||
| 237 | const RT_TIMEBEHAVIORCONTAINER = 0xF12A; |
||
| 238 | const RT_TIMECOLORBEHAVIOR = 0xF135; |
||
| 239 | const RT_TIMECOLORBEHAVIORCONTAINER = 0xF12C; |
||
| 240 | const RT_TIMECLIENTVISUALELEMENT = 0xF13C; |
||
| 241 | const RT_TIMECOMMANDBEHAVIOR = 0xF13B; |
||
| 242 | const RT_TIMECOMMANDBEHAVIORCONTAINER = 0xF132; |
||
| 243 | const RT_TIMECONDITION = 0xF128; |
||
| 244 | const RT_TIMECONDITIONCONTAINER = 0xF125; |
||
| 245 | const RT_TIMEEFFECTBEHAVIOR = 0xF136; |
||
| 246 | const RT_TIMEEFFECTBEHAVIORCONTAINER = 0xF12D; |
||
| 247 | const RT_TIMEEXTTIMENODECONTAINER = 0xF144; |
||
| 248 | const RT_TIMEITERATEDATA = 0xF140; |
||
| 249 | const RT_TIMEMODIFIER = 0xF129; |
||
| 250 | const RT_TIMEMOTIONBEHAVIOR = 0xF137; |
||
| 251 | const RT_TIMEMOTIONBEHAVIORCONTAINER = 0xF12E; |
||
| 252 | const RT_TIMENODE = 0xF127; |
||
| 253 | const RT_TIMEPROPERTYLIST = 0xF13D; |
||
| 254 | const RT_TIMEROTATIONBEHAVIOR = 0xF138; |
||
| 255 | const RT_TIMEROTATIONBEHAVIORCONTAINER = 0xF12F; |
||
| 256 | const RT_TIMESCALEBEHAVIOR = 0xF139; |
||
| 257 | const RT_TIMESCALEBEHAVIORCONTAINER = 0xF130; |
||
| 258 | const RT_TIMESEQUENCEDATA = 0xF141; |
||
| 259 | const RT_TIMESETBEHAVIOR = 0xF13A; |
||
| 260 | const RT_TIMESETBEHAVIORCONTAINER = 0xF131; |
||
| 261 | const RT_TIMESUBEFFECTCONTAINER = 0xF145; |
||
| 262 | const RT_TIMEVARIANT = 0xF142; |
||
| 263 | const RT_TIMEVARIANTLIST = 0xF13E; |
||
| 264 | const RT_USEREDITATOM = 0x0FF5; |
||
| 265 | const RT_VBAINFO = 0x03FF; |
||
| 266 | const RT_VBAINFOATOM = 0x0400; |
||
| 267 | const RT_VIEWINFOATOM = 0x03FD; |
||
| 268 | const RT_VISUALPAGEATOM = 0x2B01; |
||
| 269 | const RT_VISUALSHAPEATOM = 0x2AFB; |
||
| 270 | |||
| 271 | /** |
||
| 272 | * @var http://msdn.microsoft.com/en-us/library/dd926394(v=office.12).aspx |
||
| 273 | */ |
||
| 274 | const SL_BIGOBJECT = 0x0000000F; |
||
| 275 | const SL_BLANK = 0x00000010; |
||
| 276 | const SL_COLUMNTWOROWS = 0x0000000A; |
||
| 277 | const SL_FOUROBJECTS = 0x0000000E; |
||
| 278 | const SL_MASTERTITLE = 0x00000002; |
||
| 279 | const SL_TITLEBODY = 0x00000001; |
||
| 280 | const SL_TITLEONLY = 0x00000007; |
||
| 281 | const SL_TITLESLIDE = 0x00000000; |
||
| 282 | const SL_TWOCOLUMNS = 0x00000008; |
||
| 283 | const SL_TWOCOLUMNSROW = 0x0000000D; |
||
| 284 | const SL_TWOROWS = 0x00000009; |
||
| 285 | const SL_TWOROWSCOLUMN = 0x0000000B; |
||
| 286 | const SL_VERTICALTITLEBODY = 0x00000011; |
||
| 287 | const SL_VERTICALTWOROWS = 0x00000012; |
||
| 288 | |||
| 289 | /** |
||
| 290 | * Array with Fonts |
||
| 291 | */ |
||
| 292 | private $arrayFonts = array(); |
||
| 293 | /** |
||
| 294 | * Array with Hyperlinks |
||
| 295 | */ |
||
| 296 | private $arrayHyperlinks = array(); |
||
| 297 | /** |
||
| 298 | * Array with Pictures |
||
| 299 | */ |
||
| 300 | private $arrayPictures = array(); |
||
| 301 | /** |
||
| 302 | * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the UserEditAtom record for the most recent user edit. |
||
| 303 | * @var int |
||
| 304 | */ |
||
| 305 | private $offsetToCurrentEdit; |
||
| 306 | /** |
||
| 307 | * A structure that specifies a compressed table of sequential persist object identifiers and stream offsets to associated persist objects. |
||
| 308 | * @var int[] |
||
| 309 | */ |
||
| 310 | private $rgPersistDirEntry; |
||
| 311 | /** |
||
| 312 | * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the PersistDirectoryAtom record for this user edit |
||
| 313 | * @var int |
||
| 314 | */ |
||
| 315 | private $offsetPersistDirectory; |
||
| 316 | /** |
||
| 317 | * Output Object |
||
| 318 | * @var PhpPresentation |
||
| 319 | */ |
||
| 320 | private $oPhpPresentation; |
||
| 321 | /** |
||
| 322 | * Group Object |
||
| 323 | * @var Group |
||
| 324 | */ |
||
| 325 | private $oCurrentGroup; |
||
| 326 | /** |
||
| 327 | * @var boolean |
||
| 328 | */ |
||
| 329 | private $bFirstShapeGroup = false; |
||
| 330 | /** |
||
| 331 | * Stream "Powerpoint Document" |
||
| 332 | * @var string |
||
| 333 | */ |
||
| 334 | private $streamPowerpointDocument; |
||
| 335 | /** |
||
| 336 | * Stream "Current User" |
||
| 337 | * @var string |
||
| 338 | */ |
||
| 339 | private $streamCurrentUser; |
||
| 340 | /** |
||
| 341 | * Stream "Summary Information" |
||
| 342 | * @var string |
||
| 343 | */ |
||
| 344 | private $streamSummaryInformation; |
||
| 345 | /** |
||
| 346 | * Stream "Document Summary Information" |
||
| 347 | * @var string |
||
| 348 | */ |
||
| 349 | private $streamDocumentSummaryInformation; |
||
| 350 | /** |
||
| 351 | * Stream "Pictures" |
||
| 352 | * @var string |
||
| 353 | */ |
||
| 354 | private $streamPictures; |
||
| 355 | |||
| 356 | /** |
||
| 357 | * Can the current \PhpOffice\PhpPresentation\Reader\ReaderInterface read the file? |
||
| 358 | * |
||
| 359 | * @param string $pFilename |
||
| 360 | * @throws \Exception |
||
| 361 | * @return boolean |
||
| 362 | */ |
||
| 363 | 3 | public function canRead($pFilename) |
|
| 367 | |||
| 368 | /** |
||
| 369 | * Does a file support UnserializePhpPresentation ? |
||
| 370 | * |
||
| 371 | * @param string $pFilename |
||
| 372 | * @throws \Exception |
||
| 373 | * @return boolean |
||
| 374 | */ |
||
| 375 | 10 | public function fileSupportsUnserializePhpPresentation($pFilename = '') |
|
| 392 | |||
| 393 | /** |
||
| 394 | * Loads PhpPresentation Serialized file |
||
| 395 | * |
||
| 396 | * @param string $pFilename |
||
| 397 | * @return \PhpOffice\PhpPresentation\PhpPresentation |
||
| 398 | * @throws \Exception |
||
| 399 | */ |
||
| 400 | 6 | public function load($pFilename) |
|
| 409 | |||
| 410 | /** |
||
| 411 | * Load PhpPresentation Serialized file |
||
| 412 | * |
||
| 413 | * @param string $pFilename |
||
| 414 | * @return \PhpOffice\PhpPresentation\PhpPresentation |
||
| 415 | */ |
||
| 416 | 4 | private function loadFile($pFilename) |
|
| 432 | |||
| 433 | /** |
||
| 434 | * Read OLE Part |
||
| 435 | * @param string $pFilename |
||
| 436 | */ |
||
| 437 | 4 | private function loadOLE($pFilename) |
|
| 458 | |||
| 459 | /** |
||
| 460 | * Stream Pictures |
||
| 461 | * @link http://msdn.microsoft.com/en-us/library/dd920746(v=office.12).aspx |
||
| 462 | */ |
||
| 463 | 4 | private function loadPicturesStream() |
|
| 490 | |||
| 491 | /** |
||
| 492 | * Stream Current User |
||
| 493 | * @link http://msdn.microsoft.com/en-us/library/dd908567(v=office.12).aspx |
||
| 494 | */ |
||
| 495 | 4 | private function loadCurrentUserStream() |
|
| 588 | |||
| 589 | /** |
||
| 590 | * Stream Powerpoint Document |
||
| 591 | * @link http://msdn.microsoft.com/en-us/library/dd921564(v=office.12).aspx |
||
| 592 | */ |
||
| 593 | 4 | private function loadPowerpointDocumentStream() |
|
| 617 | |||
| 618 | /** |
||
| 619 | * Read a record header |
||
| 620 | * @param string $stream |
||
| 621 | * @param integer $pos |
||
| 622 | * @return multitype |
||
| 623 | */ |
||
| 624 | 4 | private function loadRecordHeader($stream, $pos) |
|
| 643 | |||
| 644 | /** |
||
| 645 | * Read 8-bit unsigned integer |
||
| 646 | * |
||
| 647 | * @param string $data |
||
| 648 | * @param int $pos |
||
| 649 | * @return int |
||
| 650 | */ |
||
| 651 | 4 | public static function getInt1d($data, $pos) |
|
| 655 | |||
| 656 | /** |
||
| 657 | * Read 16-bit unsigned integer |
||
| 658 | * |
||
| 659 | * @param string $data |
||
| 660 | * @param int $pos |
||
| 661 | * @return int |
||
| 662 | */ |
||
| 663 | 4 | public static function getInt2d($data, $pos) |
|
| 667 | |||
| 668 | /** |
||
| 669 | * Read 32-bit signed integer |
||
| 670 | * |
||
| 671 | * @param string $data |
||
| 672 | * @param int $pos |
||
| 673 | * @return int |
||
| 674 | */ |
||
| 675 | 4 | public static function getInt4d($data, $pos) |
|
| 689 | |||
| 690 | /** |
||
| 691 | * A container record that specifies the animation and sound information for a shape. |
||
| 692 | * @param string $stream |
||
| 693 | * @param integer $pos |
||
| 694 | * @link https://msdn.microsoft.com/en-us/library/dd772900(v=office.12).aspx |
||
| 695 | */ |
||
| 696 | private function readRecordAnimationInfoContainer($stream, $pos) |
||
| 713 | |||
| 714 | /** |
||
| 715 | * A container record that specifies information about the document. |
||
| 716 | * @param string $stream |
||
| 717 | * @param integer $pos |
||
| 718 | * @link http://msdn.microsoft.com/en-us/library/dd947357(v=office.12).aspx |
||
| 719 | */ |
||
| 720 | 4 | private function readRecordDocumentContainer($stream, $pos) |
|
| 897 | |||
| 898 | /** |
||
| 899 | * An atom record that specifies information about a slide. |
||
| 900 | * @param string $stream |
||
| 901 | * @param integer $pos |
||
| 902 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 903 | */ |
||
| 904 | 4 | private function readRecordDrawingContainer($stream, $pos) |
|
| 921 | |||
| 922 | /** |
||
| 923 | * An atom record that specifies a reference to an external object. |
||
| 924 | * @param string $stream |
||
| 925 | * @param integer $pos |
||
| 926 | * @link https://msdn.microsoft.com/en-us/library/dd910388(v=office.12).aspx |
||
| 927 | */ |
||
| 928 | private function readRecordExObjRefAtom($stream, $pos) |
||
| 944 | |||
| 945 | /** |
||
| 946 | * An atom record that specifies a type of action to be performed. |
||
| 947 | * @param string $stream |
||
| 948 | * @param integer $pos |
||
| 949 | * @link https://msdn.microsoft.com/en-us/library/dd953300(v=office.12).aspx |
||
| 950 | */ |
||
| 951 | 1 | private function readRecordInteractiveInfoAtom($stream, $pos) |
|
| 986 | |||
| 987 | /** |
||
| 988 | * An atom record that specifies the name of a macro, a file name, or a named show. |
||
| 989 | * @param string $stream |
||
| 990 | * @param integer $pos |
||
| 991 | * @link https://msdn.microsoft.com/en-us/library/dd925121(v=office.12).aspx |
||
| 992 | */ |
||
| 993 | 1 | private function readRecordMacroNameAtom($stream, $pos) |
|
| 1009 | |||
| 1010 | /** |
||
| 1011 | * A container record that specifies what actions to perform when interacting with an object by means of a mouse click. |
||
| 1012 | * @param string $stream |
||
| 1013 | * @param integer $pos |
||
| 1014 | * @link https://msdn.microsoft.com/en-us/library/dd952348(v=office.12).aspx |
||
| 1015 | */ |
||
| 1016 | 1 | private function readRecordMouseClickInteractiveInfoContainer($stream, $pos) |
|
| 1039 | |||
| 1040 | /** |
||
| 1041 | * A container record that specifies what actions to perform when interacting with an object by moving the mouse cursor over it. |
||
| 1042 | * @param string $stream |
||
| 1043 | * @param integer $pos |
||
| 1044 | * @link https://msdn.microsoft.com/en-us/library/dd925811(v=office.12).aspx |
||
| 1045 | */ |
||
| 1046 | private function readRecordMouseOverInteractiveInfoContainer($stream, $pos) |
||
| 1063 | |||
| 1064 | /** |
||
| 1065 | * The OfficeArtBlip record specifies BLIP file data. |
||
| 1066 | * @param string $stream |
||
| 1067 | * @param integer $pos |
||
| 1068 | * @link https://msdn.microsoft.com/en-us/library/dd910081(v=office.12).aspx |
||
| 1069 | */ |
||
| 1070 | 4 | private function readRecordOfficeArtBlip($stream, $pos) |
|
| 1107 | |||
| 1108 | /** |
||
| 1109 | * The OfficeArtChildAnchor record specifies four signed integers that specify the anchor for the shape that contains this record. |
||
| 1110 | * @param string $stream |
||
| 1111 | * @param integer $pos |
||
| 1112 | * @link https://msdn.microsoft.com/en-us/library/dd922720(v=office.12).aspx |
||
| 1113 | */ |
||
| 1114 | 4 | private function readRecordOfficeArtChildAnchor($stream, $pos) |
|
| 1137 | |||
| 1138 | |||
| 1139 | |||
| 1140 | /** |
||
| 1141 | * An atom record that specifies the location of a shape. |
||
| 1142 | * @param string $stream |
||
| 1143 | * @param integer $pos |
||
| 1144 | * @link https://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx |
||
| 1145 | */ |
||
| 1146 | 4 | private function readRecordOfficeArtClientAnchor($stream, $pos) |
|
| 1147 | { |
||
| 1148 | $arrayReturn = array( |
||
| 1149 | 'length' => 0 |
||
| 1150 | 4 | ); |
|
| 1151 | |||
| 1152 | 4 | $data = $this->loadRecordHeader($stream, $pos); |
|
| 1153 | 4 | if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF010 && ($data['recLen'] == 0x00000008 || $data['recLen'] == 0x00000010)) { |
|
| 1154 | // Record Header |
||
| 1155 | 4 | $arrayReturn['length'] += 8; |
|
| 1156 | // Datas |
||
| 1157 | 4 | switch ($data['recLen']) { |
|
| 1158 | 4 | case 0x00000008: |
|
| 1159 | 4 | $arrayReturn['top'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6); |
|
| 1160 | 4 | $arrayReturn['length'] += 2; |
|
| 1161 | 4 | $arrayReturn['left'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6); |
|
| 1162 | 4 | $arrayReturn['length'] += 2; |
|
| 1163 | 4 | $arrayReturn['width'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6) - $arrayReturn['left']; |
|
| 1164 | 4 | $arrayReturn['length'] += 2; |
|
| 1165 | 4 | $arrayReturn['height'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6) - $arrayReturn['left']; |
|
| 1166 | 4 | $arrayReturn['length'] += 2; |
|
| 1167 | 4 | $pos += 8; |
|
| 1168 | 4 | break; |
|
| 1169 | case 0x00000010: |
||
| 1170 | throw new \Exception('PowerPoint97 Reader : record OfficeArtClientAnchor (0x00000010)'); |
||
| 1171 | } |
||
| 1172 | } |
||
| 1173 | |||
| 1174 | 4 | return $arrayReturn; |
|
| 1175 | } |
||
| 1176 | /** |
||
| 1177 | * A container record that specifies text related data for a shape. |
||
| 1178 | * @param string $stream |
||
| 1179 | * @param integer $pos |
||
| 1180 | * @link https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx |
||
| 1181 | */ |
||
| 1182 | 4 | private function readRecordOfficeArtClientTextbox($stream, $pos) |
|
| 1319 | |||
| 1320 | /** |
||
| 1321 | * The OfficeArtSpContainer record specifies a shape container. |
||
| 1322 | * @param string $stream |
||
| 1323 | * @param integer $pos |
||
| 1324 | * @link https://msdn.microsoft.com/en-us/library/dd943794(v=office.12).aspx |
||
| 1325 | */ |
||
| 1326 | 4 | private function readRecordOfficeArtSpContainer($stream, $pos) |
|
| 1579 | |||
| 1580 | /** |
||
| 1581 | * The OfficeArtSpgrContainer record specifies a container for groups of shapes. |
||
| 1582 | * @param string $stream |
||
| 1583 | * @param integer $pos |
||
| 1584 | * @param boolean $bInGroup |
||
| 1585 | * @link : https://msdn.microsoft.com/en-us/library/dd910416(v=office.12).aspx |
||
| 1586 | */ |
||
| 1587 | 4 | private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false) |
|
| 1588 | { |
||
| 1589 | $arrayReturn = array( |
||
| 1590 | 4 | 'length' => 0, |
|
| 1591 | ); |
||
| 1592 | |||
| 1593 | 4 | $data = $this->loadRecordHeader($stream, $pos); |
|
| 1594 | 4 | if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF003) { |
|
| 1595 | 4 | $arrayReturn['length'] += 8; |
|
| 1596 | |||
| 1597 | do { |
||
| 1598 | 4 | $rhFileBlock = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); |
|
| 1599 | 4 | if (!($rhFileBlock['recVer'] == 0xF && $rhFileBlock['recInstance'] == 0x0000 && ($rhFileBlock['recType'] == 0xF003 || $rhFileBlock['recType'] == 0xF004))) { |
|
| 1600 | throw new \Exception('PowerPoint97 Reader : readRecordOfficeArtSpgrContainer.'); |
||
| 1601 | } |
||
| 1602 | |||
| 1603 | 4 | switch ($rhFileBlock['recType']) { |
|
| 1604 | 4 | case 0xF003: |
|
| 1605 | // Core |
||
| 1606 | $this->oCurrentGroup = $this->oPhpPresentation->getActiveSlide()->createGroup(); |
||
| 1607 | $this->bFirstShapeGroup = false; |
||
| 1608 | // OfficeArtSpgrContainer |
||
| 1609 | $fileBlock = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length'], true); |
||
| 1610 | $arrayReturn['length'] += $fileBlock['length']; |
||
| 1611 | $data['recLen'] -= $fileBlock['length']; |
||
| 1612 | break; |
||
| 1613 | 4 | case 0xF004: |
|
| 1614 | // Core |
||
| 1615 | 4 | if (!$bInGroup) { |
|
| 1616 | 4 | $this->oCurrentGroup = null; |
|
| 1617 | } |
||
| 1618 | // OfficeArtSpContainer |
||
| 1619 | 4 | $fileBlock = $this->readRecordOfficeArtSpContainer($stream, $pos + $arrayReturn['length']); |
|
| 1620 | 4 | $arrayReturn['length'] += $fileBlock['length']; |
|
| 1621 | 4 | $data['recLen'] -= $fileBlock['length']; |
|
| 1622 | // Core |
||
| 1623 | //@todo |
||
| 1624 | 4 | if (!is_null($fileBlock['shape'])) { |
|
| 1625 | 4 | if ($bInGroup) { |
|
| 1626 | $this->oCurrentGroup->addShape($fileBlock['shape']); |
||
| 1627 | } else { |
||
| 1628 | 4 | $this->oPhpPresentation->getActiveSlide()->addShape($fileBlock['shape']); |
|
| 1629 | } |
||
| 1630 | } |
||
| 1631 | |||
| 1632 | 4 | break; |
|
| 1633 | } |
||
| 1634 | 4 | } while ($data['recLen'] > 0); |
|
| 1635 | } |
||
| 1636 | 4 | return $arrayReturn; |
|
| 1637 | } |
||
| 1638 | |||
| 1639 | /** |
||
| 1640 | * The OfficeArtTertiaryFOPT record specifies a table of OfficeArtRGFOPTE records,. |
||
| 1641 | * @param string $stream |
||
| 1642 | * @param integer $pos |
||
| 1643 | * @link https://msdn.microsoft.com/en-us/library/dd950206(v=office.12).aspx |
||
| 1644 | */ |
||
| 1645 | 4 | private function readRecordOfficeArtTertiaryFOPT($stream, $pos) |
|
| 1701 | |||
| 1702 | /** |
||
| 1703 | * The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing. |
||
| 1704 | * @param string $stream |
||
| 1705 | * @param integer $pos |
||
| 1706 | * @link : https://msdn.microsoft.com/en-us/library/dd924455(v=office.12).aspx |
||
| 1707 | */ |
||
| 1708 | 4 | private function readRecordOfficeArtDgContainer($stream, $pos) |
|
| 1739 | |||
| 1740 | /** |
||
| 1741 | * The OfficeArtFDG record specifies the number of shapes, the drawing identifier, and the shape identifier of the last shape in a drawing. |
||
| 1742 | * @param string $stream |
||
| 1743 | * @param integer $pos |
||
| 1744 | * @link : https://msdn.microsoft.com/en-us/library/dd946757(v=office.12).aspx |
||
| 1745 | */ |
||
| 1746 | 4 | private function readRecordOfficeArtFDG($stream, $pos) |
|
| 1762 | |||
| 1763 | /** |
||
| 1764 | * The OfficeArtFOPT record specifies a table of OfficeArtRGFOPTE records. |
||
| 1765 | * @param string $stream |
||
| 1766 | * @param integer $pos |
||
| 1767 | * @link https://msdn.microsoft.com/en-us/library/dd943404(v=office.12).aspx |
||
| 1768 | */ |
||
| 1769 | 4 | private function readRecordOfficeArtFOPT($stream, $pos) |
|
| 1770 | { |
||
| 1771 | $arrayReturn = array( |
||
| 1772 | 4 | 'length' => 0, |
|
| 1773 | ); |
||
| 1774 | |||
| 1775 | 4 | $data = $this->loadRecordHeader($stream, $pos); |
|
| 1776 | 4 | if ($data['recVer'] == 0x3 && $data['recType'] == 0xF00B) { |
|
| 1777 | // Record Header |
||
| 1778 | 4 | $arrayReturn['length'] += 8; |
|
| 1779 | |||
| 1780 | //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx |
||
| 1781 | 4 | $officeArtFOPTE = array(); |
|
| 1782 | 4 | for ($inc = 0; $inc < $data['recInstance']; $inc++) { |
|
| 1783 | 4 | $opid = self::getInt2d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); |
|
| 1784 | 4 | $arrayReturn['length'] += 2; |
|
| 1785 | 4 | $data['recLen'] -= 2; |
|
| 1786 | 4 | $optOp = self::getInt4d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); |
|
| 1787 | 4 | $arrayReturn['length'] += 4; |
|
| 1788 | 4 | $data['recLen'] -= 4; |
|
| 1789 | 4 | $officeArtFOPTE[] = array( |
|
| 1790 | 4 | 'opid' => ($opid >> 0) & bindec('11111111111111'), |
|
| 1791 | 4 | 'fBid' => ($opid >> 14) & bindec('1'), |
|
| 1792 | 4 | 'fComplex' => ($opid >> 15) & bindec('1'), |
|
| 1793 | 4 | 'op' => $optOp, |
|
| 1794 | ); |
||
| 1795 | } |
||
| 1796 | //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID |
||
| 1797 | 4 | foreach ($officeArtFOPTE as $opt) { |
|
| 1798 | // echo $opt['opid'].'-0x'.dechex($opt['opid']).EOL; |
||
| 1799 | 4 | switch ($opt['opid']) { |
|
| 1800 | 4 | case 0x0004: |
|
| 1801 | // Transform : rotation |
||
| 1802 | //@link : https://msdn.microsoft.com/en-us/library/dd949750(v=office.12).aspx |
||
| 1803 | $arrayReturn['rotation'] = $opt['op']; |
||
| 1804 | break; |
||
| 1805 | 4 | case 0x007F: |
|
| 1806 | // Transform : Protection Boolean Properties |
||
| 1807 | //@link : http://msdn.microsoft.com/en-us/library/dd909131(v=office.12).aspx |
||
| 1808 | 4 | break; |
|
| 1809 | 4 | case 0x0080: |
|
| 1810 | // Text : ltxid |
||
| 1811 | //@link : http://msdn.microsoft.com/en-us/library/dd947446(v=office.12).aspx |
||
| 1812 | 3 | break; |
|
| 1813 | 4 | case 0x0081: |
|
| 1814 | // Text : dxTextLeft |
||
| 1815 | //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx |
||
| 1816 | 3 | $arrayReturn['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1817 | 3 | break; |
|
| 1818 | 4 | case 0x0082: |
|
| 1819 | // Text : dyTextTop |
||
| 1820 | //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx |
||
| 1821 | 3 | $arrayReturn['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1822 | 3 | break; |
|
| 1823 | 4 | case 0x0083: |
|
| 1824 | // Text : dxTextRight |
||
| 1825 | //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx |
||
| 1826 | 3 | $arrayReturn['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1827 | 3 | break; |
|
| 1828 | 4 | case 0x0084: |
|
| 1829 | // Text : dyTextBottom |
||
| 1830 | //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx |
||
| 1831 | 3 | $arrayReturn['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1832 | 3 | break; |
|
| 1833 | 4 | case 0x0085: |
|
| 1834 | // Text : WrapText |
||
| 1835 | //@link : http://msdn.microsoft.com/en-us/library/dd924770(v=office.12).aspx |
||
| 1836 | 4 | break; |
|
| 1837 | 4 | case 0x0087: |
|
| 1838 | // Text : anchorText |
||
| 1839 | //@link : http://msdn.microsoft.com/en-us/library/dd948575(v=office.12).aspx |
||
| 1840 | 4 | break; |
|
| 1841 | 4 | case 0x00BF: |
|
| 1842 | // Text : Text Boolean Properties |
||
| 1843 | //@link : http://msdn.microsoft.com/en-us/library/dd950905(v=office.12).aspx |
||
| 1844 | 3 | break; |
|
| 1845 | 4 | case 0x0104: |
|
| 1846 | // Blip : pib |
||
| 1847 | //@link : http://msdn.microsoft.com/en-us/library/dd772837(v=office.12).aspx |
||
| 1848 | 4 | if ($opt['fComplex'] == 0) { |
|
| 1849 | 4 | $arrayReturn['pib'] = $opt['op']; |
|
| 1850 | 4 | $data['recLen'] -= $opt['op']; |
|
| 1851 | } else { |
||
| 1852 | // pib Complex |
||
| 1853 | } |
||
| 1854 | 4 | break; |
|
| 1855 | 4 | case 0x13F: |
|
| 1856 | // Blip Boolean Properties |
||
| 1857 | //@link : https://msdn.microsoft.com/en-us/library/dd944215(v=office.12).aspx |
||
| 1858 | break; |
||
| 1859 | 4 | case 0x140: |
|
| 1860 | // Geometry : geoLeft |
||
| 1861 | //@link : http://msdn.microsoft.com/en-us/library/dd947489(v=office.12).aspx |
||
| 1862 | // print_r('geoLeft : '.$opt['op'].EOL); |
||
| 1863 | 2 | break; |
|
| 1864 | 4 | case 0x141: |
|
| 1865 | // Geometry : geoTop |
||
| 1866 | //@link : http://msdn.microsoft.com/en-us/library/dd949459(v=office.12).aspx |
||
| 1867 | // print_r('geoTop : '.$opt['op'].EOL); |
||
| 1868 | 2 | break; |
|
| 1869 | 4 | case 0x142: |
|
| 1870 | // Geometry : geoRight |
||
| 1871 | //@link : http://msdn.microsoft.com/en-us/library/dd947117(v=office.12).aspx |
||
| 1872 | // print_r('geoRight : '.$opt['op'].EOL); |
||
| 1873 | 2 | break; |
|
| 1874 | 4 | case 0x143: |
|
| 1875 | // Geometry : geoBottom |
||
| 1876 | //@link : http://msdn.microsoft.com/en-us/library/dd948602(v=office.12).aspx |
||
| 1877 | // print_r('geoBottom : '.$opt['op'].EOL); |
||
| 1878 | 2 | break; |
|
| 1879 | 4 | case 0x144: |
|
| 1880 | // Geometry : shapePath |
||
| 1881 | //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx |
||
| 1882 | 1 | $arrayReturn['line'] = true; |
|
| 1883 | 1 | break; |
|
| 1884 | 4 | case 0x145: |
|
| 1885 | // Geometry : pVertices |
||
| 1886 | //@link : http://msdn.microsoft.com/en-us/library/dd949814(v=office.12).aspx |
||
| 1887 | 2 | if ($opt['fComplex'] == 1) { |
|
| 1888 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 1889 | 2 | $data['recLen'] -= $opt['op']; |
|
| 1890 | } |
||
| 1891 | 2 | break; |
|
| 1892 | 4 | case 0x146: |
|
| 1893 | // Geometry : pSegmentInfo |
||
| 1894 | //@link : http://msdn.microsoft.com/en-us/library/dd905742(v=office.12).aspx |
||
| 1895 | 2 | if ($opt['fComplex'] == 1) { |
|
| 1896 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 1897 | 2 | $data['recLen'] -= $opt['op']; |
|
| 1898 | } |
||
| 1899 | 2 | break; |
|
| 1900 | 4 | case 0x155: |
|
| 1901 | // Geometry : pAdjustHandles |
||
| 1902 | //@link : http://msdn.microsoft.com/en-us/library/dd905890(v=office.12).aspx |
||
| 1903 | 2 | if ($opt['fComplex'] == 1) { |
|
| 1904 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 1905 | 2 | $data['recLen'] -= $opt['op']; |
|
| 1906 | } |
||
| 1907 | 2 | break; |
|
| 1908 | 4 | case 0x156: |
|
| 1909 | // Geometry : pGuides |
||
| 1910 | //@link : http://msdn.microsoft.com/en-us/library/dd910801(v=office.12).aspx |
||
| 1911 | 2 | if ($opt['fComplex'] == 1) { |
|
| 1912 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 1913 | 2 | $data['recLen'] -= $opt['op']; |
|
| 1914 | } |
||
| 1915 | 2 | break; |
|
| 1916 | 4 | case 0x157: |
|
| 1917 | // Geometry : pInscribe |
||
| 1918 | //@link : http://msdn.microsoft.com/en-us/library/dd904889(v=office.12).aspx |
||
| 1919 | 2 | if ($opt['fComplex'] == 1) { |
|
| 1920 | 2 | $arrayReturn['length'] += $opt['op']; |
|
| 1921 | 2 | $data['recLen'] -= $opt['op']; |
|
| 1922 | } |
||
| 1923 | 2 | break; |
|
| 1924 | 4 | case 0x17F: |
|
| 1925 | // Geometry Boolean Properties |
||
| 1926 | //@link : http://msdn.microsoft.com/en-us/library/dd944968(v=office.12).aspx |
||
| 1927 | 1 | break; |
|
| 1928 | 4 | case 0x0180: |
|
| 1929 | // Fill : fillType |
||
| 1930 | //@link : http://msdn.microsoft.com/en-us/library/dd947909(v=office.12).aspx |
||
| 1931 | 4 | break; |
|
| 1932 | 4 | case 0x0181: |
|
| 1933 | // Fill : fillColor |
||
| 1934 | //@link : http://msdn.microsoft.com/en-us/library/dd921332(v=office.12).aspx |
||
| 1935 | 1 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1936 | 1 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1937 | 1 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1938 | // echo 'fillColor : '.$strColor.EOL; |
||
| 1939 | 1 | break; |
|
| 1940 | 4 | case 0x0183: |
|
| 1941 | // Fill : fillBackColor |
||
| 1942 | //@link : http://msdn.microsoft.com/en-us/library/dd950634(v=office.12).aspx |
||
| 1943 | 1 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1944 | 1 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1945 | 1 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1946 | // echo 'fillBackColor : '.$strColor.EOL; |
||
| 1947 | 1 | break; |
|
| 1948 | 4 | case 0x0193: |
|
| 1949 | // Fill : fillRectRight |
||
| 1950 | //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx |
||
| 1951 | // echo 'fillRectRight : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; |
||
| 1952 | 4 | break; |
|
| 1953 | 4 | case 0x0194: |
|
| 1954 | // Fill : fillRectBottom |
||
| 1955 | //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx |
||
| 1956 | // echo 'fillRectBottom : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; |
||
| 1957 | 4 | break; |
|
| 1958 | 4 | case 0x01BF: |
|
| 1959 | // Fill : Fill Style Boolean Properties |
||
| 1960 | //@link : http://msdn.microsoft.com/en-us/library/dd909380(v=office.12).aspx |
||
| 1961 | 4 | break; |
|
| 1962 | 4 | case 0x01C0: |
|
| 1963 | // Line Style : lineColor |
||
| 1964 | //@link : http://msdn.microsoft.com/en-us/library/dd920397(v=office.12).aspx |
||
| 1965 | 4 | $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1966 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1967 | 4 | $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); |
|
| 1968 | 4 | $arrayReturn['lineColor'] = $strColor; |
|
| 1969 | 4 | break; |
|
| 1970 | 4 | case 0x01C1: |
|
| 1971 | // Line Style : lineOpacity |
||
| 1972 | //@link : http://msdn.microsoft.com/en-us/library/dd923433(v=office.12).aspx |
||
| 1973 | // echo 'lineOpacity : '.dechex($opt['op']).EOL; |
||
| 1974 | 4 | break; |
|
| 1975 | 4 | case 0x01C2: |
|
| 1976 | // Line Style : lineBackColor |
||
| 1977 | //@link : http://msdn.microsoft.com/en-us/library/dd947669(v=office.12).aspx |
||
| 1978 | 4 | break; |
|
| 1979 | 4 | case 0x01CB: |
|
| 1980 | // Line Style : lineWidth |
||
| 1981 | //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx |
||
| 1982 | 1 | $arrayReturn['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 1983 | 1 | break; |
|
| 1984 | 4 | case 0x01D6: |
|
| 1985 | // Line Style : lineJoinStyle |
||
| 1986 | //@link : http://msdn.microsoft.com/en-us/library/dd909643(v=office.12).aspx |
||
| 1987 | 4 | break; |
|
| 1988 | 4 | case 0x01D7: |
|
| 1989 | // Line Style : lineEndCapStyle |
||
| 1990 | //@link : http://msdn.microsoft.com/en-us/library/dd925071(v=office.12).aspx |
||
| 1991 | 4 | break; |
|
| 1992 | 4 | case 0x01FF: |
|
| 1993 | // Line Style : Line Style Boolean Properties |
||
| 1994 | //@link : http://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx |
||
| 1995 | 4 | break; |
|
| 1996 | 4 | case 0x0201: |
|
| 1997 | // Shadow Style : shadowColor |
||
| 1998 | //@link : http://msdn.microsoft.com/en-us/library/dd923454(v=office.12).aspx |
||
| 1999 | 3 | break; |
|
| 2000 | 4 | case 0x0204: |
|
| 2001 | // Shadow Style : shadowOpacity |
||
| 2002 | //@link : http://msdn.microsoft.com/en-us/library/dd920720(v=office.12).aspx |
||
| 2003 | 3 | break; |
|
| 2004 | 4 | case 0x0205: |
|
| 2005 | // Shadow Style : shadowOffsetX |
||
| 2006 | //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx |
||
| 2007 | 3 | $arrayReturn['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 2008 | 3 | break; |
|
| 2009 | 4 | case 0x0206: |
|
| 2010 | // Shadow Style : shadowOffsetY |
||
| 2011 | //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx |
||
| 2012 | 3 | $arrayReturn['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); |
|
| 2013 | 3 | break; |
|
| 2014 | 4 | case 0x023F: |
|
| 2015 | // Shadow Style : Shadow Style Boolean Properties |
||
| 2016 | //@link : http://msdn.microsoft.com/en-us/library/dd947887(v=office.12).aspx |
||
| 2017 | 4 | break; |
|
| 2018 | 4 | case 0x0304: |
|
| 2019 | // Shape : bWMode |
||
| 2020 | //@link : http://msdn.microsoft.com/en-us/library/dd947659(v=office.12).aspx |
||
| 2021 | 4 | break; |
|
| 2022 | 4 | case 0x033F: |
|
| 2023 | // Shape Boolean Properties |
||
| 2024 | //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx |
||
| 2025 | 4 | break; |
|
| 2026 | case 0x0380: |
||
| 2027 | // Group Shape Property Set : wzName |
||
| 2028 | //@link : http://msdn.microsoft.com/en-us/library/dd950681(v=office.12).aspx |
||
| 2029 | if ($opt['fComplex'] == 1) { |
||
| 2030 | $arrayReturn['length'] += $opt['op']; |
||
| 2031 | $data['recLen'] -= $opt['op']; |
||
| 2032 | } |
||
| 2033 | break; |
||
| 2034 | case 0x03BF: |
||
| 2035 | // Group Shape Property Set : Group Shape Boolean Properties |
||
| 2036 | //@link : http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx |
||
| 2037 | break; |
||
| 2038 | default: |
||
| 2039 | 4 | throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); |
|
| 2040 | } |
||
| 2041 | } |
||
| 2042 | 4 | if ($data['recLen'] > 0) { |
|
| 2043 | 2 | $arrayReturn['length'] += $data['recLen']; |
|
| 2044 | } |
||
| 2045 | } |
||
| 2046 | |||
| 2047 | 4 | return $arrayReturn; |
|
| 2048 | } |
||
| 2049 | |||
| 2050 | /** |
||
| 2051 | * The OfficeArtFPSPL record specifies the former hierarchical position of the containing object that is either a shape or a group of shapes. |
||
| 2052 | * @param string $stream |
||
| 2053 | * @param integer $pos |
||
| 2054 | * @link https://msdn.microsoft.com/en-us/library/dd947479(v=office.12).aspx |
||
| 2055 | */ |
||
| 2056 | private function readRecordOfficeArtFPSPL($stream, $pos) |
||
| 2070 | |||
| 2071 | /** |
||
| 2072 | * The OfficeArtFSP record specifies an instance of a shape. |
||
| 2073 | * @param string $stream |
||
| 2074 | * @param integer $pos |
||
| 2075 | * @link https://msdn.microsoft.com/en-us/library/dd925898(v=office.12).aspx |
||
| 2076 | */ |
||
| 2077 | 4 | private function readRecordOfficeArtFSP($stream, $pos) |
|
| 2099 | |||
| 2100 | /** |
||
| 2101 | * The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in. |
||
| 2102 | * @param string $stream |
||
| 2103 | * @param integer $pos |
||
| 2104 | * @link https://msdn.microsoft.com/en-us/library/dd925381(v=office.12).aspx |
||
| 2105 | */ |
||
| 2106 | 4 | private function readRecordOfficeArtFSPGR($stream, $pos) |
|
| 2127 | |||
| 2128 | /** |
||
| 2129 | * The OfficeArtSecondaryFOPT record specifies a table of OfficeArtRGFOPTE records. |
||
| 2130 | * @param string $stream |
||
| 2131 | * @param integer $pos |
||
| 2132 | * @link https://msdn.microsoft.com/en-us/library/dd950259(v=office.12).aspx |
||
| 2133 | */ |
||
| 2134 | 4 | private function readRecordOfficeArtSecondaryFOPT($stream, $pos) |
|
| 2149 | |||
| 2150 | /** |
||
| 2151 | * A container record that specifies information about a shape. |
||
| 2152 | * @param string $stream |
||
| 2153 | * @param integer $pos |
||
| 2154 | * @link : https://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx |
||
| 2155 | */ |
||
| 2156 | 4 | private function readRecordOfficeArtClientData($stream, $pos) |
|
| 2230 | |||
| 2231 | /** |
||
| 2232 | * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. |
||
| 2233 | * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx |
||
| 2234 | * @param string $stream |
||
| 2235 | * @param integer $pos |
||
| 2236 | * @throws \Exception |
||
| 2237 | */ |
||
| 2238 | 4 | private function readRecordPersistDirectoryAtom($stream, $pos) |
|
| 2263 | |||
| 2264 | /** |
||
| 2265 | * A container record that specifies information about the headers (1) and footers within a slide. |
||
| 2266 | * @param string $stream |
||
| 2267 | * @param integer $pos |
||
| 2268 | * @link https://msdn.microsoft.com/en-us/library/dd904856(v=office.12).aspx |
||
| 2269 | */ |
||
| 2270 | 4 | private function readRecordPerSlideHeadersFootersContainer($stream, $pos) |
|
| 2286 | |||
| 2287 | /** |
||
| 2288 | * An atom record that specifies whether a shape is a placeholder shape. |
||
| 2289 | * @param string $stream |
||
| 2290 | * @param integer $pos |
||
| 2291 | * @link https://msdn.microsoft.com/en-us/library/dd923930(v=office.12).aspx |
||
| 2292 | */ |
||
| 2293 | private function readRecordPlaceholderAtom($stream, $pos) |
||
| 2309 | |||
| 2310 | /** |
||
| 2311 | * An atom record that specifies a collection of re-color mappings for a metafile ([MS-WMF]). |
||
| 2312 | * @param string $stream |
||
| 2313 | * @param integer $pos |
||
| 2314 | * @link https://msdn.microsoft.com/en-us/library/dd904899(v=office.12).aspx |
||
| 2315 | */ |
||
| 2316 | private function readRecordRecolorInfoAtom($stream, $pos) |
||
| 2332 | |||
| 2333 | /** |
||
| 2334 | * An atom record that specifies that a shape is a header or footerplaceholder shape. |
||
| 2335 | * @param string $stream |
||
| 2336 | * @param integer $pos |
||
| 2337 | * @link https://msdn.microsoft.com/en-us/library/dd910800(v=office.12).aspx |
||
| 2338 | */ |
||
| 2339 | private function readRecordRoundTripHFPlaceholder12Atom($stream, $pos) |
||
| 2355 | |||
| 2356 | /** |
||
| 2357 | * An atom record that specifies a shape identifier. |
||
| 2358 | * @param string $stream |
||
| 2359 | * @param integer $pos |
||
| 2360 | * @link https://msdn.microsoft.com/en-us/library/dd772926(v=office.12).aspx |
||
| 2361 | */ |
||
| 2362 | private function readRecordRoundTripShapeId12Atom($stream, $pos) |
||
| 2378 | |||
| 2379 | /** |
||
| 2380 | * A container record that specifies information about a slide that synchronizes to a slide in a slide library. |
||
| 2381 | * @param string $stream |
||
| 2382 | * @param integer $pos |
||
| 2383 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 2384 | */ |
||
| 2385 | 4 | private function readRecordRoundTripSlideSyncInfo12Container($stream, $pos) |
|
| 2401 | |||
| 2402 | /** |
||
| 2403 | * An atom record that specifies shape-level Boolean flags. |
||
| 2404 | * @param string $stream |
||
| 2405 | * @param integer $pos |
||
| 2406 | * @link https://msdn.microsoft.com/en-us/library/dd908949(v=office.12).aspx |
||
| 2407 | */ |
||
| 2408 | private function readRecordShapeFlags10Atom($stream, $pos) |
||
| 2424 | |||
| 2425 | /** |
||
| 2426 | * An atom record that specifies shape-level Boolean flags. |
||
| 2427 | * @param string $stream |
||
| 2428 | * @param integer $pos |
||
| 2429 | * @link https://msdn.microsoft.com/en-us/library/dd925824(v=office.12).aspx |
||
| 2430 | */ |
||
| 2431 | private function readRecordShapeFlagsAtom($stream, $pos) |
||
| 2447 | |||
| 2448 | /** |
||
| 2449 | * A container record that specifies programmable tags with additional binary shape data. |
||
| 2450 | * @param string $stream |
||
| 2451 | * @param integer $pos |
||
| 2452 | * @link https://msdn.microsoft.com/en-us/library/dd911033(v=office.12).aspx |
||
| 2453 | */ |
||
| 2454 | private function readRecordShapeProgBinaryTagContainer($stream, $pos) |
||
| 2470 | |||
| 2471 | /** |
||
| 2472 | * A container record that specifies programmable tags with additional shape data. |
||
| 2473 | * @param string $stream |
||
| 2474 | * @param integer $pos |
||
| 2475 | * @link https://msdn.microsoft.com/en-us/library/dd911266(v=office.12).aspx |
||
| 2476 | */ |
||
| 2477 | private function readRecordShapeProgTagsContainer($stream, $pos) |
||
| 2507 | |||
| 2508 | /** |
||
| 2509 | * An atom record that specifies information about a slide. |
||
| 2510 | * @param string $stream |
||
| 2511 | * @param integer $pos |
||
| 2512 | * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx |
||
| 2513 | */ |
||
| 2514 | 4 | private function readRecordSlideAtom($stream, $pos) |
|
| 2545 | |||
| 2546 | /** |
||
| 2547 | * A container record that specifies a presentation slide or title master slide. |
||
| 2548 | * @param string $stream |
||
| 2549 | * @param int $pos |
||
| 2550 | * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx |
||
| 2551 | */ |
||
| 2552 | 4 | private function readRecordSlideContainer($stream, $pos) |
|
| 2598 | |||
| 2599 | /** |
||
| 2600 | * An atom record that specifies the name of a slide. |
||
| 2601 | * @param string $stream |
||
| 2602 | * @param integer $pos |
||
| 2603 | * @link https://msdn.microsoft.com/en-us/library/dd906297(v=office.12).aspx |
||
| 2604 | */ |
||
| 2605 | 4 | private function readRecordSlideNameAtom($stream, $pos) |
|
| 2627 | |||
| 2628 | /** |
||
| 2629 | * An atom record that specifies a slide number metacharacter. |
||
| 2630 | * @param string $stream |
||
| 2631 | * @param integer $pos |
||
| 2632 | * @link https://msdn.microsoft.com/en-us/library/dd945703(v=office.12).aspx |
||
| 2633 | */ |
||
| 2634 | private function readRecordSlideNumberMCAtom($stream, $pos) |
||
| 2650 | |||
| 2651 | |||
| 2652 | |||
| 2653 | /** |
||
| 2654 | * A container record that specifies programmable tags with additional slide data. |
||
| 2655 | * @param string $stream |
||
| 2656 | * @param integer $pos |
||
| 2657 | * @link https://msdn.microsoft.com/en-us/library/dd951946(v=office.12).aspx |
||
| 2658 | */ |
||
| 2659 | 4 | private function readRecordSlideProgTagsContainer($stream, $pos) |
|
| 2675 | |||
| 2676 | /** |
||
| 2677 | * A container record that specifies the color scheme used by a slide. |
||
| 2678 | * @param string $stream |
||
| 2679 | * @param integer $pos |
||
| 2680 | * @link https://msdn.microsoft.com/en-us/library/dd949420(v=office.12).aspx |
||
| 2681 | */ |
||
| 2682 | 4 | private function readRecordSlideSchemeColorSchemeAtom($stream, $pos) |
|
| 2706 | |||
| 2707 | /** |
||
| 2708 | * An atom record that specifies what transition effect to perform during a slide show, and how to advance to the next presentation slide. |
||
| 2709 | * @param string $stream |
||
| 2710 | * @param integer $pos |
||
| 2711 | * @link https://msdn.microsoft.com/en-us/library/dd943408(v=office.12).aspx |
||
| 2712 | */ |
||
| 2713 | 4 | private function readRecordSlideShowSlideInfoAtom($stream, $pos) |
|
| 2729 | |||
| 2730 | /** |
||
| 2731 | * UserEditAtom |
||
| 2732 | * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx |
||
| 2733 | * @param string $stream |
||
| 2734 | * @param integer $pos |
||
| 2735 | * @throws \Exception |
||
| 2736 | */ |
||
| 2737 | 4 | private function readRecordUserEditAtom($stream, $pos) |
|
| 2784 | |||
| 2785 | /** |
||
| 2786 | * A structure that specifies the character-level formatting of a run of text. |
||
| 2787 | * @param string $stream |
||
| 2788 | * @param int $pos |
||
| 2789 | * @param int $strLenRT |
||
| 2790 | * @link https://msdn.microsoft.com/en-us/library/dd945870(v=office.12).aspx |
||
| 2791 | */ |
||
| 2792 | 3 | private function readStructureTextCFRun($stream, $pos, $strLenRT) |
|
| 2899 | |||
| 2900 | /** |
||
| 2901 | * A structure that specifies the paragraph-level formatting of a run of text. |
||
| 2902 | * @param string $stream |
||
| 2903 | * @param integer $pos |
||
| 2904 | * @link https://msdn.microsoft.com/en-us/library/dd923535(v=office.12).aspx |
||
| 2905 | */ |
||
| 2906 | 3 | private function readStructureTextPFRun($stream, $pos, $strLenRT) |
|
| 2907 | { |
||
| 2908 | $arrayReturn = array( |
||
| 2909 | 3 | 'length' => 0, |
|
| 2910 | 3 | 'strLenRT' => $strLenRT, |
|
| 2911 | ); |
||
| 2912 | |||
| 2913 | // rgTextPFRun |
||
| 2914 | 3 | $countRgTextPFRun = self::getInt4d($stream, $pos + $arrayReturn['length']); |
|
| 2915 | 3 | $arrayReturn['strLenRT'] -= $countRgTextPFRun; |
|
| 2916 | 3 | $arrayReturn['length'] += 4; |
|
| 2917 | |||
| 2918 | // indent |
||
| 2919 | 3 | $arrayReturn['length'] += 2; |
|
| 2920 | |||
| 2921 | 3 | $masks = self::getInt4d($stream, $pos + $arrayReturn['length']); |
|
| 2922 | 3 | $arrayReturn['length'] += 4; |
|
| 2923 | |||
| 2924 | 3 | $masksData = array(); |
|
| 2925 | 3 | $masksData['hasBullet'] = ($masks >> 0) & bindec('1'); |
|
| 2926 | 3 | $masksData['bulletHasFont'] = ($masks >> 1) & bindec('1'); |
|
| 2927 | 3 | $masksData['bulletHasColor'] = ($masks >> 2) & bindec('1'); |
|
| 2928 | 3 | $masksData['bulletHasSize'] = ($masks >> 3) & bindec('1'); |
|
| 2929 | 3 | $masksData['bulletFont'] = ($masks >> 4) & bindec('1'); |
|
| 2930 | 3 | $masksData['bulletColor'] = ($masks >> 5) & bindec('1'); |
|
| 2931 | 3 | $masksData['bulletSize'] = ($masks >> 6) & bindec('1'); |
|
| 2932 | 3 | $masksData['bulletChar'] = ($masks >> 7) & bindec('1'); |
|
| 2933 | 3 | $masksData['leftMargin'] = ($masks >> 8) & bindec('1'); |
|
| 2934 | 3 | $masksData['unused'] = ($masks >> 9) & bindec('1'); |
|
| 2935 | 3 | $masksData['indent'] = ($masks >> 10) & bindec('1'); |
|
| 2936 | 3 | $masksData['align'] = ($masks >> 11) & bindec('1'); |
|
| 2937 | 3 | $masksData['lineSpacing'] = ($masks >> 12) & bindec('1'); |
|
| 2938 | 3 | $masksData['spaceBefore'] = ($masks >> 13) & bindec('1'); |
|
| 2939 | 3 | $masksData['spaceAfter'] = ($masks >> 14) & bindec('1'); |
|
| 2940 | 3 | $masksData['defaultTabSize'] = ($masks >> 15) & bindec('1'); |
|
| 2941 | 3 | $masksData['fontAlign'] = ($masks >> 16) & bindec('1'); |
|
| 2942 | 3 | $masksData['charWrap'] = ($masks >> 17) & bindec('1'); |
|
| 2943 | 3 | $masksData['wordWrap'] = ($masks >> 18) & bindec('1'); |
|
| 2944 | 3 | $masksData['overflow'] = ($masks >> 19) & bindec('1'); |
|
| 2945 | 3 | $masksData['tabStops'] = ($masks >> 20) & bindec('1'); |
|
| 2946 | 3 | $masksData['textDirection'] = ($masks >> 21) & bindec('1'); |
|
| 2947 | 3 | $masksData['reserved1'] = ($masks >> 22) & bindec('1'); |
|
| 2948 | 3 | $masksData['bulletBlip'] = ($masks >> 23) & bindec('1'); |
|
| 2949 | 3 | $masksData['bulletScheme'] = ($masks >> 24) & bindec('1'); |
|
| 2950 | 3 | $masksData['bulletHasScheme'] = ($masks >> 25) & bindec('1'); |
|
| 2951 | |||
| 2952 | 3 | $bulletFlags = array(); |
|
| 2953 | 3 | if ($masksData['hasBullet'] == 1 || $masksData['bulletHasFont'] == 1 || $masksData['bulletHasColor'] == 1 || $masksData['bulletHasSize'] == 1) { |
|
| 2954 | 3 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 2955 | 3 | $arrayReturn['length'] += 2; |
|
| 2956 | |||
| 2957 | 3 | $bulletFlags['fHasBullet'] = ($data >> 0) & bindec('1'); |
|
| 2958 | 3 | $bulletFlags['fBulletHasFont'] = ($data >> 1) & bindec('1'); |
|
| 2959 | 3 | $bulletFlags['fBulletHasColor'] = ($data >> 2) & bindec('1'); |
|
| 2960 | 3 | $bulletFlags['fBulletHasSize'] = ($data >> 3) & bindec('1'); |
|
| 2961 | } |
||
| 2962 | 3 | if ($masksData['bulletChar'] == 1) { |
|
| 2963 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 2964 | 1 | $arrayReturn['length'] += 2; |
|
| 2965 | 1 | $arrayReturn['bulletChar'] = chr($data); |
|
| 2966 | } |
||
| 2967 | 3 | if ($masksData['bulletFont'] == 1) { |
|
| 2968 | // $data = self::getInt2d($stream, $pos); |
||
| 2969 | 1 | $arrayReturn['length'] += 2; |
|
| 2970 | } |
||
| 2971 | 3 | if ($masksData['bulletSize'] == 1) { |
|
| 2972 | // $data = self::getInt2d($stream, $pos); |
||
| 2973 | 2 | $arrayReturn['length'] += 2; |
|
| 2974 | } |
||
| 2975 | 3 | if ($masksData['bulletColor'] == 1) { |
|
| 2976 | 1 | $red = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 2977 | 1 | $arrayReturn['length'] += 1; |
|
| 2978 | 1 | $green = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 2979 | 1 | $arrayReturn['length'] += 1; |
|
| 2980 | 1 | $blue = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 2981 | 1 | $arrayReturn['length'] += 1; |
|
| 2982 | 1 | $index = self::getInt1d($stream, $pos + $arrayReturn['length']); |
|
| 2983 | 1 | $arrayReturn['length'] += 1; |
|
| 2984 | |||
| 2985 | 1 | if ($index == 0xFE) { |
|
| 2986 | 1 | $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); |
|
| 2987 | 1 | $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); |
|
| 2988 | 1 | $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); |
|
| 2989 | } |
||
| 2990 | } |
||
| 2991 | 3 | if ($masksData['align'] == 1) { |
|
| 2992 | 3 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 2993 | 3 | $arrayReturn['length'] += 2; |
|
| 2994 | switch ($data) { |
||
| 2995 | 3 | case 0x0000: |
|
| 2996 | 1 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_LEFT; |
|
| 2997 | 1 | break; |
|
| 2998 | 2 | case 0x0001: |
|
| 2999 | 2 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_CENTER; |
|
| 3000 | 2 | break; |
|
| 3001 | case 0x0002: |
||
| 3002 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_RIGHT; |
||
| 3003 | break; |
||
| 3004 | case 0x0003: |
||
| 3005 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; |
||
| 3006 | break; |
||
| 3007 | case 0x0004: |
||
| 3008 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; |
||
| 3009 | break; |
||
| 3010 | case 0x0005: |
||
| 3011 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; |
||
| 3012 | break; |
||
| 3013 | case 0x0006: |
||
| 3014 | $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; |
||
| 3015 | break; |
||
| 3016 | default: |
||
| 3017 | break; |
||
| 3018 | } |
||
| 3019 | } |
||
| 3020 | 3 | if ($masksData['lineSpacing'] == 1) { |
|
| 3021 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3022 | 3 | $arrayReturn['length'] += 2; |
|
| 3023 | } |
||
| 3024 | 3 | if ($masksData['spaceBefore'] == 1) { |
|
| 3025 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3026 | 2 | $arrayReturn['length'] += 2; |
|
| 3027 | } |
||
| 3028 | 3 | if ($masksData['spaceAfter'] == 1) { |
|
| 3029 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3030 | 2 | $arrayReturn['length'] += 2; |
|
| 3031 | } |
||
| 3032 | 3 | if ($masksData['leftMargin'] == 1) { |
|
| 3033 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3034 | 1 | $arrayReturn['length'] += 2; |
|
| 3035 | 1 | $arrayReturn['leftMargin'] = (int)round($data/6); |
|
| 3036 | } |
||
| 3037 | 3 | if ($masksData['indent'] == 1) { |
|
| 3038 | 1 | $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
|
| 3039 | 1 | $arrayReturn['length'] += 2; |
|
| 3040 | 1 | $arrayReturn['indent'] = (int)round($data/6); |
|
| 3041 | } |
||
| 3042 | 3 | if ($masksData['defaultTabSize'] == 1) { |
|
| 3043 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3044 | $arrayReturn['length'] += 2; |
||
| 3045 | } |
||
| 3046 | 3 | if ($masksData['tabStops'] == 1) { |
|
| 3047 | throw new \Exception('Feature not implemented (l.'.__LINE__.')'); |
||
| 3048 | } |
||
| 3049 | 3 | if ($masksData['fontAlign'] == 1) { |
|
| 3050 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3051 | $arrayReturn['length'] += 2; |
||
| 3052 | } |
||
| 3053 | 3 | if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { |
|
| 3054 | // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); |
||
| 3055 | 3 | $arrayReturn['length'] += 2; |
|
| 3056 | } |
||
| 3057 | 3 | if ($masksData['textDirection'] == 1) { |
|
| 3058 | throw new \Exception('Feature not implemented (l.'.__LINE__.')'); |
||
| 3059 | } |
||
| 3060 | |||
| 3061 | 3 | return $arrayReturn; |
|
| 3062 | } |
||
| 3063 | |||
| 3064 | |||
| 3065 | /** |
||
| 3066 | * A structure that specifies language and spelling information for a run of text. |
||
| 3067 | * @param string $stream |
||
| 3068 | * @param integer $pos |
||
| 3069 | * @link https://msdn.microsoft.com/en-us/library/dd909603(v=office.12).aspx |
||
| 3070 | */ |
||
| 3071 | 3 | private function readStructureTextSIRun($stream, $pos, $strLenRT) |
|
| 3123 | |||
| 3124 | /** |
||
| 3125 | * A structure that specifies tabbing, margins, and indentation for text. |
||
| 3126 | * @param string $stream |
||
| 3127 | * @param integer $pos |
||
| 3128 | * @link https://msdn.microsoft.com/en-us/library/dd922749(v=office.12).aspx |
||
| 3129 | */ |
||
| 3130 | 3 | private function readStructureTextRuler($stream, $pos) |
|
| 3218 | } |
||
| 3219 |