public function PHPExcel_Shared_OLE_PPS_Root::_saveBbd in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php \PHPExcel_Shared_OLE_PPS_Root::_saveBbd()
* Saving Big Block Depot * * @access public *
Parameters
integer $iSbdSize: * @param integer $iBsize * @param integer $iPpsCnt
1 call to PHPExcel_Shared_OLE_PPS_Root::_saveBbd()
- PHPExcel_Shared_OLE_PPS_Root::save in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ OLE/ PPS/ Root.php - * Method for saving the whole OLE container (including files). * In fact, if called with an empty argument (or '-'), it saves to a * temporary file and then outputs it's contents to stdout. * If a resource pointer to a stream created…
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ OLE/ PPS/ Root.php, line 387
Class
- PHPExcel_Shared_OLE_PPS_Root
- Class for creating Root PPS's for OLE containers
Code
public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) {
$FILE = $this->_FILEH_;
// Calculate Basic Setting
$iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4c) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
$iBdExL = 0;
$iAll = $iBsize + $iPpsCnt + $iSbdSize;
$iAllW = $iAll;
$iBdCntW = floor($iAllW / $iBbCnt) + ($iAllW % $iBbCnt ? 1 : 0);
$iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + (($iAllW + $iBdCntW) % $iBbCnt ? 1 : 0);
// Calculate BD count
if ($iBdCnt > $i1stBdL) {
while (1) {
++$iBdExL;
++$iAllW;
$iBdCntW = floor($iAllW / $iBbCnt) + ($iAllW % $iBbCnt ? 1 : 0);
$iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + (($iAllW + $iBdCntW) % $iBbCnt ? 1 : 0);
if ($iBdCnt <= $iBdExL * $iBbCnt + $i1stBdL) {
break;
}
}
}
// Making BD
// Set for SBD
if ($iSbdSize > 0) {
for ($i = 0; $i < $iSbdSize - 1; ++$i) {
fwrite($FILE, pack("V", $i + 1));
}
fwrite($FILE, pack("V", -2));
}
// Set for B
for ($i = 0; $i < $iBsize - 1; ++$i) {
fwrite($FILE, pack("V", $i + $iSbdSize + 1));
}
fwrite($FILE, pack("V", -2));
// Set for PPS
for ($i = 0; $i < $iPpsCnt - 1; ++$i) {
fwrite($FILE, pack("V", $i + $iSbdSize + $iBsize + 1));
}
fwrite($FILE, pack("V", -2));
// Set for BBD itself ( 0xFFFFFFFD : BBD)
for ($i = 0; $i < $iBdCnt; ++$i) {
fwrite($FILE, pack("V", 0xfffffffd));
}
// Set for ExtraBDList
for ($i = 0; $i < $iBdExL; ++$i) {
fwrite($FILE, pack("V", 0xfffffffc));
}
// Adjust for Block
if (($iAllW + $iBdCnt) % $iBbCnt) {
$iBlock = $iBbCnt - ($iAllW + $iBdCnt) % $iBbCnt;
for ($i = 0; $i < $iBlock; ++$i) {
fwrite($FILE, pack("V", -1));
}
}
// Extra BDList
if ($iBdCnt > $i1stBdL) {
$iN = 0;
$iNb = 0;
for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) {
if ($iN >= $iBbCnt - 1) {
$iN = 0;
++$iNb;
fwrite($FILE, pack("V", $iAll + $iBdCnt + $iNb));
}
fwrite($FILE, pack("V", $iBsize + $iSbdSize + $iPpsCnt + $i));
}
if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) {
$iB = $iBbCnt - 1 - ($iBdCnt - $i1stBdL) % ($iBbCnt - 1);
for ($i = 0; $i < $iB; ++$i) {
fwrite($FILE, pack("V", -1));
}
}
fwrite($FILE, pack("V", -2));
}
}