You are here

public function PHPExcel_Shared_OLE_PPS_Root::_calcSize in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php \PHPExcel_Shared_OLE_PPS_Root::_calcSize()

* Calculate some numbers * * @access public *

Parameters

array $raList Reference to an array of PPS's: * @return array The array of numbers

1 call to PHPExcel_Shared_OLE_PPS_Root::_calcSize()
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 127

Class

PHPExcel_Shared_OLE_PPS_Root
Class for creating Root PPS's for OLE containers

Code

public function _calcSize(&$raList) {

  // Calculate Basic Setting
  list($iSBDcnt, $iBBcnt, $iPPScnt) = array(
    0,
    0,
    0,
  );
  $iSmallLen = 0;
  $iSBcnt = 0;
  $iCount = count($raList);
  for ($i = 0; $i < $iCount; ++$i) {
    if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
      $raList[$i]->Size = $raList[$i]
        ->_DataLen();
      if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
        $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE ? 1 : 0);
      }
      else {
        $iBBcnt += floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE ? 1 : 0);
      }
    }
  }
  $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
  $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
  $iSBDcnt = floor($iSBcnt / $iSlCnt) + ($iSBcnt % $iSlCnt ? 1 : 0);
  $iBBcnt += floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + ($iSmallLen % $this->_BIG_BLOCK_SIZE ? 1 : 0);
  $iCnt = count($raList);
  $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
  $iPPScnt = floor($iCnt / $iBdCnt) + ($iCnt % $iBdCnt ? 1 : 0);
  return array(
    $iSBDcnt,
    $iBBcnt,
    $iPPScnt,
  );
}