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

PHPOffice / PHPWord / 13025401639

29 Jan 2025 05:48AM UTC coverage: 96.825% (-0.4%) from 97.217%
13025401639

Pull #2562

github

web-flow
Merge ebe3e5dac into 2d2759585
Pull Request #2562: TemplateProcessor SetComplexBlock/Value and Sections

6 of 7 new or added lines in 1 file covered. (85.71%)

245 existing lines in 40 files now uncovered.

12227 of 12628 relevant lines covered (96.82%)

34.56 hits per line

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

90.07
/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
    private $dataWorkDocument;
45

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

178
        return $arrayCP;
5✔
179
    }
180

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

368
        return $pos;
5✔
369
    }
370

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

1116
        return $pos;
5✔
1117
    }
1118

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1261
            $string = '';
5✔
1262

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1527
        return $oSprm;
5✔
1528
    }
1529

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

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

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

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

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

UNCOV
1562
                        break;
×
1563
                }
1564

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

UNCOV
1675
                                    break;
×
1676
                            }
1677

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

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

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

UNCOV
1699
                                    break;
×
1700
                            }
1701

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

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

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

UNCOV
1719
                                    break;
×
1720
                            }
1721

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

UNCOV
1801
                                    break;
×
1802
                            }
1803

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

UNCOV
1899
                                    break;
×
1900
                            }
1901

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2302
        return $oStylePrl;
5✔
2303
    }
2304

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

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

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

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

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

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

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

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

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

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

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

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

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

© 2026 Coveralls, Inc