60 switch (get_class($this->
object)) {
61 case \PhpOffice\PhpSpreadsheet\Shared\Escher::class:
62 if ($dggContainer = $this->object->getDggContainer()) {
63 $writer =
new self($dggContainer);
64 $this->
data = $writer->close();
65 } elseif ($dgContainer = $this->object->getDgContainer()) {
66 $writer =
new self($dgContainer);
67 $this->
data = $writer->close();
68 $this->spOffsets = $writer->getSpOffsets();
69 $this->spTypes = $writer->getSpTypes();
73 case DggContainer::class:
81 $recInstance = 0x0000;
84 $recVerInstance = $recVer;
85 $recVerInstance |= $recInstance << 4;
91 $this->object->getSpIdMax(),
92 $this->
object->getCDgSaved() + 1,
93 $this->
object->getCSpSaved(),
94 $this->
object->getCDgSaved()
98 $IDCLs = $this->
object->getIDCLs();
100 foreach ($IDCLs as $dgId => $maxReducedSpId) {
101 $dggData .= pack(
'VV', $dgId, $maxReducedSpId + 1);
104 $header = pack(
'vvV', $recVerInstance, $recType, strlen($dggData));
105 $innerData .=
$header . $dggData;
108 if ($bstoreContainer = $this->object->getBstoreContainer()) {
109 $writer =
new self($bstoreContainer);
110 $innerData .= $writer->close();
115 $recInstance = 0x0000;
117 $length = strlen($innerData);
119 $recVerInstance = $recVer;
120 $recVerInstance |= $recInstance << 4;
122 $header = pack(
'vvV', $recVerInstance, $recType, $length);
127 case BstoreContainer::class:
134 if ($BSECollection = $this->object->getBSECollection()) {
135 foreach ($BSECollection as $BSE) {
136 $writer =
new self($BSE);
137 $innerData .= $writer->close();
143 $recInstance = count($this->object->getBSECollection());
145 $length = strlen($innerData);
147 $recVerInstance = $recVer;
148 $recVerInstance |= $recInstance << 4;
150 $header = pack(
'vvV', $recVerInstance, $recType, $length);
162 if ($blip = $this->object->getBlip()) {
163 $writer =
new self($blip);
164 $innerData .= $writer->close();
170 $btWin32 = $this->
object->getBlipType();
171 $btMacOS = $this->
object->getBlipType();
172 $data .= pack(
'CC', $btWin32, $btMacOS);
174 $rgbUid = pack(
'VVVV', 0, 0, 0, 0);
178 $size = strlen($innerData);
185 $data .= pack(
'vVVVCCCC',
$tag,
$size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
191 $recInstance = $this->
object->getBlipType();
193 $length = strlen(
$data);
195 $recVerInstance = $recVer;
196 $recVerInstance |= $recInstance << 4;
198 $header = pack(
'vvV', $recVerInstance, $recType, $length);
209 switch ($this->object->getParent()->getBlipType()) {
214 $rgbUid1 = pack(
'VVVV', 0, 0, 0, 0);
215 $innerData .= $rgbUid1;
218 $innerData .= pack(
'C',
$tag);
220 $innerData .= $this->
object->getData();
223 $recInstance = 0x46A;
225 $length = strlen($innerData);
227 $recVerInstance = $recVer;
228 $recVerInstance |= $recInstance << 4;
230 $header = pack(
'vvV', $recVerInstance, $recType, $length);
234 $this->
data .= $innerData;
241 $rgbUid1 = pack(
'VVVV', 0, 0, 0, 0);
242 $innerData .= $rgbUid1;
245 $innerData .= pack(
'C',
$tag);
247 $innerData .= $this->
object->getData();
250 $recInstance = 0x6E0;
252 $length = strlen($innerData);
254 $recVerInstance = $recVer;
255 $recVerInstance |= $recInstance << 4;
257 $header = pack(
'vvV', $recVerInstance, $recType, $length);
261 $this->
data .= $innerData;
267 case DgContainer::class:
275 $recInstance = $this->
object->getDgId();
279 $recVerInstance = $recVer;
280 $recVerInstance |= $recInstance << 4;
282 $header = pack(
'vvV', $recVerInstance, $recType, $length);
285 $countShapes = count($this->object->getSpgrContainer()->getChildren());
286 $innerData .=
$header . pack(
'VV', $countShapes, $this->object->getLastSpId());
289 if ($spgrContainer = $this->object->getSpgrContainer()) {
290 $writer =
new self($spgrContainer);
291 $innerData .= $writer->close();
308 $recInstance = 0x0000;
310 $length = strlen($innerData);
312 $recVerInstance = $recVer;
313 $recVerInstance |= $recInstance << 4;
315 $header = pack(
'vvV', $recVerInstance, $recType, $length);
320 case SpgrContainer::class:
332 foreach ($this->object->getChildren() as $spContainer) {
333 $writer =
new self($spContainer);
334 $spData = $writer->close();
335 $innerData .= $spData;
338 $totalSize += strlen($spData);
346 $recInstance = 0x0000;
348 $length = strlen($innerData);
350 $recVerInstance = $recVer;
351 $recVerInstance |= $recInstance << 4;
353 $header = pack(
'vvV', $recVerInstance, $recType, $length);
360 case SpContainer::class:
367 if ($this->object->getSpgr()) {
369 $recInstance = 0x0000;
371 $length = 0x00000010;
373 $recVerInstance = $recVer;
374 $recVerInstance |= $recInstance << 4;
376 $header = pack(
'vvV', $recVerInstance, $recType, $length);
380 $this->spTypes[] = ($this->
object->getSpType());
384 $recInstance = $this->
object->getSpType();
386 $length = 0x00000008;
388 $recVerInstance = $recVer;
389 $recVerInstance |= $recInstance << 4;
391 $header = pack(
'vvV', $recVerInstance, $recType, $length);
393 $data .=
$header . pack(
'VV', $this->object->getSpId(), $this->
object->getSpgr() ? 0x0005 : 0x0A00);
396 if ($this->object->getOPTCollection()) {
400 $recInstance = count($this->object->getOPTCollection());
402 foreach ($this->object->getOPTCollection() as $property => $value) {
403 $optData .= pack(
'vV', $property, $value);
405 $length = strlen($optData);
407 $recVerInstance = $recVer;
408 $recVerInstance |= $recInstance << 4;
410 $header = pack(
'vvV', $recVerInstance, $recType, $length);
415 if ($this->object->getStartCoordinates()) {
416 $clientAnchorData =
'';
428 $startOffsetX = $this->
object->getStartOffsetX();
431 $startOffsetY = $this->
object->getStartOffsetY();
439 $endOffsetX = $this->
object->getEndOffsetX();
442 $endOffsetY = $this->
object->getEndOffsetY();
444 $clientAnchorData = pack(
'vvvvvvvvv', $this->object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
446 $length = strlen($clientAnchorData);
448 $recVerInstance = $recVer;
449 $recVerInstance |= $recInstance << 4;
451 $header = pack(
'vvV', $recVerInstance, $recType, $length);
456 if (!$this->object->getSpgr()) {
457 $clientDataData =
'';
463 $length = strlen($clientDataData);
465 $recVerInstance = $recVer;
466 $recVerInstance |= $recInstance << 4;
468 $header = pack(
'vvV', $recVerInstance, $recType, $length);
474 $recInstance = 0x0000;
476 $length = strlen(
$data);
478 $recVerInstance = $recVer;
479 $recVerInstance |= $recInstance << 4;
481 $header = pack(
'vvV', $recVerInstance, $recType, $length);
$object
The object we are writing.
getSpOffsets()
Gets the shape offsets.
getSpTypes()
Gets the shape types.
close()
Process the object to be written.
static indexesFromString(string $coordinates)
Get indexes from a string coordinates.
__construct($object)
Constructor.
$data
The written binary data.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag