• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPOffice / PHPWord / 10632159000

30 Aug 2024 11:50AM UTC coverage: 96.975% (-0.06%) from 97.033%
10632159000

push

github

web-flow
MsDoc Reader: Support for UTF-8 characters (#2664)

5 of 5 new or added lines in 1 file covered. (100.0%)

8 existing lines in 1 file now uncovered.

11831 of 12200 relevant lines covered (96.98%)

32.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.05
/src/PhpWord/Reader/MsDoc.php
1
<?php
2
/**
3
 * This file is part of PHPWord - A pure PHP library for reading and writing
4
 * word processing documents.
5
 *
6
 * PHPWord is free software distributed under the terms of the GNU Lesser
7
 * General Public License version 3 as published by the Free Software Foundation.
8
 *
9
 * For the full copyright and license information, please read the LICENSE
10
 * file that was distributed with this source code. For the full list of
11
 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
12
 *
13
 * @see         https://github.com/PHPOffice/PHPWord
14
 *
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17

18
namespace PhpOffice\PhpWord\Reader;
19

20
use PhpOffice\PhpWord\PhpWord;
21
use PhpOffice\PhpWord\Shared\Drawing;
22
use PhpOffice\PhpWord\Shared\OLERead;
23
use PhpOffice\PhpWord\Style;
24
use stdClass;
25

26
/**
27
 * Reader for Word97.
28
 *
29
 * @since 0.10.0
30
 */
31
class MsDoc extends AbstractReader implements ReaderInterface
32
{
33
    /**
34
     * PhpWord object.
35
     *
36
     * @var PhpWord
37
     */
38
    private $phpWord;
39

40
    /**
41
     * WordDocument Stream.
42
     */
43
    private $dataWorkDocument;
44

45
    /**
46
     * 1Table Stream.
47
     */
48
    private $data1Table;
49

50
    /**
51
     * Data Stream.
52
     */
53
    private $dataData;
54

55
    /**
56
     * Object Pool Stream.
57
     */
58
    private $dataObjectPool;
59

60
    /**
61
     * @var stdClass[]
62
     */
63
    private $arrayCharacters = [];
64

65
    /**
66
     * @var array
67
     */
68
    private $arrayFib = [];
69

70
    /**
71
     * @var string[]
72
     */
73
    private $arrayFonts = [];
74

75
    /**
76
     * @var string[]
77
     */
78
    private $arrayParagraphs = [];
79

80
    /**
81
     * @var stdClass[]
82
     */
83
    private $arraySections = [];
84

85
    /** @var string */
86
    private $summaryInformation;
87

88
    /** @var string */
89
    private $documentSummaryInformation;
90

91
    const VERSION_97 = '97';
92
    const VERSION_2000 = '2000';
93
    const VERSION_2002 = '2002';
94
    const VERSION_2003 = '2003';
95
    const VERSION_2007 = '2007';
96

97
    const SPRA_VALUE = 10;
98
    const SPRA_VALUE_OPPOSITE = 20;
99

100
    const OFFICEARTBLIPEMF = 0xF01A;
101
    const OFFICEARTBLIPWMF = 0xF01B;
102
    const OFFICEARTBLIPPICT = 0xF01C;
103
    const OFFICEARTBLIPJPG = 0xF01D;
104
    const OFFICEARTBLIPPNG = 0xF01E;
105
    const OFFICEARTBLIPDIB = 0xF01F;
106
    const OFFICEARTBLIPTIFF = 0xF029;
107
    const OFFICEARTBLIPJPEG = 0xF02A;
108

109
    const MSOBLIPERROR = 0x00;
110
    const MSOBLIPUNKNOWN = 0x01;
111
    const MSOBLIPEMF = 0x02;
112
    const MSOBLIPWMF = 0x03;
113
    const MSOBLIPPICT = 0x04;
114
    const MSOBLIPJPEG = 0x05;
115
    const MSOBLIPPNG = 0x06;
116
    const MSOBLIPDIB = 0x07;
117
    const MSOBLIPTIFF = 0x11;
118
    const MSOBLIPCMYKJPEG = 0x12;
119

120
    /**
121
     * Loads PhpWord from file.
122
     *
123
     * @param string $filename
124
     *
125
     * @return PhpWord
126
     */
127
    public function load($filename)
128
    {
129
        $this->phpWord = new PhpWord();
7✔
130

131
        $this->loadOLE($filename);
7✔
132

133
        $this->readFib($this->dataWorkDocument);
5✔
134
        $this->readFibContent();
5✔
135

136
        return $this->phpWord;
5✔
137
    }
138

139
    /**
140
     * Load an OLE Document.
141
     *
142
     * @param string $filename
143
     */
144
    private function loadOLE($filename): void
145
    {
146
        // OLE reader
147
        $ole = new OLERead();
7✔
148
        $ole->read($filename);
7✔
149

150
        // Get WorkDocument stream
151
        $this->dataWorkDocument = $ole->getStream($ole->wrkdocument);
5✔
152
        // Get 1Table stream
153
        $this->data1Table = $ole->getStream($ole->wrk1Table);
5✔
154
        // Get Data stream
155
        $this->dataData = $ole->getStream($ole->wrkData);
5✔
156
        // Get Data stream
157
        $this->dataObjectPool = $ole->getStream($ole->wrkObjectPool);
5✔
158
        // Get Summary Information data
159
        $this->summaryInformation = $ole->getStream($ole->summaryInformation);
5✔
160
        // Get Document Summary Information data
161
        $this->documentSummaryInformation = $ole->getStream($ole->docSummaryInfos);
5✔
162
    }
163

164
    private function getNumInLcb($lcb, $iSize)
165
    {
166
        return ($lcb - 4) / (4 + $iSize);
5✔
167
    }
168

169
    private function getArrayCP($data, $posMem, $iNum)
170
    {
171
        $arrayCP = [];
5✔
172
        for ($inc = 0; $inc < $iNum; ++$inc) {
5✔
173
            $arrayCP[$inc] = self::getInt4d($data, $posMem);
5✔
174
            $posMem += 4;
5✔
175
        }
176

177
        return $arrayCP;
5✔
178
    }
179

180
    /**
181
     * @see  http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
182
     * @see  https://igor.io/2012/09/24/binary-parsing.html
183
     *
184
     * @param string $data
185
     */
186
    private function readFib($data)
187
    {
188
        $pos = 0;
5✔
189
        //----- FibBase
190
        // wIdent
191
        $pos += 2;
5✔
192
        // nFib
193
        $pos += 2;
5✔
194
        // unused
195
        $pos += 2;
5✔
196
        // lid : Language Identifier
197
        $pos += 2;
5✔
198
        // pnNext
199
        $pos += 2;
5✔
200

201
        // $mem = self::getInt2d($data, $pos);
202
        // $fDot = ($mem >> 15) & 1;
203
        // $fGlsy = ($mem >> 14) & 1;
204
        // $fComplex = ($mem >> 13) & 1;
205
        // $fHasPic = ($mem >> 12) & 1;
206
        // $cQuickSaves = ($mem >> 8) & bindec('1111');
207
        // $fEncrypted = ($mem >> 7) & 1;
208
        // $fWhichTblStm = ($mem >> 6) & 1;
209
        // $fReadOnlyRecommended = ($mem >> 5) & 1;
210
        // $fWriteReservation = ($mem >> 4) & 1;
211
        // $fExtChar = ($mem >> 3) & 1;
212
        // $fLoadOverride = ($mem >> 2) & 1;
213
        // $fFarEast = ($mem >> 1) & 1;
214
        // $fObfuscated = ($mem >> 0) & 1;
215
        $pos += 2;
5✔
216
        // nFibBack
217
        $pos += 2;
5✔
218
        // lKey
219
        $pos += 4;
5✔
220
        // envr
221
        ++$pos;
5✔
222

223
        // $mem = self::getInt1d($data, $pos);
224
        // $fMac = ($mem >> 7) & 1;
225
        // $fEmptySpecial = ($mem >> 6) & 1;
226
        // $fLoadOverridePage = ($mem >> 5) & 1;
227
        // $reserved1 = ($mem >> 4) & 1;
228
        // $reserved2 = ($mem >> 3) & 1;
229
        // $fSpare0 = ($mem >> 0) & bindec('111');
230
        ++$pos;
5✔
231

232
        // reserved3
233
        $pos += 2;
5✔
234
        // reserved4
235
        $pos += 2;
5✔
236
        // reserved5
237
        $pos += 4;
5✔
238
        // reserved6
239
        $pos += 4;
5✔
240

241
        //----- csw
242
        $pos += 2;
5✔
243

244
        //----- fibRgW
245
        // reserved1
246
        $pos += 2;
5✔
247
        // reserved2
248
        $pos += 2;
5✔
249
        // reserved3
250
        $pos += 2;
5✔
251
        // reserved4
252
        $pos += 2;
5✔
253
        // reserved5
254
        $pos += 2;
5✔
255
        // reserved6
256
        $pos += 2;
5✔
257
        // reserved7
258
        $pos += 2;
5✔
259
        // reserved8
260
        $pos += 2;
5✔
261
        // reserved9
262
        $pos += 2;
5✔
263
        // reserved10
264
        $pos += 2;
5✔
265
        // reserved11
266
        $pos += 2;
5✔
267
        // reserved12
268
        $pos += 2;
5✔
269
        // reserved13
270
        $pos += 2;
5✔
271
        // lidFE
272
        $pos += 2;
5✔
273

274
        //----- cslw
275
        $pos += 2;
5✔
276

277
        //----- fibRgLw
278
        // cbMac
279
        $pos += 4;
5✔
280
        // reserved1
281
        $pos += 4;
5✔
282
        // reserved2
283
        $pos += 4;
5✔
284
        $this->arrayFib['ccpText'] = self::getInt4d($data, $pos);
5✔
285
        $pos += 4;
5✔
286
        $this->arrayFib['ccpFtn'] = self::getInt4d($data, $pos);
5✔
287
        $pos += 4;
5✔
288
        $this->arrayFib['ccpHdd'] = self::getInt4d($data, $pos);
5✔
289
        $pos += 4;
5✔
290
        // reserved3
291
        $pos += 4;
5✔
292
        // ccpAtn
293
        $pos += 4;
5✔
294
        // ccpEdn
295
        $pos += 4;
5✔
296
        // ccpTxbx
297
        $pos += 4;
5✔
298
        // ccpHdrTxbx
299
        $pos += 4;
5✔
300
        // reserved4
301
        $pos += 4;
5✔
302
        // reserved5
303
        $pos += 4;
5✔
304
        // reserved6
305
        $pos += 4;
5✔
306
        // reserved7
307
        $pos += 4;
5✔
308
        // reserved8
309
        $pos += 4;
5✔
310
        // reserved9
311
        $pos += 4;
5✔
312
        // reserved10
313
        $pos += 4;
5✔
314
        // reserved11
315
        $pos += 4;
5✔
316
        // reserved12
317
        $pos += 4;
5✔
318
        // reserved13
319
        $pos += 4;
5✔
320
        // reserved14
321
        $pos += 4;
5✔
322

323
        //----- cbRgFcLcb
324
        $cbRgFcLcb = self::getInt2d($data, $pos);
5✔
325
        $pos += 2;
5✔
326
        //----- fibRgFcLcbBlob
327
        switch ($cbRgFcLcb) {
328
            case 0x005D:
5✔
329
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
330

331
                break;
×
332
            case 0x006C:
5✔
333
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
334
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
×
335

336
                break;
×
337
            case 0x0088:
5✔
338
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
2✔
339
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
2✔
340
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
2✔
341

342
                break;
2✔
343
            case 0x00A4:
3✔
344
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
345
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
×
346
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
×
347
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2003);
×
348

349
                break;
×
350
            case 0x00B7:
3✔
351
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
3✔
352
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
3✔
353
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
3✔
354
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2003);
3✔
355
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2007);
3✔
356

357
                break;
3✔
358
        }
359
        //----- cswNew
360
        $this->arrayFib['cswNew'] = self::getInt2d($data, $pos);
5✔
361
        $pos += 2;
5✔
362

363
        if ($this->arrayFib['cswNew'] != 0) {
5✔
364
            //@todo : fibRgCswNew
365
        }
366

367
        return $pos;
5✔
368
    }
369

370
    private function readBlockFibRgFcLcb($data, $pos, $version)
371
    {
372
        if ($version == self::VERSION_97) {
5✔
373
            $this->arrayFib['fcStshfOrig'] = self::getInt4d($data, $pos);
5✔
374
            $pos += 4;
5✔
375
            $this->arrayFib['lcbStshfOrig'] = self::getInt4d($data, $pos);
5✔
376
            $pos += 4;
5✔
377
            $this->arrayFib['fcStshf'] = self::getInt4d($data, $pos);
5✔
378
            $pos += 4;
5✔
379
            $this->arrayFib['lcbStshf'] = self::getInt4d($data, $pos);
5✔
380
            $pos += 4;
5✔
381
            $this->arrayFib['fcPlcffndRef'] = self::getInt4d($data, $pos);
5✔
382
            $pos += 4;
5✔
383
            $this->arrayFib['lcbPlcffndRef'] = self::getInt4d($data, $pos);
5✔
384
            $pos += 4;
5✔
385
            $this->arrayFib['fcPlcffndTxt'] = self::getInt4d($data, $pos);
5✔
386
            $pos += 4;
5✔
387
            $this->arrayFib['lcbPlcffndTxt'] = self::getInt4d($data, $pos);
5✔
388
            $pos += 4;
5✔
389
            $this->arrayFib['fcPlcfandRef'] = self::getInt4d($data, $pos);
5✔
390
            $pos += 4;
5✔
391
            $this->arrayFib['lcbPlcfandRef'] = self::getInt4d($data, $pos);
5✔
392
            $pos += 4;
5✔
393
            $this->arrayFib['fcPlcfandTxt'] = self::getInt4d($data, $pos);
5✔
394
            $pos += 4;
5✔
395
            $this->arrayFib['lcbPlcfandTxt '] = self::getInt4d($data, $pos);
5✔
396
            $pos += 4;
5✔
397
            $this->arrayFib['fcPlcfSed'] = self::getInt4d($data, $pos);
5✔
398
            $pos += 4;
5✔
399
            $this->arrayFib['lcbPlcfSed'] = self::getInt4d($data, $pos);
5✔
400
            $pos += 4;
5✔
401
            $this->arrayFib['fcPlcPad'] = self::getInt4d($data, $pos);
5✔
402
            $pos += 4;
5✔
403
            $this->arrayFib['lcbPlcPad'] = self::getInt4d($data, $pos);
5✔
404
            $pos += 4;
5✔
405
            $this->arrayFib['fcPlcfPhe'] = self::getInt4d($data, $pos);
5✔
406
            $pos += 4;
5✔
407
            $this->arrayFib['lcbPlcfPhe'] = self::getInt4d($data, $pos);
5✔
408
            $pos += 4;
5✔
409
            $this->arrayFib['fcSttbfGlsy'] = self::getInt4d($data, $pos);
5✔
410
            $pos += 4;
5✔
411
            $this->arrayFib['lcbSttbfGlsy'] = self::getInt4d($data, $pos);
5✔
412
            $pos += 4;
5✔
413
            $this->arrayFib['fcPlcfGlsy'] = self::getInt4d($data, $pos);
5✔
414
            $pos += 4;
5✔
415
            $this->arrayFib['lcbPlcfGlsy'] = self::getInt4d($data, $pos);
5✔
416
            $pos += 4;
5✔
417
            $this->arrayFib['fcPlcfHdd'] = self::getInt4d($data, $pos);
5✔
418
            $pos += 4;
5✔
419
            $this->arrayFib['lcbPlcfHdd'] = self::getInt4d($data, $pos);
5✔
420
            $pos += 4;
5✔
421
            $this->arrayFib['fcPlcfBteChpx'] = self::getInt4d($data, $pos);
5✔
422
            $pos += 4;
5✔
423
            $this->arrayFib['lcbPlcfBteChpx'] = self::getInt4d($data, $pos);
5✔
424
            $pos += 4;
5✔
425
            $this->arrayFib['fcPlcfBtePapx'] = self::getInt4d($data, $pos);
5✔
426
            $pos += 4;
5✔
427
            $this->arrayFib['lcbPlcfBtePapx'] = self::getInt4d($data, $pos);
5✔
428
            $pos += 4;
5✔
429
            $this->arrayFib['fcPlcfSea'] = self::getInt4d($data, $pos);
5✔
430
            $pos += 4;
5✔
431
            $this->arrayFib['lcbPlcfSea'] = self::getInt4d($data, $pos);
5✔
432
            $pos += 4;
5✔
433
            $this->arrayFib['fcSttbfFfn'] = self::getInt4d($data, $pos);
5✔
434
            $pos += 4;
5✔
435
            $this->arrayFib['lcbSttbfFfn'] = self::getInt4d($data, $pos);
5✔
436
            $pos += 4;
5✔
437
            $this->arrayFib['fcPlcfFldMom'] = self::getInt4d($data, $pos);
5✔
438
            $pos += 4;
5✔
439
            $this->arrayFib['lcbPlcfFldMom'] = self::getInt4d($data, $pos);
5✔
440
            $pos += 4;
5✔
441
            $this->arrayFib['fcPlcfFldHdr'] = self::getInt4d($data, $pos);
5✔
442
            $pos += 4;
5✔
443
            $this->arrayFib['lcbPlcfFldHdr'] = self::getInt4d($data, $pos);
5✔
444
            $pos += 4;
5✔
445
            $this->arrayFib['fcPlcfFldFtn'] = self::getInt4d($data, $pos);
5✔
446
            $pos += 4;
5✔
447
            $this->arrayFib['lcbPlcfFldFtn'] = self::getInt4d($data, $pos);
5✔
448
            $pos += 4;
5✔
449
            $this->arrayFib['fcPlcfFldAtn'] = self::getInt4d($data, $pos);
5✔
450
            $pos += 4;
5✔
451
            $this->arrayFib['lcbPlcfFldAtn'] = self::getInt4d($data, $pos);
5✔
452
            $pos += 4;
5✔
453
            $this->arrayFib['fcPlcfFldMcr'] = self::getInt4d($data, $pos);
5✔
454
            $pos += 4;
5✔
455
            $this->arrayFib['lcbPlcfFldMcr'] = self::getInt4d($data, $pos);
5✔
456
            $pos += 4;
5✔
457
            $this->arrayFib['fcSttbfBkmk'] = self::getInt4d($data, $pos);
5✔
458
            $pos += 4;
5✔
459
            $this->arrayFib['lcbSttbfBkmk'] = self::getInt4d($data, $pos);
5✔
460
            $pos += 4;
5✔
461
            $this->arrayFib['fcPlcfBkf'] = self::getInt4d($data, $pos);
5✔
462
            $pos += 4;
5✔
463
            $this->arrayFib['lcbPlcfBkf'] = self::getInt4d($data, $pos);
5✔
464
            $pos += 4;
5✔
465
            $this->arrayFib['fcPlcfBkl'] = self::getInt4d($data, $pos);
5✔
466
            $pos += 4;
5✔
467
            $this->arrayFib['lcbPlcfBkl'] = self::getInt4d($data, $pos);
5✔
468
            $pos += 4;
5✔
469
            $this->arrayFib['fcCmds'] = self::getInt4d($data, $pos);
5✔
470
            $pos += 4;
5✔
471
            $this->arrayFib['lcbCmds'] = self::getInt4d($data, $pos);
5✔
472
            $pos += 4;
5✔
473
            $this->arrayFib['fcUnused1'] = self::getInt4d($data, $pos);
5✔
474
            $pos += 4;
5✔
475
            $this->arrayFib['lcbUnused1'] = self::getInt4d($data, $pos);
5✔
476
            $pos += 4;
5✔
477
            $this->arrayFib['fcSttbfMcr'] = self::getInt4d($data, $pos);
5✔
478
            $pos += 4;
5✔
479
            $this->arrayFib['lcbSttbfMcr'] = self::getInt4d($data, $pos);
5✔
480
            $pos += 4;
5✔
481
            $this->arrayFib['fcPrDrvr'] = self::getInt4d($data, $pos);
5✔
482
            $pos += 4;
5✔
483
            $this->arrayFib['lcbPrDrvr'] = self::getInt4d($data, $pos);
5✔
484
            $pos += 4;
5✔
485
            $this->arrayFib['fcPrEnvPort'] = self::getInt4d($data, $pos);
5✔
486
            $pos += 4;
5✔
487
            $this->arrayFib['lcbPrEnvPort'] = self::getInt4d($data, $pos);
5✔
488
            $pos += 4;
5✔
489
            $this->arrayFib['fcPrEnvLand'] = self::getInt4d($data, $pos);
5✔
490
            $pos += 4;
5✔
491
            $this->arrayFib['lcbPrEnvLand'] = self::getInt4d($data, $pos);
5✔
492
            $pos += 4;
5✔
493
            $this->arrayFib['fcWss'] = self::getInt4d($data, $pos);
5✔
494
            $pos += 4;
5✔
495
            $this->arrayFib['lcbWss'] = self::getInt4d($data, $pos);
5✔
496
            $pos += 4;
5✔
497
            $this->arrayFib['fcDop'] = self::getInt4d($data, $pos);
5✔
498
            $pos += 4;
5✔
499
            $this->arrayFib['lcbDop'] = self::getInt4d($data, $pos);
5✔
500
            $pos += 4;
5✔
501
            $this->arrayFib['fcSttbfAssoc'] = self::getInt4d($data, $pos);
5✔
502
            $pos += 4;
5✔
503
            $this->arrayFib['lcbSttbfAssoc'] = self::getInt4d($data, $pos);
5✔
504
            $pos += 4;
5✔
505
            $this->arrayFib['fcClx'] = self::getInt4d($data, $pos);
5✔
506
            $pos += 4;
5✔
507
            $this->arrayFib['lcbClx'] = self::getInt4d($data, $pos);
5✔
508
            $pos += 4;
5✔
509
            $this->arrayFib['fcPlcfPgdFtn'] = self::getInt4d($data, $pos);
5✔
510
            $pos += 4;
5✔
511
            $this->arrayFib['lcbPlcfPgdFtn'] = self::getInt4d($data, $pos);
5✔
512
            $pos += 4;
5✔
513
            $this->arrayFib['fcAutosaveSource'] = self::getInt4d($data, $pos);
5✔
514
            $pos += 4;
5✔
515
            $this->arrayFib['lcbAutosaveSource'] = self::getInt4d($data, $pos);
5✔
516
            $pos += 4;
5✔
517
            $this->arrayFib['fcGrpXstAtnOwners'] = self::getInt4d($data, $pos);
5✔
518
            $pos += 4;
5✔
519
            $this->arrayFib['lcbGrpXstAtnOwners'] = self::getInt4d($data, $pos);
5✔
520
            $pos += 4;
5✔
521
            $this->arrayFib['fcSttbfAtnBkmk'] = self::getInt4d($data, $pos);
5✔
522
            $pos += 4;
5✔
523
            $this->arrayFib['lcbSttbfAtnBkmk'] = self::getInt4d($data, $pos);
5✔
524
            $pos += 4;
5✔
525
            $this->arrayFib['fcUnused2'] = self::getInt4d($data, $pos);
5✔
526
            $pos += 4;
5✔
527
            $this->arrayFib['lcbUnused2'] = self::getInt4d($data, $pos);
5✔
528
            $pos += 4;
5✔
529
            $this->arrayFib['fcUnused3'] = self::getInt4d($data, $pos);
5✔
530
            $pos += 4;
5✔
531
            $this->arrayFib['lcbUnused3'] = self::getInt4d($data, $pos);
5✔
532
            $pos += 4;
5✔
533
            $this->arrayFib['fcPlcSpaMom'] = self::getInt4d($data, $pos);
5✔
534
            $pos += 4;
5✔
535
            $this->arrayFib['lcbPlcSpaMom'] = self::getInt4d($data, $pos);
5✔
536
            $pos += 4;
5✔
537
            $this->arrayFib['fcPlcSpaHdr'] = self::getInt4d($data, $pos);
5✔
538
            $pos += 4;
5✔
539
            $this->arrayFib['lcbPlcSpaHdr'] = self::getInt4d($data, $pos);
5✔
540
            $pos += 4;
5✔
541
            $this->arrayFib['fcPlcfAtnBkf'] = self::getInt4d($data, $pos);
5✔
542
            $pos += 4;
5✔
543
            $this->arrayFib['lcbPlcfAtnBkf'] = self::getInt4d($data, $pos);
5✔
544
            $pos += 4;
5✔
545
            $this->arrayFib['fcPlcfAtnBkl'] = self::getInt4d($data, $pos);
5✔
546
            $pos += 4;
5✔
547
            $this->arrayFib['lcbPlcfAtnBkl'] = self::getInt4d($data, $pos);
5✔
548
            $pos += 4;
5✔
549
            $this->arrayFib['fcPms'] = self::getInt4d($data, $pos);
5✔
550
            $pos += 4;
5✔
551
            $this->arrayFib['lcbPms'] = self::getInt4d($data, $pos);
5✔
552
            $pos += 4;
5✔
553
            $this->arrayFib['fcFormFldSttbs'] = self::getInt4d($data, $pos);
5✔
554
            $pos += 4;
5✔
555
            $this->arrayFib['lcbFormFldSttbs'] = self::getInt4d($data, $pos);
5✔
556
            $pos += 4;
5✔
557
            $this->arrayFib['fcPlcfendRef'] = self::getInt4d($data, $pos);
5✔
558
            $pos += 4;
5✔
559
            $this->arrayFib['lcbPlcfendRef'] = self::getInt4d($data, $pos);
5✔
560
            $pos += 4;
5✔
561
            $this->arrayFib['fcPlcfendTxt'] = self::getInt4d($data, $pos);
5✔
562
            $pos += 4;
5✔
563
            $this->arrayFib['lcbPlcfendTxt'] = self::getInt4d($data, $pos);
5✔
564
            $pos += 4;
5✔
565
            $this->arrayFib['fcPlcfFldEdn'] = self::getInt4d($data, $pos);
5✔
566
            $pos += 4;
5✔
567
            $this->arrayFib['lcbPlcfFldEdn'] = self::getInt4d($data, $pos);
5✔
568
            $pos += 4;
5✔
569
            $this->arrayFib['fcUnused4'] = self::getInt4d($data, $pos);
5✔
570
            $pos += 4;
5✔
571
            $this->arrayFib['lcbUnused4'] = self::getInt4d($data, $pos);
5✔
572
            $pos += 4;
5✔
573
            $this->arrayFib['fcDggInfo'] = self::getInt4d($data, $pos);
5✔
574
            $pos += 4;
5✔
575
            $this->arrayFib['lcbDggInfo'] = self::getInt4d($data, $pos);
5✔
576
            $pos += 4;
5✔
577
            $this->arrayFib['fcSttbfRMark'] = self::getInt4d($data, $pos);
5✔
578
            $pos += 4;
5✔
579
            $this->arrayFib['lcbSttbfRMark'] = self::getInt4d($data, $pos);
5✔
580
            $pos += 4;
5✔
581
            $this->arrayFib['fcSttbfCaption'] = self::getInt4d($data, $pos);
5✔
582
            $pos += 4;
5✔
583
            $this->arrayFib['lcbSttbfCaption'] = self::getInt4d($data, $pos);
5✔
584
            $pos += 4;
5✔
585
            $this->arrayFib['fcSttbfAutoCaption'] = self::getInt4d($data, $pos);
5✔
586
            $pos += 4;
5✔
587
            $this->arrayFib['lcbSttbfAutoCaption'] = self::getInt4d($data, $pos);
5✔
588
            $pos += 4;
5✔
589
            $this->arrayFib['fcPlcfWkb'] = self::getInt4d($data, $pos);
5✔
590
            $pos += 4;
5✔
591
            $this->arrayFib['lcbPlcfWkb'] = self::getInt4d($data, $pos);
5✔
592
            $pos += 4;
5✔
593
            $this->arrayFib['fcPlcfSpl'] = self::getInt4d($data, $pos);
5✔
594
            $pos += 4;
5✔
595
            $this->arrayFib['lcbPlcfSpl'] = self::getInt4d($data, $pos);
5✔
596
            $pos += 4;
5✔
597
            $this->arrayFib['fcPlcftxbxTxt'] = self::getInt4d($data, $pos);
5✔
598
            $pos += 4;
5✔
599
            $this->arrayFib['lcbPlcftxbxTxt'] = self::getInt4d($data, $pos);
5✔
600
            $pos += 4;
5✔
601
            $this->arrayFib['fcPlcfFldTxbx'] = self::getInt4d($data, $pos);
5✔
602
            $pos += 4;
5✔
603
            $this->arrayFib['lcbPlcfFldTxbx'] = self::getInt4d($data, $pos);
5✔
604
            $pos += 4;
5✔
605
            $this->arrayFib['fcPlcfHdrtxbxTxt'] = self::getInt4d($data, $pos);
5✔
606
            $pos += 4;
5✔
607
            $this->arrayFib['lcbPlcfHdrtxbxTxt'] = self::getInt4d($data, $pos);
5✔
608
            $pos += 4;
5✔
609
            $this->arrayFib['fcPlcffldHdrTxbx'] = self::getInt4d($data, $pos);
5✔
610
            $pos += 4;
5✔
611
            $this->arrayFib['lcbPlcffldHdrTxbx'] = self::getInt4d($data, $pos);
5✔
612
            $pos += 4;
5✔
613
            $this->arrayFib['fcStwUser'] = self::getInt4d($data, $pos);
5✔
614
            $pos += 4;
5✔
615
            $this->arrayFib['lcbStwUser'] = self::getInt4d($data, $pos);
5✔
616
            $pos += 4;
5✔
617
            $this->arrayFib['fcSttbTtmbd'] = self::getInt4d($data, $pos);
5✔
618
            $pos += 4;
5✔
619
            $this->arrayFib['lcbSttbTtmbd'] = self::getInt4d($data, $pos);
5✔
620
            $pos += 4;
5✔
621
            $this->arrayFib['fcCookieData'] = self::getInt4d($data, $pos);
5✔
622
            $pos += 4;
5✔
623
            $this->arrayFib['lcbCookieData'] = self::getInt4d($data, $pos);
5✔
624
            $pos += 4;
5✔
625
            $this->arrayFib['fcPgdMotherOldOld'] = self::getInt4d($data, $pos);
5✔
626
            $pos += 4;
5✔
627
            $this->arrayFib['lcbPgdMotherOldOld'] = self::getInt4d($data, $pos);
5✔
628
            $pos += 4;
5✔
629
            $this->arrayFib['fcBkdMotherOldOld'] = self::getInt4d($data, $pos);
5✔
630
            $pos += 4;
5✔
631
            $this->arrayFib['lcbBkdMotherOldOld'] = self::getInt4d($data, $pos);
5✔
632
            $pos += 4;
5✔
633
            $this->arrayFib['fcPgdFtnOldOld'] = self::getInt4d($data, $pos);
5✔
634
            $pos += 4;
5✔
635
            $this->arrayFib['lcbPgdFtnOldOld'] = self::getInt4d($data, $pos);
5✔
636
            $pos += 4;
5✔
637
            $this->arrayFib['fcBkdFtnOldOld'] = self::getInt4d($data, $pos);
5✔
638
            $pos += 4;
5✔
639
            $this->arrayFib['lcbBkdFtnOldOld'] = self::getInt4d($data, $pos);
5✔
640
            $pos += 4;
5✔
641
            $this->arrayFib['fcPgdEdnOldOld'] = self::getInt4d($data, $pos);
5✔
642
            $pos += 4;
5✔
643
            $this->arrayFib['lcbPgdEdnOldOld'] = self::getInt4d($data, $pos);
5✔
644
            $pos += 4;
5✔
645
            $this->arrayFib['fcBkdEdnOldOld'] = self::getInt4d($data, $pos);
5✔
646
            $pos += 4;
5✔
647
            $this->arrayFib['lcbBkdEdnOldOld'] = self::getInt4d($data, $pos);
5✔
648
            $pos += 4;
5✔
649
            $this->arrayFib['fcSttbfIntlFld'] = self::getInt4d($data, $pos);
5✔
650
            $pos += 4;
5✔
651
            $this->arrayFib['lcbSttbfIntlFld'] = self::getInt4d($data, $pos);
5✔
652
            $pos += 4;
5✔
653
            $this->arrayFib['fcRouteSlip'] = self::getInt4d($data, $pos);
5✔
654
            $pos += 4;
5✔
655
            $this->arrayFib['lcbRouteSlip'] = self::getInt4d($data, $pos);
5✔
656
            $pos += 4;
5✔
657
            $this->arrayFib['fcSttbSavedBy'] = self::getInt4d($data, $pos);
5✔
658
            $pos += 4;
5✔
659
            $this->arrayFib['lcbSttbSavedBy'] = self::getInt4d($data, $pos);
5✔
660
            $pos += 4;
5✔
661
            $this->arrayFib['fcSttbFnm'] = self::getInt4d($data, $pos);
5✔
662
            $pos += 4;
5✔
663
            $this->arrayFib['lcbSttbFnm'] = self::getInt4d($data, $pos);
5✔
664
            $pos += 4;
5✔
665
            $this->arrayFib['fcPlfLst'] = self::getInt4d($data, $pos);
5✔
666
            $pos += 4;
5✔
667
            $this->arrayFib['lcbPlfLst'] = self::getInt4d($data, $pos);
5✔
668
            $pos += 4;
5✔
669
            $this->arrayFib['fcPlfLfo'] = self::getInt4d($data, $pos);
5✔
670
            $pos += 4;
5✔
671
            $this->arrayFib['lcbPlfLfo'] = self::getInt4d($data, $pos);
5✔
672
            $pos += 4;
5✔
673
            $this->arrayFib['fcPlcfTxbxBkd'] = self::getInt4d($data, $pos);
5✔
674
            $pos += 4;
5✔
675
            $this->arrayFib['lcbPlcfTxbxBkd'] = self::getInt4d($data, $pos);
5✔
676
            $pos += 4;
5✔
677
            $this->arrayFib['fcPlcfTxbxHdrBkd'] = self::getInt4d($data, $pos);
5✔
678
            $pos += 4;
5✔
679
            $this->arrayFib['lcbPlcfTxbxHdrBkd'] = self::getInt4d($data, $pos);
5✔
680
            $pos += 4;
5✔
681
            $this->arrayFib['fcDocUndoWord9'] = self::getInt4d($data, $pos);
5✔
682
            $pos += 4;
5✔
683
            $this->arrayFib['lcbDocUndoWord9'] = self::getInt4d($data, $pos);
5✔
684
            $pos += 4;
5✔
685
            $this->arrayFib['fcRgbUse'] = self::getInt4d($data, $pos);
5✔
686
            $pos += 4;
5✔
687
            $this->arrayFib['lcbRgbUse'] = self::getInt4d($data, $pos);
5✔
688
            $pos += 4;
5✔
689
            $this->arrayFib['fcUsp'] = self::getInt4d($data, $pos);
5✔
690
            $pos += 4;
5✔
691
            $this->arrayFib['lcbUsp'] = self::getInt4d($data, $pos);
5✔
692
            $pos += 4;
5✔
693
            $this->arrayFib['fcUskf'] = self::getInt4d($data, $pos);
5✔
694
            $pos += 4;
5✔
695
            $this->arrayFib['lcbUskf'] = self::getInt4d($data, $pos);
5✔
696
            $pos += 4;
5✔
697
            $this->arrayFib['fcPlcupcRgbUse'] = self::getInt4d($data, $pos);
5✔
698
            $pos += 4;
5✔
699
            $this->arrayFib['lcbPlcupcRgbUse'] = self::getInt4d($data, $pos);
5✔
700
            $pos += 4;
5✔
701
            $this->arrayFib['fcPlcupcUsp'] = self::getInt4d($data, $pos);
5✔
702
            $pos += 4;
5✔
703
            $this->arrayFib['lcbPlcupcUsp'] = self::getInt4d($data, $pos);
5✔
704
            $pos += 4;
5✔
705
            $this->arrayFib['fcSttbGlsyStyle'] = self::getInt4d($data, $pos);
5✔
706
            $pos += 4;
5✔
707
            $this->arrayFib['lcbSttbGlsyStyle'] = self::getInt4d($data, $pos);
5✔
708
            $pos += 4;
5✔
709
            $this->arrayFib['fcPlgosl'] = self::getInt4d($data, $pos);
5✔
710
            $pos += 4;
5✔
711
            $this->arrayFib['lcbPlgosl'] = self::getInt4d($data, $pos);
5✔
712
            $pos += 4;
5✔
713
            $this->arrayFib['fcPlcocx'] = self::getInt4d($data, $pos);
5✔
714
            $pos += 4;
5✔
715
            $this->arrayFib['lcbPlcocx'] = self::getInt4d($data, $pos);
5✔
716
            $pos += 4;
5✔
717
            $this->arrayFib['fcPlcfBteLvc'] = self::getInt4d($data, $pos);
5✔
718
            $pos += 4;
5✔
719
            $this->arrayFib['lcbPlcfBteLvc'] = self::getInt4d($data, $pos);
5✔
720
            $pos += 4;
5✔
721
            $this->arrayFib['dwLowDateTime'] = self::getInt4d($data, $pos);
5✔
722
            $pos += 4;
5✔
723
            $this->arrayFib['dwHighDateTime'] = self::getInt4d($data, $pos);
5✔
724
            $pos += 4;
5✔
725
            $this->arrayFib['fcPlcfLvcPre10'] = self::getInt4d($data, $pos);
5✔
726
            $pos += 4;
5✔
727
            $this->arrayFib['lcbPlcfLvcPre10'] = self::getInt4d($data, $pos);
5✔
728
            $pos += 4;
5✔
729
            $this->arrayFib['fcPlcfAsumy'] = self::getInt4d($data, $pos);
5✔
730
            $pos += 4;
5✔
731
            $this->arrayFib['lcbPlcfAsumy'] = self::getInt4d($data, $pos);
5✔
732
            $pos += 4;
5✔
733
            $this->arrayFib['fcPlcfGram'] = self::getInt4d($data, $pos);
5✔
734
            $pos += 4;
5✔
735
            $this->arrayFib['lcbPlcfGram'] = self::getInt4d($data, $pos);
5✔
736
            $pos += 4;
5✔
737
            $this->arrayFib['fcSttbListNames'] = self::getInt4d($data, $pos);
5✔
738
            $pos += 4;
5✔
739
            $this->arrayFib['lcbSttbListNames'] = self::getInt4d($data, $pos);
5✔
740
            $pos += 4;
5✔
741
            $this->arrayFib['fcSttbfUssr'] = self::getInt4d($data, $pos);
5✔
742
            $pos += 4;
5✔
743
            $this->arrayFib['lcbSttbfUssr'] = self::getInt4d($data, $pos);
5✔
744
            $pos += 4;
5✔
745
        }
746
        if ($version == self::VERSION_2000) {
5✔
747
            $this->arrayFib['fcPlcfTch'] = self::getInt4d($data, $pos);
5✔
748
            $pos += 4;
5✔
749
            $this->arrayFib['lcbPlcfTch'] = self::getInt4d($data, $pos);
5✔
750
            $pos += 4;
5✔
751
            $this->arrayFib['fcRmdThreading'] = self::getInt4d($data, $pos);
5✔
752
            $pos += 4;
5✔
753
            $this->arrayFib['lcbRmdThreading'] = self::getInt4d($data, $pos);
5✔
754
            $pos += 4;
5✔
755
            $this->arrayFib['fcMid'] = self::getInt4d($data, $pos);
5✔
756
            $pos += 4;
5✔
757
            $this->arrayFib['lcbMid'] = self::getInt4d($data, $pos);
5✔
758
            $pos += 4;
5✔
759
            $this->arrayFib['fcSttbRgtplc'] = self::getInt4d($data, $pos);
5✔
760
            $pos += 4;
5✔
761
            $this->arrayFib['lcbSttbRgtplc'] = self::getInt4d($data, $pos);
5✔
762
            $pos += 4;
5✔
763
            $this->arrayFib['fcMsoEnvelope'] = self::getInt4d($data, $pos);
5✔
764
            $pos += 4;
5✔
765
            $this->arrayFib['lcbMsoEnvelope'] = self::getInt4d($data, $pos);
5✔
766
            $pos += 4;
5✔
767
            $this->arrayFib['fcPlcfLad'] = self::getInt4d($data, $pos);
5✔
768
            $pos += 4;
5✔
769
            $this->arrayFib['lcbPlcfLad'] = self::getInt4d($data, $pos);
5✔
770
            $pos += 4;
5✔
771
            $this->arrayFib['fcRgDofr'] = self::getInt4d($data, $pos);
5✔
772
            $pos += 4;
5✔
773
            $this->arrayFib['lcbRgDofr'] = self::getInt4d($data, $pos);
5✔
774
            $pos += 4;
5✔
775
            $this->arrayFib['fcPlcosl'] = self::getInt4d($data, $pos);
5✔
776
            $pos += 4;
5✔
777
            $this->arrayFib['lcbPlcosl'] = self::getInt4d($data, $pos);
5✔
778
            $pos += 4;
5✔
779
            $this->arrayFib['fcPlcfCookieOld'] = self::getInt4d($data, $pos);
5✔
780
            $pos += 4;
5✔
781
            $this->arrayFib['lcbPlcfCookieOld'] = self::getInt4d($data, $pos);
5✔
782
            $pos += 4;
5✔
783
            $this->arrayFib['fcPgdMotherOld'] = self::getInt4d($data, $pos);
5✔
784
            $pos += 4;
5✔
785
            $this->arrayFib['lcbPgdMotherOld'] = self::getInt4d($data, $pos);
5✔
786
            $pos += 4;
5✔
787
            $this->arrayFib['fcBkdMotherOld'] = self::getInt4d($data, $pos);
5✔
788
            $pos += 4;
5✔
789
            $this->arrayFib['lcbBkdMotherOld'] = self::getInt4d($data, $pos);
5✔
790
            $pos += 4;
5✔
791
            $this->arrayFib['fcPgdFtnOld'] = self::getInt4d($data, $pos);
5✔
792
            $pos += 4;
5✔
793
            $this->arrayFib['lcbPgdFtnOld'] = self::getInt4d($data, $pos);
5✔
794
            $pos += 4;
5✔
795
            $this->arrayFib['fcBkdFtnOld'] = self::getInt4d($data, $pos);
5✔
796
            $pos += 4;
5✔
797
            $this->arrayFib['lcbBkdFtnOld'] = self::getInt4d($data, $pos);
5✔
798
            $pos += 4;
5✔
799
            $this->arrayFib['fcPgdEdnOld'] = self::getInt4d($data, $pos);
5✔
800
            $pos += 4;
5✔
801
            $this->arrayFib['lcbPgdEdnOld'] = self::getInt4d($data, $pos);
5✔
802
            $pos += 4;
5✔
803
            $this->arrayFib['fcBkdEdnOld'] = self::getInt4d($data, $pos);
5✔
804
            $pos += 4;
5✔
805
            $this->arrayFib['lcbBkdEdnOld'] = self::getInt4d($data, $pos);
5✔
806
            $pos += 4;
5✔
807
        }
808
        if ($version == self::VERSION_2002) {
5✔
809
            $this->arrayFib['fcUnused1'] = self::getInt4d($data, $pos);
5✔
810
            $pos += 4;
5✔
811
            $this->arrayFib['lcbUnused1'] = self::getInt4d($data, $pos);
5✔
812
            $pos += 4;
5✔
813
            $this->arrayFib['fcPlcfPgp'] = self::getInt4d($data, $pos);
5✔
814
            $pos += 4;
5✔
815
            $this->arrayFib['lcbPlcfPgp'] = self::getInt4d($data, $pos);
5✔
816
            $pos += 4;
5✔
817
            $this->arrayFib['fcPlcfuim'] = self::getInt4d($data, $pos);
5✔
818
            $pos += 4;
5✔
819
            $this->arrayFib['lcbPlcfuim'] = self::getInt4d($data, $pos);
5✔
820
            $pos += 4;
5✔
821
            $this->arrayFib['fcPlfguidUim'] = self::getInt4d($data, $pos);
5✔
822
            $pos += 4;
5✔
823
            $this->arrayFib['lcbPlfguidUim'] = self::getInt4d($data, $pos);
5✔
824
            $pos += 4;
5✔
825
            $this->arrayFib['fcAtrdExtra'] = self::getInt4d($data, $pos);
5✔
826
            $pos += 4;
5✔
827
            $this->arrayFib['lcbAtrdExtra'] = self::getInt4d($data, $pos);
5✔
828
            $pos += 4;
5✔
829
            $this->arrayFib['fcPlrsid'] = self::getInt4d($data, $pos);
5✔
830
            $pos += 4;
5✔
831
            $this->arrayFib['lcbPlrsid'] = self::getInt4d($data, $pos);
5✔
832
            $pos += 4;
5✔
833
            $this->arrayFib['fcSttbfBkmkFactoid'] = self::getInt4d($data, $pos);
5✔
834
            $pos += 4;
5✔
835
            $this->arrayFib['lcbSttbfBkmkFactoid'] = self::getInt4d($data, $pos);
5✔
836
            $pos += 4;
5✔
837
            $this->arrayFib['fcPlcfBkfFactoid'] = self::getInt4d($data, $pos);
5✔
838
            $pos += 4;
5✔
839
            $this->arrayFib['lcbPlcfBkfFactoid'] = self::getInt4d($data, $pos);
5✔
840
            $pos += 4;
5✔
841
            $this->arrayFib['fcPlcfcookie'] = self::getInt4d($data, $pos);
5✔
842
            $pos += 4;
5✔
843
            $this->arrayFib['lcbPlcfcookie'] = self::getInt4d($data, $pos);
5✔
844
            $pos += 4;
5✔
845
            $this->arrayFib['fcPlcfBklFactoid'] = self::getInt4d($data, $pos);
5✔
846
            $pos += 4;
5✔
847
            $this->arrayFib['lcbPlcfBklFactoid'] = self::getInt4d($data, $pos);
5✔
848
            $pos += 4;
5✔
849
            $this->arrayFib['fcFactoidData'] = self::getInt4d($data, $pos);
5✔
850
            $pos += 4;
5✔
851
            $this->arrayFib['lcbFactoidData'] = self::getInt4d($data, $pos);
5✔
852
            $pos += 4;
5✔
853
            $this->arrayFib['fcDocUndo'] = self::getInt4d($data, $pos);
5✔
854
            $pos += 4;
5✔
855
            $this->arrayFib['lcbDocUndo'] = self::getInt4d($data, $pos);
5✔
856
            $pos += 4;
5✔
857
            $this->arrayFib['fcSttbfBkmkFcc'] = self::getInt4d($data, $pos);
5✔
858
            $pos += 4;
5✔
859
            $this->arrayFib['lcbSttbfBkmkFcc'] = self::getInt4d($data, $pos);
5✔
860
            $pos += 4;
5✔
861
            $this->arrayFib['fcPlcfBkfFcc'] = self::getInt4d($data, $pos);
5✔
862
            $pos += 4;
5✔
863
            $this->arrayFib['lcbPlcfBkfFcc'] = self::getInt4d($data, $pos);
5✔
864
            $pos += 4;
5✔
865
            $this->arrayFib['fcPlcfBklFcc'] = self::getInt4d($data, $pos);
5✔
866
            $pos += 4;
5✔
867
            $this->arrayFib['lcbPlcfBklFcc'] = self::getInt4d($data, $pos);
5✔
868
            $pos += 4;
5✔
869
            $this->arrayFib['fcSttbfbkmkBPRepairs'] = self::getInt4d($data, $pos);
5✔
870
            $pos += 4;
5✔
871
            $this->arrayFib['lcbSttbfbkmkBPRepairs'] = self::getInt4d($data, $pos);
5✔
872
            $pos += 4;
5✔
873
            $this->arrayFib['fcPlcfbkfBPRepairs'] = self::getInt4d($data, $pos);
5✔
874
            $pos += 4;
5✔
875
            $this->arrayFib['lcbPlcfbkfBPRepairs'] = self::getInt4d($data, $pos);
5✔
876
            $pos += 4;
5✔
877
            $this->arrayFib['fcPlcfbklBPRepairs'] = self::getInt4d($data, $pos);
5✔
878
            $pos += 4;
5✔
879
            $this->arrayFib['lcbPlcfbklBPRepairs'] = self::getInt4d($data, $pos);
5✔
880
            $pos += 4;
5✔
881
            $this->arrayFib['fcPmsNew'] = self::getInt4d($data, $pos);
5✔
882
            $pos += 4;
5✔
883
            $this->arrayFib['lcbPmsNew'] = self::getInt4d($data, $pos);
5✔
884
            $pos += 4;
5✔
885
            $this->arrayFib['fcODSO'] = self::getInt4d($data, $pos);
5✔
886
            $pos += 4;
5✔
887
            $this->arrayFib['lcbODSO'] = self::getInt4d($data, $pos);
5✔
888
            $pos += 4;
5✔
889
            $this->arrayFib['fcPlcfpmiOldXP'] = self::getInt4d($data, $pos);
5✔
890
            $pos += 4;
5✔
891
            $this->arrayFib['lcbPlcfpmiOldXP'] = self::getInt4d($data, $pos);
5✔
892
            $pos += 4;
5✔
893
            $this->arrayFib['fcPlcfpmiNewXP'] = self::getInt4d($data, $pos);
5✔
894
            $pos += 4;
5✔
895
            $this->arrayFib['lcbPlcfpmiNewXP'] = self::getInt4d($data, $pos);
5✔
896
            $pos += 4;
5✔
897
            $this->arrayFib['fcPlcfpmiMixedXP'] = self::getInt4d($data, $pos);
5✔
898
            $pos += 4;
5✔
899
            $this->arrayFib['lcbPlcfpmiMixedXP'] = self::getInt4d($data, $pos);
5✔
900
            $pos += 4;
5✔
901
            $this->arrayFib['fcUnused2'] = self::getInt4d($data, $pos);
5✔
902
            $pos += 4;
5✔
903
            $this->arrayFib['lcbUnused2'] = self::getInt4d($data, $pos);
5✔
904
            $pos += 4;
5✔
905
            $this->arrayFib['fcPlcffactoid'] = self::getInt4d($data, $pos);
5✔
906
            $pos += 4;
5✔
907
            $this->arrayFib['lcbPlcffactoid'] = self::getInt4d($data, $pos);
5✔
908
            $pos += 4;
5✔
909
            $this->arrayFib['fcPlcflvcOldXP'] = self::getInt4d($data, $pos);
5✔
910
            $pos += 4;
5✔
911
            $this->arrayFib['lcbPlcflvcOldXP'] = self::getInt4d($data, $pos);
5✔
912
            $pos += 4;
5✔
913
            $this->arrayFib['fcPlcflvcNewXP'] = self::getInt4d($data, $pos);
5✔
914
            $pos += 4;
5✔
915
            $this->arrayFib['lcbPlcflvcNewXP'] = self::getInt4d($data, $pos);
5✔
916
            $pos += 4;
5✔
917
            $this->arrayFib['fcPlcflvcMixedXP'] = self::getInt4d($data, $pos);
5✔
918
            $pos += 4;
5✔
919
            $this->arrayFib['lcbPlcflvcMixedXP'] = self::getInt4d($data, $pos);
5✔
920
            $pos += 4;
5✔
921
        }
922
        if ($version == self::VERSION_2003) {
5✔
923
            $this->arrayFib['fcHplxsdr'] = self::getInt4d($data, $pos);
3✔
924
            $pos += 4;
3✔
925
            $this->arrayFib['lcbHplxsdr'] = self::getInt4d($data, $pos);
3✔
926
            $pos += 4;
3✔
927
            $this->arrayFib['fcSttbfBkmkSdt'] = self::getInt4d($data, $pos);
3✔
928
            $pos += 4;
3✔
929
            $this->arrayFib['lcbSttbfBkmkSdt'] = self::getInt4d($data, $pos);
3✔
930
            $pos += 4;
3✔
931
            $this->arrayFib['fcPlcfBkfSdt'] = self::getInt4d($data, $pos);
3✔
932
            $pos += 4;
3✔
933
            $this->arrayFib['lcbPlcfBkfSdt'] = self::getInt4d($data, $pos);
3✔
934
            $pos += 4;
3✔
935
            $this->arrayFib['fcPlcfBklSdt'] = self::getInt4d($data, $pos);
3✔
936
            $pos += 4;
3✔
937
            $this->arrayFib['lcbPlcfBklSdt'] = self::getInt4d($data, $pos);
3✔
938
            $pos += 4;
3✔
939
            $this->arrayFib['fcCustomXForm'] = self::getInt4d($data, $pos);
3✔
940
            $pos += 4;
3✔
941
            $this->arrayFib['lcbCustomXForm'] = self::getInt4d($data, $pos);
3✔
942
            $pos += 4;
3✔
943
            $this->arrayFib['fcSttbfBkmkProt'] = self::getInt4d($data, $pos);
3✔
944
            $pos += 4;
3✔
945
            $this->arrayFib['lcbSttbfBkmkProt'] = self::getInt4d($data, $pos);
3✔
946
            $pos += 4;
3✔
947
            $this->arrayFib['fcPlcfBkfProt'] = self::getInt4d($data, $pos);
3✔
948
            $pos += 4;
3✔
949
            $this->arrayFib['lcbPlcfBkfProt'] = self::getInt4d($data, $pos);
3✔
950
            $pos += 4;
3✔
951
            $this->arrayFib['fcPlcfBklProt'] = self::getInt4d($data, $pos);
3✔
952
            $pos += 4;
3✔
953
            $this->arrayFib['lcbPlcfBklProt'] = self::getInt4d($data, $pos);
3✔
954
            $pos += 4;
3✔
955
            $this->arrayFib['fcSttbProtUser'] = self::getInt4d($data, $pos);
3✔
956
            $pos += 4;
3✔
957
            $this->arrayFib['lcbSttbProtUser'] = self::getInt4d($data, $pos);
3✔
958
            $pos += 4;
3✔
959
            $this->arrayFib['fcUnused'] = self::getInt4d($data, $pos);
3✔
960
            $pos += 4;
3✔
961
            $this->arrayFib['lcbUnused'] = self::getInt4d($data, $pos);
3✔
962
            $pos += 4;
3✔
963
            $this->arrayFib['fcPlcfpmiOld'] = self::getInt4d($data, $pos);
3✔
964
            $pos += 4;
3✔
965
            $this->arrayFib['lcbPlcfpmiOld'] = self::getInt4d($data, $pos);
3✔
966
            $pos += 4;
3✔
967
            $this->arrayFib['fcPlcfpmiOldInline'] = self::getInt4d($data, $pos);
3✔
968
            $pos += 4;
3✔
969
            $this->arrayFib['lcbPlcfpmiOldInline'] = self::getInt4d($data, $pos);
3✔
970
            $pos += 4;
3✔
971
            $this->arrayFib['fcPlcfpmiNew'] = self::getInt4d($data, $pos);
3✔
972
            $pos += 4;
3✔
973
            $this->arrayFib['lcbPlcfpmiNew'] = self::getInt4d($data, $pos);
3✔
974
            $pos += 4;
3✔
975
            $this->arrayFib['fcPlcfpmiNewInline'] = self::getInt4d($data, $pos);
3✔
976
            $pos += 4;
3✔
977
            $this->arrayFib['lcbPlcfpmiNewInline'] = self::getInt4d($data, $pos);
3✔
978
            $pos += 4;
3✔
979
            $this->arrayFib['fcPlcflvcOld'] = self::getInt4d($data, $pos);
3✔
980
            $pos += 4;
3✔
981
            $this->arrayFib['lcbPlcflvcOld'] = self::getInt4d($data, $pos);
3✔
982
            $pos += 4;
3✔
983
            $this->arrayFib['fcPlcflvcOldInline'] = self::getInt4d($data, $pos);
3✔
984
            $pos += 4;
3✔
985
            $this->arrayFib['lcbPlcflvcOldInline'] = self::getInt4d($data, $pos);
3✔
986
            $pos += 4;
3✔
987
            $this->arrayFib['fcPlcflvcNew'] = self::getInt4d($data, $pos);
3✔
988
            $pos += 4;
3✔
989
            $this->arrayFib['lcbPlcflvcNew'] = self::getInt4d($data, $pos);
3✔
990
            $pos += 4;
3✔
991
            $this->arrayFib['fcPlcflvcNewInline'] = self::getInt4d($data, $pos);
3✔
992
            $pos += 4;
3✔
993
            $this->arrayFib['lcbPlcflvcNewInline'] = self::getInt4d($data, $pos);
3✔
994
            $pos += 4;
3✔
995
            $this->arrayFib['fcPgdMother'] = self::getInt4d($data, $pos);
3✔
996
            $pos += 4;
3✔
997
            $this->arrayFib['lcbPgdMother'] = self::getInt4d($data, $pos);
3✔
998
            $pos += 4;
3✔
999
            $this->arrayFib['fcBkdMother'] = self::getInt4d($data, $pos);
3✔
1000
            $pos += 4;
3✔
1001
            $this->arrayFib['lcbBkdMother'] = self::getInt4d($data, $pos);
3✔
1002
            $pos += 4;
3✔
1003
            $this->arrayFib['fcAfdMother'] = self::getInt4d($data, $pos);
3✔
1004
            $pos += 4;
3✔
1005
            $this->arrayFib['lcbAfdMother'] = self::getInt4d($data, $pos);
3✔
1006
            $pos += 4;
3✔
1007
            $this->arrayFib['fcPgdFtn'] = self::getInt4d($data, $pos);
3✔
1008
            $pos += 4;
3✔
1009
            $this->arrayFib['lcbPgdFtn'] = self::getInt4d($data, $pos);
3✔
1010
            $pos += 4;
3✔
1011
            $this->arrayFib['fcBkdFtn'] = self::getInt4d($data, $pos);
3✔
1012
            $pos += 4;
3✔
1013
            $this->arrayFib['lcbBkdFtn'] = self::getInt4d($data, $pos);
3✔
1014
            $pos += 4;
3✔
1015
            $this->arrayFib['fcAfdFtn'] = self::getInt4d($data, $pos);
3✔
1016
            $pos += 4;
3✔
1017
            $this->arrayFib['lcbAfdFtn'] = self::getInt4d($data, $pos);
3✔
1018
            $pos += 4;
3✔
1019
            $this->arrayFib['fcPgdEdn'] = self::getInt4d($data, $pos);
3✔
1020
            $pos += 4;
3✔
1021
            $this->arrayFib['lcbPgdEdn'] = self::getInt4d($data, $pos);
3✔
1022
            $pos += 4;
3✔
1023
            $this->arrayFib['fcBkdEdn'] = self::getInt4d($data, $pos);
3✔
1024
            $pos += 4;
3✔
1025
            $this->arrayFib['lcbBkdEdn'] = self::getInt4d($data, $pos);
3✔
1026
            $pos += 4;
3✔
1027
            $this->arrayFib['fcAfdEdn'] = self::getInt4d($data, $pos);
3✔
1028
            $pos += 4;
3✔
1029
            $this->arrayFib['lcbAfdEdn'] = self::getInt4d($data, $pos);
3✔
1030
            $pos += 4;
3✔
1031
            $this->arrayFib['fcAfd'] = self::getInt4d($data, $pos);
3✔
1032
            $pos += 4;
3✔
1033
            $this->arrayFib['lcbAfd'] = self::getInt4d($data, $pos);
3✔
1034
            $pos += 4;
3✔
1035
        }
1036
        if ($version == self::VERSION_2007) {
5✔
1037
            $this->arrayFib['fcPlcfmthd'] = self::getInt4d($data, $pos);
3✔
1038
            $pos += 4;
3✔
1039
            $this->arrayFib['lcbPlcfmthd'] = self::getInt4d($data, $pos);
3✔
1040
            $pos += 4;
3✔
1041
            $this->arrayFib['fcSttbfBkmkMoveFrom'] = self::getInt4d($data, $pos);
3✔
1042
            $pos += 4;
3✔
1043
            $this->arrayFib['lcbSttbfBkmkMoveFrom'] = self::getInt4d($data, $pos);
3✔
1044
            $pos += 4;
3✔
1045
            $this->arrayFib['fcPlcfBkfMoveFrom'] = self::getInt4d($data, $pos);
3✔
1046
            $pos += 4;
3✔
1047
            $this->arrayFib['lcbPlcfBkfMoveFrom'] = self::getInt4d($data, $pos);
3✔
1048
            $pos += 4;
3✔
1049
            $this->arrayFib['fcPlcfBklMoveFrom'] = self::getInt4d($data, $pos);
3✔
1050
            $pos += 4;
3✔
1051
            $this->arrayFib['lcbPlcfBklMoveFrom'] = self::getInt4d($data, $pos);
3✔
1052
            $pos += 4;
3✔
1053
            $this->arrayFib['fcSttbfBkmkMoveTo'] = self::getInt4d($data, $pos);
3✔
1054
            $pos += 4;
3✔
1055
            $this->arrayFib['lcbSttbfBkmkMoveTo'] = self::getInt4d($data, $pos);
3✔
1056
            $pos += 4;
3✔
1057
            $this->arrayFib['fcPlcfBkfMoveTo'] = self::getInt4d($data, $pos);
3✔
1058
            $pos += 4;
3✔
1059
            $this->arrayFib['lcbPlcfBkfMoveTo'] = self::getInt4d($data, $pos);
3✔
1060
            $pos += 4;
3✔
1061
            $this->arrayFib['fcPlcfBklMoveTo'] = self::getInt4d($data, $pos);
3✔
1062
            $pos += 4;
3✔
1063
            $this->arrayFib['lcbPlcfBklMoveTo'] = self::getInt4d($data, $pos);
3✔
1064
            $pos += 4;
3✔
1065
            $this->arrayFib['fcUnused1'] = self::getInt4d($data, $pos);
3✔
1066
            $pos += 4;
3✔
1067
            $this->arrayFib['lcbUnused1'] = self::getInt4d($data, $pos);
3✔
1068
            $pos += 4;
3✔
1069
            $this->arrayFib['fcUnused2'] = self::getInt4d($data, $pos);
3✔
1070
            $pos += 4;
3✔
1071
            $this->arrayFib['lcbUnused2'] = self::getInt4d($data, $pos);
3✔
1072
            $pos += 4;
3✔
1073
            $this->arrayFib['fcUnused3'] = self::getInt4d($data, $pos);
3✔
1074
            $pos += 4;
3✔
1075
            $this->arrayFib['lcbUnused3'] = self::getInt4d($data, $pos);
3✔
1076
            $pos += 4;
3✔
1077
            $this->arrayFib['fcSttbfBkmkArto'] = self::getInt4d($data, $pos);
3✔
1078
            $pos += 4;
3✔
1079
            $this->arrayFib['lcbSttbfBkmkArto'] = self::getInt4d($data, $pos);
3✔
1080
            $pos += 4;
3✔
1081
            $this->arrayFib['fcPlcfBkfArto'] = self::getInt4d($data, $pos);
3✔
1082
            $pos += 4;
3✔
1083
            $this->arrayFib['lcbPlcfBkfArto'] = self::getInt4d($data, $pos);
3✔
1084
            $pos += 4;
3✔
1085
            $this->arrayFib['fcPlcfBklArto'] = self::getInt4d($data, $pos);
3✔
1086
            $pos += 4;
3✔
1087
            $this->arrayFib['lcbPlcfBklArto'] = self::getInt4d($data, $pos);
3✔
1088
            $pos += 4;
3✔
1089
            $this->arrayFib['fcArtoData'] = self::getInt4d($data, $pos);
3✔
1090
            $pos += 4;
3✔
1091
            $this->arrayFib['lcbArtoData'] = self::getInt4d($data, $pos);
3✔
1092
            $pos += 4;
3✔
1093
            $this->arrayFib['fcUnused4'] = self::getInt4d($data, $pos);
3✔
1094
            $pos += 4;
3✔
1095
            $this->arrayFib['lcbUnused4'] = self::getInt4d($data, $pos);
3✔
1096
            $pos += 4;
3✔
1097
            $this->arrayFib['fcUnused5'] = self::getInt4d($data, $pos);
3✔
1098
            $pos += 4;
3✔
1099
            $this->arrayFib['lcbUnused5'] = self::getInt4d($data, $pos);
3✔
1100
            $pos += 4;
3✔
1101
            $this->arrayFib['fcUnused6'] = self::getInt4d($data, $pos);
3✔
1102
            $pos += 4;
3✔
1103
            $this->arrayFib['lcbUnused6'] = self::getInt4d($data, $pos);
3✔
1104
            $pos += 4;
3✔
1105
            $this->arrayFib['fcOssTheme'] = self::getInt4d($data, $pos);
3✔
1106
            $pos += 4;
3✔
1107
            $this->arrayFib['lcbOssTheme'] = self::getInt4d($data, $pos);
3✔
1108
            $pos += 4;
3✔
1109
            $this->arrayFib['fcColorSchemeMapping'] = self::getInt4d($data, $pos);
3✔
1110
            $pos += 4;
3✔
1111
            $this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos);
3✔
1112
            $pos += 4;
3✔
1113
        }
1114

1115
        return $pos;
5✔
1116
    }
1117

1118
    private function readFibContent(): void
1119
    {
1120
        // Informations about Font
1121
        $this->readRecordSttbfFfn();
5✔
1122

1123
        // Informations about page
1124
        $this->readRecordPlcfSed();
5✔
1125

1126
        // reading paragraphs
1127
        //@see  https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86
1128
        $this->readRecordPlcfBtePapx();
5✔
1129

1130
        // reading character formattings
1131
        //@see  https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94
1132
        $this->readRecordPlcfBteChpx();
5✔
1133

1134
        $this->generatePhpWord();
5✔
1135
    }
1136

1137
    /**
1138
     * Section and information about them.
1139
     *
1140
     * @see  http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx
1141
     */
1142
    private function readRecordPlcfSed(): void
1143
    {
1144
        $posMem = $this->arrayFib['fcPlcfSed'];
5✔
1145
        // PlcfSed
1146
        // PlcfSed : aCP
1147
        $aCP = [];
5✔
1148
        $aCP[0] = self::getInt4d($this->data1Table, $posMem);
5✔
1149
        $posMem += 4;
5✔
1150
        $aCP[1] = self::getInt4d($this->data1Table, $posMem);
5✔
1151
        $posMem += 4;
5✔
1152

1153
        // PlcfSed : aSed
1154
        //@see  http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx
1155
        $numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12);
5✔
1156

1157
        $aSed = [];
5✔
1158
        for ($iInc = 0; $iInc < $numSed; ++$iInc) {
5✔
1159
            // Sed : http://msdn.microsoft.com/en-us/library/dd950982%28v=office.12%29.aspx
1160
            // fn
1161
            $posMem += 2;
5✔
1162
            // fnMpr
1163
            $aSed[$iInc] = self::getInt4d($this->data1Table, $posMem);
5✔
1164
            $posMem += 4;
5✔
1165
            // fnMpr
1166
            $posMem += 2;
5✔
1167
            // fcMpr
1168
            $posMem += 4;
5✔
1169
        }
1170

1171
        foreach ($aSed as $offsetSed) {
5✔
1172
            // Sepx : http://msdn.microsoft.com/en-us/library/dd921348%28v=office.12%29.aspx
1173
            $cb = self::getInt2d($this->dataWorkDocument, $offsetSed);
5✔
1174
            $offsetSed += 2;
5✔
1175

1176
            $oStylePrl = $this->readPrl($this->dataWorkDocument, $offsetSed, $cb);
5✔
1177
            $offsetSed += $oStylePrl->length;
5✔
1178

1179
            $this->arraySections[] = $oStylePrl;
5✔
1180
        }
1181
    }
1182

1183
    /**
1184
     * Specifies the fonts that are used in the document.
1185
     *
1186
     * @see  http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx
1187
     */
1188
    private function readRecordSttbfFfn(): void
1189
    {
1190
        $posMem = $this->arrayFib['fcSttbfFfn'];
5✔
1191

1192
        $cData = self::getInt2d($this->data1Table, $posMem);
5✔
1193
        $posMem += 2;
5✔
1194
        $cbExtra = self::getInt2d($this->data1Table, $posMem);
5✔
1195
        $posMem += 2;
5✔
1196

1197
        if ($cData < 0x7FF0 && $cbExtra == 0) {
5✔
1198
            for ($inc = 0; $inc < $cData; ++$inc) {
5✔
1199
                // len
1200
                ++$posMem;
5✔
1201
                // ffid
1202
                ++$posMem;
5✔
1203
                // wWeight (400 : Normal - 700 bold)
1204
                $posMem += 2;
5✔
1205
                // chs
1206
                ++$posMem;
5✔
1207
                // ixchSzAlt
1208
                $ixchSzAlt = self::getInt1d($this->data1Table, $posMem);
5✔
1209
                ++$posMem;
5✔
1210
                // panose
1211
                $posMem += 10;
5✔
1212
                // fs
1213
                $posMem += 24;
5✔
1214
                // xszFfn
1215
                $xszFfn = '';
5✔
1216
                do {
1217
                    $char = self::getInt2d($this->data1Table, $posMem);
5✔
1218
                    $posMem += 2;
5✔
1219
                    if ($char > 0) {
5✔
1220
                        $xszFfn .= chr($char);
5✔
1221
                    }
1222
                } while ($char != 0);
5✔
1223
                // xszAlt
1224
                $xszAlt = '';
5✔
1225
                if ($ixchSzAlt > 0) {
5✔
1226
                    do {
1227
                        $char = self::getInt2d($this->data1Table, $posMem);
4✔
1228
                        $posMem += 2;
4✔
1229
                        if ($char == 0) {
4✔
1230
                            break;
4✔
1231
                        }
1232
                        $xszAlt .= chr($char);
4✔
1233
                    } while ($char != 0);
4✔
1234
                }
1235
                $this->arrayFonts[] = [
5✔
1236
                    'main' => $xszFfn,
5✔
1237
                    'alt' => $xszAlt,
5✔
1238
                ];
5✔
1239
            }
1240
        }
1241
    }
1242

1243
    /**
1244
     * Paragraph and information about them.
1245
     *
1246
     * @see  http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx
1247
     */
1248
    private function readRecordPlcfBtePapx(): void
1249
    {
1250
        $posMem = $this->arrayFib['fcPlcfBtePapx'];
5✔
1251
        $num = $this->getNumInLcb($this->arrayFib['lcbPlcfBtePapx'], 4);
5✔
1252
        $posMem += 4 * ($num + 1);
5✔
1253
        $arrAPnBtePapx = $this->getArrayCP($this->data1Table, $posMem, $num);
5✔
1254
        $posMem += 4 * $num;
5✔
1255

1256
        foreach ($arrAPnBtePapx as $aPnBtePapx) {
5✔
1257
            $offsetBase = $aPnBtePapx * 512;
5✔
1258
            $offset = $offsetBase;
5✔
1259

1260
            $string = '';
5✔
1261

1262
            $numRun = self::getInt1d($this->dataWorkDocument, $offset + 511);
5✔
1263
            $arrayRGFC = [];
5✔
1264
            for ($inc = 0; $inc <= $numRun; ++$inc) {
5✔
1265
                $arrayRGFC[$inc] = self::getInt4d($this->dataWorkDocument, $offset);
5✔
1266
                $offset += 4;
5✔
1267
            }
1268
            $arrayRGB = [];
5✔
1269
            for ($inc = 1; $inc <= $numRun; ++$inc) {
5✔
1270
                // @see  http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx
1271
                $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
5✔
1272
                ++$offset;
5✔
1273
                // reserved
1274
                $offset += 12;
5✔
1275
            }
1276

1277
            foreach (array_keys($arrayRGFC) as $key) {
5✔
1278
                if (!isset($arrayRGFC[$key + 1])) {
5✔
1279
                    break;
5✔
1280
                }
1281
                $strLen = $arrayRGFC[$key + 1] - $arrayRGFC[$key] - 1;
5✔
1282
                for ($inc = 0; $inc < ($strLen * 2); ++$inc) {
5✔
1283
                    $byte = self::getInt2d($this->dataWorkDocument, $arrayRGFC[$key] + ($inc * 2));
5✔
1284
                    if ($byte > 0) {
5✔
1285
                        $string .= mb_chr($byte, 'UTF-8');
5✔
1286
                    } else {
1287
                        break;
5✔
1288
                    }
1289
                }
1290
            }
1291
            $this->arrayParagraphs[] = $string;
5✔
1292

1293
            //@todo readPrl for paragraphs
1294
            /*// use $this->readPrl()
1295
            foreach ($arrayRGB as $key => $rgb) {
1296
                $offset = $offsetBase + ($rgb * 2);
1297

1298
                $cb = self::getInt1d($this->dataWorkDocument, $offset);
1299
                $offset += 1;
1300
                print_r('$cb : '.$cb.PHP_EOL);
1301
                if ($cb == 0) {
1302
                    $cb = self::getInt1d($this->dataWorkDocument, $offset);
1303
                    $cb = $cb * 2;
1304
                    $offset += 1;
1305
                    print_r('$cb0 : '.$cb.PHP_EOL);
1306
                } else {
1307
                    $cb = $cb * 2 - 1;
1308
                    print_r('$cbD : '.$cb.PHP_EOL);
1309
                }
1310
                $istd = self::getInt2d($this->dataWorkDocument, $offset);
1311
                $offset += 2;
1312
                $cb -= 2;
1313
                print_r('$istd : '.$istd.($istd == 0 ? ' (Normal)' : '').PHP_EOL);
1314
                if ($cb > 0) {
1315
                    do{
1316
                        $sprm = self::getInt2d($this->dataWorkDocument, $offset);
1317
                        $offset += 2;
1318
                        $cb -= 2;
1319
                        $sprm_IsPmd = $sprm & 0x01FF;
1320
                        $sprm_F = ($sprm/512) & 0x0001;
1321
                        $sprm_Sgc = ($sprm/1024) & 0x0007;
1322
                        $sprm_Spra = ($sprm/8192);
1323

1324
                        print_r('$sprm : 0x'.dechex($sprm).PHP_EOL);
1325
                        print_r('$sprm.ispmd : 0x'.dechex($sprm_IsPmd).PHP_EOL);
1326
                        print_r('$sprm.f : 0x'.dechex($sprm_F).PHP_EOL);
1327
                        print_r('$sprm.sgc : 0x'.dechex($sprm_Sgc));
1328
                        switch (dechex($sprm_Sgc)) {
1329
                            case 0x01:
1330
                                print_r(' (Paragraph property)');
1331
                                break;
1332
                            case 0x02:
1333
                                print_r(' (Character property)');
1334
                                break;
1335
                            case 0x03:
1336
                                print_r(' (Picture property)');
1337
                                break;
1338
                            case 0x04:
1339
                                print_r(' (Section property)');
1340
                                break;
1341
                            case 0x05:
1342
                                print_r(' (Table property)');
1343
                                break;
1344
                        }
1345
                        print_r(PHP_EOL);
1346
                        print_r('$sprm.spra : 0x'.dechex($sprm_Spra).PHP_EOL);
1347
                        switch (dechex($sprm_Spra)) {
1348
                            case 0x0:
1349
                                $operand = self::getInt1d($this->dataWorkDocument, $offset);
1350
                                $offset += 1;
1351
                                $cb -= 1;
1352
                                switch (dechex($operand)) {
1353
                                    case 0x00:
1354
                                        $operand = 'OFF';
1355
                                        break;
1356
                                    case 0x01:
1357
                                        $operand = 'ON';
1358
                                        break;
1359
                                    case 0x80:
1360
                                        $operand = 'CURRENT VALUE';
1361
                                        print_r(''.PHP_EOL.PHP_EOL);
1362
                                        break;
1363
                                    case 0x81:
1364
                                        $operand = 'OPPOSITE OF THE CURRENT VALUE';
1365
                                        break;
1366
                                }
1367
                                break;
1368
                            case 0x1:
1369
                                $operand = self::getInt1d($this->dataWorkDocument, $offset);
1370
                                $offset += 1;
1371
                                $cb -= 1;
1372
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1373
                                break;
1374
                            case 0x2:
1375
                            case 0x4:
1376
                            case 0x5:
1377
                                $operand = self::getInt2d($this->dataWorkDocument, $offset);
1378
                                $offset += 2;
1379
                                $cb -= 2;
1380
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1381
                                break;
1382
                            case 0x3:
1383
                                if ($sprm_IsPmd != 0x70) {
1384
                                    $operand = self::getInt4d($this->dataWorkDocument, $offset);
1385
                                    $offset += 4;
1386
                                    $cb -= 4;
1387
                                    print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1388
                                }
1389
                                break;
1390
                            case 0x7:
1391
                                $operand = self::getInt3d($this->dataWorkDocument, $offset);
1392
                                $offset += 3;
1393
                                $cb -= 3;
1394
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1395
                                break;
1396
                            default:
1397
                                print_r('YO YO YO : '.PHP_EOL);
1398
                        }
1399

1400
                        //
1401
                        switch (dechex($sprm_Sgc)) {
1402
                            case 0x01: // Sprm is modifying a paragraph property.
1403
                                switch ($sprm_IsPmd) {
1404
                                    case 0x0A: // sprmPIlvl
1405
                                        print_r('sprmPIlvl : '.$operand.PHP_EOL.PHP_EOL);
1406
                                        break;
1407
                                    case 0x0B: // sprmPIlfo
1408
                                        print_r('sprmPIlfo : '.$operand.PHP_EOL.PHP_EOL);
1409
                                        break;
1410
                                    default:
1411
                                        print_r('$sprm_IsPmd(1) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1412
                                        break;
1413
                                }
1414
                                break;
1415
                            case 0x02: // Sprm is modifying a character property.
1416
                                switch ($sprm_IsPmd) {
1417
                                    default:
1418
                                        print_r('$sprm_IsPmd(2) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1419
                                        break;
1420
                                }
1421
                                break;
1422
                            case 0x03: // Sprm is modifying a picture property.
1423
                                switch ($sprm_IsPmd) {
1424
                                    default:
1425
                                        print_r('$sprm_IsPmd(3) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1426
                                        break;
1427
                                }
1428
                                break;
1429
                            case 0x04: // Sprm is modifying a section property.
1430
                                switch ($sprm_IsPmd) {
1431
                                    default:
1432
                                        print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1433
                                        break;
1434
                                }
1435
                                break;
1436
                            case 0x05: // Sprm is modifying a table property.
1437
                                switch ($sprm_IsPmd) {
1438
                                    default:
1439
                                        print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1440
                                        break;
1441
                                }
1442
                                break;
1443
                            default:
1444
                                print_r('$sprm_Sgc : '.dechex($sprm_Sgc).PHP_EOL.PHP_EOL);
1445
                                break;
1446
                        }
1447
                    } while ($cb > 0);
1448
                } else {
1449
                    if ($istd > 0) {
1450
                        // @todo : Determining Properties of a Paragraph Style
1451
                        # @see  http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx
1452
                    }
1453
                }
1454
            }*/
1455
        }
1456
    }
1457

1458
    /**
1459
     * Character formatting properties to text in a document.
1460
     *
1461
     * @see  http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx
1462
     */
1463
    private function readRecordPlcfBteChpx(): void
1464
    {
1465
        $posMem = $this->arrayFib['fcPlcfBteChpx'];
5✔
1466
        $num = $this->getNumInLcb($this->arrayFib['lcbPlcfBteChpx'], 4);
5✔
1467
        $aPnBteChpx = [];
5✔
1468
        for ($inc = 0; $inc <= $num; ++$inc) {
5✔
1469
            $aPnBteChpx[$inc] = self::getInt4d($this->data1Table, $posMem);
5✔
1470
            $posMem += 4;
5✔
1471
        }
1472
        $pnFkpChpx = self::getInt4d($this->data1Table, $posMem);
5✔
1473
        $posMem += 4;
5✔
1474

1475
        $offsetBase = $pnFkpChpx * 512;
5✔
1476
        $offset = $offsetBase;
5✔
1477

1478
        // ChpxFkp
1479
        // @see  http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx
1480
        $numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511);
5✔
1481
        $arrayRGFC = [];
5✔
1482
        for ($inc = 0; $inc <= $numRGFC; ++$inc) {
5✔
1483
            $arrayRGFC[$inc] = self::getInt4d($this->dataWorkDocument, $offset);
5✔
1484
            $offset += 4;
5✔
1485
        }
1486

1487
        $arrayRGB = [];
5✔
1488
        for ($inc = 1; $inc <= $numRGFC; ++$inc) {
5✔
1489
            $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
5✔
1490
            ++$offset;
5✔
1491
        }
1492

1493
        $start = 0;
5✔
1494
        foreach ($arrayRGB as $keyRGB => $rgb) {
5✔
1495
            $oStyle = new stdClass();
5✔
1496
            $oStyle->pos_start = $start;
5✔
1497
            $oStyle->pos_len = (int) ceil((($arrayRGFC[$keyRGB] - 1) - $arrayRGFC[$keyRGB - 1]) / 2);
5✔
1498
            $start += $oStyle->pos_len;
5✔
1499

1500
            if ($rgb > 0) {
5✔
1501
                // Chp Structure
1502
                // @see  http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
1503
                $posRGB = $offsetBase + $rgb * 2;
4✔
1504

1505
                $cb = self::getInt1d($this->dataWorkDocument, $posRGB);
4✔
1506
                ++$posRGB;
4✔
1507

1508
                $oStyle->style = $this->readPrl($this->dataWorkDocument, $posRGB, $cb);
4✔
1509
                $posRGB += $oStyle->style->length;
4✔
1510
            }
1511
            $this->arrayCharacters[] = $oStyle;
5✔
1512
        }
1513
    }
1514

1515
    /**
1516
     * @return stdClass
1517
     */
1518
    private function readSprm($sprm)
1519
    {
1520
        $oSprm = new stdClass();
5✔
1521
        $oSprm->isPmd = $sprm & 0x01FF;
5✔
1522
        $oSprm->f = (int) ($sprm / 512) & 0x0001;
5✔
1523
        $oSprm->sgc = (int) ($sprm / 1024) & 0x0007;
5✔
1524
        $oSprm->spra = (int) ($sprm / 8192);
5✔
1525

1526
        return $oSprm;
5✔
1527
    }
1528

1529
    /**
1530
     * @param string $data
1531
     * @param int $pos
1532
     * @param stdClass $oSprm
1533
     *
1534
     * @return array
1535
     */
1536
    private function readSprmSpra($data, $pos, $oSprm)
1537
    {
1538
        $length = 0;
5✔
1539
        $operand = null;
5✔
1540

1541
        switch (dechex($oSprm->spra)) {
5✔
1542
            case 0x0:
5✔
1543
                $operand = self::getInt1d($data, $pos);
4✔
1544
                $length = 1;
4✔
1545
                switch (dechex($operand)) {
4✔
1546
                    case 0x00:
4✔
1547
                        $operand = false;
2✔
1548

1549
                        break;
2✔
1550
                    case 0x01:
4✔
1551
                        $operand = true;
3✔
1552

1553
                        break;
3✔
1554
                    case 0x80:
2✔
1555
                        $operand = self::SPRA_VALUE;
×
1556

1557
                        break;
×
1558
                    case 0x81:
2✔
1559
                        $operand = self::SPRA_VALUE_OPPOSITE;
×
1560

1561
                        break;
×
1562
                }
1563

1564
                break;
4✔
1565
            case 0x1:
5✔
1566
                $operand = self::getInt1d($data, $pos);
4✔
1567
                $length = 1;
4✔
1568

1569
                break;
4✔
1570
            case 0x2:
5✔
1571
            case 0x4:
5✔
1572
            case 0x5:
5✔
1573
                $operand = self::getInt2d($data, $pos);
5✔
1574
                $length = 2;
5✔
1575

1576
                break;
5✔
1577
            case 0x3:
5✔
1578
                if ($oSprm->isPmd != 0x70) {
5✔
1579
                    $operand = self::getInt4d($data, $pos);
5✔
1580
                    $length = 4;
5✔
1581
                }
1582

1583
                break;
5✔
1584
            case 0x7:
2✔
1585
                $operand = self::getInt3d($data, $pos);
2✔
1586
                $length = 3;
2✔
1587

1588
                break;
2✔
1589
            default:
1590
                // print_r('YO YO YO : '.PHP_EOL);
1591
        }
1592

1593
        return [
5✔
1594
            'length' => $length,
5✔
1595
            'operand' => $operand,
5✔
1596
        ];
5✔
1597
    }
1598

1599
    /**
1600
     * @param $data int
1601
     * @param $pos int
1602
     * @param $cbNum int
1603
     *
1604
     * @return stdClass
1605
     *
1606
     * @see  http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
1607
     */
1608
    private function readPrl($data, $pos, $cbNum)
1609
    {
1610
        $posStart = $pos;
5✔
1611
        $oStylePrl = new stdClass();
5✔
1612

1613
        // Variables
1614
        $sprmCPicLocation = null;
5✔
1615
        $sprmCFData = null;
5✔
1616
        //$sprmCFSpec = null;
1617

1618
        do {
1619
            // Variables
1620
            $operand = null;
5✔
1621

1622
            $sprm = self::getInt2d($data, $pos);
5✔
1623
            $oSprm = $this->readSprm($sprm);
5✔
1624
            $pos += 2;
5✔
1625
            $cbNum -= 2;
5✔
1626

1627
            $arrayReturn = $this->readSprmSpra($data, $pos, $oSprm);
5✔
1628
            $pos += $arrayReturn['length'];
5✔
1629
            $cbNum -= $arrayReturn['length'];
5✔
1630
            $operand = $arrayReturn['operand'];
5✔
1631

1632
            switch (dechex($oSprm->sgc)) {
5✔
1633
                // Paragraph property
1634
                case 0x01:
5✔
1635
                    break;
1✔
1636
                    // Character property
1637
                case 0x02:
5✔
1638
                    if (!isset($oStylePrl->styleFont)) {
4✔
1639
                        $oStylePrl->styleFont = [];
4✔
1640
                    }
1641
                    switch ($oSprm->isPmd) {
4✔
1642
                        // sprmCFRMarkIns
1643
                        case 0x01:
4✔
1644
                            break;
×
1645
                            // sprmCFFldVanish
1646
                        case 0x02:
4✔
1647
                            break;
2✔
1648
                            // sprmCPicLocation
1649
                        case 0x03:
4✔
1650
                            $sprmCPicLocation = $operand;
2✔
1651

1652
                            break;
2✔
1653
                            // sprmCFData
1654
                        case 0x06:
4✔
1655
                            $sprmCFData = dechex($operand) != 0x00;
2✔
1656

1657
                            break;
2✔
1658
                            // sprmCFItalic
1659
                        case 0x36:
4✔
1660
                            // By default, text is not italicized.
1661
                            switch ($operand) {
1662
                                case false:
1663
                                case true:
2✔
1664
                                    $oStylePrl->styleFont['italic'] = $operand;
2✔
1665

1666
                                    break;
2✔
1667
                                case self::SPRA_VALUE:
×
1668
                                    $oStylePrl->styleFont['italic'] = false;
×
1669

1670
                                    break;
×
1671
                                case self::SPRA_VALUE_OPPOSITE:
×
1672
                                    $oStylePrl->styleFont['italic'] = true;
×
1673

1674
                                    break;
×
1675
                            }
1676

1677
                            break;
2✔
1678
                            // sprmCIstd
1679
                        case 0x30:
4✔
1680
                            //print_r('sprmCIstd : '.dechex($operand).PHP_EOL.PHP_EOL);
1681
                            break;
2✔
1682
                            // sprmCFBold
1683
                        case 0x35:
4✔
1684
                            // By default, text is not bold.
1685
                            switch ($operand) {
1686
                                case false:
1687
                                case true:
3✔
1688
                                    $oStylePrl->styleFont['bold'] = $operand;
3✔
1689

1690
                                    break;
3✔
1691
                                case self::SPRA_VALUE:
×
1692
                                    $oStylePrl->styleFont['bold'] = false;
×
1693

1694
                                    break;
×
1695
                                case self::SPRA_VALUE_OPPOSITE:
×
1696
                                    $oStylePrl->styleFont['bold'] = true;
×
1697

1698
                                    break;
×
1699
                            }
1700

1701
                            break;
3✔
1702
                            // sprmCFStrike
1703
                        case 0x37:
4✔
1704
                            // By default, text is not struck through.
1705
                            switch ($operand) {
1706
                                case false:
1707
                                case true:
2✔
1708
                                    $oStylePrl->styleFont['strikethrough'] = $operand;
2✔
1709

1710
                                    break;
2✔
1711
                                case self::SPRA_VALUE:
×
1712
                                    $oStylePrl->styleFont['strikethrough'] = false;
×
1713

1714
                                    break;
×
1715
                                case self::SPRA_VALUE_OPPOSITE:
×
1716
                                    $oStylePrl->styleFont['strikethrough'] = true;
×
1717

1718
                                    break;
×
1719
                            }
1720

1721
                            break;
2✔
1722
                            // sprmCKul
1723
                        case 0x3E:
4✔
1724
                            switch (dechex($operand)) {
2✔
1725
                                case 0x00:
2✔
1726
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE;
×
1727

1728
                                    break;
×
1729
                                case 0x01:
2✔
1730
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_SINGLE;
×
1731

1732
                                    break;
×
1733
                                case 0x02:
2✔
1734
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WORDS;
×
1735

1736
                                    break;
×
1737
                                case 0x03:
2✔
1738
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOUBLE;
×
1739

1740
                                    break;
×
1741
                                case 0x04:
2✔
1742
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTTED;
×
1743

1744
                                    break;
×
1745
                                case 0x06:
2✔
1746
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_HEAVY;
×
1747

1748
                                    break;
×
1749
                                case 0x07:
2✔
1750
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASH;
2✔
1751

1752
                                    break;
2✔
1753
                                case 0x09:
×
1754
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASH;
×
1755

1756
                                    break;
×
1757
                                case 0x0A:
×
1758
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASH;
×
1759

1760
                                    break;
×
1761
                                case 0x0B:
×
1762
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVY;
×
1763

1764
                                    break;
×
1765
                                case 0x14:
×
1766
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTTEDHEAVY;
×
1767

1768
                                    break;
×
1769
                                case 0x17:
×
1770
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHHEAVY;
×
1771

1772
                                    break;
×
1773
                                case 0x19:
×
1774
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASHHEAVY;
×
1775

1776
                                    break;
×
1777
                                case 0x1A:
×
1778
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASHHEAVY;
×
1779

1780
                                    break;
×
1781
                                case 0x1B:
×
1782
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVYHEAVY;
×
1783

1784
                                    break;
×
1785
                                case 0x27:
×
1786
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHLONG;
×
1787

1788
                                    break;
×
1789
                                case 0x2B:
×
1790
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVYDOUBLE;
×
1791

1792
                                    break;
×
1793
                                case 0x37:
×
1794
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHLONGHEAVY;
×
1795

1796
                                    break;
×
1797
                                default:
1798
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE;
×
1799

1800
                                    break;
×
1801
                            }
1802

1803
                            break;
2✔
1804
                            // sprmCIco
1805
                            //@see  http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx
1806
                        case 0x42:
4✔
1807
                            switch (dechex($operand)) {
2✔
1808
                                case 0x00:
2✔
1809
                                case 0x01:
2✔
1810
                                    $oStylePrl->styleFont['color'] = '000000';
×
1811

1812
                                    break;
×
1813
                                case 0x02:
2✔
1814
                                    $oStylePrl->styleFont['color'] = '0000FF';
×
1815

1816
                                    break;
×
1817
                                case 0x03:
2✔
1818
                                    $oStylePrl->styleFont['color'] = '00FFFF';
×
1819

1820
                                    break;
×
1821
                                case 0x04:
2✔
1822
                                    $oStylePrl->styleFont['color'] = '00FF00';
×
1823

1824
                                    break;
×
1825
                                case 0x05:
2✔
1826
                                    $oStylePrl->styleFont['color'] = 'FF00FF';
×
1827

1828
                                    break;
×
1829
                                case 0x06:
2✔
1830
                                    $oStylePrl->styleFont['color'] = 'FF0000';
2✔
1831

1832
                                    break;
2✔
1833
                                case 0x07:
×
1834
                                    $oStylePrl->styleFont['color'] = 'FFFF00';
×
1835

1836
                                    break;
×
1837
                                case 0x08:
×
1838
                                    $oStylePrl->styleFont['color'] = 'FFFFFF';
×
1839

1840
                                    break;
×
1841
                                case 0x09:
×
1842
                                    $oStylePrl->styleFont['color'] = '000080';
×
1843

1844
                                    break;
×
1845
                                case 0x0A:
×
1846
                                    $oStylePrl->styleFont['color'] = '008080';
×
1847

1848
                                    break;
×
1849
                                case 0x0B:
×
1850
                                    $oStylePrl->styleFont['color'] = '008000';
×
1851

1852
                                    break;
×
1853
                                case 0x0C:
×
1854
                                    $oStylePrl->styleFont['color'] = '800080';
×
1855

1856
                                    break;
×
1857
                                case 0x0D:
×
1858
                                    $oStylePrl->styleFont['color'] = '800080';
×
1859

1860
                                    break;
×
1861
                                case 0x0E:
×
1862
                                    $oStylePrl->styleFont['color'] = '808000';
×
1863

1864
                                    break;
×
1865
                                case 0x0F:
×
1866
                                    $oStylePrl->styleFont['color'] = '808080';
×
1867

1868
                                    break;
×
1869
                                case 0x10:
×
1870
                                    $oStylePrl->styleFont['color'] = 'C0C0C0';
×
1871
                            }
1872

1873
                            break;
2✔
1874
                            // sprmCHps
1875
                        case 0x43:
4✔
1876
                            $oStylePrl->styleFont['size'] = $operand / 2;
3✔
1877

1878
                            break;
3✔
1879
                            // sprmCIss
1880
                        case 0x48:
4✔
1881
                            if (!isset($oStylePrl->styleFont['superScript'])) {
2✔
1882
                                $oStylePrl->styleFont['superScript'] = false;
2✔
1883
                            }
1884
                            if (!isset($oStylePrl->styleFont['subScript'])) {
2✔
1885
                                $oStylePrl->styleFont['subScript'] = false;
2✔
1886
                            }
1887
                            switch (dechex($operand)) {
2✔
1888
                                case 0x00:
2✔
1889
                                    // Normal text
1890
                                    break;
×
1891
                                case 0x01:
2✔
1892
                                    $oStylePrl->styleFont['superScript'] = true;
2✔
1893

1894
                                    break;
2✔
1895
                                case 0x02:
×
1896
                                    $oStylePrl->styleFont['subScript'] = true;
×
1897

1898
                                    break;
×
1899
                            }
1900

1901
                            break;
2✔
1902
                            // sprmCRgFtc0
1903
                        case 0x4F:
4✔
1904
                            $oStylePrl->styleFont['name'] = '';
2✔
1905
                            if (isset($this->arrayFonts[$operand])) {
2✔
1906
                                $oStylePrl->styleFont['name'] = $this->arrayFonts[$operand]['main'];
2✔
1907
                            }
1908

1909
                            break;
2✔
1910
                            // sprmCRgFtc1
1911
                        case 0x50:
4✔
1912
                            // if the language for the text is an East Asian language
1913
                            break;
2✔
1914
                            // sprmCRgFtc2
1915
                        case 0x51:
4✔
1916
                            // if the character falls outside the Unicode character range
1917
                            break;
2✔
1918
                            // sprmCFSpec
1919
                        case 0x55:
4✔
1920
                            //$sprmCFSpec = $operand;
1921
                            break;
3✔
1922
                            // sprmCFtcBi
1923
                        case 0x5E:
4✔
1924
                            break;
2✔
1925
                            // sprmCFItalicBi
1926
                        case 0x5D:
4✔
1927
                            break;
2✔
1928
                            // sprmCHpsBi
1929
                        case 0x61:
4✔
1930
                            break;
3✔
1931
                            // sprmCShd80
1932
                            //@see  http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx
1933
                        case 0x66:
4✔
1934
                            // $operand = self::getInt2d($data, $pos);
1935
                            $pos += 2;
2✔
1936
                            $cbNum -= 2;
2✔
1937

1938
                            // $ipat = ($operand >> 0) && bindec('111111');
1939
                            // $icoBack = ($operand >> 6) && bindec('11111');
1940
                            // $icoFore = ($operand >> 11) && bindec('11111');
1941
                            break;
2✔
1942
                            // sprmCCv
1943
                            //@see  http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx
1944
                        case 0x70:
4✔
1945
                            $red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
1✔
1946
                            ++$pos;
1✔
1947
                            $green = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
1✔
1948
                            ++$pos;
1✔
1949
                            $blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
1✔
1950
                            ++$pos;
1✔
1951
                            ++$pos;
1✔
1952
                            $oStylePrl->styleFont['color'] = $red . $green . $blue;
1✔
1953
                            $cbNum -= 4;
1✔
1954

1955
                            break;
1✔
1956
                        default:
1957
                            // print_r('@todo Character : 0x'.dechex($oSprm->isPmd));
1958
                            // print_r(PHP_EOL);
1959
                    }
1960

1961
                    break;
4✔
1962
                    // Picture property
1963
                case 0x03:
5✔
1964
                    break;
×
1965
                    // Section property
1966
                case 0x04:
5✔
1967
                    if (!isset($oStylePrl->styleSection)) {
5✔
1968
                        $oStylePrl->styleSection = [];
5✔
1969
                    }
1970
                    switch ($oSprm->isPmd) {
5✔
1971
                        // sprmSNfcPgn
1972
                        case 0x0E:
5✔
1973
                            // numbering format used for page numbers
1974
                            break;
2✔
1975
                            // sprmSXaPage
1976
                        case 0x1F:
5✔
1977
                            $oStylePrl->styleSection['pageSizeW'] = $operand;
5✔
1978

1979
                            break;
5✔
1980
                            // sprmSYaPage
1981
                        case 0x20:
5✔
1982
                            $oStylePrl->styleSection['pageSizeH'] = $operand;
5✔
1983

1984
                            break;
5✔
1985
                            // sprmSDxaLeft
1986
                        case 0x21:
5✔
1987
                            $oStylePrl->styleSection['marginLeft'] = $operand;
5✔
1988

1989
                            break;
5✔
1990
                            // sprmSDxaRight
1991
                        case 0x22:
5✔
1992
                            $oStylePrl->styleSection['marginRight'] = $operand;
5✔
1993

1994
                            break;
5✔
1995
                            // sprmSDyaTop
1996
                        case 0x23:
5✔
1997
                            $oStylePrl->styleSection['marginTop'] = $operand;
5✔
1998

1999
                            break;
5✔
2000
                            // sprmSDyaBottom
2001
                        case 0x24:
5✔
2002
                            $oStylePrl->styleSection['marginBottom'] = $operand;
5✔
2003

2004
                            break;
5✔
2005
                            // sprmSFBiDi
2006
                        case 0x28:
5✔
2007
                            // RTL layout
2008
                            break;
2✔
2009
                            // sprmSDxtCharSpace
2010
                        case 0x30:
5✔
2011
                            // characpter pitch
2012
                            break;
3✔
2013
                            // sprmSDyaLinePitch
2014
                        case 0x31:
5✔
2015
                            // line height
2016
                            break;
5✔
2017
                            // sprmSClm
2018
                        case 0x32:
5✔
2019
                            // document grid mode
2020
                            break;
3✔
2021
                            // sprmSTextFlow
2022
                        case 0x33:
5✔
2023
                            // text flow
2024
                            break;
2✔
2025
                        default:
2026
                            // print_r('@todo Section : 0x'.dechex($oSprm->isPmd));
2027
                            // print_r(PHP_EOL);
2028
                    }
2029

2030
                    break;
5✔
2031
                    // Table property
2032
                case 0x05:
2✔
2033
                    break;
×
2034
            }
2035
        } while ($cbNum > 0);
5✔
2036

2037
        if (null !== $sprmCPicLocation) {
5✔
2038
            if (null !== $sprmCFData && $sprmCFData == 0x01) {
2✔
2039
                // NilPICFAndBinData
2040
                //@todo Read Hyperlink structure
2041
                /*$lcb = self::getInt4d($this->dataData, $sprmCPicLocation);
2042
                $sprmCPicLocation += 4;
2043
                $cbHeader = self::getInt2d($this->dataData, $sprmCPicLocation);
2044
                $sprmCPicLocation += 2;
2045
                // ignored
2046
                $sprmCPicLocation += 62;
2047
                // depending of the element
2048
                // Hyperlink => HFD
2049
                // HFD > bits
2050
                $sprmCPicLocation += 1;
2051
                // HFD > clsid
2052
                $sprmCPicLocation += 16;
2053
                // HFD > hyperlink
2054
                //@see  http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx
2055
                $streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation);
2056
                $sprmCPicLocation += 4;
2057
                $data = self::getInt4d($this->dataData, $sprmCPicLocation);
2058
                $sprmCPicLocation += 4;
2059
                $hlstmfAbsFromGetdataRel = ($data >> 9) & bindec('1');
2060
                $hlstmfMonikerSavedAsStr = ($data >> 8) & bindec('1');
2061
                $hlstmfHasFrameName = ($data >> 7) & bindec('1');
2062
                $hlstmfHasCreationTime = ($data >> 6) & bindec('1');
2063
                $hlstmfHasGUID = ($data >> 5) & bindec('1');
2064
                $hlstmfHasDisplayName = ($data >> 4) & bindec('1');
2065
                $hlstmfHasLocationStr = ($data >> 3) & bindec('1');
2066
                $hlstmfSiteGaveDisplayName = ($data >> 2) & bindec('1');
2067
                $hlstmfIsAbsolute = ($data >> 1) & bindec('1');
2068
                $hlstmfHasMoniker = ($data >> 0) & bindec('1');
2069
                for ($inc = 0; $inc <= 32; $inc++) {
2070
                    echo ($data >> $inc) & bindec('1');
2071
                }
2072

2073
                print_r('$hlstmfHasMoniker > '.$hlstmfHasMoniker.PHP_EOL);
2074
                print_r('$hlstmfIsAbsolute > '.$hlstmfIsAbsolute.PHP_EOL);
2075
                print_r('$hlstmfSiteGaveDisplayName > '.$hlstmfSiteGaveDisplayName.PHP_EOL);
2076
                print_r('$hlstmfHasLocationStr > '.$hlstmfHasLocationStr.PHP_EOL);
2077
                print_r('$hlstmfHasDisplayName > '.$hlstmfHasDisplayName.PHP_EOL);
2078
                print_r('$hlstmfHasGUID > '.$hlstmfHasGUID.PHP_EOL);
2079
                print_r('$hlstmfHasCreationTime > '.$hlstmfHasCreationTime.PHP_EOL);
2080
                print_r('$hlstmfHasFrameName > '.$hlstmfHasFrameName.PHP_EOL);
2081
                print_r('$hlstmfMonikerSavedAsStr > '.$hlstmfMonikerSavedAsStr.PHP_EOL);
2082
                print_r('$hlstmfAbsFromGetdataRel > '.$hlstmfAbsFromGetdataRel.PHP_EOL);
2083
                if ($streamVersion == 2) {
2084
                    $AAA = self::getInt4d($this->dataData, $sprmCPicLocation);
2085
                    echo 'AAAA : '.$AAA.PHP_EOL;
2086
                    if ($hlstmfHasDisplayName == 1) {
2087
                        echo 'displayName'.PHP_EOL;
2088
                    }
2089
                    if ($hlstmfHasFrameName == 1) {
2090
                        echo 'targetFrameName'.PHP_EOL;
2091
                    }
2092
                    if ($hlstmfHasMoniker == 1 || $hlstmfMonikerSavedAsStr == 1) {
2093
                        $sprmCPicLocation += 16;
2094
                        $length = self::getInt4d($this->dataData, $sprmCPicLocation);
2095
                        $sprmCPicLocation += 4;
2096
                        for ($inc = 0; $inc < ($length / 2); $inc++) {
2097
                            $chr = self::getInt2d($this->dataData, $sprmCPicLocation);
2098
                            $sprmCPicLocation += 2;
2099
                            print_r(chr($chr));
2100
                        }
2101
                        echo PHP_EOL;
2102
                        echo 'moniker : '.$length.PHP_EOL;
2103
                    }
2104
                    if ($hlstmfHasMoniker == 1 || $hlstmfMonikerSavedAsStr == 1) {
2105
                        echo 'oleMoniker'.PHP_EOL;
2106
                    }
2107
                    if ($hlstmfHasLocationStr == 1) {
2108
                        echo 'location'.PHP_EOL;
2109
                    }
2110
                    if ($hlstmfHasGUID == 1) {
2111
                        echo 'guid'.PHP_EOL;
2112
                        $sprmCPicLocation += 16;
2113
                    }
2114
                    if ($hlstmfHasCreationTime == 1) {
2115
                        echo 'fileTime'.PHP_EOL;
2116
                        $sprmCPicLocation += 4;
2117
                    }
2118
                    echo 'HYPERLINK'.PHP_EOL;
2119
                }*/
2120
            } else {
2121
                // Pictures
2122
                //@see  http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx
2123
                //@see  http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx
2124
                // PICF : lcb
2125
                $sprmCPicLocation += 4;
2✔
2126
                // PICF : cbHeader
2127
                $sprmCPicLocation += 2;
2✔
2128
                // PICF : mfpf : mm
2129
                $mfpfMm = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2130
                $sprmCPicLocation += 2;
2✔
2131
                // PICF : mfpf : xExt
2132
                $sprmCPicLocation += 2;
2✔
2133
                // PICF : mfpf : yExt
2134
                $sprmCPicLocation += 2;
2✔
2135
                // PICF : mfpf : swHMF
2136
                $sprmCPicLocation += 2;
2✔
2137
                // PICF : innerHeader : grf
2138
                $sprmCPicLocation += 4;
2✔
2139
                // PICF : innerHeader : padding1
2140
                $sprmCPicLocation += 4;
2✔
2141
                // PICF : innerHeader : mmPM
2142
                $sprmCPicLocation += 2;
2✔
2143
                // PICF : innerHeader : padding2
2144
                $sprmCPicLocation += 4;
2✔
2145
                // PICF : picmid : dxaGoal
2146
                $picmidDxaGoal = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2147
                $sprmCPicLocation += 2;
2✔
2148
                // PICF : picmid : dyaGoal
2149
                $picmidDyaGoal = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2150
                $sprmCPicLocation += 2;
2✔
2151
                // PICF : picmid : mx
2152
                $picmidMx = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2153
                $sprmCPicLocation += 2;
2✔
2154
                // PICF : picmid : my
2155
                $picmidMy = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2156
                $sprmCPicLocation += 2;
2✔
2157
                // PICF : picmid : dxaReserved1
2158
                $picmidDxaCropLeft = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2159
                $sprmCPicLocation += 2;
2✔
2160
                // PICF : picmid : dyaReserved1
2161
                $picmidDxaCropTop = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2162
                $sprmCPicLocation += 2;
2✔
2163
                // PICF : picmid : dxaReserved2
2164
                $picmidDxaCropRight = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2165
                $sprmCPicLocation += 2;
2✔
2166
                // PICF : picmid : dyaReserved2
2167
                $picmidDxaCropBottom = self::getInt2d($this->dataData, $sprmCPicLocation);
2✔
2168
                $sprmCPicLocation += 2;
2✔
2169
                // PICF : picmid : fReserved
2170
                ++$sprmCPicLocation;
2✔
2171
                // PICF : picmid : bpp
2172
                ++$sprmCPicLocation;
2✔
2173
                // PICF : picmid : brcTop80
2174
                $sprmCPicLocation += 4;
2✔
2175
                // PICF : picmid : brcLeft80
2176
                $sprmCPicLocation += 4;
2✔
2177
                // PICF : picmid : brcBottom80
2178
                $sprmCPicLocation += 4;
2✔
2179
                // PICF : picmid : brcRight80
2180
                $sprmCPicLocation += 4;
2✔
2181
                // PICF : picmid : dxaReserved3
2182
                $sprmCPicLocation += 2;
2✔
2183
                // PICF : picmid : dyaReserved3
2184
                $sprmCPicLocation += 2;
2✔
2185
                // PICF : cProps
2186
                $sprmCPicLocation += 2;
2✔
2187

2188
                if ($mfpfMm == 0x0066) {
2✔
2189
                    // cchPicName
2190
                    $cchPicName = self::getInt1d($this->dataData, $sprmCPicLocation);
×
2191
                    ++$sprmCPicLocation;
×
2192

2193
                    // stPicName
2194
                    //$stPicName = '';
2195
                    for ($inc = 0; $inc <= $cchPicName; ++$inc) {
×
2196
                        //$chr = self::getInt1d($this->dataData, $sprmCPicLocation);
2197
                        ++$sprmCPicLocation;
×
2198
                        //$stPicName .= chr($chr);
2199
                    }
2200
                }
2201

2202
                // picture (OfficeArtInlineSpContainer)
2203
                // picture : shape
2204
                $shapeRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
2✔
2205
                $sprmCPicLocation += 8;
2✔
2206
                if ($shapeRH['recVer'] == 0xF && $shapeRH['recInstance'] == 0x000 && $shapeRH['recType'] == 0xF004) {
2✔
2207
                    $sprmCPicLocation += $shapeRH['recLen'];
2✔
2208
                }
2209
                // picture : rgfb
2210
                //@see  http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx
2211
                $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
2✔
2212
                while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) {
2✔
2213
                    $sprmCPicLocation += 8;
2✔
2214
                    switch ($fileBlockRH['recType']) {
2✔
2215
                        // OfficeArtFBSE
2216
                        //@see  http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx
2217
                        case 0xF007:
2✔
2218
                            // btWin32
2219
                            ++$sprmCPicLocation;
2✔
2220
                            // btMacOS
2221
                            ++$sprmCPicLocation;
2✔
2222
                            // rgbUid
2223
                            $sprmCPicLocation += 16;
2✔
2224
                            // tag
2225
                            $sprmCPicLocation += 2;
2✔
2226
                            // size
2227
                            $sprmCPicLocation += 4;
2✔
2228
                            // cRef
2229
                            $sprmCPicLocation += 4;
2✔
2230
                            // foDelay
2231
                            $sprmCPicLocation += 4;
2✔
2232
                            // unused1
2233
                            ++$sprmCPicLocation;
2✔
2234
                            // cbName
2235
                            $cbName = self::getInt1d($this->dataData, $sprmCPicLocation);
2✔
2236
                            ++$sprmCPicLocation;
2✔
2237
                            // unused2
2238
                            ++$sprmCPicLocation;
2✔
2239
                            // unused3
2240
                            ++$sprmCPicLocation;
2✔
2241
                            // nameData
2242
                            if ($cbName > 0) {
2✔
2243
                                //$nameData = '';
2244
                                for ($inc = 0; $inc <= ($cbName / 2); ++$inc) {
×
2245
                                    //$chr = self::getInt2d($this->dataData, $sprmCPicLocation);
2246
                                    $sprmCPicLocation += 2;
×
2247
                                    //$nameData .= chr($chr);
2248
                                }
2249
                            }
2250
                            // embeddedBlip
2251
                            //@see  http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx
2252
                            $embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
2✔
2253
                            switch ($embeddedBlipRH['recType']) {
2✔
2254
                                case self::OFFICEARTBLIPJPG:
2255
                                case self::OFFICEARTBLIPJPEG:
2256
                                    if (!isset($oStylePrl->image)) {
1✔
2257
                                        $oStylePrl->image = [];
1✔
2258
                                    }
2259
                                    $sprmCPicLocation += 8;
1✔
2260
                                    // embeddedBlip : rgbUid1
2261
                                    $sprmCPicLocation += 16;
1✔
2262
                                    if ($embeddedBlipRH['recInstance'] == 0x6E1) {
1✔
2263
                                        // rgbUid2
2264
                                        $sprmCPicLocation += 16;
×
2265
                                    }
2266
                                    // embeddedBlip : tag
2267
                                    ++$sprmCPicLocation;
1✔
2268
                                    // embeddedBlip : BLIPFileData
2269
                                    $oStylePrl->image['data'] = substr($this->dataData, $sprmCPicLocation, $embeddedBlipRH['recLen']);
1✔
2270
                                    $oStylePrl->image['format'] = 'jpg';
1✔
2271
                                    // Image Size
2272
                                    $iCropWidth = $picmidDxaGoal - ($picmidDxaCropLeft + $picmidDxaCropRight);
1✔
2273
                                    $iCropHeight = $picmidDyaGoal - ($picmidDxaCropTop + $picmidDxaCropBottom);
1✔
2274
                                    if (!$iCropWidth) {
1✔
2275
                                        $iCropWidth = 1;
×
2276
                                    }
2277
                                    if (!$iCropHeight) {
1✔
2278
                                        $iCropHeight = 1;
×
2279
                                    }
2280
                                    $oStylePrl->image['width'] = Drawing::twipsToPixels($iCropWidth * $picmidMx / 1000);
1✔
2281
                                    $oStylePrl->image['height'] = Drawing::twipsToPixels($iCropHeight * $picmidMy / 1000);
1✔
2282

2283
                                    $sprmCPicLocation += $embeddedBlipRH['recLen'];
1✔
2284

2285
                                    break;
1✔
2286
                                case self::OFFICEARTBLIPPNG:
2287
                                    break;
1✔
2288
                                default:
2289
                                    // print_r(dechex($embeddedBlipRH['recType']));
2290
                            }
2291

2292
                            break;
2✔
2293
                    }
2294
                    $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
2✔
2295
                }
2296
            }
2297
        }
2298

2299
        $oStylePrl->length = $pos - $posStart;
5✔
2300

2301
        return $oStylePrl;
5✔
2302
    }
2303

2304
    /**
2305
     * Read a record header.
2306
     *
2307
     * @param string $stream
2308
     * @param int $pos
2309
     *
2310
     * @return array
2311
     */
2312
    private function loadRecordHeader($stream, $pos)
2313
    {
2314
        $rec = self::getInt2d($stream, $pos);
2✔
2315
        $recType = self::getInt2d($stream, $pos + 2);
2✔
2316
        $recLen = self::getInt4d($stream, $pos + 4);
2✔
2317

2318
        return [
2✔
2319
            'recVer' => ($rec >> 0) & bindec('1111'),
2✔
2320
            'recInstance' => ($rec >> 4) & bindec('111111111111'),
2✔
2321
            'recType' => $recType,
2✔
2322
            'recLen' => $recLen,
2✔
2323
        ];
2✔
2324
    }
2325

2326
    private function generatePhpWord(): void
2327
    {
2328
        foreach ($this->arraySections as $itmSection) {
5✔
2329
            $oSection = $this->phpWord->addSection();
5✔
2330
            $oSection->setStyle($itmSection->styleSection);
5✔
2331

2332
            $sHYPERLINK = '';
5✔
2333
            foreach ($this->arrayParagraphs as $itmParagraph) {
5✔
2334
                $textPara = $itmParagraph;
5✔
2335
                foreach ($this->arrayCharacters as $oCharacters) {
5✔
2336
                    $subText = mb_substr($textPara, $oCharacters->pos_start, $oCharacters->pos_len);
5✔
2337
                    $subText = str_replace(chr(13), PHP_EOL, $subText);
5✔
2338
                    $arrayText = explode(PHP_EOL, $subText);
5✔
2339
                    if (end($arrayText) == '') {
5✔
2340
                        array_pop($arrayText);
5✔
2341
                    }
2342
                    if (reset($arrayText) == '') {
5✔
2343
                        array_shift($arrayText);
4✔
2344
                    }
2345

2346
                    // Style Character
2347
                    $styleFont = [];
5✔
2348
                    if (isset($oCharacters->style)) {
5✔
2349
                        if (isset($oCharacters->style->styleFont)) {
4✔
2350
                            $styleFont = $oCharacters->style->styleFont;
4✔
2351
                        }
2352
                    }
2353

2354
                    foreach ($arrayText as $sText) {
5✔
2355
                        // HyperLink
2356
                        if (empty($sText) && !empty($sHYPERLINK)) {
5✔
UNCOV
2357
                            $arrHYPERLINK = explode('"', $sHYPERLINK);
×
UNCOV
2358
                            $oSection->addLink($arrHYPERLINK[1], null);
×
2359
                            // print_r('>addHyperLink<'.$sHYPERLINK.'>'.ord($sHYPERLINK[0]).EOL);
UNCOV
2360
                            $sHYPERLINK = '';
×
2361
                        }
2362

2363
                        // TextBreak
2364
                        if (empty($sText)) {
5✔
2365
                            $oSection->addTextBreak();
3✔
2366
                            $sHYPERLINK = '';
3✔
2367
                            // print_r('>addTextBreak<' . EOL);
2368
                        }
2369

2370
                        if (!empty($sText)) {
5✔
2371
                            if (!empty($sHYPERLINK) && ord($sText[0]) > 20) {
5✔
UNCOV
2372
                                $sHYPERLINK .= $sText;
×
2373
                            }
2374
                            if (empty($sHYPERLINK)) {
5✔
2375
                                if (ord($sText[0]) > 20) {
5✔
2376
                                    if (strpos(trim($sText), 'HYPERLINK "') === 0) {
5✔
UNCOV
2377
                                        $sHYPERLINK = $sText;
×
2378
                                    } else {
2379
                                        $oSection->addText($sText, $styleFont);
5✔
2380
                                        // print_r('>addText<'.$sText.'>'.ord($sText[0]).EOL);
2381
                                    }
2382
                                }
2383
                                if (ord($sText[0]) == 1) {
5✔
2384
                                    if (isset($oCharacters->style->image)) {
1✔
UNCOV
2385
                                        $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc') . '.' . $oCharacters->style->image['format'];
×
UNCOV
2386
                                        file_put_contents($fileImage, $oCharacters->style->image['data']);
×
UNCOV
2387
                                        $oSection->addImage($fileImage, ['width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height']]);
×
2388
                                        // print_r('>addImage<'.$fileImage.'>'.EOL);
2389
                                    }
2390
                                }
2391
                            }
2392
                        }
2393
                    }
2394
                }
2395
            }
2396
        }
2397
    }
2398

2399
    /**
2400
     * Read 8-bit unsigned integer.
2401
     *
2402
     * @param string $data
2403
     * @param int $pos
2404
     *
2405
     * @return int
2406
     */
2407
    public static function getInt1d($data, $pos)
2408
    {
2409
        return ord($data[$pos]);
5✔
2410
    }
2411

2412
    /**
2413
     * Read 16-bit unsigned integer.
2414
     *
2415
     * @param string $data
2416
     * @param int $pos
2417
     *
2418
     * @return int
2419
     */
2420
    public static function getInt2d($data, $pos)
2421
    {
2422
        return ord($data[$pos]) | (ord($data[$pos + 1]) << 8);
5✔
2423
    }
2424

2425
    /**
2426
     * Read 24-bit signed integer.
2427
     *
2428
     * @param string $data
2429
     * @param int $pos
2430
     *
2431
     * @return int
2432
     */
2433
    public static function getInt3d($data, $pos)
2434
    {
2435
        return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16);
2✔
2436
    }
2437

2438
    /**
2439
     * Read 32-bit signed integer.
2440
     *
2441
     * @param string $data
2442
     * @param int $pos
2443
     *
2444
     * @return int
2445
     */
2446
    public static function getInt4d($data, $pos)
2447
    {
2448
        // FIX: represent numbers correctly on 64-bit system
2449
        // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
2450
        // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
2451
        $or24 = ord($data[$pos + 3]);
5✔
2452
        if ($or24 >= 128) {
5✔
2453
            // negative number
2454
            $ord24 = -abs((256 - $or24) << 24);
3✔
2455
        } else {
2456
            $ord24 = ($or24 & 127) << 24;
5✔
2457
        }
2458

2459
        return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24;
5✔
2460
    }
2461
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc