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

PHPOffice / PHPWord / 29783978122

20 Jul 2026 10:27PM UTC coverage: 98.684% (+1.9%) from 96.738%
29783978122

Pull #2567

github

web-flow
Merge f64cfee48 into 5579bd257
Pull Request #2567: WIP Do Not Install

15594 of 15802 relevant lines covered (98.68%)

55.42 hits per line

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

90.19
/src/PhpWord/Reader/MsDoc.php
1
<?php
2

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

19
namespace PhpOffice\PhpWord\Reader;
20

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

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

41
    /**
42
     * WordDocument Stream.
43
     *
44
     * @var mixed
45
     */
46
    protected $dataWorkDocument;
47

48
    /**
49
     * 1Table Stream.
50
     *
51
     * @var mixed
52
     */
53
    protected $data1Table;
54

55
    /**
56
     * Data Stream.
57
     *
58
     * @var mixed
59
     */
60
    protected $dataData;
61

62
    /**
63
     * Object Pool Stream.
64
     *
65
     * @var mixed
66
     */
67
    protected $dataObjectPool;
68

69
    /**
70
     * @var stdClass[]
71
     */
72
    private $arrayCharacters = [];
73

74
    /**
75
     * @var array
76
     */
77
    private $arrayFib = [];
78

79
    /**
80
     * @var array<array<string, string>>
81
     */
82
    private $arrayFonts = [];
83

84
    /**
85
     * @var string[]
86
     */
87
    private $arrayParagraphs = [];
88

89
    /**
90
     * @var stdClass[]
91
     */
92
    private $arraySections = [];
93

94
    /** @var string */
95
    protected $summaryInformation;
96

97
    /** @var string */
98
    protected $documentSummaryInformation;
99

100
    const VERSION_97 = '97';
101
    const VERSION_2000 = '2000';
102
    const VERSION_2002 = '2002';
103
    const VERSION_2003 = '2003';
104
    const VERSION_2007 = '2007';
105

106
    const SPRA_VALUE = 10;
107
    const SPRA_VALUE_OPPOSITE = 20;
108

109
    const OFFICEARTBLIPEMF = 0xF01A;
110
    const OFFICEARTBLIPWMF = 0xF01B;
111
    const OFFICEARTBLIPPICT = 0xF01C;
112
    const OFFICEARTBLIPJPG = 0xF01D;
113
    const OFFICEARTBLIPPNG = 0xF01E;
114
    const OFFICEARTBLIPDIB = 0xF01F;
115
    const OFFICEARTBLIPTIFF = 0xF029;
116
    const OFFICEARTBLIPJPEG = 0xF02A;
117

118
    const MSOBLIPERROR = 0x00;
119
    const MSOBLIPUNKNOWN = 0x01;
120
    const MSOBLIPEMF = 0x02;
121
    const MSOBLIPWMF = 0x03;
122
    const MSOBLIPPICT = 0x04;
123
    const MSOBLIPJPEG = 0x05;
124
    const MSOBLIPPNG = 0x06;
125
    const MSOBLIPDIB = 0x07;
126
    const MSOBLIPTIFF = 0x11;
127
    const MSOBLIPCMYKJPEG = 0x12;
128

129
    /**
130
     * Loads PhpWord from file.
131
     *
132
     * @param string $filename
133
     *
134
     * @return PhpWord
135
     */
136
    public function load($filename)
8✔
137
    {
138
        $this->phpWord = new PhpWord();
8✔
139

140
        $this->loadOLE($filename);
8✔
141

142
        $this->readFib($this->dataWorkDocument);
6✔
143
        $this->readFibContent();
6✔
144

145
        return $this->phpWord;
6✔
146
    }
147

148
    /**
149
     * Load an OLE Document.
150
     *
151
     * @param string $filename
152
     */
153
    private function loadOLE($filename): void
8✔
154
    {
155
        // OLE reader
156
        $ole = new OLERead();
8✔
157
        $ole->read($filename);
8✔
158

159
        // Get WorkDocument stream
160
        $this->dataWorkDocument = $ole->getStream($ole->wrkdocument);
6✔
161
        // Get 1Table stream
162
        $this->data1Table = $ole->getStream($ole->wrk1Table);
6✔
163
        // Get Data stream
164
        $this->dataData = $ole->getStream($ole->wrkData);
6✔
165
        // Get Data stream
166
        $this->dataObjectPool = $ole->getStream($ole->wrkObjectPool);
6✔
167
        // Get Summary Information data
168
        $this->summaryInformation = $ole->getStream($ole->summaryInformation);
6✔
169
        // Get Document Summary Information data
170
        $this->documentSummaryInformation = $ole->getStream($ole->docSummaryInfos);
6✔
171
    }
172

173
    /**
174
     * @param int $lcb
175
     * @param int $iSize
176
     *
177
     * @return int
178
     */
179
    private function getNumInLcb($lcb, $iSize)
6✔
180
    {
181
        return ($lcb - 4) / (4 + $iSize);
6✔
182
    }
183

184
    /**
185
     * @param string $data
186
     * @param int $posMem
187
     * @param int $iNum
188
     *
189
     * @return array
190
     */
191
    private function getArrayCP($data, $posMem, $iNum)
6✔
192
    {
193
        $arrayCP = [];
6✔
194
        for ($inc = 0; $inc < $iNum; ++$inc) {
6✔
195
            $arrayCP[$inc] = self::getInt4d($data, $posMem);
6✔
196
            $posMem += 4;
6✔
197
        }
198

199
        return $arrayCP;
6✔
200
    }
201

202
    /**
203
     * @see  http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
204
     * @see  https://igor.io/2012/09/24/binary-parsing.html
205
     *
206
     * @param string $data
207
     *
208
     * @return int
209
     */
210
    private function readFib($data)
6✔
211
    {
212
        $pos = 0;
6✔
213
        //----- FibBase
214
        // wIdent
215
        $pos += 2;
6✔
216
        // nFib
217
        $pos += 2;
6✔
218
        // unused
219
        $pos += 2;
6✔
220
        // lid : Language Identifier
221
        $pos += 2;
6✔
222
        // pnNext
223
        $pos += 2;
6✔
224

225
        // $mem = self::getInt2d($data, $pos);
226
        // $fDot = ($mem >> 15) & 1;
227
        // $fGlsy = ($mem >> 14) & 1;
228
        // $fComplex = ($mem >> 13) & 1;
229
        // $fHasPic = ($mem >> 12) & 1;
230
        // $cQuickSaves = ($mem >> 8) & bindec('1111');
231
        // $fEncrypted = ($mem >> 7) & 1;
232
        // $fWhichTblStm = ($mem >> 6) & 1;
233
        // $fReadOnlyRecommended = ($mem >> 5) & 1;
234
        // $fWriteReservation = ($mem >> 4) & 1;
235
        // $fExtChar = ($mem >> 3) & 1;
236
        // $fLoadOverride = ($mem >> 2) & 1;
237
        // $fFarEast = ($mem >> 1) & 1;
238
        // $fObfuscated = ($mem >> 0) & 1;
239
        $pos += 2;
6✔
240
        // nFibBack
241
        $pos += 2;
6✔
242
        // lKey
243
        $pos += 4;
6✔
244
        // envr
245
        ++$pos;
6✔
246

247
        // $mem = self::getInt1d($data, $pos);
248
        // $fMac = ($mem >> 7) & 1;
249
        // $fEmptySpecial = ($mem >> 6) & 1;
250
        // $fLoadOverridePage = ($mem >> 5) & 1;
251
        // $reserved1 = ($mem >> 4) & 1;
252
        // $reserved2 = ($mem >> 3) & 1;
253
        // $fSpare0 = ($mem >> 0) & bindec('111');
254
        ++$pos;
6✔
255

256
        // reserved3
257
        $pos += 2;
6✔
258
        // reserved4
259
        $pos += 2;
6✔
260
        // reserved5
261
        $pos += 4;
6✔
262
        // reserved6
263
        $pos += 4;
6✔
264

265
        //----- csw
266
        $pos += 2;
6✔
267

268
        //----- fibRgW
269
        // reserved1
270
        $pos += 2;
6✔
271
        // reserved2
272
        $pos += 2;
6✔
273
        // reserved3
274
        $pos += 2;
6✔
275
        // reserved4
276
        $pos += 2;
6✔
277
        // reserved5
278
        $pos += 2;
6✔
279
        // reserved6
280
        $pos += 2;
6✔
281
        // reserved7
282
        $pos += 2;
6✔
283
        // reserved8
284
        $pos += 2;
6✔
285
        // reserved9
286
        $pos += 2;
6✔
287
        // reserved10
288
        $pos += 2;
6✔
289
        // reserved11
290
        $pos += 2;
6✔
291
        // reserved12
292
        $pos += 2;
6✔
293
        // reserved13
294
        $pos += 2;
6✔
295
        // lidFE
296
        $pos += 2;
6✔
297

298
        //----- cslw
299
        $pos += 2;
6✔
300

301
        //----- fibRgLw
302
        // cbMac
303
        $pos += 4;
6✔
304
        // reserved1
305
        $pos += 4;
6✔
306
        // reserved2
307
        $pos += 4;
6✔
308
        $this->arrayFib['ccpText'] = self::getInt4d($data, $pos);
6✔
309
        $pos += 4;
6✔
310
        $this->arrayFib['ccpFtn'] = self::getInt4d($data, $pos);
6✔
311
        $pos += 4;
6✔
312
        $this->arrayFib['ccpHdd'] = self::getInt4d($data, $pos);
6✔
313
        $pos += 4;
6✔
314
        // reserved3
315
        $pos += 4;
6✔
316
        // ccpAtn
317
        $pos += 4;
6✔
318
        // ccpEdn
319
        $pos += 4;
6✔
320
        // ccpTxbx
321
        $pos += 4;
6✔
322
        // ccpHdrTxbx
323
        $pos += 4;
6✔
324
        // reserved4
325
        $pos += 4;
6✔
326
        // reserved5
327
        $pos += 4;
6✔
328
        // reserved6
329
        $pos += 4;
6✔
330
        // reserved7
331
        $pos += 4;
6✔
332
        // reserved8
333
        $pos += 4;
6✔
334
        // reserved9
335
        $pos += 4;
6✔
336
        // reserved10
337
        $pos += 4;
6✔
338
        // reserved11
339
        $pos += 4;
6✔
340
        // reserved12
341
        $pos += 4;
6✔
342
        // reserved13
343
        $pos += 4;
6✔
344
        // reserved14
345
        $pos += 4;
6✔
346

347
        //----- cbRgFcLcb
348
        $cbRgFcLcb = self::getInt2d($data, $pos);
6✔
349
        $pos += 2;
6✔
350
        //----- fibRgFcLcbBlob
351
        switch ($cbRgFcLcb) {
352
            case 0x005D:
6✔
353
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
354

355
                break;
×
356
            case 0x006C:
6✔
357
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
358
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
×
359

360
                break;
×
361
            case 0x0088:
6✔
362
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
3✔
363
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
3✔
364
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
3✔
365

366
                break;
3✔
367
            case 0x00A4:
3✔
368
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
×
369
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
×
370
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
×
371
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2003);
×
372

373
                break;
×
374
            case 0x00B7:
3✔
375
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_97);
3✔
376
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2000);
3✔
377
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2002);
3✔
378
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2003);
3✔
379
                $pos = $this->readBlockFibRgFcLcb($data, $pos, self::VERSION_2007);
3✔
380

381
                break;
3✔
382
        }
383
        //----- cswNew
384
        $this->arrayFib['cswNew'] = self::getInt2d($data, $pos);
6✔
385
        $pos += 2;
6✔
386

387
        if ($this->arrayFib['cswNew'] != 0) {
6✔
388
            //@todo : fibRgCswNew
389
        }
390

391
        return $pos;
6✔
392
    }
393

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

1146
        return $pos;
6✔
1147
    }
1148

1149
    private function readFibContent(): void
6✔
1150
    {
1151
        // Informations about Font
1152
        $this->readRecordSttbfFfn();
6✔
1153

1154
        // Informations about page
1155
        $this->readRecordPlcfSed();
6✔
1156

1157
        // reading paragraphs
1158
        //@see  https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86
1159
        $this->readRecordPlcfBtePapx();
6✔
1160

1161
        // reading character formattings
1162
        //@see  https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94
1163
        $this->readRecordPlcfBteChpx();
6✔
1164

1165
        $this->generatePhpWord();
6✔
1166
    }
1167

1168
    /**
1169
     * Section and information about them.
1170
     *
1171
     * @see  http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx
1172
     */
1173
    private function readRecordPlcfSed(): void
6✔
1174
    {
1175
        $posMem = $this->arrayFib['fcPlcfSed'];
6✔
1176
        // PlcfSed
1177
        // PlcfSed : aCP
1178
        $aCP = [];
6✔
1179
        $aCP[0] = self::getInt4d($this->data1Table, $posMem);
6✔
1180
        $posMem += 4;
6✔
1181
        $aCP[1] = self::getInt4d($this->data1Table, $posMem);
6✔
1182
        $posMem += 4;
6✔
1183

1184
        // PlcfSed : aSed
1185
        //@see  http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx
1186
        $numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12);
6✔
1187

1188
        $aSed = [];
6✔
1189
        for ($iInc = 0; $iInc < $numSed; ++$iInc) {
6✔
1190
            // Sed : http://msdn.microsoft.com/en-us/library/dd950982%28v=office.12%29.aspx
1191
            // fn
1192
            $posMem += 2;
6✔
1193
            // fnMpr
1194
            $aSed[$iInc] = self::getInt4d($this->data1Table, $posMem);
6✔
1195
            $posMem += 4;
6✔
1196
            // fnMpr
1197
            $posMem += 2;
6✔
1198
            // fcMpr
1199
            $posMem += 4;
6✔
1200
        }
1201

1202
        foreach ($aSed as $offsetSed) {
6✔
1203
            // Sepx : http://msdn.microsoft.com/en-us/library/dd921348%28v=office.12%29.aspx
1204
            $cb = self::getInt2d($this->dataWorkDocument, $offsetSed);
6✔
1205
            $offsetSed += 2;
6✔
1206

1207
            $oStylePrl = $this->readPrl($this->dataWorkDocument, $offsetSed, $cb);
6✔
1208
            $offsetSed += $oStylePrl->length;
6✔
1209

1210
            $this->arraySections[] = $oStylePrl;
6✔
1211
        }
1212
    }
1213

1214
    /**
1215
     * Specifies the fonts that are used in the document.
1216
     *
1217
     * @see  http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx
1218
     */
1219
    private function readRecordSttbfFfn(): void
6✔
1220
    {
1221
        $posMem = $this->arrayFib['fcSttbfFfn'];
6✔
1222

1223
        $cData = self::getInt2d($this->data1Table, $posMem);
6✔
1224
        $posMem += 2;
6✔
1225
        $cbExtra = self::getInt2d($this->data1Table, $posMem);
6✔
1226
        $posMem += 2;
6✔
1227

1228
        if ($cData < 0x7FF0 && $cbExtra == 0) {
6✔
1229
            for ($inc = 0; $inc < $cData; ++$inc) {
6✔
1230
                // len
1231
                ++$posMem;
6✔
1232
                // ffid
1233
                ++$posMem;
6✔
1234
                // wWeight (400 : Normal - 700 bold)
1235
                $posMem += 2;
6✔
1236
                // chs
1237
                ++$posMem;
6✔
1238
                // ixchSzAlt
1239
                $ixchSzAlt = self::getInt1d($this->data1Table, $posMem);
6✔
1240
                ++$posMem;
6✔
1241
                // panose
1242
                $posMem += 10;
6✔
1243
                // fs
1244
                $posMem += 24;
6✔
1245
                // xszFfn
1246
                $xszFfn = '';
6✔
1247
                do {
1248
                    $char = self::getInt2d($this->data1Table, $posMem);
6✔
1249
                    $posMem += 2;
6✔
1250
                    if ($char > 0) {
6✔
1251
                        $xszFfn .= mb_chr($char, 'UTF-8');
6✔
1252
                    }
1253
                } while ($char != 0);
6✔
1254
                // xszAlt
1255
                $xszAlt = '';
6✔
1256
                if ($ixchSzAlt > 0) {
6✔
1257
                    do {
1258
                        $char = self::getInt2d($this->data1Table, $posMem);
5✔
1259
                        $posMem += 2;
5✔
1260
                        if ($char == 0) {
5✔
1261
                            break;
5✔
1262
                        }
1263
                        $xszAlt .= mb_chr($char, 'UTF-8');
5✔
1264
                    } while ($char != 0);
5✔
1265
                }
1266
                $this->arrayFonts[] = [
6✔
1267
                    'main' => $xszFfn,
6✔
1268
                    'alt' => $xszAlt,
6✔
1269
                ];
6✔
1270
            }
1271
        }
1272
    }
1273

1274
    /**
1275
     * Paragraph and information about them.
1276
     *
1277
     * @see  http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx
1278
     */
1279
    private function readRecordPlcfBtePapx(): void
6✔
1280
    {
1281
        $posMem = $this->arrayFib['fcPlcfBtePapx'];
6✔
1282
        $num = $this->getNumInLcb($this->arrayFib['lcbPlcfBtePapx'], 4);
6✔
1283
        $posMem += 4 * ($num + 1);
6✔
1284
        $arrAPnBtePapx = $this->getArrayCP($this->data1Table, $posMem, $num);
6✔
1285
        $posMem += 4 * $num;
6✔
1286

1287
        foreach ($arrAPnBtePapx as $aPnBtePapx) {
6✔
1288
            $offsetBase = $aPnBtePapx * 512;
6✔
1289
            $offset = $offsetBase;
6✔
1290

1291
            $string = '';
6✔
1292

1293
            $numRun = self::getInt1d($this->dataWorkDocument, $offset + 511);
6✔
1294
            $arrayRGFC = [];
6✔
1295
            for ($inc = 0; $inc <= $numRun; ++$inc) {
6✔
1296
                $arrayRGFC[$inc] = self::getInt4d($this->dataWorkDocument, $offset);
6✔
1297
                $offset += 4;
6✔
1298
            }
1299
            $arrayRGB = [];
6✔
1300
            for ($inc = 1; $inc <= $numRun; ++$inc) {
6✔
1301
                // @see  http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx
1302
                $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
6✔
1303
                ++$offset;
6✔
1304
                // reserved
1305
                $offset += 12;
6✔
1306
            }
1307

1308
            foreach (array_keys($arrayRGFC) as $key) {
6✔
1309
                if (!isset($arrayRGFC[$key + 1])) {
6✔
1310
                    break;
6✔
1311
                }
1312
                $strLen = $arrayRGFC[$key + 1] - $arrayRGFC[$key] - 1;
6✔
1313
                for ($inc = 0; $inc < ($strLen * 2); ++$inc) {
6✔
1314
                    $byte = self::getInt2d($this->dataWorkDocument, $arrayRGFC[$key] + ($inc * 2));
6✔
1315
                    if ($byte > 0) {
6✔
1316
                        $string .= mb_chr($byte, 'UTF-8');
6✔
1317
                    } else {
1318
                        break;
6✔
1319
                    }
1320
                }
1321
            }
1322
            $this->arrayParagraphs[] = $string;
6✔
1323

1324
            //@todo readPrl for paragraphs
1325
            /*// use $this->readPrl()
1326
            foreach ($arrayRGB as $key => $rgb) {
1327
                $offset = $offsetBase + ($rgb * 2);
1328

1329
                $cb = self::getInt1d($this->dataWorkDocument, $offset);
1330
                $offset += 1;
1331
                print_r('$cb : '.$cb.PHP_EOL);
1332
                if ($cb == 0) {
1333
                    $cb = self::getInt1d($this->dataWorkDocument, $offset);
1334
                    $cb = $cb * 2;
1335
                    $offset += 1;
1336
                    print_r('$cb0 : '.$cb.PHP_EOL);
1337
                } else {
1338
                    $cb = $cb * 2 - 1;
1339
                    print_r('$cbD : '.$cb.PHP_EOL);
1340
                }
1341
                $istd = self::getInt2d($this->dataWorkDocument, $offset);
1342
                $offset += 2;
1343
                $cb -= 2;
1344
                print_r('$istd : '.$istd.($istd == 0 ? ' (Normal)' : '').PHP_EOL);
1345
                if ($cb > 0) {
1346
                    do{
1347
                        $sprm = self::getInt2d($this->dataWorkDocument, $offset);
1348
                        $offset += 2;
1349
                        $cb -= 2;
1350
                        $sprm_IsPmd = $sprm & 0x01FF;
1351
                        $sprm_F = ($sprm/512) & 0x0001;
1352
                        $sprm_Sgc = ($sprm/1024) & 0x0007;
1353
                        $sprm_Spra = ($sprm/8192);
1354

1355
                        print_r('$sprm : 0x'.dechex($sprm).PHP_EOL);
1356
                        print_r('$sprm.ispmd : 0x'.dechex($sprm_IsPmd).PHP_EOL);
1357
                        print_r('$sprm.f : 0x'.dechex($sprm_F).PHP_EOL);
1358
                        print_r('$sprm.sgc : 0x'.dechex($sprm_Sgc));
1359
                        switch (dechex($sprm_Sgc)) {
1360
                            case 0x01:
1361
                                print_r(' (Paragraph property)');
1362
                                break;
1363
                            case 0x02:
1364
                                print_r(' (Character property)');
1365
                                break;
1366
                            case 0x03:
1367
                                print_r(' (Picture property)');
1368
                                break;
1369
                            case 0x04:
1370
                                print_r(' (Section property)');
1371
                                break;
1372
                            case 0x05:
1373
                                print_r(' (Table property)');
1374
                                break;
1375
                        }
1376
                        print_r(PHP_EOL);
1377
                        print_r('$sprm.spra : 0x'.dechex($sprm_Spra).PHP_EOL);
1378
                        switch (dechex($sprm_Spra)) {
1379
                            case 0x0:
1380
                                $operand = self::getInt1d($this->dataWorkDocument, $offset);
1381
                                $offset += 1;
1382
                                $cb -= 1;
1383
                                switch (dechex($operand)) {
1384
                                    case 0x00:
1385
                                        $operand = 'OFF';
1386
                                        break;
1387
                                    case 0x01:
1388
                                        $operand = 'ON';
1389
                                        break;
1390
                                    case 0x80:
1391
                                        $operand = 'CURRENT VALUE';
1392
                                        print_r(''.PHP_EOL.PHP_EOL);
1393
                                        break;
1394
                                    case 0x81:
1395
                                        $operand = 'OPPOSITE OF THE CURRENT VALUE';
1396
                                        break;
1397
                                }
1398
                                break;
1399
                            case 0x1:
1400
                                $operand = self::getInt1d($this->dataWorkDocument, $offset);
1401
                                $offset += 1;
1402
                                $cb -= 1;
1403
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1404
                                break;
1405
                            case 0x2:
1406
                            case 0x4:
1407
                            case 0x5:
1408
                                $operand = self::getInt2d($this->dataWorkDocument, $offset);
1409
                                $offset += 2;
1410
                                $cb -= 2;
1411
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1412
                                break;
1413
                            case 0x3:
1414
                                if ($sprm_IsPmd != 0x70) {
1415
                                    $operand = self::getInt4d($this->dataWorkDocument, $offset);
1416
                                    $offset += 4;
1417
                                    $cb -= 4;
1418
                                    print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1419
                                }
1420
                                break;
1421
                            case 0x7:
1422
                                $operand = self::getInt3d($this->dataWorkDocument, $offset);
1423
                                $offset += 3;
1424
                                $cb -= 3;
1425
                                print_r('$operand : 0x'.dechex($operand).PHP_EOL);
1426
                                break;
1427
                            default:
1428
                                print_r('YO YO YO : '.PHP_EOL);
1429
                        }
1430

1431
                        //
1432
                        switch (dechex($sprm_Sgc)) {
1433
                            case 0x01: // Sprm is modifying a paragraph property.
1434
                                switch ($sprm_IsPmd) {
1435
                                    case 0x0A: // sprmPIlvl
1436
                                        print_r('sprmPIlvl : '.$operand.PHP_EOL.PHP_EOL);
1437
                                        break;
1438
                                    case 0x0B: // sprmPIlfo
1439
                                        print_r('sprmPIlfo : '.$operand.PHP_EOL.PHP_EOL);
1440
                                        break;
1441
                                    default:
1442
                                        print_r('$sprm_IsPmd(1) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1443
                                        break;
1444
                                }
1445
                                break;
1446
                            case 0x02: // Sprm is modifying a character property.
1447
                                switch ($sprm_IsPmd) {
1448
                                    default:
1449
                                        print_r('$sprm_IsPmd(2) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1450
                                        break;
1451
                                }
1452
                                break;
1453
                            case 0x03: // Sprm is modifying a picture property.
1454
                                switch ($sprm_IsPmd) {
1455
                                    default:
1456
                                        print_r('$sprm_IsPmd(3) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1457
                                        break;
1458
                                }
1459
                                break;
1460
                            case 0x04: // Sprm is modifying a section property.
1461
                                switch ($sprm_IsPmd) {
1462
                                    default:
1463
                                        print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1464
                                        break;
1465
                                }
1466
                                break;
1467
                            case 0x05: // Sprm is modifying a table property.
1468
                                switch ($sprm_IsPmd) {
1469
                                    default:
1470
                                        print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL);
1471
                                        break;
1472
                                }
1473
                                break;
1474
                            default:
1475
                                print_r('$sprm_Sgc : '.dechex($sprm_Sgc).PHP_EOL.PHP_EOL);
1476
                                break;
1477
                        }
1478
                    } while ($cb > 0);
1479
                } else {
1480
                    if ($istd > 0) {
1481
                        // @todo : Determining Properties of a Paragraph Style
1482
                        # @see  http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx
1483
                    }
1484
                }
1485
            }*/
1486
        }
1487
    }
1488

1489
    /**
1490
     * Character formatting properties to text in a document.
1491
     *
1492
     * @see  http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx
1493
     */
1494
    private function readRecordPlcfBteChpx(): void
6✔
1495
    {
1496
        $posMem = $this->arrayFib['fcPlcfBteChpx'];
6✔
1497
        $num = $this->getNumInLcb($this->arrayFib['lcbPlcfBteChpx'], 4);
6✔
1498
        $aPnBteChpx = [];
6✔
1499
        for ($inc = 0; $inc <= $num; ++$inc) {
6✔
1500
            $aPnBteChpx[$inc] = self::getInt4d($this->data1Table, $posMem);
6✔
1501
            $posMem += 4;
6✔
1502
        }
1503
        $pnFkpChpx = self::getInt4d($this->data1Table, $posMem);
6✔
1504
        $posMem += 4;
6✔
1505

1506
        $offsetBase = $pnFkpChpx * 512;
6✔
1507
        $offset = $offsetBase;
6✔
1508

1509
        // ChpxFkp
1510
        // @see  http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx
1511
        $numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511);
6✔
1512
        $arrayRGFC = [];
6✔
1513
        for ($inc = 0; $inc <= $numRGFC; ++$inc) {
6✔
1514
            $arrayRGFC[$inc] = self::getInt4d($this->dataWorkDocument, $offset);
6✔
1515
            $offset += 4;
6✔
1516
        }
1517

1518
        $arrayRGB = [];
6✔
1519
        for ($inc = 1; $inc <= $numRGFC; ++$inc) {
6✔
1520
            $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
6✔
1521
            ++$offset;
6✔
1522
        }
1523

1524
        $start = 0;
6✔
1525
        foreach ($arrayRGB as $keyRGB => $rgb) {
6✔
1526
            $oStyle = new stdClass();
6✔
1527
            $oStyle->pos_start = $start;
6✔
1528
            $oStyle->pos_len = (int) ceil((($arrayRGFC[$keyRGB] - 1) - $arrayRGFC[$keyRGB - 1]) / 2);
6✔
1529
            $start += $oStyle->pos_len;
6✔
1530

1531
            if ($rgb > 0) {
6✔
1532
                // Chp Structure
1533
                // @see  http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
1534
                $posRGB = $offsetBase + $rgb * 2;
5✔
1535

1536
                $cb = self::getInt1d($this->dataWorkDocument, $posRGB);
5✔
1537
                ++$posRGB;
5✔
1538

1539
                $oStyle->style = $this->readPrl($this->dataWorkDocument, $posRGB, $cb);
5✔
1540
                $posRGB += $oStyle->style->length;
5✔
1541
            }
1542
            $this->arrayCharacters[] = $oStyle;
6✔
1543
        }
1544
    }
1545

1546
    /**
1547
     * @param int $sprm
1548
     *
1549
     * @return stdClass
1550
     */
1551
    private function readSprm($sprm)
6✔
1552
    {
1553
        $oSprm = new stdClass();
6✔
1554
        $oSprm->isPmd = $sprm & 0x01FF;
6✔
1555
        $oSprm->f = (int) ($sprm / 512) & 0x0001;
6✔
1556
        $oSprm->sgc = (int) ($sprm / 1024) & 0x0007;
6✔
1557
        $oSprm->spra = (int) ($sprm / 8192);
6✔
1558

1559
        return $oSprm;
6✔
1560
    }
1561

1562
    /**
1563
     * @param string $data
1564
     * @param int $pos
1565
     * @param stdClass $oSprm
1566
     *
1567
     * @return array
1568
     */
1569
    private function readSprmSpra($data, $pos, $oSprm)
6✔
1570
    {
1571
        $length = 0;
6✔
1572
        $operand = null;
6✔
1573

1574
        switch (dechex($oSprm->spra)) {
6✔
1575
            case 0x0:
6✔
1576
                $operand = self::getInt1d($data, $pos);
5✔
1577
                $length = 1;
5✔
1578
                switch (dechex($operand)) {
5✔
1579
                    case 0x00:
5✔
1580
                        $operand = false;
3✔
1581

1582
                        break;
3✔
1583
                    case 0x01:
5✔
1584
                        $operand = true;
4✔
1585

1586
                        break;
4✔
1587
                    case 0x80:
2✔
1588
                        $operand = self::SPRA_VALUE;
×
1589

1590
                        break;
×
1591
                    case 0x81:
2✔
1592
                        $operand = self::SPRA_VALUE_OPPOSITE;
×
1593

1594
                        break;
×
1595
                }
1596

1597
                break;
5✔
1598
            case 0x1:
6✔
1599
                $operand = self::getInt1d($data, $pos);
5✔
1600
                $length = 1;
5✔
1601

1602
                break;
5✔
1603
            case 0x2:
6✔
1604
            case 0x4:
6✔
1605
            case 0x5:
6✔
1606
                $operand = self::getInt2d($data, $pos);
6✔
1607
                $length = 2;
6✔
1608

1609
                break;
6✔
1610
            case 0x3:
6✔
1611
                if ($oSprm->isPmd != 0x70) {
6✔
1612
                    $operand = self::getInt4d($data, $pos);
6✔
1613
                    $length = 4;
6✔
1614
                }
1615

1616
                break;
6✔
1617
            case 0x7:
3✔
1618
                $operand = self::getInt3d($data, $pos);
3✔
1619
                $length = 3;
3✔
1620

1621
                break;
3✔
1622
            default:
1623
                // print_r('YO YO YO : '.PHP_EOL);
1624
        }
1625

1626
        return [
6✔
1627
            'length' => $length,
6✔
1628
            'operand' => $operand,
6✔
1629
        ];
6✔
1630
    }
1631

1632
    /**
1633
     * @param string $data
1634
     * @param int $pos
1635
     * @param int $cbNum
1636
     *
1637
     * @return stdClass
1638
     *
1639
     * @see  http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
1640
     */
1641
    private function readPrl($data, $pos, $cbNum)
6✔
1642
    {
1643
        $posStart = $pos;
6✔
1644
        $oStylePrl = new stdClass();
6✔
1645

1646
        // Variables
1647
        $sprmCPicLocation = null;
6✔
1648
        $sprmCFData = null;
6✔
1649
        //$sprmCFSpec = null;
1650

1651
        do {
1652
            // Variables
1653
            $operand = null;
6✔
1654

1655
            $sprm = self::getInt2d($data, $pos);
6✔
1656
            $oSprm = $this->readSprm($sprm);
6✔
1657
            $pos += 2;
6✔
1658
            $cbNum -= 2;
6✔
1659

1660
            $arrayReturn = $this->readSprmSpra($data, $pos, $oSprm);
6✔
1661
            $pos += $arrayReturn['length'];
6✔
1662
            $cbNum -= $arrayReturn['length'];
6✔
1663
            $operand = $arrayReturn['operand'];
6✔
1664

1665
            switch (dechex($oSprm->sgc)) {
6✔
1666
                // Paragraph property
1667
                case 0x01:
6✔
1668
                    break;
1✔
1669
                    // Character property
1670
                case 0x02:
6✔
1671
                    if (!isset($oStylePrl->styleFont)) {
5✔
1672
                        $oStylePrl->styleFont = [];
5✔
1673
                    }
1674
                    switch ($oSprm->isPmd) {
5✔
1675
                        // sprmCFRMarkIns
1676
                        case 0x01:
5✔
1677
                            break;
×
1678
                            // sprmCFFldVanish
1679
                        case 0x02:
5✔
1680
                            break;
3✔
1681
                            // sprmCPicLocation
1682
                        case 0x03:
5✔
1683
                            $sprmCPicLocation = $operand;
3✔
1684

1685
                            break;
3✔
1686
                            // sprmCFData
1687
                        case 0x06:
5✔
1688
                            $sprmCFData = dechex($operand) != 0x00;
3✔
1689

1690
                            break;
3✔
1691
                            // sprmCFItalic
1692
                        case 0x36:
5✔
1693
                            // By default, text is not italicized.
1694
                            switch ($operand) {
1695
                                case false:
1696
                                case true:
3✔
1697
                                    $oStylePrl->styleFont['italic'] = $operand;
3✔
1698

1699
                                    break;
3✔
1700
                                case self::SPRA_VALUE:
×
1701
                                    $oStylePrl->styleFont['italic'] = false;
×
1702

1703
                                    break;
×
1704
                                case self::SPRA_VALUE_OPPOSITE:
×
1705
                                    $oStylePrl->styleFont['italic'] = true;
×
1706

1707
                                    break;
×
1708
                            }
1709

1710
                            break;
3✔
1711
                            // sprmCIstd
1712
                        case 0x30:
5✔
1713
                            //print_r('sprmCIstd : '.dechex($operand).PHP_EOL.PHP_EOL);
1714
                            break;
3✔
1715
                            // sprmCFBold
1716
                        case 0x35:
5✔
1717
                            // By default, text is not bold.
1718
                            switch ($operand) {
1719
                                case false:
1720
                                case true:
4✔
1721
                                    $oStylePrl->styleFont['bold'] = $operand;
4✔
1722

1723
                                    break;
4✔
1724
                                case self::SPRA_VALUE:
×
1725
                                    $oStylePrl->styleFont['bold'] = false;
×
1726

1727
                                    break;
×
1728
                                case self::SPRA_VALUE_OPPOSITE:
×
1729
                                    $oStylePrl->styleFont['bold'] = true;
×
1730

1731
                                    break;
×
1732
                            }
1733

1734
                            break;
4✔
1735
                            // sprmCFStrike
1736
                        case 0x37:
5✔
1737
                            // By default, text is not struck through.
1738
                            switch ($operand) {
1739
                                case false:
1740
                                case true:
3✔
1741
                                    $oStylePrl->styleFont['strikethrough'] = $operand;
3✔
1742

1743
                                    break;
3✔
1744
                                case self::SPRA_VALUE:
×
1745
                                    $oStylePrl->styleFont['strikethrough'] = false;
×
1746

1747
                                    break;
×
1748
                                case self::SPRA_VALUE_OPPOSITE:
×
1749
                                    $oStylePrl->styleFont['strikethrough'] = true;
×
1750

1751
                                    break;
×
1752
                            }
1753

1754
                            break;
3✔
1755
                            // sprmCKul
1756
                        case 0x3E:
5✔
1757
                            switch (dechex($operand)) {
3✔
1758
                                case 0x00:
3✔
1759
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE;
×
1760

1761
                                    break;
×
1762
                                case 0x01:
3✔
1763
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_SINGLE;
×
1764

1765
                                    break;
×
1766
                                case 0x02:
3✔
1767
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WORDS;
×
1768

1769
                                    break;
×
1770
                                case 0x03:
3✔
1771
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOUBLE;
×
1772

1773
                                    break;
×
1774
                                case 0x04:
3✔
1775
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTTED;
×
1776

1777
                                    break;
×
1778
                                case 0x06:
3✔
1779
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_HEAVY;
×
1780

1781
                                    break;
×
1782
                                case 0x07:
3✔
1783
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASH;
3✔
1784

1785
                                    break;
3✔
1786
                                case 0x09:
×
1787
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASH;
×
1788

1789
                                    break;
×
1790
                                case 0x0A:
×
1791
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASH;
×
1792

1793
                                    break;
×
1794
                                case 0x0B:
×
1795
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVY;
×
1796

1797
                                    break;
×
1798
                                case 0x14:
×
1799
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTTEDHEAVY;
×
1800

1801
                                    break;
×
1802
                                case 0x17:
×
1803
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHHEAVY;
×
1804

1805
                                    break;
×
1806
                                case 0x19:
×
1807
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASHHEAVY;
×
1808

1809
                                    break;
×
1810
                                case 0x1A:
×
1811
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASHHEAVY;
×
1812

1813
                                    break;
×
1814
                                case 0x1B:
×
1815
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVYHEAVY;
×
1816

1817
                                    break;
×
1818
                                case 0x27:
×
1819
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHLONG;
×
1820

1821
                                    break;
×
1822
                                case 0x2B:
×
1823
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_WAVYDOUBLE;
×
1824

1825
                                    break;
×
1826
                                case 0x37:
×
1827
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHLONGHEAVY;
×
1828

1829
                                    break;
×
1830
                                default:
1831
                                    $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE;
×
1832

1833
                                    break;
×
1834
                            }
1835

1836
                            break;
3✔
1837
                            // sprmCIco
1838
                            //@see  http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx
1839
                        case 0x42:
5✔
1840
                            switch (dechex($operand)) {
3✔
1841
                                case 0x00:
3✔
1842
                                case 0x01:
3✔
1843
                                    $oStylePrl->styleFont['color'] = '000000';
×
1844

1845
                                    break;
×
1846
                                case 0x02:
3✔
1847
                                    $oStylePrl->styleFont['color'] = '0000FF';
×
1848

1849
                                    break;
×
1850
                                case 0x03:
3✔
1851
                                    $oStylePrl->styleFont['color'] = '00FFFF';
×
1852

1853
                                    break;
×
1854
                                case 0x04:
3✔
1855
                                    $oStylePrl->styleFont['color'] = '00FF00';
×
1856

1857
                                    break;
×
1858
                                case 0x05:
3✔
1859
                                    $oStylePrl->styleFont['color'] = 'FF00FF';
×
1860

1861
                                    break;
×
1862
                                case 0x06:
3✔
1863
                                    $oStylePrl->styleFont['color'] = 'FF0000';
3✔
1864

1865
                                    break;
3✔
1866
                                case 0x07:
×
1867
                                    $oStylePrl->styleFont['color'] = 'FFFF00';
×
1868

1869
                                    break;
×
1870
                                case 0x08:
×
1871
                                    $oStylePrl->styleFont['color'] = 'FFFFFF';
×
1872

1873
                                    break;
×
1874
                                case 0x09:
×
1875
                                    $oStylePrl->styleFont['color'] = '000080';
×
1876

1877
                                    break;
×
1878
                                case 0x0A:
×
1879
                                    $oStylePrl->styleFont['color'] = '008080';
×
1880

1881
                                    break;
×
1882
                                case 0x0B:
×
1883
                                    $oStylePrl->styleFont['color'] = '008000';
×
1884

1885
                                    break;
×
1886
                                case 0x0C:
×
1887
                                    $oStylePrl->styleFont['color'] = '800080';
×
1888

1889
                                    break;
×
1890
                                case 0x0D:
×
1891
                                    $oStylePrl->styleFont['color'] = '800080';
×
1892

1893
                                    break;
×
1894
                                case 0x0E:
×
1895
                                    $oStylePrl->styleFont['color'] = '808000';
×
1896

1897
                                    break;
×
1898
                                case 0x0F:
×
1899
                                    $oStylePrl->styleFont['color'] = '808080';
×
1900

1901
                                    break;
×
1902
                                case 0x10:
×
1903
                                    $oStylePrl->styleFont['color'] = 'C0C0C0';
×
1904
                            }
1905

1906
                            break;
3✔
1907
                            // sprmCHps
1908
                        case 0x43:
5✔
1909
                            $oStylePrl->styleFont['size'] = $operand / 2;
4✔
1910

1911
                            break;
4✔
1912
                            // sprmCIss
1913
                        case 0x48:
5✔
1914
                            if (!isset($oStylePrl->styleFont['superScript'])) {
3✔
1915
                                $oStylePrl->styleFont['superScript'] = false;
3✔
1916
                            }
1917
                            if (!isset($oStylePrl->styleFont['subScript'])) {
3✔
1918
                                $oStylePrl->styleFont['subScript'] = false;
3✔
1919
                            }
1920
                            switch (dechex($operand)) {
3✔
1921
                                case 0x00:
3✔
1922
                                    // Normal text
1923
                                    break;
×
1924
                                case 0x01:
3✔
1925
                                    $oStylePrl->styleFont['superScript'] = true;
3✔
1926

1927
                                    break;
3✔
1928
                                case 0x02:
×
1929
                                    $oStylePrl->styleFont['subScript'] = true;
×
1930

1931
                                    break;
×
1932
                            }
1933

1934
                            break;
3✔
1935
                            // sprmCRgFtc0
1936
                        case 0x4F:
5✔
1937
                            $oStylePrl->styleFont['name'] = '';
3✔
1938
                            if (isset($this->arrayFonts[$operand])) {
3✔
1939
                                $oStylePrl->styleFont['name'] = $this->arrayFonts[$operand]['main'];
3✔
1940
                            }
1941

1942
                            break;
3✔
1943
                            // sprmCRgFtc1
1944
                        case 0x50:
5✔
1945
                            // if the language for the text is an East Asian language
1946
                            break;
3✔
1947
                            // sprmCRgFtc2
1948
                        case 0x51:
5✔
1949
                            // if the character falls outside the Unicode character range
1950
                            break;
3✔
1951
                            // sprmCFSpec
1952
                        case 0x55:
5✔
1953
                            //$sprmCFSpec = $operand;
1954
                            break;
4✔
1955
                            // sprmCFtcBi
1956
                        case 0x5E:
5✔
1957
                            break;
3✔
1958
                            // sprmCFItalicBi
1959
                        case 0x5D:
5✔
1960
                            break;
3✔
1961
                            // sprmCHpsBi
1962
                        case 0x61:
5✔
1963
                            break;
4✔
1964
                            // sprmCShd80
1965
                            //@see  http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx
1966
                        case 0x66:
5✔
1967
                            // $operand = self::getInt2d($data, $pos);
1968
                            $pos += 2;
3✔
1969
                            $cbNum -= 2;
3✔
1970

1971
                            // $ipat = ($operand >> 0) && bindec('111111');
1972
                            // $icoBack = ($operand >> 6) && bindec('11111');
1973
                            // $icoFore = ($operand >> 11) && bindec('11111');
1974
                            break;
3✔
1975
                            // sprmCCv
1976
                            //@see  http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx
1977
                        case 0x70:
5✔
1978
                            $red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
2✔
1979
                            ++$pos;
2✔
1980
                            $green = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
2✔
1981
                            ++$pos;
2✔
1982
                            $blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
2✔
1983
                            ++$pos;
2✔
1984
                            ++$pos;
2✔
1985
                            $oStylePrl->styleFont['color'] = $red . $green . $blue;
2✔
1986
                            $cbNum -= 4;
2✔
1987

1988
                            break;
2✔
1989
                        default:
1990
                            // print_r('@todo Character : 0x'.dechex($oSprm->isPmd));
1991
                            // print_r(PHP_EOL);
1992
                    }
1993

1994
                    break;
5✔
1995
                    // Picture property
1996
                case 0x03:
6✔
1997
                    break;
×
1998
                    // Section property
1999
                case 0x04:
6✔
2000
                    if (!isset($oStylePrl->styleSection)) {
6✔
2001
                        $oStylePrl->styleSection = [];
6✔
2002
                    }
2003
                    switch ($oSprm->isPmd) {
6✔
2004
                        // sprmSNfcPgn
2005
                        case 0x0E:
6✔
2006
                            // numbering format used for page numbers
2007
                            break;
3✔
2008
                            // sprmSXaPage
2009
                        case 0x1F:
6✔
2010
                            $oStylePrl->styleSection['pageSizeW'] = $operand;
6✔
2011

2012
                            break;
6✔
2013
                            // sprmSYaPage
2014
                        case 0x20:
6✔
2015
                            $oStylePrl->styleSection['pageSizeH'] = $operand;
6✔
2016

2017
                            break;
6✔
2018
                            // sprmSDxaLeft
2019
                        case 0x21:
6✔
2020
                            $oStylePrl->styleSection['marginLeft'] = $operand;
6✔
2021

2022
                            break;
6✔
2023
                            // sprmSDxaRight
2024
                        case 0x22:
6✔
2025
                            $oStylePrl->styleSection['marginRight'] = $operand;
6✔
2026

2027
                            break;
6✔
2028
                            // sprmSDyaTop
2029
                        case 0x23:
6✔
2030
                            $oStylePrl->styleSection['marginTop'] = $operand;
6✔
2031

2032
                            break;
6✔
2033
                            // sprmSDyaBottom
2034
                        case 0x24:
6✔
2035
                            $oStylePrl->styleSection['marginBottom'] = $operand;
6✔
2036

2037
                            break;
6✔
2038
                            // sprmSFBiDi
2039
                        case 0x28:
6✔
2040
                            // RTL layout
2041
                            break;
3✔
2042
                            // sprmSDxtCharSpace
2043
                        case 0x30:
6✔
2044
                            // characpter pitch
2045
                            break;
4✔
2046
                            // sprmSDyaLinePitch
2047
                        case 0x31:
6✔
2048
                            // line height
2049
                            break;
6✔
2050
                            // sprmSClm
2051
                        case 0x32:
6✔
2052
                            // document grid mode
2053
                            break;
4✔
2054
                            // sprmSTextFlow
2055
                        case 0x33:
6✔
2056
                            // text flow
2057
                            break;
3✔
2058
                        default:
2059
                            // print_r('@todo Section : 0x'.dechex($oSprm->isPmd));
2060
                            // print_r(PHP_EOL);
2061
                    }
2062

2063
                    break;
6✔
2064
                    // Table property
2065
                case 0x05:
3✔
2066
                    break;
×
2067
            }
2068
        } while ($cbNum > 0);
6✔
2069

2070
        if (null !== $sprmCPicLocation) {
6✔
2071
            if (null !== $sprmCFData && $sprmCFData == 0x01) {
3✔
2072
                // NilPICFAndBinData
2073
                //@todo Read Hyperlink structure
2074
                /*$lcb = self::getInt4d($this->dataData, $sprmCPicLocation);
2075
                $sprmCPicLocation += 4;
2076
                $cbHeader = self::getInt2d($this->dataData, $sprmCPicLocation);
2077
                $sprmCPicLocation += 2;
2078
                // ignored
2079
                $sprmCPicLocation += 62;
2080
                // depending of the element
2081
                // Hyperlink => HFD
2082
                // HFD > bits
2083
                $sprmCPicLocation += 1;
2084
                // HFD > clsid
2085
                $sprmCPicLocation += 16;
2086
                // HFD > hyperlink
2087
                //@see  http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx
2088
                $streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation);
2089
                $sprmCPicLocation += 4;
2090
                $data = self::getInt4d($this->dataData, $sprmCPicLocation);
2091
                $sprmCPicLocation += 4;
2092
                $hlstmfAbsFromGetdataRel = ($data >> 9) & bindec('1');
2093
                $hlstmfMonikerSavedAsStr = ($data >> 8) & bindec('1');
2094
                $hlstmfHasFrameName = ($data >> 7) & bindec('1');
2095
                $hlstmfHasCreationTime = ($data >> 6) & bindec('1');
2096
                $hlstmfHasGUID = ($data >> 5) & bindec('1');
2097
                $hlstmfHasDisplayName = ($data >> 4) & bindec('1');
2098
                $hlstmfHasLocationStr = ($data >> 3) & bindec('1');
2099
                $hlstmfSiteGaveDisplayName = ($data >> 2) & bindec('1');
2100
                $hlstmfIsAbsolute = ($data >> 1) & bindec('1');
2101
                $hlstmfHasMoniker = ($data >> 0) & bindec('1');
2102
                for ($inc = 0; $inc <= 32; $inc++) {
2103
                    echo ($data >> $inc) & bindec('1');
2104
                }
2105

2106
                print_r('$hlstmfHasMoniker > '.$hlstmfHasMoniker.PHP_EOL);
2107
                print_r('$hlstmfIsAbsolute > '.$hlstmfIsAbsolute.PHP_EOL);
2108
                print_r('$hlstmfSiteGaveDisplayName > '.$hlstmfSiteGaveDisplayName.PHP_EOL);
2109
                print_r('$hlstmfHasLocationStr > '.$hlstmfHasLocationStr.PHP_EOL);
2110
                print_r('$hlstmfHasDisplayName > '.$hlstmfHasDisplayName.PHP_EOL);
2111
                print_r('$hlstmfHasGUID > '.$hlstmfHasGUID.PHP_EOL);
2112
                print_r('$hlstmfHasCreationTime > '.$hlstmfHasCreationTime.PHP_EOL);
2113
                print_r('$hlstmfHasFrameName > '.$hlstmfHasFrameName.PHP_EOL);
2114
                print_r('$hlstmfMonikerSavedAsStr > '.$hlstmfMonikerSavedAsStr.PHP_EOL);
2115
                print_r('$hlstmfAbsFromGetdataRel > '.$hlstmfAbsFromGetdataRel.PHP_EOL);
2116
                if ($streamVersion == 2) {
2117
                    $AAA = self::getInt4d($this->dataData, $sprmCPicLocation);
2118
                    echo 'AAAA : '.$AAA.PHP_EOL;
2119
                    if ($hlstmfHasDisplayName == 1) {
2120
                        echo 'displayName'.PHP_EOL;
2121
                    }
2122
                    if ($hlstmfHasFrameName == 1) {
2123
                        echo 'targetFrameName'.PHP_EOL;
2124
                    }
2125
                    if ($hlstmfHasMoniker == 1 || $hlstmfMonikerSavedAsStr == 1) {
2126
                        $sprmCPicLocation += 16;
2127
                        $length = self::getInt4d($this->dataData, $sprmCPicLocation);
2128
                        $sprmCPicLocation += 4;
2129
                        for ($inc = 0; $inc < ($length / 2); $inc++) {
2130
                            $chr = self::getInt2d($this->dataData, $sprmCPicLocation);
2131
                            $sprmCPicLocation += 2;
2132
                            print_r(chr($chr));
2133
                        }
2134
                        echo PHP_EOL;
2135
                        echo 'moniker : '.$length.PHP_EOL;
2136
                    }
2137
                    if ($hlstmfHasMoniker == 1 || $hlstmfMonikerSavedAsStr == 1) {
2138
                        echo 'oleMoniker'.PHP_EOL;
2139
                    }
2140
                    if ($hlstmfHasLocationStr == 1) {
2141
                        echo 'location'.PHP_EOL;
2142
                    }
2143
                    if ($hlstmfHasGUID == 1) {
2144
                        echo 'guid'.PHP_EOL;
2145
                        $sprmCPicLocation += 16;
2146
                    }
2147
                    if ($hlstmfHasCreationTime == 1) {
2148
                        echo 'fileTime'.PHP_EOL;
2149
                        $sprmCPicLocation += 4;
2150
                    }
2151
                    echo 'HYPERLINK'.PHP_EOL;
2152
                }*/
2153
            } else {
2154
                // Pictures
2155
                //@see  http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx
2156
                //@see  http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx
2157
                // PICF : lcb
2158
                $sprmCPicLocation += 4;
3✔
2159
                // PICF : cbHeader
2160
                $sprmCPicLocation += 2;
3✔
2161
                // PICF : mfpf : mm
2162
                $mfpfMm = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2163
                $sprmCPicLocation += 2;
3✔
2164
                // PICF : mfpf : xExt
2165
                $sprmCPicLocation += 2;
3✔
2166
                // PICF : mfpf : yExt
2167
                $sprmCPicLocation += 2;
3✔
2168
                // PICF : mfpf : swHMF
2169
                $sprmCPicLocation += 2;
3✔
2170
                // PICF : innerHeader : grf
2171
                $sprmCPicLocation += 4;
3✔
2172
                // PICF : innerHeader : padding1
2173
                $sprmCPicLocation += 4;
3✔
2174
                // PICF : innerHeader : mmPM
2175
                $sprmCPicLocation += 2;
3✔
2176
                // PICF : innerHeader : padding2
2177
                $sprmCPicLocation += 4;
3✔
2178
                // PICF : picmid : dxaGoal
2179
                $picmidDxaGoal = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2180
                $sprmCPicLocation += 2;
3✔
2181
                // PICF : picmid : dyaGoal
2182
                $picmidDyaGoal = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2183
                $sprmCPicLocation += 2;
3✔
2184
                // PICF : picmid : mx
2185
                $picmidMx = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2186
                $sprmCPicLocation += 2;
3✔
2187
                // PICF : picmid : my
2188
                $picmidMy = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2189
                $sprmCPicLocation += 2;
3✔
2190
                // PICF : picmid : dxaReserved1
2191
                $picmidDxaCropLeft = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2192
                $sprmCPicLocation += 2;
3✔
2193
                // PICF : picmid : dyaReserved1
2194
                $picmidDxaCropTop = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2195
                $sprmCPicLocation += 2;
3✔
2196
                // PICF : picmid : dxaReserved2
2197
                $picmidDxaCropRight = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2198
                $sprmCPicLocation += 2;
3✔
2199
                // PICF : picmid : dyaReserved2
2200
                $picmidDxaCropBottom = self::getInt2d($this->dataData, $sprmCPicLocation);
3✔
2201
                $sprmCPicLocation += 2;
3✔
2202
                // PICF : picmid : fReserved
2203
                ++$sprmCPicLocation;
3✔
2204
                // PICF : picmid : bpp
2205
                ++$sprmCPicLocation;
3✔
2206
                // PICF : picmid : brcTop80
2207
                $sprmCPicLocation += 4;
3✔
2208
                // PICF : picmid : brcLeft80
2209
                $sprmCPicLocation += 4;
3✔
2210
                // PICF : picmid : brcBottom80
2211
                $sprmCPicLocation += 4;
3✔
2212
                // PICF : picmid : brcRight80
2213
                $sprmCPicLocation += 4;
3✔
2214
                // PICF : picmid : dxaReserved3
2215
                $sprmCPicLocation += 2;
3✔
2216
                // PICF : picmid : dyaReserved3
2217
                $sprmCPicLocation += 2;
3✔
2218
                // PICF : cProps
2219
                $sprmCPicLocation += 2;
3✔
2220

2221
                if ($mfpfMm == 0x0066) {
3✔
2222
                    // cchPicName
2223
                    $cchPicName = self::getInt1d($this->dataData, $sprmCPicLocation);
×
2224
                    ++$sprmCPicLocation;
×
2225

2226
                    // stPicName
2227
                    //$stPicName = '';
2228
                    for ($inc = 0; $inc <= $cchPicName; ++$inc) {
×
2229
                        //$chr = self::getInt1d($this->dataData, $sprmCPicLocation);
2230
                        ++$sprmCPicLocation;
×
2231
                        //$stPicName .= chr($chr);
2232
                    }
2233
                }
2234

2235
                // picture (OfficeArtInlineSpContainer)
2236
                // picture : shape
2237
                $shapeRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
3✔
2238
                $sprmCPicLocation += 8;
3✔
2239
                if ($shapeRH['recVer'] == 0xF && $shapeRH['recInstance'] == 0x000 && $shapeRH['recType'] == 0xF004) {
3✔
2240
                    $sprmCPicLocation += $shapeRH['recLen'];
3✔
2241
                }
2242
                // picture : rgfb
2243
                //@see  http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx
2244
                $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
3✔
2245
                while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) {
3✔
2246
                    $sprmCPicLocation += 8;
3✔
2247
                    switch ($fileBlockRH['recType']) {
3✔
2248
                        // OfficeArtFBSE
2249
                        //@see  http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx
2250
                        case 0xF007:
3✔
2251
                            // btWin32
2252
                            ++$sprmCPicLocation;
3✔
2253
                            // btMacOS
2254
                            ++$sprmCPicLocation;
3✔
2255
                            // rgbUid
2256
                            $sprmCPicLocation += 16;
3✔
2257
                            // tag
2258
                            $sprmCPicLocation += 2;
3✔
2259
                            // size
2260
                            $sprmCPicLocation += 4;
3✔
2261
                            // cRef
2262
                            $sprmCPicLocation += 4;
3✔
2263
                            // foDelay
2264
                            $sprmCPicLocation += 4;
3✔
2265
                            // unused1
2266
                            ++$sprmCPicLocation;
3✔
2267
                            // cbName
2268
                            $cbName = self::getInt1d($this->dataData, $sprmCPicLocation);
3✔
2269
                            ++$sprmCPicLocation;
3✔
2270
                            // unused2
2271
                            ++$sprmCPicLocation;
3✔
2272
                            // unused3
2273
                            ++$sprmCPicLocation;
3✔
2274
                            // nameData
2275
                            if ($cbName > 0) {
3✔
2276
                                //$nameData = '';
2277
                                for ($inc = 0; $inc <= ($cbName / 2); ++$inc) {
×
2278
                                    //$chr = self::getInt2d($this->dataData, $sprmCPicLocation);
2279
                                    $sprmCPicLocation += 2;
×
2280
                                    //$nameData .= chr($chr);
2281
                                }
2282
                            }
2283
                            // embeddedBlip
2284
                            //@see  http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx
2285
                            $embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
3✔
2286
                            switch ($embeddedBlipRH['recType']) {
3✔
2287
                                case self::OFFICEARTBLIPJPG:
2288
                                case self::OFFICEARTBLIPJPEG:
2289
                                    if (!isset($oStylePrl->image)) {
2✔
2290
                                        $oStylePrl->image = [];
2✔
2291
                                    }
2292
                                    $sprmCPicLocation += 8;
2✔
2293
                                    // embeddedBlip : rgbUid1
2294
                                    $sprmCPicLocation += 16;
2✔
2295
                                    if ($embeddedBlipRH['recInstance'] == 0x6E1) {
2✔
2296
                                        // rgbUid2
2297
                                        $sprmCPicLocation += 16;
×
2298
                                    }
2299
                                    // embeddedBlip : tag
2300
                                    ++$sprmCPicLocation;
2✔
2301
                                    // embeddedBlip : BLIPFileData
2302
                                    $oStylePrl->image['data'] = substr($this->dataData, $sprmCPicLocation, $embeddedBlipRH['recLen']);
2✔
2303
                                    $oStylePrl->image['format'] = 'jpg';
2✔
2304
                                    // Image Size
2305
                                    $iCropWidth = $picmidDxaGoal - ($picmidDxaCropLeft + $picmidDxaCropRight);
2✔
2306
                                    $iCropHeight = $picmidDyaGoal - ($picmidDxaCropTop + $picmidDxaCropBottom);
2✔
2307
                                    if (!$iCropWidth) {
2✔
2308
                                        $iCropWidth = 1;
×
2309
                                    }
2310
                                    if (!$iCropHeight) {
2✔
2311
                                        $iCropHeight = 1;
×
2312
                                    }
2313
                                    $oStylePrl->image['width'] = Drawing::twipsToPixels($iCropWidth * $picmidMx / 1000);
2✔
2314
                                    $oStylePrl->image['height'] = Drawing::twipsToPixels($iCropHeight * $picmidMy / 1000);
2✔
2315

2316
                                    $sprmCPicLocation += $embeddedBlipRH['recLen'];
2✔
2317

2318
                                    break;
2✔
2319
                                case self::OFFICEARTBLIPPNG:
2320
                                    break;
1✔
2321
                                default:
2322
                                    // print_r(dechex($embeddedBlipRH['recType']));
2323
                            }
2324

2325
                            break;
3✔
2326
                    }
2327
                    $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
3✔
2328
                }
2329
            }
2330
        }
2331

2332
        $oStylePrl->length = $pos - $posStart;
6✔
2333

2334
        return $oStylePrl;
6✔
2335
    }
2336

2337
    /**
2338
     * Read a record header.
2339
     *
2340
     * @param string $stream
2341
     * @param int $pos
2342
     *
2343
     * @return array
2344
     */
2345
    private function loadRecordHeader($stream, $pos)
3✔
2346
    {
2347
        $rec = self::getInt2d($stream, $pos);
3✔
2348
        $recType = self::getInt2d($stream, $pos + 2);
3✔
2349
        $recLen = self::getInt4d($stream, $pos + 4);
3✔
2350

2351
        return [
3✔
2352
            'recVer' => ($rec >> 0) & bindec('1111'),
3✔
2353
            'recInstance' => ($rec >> 4) & bindec('111111111111'),
3✔
2354
            'recType' => $recType,
3✔
2355
            'recLen' => $recLen,
3✔
2356
        ];
3✔
2357
    }
2358

2359
    private function generatePhpWord(): void
6✔
2360
    {
2361
        foreach ($this->arraySections as $itmSection) {
6✔
2362
            $oSection = $this->phpWord->addSection();
6✔
2363
            $oSection->setStyle($itmSection->styleSection);
6✔
2364

2365
            $sHYPERLINK = '';
6✔
2366
            foreach ($this->arrayParagraphs as $itmParagraph) {
6✔
2367
                $textPara = $itmParagraph;
6✔
2368
                foreach ($this->arrayCharacters as $oCharacters) {
6✔
2369
                    $subText = mb_substr($textPara, $oCharacters->pos_start, $oCharacters->pos_len);
6✔
2370
                    $subText = str_replace(chr(13), PHP_EOL, $subText);
6✔
2371
                    $arrayText = explode(PHP_EOL, $subText);
6✔
2372
                    if (end($arrayText) == '') {
6✔
2373
                        array_pop($arrayText);
6✔
2374
                    }
2375
                    if (reset($arrayText) == '') {
6✔
2376
                        array_shift($arrayText);
5✔
2377
                    }
2378

2379
                    // Style Character
2380
                    $styleFont = [];
6✔
2381
                    if (isset($oCharacters->style)) {
6✔
2382
                        if (isset($oCharacters->style->styleFont)) {
5✔
2383
                            $styleFont = $oCharacters->style->styleFont;
5✔
2384
                        }
2385
                    }
2386

2387
                    foreach ($arrayText as $sText) {
6✔
2388
                        // HyperLink
2389
                        if (empty($sText) && !empty($sHYPERLINK)) {
6✔
2390
                            $arrHYPERLINK = explode('"', $sHYPERLINK);
×
2391
                            $oSection->addLink($arrHYPERLINK[1], null);
×
2392
                            // print_r('>addHyperLink<'.$sHYPERLINK.'>'.ord($sHYPERLINK[0]).EOL);
2393
                            $sHYPERLINK = '';
×
2394
                        }
2395

2396
                        // TextBreak
2397
                        if (empty($sText)) {
6✔
2398
                            $oSection->addTextBreak();
4✔
2399
                            $sHYPERLINK = '';
4✔
2400
                            // print_r('>addTextBreak<' . EOL);
2401
                        }
2402

2403
                        if (!empty($sText)) {
6✔
2404
                            if (!empty($sHYPERLINK) && ord($sText[0]) > 20) {
6✔
2405
                                $sHYPERLINK .= $sText;
×
2406
                            }
2407
                            if (empty($sHYPERLINK)) {
6✔
2408
                                if (ord($sText[0]) > 20) {
6✔
2409
                                    if (strpos(trim($sText), 'HYPERLINK "') === 0) {
6✔
2410
                                        $sHYPERLINK = $sText;
×
2411
                                    } else {
2412
                                        $oSection->addText($sText, $styleFont);
6✔
2413
                                        // print_r('>addText<'.$sText.'>'.ord($sText[0]).EOL);
2414
                                    }
2415
                                }
2416
                                if (ord($sText[0]) == 1) {
6✔
2417
                                    if (isset($oCharacters->style->image)) {
1✔
2418
                                        $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc') . '.' . $oCharacters->style->image['format'];
×
2419
                                        file_put_contents($fileImage, $oCharacters->style->image['data']);
×
2420
                                        $oSection->addImage($fileImage, ['width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height']]);
×
2421
                                        // print_r('>addImage<'.$fileImage.'>'.EOL);
2422
                                    }
2423
                                }
2424
                            }
2425
                        }
2426
                    }
2427
                }
2428
            }
2429
        }
2430
    }
2431

2432
    /**
2433
     * Read 8-bit unsigned integer.
2434
     *
2435
     * @param string $data
2436
     * @param int $pos
2437
     *
2438
     * @return int
2439
     */
2440
    public static function getInt1d($data, $pos)
6✔
2441
    {
2442
        return ord($data[$pos]);
6✔
2443
    }
2444

2445
    /**
2446
     * Read 16-bit unsigned integer.
2447
     *
2448
     * @param string $data
2449
     * @param int $pos
2450
     *
2451
     * @return int
2452
     */
2453
    public static function getInt2d($data, $pos)
6✔
2454
    {
2455
        return ord($data[$pos]) | (ord($data[$pos + 1]) << 8);
6✔
2456
    }
2457

2458
    /**
2459
     * Read 24-bit signed integer.
2460
     *
2461
     * @param string $data
2462
     * @param int $pos
2463
     *
2464
     * @return int
2465
     */
2466
    public static function getInt3d($data, $pos)
3✔
2467
    {
2468
        return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16);
3✔
2469
    }
2470

2471
    /**
2472
     * Read 32-bit signed integer.
2473
     *
2474
     * @param string $data
2475
     * @param int $pos
2476
     *
2477
     * @return int
2478
     */
2479
    public static function getInt4d($data, $pos)
6✔
2480
    {
2481
        // FIX: represent numbers correctly on 64-bit system
2482
        // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
2483
        // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
2484
        $or24 = ord($data[$pos + 3]);
6✔
2485
        if ($or24 >= 128) {
6✔
2486
            // negative number
2487
            $ord24 = -abs((256 - $or24) << 24);
3✔
2488
        } else {
2489
            $ord24 = ($or24 & 127) << 24;
6✔
2490
        }
2491

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

© 2026 Coveralls, Inc