parent = $parent; } /** * Return the parent worksheet for this cell collection * * @return PHPExcel_Worksheet */ public function getParent() { return $this->parent; } /** * Identify whether the caching method is currently available * Some methods are dependent on the availability of certain extensions being enabled in the PHP build * * @return boolean */ public static function cacheMethodIsAvailable() { return true; } /** * Add or Update a cell in cache * * @param PHPExcel_Cell $cell Cell to update * @return PHPExcel_Cell * @throws PHPExcel_Exception */ public function updateCacheData(Cell $cell) { return $this->addCacheData($cell->getCoordinate(), $cell); } /** * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->currentObjectID && !is_null($this->currentObject)) { $this->currentObject->detach(); $this->currentObjectID = $this->currentObject = null; } if (is_object($this->cellCache[$pCoord])) { $this->cellCache[$pCoord]->detach(); unset($this->cellCache[$pCoord]); } $this->currentCellIsDirty = false; } /** * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check * @return boolean */ public function isDataSet($pCoord) { if ($pCoord === $this->currentObjectID) { return true; } // Check if the requested entry exists in the cache return isset($this->cellCache[$pCoord]); } /** * Clone the cell collection * * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(Worksheet $parent) { $this->currentCellIsDirty; $this->storeData(); $this->parent = $parent; if (($this->currentObject !== null) && (is_object($this->currentObject))) { $this->currentObject->attach($this); } } /** * Sort the list of all cell addresses currently held in cache by row and column * * @return string[] */ public function getSortedCellList() { $sortKeys = array(); foreach ($this->getCellList() as $coord) { sscanf($coord, '%[A-Z]%d', $column, $row); $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord; } ksort($sortKeys); return array_values($sortKeys); } /** * Get a list of all cell addresses currently held in cache * * @return string[] */ public function getCellList() { return array_keys($this->cellCache); } /** * Return the cell address of the currently active cell object * * @return string */ public function getCurrentAddress() { return $this->currentObjectID; } }