Process the object to be written.
{
$this->_data = '';
switch (get_class($this->_object)) {
case 'PHPExcel_Shared_Escher':
if ($dggContainer = $this->_object->getDggContainer()) {
$this->_data = $writer->close();
} else if ($dgContainer = $this->_object->getDgContainer()) {
$this->_data = $writer->close();
$this->_spOffsets = $writer->getSpOffsets();
}
break;
case 'PHPExcel_Shared_Escher_DggContainer':
$innerData = '';
$recVer = 0x0;
$recInstance = 0x0000;
$recType = 0xF006;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$dggData =
pack('VVVV'
, $this->_object->getSpIdMax()
, $this->_object->getCDgSaved() + 1
, $this->_object->getCSpSaved()
, $this->_object->getCDgSaved()
);
for ($i = 0; $i < $this->_object->getCDgSaved(); ++$i) {
$dggData .= pack('VV', 0, 0);
}
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
$innerData .= $header . $dggData;
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
$innerData .= $writer->close();
}
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF000;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
$innerData = '';
if ($BSECollection = $this->_object->getBSECollection()) {
foreach ($BSECollection as $BSE) {
$innerData .= $writer->close();
}
}
$recVer = 0xF;
$recInstance = count($this->_object->getBSECollection());
$recType = 0xF001;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
$innerData = '';
if ($blip = $this->_object->getBlip()) {
$innerData .= $writer->close();
}
$btWin32 = $this->_object->getBlipType();
$btMacOS = $this->_object->getBlipType();
$data .= pack(
'CC', $btWin32, $btMacOS);
$rgbUid = pack('VVVV', 0,0,0,0);
$tag = 0;
$size = strlen($innerData);
$cRef = 1;
$foDelay = 0;
$unused1 = 0x0;
$cbName = 0x0;
$unused2 = 0x0;
$unused3 = 0x0;
$data .= pack(
'vVVVCCCC', $tag,
$size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
$recVer = 0x2;
$recInstance = $this->_object->getBlipType();
$recType = 0xF007;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
switch ($this->_object->getParent()->getBlipType()) {
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0);
$innerData .= $rgbUid1;
$tag = 0xFF;
$innerData .= pack('C', $tag);
$innerData .= $this->_object->getData();
$recVer = 0x0;
$recInstance = 0x46A;
$recType = 0xF01D;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
$this->_data .= $innerData;
break;
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0);
$innerData .= $rgbUid1;
$tag = 0xFF;
$innerData .= pack('C', $tag);
$innerData .= $this->_object->getData();
$recVer = 0x0;
$recInstance = 0x6E0;
$recType = 0xF01E;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
$this->_data .= $innerData;
break;
}
break;
case 'PHPExcel_Shared_Escher_DgContainer':
$innerData = '';
$recVer = 0x0;
$recInstance = $this->_object->getDgId();
$recType = 0xF008;
$length = 8;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
if ($spgrContainer = $this->_object->getSpgrContainer()) {
$innerData .= $writer->close();
$spOffsets = $writer->getSpOffsets();
foreach ($spOffsets as & $spOffset) {
$spOffset += 24;
}
$this->_spOffsets = $spOffsets;
}
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF002;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
$innerData = '';
$totalSize = 8;
$spOffsets = array();
foreach ($this->_object->getChildren() as $spContainer) {
$spData = $writer->close();
$innerData .= $spData;
$totalSize += strlen($spData);
$spOffsets[] = $totalSize;
}
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF003;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
$this->_spOffsets = $spOffsets;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
if ($this->_object->getSpgr()) {
$recVer = 0x1;
$recInstance = 0x0000;
$recType = 0xF009;
$length = 0x00000010;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . pack(
'VVVV', 0,0,0,0);
}
$recVer = 0x2;
$recInstance = $this->_object->getSpType();
$recType = 0xF00A;
$length = 0x00000008;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . pack(
'VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0xA000);
if ($this->_object->getOPTCollection()) {
$optData = '';
$recVer = 0x3;
$recInstance = count($this->_object->getOPTCollection());
$recType = 0xF00B;
foreach ($this->_object->getOPTCollection() as $property => $value) {
$optData .= pack('vV', $property, $value);
}
$length = strlen($optData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $optData;
}
if ($this->_object->getStartCoordinates()) {
$clientAnchorData = '';
$recVer = 0x0;
$recInstance = 0x0;
$recType = 0xF010;
$startOffsetX = $this->_object->getStartOffsetX();
$startOffsetY = $this->_object->getStartOffsetY();
$endOffsetX = $this->_object->getEndOffsetX();
$endOffsetY = $this->_object->getEndOffsetY();
$clientAnchorData = pack('vvvvvvvvv', 0x00,
$c1, $startOffsetX, $r1, $startOffsetY,
$c2, $endOffsetX, $r2, $endOffsetY);
$length = strlen($clientAnchorData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $clientAnchorData;
}
if (!$this->_object->getSpgr()) {
$clientDataData = '';
$recVer = 0x0;
$recInstance = 0x0;
$recType = 0xF011;
$length = strlen($clientDataData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $clientDataData;
}
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF004;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header .
$data;
break;
}
}