diff --git a/Classes/Autoloader.php b/Classes/Autoloader.php new file mode 100644 index 0000000..9d57c3f --- /dev/null +++ b/Classes/Autoloader.php @@ -0,0 +1,156 @@ +_namespace = $namespace; + $this->_includePath = $includePath; + } + + /** + * Sets the namespace separator used by classes in the namespace of this class loader. + * + * @param string $sep The separator to use. + */ + public function setNamespaceSeparator($sep) + { + $this->_namespaceSeparator = $sep; + } + + /** + * Gets the namespace seperator used by classes in the namespace of this class loader. + * + * @return void + */ + public function getNamespaceSeparator() + { + return $this->_namespaceSeparator; + } + + /** + * Sets the base include path for all class files in the namespace of this class loader. + * + * @param string $includePath + */ + public function setIncludePath($includePath) + { + $this->_includePath = $includePath; + } + + /** + * Gets the base include path for all class files in the namespace of this class loader. + * + * @return string $includePath + */ + public function getIncludePath() + { + return $this->_includePath; + } + + /** + * Sets the file extension of class files in the namespace of this class loader. + * + * @param string $fileExtension + */ + public function setFileExtension($fileExtension) + { + $this->_fileExtension = $fileExtension; + } + + /** + * Gets the file extension of class files in the namespace of this class loader. + * + * @return string $fileExtension + */ + public function getFileExtension() + { + return $this->_fileExtension; + } + + /** + * Installs this class loader on the SPL autoload stack. + */ + public function register() + { + spl_autoload_register(array($this, 'loadClass')); + } + + /** + * Uninstalls this class loader from the SPL autoloader stack. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $className The name of the class to load. + * @return void + */ + public function loadClass($className) + { +echo 'Load Class ', $className, PHP_EOL; + if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) { + $fileName = ''; + $namespace = ''; + if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + } + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; + + require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; + } + } + +} diff --git a/Classes/Bootstrap.php b/Classes/Bootstrap.php new file mode 100644 index 0000000..76942e8 --- /dev/null +++ b/Classes/Bootstrap.php @@ -0,0 +1,48 @@ +register(); + +// As we always try to run the autoloader before anything else, we can use it to do a few +// simple checks and initialisations +// check mbstring.func_overload +if (ini_get('mbstring.func_overload') & 2) { + throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); +} +Shared_String::buildCharacterSets(); + + diff --git a/Classes/PHPExcel/Autoloader.php b/Classes/PHPExcel/Autoloader.php deleted file mode 100644 index 3878a09..0000000 --- a/Classes/PHPExcel/Autoloader.php +++ /dev/null @@ -1,85 +0,0 @@ -_currentCellIsDirty) { @@ -66,7 +68,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); + throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); } $this->_currentCellIsDirty = false; } @@ -79,11 +81,11 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach * * @access public * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -98,7 +100,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * Is a value set in the current PHPExcel\CachedObjectStorage_ICache for an indexed cell? * * @access public * @param string $pCoord Coordinate address of the cell to check @@ -116,7 +118,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach if ($success === FALSE) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); } return true; } @@ -129,8 +131,8 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach * * @access public * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -144,7 +146,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach if ($obj === FALSE) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); } } else { // Return null if requested entry doesn't exist in cache @@ -181,7 +183,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach * * @access public * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { // Delete the entry from APC @@ -196,11 +198,11 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach * Clone the cell collection * * @access public - * @param PHPExcel_Worksheet $parent The new worksheet - * @throws PHPExcel_Exception + * @param PHPExcel\Worksheet $parent The new worksheet + * @throws PHPExcel\Exception * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->_getUniqueID(); @@ -212,11 +214,11 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach if ($obj === FALSE) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($cellID); - throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC'); + throw new Exception('Cell entry '.$cellID.' no longer exists in APC'); } if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC'); + throw new Exception('Failed to store cell '.$cellID.' in APC'); } } } @@ -248,10 +250,10 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { + public function __construct(Worksheet $parent, $arguments) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; if ($this->_cachePrefix === NULL) { diff --git a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php index b04f44a..9d9a10b 100644 --- a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php +++ b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php @@ -19,33 +19,35 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_CacheBase + * PHPExcel\CachedObjectStorage_CacheBase * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_CachedObjectStorage_CacheBase { +abstract class CachedObjectStorage_CacheBase { /** * Parent worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ protected $_parent; /** * The currently active Cell * - * @var PHPExcel_Cell + * @var PHPExcel\Cell */ protected $_currentObject = null; @@ -76,11 +78,11 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection */ - public function __construct(PHPExcel_Worksheet $parent) { + public function __construct(Worksheet $parent) { // Set our parent worksheet. - // This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when + // This is maintained within the cache controller to facilitate re-attaching it to PHPExcel\Cell objects when // they are woken from a serialized state $this->_parent = $parent; } // function __construct() @@ -89,7 +91,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { /** * Return the parent worksheet for this cell collection * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getParent() { @@ -97,7 +99,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { } /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * 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 @@ -135,11 +137,11 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { /** * Add or Update a cell in cache * - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function updateCacheData(PHPExcel_Cell $cell) { + public function updateCacheData(Cell $cell) { return $this->addCacheData($cell->getCoordinate(),$cell); } // function updateCacheData() @@ -148,7 +150,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -291,10 +293,10 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { $this->_currentCellIsDirty; $this->_storeData(); diff --git a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php index 1a319d0..f9182cf 100644 --- a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php +++ b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_DiscISAM + * PHPExcel\CachedObjectStorage_DiscISAM * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_DiscISAM extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Name of the file for this cache @@ -62,7 +64,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -84,11 +86,11 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -105,8 +107,8 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -149,10 +151,10 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->_getUniqueID(); @@ -188,13 +190,13 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { + public function __construct(Worksheet $parent, $arguments) { $this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL)) ? $arguments['dir'] - : PHPExcel_Shared_File::sys_get_temp_dir(); + : Shared_File::sys_get_temp_dir(); parent::__construct($parent); if (is_null($this->_fileHandle)) { diff --git a/Classes/PHPExcel/CachedObjectStorage/ICache.php b/Classes/PHPExcel/CachedObjectStorage/ICache.php index 15d96d8..b909739 100644 --- a/Classes/PHPExcel/CachedObjectStorage/ICache.php +++ b/Classes/PHPExcel/CachedObjectStorage/ICache.php @@ -19,47 +19,49 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_ICache + * PHPExcel\CachedObjectStorage_ICache * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_CachedObjectStorage_ICache +interface CachedObjectStorage_ICache { /** * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell); + public function addCacheData($pCoord, Cell $cell); /** * Add or Update a cell in cache * - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function updateCacheData(PHPExcel_Cell $cell); + public function updateCacheData(Cell $cell); /** * Fetch a cell from cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to retrieve - * @return PHPExcel_Cell Cell that was found, or null if not found - * @throws PHPExcel_Exception + * @return PHPExcel\Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception */ public function getCacheData($pCoord); @@ -67,12 +69,12 @@ interface PHPExcel_CachedObjectStorage_ICache * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord); /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * 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 @@ -96,10 +98,10 @@ interface PHPExcel_CachedObjectStorage_ICache /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent); + public function copyCellCollection(Worksheet $parent); /** * Identify whether the caching method is currently available diff --git a/Classes/PHPExcel/CachedObjectStorage/Igbinary.php b/Classes/PHPExcel/CachedObjectStorage/Igbinary.php index 6af87b3..3866ec8 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Igbinary.php +++ b/Classes/PHPExcel/CachedObjectStorage/Igbinary.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_Igbinary + * PHPExcel\CachedObjectStorage_Igbinary * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_Igbinary extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -57,11 +59,11 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -78,8 +80,8 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/Memcache.php b/Classes/PHPExcel/CachedObjectStorage/Memcache.php index 2c33050..11f7779 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memcache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memcache.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_Memcache + * PHPExcel\CachedObjectStorage_Memcache * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_Memcache extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Prefix used to uniquely identify cache data for this worksheet @@ -62,7 +64,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -72,7 +74,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); + throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); } } $this->_currentCellIsDirty = false; @@ -85,11 +87,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -104,7 +106,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * 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 void @@ -121,7 +123,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } return true; } @@ -133,8 +135,8 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -148,7 +150,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -184,7 +186,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Memcache @@ -198,10 +200,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet + * @throws PHPExcel\Exception * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->_getUniqueID(); @@ -213,16 +216,16 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache'); + throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache'); } if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache'); + throw new Exception('Failed to store cell '.$cellID.' in MemCache'); } } } $this->_cachePrefix = $newCachePrefix; - } // function copyCellCollection() + } /** @@ -249,10 +252,10 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { + public function __construct(Worksheet $parent, $arguments) { $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost'; $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211; $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; @@ -264,13 +267,13 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage // Set a new Memcache object and connect to the Memcache server $this->_memcache = new Memcache(); if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { - throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); + throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); } $this->_cacheTime = $cacheTime; parent::__construct($parent); } - } // function __construct() + } /** @@ -278,10 +281,10 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * * @param string $host Memcache server * @param integer $port Memcache port - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function failureCallback($host, $port) { - throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed'); + throw new Exception('memcache '.$host.':'.$port.' failed'); } diff --git a/Classes/PHPExcel/CachedObjectStorage/Memory.php b/Classes/PHPExcel/CachedObjectStorage/Memory.php index dd01bc3..df5e0e3 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memory.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memory.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_Memory + * PHPExcel\CachedObjectStorage_Memory * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_Memory extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Dummy method callable from CacheBase, but unused by Memory cache @@ -47,11 +49,11 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update - * @return PHPExcel_Cell - * @throws PHPExcel_Exception + * @param PHPExcel\Cell $cell Cell to update + * @return PHPExcel\Cell + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { $this->_cellCache[$pCoord] = $cell; // Set current entry to the new/updated entry @@ -65,8 +67,8 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { // Check if the entry that has been requested actually exists @@ -87,10 +89,10 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); $newCollection = array(); diff --git a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php index f8a7791..501df5c 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_MemoryGZip + * PHPExcel\CachedObjectStorage_MemoryGZip * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_MemoryGZip extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -57,11 +59,11 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -78,8 +80,8 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php index 9825cab..d812de7 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_MemorySerialized + * PHPExcel\CachedObjectStorage_MemorySerialized * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_MemorySerialized extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -57,11 +59,11 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -78,8 +80,8 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php index 61fb416..be385bb 100644 --- a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php +++ b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -27,13 +27,13 @@ /** - * PHPExcel_CachedObjectStorage_PHPTemp + * PHPExcel\CachedObjectStorage_PHPTemp * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_PHPTemp extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Name of the file for this cache @@ -54,7 +54,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -76,11 +76,11 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -97,8 +97,8 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -141,10 +141,10 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); // Open a new stream for the cell cache data $newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+'); @@ -180,10 +180,10 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { + public function __construct(Worksheet $parent, $arguments) { $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; parent::__construct($parent); diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite.php b/Classes/PHPExcel/CachedObjectStorage/SQLite.php index 1b0221e..b9850b6 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_SQLite + * PHPExcel\CachedObjectStorage_SQLite * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_SQLite extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Database table name @@ -54,14 +56,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -72,11 +74,11 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -93,8 +95,8 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -105,7 +107,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return null; @@ -139,7 +141,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return false; @@ -152,7 +154,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -163,7 +165,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C // Check if the requested entry exists in the cache $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; if (!$this->_DBHandle->queryExec($query)) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } // function deleteCacheData() @@ -184,12 +186,12 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'"; $result = $this->_DBHandle->exec($query); if ($result === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); $query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; $result = $this->_DBHandle->exec($query); if ($result === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); return TRUE; } // function moveCell() @@ -208,7 +210,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); if ($cellIdsResult === false) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); $cellKeys = array(); foreach($cellIdsResult as $row) { @@ -222,10 +224,10 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { $this->_currentCellIsDirty; $this->_storeData(); @@ -233,7 +235,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -261,9 +263,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection */ - public function __construct(PHPExcel_Worksheet $parent) { + public function __construct(Worksheet $parent) { parent::__construct($parent); if (is_null($this->_DBHandle)) { $this->_TableName = str_replace('.','_',$this->_getUniqueID()); @@ -271,9 +273,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $this->_DBHandle = new SQLiteDatabase($_DBName); if ($this->_DBHandle === false) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); } } // function __construct() diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php index 7e69247..1c98b67 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_SQLite3 + * PHPExcel\CachedObjectStorage_SQLite3 * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_SQLite3 extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Database table name @@ -82,7 +84,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -92,7 +94,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); $result = $this->_insertQuery->execute(); if ($result === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -103,11 +105,11 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -124,8 +126,8 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -136,7 +138,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); $cellResult = $this->_selectQuery->execute(); if ($cellResult === FALSE) { - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); } $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); if ($cellData === FALSE) { @@ -171,7 +173,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); $cellResult = $this->_selectQuery->execute(); if ($cellResult === FALSE) { - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); } $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); @@ -183,7 +185,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -195,7 +197,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT); $result = $this->_deleteQuery->execute(); if ($result === FALSE) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); $this->_currentCellIsDirty = FALSE; } // function deleteCacheData() @@ -216,13 +218,13 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT); $result = $this->_deleteQuery->execute(); if ($result === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); $this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT); $this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT); $result = $this->_updateQuery->execute(); if ($result === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); return TRUE; } // function moveCell() @@ -241,7 +243,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->query($query); if ($cellIdsResult === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); $cellKeys = array(); while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { @@ -255,10 +257,10 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { $this->_currentCellIsDirty; $this->_storeData(); @@ -266,7 +268,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -294,9 +296,9 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection */ - public function __construct(PHPExcel_Worksheet $parent) { + public function __construct(Worksheet $parent) { parent::__construct($parent); if (is_null($this->_DBHandle)) { $this->_TableName = str_replace('.','_',$this->_getUniqueID()); @@ -304,9 +306,9 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_DBHandle = new SQLite3($_DBName); if ($this->_DBHandle === false) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + throw new Exception($this->_DBHandle->lastErrorMsg()); } $this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id"); diff --git a/Classes/PHPExcel/CachedObjectStorage/Wincache.php b/Classes/PHPExcel/CachedObjectStorage/Wincache.php index af31eb7..77cb455 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Wincache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Wincache.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorage_Wincache + * PHPExcel\CachedObjectStorage_Wincache * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { +class CachedObjectStorage_Wincache extends CachedObjectStorage_CacheBase implements CachedObjectStorage_ICache { /** * Prefix used to uniquely identify cache data for this worksheet @@ -55,7 +57,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ protected function _storeData() { if ($this->_currentCellIsDirty) { @@ -65,12 +67,12 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) { if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } else { if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } $this->_currentCellIsDirty = false; @@ -84,11 +86,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update + * @param PHPExcel\Cell $cell Cell to update * @return void - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { + public function addCacheData($pCoord, Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { $this->_storeData(); } @@ -103,7 +105,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * 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 @@ -119,7 +121,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in Wincache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } return true; } @@ -131,8 +133,8 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -148,7 +150,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -184,7 +186,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Wincache @@ -198,10 +200,10 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * - * @param PHPExcel_Worksheet $parent The new worksheet + * @param PHPExcel\Worksheet $parent The new worksheet * @return void */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { + public function copyCellCollection(Worksheet $parent) { parent::copyCellCollection($parent); // Get a new id for the new file name $baseUnique = $this->_getUniqueID(); @@ -214,11 +216,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); + throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache'); } if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); + throw new Exception('Failed to store cell '.$cellID.' in Wincache'); } } } @@ -250,10 +252,10 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { + public function __construct(Worksheet $parent, $arguments) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; if (is_null($this->_cachePrefix)) { diff --git a/Classes/PHPExcel/CachedObjectStorageFactory.php b/Classes/PHPExcel/CachedObjectStorageFactory.php index b5c4f7e..4ce2d78 100644 --- a/Classes/PHPExcel/CachedObjectStorageFactory.php +++ b/Classes/PHPExcel/CachedObjectStorageFactory.php @@ -20,21 +20,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage + * @package PHPExcel\CachedObjectStorage * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CachedObjectStorageFactory + * PHPExcel\CachedObjectStorageFactory * * @category PHPExcel - * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel\CachedObjectStorage + * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CachedObjectStorageFactory +class CachedObjectStorageFactory { const cache_in_memory = 'Memory'; const cache_in_memory_gzip = 'MemoryGZip'; @@ -139,7 +141,7 @@ class PHPExcel_CachedObjectStorageFactory /** * Return the current cache storage class * - * @return PHPExcel_CachedObjectStorage_ICache|NULL + * @return PHPExcel\CachedObjectStorage_ICache|NULL **/ public static function getCacheStorageClass() { @@ -167,7 +169,7 @@ class PHPExcel_CachedObjectStorageFactory { $activeMethods = array(); foreach(self::$_storageMethods as $storageMethod) { - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; + $cacheStorageClass = 'PHPExcel\CachedObjectStorage_' . $storageMethod; if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { $activeMethods[] = $storageMethod; } @@ -190,9 +192,10 @@ class PHPExcel_CachedObjectStorageFactory return FALSE; } - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; - if (!call_user_func(array( $cacheStorageClass, - 'cacheMethodIsAvailable'))) { + $cacheStorageClass = __NAMESPACE__ . '\CachedObjectStorage_'.$method; + if (!call_user_func( + array($cacheStorageClass, 'cacheMethodIsAvailable') + )) { return FALSE; } @@ -204,7 +207,7 @@ class PHPExcel_CachedObjectStorageFactory } if (self::$_cacheStorageMethod === NULL) { - self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; + self::$_cacheStorageClass = 'CachedObjectStorage_' . $method; self::$_cacheStorageMethod = $method; } return TRUE; @@ -214,20 +217,21 @@ class PHPExcel_CachedObjectStorageFactory /** * Initialise the cache storage * - * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet - * @return PHPExcel_CachedObjectStorage_ICache + * @param PHPExcel\Worksheet $parent Enable cell caching for this worksheet + * @return PHPExcel\CachedObjectStorage_ICache **/ - public static function getInstance(PHPExcel_Worksheet $parent) + public static function getInstance(Worksheet $parent) { $cacheMethodIsAvailable = TRUE; if (self::$_cacheStorageMethod === NULL) { $cacheMethodIsAvailable = self::initialize(); } + $cacheStorageClass = __NAMESPACE__ . '\\' . self::$_cacheStorageClass; if ($cacheMethodIsAvailable) { - $instance = new self::$_cacheStorageClass( $parent, - self::$_storageMethodParameters[self::$_cacheStorageMethod] - ); + $instance = new $cacheStorageClass( $parent, + self::$_storageMethodParameters[self::$_cacheStorageMethod] + ); if ($instance !== NULL) { return $instance; } diff --git a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php index 3759517..d720359 100644 --- a/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php +++ b/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CalcEngine_CyclicReferenceStack + * PHPExcel\CalcEngine_CyclicReferenceStack * - * @category PHPExcel_CalcEngine_CyclicReferenceStack - * @package PHPExcel_Calculation + * @category PHPExcel\CalcEngine_CyclicReferenceStack + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CalcEngine_CyclicReferenceStack { +class CalcEngine_CyclicReferenceStack { /** * The call stack for calculated cells @@ -95,4 +97,4 @@ class PHPExcel_CalcEngine_CyclicReferenceStack { return $this->_stack; } -} // class PHPExcel_CalcEngine_CyclicReferenceStack +} diff --git a/Classes/PHPExcel/CalcEngine/Logger.php b/Classes/PHPExcel/CalcEngine/Logger.php index 77c42aa..beb1598 100644 --- a/Classes/PHPExcel/CalcEngine/Logger.php +++ b/Classes/PHPExcel/CalcEngine/Logger.php @@ -19,20 +19,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_CalcEngine_Logger + * PHPExcel\CalcEngine_Logger * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_CalcEngine_Logger { +class CalcEngine_Logger { /** * Flag to determine whether a debug log should be generated by the calculation engine @@ -63,7 +65,7 @@ class PHPExcel_CalcEngine_Logger { /** * The calculation engine cell reference stack * - * @var PHPExcel_CalcEngine_CyclicReferenceStack + * @var PHPExcel\CalcEngine_CyclicReferenceStack */ private $_cellStack; @@ -71,9 +73,9 @@ class PHPExcel_CalcEngine_Logger { /** * Instantiate a Calculation engine logger * - * @param PHPExcel_CalcEngine_CyclicReferenceStack $stack + * @param PHPExcel\CalcEngine_CyclicReferenceStack $stack */ - public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) { + public function __construct(CalcEngine_CyclicReferenceStack $stack) { $this->_cellStack = $stack; } @@ -149,5 +151,5 @@ class PHPExcel_CalcEngine_Logger { return $this->_debugLog; } // function flushLogger() -} // class PHPExcel_CalcEngine_Logger +} diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index 01cfb7c..d02e64c 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -19,22 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ - -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; if (!defined('CALCULATION_REGEXP_CELLREF')) { // Test for support of \P (multibyte options) in PCRE @@ -53,13 +44,13 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) { /** - * PHPExcel_Calculation (Multiton) + * PHPExcel\Calculation (Multiton) * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation { +class Calculation { /** Constants */ /** Regular Expressions */ @@ -91,7 +82,7 @@ class PHPExcel_Calculation { * Instance of this class * * @access private - * @var PHPExcel_Calculation + * @var PHPExcel\Calculation */ private static $_instance; @@ -108,7 +99,7 @@ class PHPExcel_Calculation { * List of instances of the calculation engine that we've instantiated for individual workbooks * * @access private - * @var PHPExcel_Calculation[] + * @var PHPExcel\Calculation[] */ private static $_workbookSets; @@ -160,7 +151,7 @@ class PHPExcel_Calculation { * The debug log generated by the calculation engine * * @access private - * @var PHPExcel_CalcEngine_Logger + * @var PHPExcel\CalcEngine_Logger * */ private $debugLog; @@ -275,1434 +266,1434 @@ class PHPExcel_Calculation { // PHPExcel functions private static $_PHPExcelFunctions = array( // PHPExcel functions - 'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ABS' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'abs', 'argumentCount' => '1' ), - 'ACCRINT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT', + 'ACCRINT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::ACCRINT', 'argumentCount' => '4-7' ), - 'ACCRINTM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINTM', + 'ACCRINTM' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::ACCRINTM', 'argumentCount' => '3-5' ), - 'ACOS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ACOS' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'acos', 'argumentCount' => '1' ), - 'ACOSH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ACOSH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'acosh', 'argumentCount' => '1' ), - 'ADDRESS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::CELL_ADDRESS', + 'ADDRESS' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::CELL_ADDRESS', 'argumentCount' => '2-5' ), - 'AMORDEGRC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::AMORDEGRC', + 'AMORDEGRC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::AMORDEGRC', 'argumentCount' => '6,7' ), - 'AMORLINC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::AMORLINC', + 'AMORLINC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::AMORLINC', 'argumentCount' => '6,7' ), - 'AND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_AND', + 'AND' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::LOGICAL_AND', 'argumentCount' => '1+' ), - 'AREAS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'AREAS' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'ASC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ASC' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'ASIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ASIN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'asin', 'argumentCount' => '1' ), - 'ASINH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ASINH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'asinh', 'argumentCount' => '1' ), - 'ATAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ATAN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'atan', 'argumentCount' => '1' ), - 'ATAN2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::ATAN2', + 'ATAN2' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::ATAN2', 'argumentCount' => '2' ), - 'ATANH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ATANH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'atanh', 'argumentCount' => '1' ), - 'AVEDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::AVEDEV', + 'AVEDEV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::AVEDEV', 'argumentCount' => '1+' ), - 'AVERAGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGE', + 'AVERAGE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::AVERAGE', 'argumentCount' => '1+' ), - 'AVERAGEA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEA', + 'AVERAGEA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::AVERAGEA', 'argumentCount' => '1+' ), - 'AVERAGEIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEIF', + 'AVERAGEIF' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::AVERAGEIF', 'argumentCount' => '2,3' ), - 'AVERAGEIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'AVERAGEIFS' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '3+' ), - 'BAHTTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'BAHTTEXT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'BESSELI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELI', + 'BESSELI' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BESSELI', 'argumentCount' => '2' ), - 'BESSELJ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELJ', + 'BESSELJ' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BESSELJ', 'argumentCount' => '2' ), - 'BESSELK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELK', + 'BESSELK' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BESSELK', 'argumentCount' => '2' ), - 'BESSELY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELY', + 'BESSELY' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BESSELY', 'argumentCount' => '2' ), - 'BETADIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::BETADIST', + 'BETADIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::BETADIST', 'argumentCount' => '3-5' ), - 'BETAINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::BETAINV', + 'BETAINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::BETAINV', 'argumentCount' => '3-5' ), - 'BIN2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTODEC', + 'BIN2DEC' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BINTODEC', 'argumentCount' => '1' ), - 'BIN2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOHEX', + 'BIN2HEX' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BINTOHEX', 'argumentCount' => '1,2' ), - 'BIN2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOOCT', + 'BIN2OCT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::BINTOOCT', 'argumentCount' => '1,2' ), - 'BINOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::BINOMDIST', + 'BINOMDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::BINOMDIST', 'argumentCount' => '4' ), - 'CEILING' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::CEILING', + 'CEILING' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::CEILING', 'argumentCount' => '2' ), - 'CELL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CELL' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1,2' ), - 'CHAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::CHARACTER', + 'CHAR' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::CHARACTER', 'argumentCount' => '1' ), - 'CHIDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CHIDIST', + 'CHIDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CHIDIST', 'argumentCount' => '2' ), - 'CHIINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CHIINV', + 'CHIINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CHIINV', 'argumentCount' => '2' ), - 'CHITEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CHITEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'CHOOSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::CHOOSE', + 'CHOOSE' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::CHOOSE', 'argumentCount' => '2+' ), - 'CLEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::TRIMNONPRINTABLE', + 'CLEAN' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::TRIMNONPRINTABLE', 'argumentCount' => '1' ), - 'CODE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::ASCIICODE', + 'CODE' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::ASCIICODE', 'argumentCount' => '1' ), - 'COLUMN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMN', + 'COLUMN' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::COLUMN', 'argumentCount' => '-1', 'passByReference' => array(TRUE) ), - 'COLUMNS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMNS', + 'COLUMNS' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::COLUMNS', 'argumentCount' => '1' ), - 'COMBIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::COMBIN', + 'COMBIN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::COMBIN', 'argumentCount' => '2' ), - 'COMPLEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::COMPLEX', + 'COMPLEX' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::COMPLEX', 'argumentCount' => '2,3' ), - 'CONCATENATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::CONCATENATE', + 'CONCATENATE' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::CONCATENATE', 'argumentCount' => '1+' ), - 'CONFIDENCE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CONFIDENCE', + 'CONFIDENCE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CONFIDENCE', 'argumentCount' => '3' ), - 'CONVERT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::CONVERTUOM', + 'CONVERT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::CONVERTUOM', 'argumentCount' => '3' ), - 'CORREL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL', + 'CORREL' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CORREL', 'argumentCount' => '2' ), - 'COS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'COS' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'cos', 'argumentCount' => '1' ), - 'COSH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'COSH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'cosh', 'argumentCount' => '1' ), - 'COUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNT', + 'COUNT' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::COUNT', 'argumentCount' => '1+' ), - 'COUNTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTA', + 'COUNTA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::COUNTA', 'argumentCount' => '1+' ), - 'COUNTBLANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTBLANK', + 'COUNTBLANK' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::COUNTBLANK', 'argumentCount' => '1' ), - 'COUNTIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTIF', + 'COUNTIF' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::COUNTIF', 'argumentCount' => '2' ), - 'COUNTIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'COUNTIFS' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'COUPDAYBS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYBS', + 'COUPDAYBS' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPDAYBS', 'argumentCount' => '3,4' ), - 'COUPDAYS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYS', + 'COUPDAYS' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPDAYS', 'argumentCount' => '3,4' ), - 'COUPDAYSNC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYSNC', + 'COUPDAYSNC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPDAYSNC', 'argumentCount' => '3,4' ), - 'COUPNCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPNCD', + 'COUPNCD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPNCD', 'argumentCount' => '3,4' ), - 'COUPNUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPNUM', + 'COUPNUM' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPNUM', 'argumentCount' => '3,4' ), - 'COUPPCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::COUPPCD', + 'COUPPCD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::COUPPCD', 'argumentCount' => '3,4' ), - 'COVAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::COVAR', + 'COVAR' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::COVAR', 'argumentCount' => '2' ), - 'CRITBINOM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CRITBINOM', + 'CRITBINOM' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CRITBINOM', 'argumentCount' => '3' ), - 'CUBEKPIMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBEKPIMEMBER' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBEMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBEMEMBER' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBEMEMBERPROPERTY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBEMEMBERPROPERTY' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBERANKEDMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBERANKEDMEMBER' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBESET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBESET' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBESETCOUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBESETCOUNT' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUBEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'CUBEVALUE' => array('category' => Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'CUMIPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::CUMIPMT', + 'CUMIPMT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::CUMIPMT', 'argumentCount' => '6' ), - 'CUMPRINC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::CUMPRINC', + 'CUMPRINC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::CUMPRINC', 'argumentCount' => '6' ), - 'DATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DATE', + 'DATE' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DATE', 'argumentCount' => '3' ), - 'DATEDIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DATEDIF', + 'DATEDIF' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DATEDIF', 'argumentCount' => '2,3' ), - 'DATEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DATEVALUE', + 'DATEVALUE' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DATEVALUE', 'argumentCount' => '1' ), - 'DAVERAGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DAVERAGE', + 'DAVERAGE' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DAVERAGE', 'argumentCount' => '3' ), - 'DAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFMONTH', + 'DAY' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DAYOFMONTH', 'argumentCount' => '1' ), - 'DAYS360' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYS360', + 'DAYS360' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DAYS360', 'argumentCount' => '2,3' ), - 'DB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::DB', + 'DB' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::DB', 'argumentCount' => '4,5' ), - 'DCOUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DCOUNT', + 'DCOUNT' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DCOUNT', 'argumentCount' => '3' ), - 'DCOUNTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DCOUNTA', + 'DCOUNTA' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DCOUNTA', 'argumentCount' => '3' ), - 'DDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::DDB', + 'DDB' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::DDB', 'argumentCount' => '4,5' ), - 'DEC2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOBIN', + 'DEC2BIN' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::DECTOBIN', 'argumentCount' => '1,2' ), - 'DEC2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOHEX', + 'DEC2HEX' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::DECTOHEX', 'argumentCount' => '1,2' ), - 'DEC2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOOCT', + 'DEC2OCT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::DECTOOCT', 'argumentCount' => '1,2' ), - 'DEGREES' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'DEGREES' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'rad2deg', 'argumentCount' => '1' ), - 'DELTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::DELTA', + 'DELTA' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::DELTA', 'argumentCount' => '1,2' ), - 'DEVSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::DEVSQ', + 'DEVSQ' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::DEVSQ', 'argumentCount' => '1+' ), - 'DGET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DGET', + 'DGET' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DGET', 'argumentCount' => '3' ), - 'DISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::DISC', + 'DISC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::DISC', 'argumentCount' => '4,5' ), - 'DMAX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DMAX', + 'DMAX' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DMAX', 'argumentCount' => '3' ), - 'DMIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DMIN', + 'DMIN' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DMIN', 'argumentCount' => '3' ), - 'DOLLAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::DOLLAR', + 'DOLLAR' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::DOLLAR', 'argumentCount' => '1,2' ), - 'DOLLARDE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARDE', + 'DOLLARDE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::DOLLARDE', 'argumentCount' => '2' ), - 'DOLLARFR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARFR', + 'DOLLARFR' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::DOLLARFR', 'argumentCount' => '2' ), - 'DPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DPRODUCT', + 'DPRODUCT' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DPRODUCT', 'argumentCount' => '3' ), - 'DSTDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DSTDEV', + 'DSTDEV' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DSTDEV', 'argumentCount' => '3' ), - 'DSTDEVP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DSTDEVP', + 'DSTDEVP' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DSTDEVP', 'argumentCount' => '3' ), - 'DSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DSUM', + 'DSUM' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DSUM', 'argumentCount' => '3' ), - 'DURATION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'DURATION' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '5,6' ), - 'DVAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DVAR', + 'DVAR' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DVAR', 'argumentCount' => '3' ), - 'DVARP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, - 'functionCall' => 'PHPExcel_Calculation_Database::DVARP', + 'DVARP' => array('category' => Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'Calculation_Database::DVARP', 'argumentCount' => '3' ), - 'EDATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::EDATE', + 'EDATE' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::EDATE', 'argumentCount' => '2' ), - 'EFFECT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::EFFECT', + 'EFFECT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::EFFECT', 'argumentCount' => '2' ), - 'EOMONTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::EOMONTH', + 'EOMONTH' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::EOMONTH', 'argumentCount' => '2' ), - 'ERF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::ERF', + 'ERF' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::ERF', 'argumentCount' => '1,2' ), - 'ERFC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::ERFC', + 'ERFC' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::ERFC', 'argumentCount' => '1' ), - 'ERROR.TYPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::ERROR_TYPE', + 'ERROR.TYPE' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::ERROR_TYPE', 'argumentCount' => '1' ), - 'EVEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::EVEN', + 'EVEN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::EVEN', 'argumentCount' => '1' ), - 'EXACT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'EXACT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'EXP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'EXP' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'exp', 'argumentCount' => '1' ), - 'EXPONDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::EXPONDIST', + 'EXPONDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::EXPONDIST', 'argumentCount' => '3' ), - 'FACT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::FACT', + 'FACT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::FACT', 'argumentCount' => '1' ), - 'FACTDOUBLE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::FACTDOUBLE', + 'FACTDOUBLE' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::FACTDOUBLE', 'argumentCount' => '1' ), - 'FALSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::FALSE', + 'FALSE' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::FALSE', 'argumentCount' => '0' ), - 'FDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'FDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '3' ), - 'FIND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE', + 'FIND' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::SEARCHSENSITIVE', 'argumentCount' => '2,3' ), - 'FINDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE', + 'FINDB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::SEARCHSENSITIVE', 'argumentCount' => '2,3' ), - 'FINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'FINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '3' ), - 'FISHER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::FISHER', + 'FISHER' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::FISHER', 'argumentCount' => '1' ), - 'FISHERINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::FISHERINV', + 'FISHERINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::FISHERINV', 'argumentCount' => '1' ), - 'FIXED' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::FIXEDFORMAT', + 'FIXED' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::FIXEDFORMAT', 'argumentCount' => '1-3' ), - 'FLOOR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::FLOOR', + 'FLOOR' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::FLOOR', 'argumentCount' => '2' ), - 'FORECAST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::FORECAST', + 'FORECAST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::FORECAST', 'argumentCount' => '3' ), - 'FREQUENCY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'FREQUENCY' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'FTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'FTEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'FV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::FV', + 'FV' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::FV', 'argumentCount' => '3-5' ), - 'FVSCHEDULE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::FVSCHEDULE', + 'FVSCHEDULE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::FVSCHEDULE', 'argumentCount' => '2' ), - 'GAMMADIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMADIST', + 'GAMMADIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::GAMMADIST', 'argumentCount' => '4' ), - 'GAMMAINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMAINV', + 'GAMMAINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::GAMMAINV', 'argumentCount' => '3' ), - 'GAMMALN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMALN', + 'GAMMALN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::GAMMALN', 'argumentCount' => '1' ), - 'GCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::GCD', + 'GCD' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::GCD', 'argumentCount' => '1+' ), - 'GEOMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::GEOMEAN', + 'GEOMEAN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::GEOMEAN', 'argumentCount' => '1+' ), - 'GESTEP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::GESTEP', + 'GESTEP' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::GESTEP', 'argumentCount' => '1,2' ), - 'GETPIVOTDATA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'GETPIVOTDATA' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2+' ), - 'GROWTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::GROWTH', + 'GROWTH' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::GROWTH', 'argumentCount' => '1-4' ), - 'HARMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::HARMEAN', + 'HARMEAN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::HARMEAN', 'argumentCount' => '1+' ), - 'HEX2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOBIN', + 'HEX2BIN' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::HEXTOBIN', 'argumentCount' => '1,2' ), - 'HEX2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTODEC', + 'HEX2DEC' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::HEXTODEC', 'argumentCount' => '1' ), - 'HEX2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOOCT', + 'HEX2OCT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::HEXTOOCT', 'argumentCount' => '1,2' ), - 'HLOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::HLOOKUP', + 'HLOOKUP' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::HLOOKUP', 'argumentCount' => '3,4' ), - 'HOUR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::HOUROFDAY', + 'HOUR' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::HOUROFDAY', 'argumentCount' => '1' ), - 'HYPERLINK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::HYPERLINK', + 'HYPERLINK' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::HYPERLINK', 'argumentCount' => '1,2', 'passCellReference'=> TRUE ), - 'HYPGEOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::HYPGEOMDIST', + 'HYPGEOMDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::HYPGEOMDIST', 'argumentCount' => '4' ), - 'IF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::STATEMENT_IF', + 'IF' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::STATEMENT_IF', 'argumentCount' => '1-3' ), - 'IFERROR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::IFERROR', + 'IFERROR' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::IFERROR', 'argumentCount' => '2' ), - 'IMABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMABS', + 'IMABS' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMABS', 'argumentCount' => '1' ), - 'IMAGINARY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMAGINARY', + 'IMAGINARY' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMAGINARY', 'argumentCount' => '1' ), - 'IMARGUMENT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMARGUMENT', + 'IMARGUMENT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMARGUMENT', 'argumentCount' => '1' ), - 'IMCONJUGATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMCONJUGATE', + 'IMCONJUGATE' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMCONJUGATE', 'argumentCount' => '1' ), - 'IMCOS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMCOS', + 'IMCOS' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMCOS', 'argumentCount' => '1' ), - 'IMDIV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMDIV', + 'IMDIV' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMDIV', 'argumentCount' => '2' ), - 'IMEXP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMEXP', + 'IMEXP' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMEXP', 'argumentCount' => '1' ), - 'IMLN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLN', + 'IMLN' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMLN', 'argumentCount' => '1' ), - 'IMLOG10' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG10', + 'IMLOG10' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMLOG10', 'argumentCount' => '1' ), - 'IMLOG2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG2', + 'IMLOG2' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMLOG2', 'argumentCount' => '1' ), - 'IMPOWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMPOWER', + 'IMPOWER' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMPOWER', 'argumentCount' => '2' ), - 'IMPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMPRODUCT', + 'IMPRODUCT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMPRODUCT', 'argumentCount' => '1+' ), - 'IMREAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMREAL', + 'IMREAL' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMREAL', 'argumentCount' => '1' ), - 'IMSIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSIN', + 'IMSIN' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMSIN', 'argumentCount' => '1' ), - 'IMSQRT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSQRT', + 'IMSQRT' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMSQRT', 'argumentCount' => '1' ), - 'IMSUB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUB', + 'IMSUB' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMSUB', 'argumentCount' => '2' ), - 'IMSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUM', + 'IMSUM' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::IMSUM', 'argumentCount' => '1+' ), - 'INDEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::INDEX', + 'INDEX' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::INDEX', 'argumentCount' => '1-4' ), - 'INDIRECT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::INDIRECT', + 'INDIRECT' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::INDIRECT', 'argumentCount' => '1,2', 'passCellReference'=> TRUE ), - 'INFO' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'INFO' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'INT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::INT', + 'INT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::INT', 'argumentCount' => '1' ), - 'INTERCEPT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::INTERCEPT', + 'INTERCEPT' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::INTERCEPT', 'argumentCount' => '2' ), - 'INTRATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::INTRATE', + 'INTRATE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::INTRATE', 'argumentCount' => '4,5' ), - 'IPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::IPMT', + 'IPMT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::IPMT', 'argumentCount' => '4-6' ), - 'IRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::IRR', + 'IRR' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::IRR', 'argumentCount' => '1,2' ), - 'ISBLANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_BLANK', + 'ISBLANK' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_BLANK', 'argumentCount' => '1' ), - 'ISERR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERR', + 'ISERR' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_ERR', 'argumentCount' => '1' ), - 'ISERROR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERROR', + 'ISERROR' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_ERROR', 'argumentCount' => '1' ), - 'ISEVEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_EVEN', + 'ISEVEN' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_EVEN', 'argumentCount' => '1' ), - 'ISLOGICAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_LOGICAL', + 'ISLOGICAL' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_LOGICAL', 'argumentCount' => '1' ), - 'ISNA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NA', + 'ISNA' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_NA', 'argumentCount' => '1' ), - 'ISNONTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NONTEXT', + 'ISNONTEXT' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_NONTEXT', 'argumentCount' => '1' ), - 'ISNUMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NUMBER', + 'ISNUMBER' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_NUMBER', 'argumentCount' => '1' ), - 'ISODD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ODD', + 'ISODD' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_ODD', 'argumentCount' => '1' ), - 'ISPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::ISPMT', + 'ISPMT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::ISPMT', 'argumentCount' => '4' ), - 'ISREF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ISREF' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'ISTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::IS_TEXT', + 'ISTEXT' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::IS_TEXT', 'argumentCount' => '1' ), - 'JIS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'JIS' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'KURT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::KURT', + 'KURT' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::KURT', 'argumentCount' => '1+' ), - 'LARGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::LARGE', + 'LARGE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::LARGE', 'argumentCount' => '2' ), - 'LCM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::LCM', + 'LCM' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::LCM', 'argumentCount' => '1+' ), - 'LEFT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::LEFT', + 'LEFT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::LEFT', 'argumentCount' => '1,2' ), - 'LEFTB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::LEFT', + 'LEFTB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::LEFT', 'argumentCount' => '1,2' ), - 'LEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH', + 'LEN' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::STRINGLENGTH', 'argumentCount' => '1' ), - 'LENB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH', + 'LENB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::STRINGLENGTH', 'argumentCount' => '1' ), - 'LINEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::LINEST', + 'LINEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::LINEST', 'argumentCount' => '1-4' ), - 'LN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'LN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'log', 'argumentCount' => '1' ), - 'LOG' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::LOG_BASE', + 'LOG' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::LOG_BASE', 'argumentCount' => '1,2' ), - 'LOG10' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'LOG10' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'log10', 'argumentCount' => '1' ), - 'LOGEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGEST', + 'LOGEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::LOGEST', 'argumentCount' => '1-4' ), - 'LOGINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGINV', + 'LOGINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::LOGINV', 'argumentCount' => '3' ), - 'LOGNORMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGNORMDIST', + 'LOGNORMDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::LOGNORMDIST', 'argumentCount' => '3' ), - 'LOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::LOOKUP', + 'LOOKUP' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::LOOKUP', 'argumentCount' => '2,3' ), - 'LOWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::LOWERCASE', + 'LOWER' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::LOWERCASE', 'argumentCount' => '1' ), - 'MATCH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::MATCH', + 'MATCH' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::MATCH', 'argumentCount' => '2,3' ), - 'MAX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MAX', + 'MAX' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MAX', 'argumentCount' => '1+' ), - 'MAXA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MAXA', + 'MAXA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MAXA', 'argumentCount' => '1+' ), - 'MAXIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MAXIF', + 'MAXIF' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MAXIF', 'argumentCount' => '2+' ), - 'MDETERM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MDETERM', + 'MDETERM' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MDETERM', 'argumentCount' => '1' ), - 'MDURATION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'MDURATION' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '5,6' ), - 'MEDIAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MEDIAN', + 'MEDIAN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MEDIAN', 'argumentCount' => '1+' ), - 'MEDIANIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'MEDIANIF' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2+' ), - 'MID' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::MID', + 'MID' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::MID', 'argumentCount' => '3' ), - 'MIDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::MID', + 'MIDB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::MID', 'argumentCount' => '3' ), - 'MIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MIN', + 'MIN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MIN', 'argumentCount' => '1+' ), - 'MINA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MINA', + 'MINA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MINA', 'argumentCount' => '1+' ), - 'MINIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MINIF', + 'MINIF' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MINIF', 'argumentCount' => '2+' ), - 'MINUTE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::MINUTEOFHOUR', + 'MINUTE' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::MINUTEOFHOUR', 'argumentCount' => '1' ), - 'MINVERSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MINVERSE', + 'MINVERSE' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MINVERSE', 'argumentCount' => '1' ), - 'MIRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::MIRR', + 'MIRR' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::MIRR', 'argumentCount' => '3' ), - 'MMULT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MMULT', + 'MMULT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MMULT', 'argumentCount' => '2' ), - 'MOD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MOD', + 'MOD' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MOD', 'argumentCount' => '2' ), - 'MODE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::MODE', + 'MODE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::MODE', 'argumentCount' => '1+' ), - 'MONTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::MONTHOFYEAR', + 'MONTH' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::MONTHOFYEAR', 'argumentCount' => '1' ), - 'MROUND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MROUND', + 'MROUND' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MROUND', 'argumentCount' => '2' ), - 'MULTINOMIAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::MULTINOMIAL', + 'MULTINOMIAL' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::MULTINOMIAL', 'argumentCount' => '1+' ), - 'N' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::N', + 'N' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::N', 'argumentCount' => '1' ), - 'NA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::NA', + 'NA' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::NA', 'argumentCount' => '0' ), - 'NEGBINOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::NEGBINOMDIST', + 'NEGBINOMDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::NEGBINOMDIST', 'argumentCount' => '3' ), - 'NETWORKDAYS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::NETWORKDAYS', + 'NETWORKDAYS' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::NETWORKDAYS', 'argumentCount' => '2+' ), - 'NOMINAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::NOMINAL', + 'NOMINAL' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::NOMINAL', 'argumentCount' => '2' ), - 'NORMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMDIST', + 'NORMDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::NORMDIST', 'argumentCount' => '4' ), - 'NORMINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMINV', + 'NORMINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::NORMINV', 'argumentCount' => '3' ), - 'NORMSDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSDIST', + 'NORMSDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::NORMSDIST', 'argumentCount' => '1' ), - 'NORMSINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSINV', + 'NORMSINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::NORMSINV', 'argumentCount' => '1' ), - 'NOT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::NOT', + 'NOT' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::NOT', 'argumentCount' => '1' ), - 'NOW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DATETIMENOW', + 'NOW' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DATETIMENOW', 'argumentCount' => '0' ), - 'NPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::NPER', + 'NPER' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::NPER', 'argumentCount' => '3-5' ), - 'NPV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::NPV', + 'NPV' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::NPV', 'argumentCount' => '2+' ), - 'OCT2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOBIN', + 'OCT2BIN' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::OCTTOBIN', 'argumentCount' => '1,2' ), - 'OCT2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTODEC', + 'OCT2DEC' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::OCTTODEC', 'argumentCount' => '1' ), - 'OCT2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, - 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOHEX', + 'OCT2HEX' => array('category' => Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'Calculation_Engineering::OCTTOHEX', 'argumentCount' => '1,2' ), - 'ODD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::ODD', + 'ODD' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::ODD', 'argumentCount' => '1' ), - 'ODDFPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ODDFPRICE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '8,9' ), - 'ODDFYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ODDFYIELD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '8,9' ), - 'ODDLPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ODDLPRICE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '7,8' ), - 'ODDLYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'ODDLYIELD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '7,8' ), - 'OFFSET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::OFFSET', + 'OFFSET' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::OFFSET', 'argumentCount' => '3,5', 'passCellReference'=> TRUE, 'passByReference' => array(TRUE) ), - 'OR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_OR', + 'OR' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::LOGICAL_OR', 'argumentCount' => '1+' ), - 'PEARSON' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL', + 'PEARSON' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::CORREL', 'argumentCount' => '2' ), - 'PERCENTILE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTILE', + 'PERCENTILE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::PERCENTILE', 'argumentCount' => '2' ), - 'PERCENTRANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTRANK', + 'PERCENTRANK' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::PERCENTRANK', 'argumentCount' => '2,3' ), - 'PERMUT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::PERMUT', + 'PERMUT' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::PERMUT', 'argumentCount' => '2' ), - 'PHONETIC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'PHONETIC' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'PI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'PI' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'pi', 'argumentCount' => '0' ), - 'PMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PMT', + 'PMT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PMT', 'argumentCount' => '3-5' ), - 'POISSON' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::POISSON', + 'POISSON' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::POISSON', 'argumentCount' => '3' ), - 'POWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::POWER', + 'POWER' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::POWER', 'argumentCount' => '2' ), - 'PPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PPMT', + 'PPMT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PPMT', 'argumentCount' => '4-6' ), - 'PRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PRICE', + 'PRICE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PRICE', 'argumentCount' => '6,7' ), - 'PRICEDISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PRICEDISC', + 'PRICEDISC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PRICEDISC', 'argumentCount' => '4,5' ), - 'PRICEMAT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PRICEMAT', + 'PRICEMAT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PRICEMAT', 'argumentCount' => '5,6' ), - 'PROB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'PROB' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '3,4' ), - 'PRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::PRODUCT', + 'PRODUCT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::PRODUCT', 'argumentCount' => '1+' ), - 'PROPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::PROPERCASE', + 'PROPER' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::PROPERCASE', 'argumentCount' => '1' ), - 'PV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::PV', + 'PV' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::PV', 'argumentCount' => '3-5' ), - 'QUARTILE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::QUARTILE', + 'QUARTILE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::QUARTILE', 'argumentCount' => '2' ), - 'QUOTIENT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::QUOTIENT', + 'QUOTIENT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::QUOTIENT', 'argumentCount' => '2' ), - 'RADIANS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'RADIANS' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'deg2rad', 'argumentCount' => '1' ), - 'RAND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND', + 'RAND' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::RAND', 'argumentCount' => '0' ), - 'RANDBETWEEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND', + 'RANDBETWEEN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::RAND', 'argumentCount' => '2' ), - 'RANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::RANK', + 'RANK' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::RANK', 'argumentCount' => '2,3' ), - 'RATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::RATE', + 'RATE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::RATE', 'argumentCount' => '3-6' ), - 'RECEIVED' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::RECEIVED', + 'RECEIVED' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::RECEIVED', 'argumentCount' => '4-5' ), - 'REPLACE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE', + 'REPLACE' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::REPLACE', 'argumentCount' => '4' ), - 'REPLACEB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE', + 'REPLACEB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::REPLACE', 'argumentCount' => '4' ), - 'REPT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'REPT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, 'functionCall' => 'str_repeat', 'argumentCount' => '2' ), - 'RIGHT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT', + 'RIGHT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::RIGHT', 'argumentCount' => '1,2' ), - 'RIGHTB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT', + 'RIGHTB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::RIGHT', 'argumentCount' => '1,2' ), - 'ROMAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROMAN', + 'ROMAN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::ROMAN', 'argumentCount' => '1,2' ), - 'ROUND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'ROUND' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'round', 'argumentCount' => '2' ), - 'ROUNDDOWN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDDOWN', + 'ROUNDDOWN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::ROUNDDOWN', 'argumentCount' => '2' ), - 'ROUNDUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDUP', + 'ROUNDUP' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::ROUNDUP', 'argumentCount' => '2' ), - 'ROW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROW', + 'ROW' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::ROW', 'argumentCount' => '-1', 'passByReference' => array(TRUE) ), - 'ROWS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROWS', + 'ROWS' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::ROWS', 'argumentCount' => '1' ), - 'RSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::RSQ', + 'RSQ' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::RSQ', 'argumentCount' => '2' ), - 'RTD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'RTD' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1+' ), - 'SEARCH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE', + 'SEARCH' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::SEARCHINSENSITIVE', 'argumentCount' => '2,3' ), - 'SEARCHB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE', + 'SEARCHB' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::SEARCHINSENSITIVE', 'argumentCount' => '2,3' ), - 'SECOND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::SECONDOFMINUTE', + 'SECOND' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::SECONDOFMINUTE', 'argumentCount' => '1' ), - 'SERIESSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SERIESSUM', + 'SERIESSUM' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SERIESSUM', 'argumentCount' => '4' ), - 'SIGN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SIGN', + 'SIGN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SIGN', 'argumentCount' => '1' ), - 'SIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'SIN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'sin', 'argumentCount' => '1' ), - 'SINH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'SINH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'sinh', 'argumentCount' => '1' ), - 'SKEW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::SKEW', + 'SKEW' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::SKEW', 'argumentCount' => '1+' ), - 'SLN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::SLN', + 'SLN' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::SLN', 'argumentCount' => '3' ), - 'SLOPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::SLOPE', + 'SLOPE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::SLOPE', 'argumentCount' => '2' ), - 'SMALL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::SMALL', + 'SMALL' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::SMALL', 'argumentCount' => '2' ), - 'SQRT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'SQRT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'sqrt', 'argumentCount' => '1' ), - 'SQRTPI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SQRTPI', + 'SQRTPI' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SQRTPI', 'argumentCount' => '1' ), - 'STANDARDIZE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STANDARDIZE', + 'STANDARDIZE' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STANDARDIZE', 'argumentCount' => '3' ), - 'STDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEV', + 'STDEV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STDEV', 'argumentCount' => '1+' ), - 'STDEVA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVA', + 'STDEVA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STDEVA', 'argumentCount' => '1+' ), - 'STDEVP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVP', + 'STDEVP' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STDEVP', 'argumentCount' => '1+' ), - 'STDEVPA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVPA', + 'STDEVPA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STDEVPA', 'argumentCount' => '1+' ), - 'STEYX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::STEYX', + 'STEYX' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::STEYX', 'argumentCount' => '2' ), - 'SUBSTITUTE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::SUBSTITUTE', + 'SUBSTITUTE' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::SUBSTITUTE', 'argumentCount' => '3,4' ), - 'SUBTOTAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUBTOTAL', + 'SUBTOTAL' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUBTOTAL', 'argumentCount' => '2+' ), - 'SUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUM', + 'SUM' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUM', 'argumentCount' => '1+' ), - 'SUMIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMIF', + 'SUMIF' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMIF', 'argumentCount' => '2,3' ), - 'SUMIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'SUMIFS' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '?' ), - 'SUMPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMPRODUCT', + 'SUMPRODUCT' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMPRODUCT', 'argumentCount' => '1+' ), - 'SUMSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMSQ', + 'SUMSQ' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMSQ', 'argumentCount' => '1+' ), - 'SUMX2MY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2MY2', + 'SUMX2MY2' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMX2MY2', 'argumentCount' => '2' ), - 'SUMX2PY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2PY2', + 'SUMX2PY2' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMX2PY2', 'argumentCount' => '2' ), - 'SUMXMY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMXMY2', + 'SUMXMY2' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::SUMXMY2', 'argumentCount' => '2' ), - 'SYD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::SYD', + 'SYD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::SYD', 'argumentCount' => '4' ), - 'T' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::RETURNSTRING', + 'T' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::RETURNSTRING', 'argumentCount' => '1' ), - 'TAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'TAN' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'tan', 'argumentCount' => '1' ), - 'TANH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'TANH' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'tanh', 'argumentCount' => '1' ), - 'TBILLEQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLEQ', + 'TBILLEQ' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::TBILLEQ', 'argumentCount' => '3' ), - 'TBILLPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLPRICE', + 'TBILLPRICE' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::TBILLPRICE', 'argumentCount' => '3' ), - 'TBILLYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLYIELD', + 'TBILLYIELD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::TBILLYIELD', 'argumentCount' => '3' ), - 'TDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::TDIST', + 'TDIST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::TDIST', 'argumentCount' => '3' ), - 'TEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::TEXTFORMAT', + 'TEXT' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::TEXTFORMAT', 'argumentCount' => '2' ), - 'TIME' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::TIME', + 'TIME' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::TIME', 'argumentCount' => '3' ), - 'TIMEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::TIMEVALUE', + 'TIMEVALUE' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::TIMEVALUE', 'argumentCount' => '1' ), - 'TINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::TINV', + 'TINV' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::TINV', 'argumentCount' => '2' ), - 'TODAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DATENOW', + 'TODAY' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DATENOW', 'argumentCount' => '0' ), - 'TRANSPOSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::TRANSPOSE', + 'TRANSPOSE' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::TRANSPOSE', 'argumentCount' => '1' ), - 'TREND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::TREND', + 'TREND' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::TREND', 'argumentCount' => '1-4' ), - 'TRIM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::TRIMSPACES', + 'TRIM' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::TRIMSPACES', 'argumentCount' => '1' ), - 'TRIMMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::TRIMMEAN', + 'TRIMMEAN' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::TRIMMEAN', 'argumentCount' => '2' ), - 'TRUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, - 'functionCall' => 'PHPExcel_Calculation_Logical::TRUE', + 'TRUE' => array('category' => Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'Calculation_Logical::TRUE', 'argumentCount' => '0' ), - 'TRUNC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, - 'functionCall' => 'PHPExcel_Calculation_MathTrig::TRUNC', + 'TRUNC' => array('category' => Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'Calculation_MathTrig::TRUNC', 'argumentCount' => '1,2' ), - 'TTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'TTEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '4' ), - 'TYPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::TYPE', + 'TYPE' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::TYPE', 'argumentCount' => '1' ), - 'UPPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_TextData::UPPERCASE', + 'UPPER' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_TextData::UPPERCASE', 'argumentCount' => '1' ), - 'USDOLLAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'USDOLLAR' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '2' ), - 'VALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'VALUE' => array('category' => Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '1' ), - 'VAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::VARFunc', + 'VAR' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::VARFunc', 'argumentCount' => '1+' ), - 'VARA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::VARA', + 'VARA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::VARA', 'argumentCount' => '1+' ), - 'VARP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::VARP', + 'VARP' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::VARP', 'argumentCount' => '1+' ), - 'VARPA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::VARPA', + 'VARPA' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::VARPA', 'argumentCount' => '1+' ), - 'VDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'VDB' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '5-7' ), - 'VERSION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, - 'functionCall' => 'PHPExcel_Calculation_Functions::VERSION', + 'VERSION' => array('category' => Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'Calculation_Functions::VERSION', 'argumentCount' => '0' ), - 'VLOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_LookupRef::VLOOKUP', + 'VLOOKUP' => array('category' => Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'Calculation_LookupRef::VLOOKUP', 'argumentCount' => '3,4' ), - 'WEEKDAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFWEEK', + 'WEEKDAY' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::DAYOFWEEK', 'argumentCount' => '1,2' ), - 'WEEKNUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::WEEKOFYEAR', + 'WEEKNUM' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::WEEKOFYEAR', 'argumentCount' => '1,2' ), - 'WEIBULL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::WEIBULL', + 'WEIBULL' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::WEIBULL', 'argumentCount' => '4' ), - 'WORKDAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::WORKDAY', + 'WORKDAY' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::WORKDAY', 'argumentCount' => '2+' ), - 'XIRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::XIRR', + 'XIRR' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::XIRR', 'argumentCount' => '2,3' ), - 'XNPV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::XNPV', + 'XNPV' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::XNPV', 'argumentCount' => '3' ), - 'YEAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::YEAR', + 'YEAR' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::YEAR', 'argumentCount' => '1' ), - 'YEARFRAC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, - 'functionCall' => 'PHPExcel_Calculation_DateTime::YEARFRAC', + 'YEARFRAC' => array('category' => Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'Calculation_DateTime::YEARFRAC', 'argumentCount' => '2,3' ), - 'YIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'YIELD' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Functions::DUMMY', 'argumentCount' => '6,7' ), - 'YIELDDISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::YIELDDISC', + 'YIELDDISC' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::YIELDDISC', 'argumentCount' => '4,5' ), - 'YIELDMAT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, - 'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT', + 'YIELDMAT' => array('category' => Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'Calculation_Financial::YIELDMAT', 'argumentCount' => '5,6' ), - 'ZTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, - 'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST', + 'ZTEST' => array('category' => Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'Calculation_Statistical::ZTEST', 'argumentCount' => '2-3' ) ); @@ -1718,7 +1709,7 @@ class PHPExcel_Calculation { - private function __construct(PHPExcel $workbook = NULL) { + private function __construct(Workbook $workbook = NULL) { $setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16; $this->_savedPrecision = ini_get('precision'); if ($this->_savedPrecision < $setPrecision) { @@ -1730,8 +1721,8 @@ class PHPExcel_Calculation { } $this->_workbook = $workbook; - $this->_cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack(); - $this->_debugLog = new PHPExcel_CalcEngine_Logger($this->_cyclicReferenceStack); + $this->_cyclicReferenceStack = new CalcEngine_CyclicReferenceStack(); + $this->_debugLog = new CalcEngine_Logger($this->_cyclicReferenceStack); } // function __construct() @@ -1757,18 +1748,18 @@ class PHPExcel_Calculation { * @access public * @param PHPExcel $workbook Injected workbook for working with a PHPExcel object, * or NULL to create a standalone claculation engine - * @return PHPExcel_Calculation + * @return PHPExcel\Calculation */ - public static function getInstance(PHPExcel $workbook = NULL) { + public static function getInstance(Workbook $workbook = NULL) { if ($workbook !== NULL) { if (isset(self::$_workbookSets[$workbook->getID()])) { return self::$_workbookSets[$workbook->getID()]; } - return new PHPExcel_Calculation($workbook); + return new Calculation($workbook); } if (!isset(self::$_instance) || (self::$_instance === NULL)) { - self::$_instance = new PHPExcel_Calculation(); + self::$_instance = new Calculation(); } return self::$_instance; @@ -1780,7 +1771,7 @@ class PHPExcel_Calculation { * @access public * @param PHPExcel $workbook Injected workbook identifying the instance to unset */ - public static function unsetInstance(PHPExcel $workbook = NULL) { + public static function unsetInstance(Workbook $workbook = NULL) { if ($workbook !== NULL) { if (isset(self::$_workbookSets[$workbook->getID()])) { unset(self::$_workbookSets[$workbook->getID()]); @@ -1790,7 +1781,7 @@ class PHPExcel_Calculation { /** * Flush the calculation cache for any existing instance of this class - * but only if a PHPExcel_Calculation instance exists + * but only if a PHPExcel\Calculation instance exists * * @access public * @return null @@ -1804,7 +1795,7 @@ class PHPExcel_Calculation { * Get the debuglog for this claculation engine instance * * @access public - * @return PHPExcel_CalcEngine_Logger + * @return PHPExcel\CalcEngine_Logger */ public function getDebugLog() { return $this->_debugLog; @@ -1814,10 +1805,10 @@ class PHPExcel_Calculation { * __clone implementation. Cloning should not be allowed in a Singleton! * * @access public - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ public final function __clone() { - throw new PHPExcel_Calculation_Exception ('Cloning the calculation engine is not allowed!'); + throw new Calculation_Exception ('Cloning the calculation engine is not allowed!'); } // function __clone() @@ -2168,7 +2159,7 @@ class PHPExcel_Calculation { return '"'.$value.'"'; // Convert numeric errors to NaN error } else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $value; @@ -2188,7 +2179,7 @@ class PHPExcel_Calculation { } // Convert numeric errors to NaN error } else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $value; } // function _unwrapResult() @@ -2201,15 +2192,15 @@ class PHPExcel_Calculation { * Retained for backward compatibility * * @access public - * @param PHPExcel_Cell $pCell Cell to calculate + * @param PHPExcel\Cell $pCell Cell to calculate * @return mixed - * @throws PHPExcel_Calculation_Exception + * @throws PHPExcel\Calculation_Exception */ - public function calculate(PHPExcel_Cell $pCell = NULL) { + public function calculate(Cell $pCell = NULL) { try { return $this->calculateCellValue($pCell); - } catch (PHPExcel_Exception $e) { - throw new PHPExcel_Calculation_Exception($e->getMessage()); + } catch (Exception $e) { + throw new Calculation_Exception($e->getMessage()); } } // function calculate() @@ -2218,12 +2209,12 @@ class PHPExcel_Calculation { * Calculate the value of a cell formula * * @access public - * @param PHPExcel_Cell $pCell Cell to calculate + * @param PHPExcel\Cell $pCell Cell to calculate * @param Boolean $resetLog Flag indicating whether the debug log should be reset or not * @return mixed - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ - public function calculateCellValue(PHPExcel_Cell $pCell = NULL, $resetLog = TRUE) { + public function calculateCellValue(Cell $pCell = NULL, $resetLog = TRUE) { if ($pCell === NULL) { return NULL; } @@ -2242,27 +2233,27 @@ class PHPExcel_Calculation { // Execute the calculation for the cell formula try { $result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); - } catch (PHPExcel_Exception $e) { - throw new PHPExcel_Calculation_Exception($e->getMessage()); + } catch (Exception $e) { + throw new Calculation_Exception($e->getMessage()); } if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { self::$returnArrayAsType = $returnArrayAsType; - $testResult = PHPExcel_Calculation_Functions::flattenArray($result); + $testResult = Calculation_Functions::flattenArray($result); if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // If there's only a single cell in the array, then we allow it if (count($testResult) != 1) { // If keys are numeric, then it's a matrix result rather than a cell range result, so we permit it $r = array_keys($result); $r = array_shift($r); - if (!is_numeric($r)) { return PHPExcel_Calculation_Functions::VALUE(); } + if (!is_numeric($r)) { return Calculation_Functions::VALUE(); } if (is_array($result[$r])) { $c = array_keys($result[$r]); $c = array_shift($c); if (!is_numeric($c)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } } @@ -2274,7 +2265,7 @@ class PHPExcel_Calculation { if ($result === NULL) { return 0; } elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $result; } // function calculateCellValue( @@ -2285,7 +2276,7 @@ class PHPExcel_Calculation { * * @param string $formula Formula to parse * @return array - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ public function parseFormula($formula) { // Basic validation that this is indeed a formula @@ -2305,11 +2296,11 @@ class PHPExcel_Calculation { * * @param string $formula Formula to parse * @param string $cellID Address of the cell to calculate - * @param PHPExcel_Cell $pCell Cell to calculate + * @param PHPExcel\Cell $pCell Cell to calculate * @return mixed - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ - public function calculateFormula($formula, $cellID=NULL, PHPExcel_Cell $pCell = NULL) { + public function calculateFormula($formula, $cellID=NULL, Cell $pCell = NULL) { // Initialise the logging settings $this->formulaError = null; $this->_debugLog->clearLog(); @@ -2322,8 +2313,8 @@ class PHPExcel_Calculation { // Execute the calculation try { $result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); - } catch (PHPExcel_Exception $e) { - throw new PHPExcel_Calculation_Exception($e->getMessage()); + } catch (Exception $e) { + throw new Calculation_Exception($e->getMessage()); } // Reset calculation cacheing to its previous state @@ -2359,11 +2350,11 @@ class PHPExcel_Calculation { * * @param string $formula The formula to parse and calculate * @param string $cellID The ID (e.g. A3) of the cell that we are calculating - * @param PHPExcel_Cell $pCell Cell to calculate + * @param PHPExcel\Cell $pCell Cell to calculate * @return mixed - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ - public function _calculateFormulaValue($formula, $cellID=null, PHPExcel_Cell $pCell = null) { + public function _calculateFormulaValue($formula, $cellID=null, Cell $pCell = null) { $cellValue = ''; // Basic validation that this is indeed a formula @@ -2576,7 +2567,7 @@ class PHPExcel_Calculation { */ private function _showValue($value) { if ($this->_debugLog->getWriteDebugLog()) { - $testArray = PHPExcel_Calculation_Functions::flattenArray($value); + $testArray = Calculation_Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); } @@ -2599,7 +2590,7 @@ class PHPExcel_Calculation { return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE']; } } - return PHPExcel_Calculation_Functions::flattenSingleValue($value); + return Calculation_Functions::flattenSingleValue($value); } // function _showValue() @@ -2611,7 +2602,7 @@ class PHPExcel_Calculation { */ private function _showTypeDetails($value) { if ($this->_debugLog->getWriteDebugLog()) { - $testArray = PHPExcel_Calculation_Functions::flattenArray($value); + $testArray = Calculation_Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); } @@ -2728,7 +2719,7 @@ class PHPExcel_Calculation { ); // Convert infix to postfix notation - private function _parseFormula($formula, PHPExcel_Cell $pCell = NULL) { + private function _parseFormula($formula, Cell $pCell = NULL) { if (($formula = self::_convertMatrixReferences(trim($formula))) === FALSE) { return FALSE; } @@ -2748,7 +2739,7 @@ class PHPExcel_Calculation { // Start with initialisation $index = 0; - $stack = new PHPExcel_Calculation_Token_Stack; + $stack = new Calculation_Token_Stack; $output = array(); $expectingOperator = FALSE; // We use this test in syntax-checking the expression to determine when a // - is a negation or + is a positive operator rather than an operation @@ -3086,14 +3077,14 @@ class PHPExcel_Calculation { } // evaluate postfix notation - private function _processTokenStack($tokens, $cellID = NULL, PHPExcel_Cell $pCell = NULL) { + private function _processTokenStack($tokens, $cellID = NULL, Cell $pCell = NULL) { if ($tokens == FALSE) return FALSE; // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent cell collection), // so we store the parent cell collection so that we can re-attach it when necessary $pCellWorksheet = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL; $pCellParent = ($pCell !== NULL) ? $pCell->getParent() : null; - $stack = new PHPExcel_Calculation_Token_Stack; + $stack = new Calculation_Token_Stack; // Loop through each token in turn foreach ($tokens as $tokenData) { @@ -3165,11 +3156,11 @@ class PHPExcel_Calculation { $oData = array_merge(explode(':',$operand1Data['reference']),explode(':',$operand2Data['reference'])); $oCol = $oRow = array(); foreach($oData as $oDatum) { - $oCR = PHPExcel_Cell::coordinateFromString($oDatum); - $oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1; + $oCR = Cell::coordinateFromString($oDatum); + $oCol[] = Cell::columnIndexFromString($oCR[0]) - 1; $oRow[] = $oCR[1]; } - $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); + $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); if ($pCellParent !== NULL) { $cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), FALSE); } else { @@ -3177,7 +3168,7 @@ class PHPExcel_Calculation { } $stack->push('Cell Reference',$cellValue,$cellRef); } else { - $stack->push('Error',PHPExcel_Calculation_Functions::REF(),NULL); + $stack->push('Error',Calculation_Functions::REF(),NULL); } break; @@ -3211,11 +3202,11 @@ class PHPExcel_Calculation { self::_checkMatrixOperands($operand1,$operand2,2); try { // Convert operand 1 from a PHP array to a matrix - $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1); + $matrix = new Shared_JAMA_Matrix($operand1); // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->concat($operand2); $result = $matrixResult->getArray(); - } catch (PHPExcel_Exception $ex) { + } catch (Exception $ex) { $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } @@ -3231,11 +3222,11 @@ class PHPExcel_Calculation { foreach(array_keys($rowIntersect) as $row) { $oRow[] = $row; foreach($rowIntersect[$row] as $col => $data) { - $oCol[] = PHPExcel_Cell::columnIndexFromString($col) - 1; + $oCol[] = Cell::columnIndexFromString($col) - 1; $cellIntersect[$row] = array_intersect_key($operand1[$row],$operand2[$row]); } } - $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); + $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($cellIntersect)); $stack->push('Value',$cellIntersect,$cellRef); break; @@ -3258,10 +3249,10 @@ class PHPExcel_Calculation { if (is_array($arg)) { self::_checkMatrixOperands($arg,$multiplier,2); try { - $matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg); + $matrix1 = new Shared_JAMA_Matrix($arg); $matrixResult = $matrix1->arrayTimesEquals($multiplier); $result = $matrixResult->getArray(); - } catch (PHPExcel_Exception $ex) { + } catch (Exception $ex) { $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } @@ -3278,7 +3269,7 @@ class PHPExcel_Calculation { // echo 'Reference is a Range of cells
'; if ($pCell === NULL) { // We can't access the range, so return a REF error - $cellValue = PHPExcel_Calculation_Functions::REF(); + $cellValue = Calculation_Functions::REF(); } else { $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; if ($matches[2] > '') { @@ -3312,7 +3303,7 @@ class PHPExcel_Calculation { // echo 'Reference is a single Cell
'; if ($pCell === NULL) { // We can't access the cell, so return a REF error - $cellValue = PHPExcel_Calculation_Functions::REF(); + $cellValue = Calculation_Functions::REF(); } else { $cellRef = $matches[6].$matches[7]; if ($matches[2] > '') { @@ -3402,7 +3393,7 @@ class PHPExcel_Calculation { if ($functionName != 'MKMATRIX') { if ($this->_debugLog->getWriteDebugLog()) { krsort($argArrayVals); - $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', implode(self::$_localeArgumentSeparator.' ',PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )'); + $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', implode(self::$_localeArgumentSeparator.' ',Calculation_Functions::flattenArray($argArrayVals)), ' )'); } } // Process each argument in turn, building the return value as an array @@ -3436,7 +3427,7 @@ class PHPExcel_Calculation { $result = call_user_func_array(explode('::',$functionCall),$args); } else { foreach($args as &$arg) { - $arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg); + $arg = Calculation_Functions::flattenSingleValue($arg); } unset($arg); $result = call_user_func_array($functionCall,$args); @@ -3479,7 +3470,7 @@ class PHPExcel_Calculation { $output = $output['value']; // if ((is_array($output)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { -// return array_shift(PHPExcel_Calculation_Functions::flattenArray($output)); +// return array_shift(Calculation_Functions::flattenArray($output)); // } return $output; } // function _processTokenStack() @@ -3505,7 +3496,7 @@ class PHPExcel_Calculation { $stack->push('Value', $operand); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($operand)); return FALSE; - } elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) { + } elseif (!Shared_String::convertToNumberIfFraction($operand)) { // If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations $stack->push('Value', '#VALUE!'); $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->_showTypeDetails('#VALUE!')); @@ -3607,18 +3598,18 @@ class PHPExcel_Calculation { try { // Convert operand 1 from a PHP array to a matrix - $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1); + $matrix = new Shared_JAMA_Matrix($operand1); // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->$matrixFunction($operand2); $result = $matrixResult->getArray(); - } catch (PHPExcel_Exception $ex) { + } catch (Exception $ex) { $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } } else { - if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) && + if ((Calculation_Functions::getCompatibilityMode() != Calculation_Functions::COMPATIBILITY_OPENOFFICE) && ((is_string($operand1) && !is_numeric($operand1)) || (is_string($operand2) && !is_numeric($operand2)))) { - $result = PHPExcel_Calculation_Functions::VALUE(); + $result = Calculation_Functions::VALUE(); } else { // If we're dealing with non-matrix operations, execute the necessary operation switch ($operation) { @@ -3665,7 +3656,7 @@ class PHPExcel_Calculation { protected function _raiseFormulaError($errorMessage) { $this->formulaError = $errorMessage; $this->_cyclicReferenceStack->clear(); - if (!$this->suppressFormulaErrors) throw new PHPExcel_Calculation_Exception($errorMessage); + if (!$this->suppressFormulaErrors) throw new Calculation_Exception($errorMessage); trigger_error($errorMessage, E_USER_ERROR); } // function _raiseFormulaError() @@ -3674,12 +3665,12 @@ class PHPExcel_Calculation { * Extract range values * * @param string &$pRange String based range representation - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel\Worksheet $pSheet Worksheet * @param boolean $resetLog Flag indicating whether calculation log should be reset or not * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ - public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) { + public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = NULL, $resetLog = TRUE) { // Return value $returnValue = array (); @@ -3690,14 +3681,14 @@ class PHPExcel_Calculation { // echo 'Range reference is '.$pRange.PHP_EOL; if (strpos ($pRange, '!') !== false) { // echo '$pRange reference includes sheet reference',PHP_EOL; - list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); + list($pSheetName,$pRange) = Worksheet::extractSheetTitle($pRange, true); // echo 'New sheet name is '.$pSheetName,PHP_EOL; // echo 'Adjusted Range reference is '.$pRange,PHP_EOL; $pSheet = $this->_workbook->getSheetByName($pSheetName); } // Extract range - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + $aReferences = Cell::extractAllCellReferencesInRange($pRange); $pRange = $pSheetName.'!'.$pRange; if (!isset($aReferences[1])) { // Single cell in range @@ -3732,12 +3723,12 @@ class PHPExcel_Calculation { * Extract range values * * @param string &$pRange String based range representation - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel\Worksheet $pSheet Worksheet * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. * @param boolean $resetLog Flag indicating whether calculation log should be reset or not - * @throws PHPExcel_Calculation_Exception + * @throws Calculation_Exception */ - public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) { + public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = NULL, $resetLog = TRUE) { // Return value $returnValue = array (); @@ -3748,19 +3739,19 @@ class PHPExcel_Calculation { // echo 'Range reference is '.$pRange.'
'; if (strpos ($pRange, '!') !== false) { // echo '$pRange reference includes sheet reference',PHP_EOL; - list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); + list($pSheetName,$pRange) = Worksheet::extractSheetTitle($pRange, true); // echo 'New sheet name is '.$pSheetName,PHP_EOL; // echo 'Adjusted Range reference is '.$pRange,PHP_EOL; $pSheet = $this->_workbook->getSheetByName($pSheetName); } // Named range? - $namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet); + $namedRange = NamedRange::resolveRange($pRange, $pSheet); if ($namedRange !== NULL) { $pSheet = $namedRange->getWorksheet(); // echo 'Named Range '.$pRange.' ('; $pRange = $namedRange->getRange(); - $splitRange = PHPExcel_Cell::splitRange($pRange); + $splitRange = Cell::splitRange($pRange); // Convert row and column references if (ctype_alpha($splitRange[0][0])) { $pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow(); @@ -3777,15 +3768,15 @@ class PHPExcel_Calculation { // } // } } else { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } // Extract range - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + $aReferences = Cell::extractAllCellReferencesInRange($pRange); // var_dump($aReferences); if (!isset($aReferences[1])) { // Single cell (or single column or row) in range - list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]); + list($currentCol,$currentRow) = Cell::coordinateFromString($aReferences[0]); $cellValue = NULL; if ($pSheet->cellExists($aReferences[0])) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); @@ -3796,7 +3787,7 @@ class PHPExcel_Calculation { // Extract cell data for all cells in the range foreach ($aReferences as $reference) { // Extract range - list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference); + list($currentCol,$currentRow) = Cell::coordinateFromString($reference); // echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'
'; $cellValue = NULL; if ($pSheet->cellExists($reference)) { @@ -3824,7 +3815,7 @@ class PHPExcel_Calculation { public function isImplemented($pFunction = '') { $pFunction = strtoupper ($pFunction); if (isset(self::$_PHPExcelFunctions[$pFunction])) { - return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY'); + return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'Calculation_Functions::DUMMY'); } else { return FALSE; } @@ -3834,15 +3825,15 @@ class PHPExcel_Calculation { /** * Get a list of all implemented functions as an array of function objects * - * @return array of PHPExcel_Calculation_Function + * @return array of Calculation_Function */ public function listFunctions() { // Return value $returnValue = array(); // Loop functions foreach(self::$_PHPExcelFunctions as $functionName => $function) { - if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') { - $returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'], + if ($function['functionCall'] != 'Calculation_Functions::DUMMY') { + $returnValue[$functionName] = new Calculation_Function($function['category'], $functionName, $function['functionCall'] ); @@ -3873,7 +3864,7 @@ class PHPExcel_Calculation { $returnValue = array(); // Loop functions foreach(self::$_PHPExcelFunctions as $functionName => $function) { - if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') { + if ($function['functionCall'] != 'Calculation_Functions::DUMMY') { $returnValue[] = $functionName; } } @@ -3882,5 +3873,4 @@ class PHPExcel_Calculation { return $returnValue; } // function listFunctionNames() -} // class PHPExcel_Calculation - +} diff --git a/Classes/PHPExcel/Calculation/Database.php b/Classes/PHPExcel/Calculation/Database.php index 0d4fabf..b18aa29 100644 --- a/Classes/PHPExcel/Calculation/Database.php +++ b/Classes/PHPExcel/Calculation/Database.php @@ -19,31 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_Database + * PHPExcel\Calculation_Database * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Database { +class Calculation_Database { /** @@ -65,7 +57,7 @@ class PHPExcel_Calculation_Database { * */ private static function __fieldExtract($database,$field) { - $field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field)); + $field = strtoupper(Calculation_Functions::flattenSingleValue($field)); $fieldNames = array_map('strtoupper',array_shift($database)); if (is_numeric($field)) { @@ -107,7 +99,7 @@ class PHPExcel_Calculation_Database { $testConditionCount = 0; foreach($criteria as $row => $criterion) { if ($criterion[$key] > '') { - $testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::_ifCondition($criterion[$key]); + $testCondition[] = '[:'.$criteriaName.']'.Calculation_Functions::_ifCondition($criterion[$key]); $testConditionCount++; } } @@ -134,12 +126,12 @@ class PHPExcel_Calculation_Database { $k = array_search($criteriaName,$fieldNames); if (isset($dataValues[$k])) { $dataValue = $dataValues[$k]; - $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue; + $dataValue = (is_string($dataValue)) ? Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue; $testConditionList = str_replace('[:'.$criteriaName.']',$dataValue,$testConditionList); } } // evaluate the criteria against the row data - $result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); + $result = Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); // If the row failed to meet the criteria, remove it from the database if (!$result) { unset($database[$dataRow]); @@ -191,7 +183,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::AVERAGE($colData); + return Calculation_Statistical::AVERAGE($colData); } // function DAVERAGE() @@ -244,7 +236,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::COUNT($colData); + return Calculation_Statistical::COUNT($colData); } // function DCOUNT() @@ -293,7 +285,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::COUNTA($colData); + return Calculation_Statistical::COUNTA($colData); } // function DCOUNTA() @@ -341,7 +333,7 @@ class PHPExcel_Calculation_Database { // Return if (count($colData) > 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $colData[0]; @@ -391,7 +383,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::MAX($colData); + return Calculation_Statistical::MAX($colData); } // function DMAX() @@ -438,7 +430,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::MIN($colData); + return Calculation_Statistical::MIN($colData); } // function DMIN() @@ -484,7 +476,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_MathTrig::PRODUCT($colData); + return Calculation_MathTrig::PRODUCT($colData); } // function DPRODUCT() @@ -531,7 +523,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::STDEV($colData); + return Calculation_Statistical::STDEV($colData); } // function DSTDEV() @@ -578,7 +570,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::STDEVP($colData); + return Calculation_Statistical::STDEVP($colData); } // function DSTDEVP() @@ -624,7 +616,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_MathTrig::SUM($colData); + return Calculation_MathTrig::SUM($colData); } // function DSUM() @@ -671,7 +663,7 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::VARFunc($colData); + return Calculation_Statistical::VARFunc($colData); } // function DVAR() @@ -718,8 +710,8 @@ class PHPExcel_Calculation_Database { } // Return - return PHPExcel_Calculation_Statistical::VARP($colData); + return Calculation_Statistical::VARP($colData); } // function DVARP() -} // class PHPExcel_Calculation_Database +} diff --git a/Classes/PHPExcel/Calculation/DateTime.php b/Classes/PHPExcel/Calculation/DateTime.php index 364cc9f..04f70bf 100644 --- a/Classes/PHPExcel/Calculation/DateTime.php +++ b/Classes/PHPExcel/Calculation/DateTime.php @@ -19,31 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_DateTime + * PHPExcel\Calculation_DateTime * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_DateTime { +class Calculation_DateTime { /** * Identify if a year is a leap year or not @@ -101,16 +93,16 @@ class PHPExcel_Calculation_DateTime { public static function _getDateValue($dateValue) { if (!is_numeric($dateValue)) { if ((is_string($dateValue)) && - (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) { - return PHPExcel_Calculation_Functions::VALUE(); + (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC)) { + return Calculation_Functions::VALUE(); } if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { - $dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue); + $dateValue = Shared_Date::PHPToExcel($dateValue); } else { - $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveReturnDateType = Calculation_Functions::getReturnDateType(); + Calculation_Functions::setReturnDateType(Calculation_Functions::RETURNDATE_EXCEL); $dateValue = self::DATEVALUE($dateValue); - PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType); + Calculation_Functions::setReturnDateType($saveReturnDateType); } } return $dateValue; @@ -124,17 +116,17 @@ class PHPExcel_Calculation_DateTime { * @return mixed Excel date/time serial value, or string if error */ private static function _getTimeValue($timeValue) { - $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveReturnDateType = Calculation_Functions::getReturnDateType(); + Calculation_Functions::setReturnDateType(Calculation_Functions::RETURNDATE_EXCEL); $timeValue = self::TIMEVALUE($timeValue); - PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType); + Calculation_Functions::setReturnDateType($saveReturnDateType); return $timeValue; } // function _getTimeValue() private static function _adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0) { // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); $oMonth = (int) $PHPDateObject->format('m'); $oYear = (int) $PHPDateObject->format('Y'); @@ -181,14 +173,14 @@ class PHPExcel_Calculation_DateTime { $saveTimeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $retValue = False; - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : - $retValue = (float) PHPExcel_Shared_Date::PHPToExcel(time()); + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : + $retValue = (float) Shared_Date::PHPToExcel(time()); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : $retValue = (integer) time(); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + case Calculation_Functions::RETURNDATE_PHP_OBJECT : $retValue = new DateTime(); break; } @@ -221,16 +213,16 @@ class PHPExcel_Calculation_DateTime { $saveTimeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $retValue = False; - $excelDateTime = floor(PHPExcel_Shared_Date::PHPToExcel(time())); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + $excelDateTime = floor(Shared_Date::PHPToExcel(time())); + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : $retValue = (float) $excelDateTime; break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - $retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + $retValue = (integer) Shared_Date::ExcelToPHP($excelDateTime); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : - $retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : + $retValue = Shared_Date::ExcelToPHPObject($excelDateTime); break; } date_default_timezone_set($saveTimeZone); @@ -290,37 +282,37 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function DATE($year = 0, $month = 1, $day = 1) { - $year = PHPExcel_Calculation_Functions::flattenSingleValue($year); - $month = PHPExcel_Calculation_Functions::flattenSingleValue($month); - $day = PHPExcel_Calculation_Functions::flattenSingleValue($day); + $year = Calculation_Functions::flattenSingleValue($year); + $month = Calculation_Functions::flattenSingleValue($month); + $day = Calculation_Functions::flattenSingleValue($day); if (($month !== NULL) && (!is_numeric($month))) { - $month = PHPExcel_Shared_Date::monthStringToNumber($month); + $month = Shared_Date::monthStringToNumber($month); } if (($day !== NULL) && (!is_numeric($day))) { - $day = PHPExcel_Shared_Date::dayStringToNumber($day); + $day = Shared_Date::dayStringToNumber($day); } - $year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0; - $month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0; - $day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0; + $year = ($year !== NULL) ? Shared_String::testStringAsNumeric($year) : 0; + $month = ($month !== NULL) ? Shared_String::testStringAsNumeric($month) : 0; + $day = ($day !== NULL) ? Shared_String::testStringAsNumeric($day) : 0; if ((!is_numeric($year)) || (!is_numeric($month)) || (!is_numeric($day))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $year = (integer) $year; $month = (integer) $month; $day = (integer) $day; - $baseYear = PHPExcel_Shared_Date::getExcelCalendar(); + $baseYear = Shared_Date::getExcelCalendar(); // Validate parameters if ($year < ($baseYear-1900)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($year < $baseYear) && ($year >= ($baseYear-1900))) { @@ -340,18 +332,18 @@ class PHPExcel_Calculation_DateTime { // Re-validate the year parameter after adjustments if (($year < $baseYear) || ($year >= 10000)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + $excelDateValue = Shared_Date::FormattedPHPToExcel($year, $month, $day); + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : return (float) $excelDateValue; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : - return PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP($excelDateValue); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : + return Shared_Date::ExcelToPHPObject($excelDateValue); } } // function DATE() @@ -384,16 +376,16 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function TIME($hour = 0, $minute = 0, $second = 0) { - $hour = PHPExcel_Calculation_Functions::flattenSingleValue($hour); - $minute = PHPExcel_Calculation_Functions::flattenSingleValue($minute); - $second = PHPExcel_Calculation_Functions::flattenSingleValue($second); + $hour = Calculation_Functions::flattenSingleValue($hour); + $minute = Calculation_Functions::flattenSingleValue($minute); + $second = Calculation_Functions::flattenSingleValue($second); if ($hour == '') { $hour = 0; } if ($minute == '') { $minute = 0; } if ($second == '') { $second = 0; } if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $hour = (integer) $hour; $minute = (integer) $minute; @@ -419,21 +411,21 @@ class PHPExcel_Calculation_DateTime { if ($hour > 23) { $hour = $hour % 24; } elseif ($hour < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : $date = 0; - $calendar = PHPExcel_Shared_Date::getExcelCalendar(); - if ($calendar != PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900) { + $calendar = Shared_Date::getExcelCalendar(); + if ($calendar != Shared_Date::CALENDAR_WINDOWS_1900) { $date = 1; } - return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + return (float) Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP(Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 + case Calculation_Functions::RETURNDATE_PHP_OBJECT : $dayAdjust = 0; if ($hour < 0) { $dayAdjust = floor($hour / 24); @@ -479,7 +471,7 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function DATEVALUE($dateValue = 1) { - $dateValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($dateValue),'"'); + $dateValue = trim(Calculation_Functions::flattenSingleValue($dateValue),'"'); // Strip any ordinals because they're allowed in Excel (English only) $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui','$1$3',$dateValue); // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) @@ -490,7 +482,7 @@ class PHPExcel_Calculation_DateTime { foreach($t1 as &$t) { if ((is_numeric($t)) && ($t > 31)) { if ($yearFound) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } else { if ($t < 100) { $t += 1900; } $yearFound = true; @@ -522,16 +514,16 @@ class PHPExcel_Calculation_DateTime { $testVal3 = strftime('%Y'); } } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) { $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } } @@ -540,21 +532,21 @@ class PHPExcel_Calculation_DateTime { // Execute function if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); } if ($PHPDateArray['year'] < 1900) - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); } if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); } - $excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second'])); + $excelDateValue = floor(Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second'])); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : return (float) $excelDateValue; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP($excelDateValue); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function DATEVALUE() @@ -581,27 +573,27 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function TIMEVALUE($timeValue) { - $timeValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($timeValue),'"'); + $timeValue = trim(Calculation_Functions::flattenSingleValue($timeValue),'"'); $timeValue = str_replace(array('/','.'),array('-','-'),$timeValue); $PHPDateArray = date_parse($timeValue); if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { - $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']); + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + $excelDateValue = Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']); } else { - $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900,1,1,$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']) - 1; + $excelDateValue = Shared_Date::FormattedPHPToExcel(1900,1,1,$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']) - 1; } - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : return (float) $excelDateValue; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) $phpDateValue = Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;; + case Calculation_Functions::RETURNDATE_PHP_OBJECT : return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TIMEVALUE() @@ -616,36 +608,36 @@ class PHPExcel_Calculation_DateTime { * @return integer Interval between the dates */ public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') { - $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate); - $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate); - $unit = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($unit)); + $startDate = Calculation_Functions::flattenSingleValue($startDate); + $endDate = Calculation_Functions::flattenSingleValue($endDate); + $unit = strtoupper(Calculation_Functions::flattenSingleValue($unit)); if (is_string($startDate = self::_getDateValue($startDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_string($endDate = self::_getDateValue($endDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Validate parameters if ($startDate >= $endDate) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function $difference = $endDate - $startDate; - $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); + $PHPStartDateObject = Shared_Date::ExcelToPHPObject($startDate); $startDays = $PHPStartDateObject->format('j'); $startMonths = $PHPStartDateObject->format('n'); $startYears = $PHPStartDateObject->format('Y'); - $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + $PHPEndDateObject = Shared_Date::ExcelToPHPObject($endDate); $endDays = $PHPEndDateObject->format('j'); $endMonths = $PHPEndDateObject->format('n'); $endYears = $PHPEndDateObject->format('Y'); - $retVal = PHPExcel_Calculation_Functions::NaN(); + $retVal = Calculation_Functions::NaN(); switch ($unit) { case 'D': $retVal = intval($difference); @@ -698,7 +690,7 @@ class PHPExcel_Calculation_DateTime { } break; default: - $retVal = PHPExcel_Calculation_Functions::NaN(); + $retVal = Calculation_Functions::NaN(); } return $retVal; } // function DATEDIF() @@ -734,27 +726,27 @@ class PHPExcel_Calculation_DateTime { * @return integer Number of days between start date and end date */ public static function DAYS360($startDate = 0, $endDate = 0, $method = false) { - $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate); - $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate); + $startDate = Calculation_Functions::flattenSingleValue($startDate); + $endDate = Calculation_Functions::flattenSingleValue($endDate); if (is_string($startDate = self::_getDateValue($startDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_string($endDate = self::_getDateValue($endDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (!is_bool($method)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Execute function - $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); + $PHPStartDateObject = Shared_Date::ExcelToPHPObject($startDate); $startDay = $PHPStartDateObject->format('j'); $startMonth = $PHPStartDateObject->format('n'); $startYear = $PHPStartDateObject->format('Y'); - $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + $PHPEndDateObject = Shared_Date::ExcelToPHPObject($endDate); $endDay = $PHPEndDateObject->format('j'); $endMonth = $PHPEndDateObject->format('n'); $endYear = $PHPEndDateObject->format('Y'); @@ -789,15 +781,15 @@ class PHPExcel_Calculation_DateTime { * @return float fraction of the year */ public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) { - $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate); - $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate); - $method = PHPExcel_Calculation_Functions::flattenSingleValue($method); + $startDate = Calculation_Functions::flattenSingleValue($startDate); + $endDate = Calculation_Functions::flattenSingleValue($endDate); + $method = Calculation_Functions::flattenSingleValue($method); if (is_string($startDate = self::_getDateValue($startDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_string($endDate = self::_getDateValue($endDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) { @@ -856,7 +848,7 @@ class PHPExcel_Calculation_DateTime { return self::DAYS360($startDate,$endDate,True) / 360; } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function YEARFRAC() @@ -885,20 +877,20 @@ class PHPExcel_Calculation_DateTime { */ public static function NETWORKDAYS($startDate,$endDate) { // Retrieve the mandatory start and end date that are referenced in the function definition - $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate); - $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate); + $startDate = Calculation_Functions::flattenSingleValue($startDate); + $endDate = Calculation_Functions::flattenSingleValue($endDate); // Flush the mandatory start and end date that are referenced in the function definition, and get the optional days - $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $dateArgs = Calculation_Functions::flattenArray(func_get_args()); array_shift($dateArgs); array_shift($dateArgs); // Validate the start and end dates if (is_string($startDate = $sDate = self::_getDateValue($startDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $startDate = (float) floor($startDate); if (is_string($endDate = $eDate = self::_getDateValue($endDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $endDate = (float) floor($endDate); @@ -923,7 +915,7 @@ class PHPExcel_Calculation_DateTime { $holidayCountedArray = array(); foreach ($dateArgs as $holidayDate) { if (is_string($holidayDate = self::_getDateValue($holidayDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) { if ((self::DAYOFWEEK($holidayDate,2) < 6) && (!in_array($holidayDate,$holidayCountedArray))) { @@ -967,15 +959,15 @@ class PHPExcel_Calculation_DateTime { */ public static function WORKDAY($startDate,$endDays) { // Retrieve the mandatory start date and days that are referenced in the function definition - $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate); - $endDays = PHPExcel_Calculation_Functions::flattenSingleValue($endDays); + $startDate = Calculation_Functions::flattenSingleValue($startDate); + $endDays = Calculation_Functions::flattenSingleValue($endDays); // Flush the mandatory start date and days that are referenced in the function definition, and get the optional days - $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $dateArgs = Calculation_Functions::flattenArray(func_get_args()); array_shift($dateArgs); array_shift($dateArgs); if ((is_string($startDate = self::_getDateValue($startDate))) || (!is_numeric($endDays))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $startDate = (float) floor($startDate); $endDays = (int) floor($endDays); @@ -1007,7 +999,7 @@ class PHPExcel_Calculation_DateTime { foreach ($dateArgs as $holidayDate) { if (($holidayDate !== NULL) && (trim($holidayDate) > '')) { if (is_string($holidayDate = self::_getDateValue($holidayDate))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (self::DAYOFWEEK($holidayDate,3) < 5) { $holidayDates[] = $holidayDate; @@ -1044,13 +1036,13 @@ class PHPExcel_Calculation_DateTime { } } - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : return (float) $endDate; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : - return PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP($endDate); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : + return Shared_Date::ExcelToPHPObject($endDate); } } // function WORKDAY() @@ -1069,18 +1061,18 @@ class PHPExcel_Calculation_DateTime { * @return int Day of the month */ public static function DAYOFMONTH($dateValue = 1) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($dateValue == 0.0) { return 0; } elseif ($dateValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); return (int) $PHPDateObject->format('j'); } // function DAYOFMONTH() @@ -1104,24 +1096,24 @@ class PHPExcel_Calculation_DateTime { * @return int Day of the week value */ public static function DAYOFWEEK($dateValue = 1, $style = 1) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - $style = PHPExcel_Calculation_Functions::flattenSingleValue($style); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); + $style = Calculation_Functions::flattenSingleValue($style); if (!is_numeric($style)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif (($style < 1) || ($style > 3)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $style = floor($style); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); $DoW = $PHPDateObject->format('w'); $firstDay = 1; @@ -1135,7 +1127,7 @@ class PHPExcel_Calculation_DateTime { --$DoW; break; } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_EXCEL) { // Test for Excel's 1900 leap year, and introduce the error as required if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) { --$DoW; @@ -1170,24 +1162,24 @@ class PHPExcel_Calculation_DateTime { * @return int Week Number */ public static function WEEKOFYEAR($dateValue = 1, $method = 1) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - $method = PHPExcel_Calculation_Functions::flattenSingleValue($method); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); + $method = Calculation_Functions::flattenSingleValue($method); if (!is_numeric($method)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif (($method < 1) || ($method > 2)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $method = floor($method); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); $dayOfYear = $PHPDateObject->format('z'); $dow = $PHPDateObject->format('w'); $PHPDateObject->modify('-'.$dayOfYear.' days'); @@ -1214,16 +1206,16 @@ class PHPExcel_Calculation_DateTime { * @return int Month of the year */ public static function MONTHOFYEAR($dateValue = 1) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); return (int) $PHPDateObject->format('n'); } // function MONTHOFYEAR() @@ -1243,16 +1235,16 @@ class PHPExcel_Calculation_DateTime { * @return int Year */ public static function YEAR($dateValue = 1) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = Shared_Date::ExcelToPHPObject($dateValue); return (int) $PHPDateObject->format('Y'); } // function YEAR() @@ -1272,27 +1264,27 @@ class PHPExcel_Calculation_DateTime { * @return int Hour */ public static function HOUROFDAY($timeValue = 0) { - $timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue); + $timeValue = Calculation_Functions::flattenSingleValue($timeValue); if (!is_numeric($timeValue)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $testVal = strtok($timeValue,'/-: '); if (strlen($testVal) < strlen($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $timeValue = self::_getTimeValue($timeValue); if (is_string($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } // Execute function if ($timeValue >= 1) { $timeValue = fmod($timeValue,1); } elseif ($timeValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + $timeValue = Shared_Date::ExcelToPHP($timeValue); return (int) gmdate('G',$timeValue); } // function HOUROFDAY() @@ -1312,27 +1304,27 @@ class PHPExcel_Calculation_DateTime { * @return int Minute */ public static function MINUTEOFHOUR($timeValue = 0) { - $timeValue = $timeTester = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue); + $timeValue = $timeTester = Calculation_Functions::flattenSingleValue($timeValue); if (!is_numeric($timeValue)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $testVal = strtok($timeValue,'/-: '); if (strlen($testVal) < strlen($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $timeValue = self::_getTimeValue($timeValue); if (is_string($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } // Execute function if ($timeValue >= 1) { $timeValue = fmod($timeValue,1); } elseif ($timeValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + $timeValue = Shared_Date::ExcelToPHP($timeValue); return (int) gmdate('i',$timeValue); } // function MINUTEOFHOUR() @@ -1352,27 +1344,27 @@ class PHPExcel_Calculation_DateTime { * @return int Second */ public static function SECONDOFMINUTE($timeValue = 0) { - $timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue); + $timeValue = Calculation_Functions::flattenSingleValue($timeValue); if (!is_numeric($timeValue)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $testVal = strtok($timeValue,'/-: '); if (strlen($testVal) < strlen($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $timeValue = self::_getTimeValue($timeValue); if (is_string($timeValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } // Execute function if ($timeValue >= 1) { $timeValue = fmod($timeValue,1); } elseif ($timeValue < 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + $timeValue = Shared_Date::ExcelToPHP($timeValue); return (int) gmdate('s',$timeValue); } // function SECONDOFMINUTE() @@ -1398,27 +1390,27 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function EDATE($dateValue = 1, $adjustmentMonths = 0) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - $adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); + $adjustmentMonths = Calculation_Functions::flattenSingleValue($adjustmentMonths); if (!is_numeric($adjustmentMonths)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $adjustmentMonths = floor($adjustmentMonths); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Execute function $PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : - return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : + return (float) Shared_Date::PHPToExcel($PHPDateObject); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP(Shared_Date::PHPToExcel($PHPDateObject)); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : return $PHPDateObject; } } // function EDATE() @@ -1443,16 +1435,16 @@ class PHPExcel_Calculation_DateTime { * depending on the value of the ReturnDateType flag */ public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) { - $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - $adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths); + $dateValue = Calculation_Functions::flattenSingleValue($dateValue); + $adjustmentMonths = Calculation_Functions::flattenSingleValue($adjustmentMonths); if (!is_numeric($adjustmentMonths)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $adjustmentMonths = floor($adjustmentMonths); if (is_string($dateValue = self::_getDateValue($dateValue))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Execute function @@ -1461,15 +1453,15 @@ class PHPExcel_Calculation_DateTime { $adjustDaysString = '-'.$adjustDays.' days'; $PHPDateObject->modify($adjustDaysString); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL : - return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC : - return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT : + switch (Calculation_Functions::getReturnDateType()) { + case Calculation_Functions::RETURNDATE_EXCEL : + return (float) Shared_Date::PHPToExcel($PHPDateObject); + case Calculation_Functions::RETURNDATE_PHP_NUMERIC : + return (integer) Shared_Date::ExcelToPHP(Shared_Date::PHPToExcel($PHPDateObject)); + case Calculation_Functions::RETURNDATE_PHP_OBJECT : return $PHPDateObject; } } // function EOMONTH() -} // class PHPExcel_Calculation_DateTime +} diff --git a/Classes/PHPExcel/Calculation/Engineering.php b/Classes/PHPExcel/Calculation/Engineering.php index 85a65ca..4d7bc77 100644 --- a/Classes/PHPExcel/Calculation/Engineering.php +++ b/Classes/PHPExcel/Calculation/Engineering.php @@ -19,35 +19,27 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** EULER */ define('EULER', 2.71828182845904523536); /** - * PHPExcel_Calculation_Engineering + * PHPExcel\Calculation_Engineering * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Engineering { +class Calculation_Engineering { /** * Details of the Units of measure that can be used in CONVERTUOM() @@ -766,7 +758,7 @@ class PHPExcel_Calculation_Engineering { if (strlen($xVal) <= $places) { return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10); } else { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } @@ -794,17 +786,17 @@ class PHPExcel_Calculation_Engineering { * */ public static function BESSELI($x, $ord) { - $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x); - $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord); + $x = (is_null($x)) ? 0.0 : Calculation_Functions::flattenSingleValue($x); + $ord = (is_null($ord)) ? 0.0 : Calculation_Functions::flattenSingleValue($ord); if ((is_numeric($x)) && (is_numeric($ord))) { $ord = floor($ord); if ($ord < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (abs($x) <= 30) { - $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord); + $fResult = $fTerm = pow($x / 2, $ord) / Calculation_MathTrig::FACT($ord); $ordK = 1; $fSqrX = ($x * $x) / 4; do { @@ -821,9 +813,9 @@ class PHPExcel_Calculation_Engineering { $fResult = -$fResult; } } - return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult; + return (is_nan($fResult)) ? Calculation_Functions::NaN() : $fResult; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BESSELI() @@ -846,18 +838,18 @@ class PHPExcel_Calculation_Engineering { * */ public static function BESSELJ($x, $ord) { - $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x); - $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord); + $x = (is_null($x)) ? 0.0 : Calculation_Functions::flattenSingleValue($x); + $ord = (is_null($ord)) ? 0.0 : Calculation_Functions::flattenSingleValue($ord); if ((is_numeric($x)) && (is_numeric($ord))) { $ord = floor($ord); if ($ord < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $fResult = 0; if (abs($x) <= 30) { - $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord); + $fResult = $fTerm = pow($x / 2, $ord) / Calculation_MathTrig::FACT($ord); $ordK = 1; $fSqrX = ($x * $x) / -4; do { @@ -875,9 +867,9 @@ class PHPExcel_Calculation_Engineering { $fResult = -$fResult; } } - return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult; + return (is_nan($fResult)) ? Calculation_Functions::NaN() : $fResult; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BESSELJ() @@ -935,12 +927,12 @@ class PHPExcel_Calculation_Engineering { * */ public static function BESSELK($x, $ord) { - $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x); - $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord); + $x = (is_null($x)) ? 0.0 : Calculation_Functions::flattenSingleValue($x); + $ord = (is_null($ord)) ? 0.0 : Calculation_Functions::flattenSingleValue($ord); if ((is_numeric($x)) && (is_numeric($ord))) { if (($ord < 0) || ($x == 0.0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } switch(floor($ord)) { @@ -957,9 +949,9 @@ class PHPExcel_Calculation_Engineering { $fBk = $fBkp; } } - return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk; + return (is_nan($fBk)) ? Calculation_Functions::NaN() : $fBk; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BESSELK() @@ -1015,12 +1007,12 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function BESSELY($x, $ord) { - $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x); - $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord); + $x = (is_null($x)) ? 0.0 : Calculation_Functions::flattenSingleValue($x); + $ord = (is_null($ord)) ? 0.0 : Calculation_Functions::flattenSingleValue($ord); if ((is_numeric($x)) && (is_numeric($ord))) { if (($ord < 0) || ($x == 0.0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } switch(floor($ord)) { @@ -1037,9 +1029,9 @@ class PHPExcel_Calculation_Engineering { $fBy = $fByp; } } - return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy; + return (is_nan($fBy)) ? Calculation_Functions::NaN() : $fBy; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BESSELY() @@ -1062,24 +1054,24 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function BINTODEC($x) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); + $x = Calculation_Functions::flattenSingleValue($x); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $x = floor($x); } $x = (string) $x; if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (strlen($x) > 10) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (strlen($x) == 10) { // Two's Complement $x = substr($x,-9); @@ -1114,25 +1106,25 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function BINTOHEX($x, $places=NULL) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $x = floor($x); } $x = (string) $x; if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (strlen($x) > 10) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (strlen($x) == 10) { // Two's Complement return str_repeat('F',8).substr(strtoupper(dechex(bindec(substr($x,-9)))),-2); @@ -1168,25 +1160,25 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function BINTOOCT($x, $places=NULL) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $x = floor($x); } $x = (string) $x; if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (strlen($x) > 10) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (strlen($x) == 10) { // Two's Complement return str_repeat('7',7).substr(strtoupper(decoct(bindec(substr($x,-9)))),-3); @@ -1226,19 +1218,19 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function DECTOBIN($x, $places=NULL) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $x = (string) $x; if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) floor($x); $r = decbin($x); @@ -1246,7 +1238,7 @@ class PHPExcel_Calculation_Engineering { // Two's Complement $r = substr($r,-10); } elseif (strlen($r) > 11) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::_nbrConversionFormat($r,$places); @@ -1282,19 +1274,19 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function DECTOHEX($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $x = (string) $x; if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) floor($x); $r = strtoupper(dechex($x)); @@ -1336,19 +1328,19 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function DECTOOCT($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $x = (int) $x; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } $x = (string) $x; if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) floor($x); $r = decoct($x); @@ -1393,15 +1385,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function HEXTOBIN($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $binVal = decbin(hexdec($x)); @@ -1429,14 +1421,14 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function HEXTODEC($x) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); + $x = Calculation_Functions::flattenSingleValue($x); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return hexdec($x); } // function HEXTODEC() @@ -1475,15 +1467,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function HEXTOOCT($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $octVal = decoct(hexdec($x)); @@ -1526,15 +1518,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function OCTTOBIN($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $r = decbin(octdec($x)); @@ -1562,14 +1554,14 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function OCTTODEC($x) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); + $x = Calculation_Functions::flattenSingleValue($x); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return octdec($x); } // function OCTTODEC() @@ -1605,15 +1597,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function OCTTOHEX($x, $places=null) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $places = PHPExcel_Calculation_Functions::flattenSingleValue($places); + $x = Calculation_Functions::flattenSingleValue($x); + $places = Calculation_Functions::flattenSingleValue($places); if (is_bool($x)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = (string) $x; if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $hexVal = strtoupper(dechex(octdec($x))); @@ -1638,9 +1630,9 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i') { - $realNumber = (is_null($realNumber)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($realNumber); - $imaginary = (is_null($imaginary)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($imaginary); - $suffix = (is_null($suffix)) ? 'i' : PHPExcel_Calculation_Functions::flattenSingleValue($suffix); + $realNumber = (is_null($realNumber)) ? 0.0 : Calculation_Functions::flattenSingleValue($realNumber); + $imaginary = (is_null($imaginary)) ? 0.0 : Calculation_Functions::flattenSingleValue($imaginary); + $suffix = (is_null($suffix)) ? 'i' : Calculation_Functions::flattenSingleValue($suffix); if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && (($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) { @@ -1668,7 +1660,7 @@ class PHPExcel_Calculation_Engineering { return (string) $realNumber.$imaginary.$suffix; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function COMPLEX() @@ -1687,7 +1679,7 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function IMAGINARY($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); return $parsedComplex['imaginary']; @@ -1708,7 +1700,7 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function IMREAL($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); return $parsedComplex['real']; @@ -1727,7 +1719,7 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function IMABS($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1748,7 +1740,7 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function IMARGUMENT($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1782,7 +1774,7 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMCONJUGATE($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1810,7 +1802,7 @@ class PHPExcel_Calculation_Engineering { * @return string|float */ public static function IMCOS($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1834,7 +1826,7 @@ class PHPExcel_Calculation_Engineering { * @return string|float */ public static function IMSIN($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1858,7 +1850,7 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMSQRT($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -1887,12 +1879,12 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMLN($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']))); @@ -1918,12 +1910,12 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMLOG10($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { return log10($parsedComplex['real']); } @@ -1944,12 +1936,12 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMLOG2($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { return log($parsedComplex['real'],2); } @@ -1970,7 +1962,7 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMEXP($complexNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); $parsedComplex = self::_parseComplex($complexNumber); @@ -2003,11 +1995,11 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMPOWER($complexNumber,$realNumber) { - $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); - $realNumber = PHPExcel_Calculation_Functions::flattenSingleValue($realNumber); + $complexNumber = Calculation_Functions::flattenSingleValue($complexNumber); + $realNumber = Calculation_Functions::flattenSingleValue($realNumber); if (!is_numeric($realNumber)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $parsedComplex = self::_parseComplex($complexNumber); @@ -2038,15 +2030,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMDIV($complexDividend,$complexDivisor) { - $complexDividend = PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend); - $complexDivisor = PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor); + $complexDividend = Calculation_Functions::flattenSingleValue($complexDividend); + $complexDivisor = Calculation_Functions::flattenSingleValue($complexDivisor); $parsedComplexDividend = self::_parseComplex($complexDividend); $parsedComplexDivisor = self::_parseComplex($complexDivisor); if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') && ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) { $parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix']; @@ -2082,15 +2074,15 @@ class PHPExcel_Calculation_Engineering { * @return string */ public static function IMSUB($complexNumber1,$complexNumber2) { - $complexNumber1 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1); - $complexNumber2 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2); + $complexNumber1 = Calculation_Functions::flattenSingleValue($complexNumber1); + $complexNumber2 = Calculation_Functions::flattenSingleValue($complexNumber2); $parsedComplex1 = self::_parseComplex($complexNumber1); $parsedComplex2 = self::_parseComplex($complexNumber2); if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) && ($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) { $parsedComplex1['suffix'] = $parsedComplex2['suffix']; } @@ -2119,14 +2111,14 @@ class PHPExcel_Calculation_Engineering { $activeSuffix = ''; // Loop through the arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { $parsedComplex = self::_parseComplex($arg); if ($activeSuffix == '') { $activeSuffix = $parsedComplex['suffix']; } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $returnValue['real'] += $parsedComplex['real']; @@ -2155,7 +2147,7 @@ class PHPExcel_Calculation_Engineering { $activeSuffix = ''; // Loop through the arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { $parsedComplex = self::_parseComplex($arg); @@ -2163,7 +2155,7 @@ class PHPExcel_Calculation_Engineering { if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) { $activeSuffix = $parsedComplex['suffix']; } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']); $returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']); @@ -2190,8 +2182,8 @@ class PHPExcel_Calculation_Engineering { * @return int */ public static function DELTA($a, $b=0) { - $a = PHPExcel_Calculation_Functions::flattenSingleValue($a); - $b = PHPExcel_Calculation_Functions::flattenSingleValue($b); + $a = Calculation_Functions::flattenSingleValue($a); + $b = Calculation_Functions::flattenSingleValue($b); return (int) ($a == $b); } // function DELTA() @@ -2213,8 +2205,8 @@ class PHPExcel_Calculation_Engineering { * @return int */ public static function GESTEP($number, $step=0) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $step = PHPExcel_Calculation_Functions::flattenSingleValue($step); + $number = Calculation_Functions::flattenSingleValue($number); + $step = Calculation_Functions::flattenSingleValue($step); return (int) ($number >= $step); } // function GESTEP() @@ -2266,8 +2258,8 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function ERF($lower, $upper = NULL) { - $lower = PHPExcel_Calculation_Functions::flattenSingleValue($lower); - $upper = PHPExcel_Calculation_Functions::flattenSingleValue($upper); + $lower = Calculation_Functions::flattenSingleValue($lower); + $upper = Calculation_Functions::flattenSingleValue($upper); if (is_numeric($lower)) { if (is_null($upper)) { @@ -2277,7 +2269,7 @@ class PHPExcel_Calculation_Engineering { return self::_erfVal($upper) - self::_erfVal($lower); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ERF() @@ -2330,12 +2322,12 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function ERFC($x) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); + $x = Calculation_Functions::flattenSingleValue($x); if (is_numeric($x)) { return self::_erfcVal($x); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ERFC() @@ -2419,12 +2411,12 @@ class PHPExcel_Calculation_Engineering { * @return float */ public static function CONVERTUOM($value, $fromUOM, $toUOM) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $fromUOM = PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM); - $toUOM = PHPExcel_Calculation_Functions::flattenSingleValue($toUOM); + $value = Calculation_Functions::flattenSingleValue($value); + $fromUOM = Calculation_Functions::flattenSingleValue($fromUOM); + $toUOM = Calculation_Functions::flattenSingleValue($toUOM); if (!is_numeric($value)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $fromMultiplier = 1.0; if (isset(self::$_conversionUnits[$fromUOM])) { @@ -2435,12 +2427,12 @@ class PHPExcel_Calculation_Engineering { if (isset(self::$_conversionMultipliers[$fromMultiplier])) { $fromMultiplier = self::$_conversionMultipliers[$fromMultiplier]['multiplier']; } else { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } if ((isset(self::$_conversionUnits[$fromUOM])) && (self::$_conversionUnits[$fromUOM]['AllowPrefix'])) { $unitGroup1 = self::$_conversionUnits[$fromUOM]['Group']; } else { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } } $value *= $fromMultiplier; @@ -2454,16 +2446,16 @@ class PHPExcel_Calculation_Engineering { if (isset(self::$_conversionMultipliers[$toMultiplier])) { $toMultiplier = self::$_conversionMultipliers[$toMultiplier]['multiplier']; } else { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } if ((isset(self::$_conversionUnits[$toUOM])) && (self::$_conversionUnits[$toUOM]['AllowPrefix'])) { $unitGroup2 = self::$_conversionUnits[$toUOM]['Group']; } else { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } } if ($unitGroup1 != $unitGroup2) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) { @@ -2502,4 +2494,4 @@ class PHPExcel_Calculation_Engineering { return ($value * self::$_unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier; } // function CONVERTUOM() -} // class PHPExcel_Calculation_Engineering +} diff --git a/Classes/PHPExcel/Calculation/Exception.php b/Classes/PHPExcel/Calculation/Exception.php index 7666f2f..50e28d4 100644 --- a/Classes/PHPExcel/Calculation/Exception.php +++ b/Classes/PHPExcel/Calculation/Exception.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -27,13 +27,13 @@ /** - * PHPExcel_Calculation_Exception + * PHPExcel\Calculation_Exception * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Exception extends PHPExcel_Exception { +class Calculation_Exception extends Exception { /** * Error handler callback * diff --git a/Classes/PHPExcel/Calculation/ExceptionHandler.php b/Classes/PHPExcel/Calculation/ExceptionHandler.php index c114875..0858ea1 100644 --- a/Classes/PHPExcel/Calculation/ExceptionHandler.php +++ b/Classes/PHPExcel/Calculation/ExceptionHandler.php @@ -19,25 +19,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ /** - * PHPExcel_Calculation_ExceptionHandler + * PHPExcel\Calculation_ExceptionHandler * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_ExceptionHandler { +class Calculation_ExceptionHandler { /** * Register errorhandler */ public function __construct() { - set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL); + set_error_handler(array(__NAMESPACE__ . '\Calculation_Exception', 'errorHandlerCallback'), E_ALL); } /** diff --git a/Classes/PHPExcel/Calculation/Financial.php b/Classes/PHPExcel/Calculation/Financial.php index 8d359d8..14d5be3 100644 --- a/Classes/PHPExcel/Calculation/Financial.php +++ b/Classes/PHPExcel/Calculation/Financial.php @@ -19,22 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** FINANCIAL_MAX_ITERATIONS */ define('FINANCIAL_MAX_ITERATIONS', 128); @@ -44,13 +36,13 @@ define('FINANCIAL_PRECISION', 1.0e-08); /** - * PHPExcel_Calculation_Financial + * PHPExcel\Calculation_Financial * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Financial { +class Calculation_Financial { /** * _lastDayOfMonth @@ -84,10 +76,10 @@ class PHPExcel_Calculation_Financial { { $months = 12 / $frequency; - $result = PHPExcel_Shared_Date::ExcelToPHPObject($maturity); + $result = Shared_Date::ExcelToPHPObject($maturity); $eom = self::_lastDayOfMonth($result); - while ($settlement < PHPExcel_Shared_Date::PHPToExcel($result)) { + while ($settlement < Shared_Date::PHPToExcel($result)) { $result->modify('-'.$months.' months'); } if ($next) { @@ -98,7 +90,7 @@ class PHPExcel_Calculation_Financial { $result->modify('-1 day'); } - return PHPExcel_Shared_Date::PHPToExcel($result); + return Shared_Date::PHPToExcel($result); } // function _coupFirstPeriodDate() @@ -107,7 +99,7 @@ class PHPExcel_Calculation_Financial { if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) { return true; } - if ((PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) && + if ((Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) && (($frequency == 6) || ($frequency == 12))) { return true; } @@ -141,10 +133,10 @@ class PHPExcel_Calculation_Financial { $daysPerYear = 365; break; case 1 : - $daysPerYear = (PHPExcel_Calculation_DateTime::_isLeapYear($year)) ? 366 : 365; + $daysPerYear = (Calculation_DateTime::_isLeapYear($year)) ? 366 : 365; break; default : - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $daysPerYear; } // function _daysPerYear() @@ -200,22 +192,22 @@ class PHPExcel_Calculation_Financial { */ public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par=1000, $frequency=1, $basis=0) { - $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue); - $firstinterest = PHPExcel_Calculation_Functions::flattenSingleValue($firstinterest); - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par); - $frequency = (is_null($frequency)) ? 1 : PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $issue = Calculation_Functions::flattenSingleValue($issue); + $firstinterest = Calculation_Functions::flattenSingleValue($firstinterest); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $rate = Calculation_Functions::flattenSingleValue($rate); + $par = (is_null($par)) ? 1000 : Calculation_Functions::flattenSingleValue($par); + $frequency = (is_null($frequency)) ? 1 : Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($rate)) && (is_numeric($par))) { $rate = (float) $rate; $par = (float) $par; if (($rate <= 0) || ($par <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; @@ -223,7 +215,7 @@ class PHPExcel_Calculation_Financial { return $par * $rate * $daysBetweenIssueAndSettlement; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ACCRINT() @@ -251,27 +243,27 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function ACCRINTM($issue, $settlement, $rate, $par=1000, $basis=0) { - $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue); - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par); - $basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $issue = Calculation_Functions::flattenSingleValue($issue); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $rate = Calculation_Functions::flattenSingleValue($rate); + $par = (is_null($par)) ? 1000 : Calculation_Functions::flattenSingleValue($par); + $basis = (is_null($basis)) ? 0 : Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($rate)) && (is_numeric($par))) { $rate = (float) $rate; $par = (float) $par; if (($rate <= 0) || ($par <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } return $par * $rate * $daysBetweenIssueAndSettlement; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ACCRINTM() @@ -307,13 +299,13 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased); - $firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $period = floor(PHPExcel_Calculation_Functions::flattenSingleValue($period)); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $cost = Calculation_Functions::flattenSingleValue($cost); + $purchased = Calculation_Functions::flattenSingleValue($purchased); + $firstPeriod = Calculation_Functions::flattenSingleValue($firstPeriod); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $period = floor(Calculation_Functions::flattenSingleValue($period)); + $rate = Calculation_Functions::flattenSingleValue($rate); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); // The depreciation coefficients are: // Life of assets (1/rate) Depreciation coefficient @@ -333,7 +325,7 @@ class PHPExcel_Calculation_Financial { } $rate *= $amortiseCoeff; - $fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost,0); + $fNRate = round(Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost,0); $cost -= $fNRate; $fRest = $cost - $salvage; @@ -383,21 +375,21 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased); - $firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $period = PHPExcel_Calculation_Functions::flattenSingleValue($period); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $cost = Calculation_Functions::flattenSingleValue($cost); + $purchased = Calculation_Functions::flattenSingleValue($purchased); + $firstPeriod = Calculation_Functions::flattenSingleValue($firstPeriod); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $period = Calculation_Functions::flattenSingleValue($period); + $rate = Calculation_Functions::flattenSingleValue($rate); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); $fOneRate = $cost * $rate; $fCostDelta = $cost - $salvage; // Note, quirky variation for leap years on the YEARFRAC for this function - $purchasedYear = PHPExcel_Calculation_DateTime::YEAR($purchased); - $yearFrac = PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis); + $purchasedYear = Calculation_DateTime::YEAR($purchased); + $yearFrac = Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis); - if (($basis == 1) && ($yearFrac < 1) && (PHPExcel_Calculation_DateTime::_isLeapYear($purchasedYear))) { + if (($basis == 1) && ($yearFrac < 1) && (Calculation_DateTime::_isLeapYear($purchasedYear))) { $yearFrac *= 365 / 366; } @@ -449,28 +441,28 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function COUPDAYBS($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($settlement),$basis); $prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False); - return PHPExcel_Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear; + return Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear; } // function COUPDAYBS() @@ -507,22 +499,22 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function COUPDAYS($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } switch ($basis) { @@ -530,7 +522,7 @@ class PHPExcel_Calculation_Financial { return 365 / $frequency; case 1: // Actual/actual if ($frequency == 1) { - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($maturity),$basis); return ($daysPerYear / $frequency); } else { $prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False); @@ -540,7 +532,7 @@ class PHPExcel_Calculation_Financial { default: // US (NASD) 30/360, Actual/360 or European 30/360 return 360 / $frequency; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function COUPDAYS() @@ -577,28 +569,28 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($settlement),$basis); $next = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True); - return PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear; + return Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear; } // function COUPDAYSNC() @@ -636,22 +628,22 @@ class PHPExcel_Calculation_Financial { * depending on the value of the ReturnDateType flag */ public static function COUPNCD($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True); @@ -692,26 +684,26 @@ class PHPExcel_Calculation_Financial { * @return integer */ public static function COUPNUM($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $settlement = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True); - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis) * 365; + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis) * 365; switch ($frequency) { case 1: // annual payments @@ -725,7 +717,7 @@ class PHPExcel_Calculation_Financial { case 12: // monthly return ceil($daysBetweenSettlementAndMaturity / 30); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function COUPNUM() @@ -763,22 +755,22 @@ class PHPExcel_Calculation_Financial { * depending on the value of the ReturnDateType flag */ public static function COUPPCD($settlement, $maturity, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False); @@ -807,19 +799,19 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start); - $end = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end); - $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $nper = (int) Calculation_Functions::flattenSingleValue($nper); + $pv = Calculation_Functions::flattenSingleValue($pv); + $start = (int) Calculation_Functions::flattenSingleValue($start); + $end = (int) Calculation_Functions::flattenSingleValue($end); + $type = (int) Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($start < 1 || $start > $end) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Calculate @@ -854,19 +846,19 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start); - $end = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end); - $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $nper = (int) Calculation_Functions::flattenSingleValue($nper); + $pv = Calculation_Functions::flattenSingleValue($pv); + $start = (int) Calculation_Functions::flattenSingleValue($start); + $end = (int) Calculation_Functions::flattenSingleValue($end); + $type = (int) Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($start < 1 || $start > $end) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Calculate @@ -906,11 +898,11 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function DB($cost, $salvage, $life, $period, $month=12) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $life = PHPExcel_Calculation_Functions::flattenSingleValue($life); - $period = PHPExcel_Calculation_Functions::flattenSingleValue($period); - $month = PHPExcel_Calculation_Functions::flattenSingleValue($month); + $cost = Calculation_Functions::flattenSingleValue($cost); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $life = Calculation_Functions::flattenSingleValue($life); + $period = Calculation_Functions::flattenSingleValue($period); + $month = Calculation_Functions::flattenSingleValue($month); // Validate if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) { @@ -922,7 +914,7 @@ class PHPExcel_Calculation_Financial { if ($cost == 0) { return 0.0; } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Set Fixed Depreciation Rate $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); @@ -940,12 +932,12 @@ class PHPExcel_Calculation_Financial { } $previousDepreciation += $depreciation; } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $depreciation = round($depreciation,2); } return $depreciation; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function DB() @@ -973,11 +965,11 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function DDB($cost, $salvage, $life, $period, $factor=2.0) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $life = PHPExcel_Calculation_Functions::flattenSingleValue($life); - $period = PHPExcel_Calculation_Functions::flattenSingleValue($period); - $factor = PHPExcel_Calculation_Functions::flattenSingleValue($factor); + $cost = Calculation_Functions::flattenSingleValue($cost); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $life = Calculation_Functions::flattenSingleValue($life); + $period = Calculation_Functions::flattenSingleValue($period); + $factor = Calculation_Functions::flattenSingleValue($factor); // Validate if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) { @@ -987,7 +979,7 @@ class PHPExcel_Calculation_Financial { $period = (int) $period; $factor = (float) $factor; if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Set Fixed Depreciation Rate $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); @@ -999,12 +991,12 @@ class PHPExcel_Calculation_Financial { $depreciation = min( ($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation) ); $previousDepreciation += $depreciation; } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { $depreciation = round($depreciation,2); } return $depreciation; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function DDB() @@ -1034,11 +1026,11 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function DISC($settlement, $maturity, $price, $redemption, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $price = PHPExcel_Calculation_Functions::flattenSingleValue($price); - $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption); - $basis = PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $price = Calculation_Functions::flattenSingleValue($price); + $redemption = Calculation_Functions::flattenSingleValue($redemption); + $basis = Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) { @@ -1046,9 +1038,9 @@ class PHPExcel_Calculation_Financial { $redemption = (float) $redemption; $basis = (int) $basis; if (($price <= 0) || ($redemption <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -1056,7 +1048,7 @@ class PHPExcel_Calculation_Financial { return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function DISC() @@ -1077,15 +1069,15 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function DOLLARDE($fractional_dollar = Null, $fraction = 0) { - $fractional_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar); - $fraction = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction); + $fractional_dollar = Calculation_Functions::flattenSingleValue($fractional_dollar); + $fraction = (int)Calculation_Functions::flattenSingleValue($fraction); // Validate parameters if (is_null($fractional_dollar) || $fraction < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($fraction == 0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $dollars = floor($fractional_dollar); @@ -1113,15 +1105,15 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function DOLLARFR($decimal_dollar = Null, $fraction = 0) { - $decimal_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar); - $fraction = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction); + $decimal_dollar = Calculation_Functions::flattenSingleValue($decimal_dollar); + $fraction = (int)Calculation_Functions::flattenSingleValue($fraction); // Validate parameters if (is_null($decimal_dollar) || $fraction < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($fraction == 0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $dollars = floor($decimal_dollar); @@ -1148,12 +1140,12 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function EFFECT($nominal_rate = 0, $npery = 0) { - $nominal_rate = PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate); - $npery = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery); + $nominal_rate = Calculation_Functions::flattenSingleValue($nominal_rate); + $npery = (int)Calculation_Functions::flattenSingleValue($npery); // Validate parameters if ($nominal_rate <= 0 || $npery < 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return pow((1 + $nominal_rate / $npery), $npery) - 1; @@ -1183,15 +1175,15 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $type = PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $nper = Calculation_Functions::flattenSingleValue($nper); + $pmt = Calculation_Functions::flattenSingleValue($pmt); + $pv = Calculation_Functions::flattenSingleValue($pv); + $type = Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Calculate @@ -1217,8 +1209,8 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function FVSCHEDULE($principal, $schedule) { - $principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal); - $schedule = PHPExcel_Calculation_Functions::flattenArray($schedule); + $principal = Calculation_Functions::flattenSingleValue($principal); + $schedule = Calculation_Functions::flattenArray($schedule); foreach($schedule as $rate) { $principal *= 1 + $rate; @@ -1251,11 +1243,11 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $investment = PHPExcel_Calculation_Functions::flattenSingleValue($investment); - $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption); - $basis = PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $investment = Calculation_Functions::flattenSingleValue($investment); + $redemption = Calculation_Functions::flattenSingleValue($redemption); + $basis = Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) { @@ -1263,9 +1255,9 @@ class PHPExcel_Calculation_Financial { $redemption = (float) $redemption; $basis = (int) $basis; if (($investment <= 0) || ($redemption <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -1273,7 +1265,7 @@ class PHPExcel_Calculation_Financial { return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function INTRATE() @@ -1294,19 +1286,19 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $per = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per); - $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $per = (int) Calculation_Functions::flattenSingleValue($per); + $nper = (int) Calculation_Functions::flattenSingleValue($nper); + $pv = Calculation_Functions::flattenSingleValue($pv); + $fv = Calculation_Functions::flattenSingleValue($fv); + $type = (int) Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($per <= 0 || $per > $nper) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Calculate @@ -1334,9 +1326,9 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function IRR($values, $guess = 0.1) { - if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); - $values = PHPExcel_Calculation_Functions::flattenArray($values); - $guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess); + if (!is_array($values)) return Calculation_Functions::VALUE(); + $values = Calculation_Functions::flattenArray($values); + $guess = Calculation_Functions::flattenSingleValue($guess); // create an initial range, with a root somewhere between 0 and guess $x1 = 0.0; @@ -1351,7 +1343,7 @@ class PHPExcel_Calculation_Financial { $f2 = self::NPV($x2 += 1.6 * ($x2 - $x1), $values); } } - if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE(); + if (($f1 * $f2) > 0.0) return Calculation_Functions::VALUE(); $f = self::NPV($x1, $values); if ($f < 0.0) { @@ -1371,7 +1363,7 @@ class PHPExcel_Calculation_Financial { if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function IRR() @@ -1396,7 +1388,7 @@ class PHPExcel_Calculation_Financial { $returnValue = 0; // Get the parameters - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $interestRate = array_shift($aArgs); $period = array_shift($aArgs); $numberPeriods = array_shift($aArgs); @@ -1433,10 +1425,10 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function MIRR($values, $finance_rate, $reinvestment_rate) { - if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); - $values = PHPExcel_Calculation_Functions::flattenArray($values); - $finance_rate = PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate); - $reinvestment_rate = PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate); + if (!is_array($values)) return Calculation_Functions::VALUE(); + $values = Calculation_Functions::flattenArray($values); + $finance_rate = Calculation_Functions::flattenSingleValue($finance_rate); + $reinvestment_rate = Calculation_Functions::flattenSingleValue($reinvestment_rate); $n = count($values); $rr = 1.0 + $reinvestment_rate; @@ -1452,13 +1444,13 @@ class PHPExcel_Calculation_Financial { } if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $mirr = pow((-$npv_pos * pow($rr, $n)) / ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0; - return (is_finite($mirr) ? $mirr : PHPExcel_Calculation_Functions::VALUE()); + return (is_finite($mirr) ? $mirr : Calculation_Functions::VALUE()); } // function MIRR() @@ -1472,12 +1464,12 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function NOMINAL($effect_rate = 0, $npery = 0) { - $effect_rate = PHPExcel_Calculation_Functions::flattenSingleValue($effect_rate); - $npery = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery); + $effect_rate = Calculation_Functions::flattenSingleValue($effect_rate); + $npery = (int)Calculation_Functions::flattenSingleValue($npery); // Validate parameters if ($effect_rate <= 0 || $npery < 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Calculate @@ -1498,26 +1490,26 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $pmt = Calculation_Functions::flattenSingleValue($pmt); + $pv = Calculation_Functions::flattenSingleValue($pv); + $fv = Calculation_Functions::flattenSingleValue($fv); + $type = Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Calculate if (!is_null($rate) && $rate != 0) { if ($pmt == 0 && $pv == 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate); } else { if ($pmt == 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return (-$pv -$fv) / $pmt; } @@ -1535,7 +1527,7 @@ class PHPExcel_Calculation_Financial { $returnValue = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $rate = array_shift($aArgs); @@ -1563,15 +1555,15 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $nper = Calculation_Functions::flattenSingleValue($nper); + $pv = Calculation_Functions::flattenSingleValue($pv); + $fv = Calculation_Functions::flattenSingleValue($fv); + $type = Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Calculate @@ -1597,19 +1589,19 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $per = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per); - $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $per = (int) Calculation_Functions::flattenSingleValue($per); + $nper = (int) Calculation_Functions::flattenSingleValue($nper); + $pv = Calculation_Functions::flattenSingleValue($pv); + $fv = Calculation_Functions::flattenSingleValue($fv); + $type = (int) Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($per <= 0 || $per > $nper) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // Calculate @@ -1619,25 +1611,25 @@ class PHPExcel_Calculation_Financial { public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $rate = (float) PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $yield = (float) PHPExcel_Calculation_Functions::flattenSingleValue($yield); - $redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption); - $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency); - $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $rate = (float) Calculation_Functions::flattenSingleValue($rate); + $yield = (float) Calculation_Functions::flattenSingleValue($yield); + $redemption = (float) Calculation_Functions::flattenSingleValue($redemption); + $frequency = (int) Calculation_Functions::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) Calculation_Functions::flattenSingleValue($basis); - if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($settlement = Calculation_DateTime::_getDateValue($settlement))) { + return Calculation_Functions::VALUE(); } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } if (($settlement > $maturity) || (!self::_validFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $dsc = self::COUPDAYSNC($settlement, $maturity, $frequency, $basis); @@ -1679,18 +1671,18 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $discount = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount); - $redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption); - $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $discount = (float) Calculation_Functions::flattenSingleValue($discount); + $redemption = (float) Calculation_Functions::flattenSingleValue($redemption); + $basis = (int) Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) { if (($discount <= 0) || ($redemption <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -1698,7 +1690,7 @@ class PHPExcel_Calculation_Financial { return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function PRICEDISC() @@ -1723,35 +1715,35 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $yield = PHPExcel_Calculation_Functions::flattenSingleValue($yield); - $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $issue = Calculation_Functions::flattenSingleValue($issue); + $rate = Calculation_Functions::flattenSingleValue($rate); + $yield = Calculation_Functions::flattenSingleValue($yield); + $basis = (int) Calculation_Functions::flattenSingleValue($basis); // Validate if (is_numeric($rate) && is_numeric($yield)) { if (($rate <= 0) || ($yield <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($settlement),$basis); if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } $daysBetweenIssueAndSettlement *= $daysPerYear; - $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis); + $daysBetweenIssueAndMaturity = Calculation_DateTime::YEARFRAC($issue, $maturity, $basis); if (!is_numeric($daysBetweenIssueAndMaturity)) { // return date error return $daysBetweenIssueAndMaturity; } $daysBetweenIssueAndMaturity *= $daysPerYear; - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -1762,7 +1754,7 @@ class PHPExcel_Calculation_Financial { (1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) - (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function PRICEMAT() @@ -1779,15 +1771,15 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt); - $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = PHPExcel_Calculation_Functions::flattenSingleValue($type); + $rate = Calculation_Functions::flattenSingleValue($rate); + $nper = Calculation_Functions::flattenSingleValue($nper); + $pmt = Calculation_Functions::flattenSingleValue($pmt); + $fv = Calculation_Functions::flattenSingleValue($fv); + $type = Calculation_Functions::flattenSingleValue($type); // Validate parameters if ($type != 0 && $type != 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // Calculate @@ -1830,12 +1822,12 @@ class PHPExcel_Calculation_Financial { * @return float **/ public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) { - $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper); - $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt); - $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv); - $fv = (is_null($fv)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($fv); - $type = (is_null($type)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($type); - $guess = (is_null($guess)) ? 0.1 : PHPExcel_Calculation_Functions::flattenSingleValue($guess); + $nper = (int) Calculation_Functions::flattenSingleValue($nper); + $pmt = Calculation_Functions::flattenSingleValue($pmt); + $pv = Calculation_Functions::flattenSingleValue($pv); + $fv = (is_null($fv)) ? 0.0 : Calculation_Functions::flattenSingleValue($fv); + $type = (is_null($type)) ? 0 : (int) Calculation_Functions::flattenSingleValue($type); + $guess = (is_null($guess)) ? 0.1 : Calculation_Functions::flattenSingleValue($guess); $rate = $guess; if (abs($rate) < FINANCIAL_PRECISION) { @@ -1892,18 +1884,18 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $investment = (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment); - $discount = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount); - $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $investment = (float) Calculation_Functions::flattenSingleValue($investment); + $discount = (float) Calculation_Functions::flattenSingleValue($discount); + $basis = (int) Calculation_Functions::flattenSingleValue($basis); // Validate if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) { if (($investment <= 0) || ($discount <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -1911,7 +1903,7 @@ class PHPExcel_Calculation_Financial { return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function RECEIVED() @@ -1926,18 +1918,18 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function SLN($cost, $salvage, $life) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $life = PHPExcel_Calculation_Functions::flattenSingleValue($life); + $cost = Calculation_Functions::flattenSingleValue($cost); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $life = Calculation_Functions::flattenSingleValue($life); // Calculate if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { if ($life < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return ($cost - $salvage) / $life; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SLN() @@ -1953,19 +1945,19 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function SYD($cost, $salvage, $life, $period) { - $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); - $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); - $life = PHPExcel_Calculation_Functions::flattenSingleValue($life); - $period = PHPExcel_Calculation_Functions::flattenSingleValue($period); + $cost = Calculation_Functions::flattenSingleValue($cost); + $salvage = Calculation_Functions::flattenSingleValue($salvage); + $life = Calculation_Functions::flattenSingleValue($life); + $period = Calculation_Functions::flattenSingleValue($period); // Calculate if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) { if (($life < 1) || ($period > $life)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SYD() @@ -1982,9 +1974,9 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function TBILLEQ($settlement, $maturity, $discount) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $discount = PHPExcel_Calculation_Functions::flattenSingleValue($discount); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $discount = Calculation_Functions::flattenSingleValue($discount); // Use TBILLPRICE for validation $testValue = self::TBILLPRICE($settlement, $maturity, $discount); @@ -1992,15 +1984,15 @@ class PHPExcel_Calculation_Financial { return $testValue; } - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { ++$maturity; - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; } else { - $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement)); + $daysBetweenSettlementAndMaturity = (Calculation_DateTime::_getDateValue($maturity) - Calculation_DateTime::_getDateValue($settlement)); } return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity); @@ -2020,42 +2012,42 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function TBILLPRICE($settlement, $maturity, $discount) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $discount = PHPExcel_Calculation_Functions::flattenSingleValue($discount); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $discount = Calculation_Functions::flattenSingleValue($discount); - if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) { - return PHPExcel_Calculation_Functions::VALUE(); + if (is_string($maturity = Calculation_DateTime::_getDateValue($maturity))) { + return Calculation_Functions::VALUE(); } // Validate if (is_numeric($discount)) { if ($discount <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { ++$maturity; - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; } } else { - $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement)); + $daysBetweenSettlementAndMaturity = (Calculation_DateTime::_getDateValue($maturity) - Calculation_DateTime::_getDateValue($settlement)); } if ($daysBetweenSettlementAndMaturity > 360) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360)); if ($price <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return $price; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TBILLPRICE() @@ -2072,43 +2064,43 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function TBILLYIELD($settlement, $maturity, $price) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $price = PHPExcel_Calculation_Functions::flattenSingleValue($price); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $price = Calculation_Functions::flattenSingleValue($price); // Validate if (is_numeric($price)) { if ($price <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { ++$maturity; - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360; if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; } } else { - $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement)); + $daysBetweenSettlementAndMaturity = (Calculation_DateTime::_getDateValue($maturity) - Calculation_DateTime::_getDateValue($settlement)); } if ($daysBetweenSettlementAndMaturity > 360) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TBILLYIELD() public static function XIRR($values, $dates, $guess = 0.1) { - if ((!is_array($values)) && (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE(); - $values = PHPExcel_Calculation_Functions::flattenArray($values); - $dates = PHPExcel_Calculation_Functions::flattenArray($dates); - $guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess); - if (count($values) != count($dates)) return PHPExcel_Calculation_Functions::NaN(); + if ((!is_array($values)) && (!is_array($dates))) return Calculation_Functions::VALUE(); + $values = Calculation_Functions::flattenArray($values); + $dates = Calculation_Functions::flattenArray($dates); + $guess = Calculation_Functions::flattenSingleValue($guess); + if (count($values) != count($dates)) return Calculation_Functions::NaN(); // create an initial range, with a root somewhere between 0 and guess $x1 = 0.0; @@ -2123,7 +2115,7 @@ class PHPExcel_Calculation_Financial { $f2 = self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates); } } - if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE(); + if (($f1 * $f2) > 0.0) return Calculation_Functions::VALUE(); $f = self::XNPV($x1, $values, $dates); if ($f < 0.0) { @@ -2141,7 +2133,7 @@ class PHPExcel_Calculation_Financial { if ($f_mid <= 0.0) $rtb = $x_mid; if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } @@ -2160,21 +2152,21 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function XNPV($rate, $values, $dates) { - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - if (!is_numeric($rate)) return PHPExcel_Calculation_Functions::VALUE(); - if ((!is_array($values)) || (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE(); - $values = PHPExcel_Calculation_Functions::flattenArray($values); - $dates = PHPExcel_Calculation_Functions::flattenArray($dates); + $rate = Calculation_Functions::flattenSingleValue($rate); + if (!is_numeric($rate)) return Calculation_Functions::VALUE(); + if ((!is_array($values)) || (!is_array($dates))) return Calculation_Functions::VALUE(); + $values = Calculation_Functions::flattenArray($values); + $dates = Calculation_Functions::flattenArray($dates); $valCount = count($values); - if ($valCount != count($dates)) return PHPExcel_Calculation_Functions::NaN(); - if ((min($values) > 0) || (max($values) < 0)) return PHPExcel_Calculation_Functions::VALUE(); + if ($valCount != count($dates)) return Calculation_Functions::NaN(); + if ((min($values) > 0) || (max($values) < 0)) return Calculation_Functions::VALUE(); $xnpv = 0.0; for ($i = 0; $i < $valCount; ++$i) { - if (!is_numeric($values[$i])) return PHPExcel_Calculation_Functions::VALUE(); - $xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0],$dates[$i],'d') / 365); + if (!is_numeric($values[$i])) return Calculation_Functions::VALUE(); + $xnpv += $values[$i] / pow(1 + $rate, Calculation_DateTime::DATEDIF($dates[0],$dates[$i],'d') / 365); } - return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE(); + return (is_finite($xnpv)) ? $xnpv : Calculation_Functions::VALUE(); } // function XNPV() @@ -2198,22 +2190,22 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $price = PHPExcel_Calculation_Functions::flattenSingleValue($price); - $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption); - $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $price = Calculation_Functions::flattenSingleValue($price); + $redemption = Calculation_Functions::flattenSingleValue($redemption); + $basis = (int) Calculation_Functions::flattenSingleValue($basis); // Validate if (is_numeric($price) && is_numeric($redemption)) { if (($price <= 0) || ($redemption <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($settlement),$basis); if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity,$basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity,$basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -2222,7 +2214,7 @@ class PHPExcel_Calculation_Financial { return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function YIELDDISC() @@ -2247,35 +2239,35 @@ class PHPExcel_Calculation_Financial { * @return float */ public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0) { - $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement); - $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity); - $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue); - $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate); - $price = PHPExcel_Calculation_Functions::flattenSingleValue($price); - $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis); + $settlement = Calculation_Functions::flattenSingleValue($settlement); + $maturity = Calculation_Functions::flattenSingleValue($maturity); + $issue = Calculation_Functions::flattenSingleValue($issue); + $rate = Calculation_Functions::flattenSingleValue($rate); + $price = Calculation_Functions::flattenSingleValue($price); + $basis = (int) Calculation_Functions::flattenSingleValue($basis); // Validate if (is_numeric($rate) && is_numeric($price)) { if (($rate <= 0) || ($price <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - $daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis); + $daysPerYear = self::_daysPerYear(Calculation_DateTime::YEAR($settlement),$basis); if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Calculation_DateTime::YEARFRAC($issue, $settlement, $basis); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } $daysBetweenIssueAndSettlement *= $daysPerYear; - $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis); + $daysBetweenIssueAndMaturity = Calculation_DateTime::YEARFRAC($issue, $maturity, $basis); if (!is_numeric($daysBetweenIssueAndMaturity)) { // return date error return $daysBetweenIssueAndMaturity; } $daysBetweenIssueAndMaturity *= $daysPerYear; - $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -2286,7 +2278,7 @@ class PHPExcel_Calculation_Financial { (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) * ($daysPerYear / $daysBetweenSettlementAndMaturity); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function YIELDMAT() -} // class PHPExcel_Calculation_Financial +} diff --git a/Classes/PHPExcel/Calculation/FormulaParser.php b/Classes/PHPExcel/Calculation/FormulaParser.php index 69b1463..3acd9fe 100644 --- a/Classes/PHPExcel/Calculation/FormulaParser.php +++ b/Classes/PHPExcel/Calculation/FormulaParser.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -49,14 +49,17 @@ PARTLY BASED ON: http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html */ + +namespace PHPExcel; + /** - * PHPExcel_Calculation_FormulaParser + * PHPExcel\Calculation_FormulaParser * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_FormulaParser { +class Calculation_FormulaParser { /* Character constants */ const QUOTE_DOUBLE = '"'; const QUOTE_SINGLE = '\''; @@ -85,21 +88,21 @@ class PHPExcel_Calculation_FormulaParser { /** * Tokens * - * @var PHPExcel_Calculation_FormulaToken[] + * @var PHPExcel\Calculation_FormulaToken[] */ private $_tokens = array(); /** - * Create a new PHPExcel_Calculation_FormulaParser + * Create a new PHPExcel\Calculation_FormulaParser * * @param string $pFormula Formula to parse - * @throws PHPExcel_Calculation_Exception + * @throws PHPExcel\Calculation_Exception */ public function __construct($pFormula = '') { // Check parameters if (is_null($pFormula)) { - throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula"); + throw new Calculation_Exception("Invalid parameter passed: formula"); } // Initialise values @@ -122,13 +125,13 @@ class PHPExcel_Calculation_FormulaParser { * * @param int $pId Token id * @return string - * @throws PHPExcel_Calculation_Exception + * @throws PHPExcel\Calculation_Exception */ public function getToken($pId = 0) { if (isset($this->_tokens[$pId])) { return $this->_tokens[$pId]; } else { - throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist."); + throw new Calculation_Exception("Token with id $pId does not exist."); } } @@ -144,7 +147,7 @@ class PHPExcel_Calculation_FormulaParser { /** * Get Tokens * - * @return PHPExcel_Calculation_FormulaToken[] + * @return PHPExcel\Calculation_FormulaToken[] */ public function getTokens() { return $this->_tokens; @@ -179,13 +182,13 @@ class PHPExcel_Calculation_FormulaParser { // embeds are doubled // end marks token if ($inString) { - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { - if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) { - $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE; + if ($this->_formula{$index} == Calculation_FormulaParser::QUOTE_DOUBLE) { + if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == Calculation_FormulaParser::QUOTE_DOUBLE)) { + $value .= Calculation_FormulaParser::QUOTE_DOUBLE; ++$index; } else { $inString = false; - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND, Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT); $value = ""; } } else { @@ -199,9 +202,9 @@ class PHPExcel_Calculation_FormulaParser { // embeds are double // end does not mark a token if ($inPath) { - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { - if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) { - $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE; + if ($this->_formula{$index} == Calculation_FormulaParser::QUOTE_SINGLE) { + if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == Calculation_FormulaParser::QUOTE_SINGLE)) { + $value .= Calculation_FormulaParser::QUOTE_SINGLE; ++$index; } else { $inPath = false; @@ -217,7 +220,7 @@ class PHPExcel_Calculation_FormulaParser { // no embeds (changed to "()" by Excel) // end does not mark a token if ($inRange) { - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) { + if ($this->_formula{$index} == Calculation_FormulaParser::BRACKET_CLOSE) { $inRange = false; } $value .= $this->_formula{$index}; @@ -232,14 +235,14 @@ class PHPExcel_Calculation_FormulaParser { ++$index; if (in_array($value, $ERRORS)) { $inError = false; - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND, Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR); $value = ""; } continue; } // scientific notation check - if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->_formula{$index}) !== false) { + if (strpos(Calculation_FormulaParser::OPERATORS_SN, $this->_formula{$index}) !== false) { if (strlen($value) > 1) { if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->_formula{$index}) != 0) { $value .= $this->_formula{$index}; @@ -252,9 +255,9 @@ class PHPExcel_Calculation_FormulaParser { // independent character evaluation (order not important) // establish state-dependent character evaluations - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { + if ($this->_formula{$index} == Calculation_FormulaParser::QUOTE_DOUBLE) { if (strlen($value > 0)) { // unexpected - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $value = ""; } $inString = true; @@ -262,9 +265,9 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { + if ($this->_formula{$index} == Calculation_FormulaParser::QUOTE_SINGLE) { if (strlen($value) > 0) { // unexpected - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $value = ""; } $inPath = true; @@ -272,36 +275,36 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) { + if ($this->_formula{$index} == Calculation_FormulaParser::BRACKET_OPEN) { $inRange = true; - $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN; + $value .= Calculation_FormulaParser::BRACKET_OPEN; ++$index; continue; } - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) { + if ($this->_formula{$index} == Calculation_FormulaParser::ERROR_START) { if (strlen($value) > 0) { // unexpected - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $value = ""; } $inError = true; - $value .= PHPExcel_Calculation_FormulaParser::ERROR_START; + $value .= Calculation_FormulaParser::ERROR_START; ++$index; continue; } // mark start and end of arrays and array rows - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) { + if ($this->_formula{$index} == Calculation_FormulaParser::BRACE_OPEN) { if (strlen($value) > 0) { // unexpected - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $value = ""; } - $tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tmp = new Calculation_FormulaToken("ARRAY", Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; $stack[] = clone $tmp; - $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tmp = new Calculation_FormulaToken("ARRAYROW", Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; $stack[] = clone $tmp; @@ -309,21 +312,21 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) { + if ($this->_formula{$index} == Calculation_FormulaParser::SEMICOLON) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } $tmp = array_pop($stack); $tmp->setValue(""); - $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tmp->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tokens1[] = $tmp; - $tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); + $tmp = new Calculation_FormulaToken(",", Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); $tokens1[] = $tmp; - $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tmp = new Calculation_FormulaToken("ARRAYROW", Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; $stack[] = clone $tmp; @@ -331,20 +334,20 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) { + if ($this->_formula{$index} == Calculation_FormulaParser::BRACE_CLOSE) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } $tmp = array_pop($stack); $tmp->setValue(""); - $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tmp->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tokens1[] = $tmp; $tmp = array_pop($stack); $tmp->setValue(""); - $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tmp->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tokens1[] = $tmp; ++$index; @@ -352,14 +355,14 @@ class PHPExcel_Calculation_FormulaParser { } // trim white-space - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) { + if ($this->_formula{$index} == Calculation_FormulaParser::WHITESPACE) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } - $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE); + $tokens1[] = new Calculation_FormulaToken("", Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE); ++$index; - while (($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) { + while (($this->_formula{$index} == Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) { ++$index; } continue; @@ -369,46 +372,46 @@ class PHPExcel_Calculation_FormulaParser { if (($index + 2) <= $formulaLength) { if (in_array(substr($this->_formula, $index, 2), $COMPARATORS_MULTI)) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } - $tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->_formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + $tokens1[] = new Calculation_FormulaToken(substr($this->_formula, $index, 2), Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); $index += 2; continue; } } // standard infix operators - if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->_formula{$index}) !== false) { + if (strpos(Calculation_FormulaParser::OPERATORS_INFIX, $this->_formula{$index}) !== false) { if (strlen($value) > 0) { - $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] =new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } - $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX); + $tokens1[] = new Calculation_FormulaToken($this->_formula{$index}, Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX); ++$index; continue; } // standard postfix operators (only one) - if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->_formula{$index}) !== false) { + if (strpos(Calculation_FormulaParser::OPERATORS_POSTFIX, $this->_formula{$index}) !== false) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } - $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); + $tokens1[] = new Calculation_FormulaToken($this->_formula{$index}, Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); ++$index; continue; } // start subexpression or function - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) { + if ($this->_formula{$index} == Calculation_FormulaParser::PAREN_OPEN) { if (strlen($value) > 0) { - $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tmp = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; $stack[] = clone $tmp; $value = ""; } else { - $tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tmp = new Calculation_FormulaToken("", Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; $stack[] = clone $tmp; } @@ -417,36 +420,36 @@ class PHPExcel_Calculation_FormulaParser { } // function, subexpression, or array parameters, or operand unions - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) { + if ($this->_formula{$index} == Calculation_FormulaParser::COMMA) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } $tmp = array_pop($stack); $tmp->setValue(""); - $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tmp->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $stack[] = $tmp; - if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION); + if ($tmp->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { + $tokens1[] = new Calculation_FormulaToken(",", Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, Calculation_FormulaToken::TOKEN_SUBTYPE_UNION); } else { - $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); + $tokens1[] = new Calculation_FormulaToken(",", Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); } ++$index; continue; } // stop subexpression - if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) { + if ($this->_formula{$index} == Calculation_FormulaParser::PAREN_CLOSE) { if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $value = ""; } $tmp = array_pop($stack); $tmp->setValue(""); - $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tmp->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); $tokens1[] = $tmp; ++$index; @@ -460,7 +463,7 @@ class PHPExcel_Calculation_FormulaParser { // dump remaining accumulation if (strlen($value) > 0) { - $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $tokens1[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERAND); } // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections @@ -482,7 +485,7 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) { + if ($token->getTokenType() != Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) { $tokens2[] = $token; continue; } @@ -492,9 +495,9 @@ class PHPExcel_Calculation_FormulaParser { } if (! ( - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ) ) { continue; } @@ -504,14 +507,14 @@ class PHPExcel_Calculation_FormulaParser { } if (! ( - (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || - (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || - ($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + (($nextToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || + (($nextToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || + ($nextToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ) ) { continue; } - $tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION); + $tokens2[] = new Calculation_FormulaToken($value, Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION); } // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators @@ -536,34 +539,34 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") { + if ($token->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") { if ($i == 0) { - $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + $token->setTokenType(Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); } else if ( - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || - ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ) { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); } else { - $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + $token->setTokenType(Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); } $this->_tokens[] = $token; continue; } - if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") { + if ($token->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") { if ($i == 0) { continue; } else if ( - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || - ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || - ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERAND) ) { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); } else { continue; } @@ -572,35 +575,35 @@ class PHPExcel_Calculation_FormulaParser { continue; } - if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if ($token->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); } else if ($token->getValue() == "&") { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION); } else { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); } $this->_tokens[] = $token; continue; } - if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if ($token->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_OPERAND && $token->getTokenSubType() == Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { if (!is_numeric($token->getValue())) { if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); } else { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE); } } else { - $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER); + $token->setTokenSubType(Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER); } $this->_tokens[] = $token; continue; } - if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { + if ($token->getTokenType() == Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { if (strlen($token->getValue() > 0)) { if (substr($token->getValue(), 0, 1) == "@") { $token->setValue(substr($token->getValue(), 1)); diff --git a/Classes/PHPExcel/Calculation/FormulaToken.php b/Classes/PHPExcel/Calculation/FormulaToken.php index 6eaa3ee..eba3061 100644 --- a/Classes/PHPExcel/Calculation/FormulaToken.php +++ b/Classes/PHPExcel/Calculation/FormulaToken.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -50,14 +50,16 @@ PARTLY BASED ON: */ +namespace PHPExcel; + /** - * PHPExcel_Calculation_FormulaToken + * PHPExcel\Calculation_FormulaToken * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_FormulaToken { +class Calculation_FormulaToken { /* Token types */ const TOKEN_TYPE_NOOP = 'Noop'; const TOKEN_TYPE_OPERAND = 'Operand'; @@ -106,13 +108,13 @@ class PHPExcel_Calculation_FormulaToken { private $_tokenSubType; /** - * Create a new PHPExcel_Calculation_FormulaToken + * Create a new PHPExcel\Calculation_FormulaToken * * @param string $pValue * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) */ - public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) + public function __construct($pValue, $pTokenType = Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { // Initialise values $this->_value = $pValue; @@ -152,7 +154,7 @@ class PHPExcel_Calculation_FormulaToken { * * @param string $value */ - public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { + public function setTokenType($value = Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { $this->_tokenType = $value; } @@ -170,7 +172,7 @@ class PHPExcel_Calculation_FormulaToken { * * @param string $value */ - public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + public function setTokenSubType($value = Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { $this->_tokenSubType = $value; } } diff --git a/Classes/PHPExcel/Calculation/Function.php b/Classes/PHPExcel/Calculation/Function.php index b982200..22711b8 100644 --- a/Classes/PHPExcel/Calculation/Function.php +++ b/Classes/PHPExcel/Calculation/Function.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Calculation_Function + * PHPExcel\Calculation_Function * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Function { +class Calculation_Function { /* Function categories */ const CATEGORY_CUBE = 'Cube'; const CATEGORY_DATABASE = 'Database'; @@ -69,12 +71,12 @@ class PHPExcel_Calculation_Function { private $_phpExcelName; /** - * Create a new PHPExcel_Calculation_Function + * Create a new PHPExcel\Calculation_Function * * @param string $pCategory Category (represented by CATEGORY_*) * @param string $pExcelName Excel function name * @param string $pPHPExcelName PHPExcel function mapping - * @throws PHPExcel_Calculation_Exception + * @throws PHPExcel\Calculation_Exception */ public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL) { @@ -84,7 +86,7 @@ class PHPExcel_Calculation_Function { $this->_excelName = $pExcelName; $this->_phpExcelName = $pPHPExcelName; } else { - throw new PHPExcel_Calculation_Exception("Invalid parameters passed."); + throw new Calculation_Exception("Invalid parameters passed."); } } @@ -101,13 +103,13 @@ class PHPExcel_Calculation_Function { * Set Category (represented by CATEGORY_*) * * @param string $value - * @throws PHPExcel_Calculation_Exception + * @throws PHPExcel\Calculation_Exception */ public function setCategory($value = null) { if (!is_null($value)) { $this->_category = $value; } else { - throw new PHPExcel_Calculation_Exception("Invalid parameter passed."); + throw new Calculation_Exception("Invalid parameter passed."); } } diff --git a/Classes/PHPExcel/Calculation/Functions.php b/Classes/PHPExcel/Calculation/Functions.php index 3004eec..036b9e1 100644 --- a/Classes/PHPExcel/Calculation/Functions.php +++ b/Classes/PHPExcel/Calculation/Functions.php @@ -19,22 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ - -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** MAX_VALUE */ define('MAX_VALUE', 1.2e308); @@ -50,13 +41,13 @@ define('PRECISION', 8.88E-016); /** - * PHPExcel_Calculation_Functions + * PHPExcel\Calculation_Functions * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Functions { +class Calculation_Functions { /** constants */ const COMPATIBILITY_EXCEL = 'Excel'; @@ -108,9 +99,9 @@ class PHPExcel_Calculation_Functions { * @category Function Configuration * @param string $compatibilityMode Compatibility Mode * Permitted values are: - * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' - * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' - * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * PHPExcel\Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' + * PHPExcel\Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * PHPExcel\Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' * @return boolean (Success or Failure) */ public static function setCompatibilityMode($compatibilityMode) { @@ -131,9 +122,9 @@ class PHPExcel_Calculation_Functions { * @category Function Configuration * @return string Compatibility Mode * Possible Return values are: - * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' - * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' - * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * PHPExcel\Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' + * PHPExcel\Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * PHPExcel\Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' */ public static function getCompatibilityMode() { return self::$compatibilityMode; @@ -147,9 +138,9 @@ class PHPExcel_Calculation_Functions { * @category Function Configuration * @param string $returnDateType Return Date Format * Permitted values are: - * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' - * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' - * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E' + * PHPExcel\Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' + * PHPExcel\Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' + * PHPExcel\Calculation_Functions::RETURNDATE_EXCEL 'E' * @return boolean Success or failure */ public static function setReturnDateType($returnDateType) { @@ -170,9 +161,9 @@ class PHPExcel_Calculation_Functions { * @category Function Configuration * @return string Return Date Format * Possible Return values are: - * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' - * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' - * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E' + * PHPExcel\Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' + * PHPExcel\Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' + * PHPExcel\Calculation_Functions::RETURNDATE_EXCEL 'E' */ public static function getReturnDateType() { return self::$ReturnDateType; @@ -307,16 +298,16 @@ class PHPExcel_Calculation_Functions { public static function _ifCondition($condition) { - $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition); + $condition = Calculation_Functions::flattenSingleValue($condition); if (!isset($condition{0})) $condition = '=""'; if (!in_array($condition{0},array('>', '<', '='))) { - if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } + if (!is_numeric($condition)) { $condition = Calculation::_wrapResult(strtoupper($condition)); } return '='.$condition; } else { preg_match('/([<>=]+)(.*)/',$condition,$matches); list(,$operator,$operand) = $matches; - if (!is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); } + if (!is_numeric($operand)) { $operand = Calculation::_wrapResult(strtoupper($operand)); } return $operator.$operand; } } // function _ifCondition() @@ -663,7 +654,7 @@ class PHPExcel_Calculation_Functions { return $value; } // function flattenSingleValue() -} // class PHPExcel_Calculation_Functions +} // diff --git a/Classes/PHPExcel/Calculation/Logical.php b/Classes/PHPExcel/Calculation/Logical.php index 77ae473..f28e9b0 100644 --- a/Classes/PHPExcel/Calculation/Logical.php +++ b/Classes/PHPExcel/Calculation/Logical.php @@ -19,31 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_Logical + * PHPExcel\Calculation_Logical * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Logical { +class Calculation_Logical { /** * TRUE @@ -105,7 +97,7 @@ class PHPExcel_Calculation_Logical { $returnValue = TRUE; // Loop through the arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $argCount = -1; foreach ($aArgs as $argCount => $arg) { // Is it a boolean value? @@ -115,12 +107,12 @@ class PHPExcel_Calculation_Logical { $returnValue = $returnValue && ($arg != 0); } elseif (is_string($arg)) { $arg = strtoupper($arg); - if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { + if (($arg == 'TRUE') || ($arg == Calculation::getTRUE())) { $arg = TRUE; - } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { + } elseif (($arg == 'FALSE') || ($arg == Calculation::getFALSE())) { $arg = FALSE; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $returnValue = $returnValue && ($arg != 0); } @@ -128,7 +120,7 @@ class PHPExcel_Calculation_Logical { // Return if ($argCount < 0) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } return $returnValue; } // function LOGICAL_AND() @@ -160,7 +152,7 @@ class PHPExcel_Calculation_Logical { $returnValue = FALSE; // Loop through the arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $argCount = -1; foreach ($aArgs as $argCount => $arg) { // Is it a boolean value? @@ -170,12 +162,12 @@ class PHPExcel_Calculation_Logical { $returnValue = $returnValue || ($arg != 0); } elseif (is_string($arg)) { $arg = strtoupper($arg); - if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { + if (($arg == 'TRUE') || ($arg == Calculation::getTRUE())) { $arg = TRUE; - } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { + } elseif (($arg == 'FALSE') || ($arg == Calculation::getFALSE())) { $arg = FALSE; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $returnValue = $returnValue || ($arg != 0); } @@ -183,7 +175,7 @@ class PHPExcel_Calculation_Logical { // Return if ($argCount < 0) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } return $returnValue; } // function LOGICAL_OR() @@ -210,15 +202,15 @@ class PHPExcel_Calculation_Logical { * @return boolean The boolean inverse of the argument. */ public static function NOT($logical=FALSE) { - $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical); + $logical = Calculation_Functions::flattenSingleValue($logical); if (is_string($logical)) { $logical = strtoupper($logical); - if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) { + if (($logical == 'TRUE') || ($logical == Calculation::getTRUE())) { return FALSE; - } elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) { + } elseif (($logical == 'FALSE') || ($logical == Calculation::getFALSE())) { return TRUE; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } @@ -258,9 +250,9 @@ class PHPExcel_Calculation_Logical { * @return mixed The value of returnIfTrue or returnIfFalse determined by condition */ public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) { - $condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition); - $returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue); - $returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse); + $condition = (is_null($condition)) ? TRUE : (boolean) Calculation_Functions::flattenSingleValue($condition); + $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Calculation_Functions::flattenSingleValue($returnIfTrue); + $returnIfFalse = (is_null($returnIfFalse)) ? FALSE : Calculation_Functions::flattenSingleValue($returnIfFalse); return ($condition) ? $returnIfTrue : $returnIfFalse; } // function STATEMENT_IF() @@ -279,10 +271,10 @@ class PHPExcel_Calculation_Logical { * @return mixed The value of errorpart or testValue determined by error condition */ public static function IFERROR($testValue = '', $errorpart = '') { - $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue); - $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart); + $testValue = (is_null($testValue)) ? '' : Calculation_Functions::flattenSingleValue($testValue); + $errorpart = (is_null($errorpart)) ? '' : Calculation_Functions::flattenSingleValue($errorpart); - return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue); + return self::STATEMENT_IF(Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue); } // function IFERROR() -} // class PHPExcel_Calculation_Logical +} diff --git a/Classes/PHPExcel/Calculation/LookupRef.php b/Classes/PHPExcel/Calculation/LookupRef.php index c3363f1..7a228cd 100644 --- a/Classes/PHPExcel/Calculation/LookupRef.php +++ b/Classes/PHPExcel/Calculation/LookupRef.php @@ -19,32 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_LookupRef + * PHPExcel\Calculation_LookupRef * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_LookupRef { - +class Calculation_LookupRef { /** * CELL_ADDRESS @@ -68,13 +59,13 @@ class PHPExcel_Calculation_LookupRef { * @return string */ public static function CELL_ADDRESS($row, $column, $relativity=1, $referenceStyle=True, $sheetText='') { - $row = PHPExcel_Calculation_Functions::flattenSingleValue($row); - $column = PHPExcel_Calculation_Functions::flattenSingleValue($column); - $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity); - $sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText); + $row = Calculation_Functions::flattenSingleValue($row); + $column = Calculation_Functions::flattenSingleValue($column); + $relativity = Calculation_Functions::flattenSingleValue($relativity); + $sheetText = Calculation_Functions::flattenSingleValue($sheetText); if (($row < 1) || ($column < 1)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if ($sheetText > '') { @@ -83,7 +74,7 @@ class PHPExcel_Calculation_LookupRef { } if ((!is_bool($referenceStyle)) || $referenceStyle) { $rowRelative = $columnRelative = '$'; - $column = PHPExcel_Cell::stringFromColumnIndex($column-1); + $column = Cell::stringFromColumnIndex($column-1); if (($relativity == 2) || ($relativity == 4)) { $columnRelative = ''; } if (($relativity == 3) || ($relativity == 4)) { $rowRelative = ''; } return $sheetText.$columnRelative.$column.$rowRelative.$row; @@ -115,7 +106,7 @@ class PHPExcel_Calculation_LookupRef { if (is_array($cellAddress)) { foreach($cellAddress as $columnKey => $value) { $columnKey = preg_replace('/[^a-z]/i','',$columnKey); - return (integer) PHPExcel_Cell::columnIndexFromString($columnKey); + return (integer) Cell::columnIndexFromString($columnKey); } } else { if (strpos($cellAddress,'!') !== false) { @@ -127,12 +118,12 @@ class PHPExcel_Calculation_LookupRef { $endAddress = preg_replace('/[^a-z]/i','',$endAddress); $returnValue = array(); do { - $returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress); + $returnValue[] = (integer) Cell::columnIndexFromString($startAddress); } while ($startAddress++ != $endAddress); return $returnValue; } else { $cellAddress = preg_replace('/[^a-z]/i','',$cellAddress); - return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress); + return (integer) Cell::columnIndexFromString($cellAddress); } } } // function COLUMN() @@ -153,13 +144,13 @@ class PHPExcel_Calculation_LookupRef { if (is_null($cellAddress) || $cellAddress === '') { return 1; } elseif (!is_array($cellAddress)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $x = array_keys($cellAddress); $x = array_shift($x); $isMatrix = (is_numeric($x)); - list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); + list($columns,$rows) = Calculation::_getMatrixDimensions($cellAddress); if ($isMatrix) { return $rows; @@ -228,12 +219,12 @@ class PHPExcel_Calculation_LookupRef { if (is_null($cellAddress) || $cellAddress === '') { return 1; } elseif (!is_array($cellAddress)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $i = array_keys($cellAddress); $isMatrix = (is_numeric(array_shift($i))); - list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); + list($columns,$rows) = Calculation::_getMatrixDimensions($cellAddress); if ($isMatrix) { return $columns; @@ -253,18 +244,18 @@ class PHPExcel_Calculation_LookupRef { * @category Logical Functions * @param string $linkURL Value to check, is also the value returned when no error * @param string $displayName Value to return when testValue is an error condition - * @param PHPExcel_Cell $pCell The cell to set the hyperlink in + * @param PHPExcel\Cell $pCell The cell to set the hyperlink in * @return mixed The value of $displayName (or $linkURL if $displayName was blank) */ - public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) { + public static function HYPERLINK($linkURL = '', $displayName = null, Cell $pCell = null) { $args = func_get_args(); $pCell = array_pop($args); - $linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL); - $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName); + $linkURL = (is_null($linkURL)) ? '' : Calculation_Functions::flattenSingleValue($linkURL); + $displayName = (is_null($displayName)) ? '' : Calculation_Functions::flattenSingleValue($displayName); if ((!is_object($pCell)) || (trim($linkURL) == '')) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } if ((is_object($displayName)) || trim($displayName) == '') { @@ -289,16 +280,16 @@ class PHPExcel_Calculation_LookupRef { * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010 * * @param cellAddress $cellAddress The cell address of the current cell (containing this formula) - * @param PHPExcel_Cell $pCell The current cell (containing this formula) + * @param PHPExcel\Cell $pCell The current cell (containing this formula) * @return mixed The cells referenced by cellAddress * * @todo Support for the optional a1 parameter introduced in Excel 2010 * */ - public static function INDIRECT($cellAddress = NULL, PHPExcel_Cell $pCell = NULL) { - $cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress); + public static function INDIRECT($cellAddress = NULL, Cell $pCell = NULL) { + $cellAddress = Calculation_Functions::flattenSingleValue($cellAddress); if (is_null($cellAddress) || $cellAddress === '') { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } $cellAddress1 = $cellAddress; @@ -307,10 +298,10 @@ class PHPExcel_Calculation_LookupRef { list($cellAddress1,$cellAddress2) = explode(':',$cellAddress); } - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || - ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { - if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { - return PHPExcel_Calculation_Functions::REF(); + if ((!preg_match('/^'.Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || + ((!is_null($cellAddress2)) && (!preg_match('/^'.Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { + if (!preg_match('/^'.Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { + return Calculation_Functions::REF(); } if (strpos($cellAddress,'!') !== FALSE) { @@ -321,7 +312,7 @@ class PHPExcel_Calculation_LookupRef { $pSheet = $pCell->getParent(); } - return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE); + return Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE); } if (strpos($cellAddress,'!') !== FALSE) { @@ -332,7 +323,7 @@ class PHPExcel_Calculation_LookupRef { $pSheet = $pCell->getParent(); } - return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE); + return Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE); } // function INDIRECT() @@ -362,10 +353,10 @@ class PHPExcel_Calculation_LookupRef { * @return string A reference to a cell or range of cells */ public static function OFFSET($cellAddress=Null,$rows=0,$columns=0,$height=null,$width=null) { - $rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows); - $columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns); - $height = PHPExcel_Calculation_Functions::flattenSingleValue($height); - $width = PHPExcel_Calculation_Functions::flattenSingleValue($width); + $rows = Calculation_Functions::flattenSingleValue($rows); + $columns = Calculation_Functions::flattenSingleValue($columns); + $height = Calculation_Functions::flattenSingleValue($height); + $width = Calculation_Functions::flattenSingleValue($width); if ($cellAddress == Null) { return 0; } @@ -373,7 +364,7 @@ class PHPExcel_Calculation_LookupRef { $args = func_get_args(); $pCell = array_pop($args); if (!is_object($pCell)) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } $sheetName = NULL; @@ -386,23 +377,23 @@ class PHPExcel_Calculation_LookupRef { } else { $startCell = $endCell = $cellAddress; } - list($startCellColumn,$startCellRow) = PHPExcel_Cell::coordinateFromString($startCell); - list($endCellColumn,$endCellRow) = PHPExcel_Cell::coordinateFromString($endCell); + list($startCellColumn,$startCellRow) = Cell::coordinateFromString($startCell); + list($endCellColumn,$endCellRow) = Cell::coordinateFromString($endCell); $startCellRow += $rows; - $startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1; + $startCellColumn = Cell::columnIndexFromString($startCellColumn) - 1; $startCellColumn += $columns; if (($startCellRow <= 0) || ($startCellColumn < 0)) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } - $endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1; + $endCellColumn = Cell::columnIndexFromString($endCellColumn) - 1; if (($width != null) && (!is_object($width))) { $endCellColumn = $startCellColumn + $width - 1; } else { $endCellColumn += $columns; } - $startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn); + $startCellColumn = Cell::stringFromColumnIndex($startCellColumn); if (($height != null) && (!is_object($height))) { $endCellRow = $startCellRow + $height - 1; @@ -411,9 +402,9 @@ class PHPExcel_Calculation_LookupRef { } if (($endCellRow <= 0) || ($endCellColumn < 0)) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } - $endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn); + $endCellColumn = Cell::stringFromColumnIndex($endCellColumn); $cellAddress = $startCellColumn.$startCellRow; if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { @@ -426,7 +417,7 @@ class PHPExcel_Calculation_LookupRef { $pSheet = $pCell->getParent(); } - return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False); + return Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False); } // function OFFSET() @@ -450,7 +441,7 @@ class PHPExcel_Calculation_LookupRef { */ public static function CHOOSE() { $chooseArgs = func_get_args(); - $chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs)); + $chosenEntry = Calculation_Functions::flattenArray(array_shift($chooseArgs)); $entryCount = count($chooseArgs) - 1; if(is_array($chosenEntry)) { @@ -459,15 +450,15 @@ class PHPExcel_Calculation_LookupRef { if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) { --$chosenEntry; } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $chosenEntry = floor($chosenEntry); if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_array($chooseArgs[$chosenEntry])) { - return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]); + return Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]); } else { return $chooseArgs[$chosenEntry]; } @@ -488,26 +479,26 @@ class PHPExcel_Calculation_LookupRef { * @return integer The relative position of the found item */ public static function MATCH($lookup_value, $lookup_array, $match_type=1) { - $lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array); - $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); - $match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type); + $lookup_array = Calculation_Functions::flattenArray($lookup_array); + $lookup_value = Calculation_Functions::flattenSingleValue($lookup_value); + $match_type = (is_null($match_type)) ? 1 : (int) Calculation_Functions::flattenSingleValue($match_type); // MATCH is not case sensitive $lookup_value = strtolower($lookup_value); // lookup_value type has to be number, text, or logical values if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // match_type is 0, 1 or -1 if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // lookup_array should not be empty $lookupArraySize = count($lookup_array); if ($lookupArraySize <= 0) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // lookup_array should contain only number, text, or logical values, or empty (null) cells @@ -515,7 +506,7 @@ class PHPExcel_Calculation_LookupRef { // check the type of the value if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) && (!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // convert strings to lowercase for case-insensitive testing if (is_string($lookupArrayValue)) { @@ -583,7 +574,7 @@ class PHPExcel_Calculation_LookupRef { } // unsuccessful in finding a match, return #N/A error value - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // function MATCH() @@ -603,18 +594,18 @@ class PHPExcel_Calculation_LookupRef { public static function INDEX($arrayValues,$rowNum = 0,$columnNum = 0) { if (($rowNum < 0) || ($columnNum < 0)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (!is_array($arrayValues)) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } $rowKeys = array_keys($arrayValues); $columnKeys = @array_keys($arrayValues[$rowKeys[0]]); if ($columnNum > count($columnKeys)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($columnNum == 0) { if ($rowNum == 0) { return $arrayValues; @@ -636,7 +627,7 @@ class PHPExcel_Calculation_LookupRef { } $columnNum = $columnKeys[--$columnNum]; if ($rowNum > count($rowKeys)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($rowNum == 0) { return $arrayValues[$columnNum]; } @@ -691,23 +682,23 @@ class PHPExcel_Calculation_LookupRef { * @return mixed The value of the found cell */ public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { - $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); - $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number); - $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match); + $lookup_value = Calculation_Functions::flattenSingleValue($lookup_value); + $index_number = Calculation_Functions::flattenSingleValue($index_number); + $not_exact_match = Calculation_Functions::flattenSingleValue($not_exact_match); // index_number must be greater than or equal to 1 if ($index_number < 1) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // index_number must be less than or equal to the number of columns in lookup_array if ((!is_array($lookup_array)) || (empty($lookup_array))) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } else { $f = array_keys($lookup_array); $firstRow = array_pop($f); if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } else { $columnKeys = array_keys($lookup_array[$firstRow]); $returnColumn = $columnKeys[--$index_number]; @@ -732,7 +723,7 @@ class PHPExcel_Calculation_LookupRef { if ($rowNumber !== false) { if ((!$not_exact_match) && ($rowValue != $lookup_value)) { // if an exact match is required, we have what we need to return an appropriate response - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } else { // otherwise return the appropriate value $result = $lookup_array[$rowNumber][$returnColumn]; @@ -743,7 +734,7 @@ class PHPExcel_Calculation_LookupRef { } } - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // function VLOOKUP() @@ -757,23 +748,23 @@ class PHPExcel_Calculation_LookupRef { * @return mixed The value of the found cell */ public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { - $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); - $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number); - $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match); + $lookup_value = Calculation_Functions::flattenSingleValue($lookup_value); + $index_number = Calculation_Functions::flattenSingleValue($index_number); + $not_exact_match = Calculation_Functions::flattenSingleValue($not_exact_match); // index_number must be greater than or equal to 1 if ($index_number < 1) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // index_number must be less than or equal to the number of columns in lookup_array if ((!is_array($lookup_array)) || (empty($lookup_array))) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } else { $f = array_keys($lookup_array); $firstRow = array_pop($f); if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { - return PHPExcel_Calculation_Functions::REF(); + return Calculation_Functions::REF(); } else { $columnKeys = array_keys($lookup_array[$firstRow]); $firstkey = $f[0] - 1; @@ -799,7 +790,7 @@ class PHPExcel_Calculation_LookupRef { if ($rowNumber !== false) { if ((!$not_exact_match) && ($rowValue != $lookup_value)) { // if an exact match is required, we have what we need to return an appropriate response - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } else { // otherwise return the appropriate value $result = $lookup_array[$returnColumn][$rowNumber]; @@ -807,7 +798,7 @@ class PHPExcel_Calculation_LookupRef { } } - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } // function HLOOKUP() @@ -820,10 +811,10 @@ class PHPExcel_Calculation_LookupRef { * @return mixed The value of the found cell */ public static function LOOKUP($lookup_value, $lookup_vector, $result_vector=null) { - $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); + $lookup_value = Calculation_Functions::flattenSingleValue($lookup_value); if (!is_array($lookup_vector)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } $lookupRows = count($lookup_vector); $l = array_keys($lookup_vector); @@ -878,4 +869,4 @@ class PHPExcel_Calculation_LookupRef { return self::VLOOKUP($lookup_value,$lookup_vector,2); } // function LOOKUP() -} // class PHPExcel_Calculation_LookupRef +} diff --git a/Classes/PHPExcel/Calculation/MathTrig.php b/Classes/PHPExcel/Calculation/MathTrig.php index 69f296f..06c07ad 100644 --- a/Classes/PHPExcel/Calculation/MathTrig.php +++ b/Classes/PHPExcel/Calculation/MathTrig.php @@ -19,31 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_MathTrig + * PHPExcel\Calculation_MathTrig * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_MathTrig { +class Calculation_MathTrig { // // Private method to return an array of the factors of the input value @@ -98,8 +90,8 @@ class PHPExcel_Calculation_MathTrig { * @return float The inverse tangent of the specified x- and y-coordinates. */ public static function ATAN2($xCoordinate = NULL, $yCoordinate = NULL) { - $xCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($xCoordinate); - $yCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($yCoordinate); + $xCoordinate = Calculation_Functions::flattenSingleValue($xCoordinate); + $yCoordinate = Calculation_Functions::flattenSingleValue($yCoordinate); $xCoordinate = ($xCoordinate !== NULL) ? $xCoordinate : 0.0; $yCoordinate = ($yCoordinate !== NULL) ? $yCoordinate : 0.0; @@ -110,12 +102,12 @@ class PHPExcel_Calculation_MathTrig { $yCoordinate = (float) $yCoordinate; if (($xCoordinate == 0) && ($yCoordinate == 0)) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } return atan2($yCoordinate, $xCoordinate); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ATAN2() @@ -137,11 +129,11 @@ class PHPExcel_Calculation_MathTrig { * @return float Rounded Number */ public static function CEILING($number, $significance = NULL) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance); + $number = Calculation_Functions::flattenSingleValue($number); + $significance = Calculation_Functions::flattenSingleValue($significance); if ((is_null($significance)) && - (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) { + (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC)) { $significance = $number/abs($number); } @@ -151,10 +143,10 @@ class PHPExcel_Calculation_MathTrig { } elseif (self::SIGN($number) == self::SIGN($significance)) { return ceil($number / $significance) * $significance; } else { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function CEILING() @@ -174,18 +166,18 @@ class PHPExcel_Calculation_MathTrig { * @return int Number of combinations */ public static function COMBIN($numObjs, $numInSet) { - $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs); - $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet); + $numObjs = Calculation_Functions::flattenSingleValue($numObjs); + $numInSet = Calculation_Functions::flattenSingleValue($numInSet); if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { if ($numObjs < $numInSet) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif ($numInSet < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function COMBIN() @@ -207,7 +199,7 @@ class PHPExcel_Calculation_MathTrig { * @return int Rounded Number */ public static function EVEN($number) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); + $number = Calculation_Functions::flattenSingleValue($number); if (is_null($number)) { return 0; @@ -219,7 +211,7 @@ class PHPExcel_Calculation_MathTrig { $significance = 2 * self::SIGN($number); return (int) self::CEILING($number,$significance); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function EVEN() @@ -238,16 +230,16 @@ class PHPExcel_Calculation_MathTrig { * @return int Factorial */ public static function FACT($factVal) { - $factVal = PHPExcel_Calculation_Functions::flattenSingleValue($factVal); + $factVal = Calculation_Functions::flattenSingleValue($factVal); if (is_numeric($factVal)) { if ($factVal < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $factLoop = floor($factVal); - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { if ($factVal > $factLoop) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } @@ -257,7 +249,7 @@ class PHPExcel_Calculation_MathTrig { } return $factorial ; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function FACT() @@ -275,12 +267,12 @@ class PHPExcel_Calculation_MathTrig { * @return int Double Factorial */ public static function FACTDOUBLE($factVal) { - $factLoop = PHPExcel_Calculation_Functions::flattenSingleValue($factVal); + $factLoop = Calculation_Functions::flattenSingleValue($factVal); if (is_numeric($factLoop)) { $factLoop = floor($factLoop); if ($factVal < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $factorial = 1; while ($factLoop > 1) { @@ -289,7 +281,7 @@ class PHPExcel_Calculation_MathTrig { } return $factorial ; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function FACTDOUBLE() @@ -308,24 +300,24 @@ class PHPExcel_Calculation_MathTrig { * @return float Rounded Number */ public static function FLOOR($number, $significance = NULL) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance); + $number = Calculation_Functions::flattenSingleValue($number); + $significance = Calculation_Functions::flattenSingleValue($significance); - if ((is_null($significance)) && (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) { + if ((is_null($significance)) && (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC)) { $significance = $number/abs($number); } if ((is_numeric($number)) && (is_numeric($significance))) { if ((float) $significance == 0.0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } if (self::SIGN($number) == self::SIGN($significance)) { return floor($number / $significance) * $significance; } else { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function FLOOR() @@ -348,13 +340,13 @@ class PHPExcel_Calculation_MathTrig { $returnValue = 1; $allValuesFactors = array(); // Loop through arguments - foreach(PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) { + foreach(Calculation_Functions::flattenArray(func_get_args()) as $value) { if (!is_numeric($value)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } elseif ($value == 0) { continue; } elseif($value < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $myFactors = self::_factors($value); $myCountedFactors = array_count_values($myFactors); @@ -419,7 +411,7 @@ class PHPExcel_Calculation_MathTrig { * @return integer Integer value */ public static function INT($number) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); + $number = Calculation_Functions::flattenSingleValue($number); if (is_null($number)) { return 0; @@ -429,7 +421,7 @@ class PHPExcel_Calculation_MathTrig { if (is_numeric($number)) { return (int) floor($number); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function INT() @@ -453,14 +445,14 @@ class PHPExcel_Calculation_MathTrig { $returnValue = 1; $allPoweredFactors = array(); // Loop through arguments - foreach(PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) { + foreach(Calculation_Functions::flattenArray(func_get_args()) as $value) { if (!is_numeric($value)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if ($value == 0) { return 0; } elseif ($value < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $myFactors = self::_factors(floor($value)); $myCountedFactors = array_count_values($myFactors); @@ -500,13 +492,13 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function LOG_BASE($number = NULL, $base = 10) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base); + $number = Calculation_Functions::flattenSingleValue($number); + $base = (is_null($base)) ? 10 : (float) Calculation_Functions::flattenSingleValue($base); if ((!is_numeric($base)) || (!is_numeric($number))) - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); if (($base <= 0) || ($number <= 0)) - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); return log($number, $base); } // function LOG_BASE() @@ -534,7 +526,7 @@ class PHPExcel_Calculation_MathTrig { $column = 0; foreach($matrixRow as $matrixCell) { if ((is_string($matrixCell)) || ($matrixCell === null)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $matrixData[$column][$row] = $matrixCell; ++$column; @@ -542,13 +534,13 @@ class PHPExcel_Calculation_MathTrig { if ($column > $maxColumn) { $maxColumn = $column; } ++$row; } - if ($row != $maxColumn) { return PHPExcel_Calculation_Functions::VALUE(); } + if ($row != $maxColumn) { return Calculation_Functions::VALUE(); } try { - $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); + $matrix = new Shared_JAMA_Matrix($matrixData); return $matrix->det(); - } catch (PHPExcel_Exception $ex) { - return PHPExcel_Calculation_Functions::VALUE(); + } catch (Exception $ex) { + return Calculation_Functions::VALUE(); } } // function MDETERM() @@ -576,7 +568,7 @@ class PHPExcel_Calculation_MathTrig { $column = 0; foreach($matrixRow as $matrixCell) { if ((is_string($matrixCell)) || ($matrixCell === null)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $matrixData[$column][$row] = $matrixCell; ++$column; @@ -584,13 +576,13 @@ class PHPExcel_Calculation_MathTrig { if ($column > $maxColumn) { $maxColumn = $column; } ++$row; } - if ($row != $maxColumn) { return PHPExcel_Calculation_Functions::VALUE(); } + if ($row != $maxColumn) { return Calculation_Functions::VALUE(); } try { - $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); + $matrix = new Shared_JAMA_Matrix($matrixData); return $matrix->inverse()->getArray(); - } catch (PHPExcel_Exception $ex) { - return PHPExcel_Calculation_Functions::VALUE(); + } catch (Exception $ex) { + return Calculation_Functions::VALUE(); } } // function MINVERSE() @@ -613,7 +605,7 @@ class PHPExcel_Calculation_MathTrig { $columnA = 0; foreach($matrixRow as $matrixCell) { if ((is_string($matrixCell)) || ($matrixCell === null)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $matrixAData[$rowA][$columnA] = $matrixCell; ++$columnA; @@ -621,29 +613,29 @@ class PHPExcel_Calculation_MathTrig { ++$rowA; } try { - $matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData); + $matrixA = new Shared_JAMA_Matrix($matrixAData); $rowB = 0; foreach($matrixData2 as $matrixRow) { if (!is_array($matrixRow)) { $matrixRow = array($matrixRow); } $columnB = 0; foreach($matrixRow as $matrixCell) { if ((is_string($matrixCell)) || ($matrixCell === null)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $matrixBData[$rowB][$columnB] = $matrixCell; ++$columnB; } ++$rowB; } - $matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData); + $matrixB = new Shared_JAMA_Matrix($matrixBData); if (($rowA != $columnB) || ($rowB != $columnA)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } return $matrixA->times($matrixB)->getArray(); - } catch (PHPExcel_Exception $ex) { - return PHPExcel_Calculation_Functions::VALUE(); + } catch (Exception $ex) { + return Calculation_Functions::VALUE(); } } // function MMULT() @@ -656,11 +648,11 @@ class PHPExcel_Calculation_MathTrig { * @return int Remainder */ public static function MOD($a = 1, $b = 1) { - $a = PHPExcel_Calculation_Functions::flattenSingleValue($a); - $b = PHPExcel_Calculation_Functions::flattenSingleValue($b); + $a = Calculation_Functions::flattenSingleValue($a); + $b = Calculation_Functions::flattenSingleValue($b); if ($b == 0.0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } elseif (($a < 0.0) && ($b > 0.0)) { return $b - fmod(abs($a),$b); } elseif (($a > 0.0) && ($b < 0.0)) { @@ -681,8 +673,8 @@ class PHPExcel_Calculation_MathTrig { * @return float Rounded Number */ public static function MROUND($number,$multiple) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $multiple = PHPExcel_Calculation_Functions::flattenSingleValue($multiple); + $number = Calculation_Functions::flattenSingleValue($number); + $multiple = Calculation_Functions::flattenSingleValue($multiple); if ((is_numeric($number)) && (is_numeric($multiple))) { if ($multiple == 0) { @@ -692,9 +684,9 @@ class PHPExcel_Calculation_MathTrig { $multiplier = 1 / $multiple; return round($number * $multiplier) / $multiplier; } - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function MROUND() @@ -710,16 +702,16 @@ class PHPExcel_Calculation_MathTrig { $summer = 0; $divisor = 1; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) { + foreach (Calculation_Functions::flattenArray(func_get_args()) as $arg) { // Is it a numeric value? if (is_numeric($arg)) { if ($arg < 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $summer += floor($arg); $divisor *= self::FACT($arg); } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } @@ -741,7 +733,7 @@ class PHPExcel_Calculation_MathTrig { * @return int Rounded Number */ public static function ODD($number) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); + $number = Calculation_Functions::flattenSingleValue($number); if (is_null($number)) { return 1; @@ -762,7 +754,7 @@ class PHPExcel_Calculation_MathTrig { return (int) $result; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ODD() @@ -776,19 +768,19 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function POWER($x = 0, $y = 2) { - $x = PHPExcel_Calculation_Functions::flattenSingleValue($x); - $y = PHPExcel_Calculation_Functions::flattenSingleValue($y); + $x = Calculation_Functions::flattenSingleValue($x); + $y = Calculation_Functions::flattenSingleValue($y); // Validate parameters if ($x == 0.0 && $y == 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } elseif ($x == 0.0 && $y < 0.0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // Return $result = pow($x, $y); - return (!is_nan($result) && !is_infinite($result)) ? $result : PHPExcel_Calculation_Functions::NaN(); + return (!is_nan($result) && !is_infinite($result)) ? $result : Calculation_Functions::NaN(); } // function POWER() @@ -810,7 +802,7 @@ class PHPExcel_Calculation_MathTrig { $returnValue = null; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) { + foreach (Calculation_Functions::flattenArray(func_get_args()) as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if (is_null($returnValue)) { @@ -848,7 +840,7 @@ class PHPExcel_Calculation_MathTrig { $returnValue = null; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) { + foreach (Calculation_Functions::flattenArray(func_get_args()) as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if (is_null($returnValue)) { @@ -876,8 +868,8 @@ class PHPExcel_Calculation_MathTrig { * @return int Random number */ public static function RAND($min = 0, $max = 0) { - $min = PHPExcel_Calculation_Functions::flattenSingleValue($min); - $max = PHPExcel_Calculation_Functions::flattenSingleValue($max); + $min = Calculation_Functions::flattenSingleValue($min); + $max = Calculation_Functions::flattenSingleValue($max); if ($min == 0 && $max == 0) { return (rand(0,10000000)) / 10000000; @@ -888,10 +880,10 @@ class PHPExcel_Calculation_MathTrig { public static function ROMAN($aValue, $style=0) { - $aValue = PHPExcel_Calculation_Functions::flattenSingleValue($aValue); - $style = (is_null($style)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($style); + $aValue = Calculation_Functions::flattenSingleValue($aValue); + $style = (is_null($style)) ? 0 : (integer) Calculation_Functions::flattenSingleValue($style); if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $aValue = (integer) $aValue; if ($aValue == 0) { @@ -926,8 +918,8 @@ class PHPExcel_Calculation_MathTrig { * @return float Rounded Number */ public static function ROUNDUP($number,$digits) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits); + $number = Calculation_Functions::flattenSingleValue($number); + $digits = Calculation_Functions::flattenSingleValue($digits); if ((is_numeric($number)) && (is_numeric($digits))) { $significance = pow(10,(int) $digits); @@ -937,7 +929,7 @@ class PHPExcel_Calculation_MathTrig { return ceil($number * $significance) / $significance; } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ROUNDUP() @@ -951,8 +943,8 @@ class PHPExcel_Calculation_MathTrig { * @return float Rounded Number */ public static function ROUNDDOWN($number,$digits) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits); + $number = Calculation_Functions::flattenSingleValue($number); + $digits = Calculation_Functions::flattenSingleValue($digits); if ((is_numeric($number)) && (is_numeric($digits))) { $significance = pow(10,(int) $digits); @@ -962,7 +954,7 @@ class PHPExcel_Calculation_MathTrig { return floor($number * $significance) / $significance; } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function ROUNDDOWN() @@ -982,7 +974,7 @@ class PHPExcel_Calculation_MathTrig { $returnValue = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $x = array_shift($aArgs); $n = array_shift($aArgs); @@ -996,13 +988,13 @@ class PHPExcel_Calculation_MathTrig { if ((is_numeric($arg)) && (!is_string($arg))) { $returnValue += $arg * pow($x,$n + ($m * $i++)); } else { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } } // Return return $returnValue; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SERIESSUM() @@ -1016,7 +1008,7 @@ class PHPExcel_Calculation_MathTrig { * @return int sign value */ public static function SIGN($number) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); + $number = Calculation_Functions::flattenSingleValue($number); if (is_bool($number)) return (int) $number; @@ -1026,7 +1018,7 @@ class PHPExcel_Calculation_MathTrig { } return $number / abs($number); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SIGN() @@ -1039,15 +1031,15 @@ class PHPExcel_Calculation_MathTrig { * @return float Square Root of Number * Pi */ public static function SQRTPI($number) { - $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); + $number = Calculation_Functions::flattenSingleValue($number); if (is_numeric($number)) { if ($number < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return sqrt($number * M_PI) ; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SQRTPI() @@ -1062,7 +1054,7 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function SUBTOTAL() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $subtotal = array_shift($aArgs); @@ -1070,41 +1062,41 @@ class PHPExcel_Calculation_MathTrig { if ((is_numeric($subtotal)) && (!is_string($subtotal))) { switch($subtotal) { case 1 : - return PHPExcel_Calculation_Statistical::AVERAGE($aArgs); + return Calculation_Statistical::AVERAGE($aArgs); break; case 2 : - return PHPExcel_Calculation_Statistical::COUNT($aArgs); + return Calculation_Statistical::COUNT($aArgs); break; case 3 : - return PHPExcel_Calculation_Statistical::COUNTA($aArgs); + return Calculation_Statistical::COUNTA($aArgs); break; case 4 : - return PHPExcel_Calculation_Statistical::MAX($aArgs); + return Calculation_Statistical::MAX($aArgs); break; case 5 : - return PHPExcel_Calculation_Statistical::MIN($aArgs); + return Calculation_Statistical::MIN($aArgs); break; case 6 : return self::PRODUCT($aArgs); break; case 7 : - return PHPExcel_Calculation_Statistical::STDEV($aArgs); + return Calculation_Statistical::STDEV($aArgs); break; case 8 : - return PHPExcel_Calculation_Statistical::STDEVP($aArgs); + return Calculation_Statistical::STDEVP($aArgs); break; case 9 : return self::SUM($aArgs); break; case 10 : - return PHPExcel_Calculation_Statistical::VARFunc($aArgs); + return Calculation_Statistical::VARFunc($aArgs); break; case 11 : - return PHPExcel_Calculation_Statistical::VARP($aArgs); + return Calculation_Statistical::VARP($aArgs); break; } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SUBTOTAL() @@ -1126,7 +1118,7 @@ class PHPExcel_Calculation_MathTrig { $returnValue = 0; // Loop through the arguments - foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) { + foreach (Calculation_Functions::flattenArray(func_get_args()) as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { $returnValue += $arg; @@ -1156,17 +1148,17 @@ class PHPExcel_Calculation_MathTrig { // Return value $returnValue = 0; - $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs); - $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs); + $aArgs = Calculation_Functions::flattenArray($aArgs); + $sumArgs = Calculation_Functions::flattenArray($sumArgs); if (empty($sumArgs)) { $sumArgs = $aArgs; } - $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); + $condition = Calculation_Functions::_ifCondition($condition); // Loop through arguments foreach ($aArgs as $key => $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { $arg = Calculation::_wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; - if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { // Is it a value within our criteria $returnValue += $sumArgs[$key]; } @@ -1191,7 +1183,7 @@ class PHPExcel_Calculation_MathTrig { public static function SUMPRODUCT() { $arrayList = func_get_args(); - $wrkArray = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList)); + $wrkArray = Calculation_Functions::flattenArray(array_shift($arrayList)); $wrkCellCount = count($wrkArray); for ($i=0; $i< $wrkCellCount; ++$i) { @@ -1201,10 +1193,10 @@ class PHPExcel_Calculation_MathTrig { } foreach($arrayList as $matrixData) { - $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData); + $array2 = Calculation_Functions::flattenArray($matrixData); $count = count($array2); if ($wrkCellCount != $count) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } foreach ($array2 as $i => $val) { @@ -1237,7 +1229,7 @@ class PHPExcel_Calculation_MathTrig { $returnValue = 0; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) { + foreach (Calculation_Functions::flattenArray(func_get_args()) as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { $returnValue += ($arg * $arg); @@ -1257,8 +1249,8 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function SUMX2MY2($matrixData1,$matrixData2) { - $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1); - $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2); + $array1 = Calculation_Functions::flattenArray($matrixData1); + $array2 = Calculation_Functions::flattenArray($matrixData2); $count1 = count($array1); $count2 = count($array2); if ($count1 < $count2) { @@ -1287,8 +1279,8 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function SUMX2PY2($matrixData1,$matrixData2) { - $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1); - $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2); + $array1 = Calculation_Functions::flattenArray($matrixData1); + $array2 = Calculation_Functions::flattenArray($matrixData2); $count1 = count($array1); $count2 = count($array2); if ($count1 < $count2) { @@ -1317,8 +1309,8 @@ class PHPExcel_Calculation_MathTrig { * @return float */ public static function SUMXMY2($matrixData1,$matrixData2) { - $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1); - $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2); + $array1 = Calculation_Functions::flattenArray($matrixData1); + $array2 = Calculation_Functions::flattenArray($matrixData2); $count1 = count($array1); $count2 = count($array2); if ($count1 < $count2) { @@ -1349,12 +1341,12 @@ class PHPExcel_Calculation_MathTrig { * @return float Truncated value */ public static function TRUNC($value = 0, $digits = 0) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits); + $value = Calculation_Functions::flattenSingleValue($value); + $digits = Calculation_Functions::flattenSingleValue($digits); // Validate parameters if ((!is_numeric($value)) || (!is_numeric($digits))) - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); $digits = floor($digits); // Truncate @@ -1366,4 +1358,4 @@ class PHPExcel_Calculation_MathTrig { return (intval($value * $adjust)) / $adjust; } // function TRUNC() -} // class PHPExcel_Calculation_MathTrig +} diff --git a/Classes/PHPExcel/Calculation/Statistical.php b/Classes/PHPExcel/Calculation/Statistical.php index 76760f2..cf8f272 100644 --- a/Classes/PHPExcel/Calculation/Statistical.php +++ b/Classes/PHPExcel/Calculation/Statistical.php @@ -19,26 +19,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/trendClass.php'; - /** LOG_GAMMA_X_MAX_VALUE */ define('LOG_GAMMA_X_MAX_VALUE', 2.55e305); @@ -53,21 +44,21 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); /** - * PHPExcel_Calculation_Statistical + * PHPExcel\Calculation_Statistical * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Statistical { +class Calculation_Statistical { private static function _checkTrendArrays(&$array1,&$array2) { if (!is_array($array1)) { $array1 = array($array1); } if (!is_array($array2)) { $array2 = array($array2); } - $array1 = PHPExcel_Calculation_Functions::flattenArray($array1); - $array2 = PHPExcel_Calculation_Functions::flattenArray($array2); + $array1 = Calculation_Functions::flattenArray($array1); + $array2 = Calculation_Functions::flattenArray($array2); foreach($array1 as $key => $value) { if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { unset($array1[$key]); @@ -536,7 +527,7 @@ class PHPExcel_Calculation_Statistical { (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1); } // If 0 < p < 1, return a null value - return PHPExcel_Calculation_Functions::NULL(); + return Calculation_Functions::NULL(); } // function _inverse_ncdf() @@ -698,17 +689,17 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function AVEDEV() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; $aMean = self::AVERAGE($aArgs); - if ($aMean != PHPExcel_Calculation_Functions::DIV0()) { + if ($aMean != Calculation_Functions::DIV0()) { $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } // Is it a numeric value? @@ -724,11 +715,11 @@ class PHPExcel_Calculation_Statistical { // Return if ($aCount == 0) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } return $returnValue / $aCount; } - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // function AVEDEV() @@ -749,9 +740,9 @@ class PHPExcel_Calculation_Statistical { $returnValue = $aCount = 0; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { + foreach (Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } // Is it a numeric value? @@ -769,7 +760,7 @@ class PHPExcel_Calculation_Statistical { if ($aCount > 0) { return $returnValue / $aCount; } else { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } } // function AVERAGE() @@ -793,9 +784,9 @@ class PHPExcel_Calculation_Statistical { $aCount = 0; // Loop through arguments - foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { + foreach (Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { if ((is_bool($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { if (is_bool($arg)) { @@ -817,7 +808,7 @@ class PHPExcel_Calculation_Statistical { if ($aCount > 0) { return $returnValue / $aCount; } else { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } } // function AVERAGEA() @@ -841,18 +832,18 @@ class PHPExcel_Calculation_Statistical { // Return value $returnValue = 0; - $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs); - $averageArgs = PHPExcel_Calculation_Functions::flattenArray($averageArgs); + $aArgs = Calculation_Functions::flattenArray($aArgs); + $averageArgs = Calculation_Functions::flattenArray($averageArgs); if (empty($averageArgs)) { $averageArgs = $aArgs; } - $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); + $condition = Calculation_Functions::_ifCondition($condition); // Loop through arguments $aCount = 0; foreach ($aArgs as $key => $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { $arg = Calculation::_wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; - if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if ((is_null($returnValue)) || ($arg > $returnValue)) { $returnValue += $arg; ++$aCount; @@ -864,7 +855,7 @@ class PHPExcel_Calculation_Statistical { if ($aCount > 0) { return $returnValue / $aCount; } else { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } } // function AVERAGEIF() @@ -882,15 +873,15 @@ class PHPExcel_Calculation_Statistical { * */ public static function BETADIST($value,$alpha,$beta,$rMin=0,$rMax=1) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); - $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin); - $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax); + $value = Calculation_Functions::flattenSingleValue($value); + $alpha = Calculation_Functions::flattenSingleValue($alpha); + $beta = Calculation_Functions::flattenSingleValue($beta); + $rMin = Calculation_Functions::flattenSingleValue($rMin); + $rMax = Calculation_Functions::flattenSingleValue($rMax); if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($rMin > $rMax) { $tmp = $rMin; @@ -901,7 +892,7 @@ class PHPExcel_Calculation_Statistical { $value /= ($rMax - $rMin); return self::_incompleteBeta($value,$alpha,$beta); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BETADIST() @@ -920,15 +911,15 @@ class PHPExcel_Calculation_Statistical { * */ public static function BETAINV($probability,$alpha,$beta,$rMin=0,$rMax=1) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); - $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin); - $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax); + $probability = Calculation_Functions::flattenSingleValue($probability); + $alpha = Calculation_Functions::flattenSingleValue($alpha); + $beta = Calculation_Functions::flattenSingleValue($beta); + $rMin = Calculation_Functions::flattenSingleValue($rMin); + $rMax = Calculation_Functions::flattenSingleValue($rMax); if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($rMin > $rMax) { $tmp = $rMin; @@ -951,11 +942,11 @@ class PHPExcel_Calculation_Statistical { } } if ($i == MAX_ITERATIONS) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return round($rMin + $guess * ($rMax - $rMin),12); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BETAINV() @@ -978,30 +969,30 @@ class PHPExcel_Calculation_Statistical { * */ public static function BINOMDIST($value, $trials, $probability, $cumulative) { - $value = floor(PHPExcel_Calculation_Functions::flattenSingleValue($value)); - $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); + $value = floor(Calculation_Functions::flattenSingleValue($value)); + $trials = floor(Calculation_Functions::flattenSingleValue($trials)); + $probability = Calculation_Functions::flattenSingleValue($probability); if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) { if (($value < 0) || ($value > $trials)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($probability < 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { $summer = 0; for ($i = 0; $i <= $value; ++$i) { - $summer += PHPExcel_Calculation_MathTrig::COMBIN($trials,$i) * pow($probability,$i) * pow(1 - $probability,$trials - $i); + $summer += Calculation_MathTrig::COMBIN($trials,$i) * pow($probability,$i) * pow(1 - $probability,$trials - $i); } return $summer; } else { - return PHPExcel_Calculation_MathTrig::COMBIN($trials,$value) * pow($probability,$value) * pow(1 - $probability,$trials - $value) ; + return Calculation_MathTrig::COMBIN($trials,$value) * pow($probability,$value) * pow(1 - $probability,$trials - $value) ; } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function BINOMDIST() @@ -1015,22 +1006,22 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function CHIDIST($value, $degrees) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); + $value = Calculation_Functions::flattenSingleValue($value); + $degrees = floor(Calculation_Functions::flattenSingleValue($degrees)); if ((is_numeric($value)) && (is_numeric($degrees))) { if ($degrees < 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($value < 0) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { return 1; } - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return 1 - (self::_incompleteGamma($degrees/2,$value/2) / self::_gamma($degrees/2)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function CHIDIST() @@ -1044,8 +1035,8 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function CHIINV($probability, $degrees) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); + $probability = Calculation_Functions::flattenSingleValue($probability); + $degrees = floor(Calculation_Functions::flattenSingleValue($degrees)); if ((is_numeric($probability)) && (is_numeric($degrees))) { @@ -1082,11 +1073,11 @@ class PHPExcel_Calculation_Statistical { $x = $xNew; } if ($i == MAX_ITERATIONS) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return round($x,12); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function CHIINV() @@ -1102,20 +1093,20 @@ class PHPExcel_Calculation_Statistical { * */ public static function CONFIDENCE($alpha,$stdDev,$size) { - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); - $size = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size)); + $alpha = Calculation_Functions::flattenSingleValue($alpha); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); + $size = floor(Calculation_Functions::flattenSingleValue($size)); if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) { if (($alpha <= 0) || ($alpha >= 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($stdDev <= 0) || ($size < 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function CONFIDENCE() @@ -1130,18 +1121,18 @@ class PHPExcel_Calculation_Statistical { */ public static function CORREL($yValues,$xValues=null) { if ((is_null($xValues)) || (!is_array($yValues)) || (!is_array($xValues))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -1167,10 +1158,10 @@ class PHPExcel_Calculation_Statistical { $returnValue = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } // Is it a numeric value? @@ -1202,7 +1193,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric, boolean or string value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { @@ -1233,7 +1224,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a blank cell? if ((is_null($arg)) || ((is_string($arg)) && ($arg == ''))) { @@ -1264,13 +1255,13 @@ class PHPExcel_Calculation_Statistical { // Return value $returnValue = 0; - $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs); - $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); + $aArgs = Calculation_Functions::flattenArray($aArgs); + $condition = Calculation_Functions::_ifCondition($condition); // Loop through arguments foreach ($aArgs as $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { $arg = Calculation::_wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; - if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { // Is it a value within our criteria ++$returnValue; } @@ -1292,15 +1283,15 @@ class PHPExcel_Calculation_Statistical { */ public static function COVAR($yValues,$xValues) { if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -1328,19 +1319,19 @@ class PHPExcel_Calculation_Statistical { * */ public static function CRITBINOM($trials, $probability, $alpha) { - $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); + $trials = floor(Calculation_Functions::flattenSingleValue($trials)); + $probability = Calculation_Functions::flattenSingleValue($probability); + $alpha = Calculation_Functions::flattenSingleValue($alpha); if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) { if ($trials < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($probability < 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($alpha < 0) || ($alpha > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($alpha <= 0.5) { $t = sqrt(log(1 / ($alpha * $alpha))); @@ -1414,7 +1405,7 @@ class PHPExcel_Calculation_Statistical { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function CRITBINOM() @@ -1432,18 +1423,18 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function DEVSQ() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; $aMean = self::AVERAGE($aArgs); - if ($aMean != PHPExcel_Calculation_Functions::DIV0()) { + if ($aMean != Calculation_Functions::DIV0()) { $aCount = -1; foreach ($aArgs as $k => $arg) { // Is it a numeric value? if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } if ((is_numeric($arg)) && (!is_string($arg))) { @@ -1458,7 +1449,7 @@ class PHPExcel_Calculation_Statistical { // Return if (is_null($returnValue)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } else { return $returnValue; } @@ -1480,13 +1471,13 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function EXPONDIST($value, $lambda, $cumulative) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $lambda = PHPExcel_Calculation_Functions::flattenSingleValue($lambda); - $cumulative = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative); + $value = Calculation_Functions::flattenSingleValue($value); + $lambda = Calculation_Functions::flattenSingleValue($lambda); + $cumulative = Calculation_Functions::flattenSingleValue($cumulative); if ((is_numeric($value)) && (is_numeric($lambda))) { if (($value < 0) || ($lambda < 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { @@ -1496,7 +1487,7 @@ class PHPExcel_Calculation_Statistical { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function EXPONDIST() @@ -1511,15 +1502,15 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function FISHER($value) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); + $value = Calculation_Functions::flattenSingleValue($value); if (is_numeric($value)) { if (($value <= -1) || ($value >= 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return 0.5 * log((1+$value)/(1-$value)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function FISHER() @@ -1534,12 +1525,12 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function FISHERINV($value) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); + $value = Calculation_Functions::flattenSingleValue($value); if (is_numeric($value)) { return (exp(2 * $value) - 1) / (exp(2 * $value) + 1); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function FISHERINV() @@ -1554,21 +1545,21 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function FORECAST($xValue,$yValues,$xValues) { - $xValue = PHPExcel_Calculation_Functions::flattenSingleValue($xValue); + $xValue = Calculation_Functions::flattenSingleValue($xValue); if (!is_numeric($xValue)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -1589,13 +1580,13 @@ class PHPExcel_Calculation_Statistical { * */ public static function GAMMADIST($value,$a,$b,$cumulative) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $a = PHPExcel_Calculation_Functions::flattenSingleValue($a); - $b = PHPExcel_Calculation_Functions::flattenSingleValue($b); + $value = Calculation_Functions::flattenSingleValue($value); + $a = Calculation_Functions::flattenSingleValue($a); + $b = Calculation_Functions::flattenSingleValue($b); if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) { if (($value < 0) || ($a <= 0) || ($b <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { @@ -1605,7 +1596,7 @@ class PHPExcel_Calculation_Statistical { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function GAMMADIST() @@ -1621,13 +1612,13 @@ class PHPExcel_Calculation_Statistical { * */ public static function GAMMAINV($probability,$alpha,$beta) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); + $probability = Calculation_Functions::flattenSingleValue($probability); + $alpha = Calculation_Functions::flattenSingleValue($alpha); + $beta = Calculation_Functions::flattenSingleValue($beta); if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) { if (($alpha <= 0) || ($beta <= 0) || ($probability < 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $xLo = 0; @@ -1662,11 +1653,11 @@ class PHPExcel_Calculation_Statistical { $x = $xNew; } if ($i == MAX_ITERATIONS) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return $x; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function GAMMAINV() @@ -1679,15 +1670,15 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function GAMMALN($value) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); + $value = Calculation_Functions::flattenSingleValue($value); if (is_numeric($value)) { if ($value <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return log(self::_gamma($value)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function GAMMALN() @@ -1707,16 +1698,16 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function GEOMEAN() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); - $aMean = PHPExcel_Calculation_MathTrig::PRODUCT($aArgs); + $aMean = Calculation_MathTrig::PRODUCT($aArgs); if (is_numeric($aMean) && ($aMean > 0)) { $aCount = self::COUNT($aArgs) ; if (self::MIN($aArgs) > 0) { return pow($aMean, (1 / $aCount)); } } - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // GEOMEAN() @@ -1732,10 +1723,10 @@ class PHPExcel_Calculation_Statistical { * @return array of float */ public static function GROWTH($yValues,$xValues=array(),$newValues=array(),$const=True) { - $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); - $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); - $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); + $yValues = Calculation_Functions::flattenArray($yValues); + $xValues = Calculation_Functions::flattenArray($xValues); + $newValues = Calculation_Functions::flattenArray($newValues); + $const = (is_null($const)) ? True : (boolean) Calculation_Functions::flattenSingleValue($const); $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); if (empty($newValues)) { @@ -1767,19 +1758,19 @@ class PHPExcel_Calculation_Statistical { */ public static function HARMEAN() { // Return value - $returnValue = PHPExcel_Calculation_Functions::NA(); + $returnValue = Calculation_Functions::NA(); // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); if (self::MIN($aArgs) < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $aCount = 0; foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if ($arg <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (is_null($returnValue)) { $returnValue = (1 / $arg); @@ -1813,26 +1804,26 @@ class PHPExcel_Calculation_Statistical { * */ public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) { - $sampleSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleSuccesses)); - $sampleNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleNumber)); - $populationSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationSuccesses)); - $populationNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationNumber)); + $sampleSuccesses = floor(Calculation_Functions::flattenSingleValue($sampleSuccesses)); + $sampleNumber = floor(Calculation_Functions::flattenSingleValue($sampleNumber)); + $populationSuccesses = floor(Calculation_Functions::flattenSingleValue($populationSuccesses)); + $populationNumber = floor(Calculation_Functions::flattenSingleValue($populationNumber)); if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) { if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - return PHPExcel_Calculation_MathTrig::COMBIN($populationSuccesses,$sampleSuccesses) * - PHPExcel_Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses,$sampleNumber - $sampleSuccesses) / - PHPExcel_Calculation_MathTrig::COMBIN($populationNumber,$sampleNumber); + return Calculation_MathTrig::COMBIN($populationSuccesses,$sampleSuccesses) * + Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses,$sampleNumber - $sampleSuccesses) / + Calculation_MathTrig::COMBIN($populationNumber,$sampleNumber); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function HYPGEOMDIST() @@ -1847,15 +1838,15 @@ class PHPExcel_Calculation_Statistical { */ public static function INTERCEPT($yValues,$xValues) { if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -1875,7 +1866,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function KURT() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); $mean = self::AVERAGE($aArgs); $stdDev = self::STDEV($aArgs); @@ -1884,7 +1875,7 @@ class PHPExcel_Calculation_Statistical { // Loop through arguments foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -1899,7 +1890,7 @@ class PHPExcel_Calculation_Statistical { return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1,2) / (($count-2) * ($count-3))); } } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function KURT() @@ -1920,7 +1911,7 @@ class PHPExcel_Calculation_Statistical { * */ public static function LARGE() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $entry = floor(array_pop($aArgs)); @@ -1936,12 +1927,12 @@ class PHPExcel_Calculation_Statistical { $count = self::COUNT($mArgs); $entry = floor(--$entry); if (($entry < 0) || ($entry >= $count) || ($count == 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } rsort($mArgs); return $mArgs[$entry]; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function LARGE() @@ -1958,19 +1949,19 @@ class PHPExcel_Calculation_Statistical { * @return array */ public static function LINEST($yValues, $xValues = NULL, $const = TRUE, $stats = FALSE) { - $const = (is_null($const)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); - $stats = (is_null($stats)) ? FALSE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); + $const = (is_null($const)) ? TRUE : (boolean) Calculation_Functions::flattenSingleValue($const); + $stats = (is_null($stats)) ? FALSE : (boolean) Calculation_Functions::flattenSingleValue($stats); + if (is_null($xValues)) $xValues = range(1,count(Calculation_Functions::flattenArray($yValues))); if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { return 0; } @@ -2011,25 +2002,25 @@ class PHPExcel_Calculation_Statistical { * @return array */ public static function LOGEST($yValues,$xValues=null,$const=True,$stats=False) { - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); - $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); + $const = (is_null($const)) ? True : (boolean) Calculation_Functions::flattenSingleValue($const); + $stats = (is_null($stats)) ? False : (boolean) Calculation_Functions::flattenSingleValue($stats); + if (is_null($xValues)) $xValues = range(1,count(Calculation_Functions::flattenArray($yValues))); if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); foreach($yValues as $value) { if ($value <= 0.0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { return 1; } @@ -2072,17 +2063,17 @@ class PHPExcel_Calculation_Statistical { * (as described at) http://home.online.no/~pjacklam/notes/invnorm/ */ public static function LOGINV($probability, $mean, $stdDev) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); + $probability = Calculation_Functions::flattenSingleValue($probability); + $mean = Calculation_Functions::flattenSingleValue($mean); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return exp($mean + $stdDev * self::NORMSINV($probability)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function LOGINV() @@ -2098,17 +2089,17 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function LOGNORMDIST($value, $mean, $stdDev) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); + $value = Calculation_Functions::flattenSingleValue($value); + $mean = Calculation_Functions::flattenSingleValue($mean); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { if (($value <= 0) || ($stdDev <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::NORMSDIST((log($value) - $mean) / $stdDev); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function LOGNORMDIST() @@ -2131,7 +2122,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = null; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -2167,7 +2158,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = null; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { @@ -2208,17 +2199,17 @@ class PHPExcel_Calculation_Statistical { // Return value $returnValue = null; - $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs); - $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs); + $aArgs = Calculation_Functions::flattenArray($aArgs); + $sumArgs = Calculation_Functions::flattenArray($sumArgs); if (empty($sumArgs)) { $sumArgs = $aArgs; } - $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); + $condition = Calculation_Functions::_ifCondition($condition); // Loop through arguments foreach ($aArgs as $key => $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { $arg = Calculation::_wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; - if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if ((is_null($returnValue)) || ($arg > $returnValue)) { $returnValue = $arg; } @@ -2245,11 +2236,11 @@ class PHPExcel_Calculation_Statistical { */ public static function MEDIAN() { // Return value - $returnValue = PHPExcel_Calculation_Functions::NaN(); + $returnValue = Calculation_Functions::NaN(); $mArgs = array(); // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -2293,7 +2284,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = null; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -2329,7 +2320,7 @@ class PHPExcel_Calculation_Statistical { $returnValue = null; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { @@ -2370,17 +2361,17 @@ class PHPExcel_Calculation_Statistical { // Return value $returnValue = null; - $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs); - $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs); + $aArgs = Calculation_Functions::flattenArray($aArgs); + $sumArgs = Calculation_Functions::flattenArray($sumArgs); if (empty($sumArgs)) { $sumArgs = $aArgs; } - $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); + $condition = Calculation_Functions::_ifCondition($condition); // Loop through arguments foreach ($aArgs as $key => $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { $arg = Calculation::_wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; - if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if ((is_null($returnValue)) || ($arg < $returnValue)) { $returnValue = $arg; } @@ -2420,7 +2411,7 @@ class PHPExcel_Calculation_Statistical { array_multisort($frequencyList, SORT_DESC, $valueList, SORT_ASC, SORT_NUMERIC, $frequencyArray); if ($frequencyArray[0]['frequency'] == 1) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return $frequencyArray[0]['value']; } // function _modeCalc() @@ -2441,10 +2432,10 @@ class PHPExcel_Calculation_Statistical { */ public static function MODE() { // Return value - $returnValue = PHPExcel_Calculation_Functions::NA(); + $returnValue = Calculation_Functions::NA(); // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $mArgs = array(); foreach ($aArgs as $arg) { @@ -2479,25 +2470,25 @@ class PHPExcel_Calculation_Statistical { * */ public static function NEGBINOMDIST($failures, $successes, $probability) { - $failures = floor(PHPExcel_Calculation_Functions::flattenSingleValue($failures)); - $successes = floor(PHPExcel_Calculation_Functions::flattenSingleValue($successes)); - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); + $failures = floor(Calculation_Functions::flattenSingleValue($failures)); + $successes = floor(Calculation_Functions::flattenSingleValue($successes)); + $probability = Calculation_Functions::flattenSingleValue($probability); if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) { if (($failures < 0) || ($successes < 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if (($probability < 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_GNUMERIC) { if (($failures + $successes - 1) <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } } - return (PHPExcel_Calculation_MathTrig::COMBIN($failures + $successes - 1,$successes - 1)) * (pow($probability,$successes)) * (pow(1 - $probability,$failures)) ; + return (Calculation_MathTrig::COMBIN($failures + $successes - 1,$successes - 1)) * (pow($probability,$successes)) * (pow(1 - $probability,$failures)) ; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function NEGBINOMDIST() @@ -2516,23 +2507,23 @@ class PHPExcel_Calculation_Statistical { * */ public static function NORMDIST($value, $mean, $stdDev, $cumulative) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); + $value = Calculation_Functions::flattenSingleValue($value); + $mean = Calculation_Functions::flattenSingleValue($mean); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { if ($stdDev < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { - return 0.5 * (1 + PHPExcel_Calculation_Engineering::_erfVal(($value - $mean) / ($stdDev * sqrt(2)))); + return 0.5 * (1 + Calculation_Engineering::_erfVal(($value - $mean) / ($stdDev * sqrt(2)))); } else { return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean,2) / (2 * ($stdDev * $stdDev)))); } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function NORMDIST() @@ -2548,20 +2539,20 @@ class PHPExcel_Calculation_Statistical { * */ public static function NORMINV($probability,$mean,$stdDev) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); + $probability = Calculation_Functions::flattenSingleValue($probability); + $mean = Calculation_Functions::flattenSingleValue($mean); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { if (($probability < 0) || ($probability > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ($stdDev < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return (self::_inverse_ncdf($probability) * $stdDev) + $mean; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function NORMINV() @@ -2576,7 +2567,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function NORMSDIST($value) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); + $value = Calculation_Functions::flattenSingleValue($value); return self::NORMDIST($value, 0, 1, True); } // function NORMSDIST() @@ -2610,14 +2601,14 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function PERCENTILE() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $entry = array_pop($aArgs); if ((is_numeric($entry)) && (!is_string($entry))) { if (($entry < 0) || ($entry > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $mArgs = array(); foreach ($aArgs as $arg) { @@ -2641,7 +2632,7 @@ class PHPExcel_Calculation_Statistical { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function PERCENTILE() @@ -2656,9 +2647,9 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function PERCENTRANK($valueSet,$value,$significance=3) { - $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet); - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $significance = (is_null($significance)) ? 3 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($significance); + $valueSet = Calculation_Functions::flattenArray($valueSet); + $value = Calculation_Functions::flattenSingleValue($value); + $significance = (is_null($significance)) ? 3 : (integer) Calculation_Functions::flattenSingleValue($significance); foreach($valueSet as $key => $valueEntry) { if (!is_numeric($valueEntry)) { @@ -2668,12 +2659,12 @@ class PHPExcel_Calculation_Statistical { sort($valueSet,SORT_NUMERIC); $valueCount = count($valueSet); if ($valueCount == 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $valueAdjustor = $valueCount - 1; if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } $pos = array_search($value,$valueSet); @@ -2705,17 +2696,17 @@ class PHPExcel_Calculation_Statistical { * @return int Number of permutations */ public static function PERMUT($numObjs,$numInSet) { - $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs); - $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet); + $numObjs = Calculation_Functions::flattenSingleValue($numObjs); + $numInSet = Calculation_Functions::flattenSingleValue($numInSet); if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { $numInSet = floor($numInSet); if ($numObjs < $numInSet) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } - return round(PHPExcel_Calculation_MathTrig::FACT($numObjs) / PHPExcel_Calculation_MathTrig::FACT($numObjs - $numInSet)); + return round(Calculation_MathTrig::FACT($numObjs) / Calculation_MathTrig::FACT($numObjs - $numInSet)); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function PERMUT() @@ -2733,26 +2724,26 @@ class PHPExcel_Calculation_Statistical { * */ public static function POISSON($value, $mean, $cumulative) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); + $value = Calculation_Functions::flattenSingleValue($value); + $mean = Calculation_Functions::flattenSingleValue($mean); if ((is_numeric($value)) && (is_numeric($mean))) { if (($value <= 0) || ($mean <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { $summer = 0; for ($i = 0; $i <= floor($value); ++$i) { - $summer += pow($mean,$i) / PHPExcel_Calculation_MathTrig::FACT($i); + $summer += pow($mean,$i) / Calculation_MathTrig::FACT($i); } return exp(0-$mean) * $summer; } else { - return (exp(0-$mean) * pow($mean,$value)) / PHPExcel_Calculation_MathTrig::FACT($value); + return (exp(0-$mean) * pow($mean,$value)) / Calculation_MathTrig::FACT($value); } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function POISSON() @@ -2771,7 +2762,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function QUARTILE() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $entry = floor(array_pop($aArgs)); @@ -2779,11 +2770,11 @@ class PHPExcel_Calculation_Statistical { if ((is_numeric($entry)) && (!is_string($entry))) { $entry /= 4; if (($entry < 0) || ($entry > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return self::PERCENTILE($aArgs,$entry); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function QUARTILE() @@ -2798,9 +2789,9 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function RANK($value,$valueSet,$order=0) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet); - $order = (is_null($order)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($order); + $value = Calculation_Functions::flattenSingleValue($value); + $valueSet = Calculation_Functions::flattenArray($valueSet); + $order = (is_null($order)) ? 0 : (integer) Calculation_Functions::flattenSingleValue($order); foreach($valueSet as $key => $valueEntry) { if (!is_numeric($valueEntry)) { @@ -2815,7 +2806,7 @@ class PHPExcel_Calculation_Statistical { } $pos = array_search($value,$valueSet); if ($pos === False) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return ++$pos; @@ -2833,15 +2824,15 @@ class PHPExcel_Calculation_Statistical { */ public static function RSQ($yValues,$xValues) { if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -2861,7 +2852,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function SKEW() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); $mean = self::AVERAGE($aArgs); $stdDev = self::STDEV($aArgs); @@ -2869,7 +2860,7 @@ class PHPExcel_Calculation_Statistical { // Loop through arguments foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -2883,7 +2874,7 @@ class PHPExcel_Calculation_Statistical { if ($count > 2) { return $summer * ($count / (($count-1) * ($count-2))); } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function SKEW() @@ -2898,15 +2889,15 @@ class PHPExcel_Calculation_Statistical { */ public static function SLOPE($yValues,$xValues) { if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -2930,7 +2921,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function SMALL() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $entry = array_pop($aArgs); @@ -2946,12 +2937,12 @@ class PHPExcel_Calculation_Statistical { $count = self::COUNT($mArgs); $entry = floor(--$entry); if (($entry < 0) || ($entry >= $count) || ($count == 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } sort($mArgs); return $mArgs[$entry]; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SMALL() @@ -2966,17 +2957,17 @@ class PHPExcel_Calculation_Statistical { * @return float Standardized value */ public static function STANDARDIZE($value,$mean,$stdDev) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); + $value = Calculation_Functions::flattenSingleValue($value); + $mean = Calculation_Functions::flattenSingleValue($mean); + $stdDev = Calculation_Functions::flattenSingleValue($stdDev); if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { if ($stdDev <= 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } return ($value - $mean) / $stdDev ; } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function STANDARDIZE() @@ -2995,7 +2986,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function STDEV() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; @@ -3005,7 +2996,7 @@ class PHPExcel_Calculation_Statistical { $aCount = -1; foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } // Is it a numeric value? @@ -3024,7 +3015,7 @@ class PHPExcel_Calculation_Statistical { return sqrt($returnValue / $aCount); } } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function STDEV() @@ -3042,7 +3033,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function STDEVA() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; @@ -3052,7 +3043,7 @@ class PHPExcel_Calculation_Statistical { $aCount = -1; foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { @@ -3076,7 +3067,7 @@ class PHPExcel_Calculation_Statistical { return sqrt($returnValue / $aCount); } } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function STDEVA() @@ -3094,7 +3085,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function STDEVP() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; @@ -3104,7 +3095,7 @@ class PHPExcel_Calculation_Statistical { $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { + ((!Calculation_Functions::isCellValue($k)) || (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { $arg = (integer) $arg; } // Is it a numeric value? @@ -3123,7 +3114,7 @@ class PHPExcel_Calculation_Statistical { return sqrt($returnValue / $aCount); } } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function STDEVP() @@ -3141,7 +3132,7 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function STDEVPA() { - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); // Return value $returnValue = null; @@ -3151,7 +3142,7 @@ class PHPExcel_Calculation_Statistical { $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { @@ -3175,7 +3166,7 @@ class PHPExcel_Calculation_Statistical { return sqrt($returnValue / $aCount); } } - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } // function STDEVPA() @@ -3190,15 +3181,15 @@ class PHPExcel_Calculation_Statistical { */ public static function STEYX($yValues,$xValues) { if (!self::_checkTrendArrays($yValues,$xValues)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } $yValueCount = count($yValues); $xValueCount = count($xValues); if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } elseif ($yValueCount == 1) { - return PHPExcel_Calculation_Functions::DIV0(); + return Calculation_Functions::DIV0(); } $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); @@ -3217,13 +3208,13 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function TDIST($value, $degrees, $tails) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); - $tails = floor(PHPExcel_Calculation_Functions::flattenSingleValue($tails)); + $value = Calculation_Functions::flattenSingleValue($value); + $degrees = floor(Calculation_Functions::flattenSingleValue($degrees)); + $tails = floor(Calculation_Functions::flattenSingleValue($tails)); if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) { if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } // tdist, which finds the probability that corresponds to a given value // of t with k degrees of freedom. This algorithm is translated from a @@ -3263,7 +3254,7 @@ class PHPExcel_Calculation_Statistical { return 1 - abs((1 - $tValue) - $tValue); } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TDIST() @@ -3277,8 +3268,8 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function TINV($probability, $degrees) { - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); + $probability = Calculation_Functions::flattenSingleValue($probability); + $degrees = floor(Calculation_Functions::flattenSingleValue($degrees)); if ((is_numeric($probability)) && (is_numeric($degrees))) { $xLo = 100; @@ -3314,11 +3305,11 @@ class PHPExcel_Calculation_Statistical { $x = $xNew; } if ($i == MAX_ITERATIONS) { - return PHPExcel_Calculation_Functions::NA(); + return Calculation_Functions::NA(); } return round($x,12); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TINV() @@ -3334,10 +3325,10 @@ class PHPExcel_Calculation_Statistical { * @return array of float */ public static function TREND($yValues,$xValues=array(),$newValues=array(),$const=True) { - $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); - $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); - $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); + $yValues = Calculation_Functions::flattenArray($yValues); + $xValues = Calculation_Functions::flattenArray($xValues); + $newValues = Calculation_Functions::flattenArray($newValues); + $const = (is_null($const)) ? True : (boolean) Calculation_Functions::flattenSingleValue($const); $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); if (empty($newValues)) { @@ -3370,14 +3361,14 @@ class PHPExcel_Calculation_Statistical { * @return float */ public static function TRIMMEAN() { - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); // Calculate $percent = array_pop($aArgs); if ((is_numeric($percent)) && (!is_string($percent))) { if (($percent < 0) || ($percent > 1)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $mArgs = array(); foreach ($aArgs as $arg) { @@ -3394,7 +3385,7 @@ class PHPExcel_Calculation_Statistical { } return self::AVERAGE($mArgs); } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function TRIMMEAN() @@ -3413,12 +3404,12 @@ class PHPExcel_Calculation_Statistical { */ public static function VARFunc() { // Return value - $returnValue = PHPExcel_Calculation_Functions::DIV0(); + $returnValue = Calculation_Functions::DIV0(); $summerA = $summerB = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $aCount = 0; foreach ($aArgs as $arg) { if (is_bool($arg)) { $arg = (integer) $arg; } @@ -3455,19 +3446,19 @@ class PHPExcel_Calculation_Statistical { */ public static function VARA() { // Return value - $returnValue = PHPExcel_Calculation_Functions::DIV0(); + $returnValue = Calculation_Functions::DIV0(); $summerA = $summerB = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_string($arg)) && - (PHPExcel_Calculation_Functions::isValue($k))) { - return PHPExcel_Calculation_Functions::VALUE(); + (Calculation_Functions::isValue($k))) { + return Calculation_Functions::VALUE(); } elseif ((is_string($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { @@ -3508,12 +3499,12 @@ class PHPExcel_Calculation_Statistical { */ public static function VARP() { // Return value - $returnValue = PHPExcel_Calculation_Functions::DIV0(); + $returnValue = Calculation_Functions::DIV0(); $summerA = $summerB = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); $aCount = 0; foreach ($aArgs as $arg) { if (is_bool($arg)) { $arg = (integer) $arg; } @@ -3550,19 +3541,19 @@ class PHPExcel_Calculation_Statistical { */ public static function VARPA() { // Return value - $returnValue = PHPExcel_Calculation_Functions::DIV0(); + $returnValue = Calculation_Functions::DIV0(); $summerA = $summerB = 0; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); + $aArgs = Calculation_Functions::flattenArrayIndexed(func_get_args()); $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_string($arg)) && - (PHPExcel_Calculation_Functions::isValue($k))) { - return PHPExcel_Calculation_Functions::VALUE(); + (Calculation_Functions::isValue($k))) { + return Calculation_Functions::VALUE(); } elseif ((is_string($arg)) && - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { + (!Calculation_Functions::isMatrixValue($k))) { } else { // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { @@ -3602,13 +3593,13 @@ class PHPExcel_Calculation_Statistical { * */ public static function WEIBULL($value, $alpha, $beta, $cumulative) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); + $value = Calculation_Functions::flattenSingleValue($value); + $alpha = Calculation_Functions::flattenSingleValue($alpha); + $beta = Calculation_Functions::flattenSingleValue($beta); if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) { if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { @@ -3618,7 +3609,7 @@ class PHPExcel_Calculation_Statistical { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function WEIBULL() @@ -3636,9 +3627,9 @@ class PHPExcel_Calculation_Statistical { * */ public static function ZTEST($dataSet, $m0, $sigma = NULL) { - $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet); - $m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0); - $sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma); + $dataSet = Calculation_Functions::flattenArrayIndexed($dataSet); + $m0 = Calculation_Functions::flattenSingleValue($m0); + $sigma = Calculation_Functions::flattenSingleValue($sigma); if (is_null($sigma)) { $sigma = self::STDEV($dataSet); @@ -3648,4 +3639,4 @@ class PHPExcel_Calculation_Statistical { return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0)/($sigma/SQRT($n))); } // function ZTEST() -} // class PHPExcel_Calculation_Statistical +} diff --git a/Classes/PHPExcel/Calculation/TextData.php b/Classes/PHPExcel/Calculation/TextData.php index 90447c0..72226bf 100644 --- a/Classes/PHPExcel/Calculation/TextData.php +++ b/Classes/PHPExcel/Calculation/TextData.php @@ -19,31 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Calculation_TextData + * PHPExcel\Calculation_TextData * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_TextData { +class Calculation_TextData { private static $_invalidChars = Null; @@ -61,7 +53,7 @@ class PHPExcel_Calculation_TextData { if (ord($c{0}) >= 252 && ord($c{0}) <= 253) return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); return 0; } // function _uniord() @@ -72,10 +64,10 @@ class PHPExcel_Calculation_TextData { * @return int */ public static function CHARACTER($character) { - $character = PHPExcel_Calculation_Functions::flattenSingleValue($character); + $character = Calculation_Functions::flattenSingleValue($character); if ((!is_numeric($character)) || ($character < 0)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (function_exists('mb_convert_encoding')) { @@ -93,10 +85,10 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function TRIMNONPRINTABLE($stringValue = '') { - $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); + $stringValue = Calculation_Functions::flattenSingleValue($stringValue); if (is_bool($stringValue)) { - return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + return ($stringValue) ? Calculation::getTRUE() : Calculation::getFALSE(); } if (self::$_invalidChars == Null) { @@ -117,10 +109,10 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function TRIMSPACES($stringValue = '') { - $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); + $stringValue = Calculation_Functions::flattenSingleValue($stringValue); if (is_bool($stringValue)) { - return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + return ($stringValue) ? Calculation::getTRUE() : Calculation::getFALSE(); } if (is_string($stringValue) || is_numeric($stringValue)) { @@ -138,13 +130,13 @@ class PHPExcel_Calculation_TextData { */ public static function ASCIICODE($characters) { if (($characters === NULL) || ($characters === '')) - return PHPExcel_Calculation_Functions::VALUE(); - $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters); + return Calculation_Functions::VALUE(); + $characters = Calculation_Functions::flattenSingleValue($characters); if (is_bool($characters)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $characters = (int) $characters; } else { - $characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $characters = ($characters) ? Calculation::getTRUE() : Calculation::getFALSE(); } } @@ -169,13 +161,13 @@ class PHPExcel_Calculation_TextData { $returnValue = ''; // Loop through arguments - $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); + $aArgs = Calculation_Functions::flattenArray(func_get_args()); foreach ($aArgs as $arg) { if (is_bool($arg)) { - if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { + if (Calculation_Functions::getCompatibilityMode() == Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $arg = (int) $arg; } else { - $arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $arg = ($arg) ? Calculation::getTRUE() : Calculation::getFALSE(); } } $returnValue .= $arg; @@ -199,12 +191,12 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function DOLLAR($value = 0, $decimals = 2) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals); + $value = Calculation_Functions::flattenSingleValue($value); + $decimals = is_null($decimals) ? 0 : Calculation_Functions::flattenSingleValue($decimals); // Validate parameters if (!is_numeric($value) || !is_numeric($decimals)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $decimals = floor($decimals); @@ -214,10 +206,10 @@ class PHPExcel_Calculation_TextData { } else { $round = pow(10,abs($decimals)); if ($value < 0) { $round = 0-$round; } - $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round); + $value = Calculation_MathTrig::MROUND($value, $round); } - return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask); + return Style_NumberFormat::toFormattedString($value, $mask); } // function DOLLAR() @@ -231,17 +223,17 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function SEARCHSENSITIVE($needle,$haystack,$offset=1) { - $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle); - $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); - $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset); + $needle = Calculation_Functions::flattenSingleValue($needle); + $haystack = Calculation_Functions::flattenSingleValue($haystack); + $offset = Calculation_Functions::flattenSingleValue($offset); if (!is_bool($needle)) { if (is_bool($haystack)) { - $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $haystack = ($haystack) ? Calculation::getTRUE() : Calculation::getFALSE(); } - if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { - if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { + if (($offset > 0) && (Shared_String::CountCharacters($haystack) > $offset)) { + if (Shared_String::CountCharacters($needle) == 0) { return $offset; } if (function_exists('mb_strpos')) { @@ -254,7 +246,7 @@ class PHPExcel_Calculation_TextData { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SEARCHSENSITIVE() @@ -267,17 +259,17 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function SEARCHINSENSITIVE($needle,$haystack,$offset=1) { - $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle); - $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); - $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset); + $needle = Calculation_Functions::flattenSingleValue($needle); + $haystack = Calculation_Functions::flattenSingleValue($haystack); + $offset = Calculation_Functions::flattenSingleValue($offset); if (!is_bool($needle)) { if (is_bool($haystack)) { - $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $haystack = ($haystack) ? Calculation::getTRUE() : Calculation::getFALSE(); } - if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { - if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { + if (($offset > 0) && (Shared_String::CountCharacters($haystack) > $offset)) { + if (Shared_String::CountCharacters($needle) == 0) { return $offset; } if (function_exists('mb_stripos')) { @@ -290,7 +282,7 @@ class PHPExcel_Calculation_TextData { } } } - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } // function SEARCHINSENSITIVE() @@ -303,13 +295,13 @@ class PHPExcel_Calculation_TextData { * @return boolean */ public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals); - $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas); + $value = Calculation_Functions::flattenSingleValue($value); + $decimals = Calculation_Functions::flattenSingleValue($decimals); + $no_commas = Calculation_Functions::flattenSingleValue($no_commas); // Validate parameters if (!is_numeric($value) || !is_numeric($decimals)) { - return PHPExcel_Calculation_Functions::NaN(); + return Calculation_Functions::NaN(); } $decimals = floor($decimals); @@ -331,15 +323,15 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function LEFT($value = '', $chars = 1) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars); + $value = Calculation_Functions::flattenSingleValue($value); + $chars = Calculation_Functions::flattenSingleValue($chars); if ($chars < 0) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_bool($value)) { - $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); } if (function_exists('mb_substr')) { @@ -359,16 +351,16 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function MID($value = '', $start = 1, $chars = null) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $start = PHPExcel_Calculation_Functions::flattenSingleValue($start); - $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars); + $value = Calculation_Functions::flattenSingleValue($value); + $start = Calculation_Functions::flattenSingleValue($start); + $chars = Calculation_Functions::flattenSingleValue($chars); if (($start < 1) || ($chars < 0)) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_bool($value)) { - $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); } if (function_exists('mb_substr')) { @@ -387,15 +379,15 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function RIGHT($value = '', $chars = 1) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars); + $value = Calculation_Functions::flattenSingleValue($value); + $chars = Calculation_Functions::flattenSingleValue($chars); if ($chars < 0) { - return PHPExcel_Calculation_Functions::VALUE(); + return Calculation_Functions::VALUE(); } if (is_bool($value)) { - $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); } if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) { @@ -413,10 +405,10 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function STRINGLENGTH($value = '') { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); + $value = Calculation_Functions::flattenSingleValue($value); if (is_bool($value)) { - $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); } if (function_exists('mb_strlen')) { @@ -436,13 +428,13 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function LOWERCASE($mixedCaseString) { - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); + $mixedCaseString = Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); } - return PHPExcel_Shared_String::StrToLower($mixedCaseString); + return Shared_String::StrToLower($mixedCaseString); } // function LOWERCASE() @@ -455,13 +447,13 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function UPPERCASE($mixedCaseString) { - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); + $mixedCaseString = Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); } - return PHPExcel_Shared_String::StrToUpper($mixedCaseString); + return Shared_String::StrToUpper($mixedCaseString); } // function UPPERCASE() @@ -474,13 +466,13 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function PROPERCASE($mixedCaseString) { - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); + $mixedCaseString = Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); } - return PHPExcel_Shared_String::StrToTitle($mixedCaseString); + return Shared_String::StrToTitle($mixedCaseString); } // function PROPERCASE() @@ -494,10 +486,10 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) { - $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText); - $start = PHPExcel_Calculation_Functions::flattenSingleValue($start); - $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars); - $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText); + $oldText = Calculation_Functions::flattenSingleValue($oldText); + $start = Calculation_Functions::flattenSingleValue($start); + $chars = Calculation_Functions::flattenSingleValue($chars); + $newText = Calculation_Functions::flattenSingleValue($newText); $left = self::LEFT($oldText,$start-1); $right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1); @@ -516,10 +508,10 @@ class PHPExcel_Calculation_TextData { * @return string */ public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) { - $text = PHPExcel_Calculation_Functions::flattenSingleValue($text); - $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText); - $toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText); - $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance)); + $text = Calculation_Functions::flattenSingleValue($text); + $fromText = Calculation_Functions::flattenSingleValue($fromText); + $toText = Calculation_Functions::flattenSingleValue($toText); + $instance = floor(Calculation_Functions::flattenSingleValue($instance)); if ($instance == 0) { if(function_exists('mb_str_replace')) { @@ -560,7 +552,7 @@ class PHPExcel_Calculation_TextData { * @return boolean */ public static function RETURNSTRING($testValue = '') { - $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue); + $testValue = Calculation_Functions::flattenSingleValue($testValue); if (is_string($testValue)) { return $testValue; @@ -577,14 +569,14 @@ class PHPExcel_Calculation_TextData { * @return boolean */ public static function TEXTFORMAT($value,$format) { - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); - $format = PHPExcel_Calculation_Functions::flattenSingleValue($format); + $value = Calculation_Functions::flattenSingleValue($value); + $format = Calculation_Functions::flattenSingleValue($format); - if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) { - $value = PHPExcel_Calculation_DateTime::DATEVALUE($value); + if ((is_string($value)) && (!is_numeric($value)) && Shared_Date::isDateTimeFormatCode($format)) { + $value = Calculation_DateTime::DATEVALUE($value); } - return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format); + return (string) Style_NumberFormat::toFormattedString($value,$format); } // function TEXTFORMAT() -} // class PHPExcel_Calculation_TextData +} diff --git a/Classes/PHPExcel/Calculation/Token/Stack.php b/Classes/PHPExcel/Calculation/Token/Stack.php index 05825d1..63979b8 100644 --- a/Classes/PHPExcel/Calculation/Token/Stack.php +++ b/Classes/PHPExcel/Calculation/Token/Stack.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Calculation + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Calculation_Token_Stack + * PHPExcel\Calculation_Token_Stack * - * @category PHPExcel_Calculation_Token_Stack - * @package PHPExcel_Calculation + * @category PHPExcel\Calculation_Token_Stack + * @package PHPExcel\Calculation * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Token_Stack { +class Calculation_Token_Stack { /** * The parser stack for formulae @@ -72,7 +74,7 @@ class PHPExcel_Calculation_Token_Stack { 'reference' => $reference ); if ($type == 'Function') { - $localeFunction = PHPExcel_Calculation::_localeFunc($value); + $localeFunction = Calculation::_localeFunc($value); if ($localeFunction != $value) { $this->_stack[($this->_count - 1)]['localeValue'] = $localeFunction; } @@ -112,4 +114,4 @@ class PHPExcel_Calculation_Token_Stack { $this->_count = 0; } -} // class PHPExcel_Calculation_Token_Stack +} diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 6664e64..47086e5 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Cell + * PHPExcel\Cell * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell +class Cell { /** @@ -46,7 +48,7 @@ class PHPExcel_Cell /** * Value binder to use * - * @var PHPExcel_Cell_IValueBinder + * @var PHPExcel\Cell_IValueBinder */ private static $_valueBinder = NULL; @@ -79,7 +81,7 @@ class PHPExcel_Cell /** * Parent worksheet * - * @var PHPExcel_CachedObjectStorage_CacheBase + * @var PHPExcel\CachedObjectStorage_CacheBase */ private $_parent; @@ -112,7 +114,7 @@ class PHPExcel_Cell $this->_parent = NULL; } - public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) { + public function attach(CachedObjectStorage_CacheBase $parent) { $this->_parent = $parent; @@ -124,10 +126,10 @@ class PHPExcel_Cell * * @param mixed $pValue * @param string $pDataType - * @param PHPExcel_Worksheet $pSheet - * @throws PHPExcel_Exception + * @param PHPExcel\Worksheet $pSheet + * @throws PHPExcel\Exception */ - public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL) + public function __construct($pValue = NULL, $pDataType = NULL, Worksheet $pSheet = NULL) { // Initialise cell value $this->_value = $pValue; @@ -137,12 +139,12 @@ class PHPExcel_Cell // Set datatype? if ($pDataType !== NULL) { - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; + if ($pDataType == Cell_DataType::TYPE_STRING2) + $pDataType = Cell_DataType::TYPE_STRING; $this->_dataType = $pDataType; } else { if (!self::getValueBinder()->bindValue($this, $pValue)) { - throw new PHPExcel_Exception("Value could not be bound to cell."); + throw new Exception("Value could not be bound to cell."); } } @@ -197,7 +199,7 @@ class PHPExcel_Cell */ public function getFormattedValue() { - return (string) PHPExcel_Style_NumberFormat::toFormattedString( + return (string) Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()) ->getNumberFormat()->getFormatCode() @@ -210,13 +212,13 @@ class PHPExcel_Cell * Sets the value for a cell, automatically determining the datatype using the value binder * * @param mixed $pValue Value - * @return PHPExcel_Cell - * @throws PHPExcel_Exception + * @return PHPExcel\Cell + * @throws PHPExcel\Exception */ public function setValue($pValue = NULL) { if (!self::getValueBinder()->bindValue($this, $pValue)) { - throw new PHPExcel_Exception("Value could not be bound to cell."); + throw new Exception("Value could not be bound to cell."); } return $this; } @@ -226,34 +228,34 @@ class PHPExcel_Cell * * @param mixed $pValue Value * @param string $pDataType Explicit data type - * @return PHPExcel_Cell - * @throws PHPExcel_Exception + * @return PHPExcel\Cell + * @throws PHPExcel\Exception */ - public function setValueExplicit($pValue = NULL, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + public function setValueExplicit($pValue = NULL, $pDataType = Cell_DataType::TYPE_STRING) { // set the value according to data type switch ($pDataType) { - case PHPExcel_Cell_DataType::TYPE_STRING2: - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; - case PHPExcel_Cell_DataType::TYPE_STRING: - case PHPExcel_Cell_DataType::TYPE_NULL: - case PHPExcel_Cell_DataType::TYPE_INLINE: - $this->_value = PHPExcel_Cell_DataType::checkString($pValue); + case Cell_DataType::TYPE_STRING2: + $pDataType = Cell_DataType::TYPE_STRING; + case Cell_DataType::TYPE_STRING: + case Cell_DataType::TYPE_NULL: + case Cell_DataType::TYPE_INLINE: + $this->_value = Cell_DataType::checkString($pValue); break; - case PHPExcel_Cell_DataType::TYPE_NUMERIC: + case Cell_DataType::TYPE_NUMERIC: $this->_value = (float)$pValue; break; - case PHPExcel_Cell_DataType::TYPE_FORMULA: + case Cell_DataType::TYPE_FORMULA: $this->_value = (string)$pValue; break; - case PHPExcel_Cell_DataType::TYPE_BOOL: + case Cell_DataType::TYPE_BOOL: $this->_value = (bool)$pValue; break; - case PHPExcel_Cell_DataType::TYPE_ERROR: - $this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue); + case Cell_DataType::TYPE_ERROR: + $this->_value = Cell_DataType::checkErrorCode($pValue); break; default: - throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType); + throw new Exception('Invalid datatype: ' . $pDataType); break; } @@ -270,15 +272,15 @@ class PHPExcel_Cell * * @param boolean $resetLog Whether the calculation engine logger should be reset or not * @return mixed - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function getCalculatedValue($resetLog = TRUE) { //echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL; - if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { + if ($this->_dataType == Cell_DataType::TYPE_FORMULA) { try { //echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL; - $result = PHPExcel_Calculation::getInstance( + $result = Calculation::getInstance( $this->getWorksheet()->getParent() )->calculateCellValue($this,$resetLog); //echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL; @@ -288,14 +290,14 @@ class PHPExcel_Cell $result = array_pop($result); } } - } catch ( PHPExcel_Exception $ex ) { + } catch ( Exception $ex ) { if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { //echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; return $this->_calculatedValue; // Fallback for calculations referencing external files. } //echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL; $result = '#N/A'; - throw new PHPExcel_Calculation_Exception( + throw new Calculation_Exception( $this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage() ); } @@ -306,7 +308,7 @@ class PHPExcel_Cell } //echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL; return $result; - } elseif($this->_value instanceof PHPExcel_RichText) { + } elseif($this->_value instanceof RichText) { // echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'
'; return $this->_value->getPlainText(); } @@ -318,7 +320,7 @@ class PHPExcel_Cell * Set old calculated value (cached) * * @param mixed $pValue Value - * @return PHPExcel_Cell + * @return PHPExcel\Cell */ public function setCalculatedValue($pValue = NULL) { @@ -358,12 +360,12 @@ class PHPExcel_Cell * Set cell data type * * @param string $pDataType - * @return PHPExcel_Cell + * @return PHPExcel\Cell */ - public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + public function setDataType($pDataType = Cell_DataType::TYPE_STRING) { - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; + if ($pDataType == Cell_DataType::TYPE_STRING2) + $pDataType = Cell_DataType::TYPE_STRING; $this->_dataType = $pDataType; @@ -374,12 +376,12 @@ class PHPExcel_Cell * Does this cell contain Data validation rules? * * @return boolean - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function hasDataValidation() { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet'); + throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); } return $this->getWorksheet()->dataValidationExists($this->getCoordinate()); @@ -388,13 +390,13 @@ class PHPExcel_Cell /** * Get Data validation rules * - * @return PHPExcel_Cell_DataValidation - * @throws PHPExcel_Exception + * @return PHPExcel\Cell_DataValidation + * @throws PHPExcel\Exception */ public function getDataValidation() { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet'); + throw new Exception('Cannot get data validation for cell that is not bound to a worksheet'); } return $this->getWorksheet()->getDataValidation($this->getCoordinate()); @@ -403,14 +405,14 @@ class PHPExcel_Cell /** * Set Data validation rules * - * @param PHPExcel_Cell_DataValidation $pDataValidation - * @return PHPExcel_Cell - * @throws PHPExcel_Exception + * @param PHPExcel\Cell_DataValidation $pDataValidation + * @return PHPExcel\Cell + * @throws PHPExcel\Exception */ - public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = NULL) + public function setDataValidation(Cell_DataValidation $pDataValidation = NULL) { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet'); + throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); } $this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation); @@ -422,12 +424,12 @@ class PHPExcel_Cell * Does this cell contain a Hyperlink? * * @return boolean - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function hasHyperlink() { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); + throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); } return $this->getWorksheet()->hyperlinkExists($this->getCoordinate()); @@ -436,13 +438,13 @@ class PHPExcel_Cell /** * Get Hyperlink * - * @return PHPExcel_Cell_Hyperlink - * @throws PHPExcel_Exception + * @return PHPExcel\Cell_Hyperlink + * @throws PHPExcel\Exception */ public function getHyperlink() { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); + throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); } return $this->getWorksheet()->getHyperlink($this->getCoordinate()); @@ -451,14 +453,14 @@ class PHPExcel_Cell /** * Set Hyperlink * - * @param PHPExcel_Cell_Hyperlink $pHyperlink - * @return PHPExcel_Cell - * @throws PHPExcel_Exception + * @param PHPExcel\Cell_Hyperlink $pHyperlink + * @return PHPExcel\Cell + * @throws PHPExcel\Exception */ - public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = NULL) + public function setHyperlink(Cell_Hyperlink $pHyperlink = NULL) { if (!isset($this->_parent)) { - throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); + throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); } $this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink); @@ -469,7 +471,7 @@ class PHPExcel_Cell /** * Get parent worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getParent() { return $this->_parent; @@ -478,7 +480,7 @@ class PHPExcel_Cell /** * Get parent worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getWorksheet() { return $this->_parent->getParent(); @@ -487,7 +489,7 @@ class PHPExcel_Cell /** * Get cell style * - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getStyle() { @@ -497,10 +499,10 @@ class PHPExcel_Cell /** * Re-bind parent * - * @param PHPExcel_Worksheet $parent - * @return PHPExcel_Cell + * @param PHPExcel\Worksheet $parent + * @return PHPExcel\Cell */ - public function rebindParent(PHPExcel_Worksheet $parent) { + public function rebindParent(Worksheet $parent) { $this->_parent = $parent->getCellCacheController(); return $this->notifyCacheController(); @@ -531,19 +533,19 @@ class PHPExcel_Cell * * @param string $pCoordinateString * @return array Array containing column and row (indexes 0 and 1) - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function coordinateFromString($pCoordinateString = 'A1') { if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { return array($matches[1],$matches[2]); } elseif ((strpos($pCoordinateString,':') !== FALSE) || (strpos($pCoordinateString,',') !== FALSE)) { - throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); + throw new Exception('Cell coordinate string can not be a range of cells'); } elseif ($pCoordinateString == '') { - throw new PHPExcel_Exception('Cell coordinate can not be zero-length string'); + throw new Exception('Cell coordinate can not be zero-length string'); } - throw new PHPExcel_Exception('Invalid cell coordinate '.$pCoordinateString); + throw new Exception('Invalid cell coordinate '.$pCoordinateString); } /** @@ -552,7 +554,7 @@ class PHPExcel_Cell * @param string $pCoordinateString e.g. 'A' or '1' or 'A1' * Note that this value can be a row or column reference as well as a cell reference * @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1' - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function absoluteReference($pCoordinateString = 'A1') { @@ -574,7 +576,7 @@ class PHPExcel_Cell return $worksheet . self::absoluteCoordinate($pCoordinateString); } - throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); + throw new Exception('Cell coordinate string can not be a range of cells'); } /** @@ -582,7 +584,7 @@ class PHPExcel_Cell * * @param string $pCoordinateString e.g. 'A1' * @return string Absolute coordinate e.g. '$A$1' - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function absoluteCoordinate($pCoordinateString = 'A1') { @@ -602,7 +604,7 @@ class PHPExcel_Cell return $worksheet . '$' . $column . '$' . $row; } - throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); + throw new Exception('Cell coordinate string can not be a range of cells'); } /** @@ -633,13 +635,13 @@ class PHPExcel_Cell * * @param array $pRange Array containg one or more arrays containing one or two coordinate strings * @return string String representation of $pRange - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function buildRange($pRange) { // Verify range if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) { - throw new PHPExcel_Exception('Range does not contain any information'); + throw new Exception('Range does not contain any information'); } // Build range @@ -734,6 +736,7 @@ class PHPExcel_Cell * * @param string $pString * @return int Column index (base 1 !!!) + * @throws PHPExcel\Exception */ public static function columnIndexFromString($pString = 'A') { @@ -769,7 +772,7 @@ class PHPExcel_Cell return $_indexCache[$pString]; } } - throw new PHPExcel_Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty")); + throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty")); } /** @@ -866,11 +869,11 @@ class PHPExcel_Cell /** * Compare 2 cells * - * @param PHPExcel_Cell $a Cell a - * @param PHPExcel_Cell $b Cell b + * @param PHPExcel\Cell $a Cell a + * @param PHPExcel\Cell $b Cell b * @return int Result of comparison (always -1 or 1, never zero!) */ - public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) + public static function compareCells(Cell $a, Cell $b) { if ($a->getRow() < $b->getRow()) { return -1; @@ -886,11 +889,11 @@ class PHPExcel_Cell /** * Get value binder to use * - * @return PHPExcel_Cell_IValueBinder + * @return PHPExcel\Cell_IValueBinder */ public static function getValueBinder() { if (self::$_valueBinder === NULL) { - self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder(); + self::$_valueBinder = new Cell_DefaultValueBinder(); } return self::$_valueBinder; @@ -899,12 +902,12 @@ class PHPExcel_Cell /** * Set value binder to use * - * @param PHPExcel_Cell_IValueBinder $binder - * @throws PHPExcel_Exception + * @param PHPExcel\Cell_IValueBinder $binder + * @throws PHPExcel\Exception */ - public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) { + public static function setValueBinder(Cell_IValueBinder $binder = NULL) { if ($binder === NULL) { - throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); + throw new Exception("A PHPExcel\Cell_IValueBinder is required for PHPExcel to function correctly."); } self::$_valueBinder = $binder; @@ -938,7 +941,7 @@ class PHPExcel_Cell * Set index to cellXf * * @param int $pValue - * @return PHPExcel_Cell + * @return PHPExcel\Cell */ public function setXfIndex($pValue = 0) { diff --git a/Classes/PHPExcel/Cell/AdvancedValueBinder.php b/Classes/PHPExcel/Cell/AdvancedValueBinder.php index d6c0433..8abf60c 100644 --- a/Classes/PHPExcel/Cell/AdvancedValueBinder.php +++ b/Classes/PHPExcel/Cell/AdvancedValueBinder.php @@ -19,63 +19,55 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Cell_AdvancedValueBinder + * PHPExcel\Cell_AdvancedValueBinder * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder +class Cell_AdvancedValueBinder extends Cell_DefaultValueBinder implements Cell_IValueBinder { /** * Bind value to a cell * - * @param PHPExcel_Cell $cell Cell to bind value to + * @param PHPExcel\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell * @return boolean */ - public function bindValue(PHPExcel_Cell $cell, $value = null) + public function bindValue(Cell $cell, $value = null) { // sanitize UTF-8 strings if (is_string($value)) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); + $value = Shared_String::SanitizeUTF8($value); } // Find out data type $dataType = parent::dataTypeForValue($value); // Style logic - strings - if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { + if ($dataType === Cell_DataType::TYPE_STRING && !$value instanceof RichText) { // Test for booleans using locale-setting - if ($value == PHPExcel_Calculation::getTRUE()) { - $cell->setValueExplicit( TRUE, PHPExcel_Cell_DataType::TYPE_BOOL); + if ($value == Calculation::getTRUE()) { + $cell->setValueExplicit( TRUE, Cell_DataType::TYPE_BOOL); return true; - } elseif($value == PHPExcel_Calculation::getFALSE()) { - $cell->setValueExplicit( FALSE, PHPExcel_Cell_DataType::TYPE_BOOL); + } elseif($value == Calculation::getFALSE()) { + $cell->setValueExplicit( FALSE, Cell_DataType::TYPE_BOOL); return true; } // Check for number in scientific format - if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + if (preg_match('/^'.Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { + $cell->setValueExplicit( (float) $value, Cell_DataType::TYPE_NUMERIC); return true; } @@ -84,7 +76,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder // Convert value to number $value = $matches[2] / $matches[3]; if ($matches[1] == '-') $value = 0 - $value; - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit( (float) $value, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) ->getNumberFormat()->setFormatCode( '??/??' ); @@ -93,7 +85,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder // Convert value to number $value = $matches[2] + ($matches[3] / $matches[4]); if ($matches[1] == '-') $value = 0 - $value; - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit( (float) $value, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) ->getNumberFormat()->setFormatCode( '# ??/??' ); @@ -104,34 +96,34 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) { // Convert value to number $value = (float) str_replace('%', '', $value) / 100; - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit( $value, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 ); + ->getNumberFormat()->setFormatCode( Style_NumberFormat::FORMAT_PERCENTAGE_00 ); return true; } // Check for currency - $currencyCode = PHPExcel_Shared_String::getCurrencyCode(); - $decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator(); - $thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator(); + $currencyCode = Shared_String::getCurrencyCode(); + $decimalSeparator = Shared_String::getDecimalSeparator(); + $thousandsSeparator = Shared_String::getThousandsSeparator(); if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) { // Convert value to number $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value)); - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit( $value, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) ->getNumberFormat()->setFormatCode( - str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ) + str_replace('$', $currencyCode, Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ) ); return true; } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { // Convert value to number $value = (float) trim(str_replace(array('$',','), '', $value)); - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit( $value, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ); + ->getNumberFormat()->setFormatCode( Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ); return true; } @@ -140,10 +132,10 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder // Convert value to number list($h, $m) = explode(':', $value); $days = $h / 24 + $m / 1440; - $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($days, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 ); + ->getNumberFormat()->setFormatCode( Style_NumberFormat::FORMAT_DATE_TIME3 ); return true; } @@ -153,17 +145,17 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder list($h, $m, $s) = explode(':', $value); $days = $h / 24 + $m / 1440 + $s / 86400; // Convert value to number - $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($days, Cell_DataType::TYPE_NUMERIC); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 ); + ->getNumberFormat()->setFormatCode( Style_NumberFormat::FORMAT_DATE_TIME4 ); return true; } // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' - if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) { + if (($d = Shared_Date::stringToExcel($value)) !== false) { // Convert value to number - $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($d, Cell_DataType::TYPE_NUMERIC); // Determine style. Either there is a time part or not. Look for ':' if (strpos($value, ':') !== false) { $formatCode = 'yyyy-mm-dd h:mm'; @@ -177,8 +169,8 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder // Check for newline character "\n" if (strpos($value, "\n") !== FALSE) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); - $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); + $value = Shared_String::SanitizeUTF8($value); + $cell->setValueExplicit($value, Cell_DataType::TYPE_STRING); // Set style $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) ->getAlignment()->setWrapText(TRUE); diff --git a/Classes/PHPExcel/Cell/DataType.php b/Classes/PHPExcel/Cell/DataType.php index 6ec30ce..7983255 100644 --- a/Classes/PHPExcel/Cell/DataType.php +++ b/Classes/PHPExcel/Cell/DataType.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Cell_DataType + * PHPExcel\Cell_DataType * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell_DataType +class Cell_DataType { /* Data types */ const TYPE_STRING2 = 'str'; @@ -72,12 +74,12 @@ class PHPExcel_Cell_DataType /** * DataType for value * - * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0 + * @deprecated Replaced by PHPExcel\Cell_IValueBinder infrastructure, will be removed in version 1.8.0 * @param mixed $pValue * @return string */ public static function dataTypeForValue($pValue = null) { - return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue); + return Cell_DefaultValueBinder::dataTypeForValue($pValue); } /** @@ -88,13 +90,13 @@ class PHPExcel_Cell_DataType */ public static function checkString($pValue = null) { - if ($pValue instanceof PHPExcel_RichText) { + if ($pValue instanceof RichText) { // TODO: Sanitize Rich-Text string (max. character count is 32,767) return $pValue; } // string must never be longer than 32,767 characters, truncate if necessary - $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767); + $pValue = Shared_String::Substring($pValue, 0, 32767); // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); diff --git a/Classes/PHPExcel/Cell/DataValidation.php b/Classes/PHPExcel/Cell/DataValidation.php index 80bf91f..93b0ca7 100644 --- a/Classes/PHPExcel/Cell/DataValidation.php +++ b/Classes/PHPExcel/Cell/DataValidation.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Cell_DataValidation + * PHPExcel\Cell_DataValidation * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell_DataValidation +class Cell_DataValidation { /* Data validation types */ const TYPE_NONE = 'none'; @@ -79,14 +81,14 @@ class PHPExcel_Cell_DataValidation * * @var string */ - private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE; + private $_type = Cell_DataValidation::TYPE_NONE; /** * Error style * * @var string */ - private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; + private $_errorStyle = Cell_DataValidation::STYLE_STOP; /** * Operator @@ -152,15 +154,15 @@ class PHPExcel_Cell_DataValidation private $_prompt; /** - * Create a new PHPExcel_Cell_DataValidation + * Create a new PHPExcel\Cell_DataValidation */ public function __construct() { // Initialise member variables $this->_formula1 = ''; $this->_formula2 = ''; - $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; - $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; + $this->_type = Cell_DataValidation::TYPE_NONE; + $this->_errorStyle = Cell_DataValidation::STYLE_STOP; $this->_operator = ''; $this->_allowBlank = FALSE; $this->_showDropDown = FALSE; @@ -185,7 +187,7 @@ class PHPExcel_Cell_DataValidation * Set Formula 1 * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setFormula1($value = '') { $this->_formula1 = $value; @@ -205,7 +207,7 @@ class PHPExcel_Cell_DataValidation * Set Formula 2 * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setFormula2($value = '') { $this->_formula2 = $value; @@ -225,9 +227,9 @@ class PHPExcel_Cell_DataValidation * Set Type * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ - public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) { + public function setType($value = Cell_DataValidation::TYPE_NONE) { $this->_type = $value; return $this; } @@ -245,9 +247,9 @@ class PHPExcel_Cell_DataValidation * Set Error style * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ - public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) { + public function setErrorStyle($value = Cell_DataValidation::STYLE_STOP) { $this->_errorStyle = $value; return $this; } @@ -265,7 +267,7 @@ class PHPExcel_Cell_DataValidation * Set Operator * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setOperator($value = '') { $this->_operator = $value; @@ -285,7 +287,7 @@ class PHPExcel_Cell_DataValidation * Set Allow Blank * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setAllowBlank($value = false) { $this->_allowBlank = $value; @@ -305,7 +307,7 @@ class PHPExcel_Cell_DataValidation * Set Show DropDown * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setShowDropDown($value = false) { $this->_showDropDown = $value; @@ -325,7 +327,7 @@ class PHPExcel_Cell_DataValidation * Set Show InputMessage * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setShowInputMessage($value = false) { $this->_showInputMessage = $value; @@ -345,7 +347,7 @@ class PHPExcel_Cell_DataValidation * Set Show ErrorMessage * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setShowErrorMessage($value = false) { $this->_showErrorMessage = $value; @@ -365,7 +367,7 @@ class PHPExcel_Cell_DataValidation * Set Error title * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setErrorTitle($value = '') { $this->_errorTitle = $value; @@ -385,7 +387,7 @@ class PHPExcel_Cell_DataValidation * Set Error * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setError($value = '') { $this->_error = $value; @@ -405,7 +407,7 @@ class PHPExcel_Cell_DataValidation * Set Prompt title * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setPromptTitle($value = '') { $this->_promptTitle = $value; @@ -425,7 +427,7 @@ class PHPExcel_Cell_DataValidation * Set Prompt * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return PHPExcel\Cell_DataValidation */ public function setPrompt($value = '') { $this->_prompt = $value; @@ -441,8 +443,8 @@ class PHPExcel_Cell_DataValidation return md5( $this->_formula1 . $this->_formula2 - . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE - . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP + . $this->_type = Cell_DataValidation::TYPE_NONE + . $this->_errorStyle = Cell_DataValidation::STYLE_STOP . $this->_operator . ($this->_allowBlank ? 't' : 'f') . ($this->_showDropDown ? 't' : 'f') diff --git a/Classes/PHPExcel/Cell/DefaultValueBinder.php b/Classes/PHPExcel/Cell/DefaultValueBinder.php index 6d71a03..1fca830 100644 --- a/Classes/PHPExcel/Cell/DefaultValueBinder.php +++ b/Classes/PHPExcel/Cell/DefaultValueBinder.php @@ -19,44 +19,36 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - +namespace PHPExcel; /** - * PHPExcel_Cell_DefaultValueBinder + * PHPExcel\Cell_DefaultValueBinder * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder +class Cell_DefaultValueBinder implements Cell_IValueBinder { /** * Bind value to a cell * - * @param PHPExcel_Cell $cell Cell to bind value to + * @param PHPExcel\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell * @return boolean */ - public function bindValue(PHPExcel_Cell $cell, $value = null) + public function bindValue(Cell $cell, $value = null) { // sanitize UTF-8 strings if (is_string($value)) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); + $value = Shared_String::SanitizeUTF8($value); } // Set value explicit @@ -75,31 +67,31 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder public static function dataTypeForValue($pValue = null) { // Match the value against a few data types if (is_null($pValue)) { - return PHPExcel_Cell_DataType::TYPE_NULL; + return Cell_DataType::TYPE_NULL; } elseif ($pValue === '') { - return PHPExcel_Cell_DataType::TYPE_STRING; + return Cell_DataType::TYPE_STRING; - } elseif ($pValue instanceof PHPExcel_RichText) { - return PHPExcel_Cell_DataType::TYPE_INLINE; + } elseif ($pValue instanceof RichText) { + return Cell_DataType::TYPE_INLINE; } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { - return PHPExcel_Cell_DataType::TYPE_FORMULA; + return Cell_DataType::TYPE_FORMULA; } elseif (is_bool($pValue)) { - return PHPExcel_Cell_DataType::TYPE_BOOL; + return Cell_DataType::TYPE_BOOL; } elseif (is_float($pValue) || is_int($pValue)) { - return PHPExcel_Cell_DataType::TYPE_NUMERIC; + return Cell_DataType::TYPE_NUMERIC; } elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) { - return PHPExcel_Cell_DataType::TYPE_NUMERIC; + return Cell_DataType::TYPE_NUMERIC; - } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { - return PHPExcel_Cell_DataType::TYPE_ERROR; + } elseif (is_string($pValue) && array_key_exists($pValue, Cell_DataType::getErrorCodes())) { + return Cell_DataType::TYPE_ERROR; } else { - return PHPExcel_Cell_DataType::TYPE_STRING; + return Cell_DataType::TYPE_STRING; } } diff --git a/Classes/PHPExcel/Cell/Hyperlink.php b/Classes/PHPExcel/Cell/Hyperlink.php index 910a048..1984d38 100644 --- a/Classes/PHPExcel/Cell/Hyperlink.php +++ b/Classes/PHPExcel/Cell/Hyperlink.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Cell_Hyperlink + * PHPExcel\Cell_Hyperlink * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Cell_Hyperlink +class Cell_Hyperlink { /** * URL to link the cell to @@ -50,7 +52,7 @@ class PHPExcel_Cell_Hyperlink private $_tooltip; /** - * Create a new PHPExcel_Cell_Hyperlink + * Create a new PHPExcel\Cell_Hyperlink * * @param string $pUrl Url to link the cell to * @param string $pTooltip Tooltip to display on the hyperlink @@ -75,7 +77,7 @@ class PHPExcel_Cell_Hyperlink * Set URL * * @param string $value - * @return PHPExcel_Cell_Hyperlink + * @return PHPExcel\Cell_Hyperlink */ public function setUrl($value = '') { $this->_url = $value; @@ -95,7 +97,7 @@ class PHPExcel_Cell_Hyperlink * Set tooltip * * @param string $value - * @return PHPExcel_Cell_Hyperlink + * @return PHPExcel\Cell_Hyperlink */ public function setTooltip($value = '') { $this->_tooltip = $value; diff --git a/Classes/PHPExcel/Cell/IValueBinder.php b/Classes/PHPExcel/Cell/IValueBinder.php index b07df74..2349825 100644 --- a/Classes/PHPExcel/Cell/IValueBinder.php +++ b/Classes/PHPExcel/Cell/IValueBinder.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Cell_IValueBinder + * PHPExcel\Cell_IValueBinder * * @category PHPExcel - * @package PHPExcel_Cell + * @package PHPExcel\Cell * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_Cell_IValueBinder +interface Cell_IValueBinder { /** * Bind value to a cell * - * @param PHPExcel_Cell $cell Cell to bind value to + * @param PHPExcel\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell * @return boolean */ - public function bindValue(PHPExcel_Cell $cell, $value = NULL); + public function bindValue(Cell $cell, $value = NULL); } diff --git a/Classes/PHPExcel/Chart.php b/Classes/PHPExcel/Chart.php index 0e9b487..24c738e 100644 --- a/Classes/PHPExcel/Chart.php +++ b/Classes/PHPExcel/Chart.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart + * PHPExcel\Chart * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart +class Chart { /** * Chart Name @@ -45,42 +47,42 @@ class PHPExcel_Chart /** * Worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_worksheet = null; /** * Chart Title * - * @var PHPExcel_Chart_Title + * @var PHPExcel\Chart_Title */ private $_title = null; /** * Chart Legend * - * @var PHPExcel_Chart_Legend + * @var PHPExcel\Chart_Legend */ private $_legend = null; /** * X-Axis Label * - * @var PHPExcel_Chart_Title + * @var PHPExcel\Chart_Title */ private $_xAxisLabel = null; /** * Y-Axis Label * - * @var PHPExcel_Chart_Title + * @var PHPExcel\Chart_Title */ private $_yAxisLabel = null; /** * Chart Plot Area * - * @var PHPExcel_Chart_PlotArea + * @var PHPExcel\Chart_PlotArea */ private $_plotArea = null; @@ -148,9 +150,9 @@ class PHPExcel_Chart /** - * Create a new PHPExcel_Chart + * Create a new PHPExcel\Chart */ - public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null) + public function __construct($name, Chart_Title $title = null, Chart_Legend $legend = null, Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Chart_Title $xAxisLabel = null, Chart_Title $yAxisLabel = null) { $this->_name = $name; $this->_title = $title; @@ -174,7 +176,7 @@ class PHPExcel_Chart /** * Get Worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getWorksheet() { return $this->_worksheet; @@ -183,11 +185,11 @@ class PHPExcel_Chart /** * Set Worksheet * - * @param PHPExcel_Worksheet $pValue - * @throws PHPExcel_Chart_Exception - * @return PHPExcel_Chart + * @param PHPExcel\Worksheet $pValue + * @throws PHPExcel\Chart_Exception + * @return PHPExcel\Chart */ - public function setWorksheet(PHPExcel_Worksheet $pValue = null) { + public function setWorksheet(Worksheet $pValue = null) { $this->_worksheet = $pValue; return $this; @@ -196,7 +198,7 @@ class PHPExcel_Chart /** * Get Title * - * @return PHPExcel_Chart_Title + * @return PHPExcel\Chart_Title */ public function getTitle() { return $this->_title; @@ -205,10 +207,10 @@ class PHPExcel_Chart /** * Set Title * - * @param PHPExcel_Chart_Title $title - * @return PHPExcel_Chart + * @param PHPExcel\Chart_Title $title + * @return PHPExcel\Chart */ - public function setTitle(PHPExcel_Chart_Title $title) { + public function setTitle(Chart_Title $title) { $this->_title = $title; return $this; @@ -217,7 +219,7 @@ class PHPExcel_Chart /** * Get Legend * - * @return PHPExcel_Chart_Legend + * @return PHPExcel\Chart_Legend */ public function getLegend() { return $this->_legend; @@ -226,10 +228,10 @@ class PHPExcel_Chart /** * Set Legend * - * @param PHPExcel_Chart_Legend $legend - * @return PHPExcel_Chart + * @param PHPExcel\Chart_Legend $legend + * @return PHPExcel\Chart */ - public function setLegend(PHPExcel_Chart_Legend $legend) { + public function setLegend(Chart_Legend $legend) { $this->_legend = $legend; return $this; @@ -238,7 +240,7 @@ class PHPExcel_Chart /** * Get X-Axis Label * - * @return PHPExcel_Chart_Title + * @return PHPExcel\Chart_Title */ public function getXAxisLabel() { return $this->_xAxisLabel; @@ -247,10 +249,10 @@ class PHPExcel_Chart /** * Set X-Axis Label * - * @param PHPExcel_Chart_Title $label - * @return PHPExcel_Chart + * @param PHPExcel\Chart_Title $label + * @return PHPExcel\Chart */ - public function setXAxisLabel(PHPExcel_Chart_Title $label) { + public function setXAxisLabel(Chart_Title $label) { $this->_xAxisLabel = $label; return $this; @@ -259,7 +261,7 @@ class PHPExcel_Chart /** * Get Y-Axis Label * - * @return PHPExcel_Chart_Title + * @return PHPExcel\Chart_Title */ public function getYAxisLabel() { return $this->_yAxisLabel; @@ -268,10 +270,10 @@ class PHPExcel_Chart /** * Set Y-Axis Label * - * @param PHPExcel_Chart_Title $label - * @return PHPExcel_Chart + * @param PHPExcel\Chart_Title $label + * @return PHPExcel\Chart */ - public function setYAxisLabel(PHPExcel_Chart_Title $label) { + public function setYAxisLabel(Chart_Title $label) { $this->_yAxisLabel = $label; return $this; @@ -280,7 +282,7 @@ class PHPExcel_Chart /** * Get Plot Area * - * @return PHPExcel_Chart_PlotArea + * @return PHPExcel\Chart_PlotArea */ public function getPlotArea() { return $this->_plotArea; @@ -299,7 +301,7 @@ class PHPExcel_Chart * Set Plot Visible Only * * @param boolean $plotVisibleOnly - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setPlotVisibleOnly($plotVisibleOnly = true) { $this->_plotVisibleOnly = $plotVisibleOnly; @@ -320,7 +322,7 @@ class PHPExcel_Chart * Set Display Blanks as * * @param string $displayBlanksAs - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setDisplayBlanksAs($displayBlanksAs = '0') { $this->_displayBlanksAs = $displayBlanksAs; @@ -333,7 +335,7 @@ class PHPExcel_Chart * @param string $cell * @param integer $xOffset * @param integer $yOffset - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) { $this->_topLeftCellRef = $cell; @@ -370,7 +372,7 @@ class PHPExcel_Chart * Set the Top Left cell position for the chart * * @param string $cell - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setTopLeftCell($cell) { $this->_topLeftCellRef = $cell; @@ -383,7 +385,7 @@ class PHPExcel_Chart * * @param integer $xOffset * @param integer $yOffset - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setTopLeftOffset($xOffset=null,$yOffset=null) { if (!is_null($xOffset)) @@ -431,7 +433,7 @@ class PHPExcel_Chart * @param string $cell * @param integer $xOffset * @param integer $yOffset - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) { $this->_bottomRightCellRef = $cell; @@ -475,7 +477,7 @@ class PHPExcel_Chart * * @param integer $xOffset * @param integer $yOffset - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ public function setBottomRightOffset($xOffset=null,$yOffset=null) { if (!is_null($xOffset)) @@ -525,21 +527,21 @@ class PHPExcel_Chart } public function render($outputDestination = null) { - $libraryName = PHPExcel_Settings::getChartRendererName(); + $libraryName = Settings::getChartRendererName(); if (is_null($libraryName)) { return false; } // Ensure that data series values are up-to-date before we render $this->refresh(); - $libraryPath = PHPExcel_Settings::getChartRendererPath(); + $libraryPath = Settings::getChartRendererPath(); $includePath = str_replace('\\','/',get_include_path()); $rendererPath = str_replace('\\','/',$libraryPath); if (strpos($rendererPath,$includePath) === false) { set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath); } - $rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName; + $rendererName = __NAMESPACE__ . '\Chart_Renderer_'.$libraryName; $renderer = new $rendererName($this); if ($outputDestination == 'php://output') { diff --git a/Classes/PHPExcel/Chart/DataSeries.php b/Classes/PHPExcel/Chart/DataSeries.php index 68382e7..5657471 100644 --- a/Classes/PHPExcel/Chart/DataSeries.php +++ b/Classes/PHPExcel/Chart/DataSeries.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_DataSeries + * PHPExcel\Chart_DataSeries * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_DataSeries +class Chart_DataSeries { const TYPE_BARCHART = 'barChart'; @@ -108,14 +110,14 @@ class PHPExcel_Chart_DataSeries /** * Plot Label * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of PHPExcel\Chart_DataSeriesValues */ private $_plotLabel = array(); /** * Plot Category * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of PHPExcel\Chart_DataSeriesValues */ private $_plotCategory = array(); @@ -129,12 +131,12 @@ class PHPExcel_Chart_DataSeries /** * Plot Values * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of PHPExcel\Chart_DataSeriesValues */ private $_plotValues = array(); /** - * Create a new PHPExcel_Chart_DataSeries + * Create a new PHPExcel\Chart_DataSeries */ public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $smoothLine = null, $plotStyle = null) { @@ -144,12 +146,12 @@ class PHPExcel_Chart_DataSeries $keys = array_keys($plotValues); $this->_plotValues = $plotValues; if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { - $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); + $plotLabel[$keys[0]] = new Chart_DataSeriesValues(); } $this->_plotLabel = $plotLabel; if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { - $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); + $plotCategory[$keys[0]] = new Chart_DataSeriesValues(); } $this->_plotCategory = $plotCategory; $this->_smoothLine = $smoothLine; @@ -222,7 +224,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Labels * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of PHPExcel\Chart_DataSeriesValues */ public function getPlotLabels() { return $this->_plotLabel; @@ -231,7 +233,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Label by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function getPlotLabelByIndex($index) { $keys = array_keys($this->_plotLabel); @@ -246,7 +248,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Categories * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of PHPExcel\Chart_DataSeriesValues */ public function getPlotCategories() { return $this->_plotCategory; @@ -255,7 +257,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Category by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function getPlotCategoryByIndex($index) { $keys = array_keys($this->_plotCategory); @@ -288,7 +290,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Values * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of PHPExcel\Chart_DataSeriesValues */ public function getPlotValues() { return $this->_plotValues; @@ -297,7 +299,7 @@ class PHPExcel_Chart_DataSeries /** * Get Plot Values by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function getPlotValuesByIndex($index) { $keys = array_keys($this->_plotValues); @@ -336,7 +338,7 @@ class PHPExcel_Chart_DataSeries $this->_smoothLine = $smoothLine; } - public function refresh(PHPExcel_Worksheet $worksheet) { + public function refresh(Worksheet $worksheet) { foreach($this->_plotValues as $plotValues) { if ($plotValues !== NULL) $plotValues->refresh($worksheet, TRUE); diff --git a/Classes/PHPExcel/Chart/DataSeriesValues.php b/Classes/PHPExcel/Chart/DataSeriesValues.php index f7d0681..e58104b 100644 --- a/Classes/PHPExcel/Chart/DataSeriesValues.php +++ b/Classes/PHPExcel/Chart/DataSeriesValues.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_DataSeriesValues + * PHPExcel\Chart_DataSeriesValues * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_DataSeriesValues +class Chart_DataSeriesValues { const DATASERIES_TYPE_STRING = 'String'; @@ -87,7 +89,7 @@ class PHPExcel_Chart_DataSeriesValues private $_dataValues = array(); /** - * Create a new PHPExcel_Chart_DataSeriesValues object + * Create a new PHPExcel\Chart_DataSeriesValues object */ public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) { @@ -113,15 +115,15 @@ class PHPExcel_Chart_DataSeriesValues * * @param string $dataType Datatype of this data series * Typical values are: - * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING + * PHPExcel\Chart_DataSeriesValues::DATASERIES_TYPE_STRING * Normally used for axis point values - * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER + * PHPExcel\Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER * Normally used for chart data values - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) { if (!in_array($dataType, self::$_dataTypeValues)) { - throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); + throw new Chart_Exception('Invalid datatype for chart data series values'); } $this->_dataType = $dataType; @@ -141,7 +143,7 @@ class PHPExcel_Chart_DataSeriesValues * Set Series Data Source (formula) * * @param string $dataSource - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function setDataSource($dataSource = null, $refreshDataValues = true) { $this->_dataSource = $dataSource; @@ -166,7 +168,7 @@ class PHPExcel_Chart_DataSeriesValues * Set Point Marker * * @param string $marker - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function setPointMarker($marker = null) { $this->_marker = $marker; @@ -187,7 +189,7 @@ class PHPExcel_Chart_DataSeriesValues * Set Series Format Code * * @param string $formatCode - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function setFormatCode($formatCode = null) { $this->_formatCode = $formatCode; @@ -260,10 +262,10 @@ class PHPExcel_Chart_DataSeriesValues * @param boolean $refreshDataSource * TRUE - refresh the value of _dataSource based on the values of $dataValues * FALSE - don't change the value of _dataSource - * @return PHPExcel_Chart_DataSeriesValues + * @return PHPExcel\Chart_DataSeriesValues */ public function setDataValues($dataValues = array(), $refreshDataSource = TRUE) { - $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); + $this->_dataValues = Calculation_Functions::flattenArray($dataValues); $this->_pointCount = count($dataValues); if ($refreshDataSource) { @@ -277,10 +279,10 @@ class PHPExcel_Chart_DataSeriesValues return $var !== NULL; } - public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) { + public function refresh(Worksheet $worksheet, $flatten = TRUE) { if ($this->_dataSource !== NULL) { - $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); - $newDataValues = PHPExcel_Calculation::_unwrapResult( + $calcEngine = Calculation::getInstance($worksheet->getParent()); + $newDataValues = Calculation::_unwrapResult( $calcEngine->_calculateFormulaValue( '='.$this->_dataSource, NULL, @@ -288,7 +290,7 @@ class PHPExcel_Chart_DataSeriesValues ) ); if ($flatten) { - $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + $this->_dataValues = Calculation_Functions::flattenArray($newDataValues); foreach($this->_dataValues as &$dataValue) { if ((!empty($dataValue)) && ($dataValue[0] == '#')) { $dataValue = 0.0; @@ -301,9 +303,9 @@ class PHPExcel_Chart_DataSeriesValues list(,$cellRange) = $cellRange; } - $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange)); + $dimensions = Cell::rangeDimension(str_replace('$','',$cellRange)); if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { - $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + $this->_dataValues = Calculation_Functions::flattenArray($newDataValues); } else { $newArray = array_values(array_shift($newDataValues)); foreach($newArray as $i => $newDataSet) { diff --git a/Classes/PHPExcel/Chart/Exception.php b/Classes/PHPExcel/Chart/Exception.php index e7448ce..433018a 100644 --- a/Classes/PHPExcel/Chart/Exception.php +++ b/Classes/PHPExcel/Chart/Exception.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_Exception + * PHPExcel\Chart_Exception * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Exception extends PHPExcel_Exception { +class Chart_Exception extends Exception { /** * Error handler callback * diff --git a/Classes/PHPExcel/Chart/Layout.php b/Classes/PHPExcel/Chart/Layout.php index 4b2c6af..4d5f50c 100644 --- a/Classes/PHPExcel/Chart/Layout.php +++ b/Classes/PHPExcel/Chart/Layout.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_Layout + * PHPExcel\Chart_Layout * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Layout +class Chart_Layout { /** * layoutTarget @@ -141,7 +143,7 @@ class PHPExcel_Chart_Layout /** - * Create a new PHPExcel_Chart_Layout + * Create a new PHPExcel\Chart_Layout */ public function __construct($layout=array()) { diff --git a/Classes/PHPExcel/Chart/Legend.php b/Classes/PHPExcel/Chart/Legend.php index 0422e96..7b81a01 100644 --- a/Classes/PHPExcel/Chart/Legend.php +++ b/Classes/PHPExcel/Chart/Legend.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_Legend + * PHPExcel\Chart_Legend * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Legend +class Chart_Legend { /** Legend positions */ const xlLegendPositionBottom = -4107; // Below the chart. @@ -74,15 +76,15 @@ class PHPExcel_Chart_Legend /** * Legend Layout * - * @var PHPExcel_Chart_Layout + * @var PHPExcel\Chart_Layout */ private $_layout = NULL; /** - * Create a new PHPExcel_Chart_Legend + * Create a new PHPExcel\Chart_Legend */ - public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE) + public function __construct($position = self::POSITION_RIGHT, Chart_Layout $layout = NULL, $overlay = FALSE) { $this->setPosition($position); $this->_layout = $layout; @@ -162,7 +164,7 @@ class PHPExcel_Chart_Legend /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return PHPExcel\Chart_Layout */ public function getLayout() { return $this->_layout; diff --git a/Classes/PHPExcel/Chart/PlotArea.php b/Classes/PHPExcel/Chart/PlotArea.php index 2975c09..6dd8a4e 100644 --- a/Classes/PHPExcel/Chart/PlotArea.php +++ b/Classes/PHPExcel/Chart/PlotArea.php @@ -19,40 +19,42 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_PlotArea + * PHPExcel\Chart_PlotArea * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_PlotArea +class Chart_PlotArea { /** * PlotArea Layout * - * @var PHPExcel_Chart_Layout + * @var PHPExcel\Chart_Layout */ private $_layout = null; /** * Plot Series * - * @var array of PHPExcel_Chart_DataSeries + * @var array of PHPExcel\Chart_DataSeries */ private $_plotSeries = array(); /** - * Create a new PHPExcel_Chart_PlotArea + * Create a new PHPExcel\Chart_PlotArea */ - public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array()) + public function __construct(Chart_Layout $layout = null, $plotSeries = array()) { $this->_layout = $layout; $this->_plotSeries = $plotSeries; @@ -61,7 +63,7 @@ class PHPExcel_Chart_PlotArea /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return PHPExcel\Chart_Layout */ public function getLayout() { return $this->_layout; @@ -70,7 +72,7 @@ class PHPExcel_Chart_PlotArea /** * Get Number of Plot Groups * - * @return array of PHPExcel_Chart_DataSeries + * @return array of PHPExcel\Chart_DataSeries */ public function getPlotGroupCount() { return count($this->_plotSeries); @@ -92,7 +94,7 @@ class PHPExcel_Chart_PlotArea /** * Get Plot Series * - * @return array of PHPExcel_Chart_DataSeries + * @return array of PHPExcel\Chart_DataSeries */ public function getPlotGroup() { return $this->_plotSeries; @@ -101,7 +103,7 @@ class PHPExcel_Chart_PlotArea /** * Get Plot Series by Index * - * @return PHPExcel_Chart_DataSeries + * @return PHPExcel\Chart_DataSeries */ public function getPlotGroupByIndex($index) { return $this->_plotSeries[$index]; @@ -110,13 +112,13 @@ class PHPExcel_Chart_PlotArea /** * Set Plot Series * - * @param [PHPExcel_Chart_DataSeries] + * @param [PHPExcel\Chart_DataSeries] */ public function setPlotSeries($plotSeries = array()) { $this->_plotSeries = $plotSeries; } - public function refresh(PHPExcel_Worksheet $worksheet) { + public function refresh(Worksheet $worksheet) { foreach($this->_plotSeries as $plotSeries) { $plotSeries->refresh($worksheet); } diff --git a/Classes/PHPExcel/Chart/Renderer/jpgraph.php b/Classes/PHPExcel/Chart/Renderer/jpgraph.php index 9da620d..ee008fb 100644 --- a/Classes/PHPExcel/Chart/Renderer/jpgraph.php +++ b/Classes/PHPExcel/Chart/Renderer/jpgraph.php @@ -20,24 +20,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart_Renderer + * @package PHPExcel\Chart_Renderer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; -require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php'); +require_once(Settings::getChartRendererPath() . '/jpgraph.php'); /** - * PHPExcel_Chart_Renderer_jpgraph + * PHPExcel\Chart_Renderer_jpgraph * * @category PHPExcel - * @package PHPExcel_Chart_Renderer + * @package PHPExcel\Chart_Renderer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Renderer_jpgraph +class Chart_Renderer_jpgraph { private static $_width = 640; @@ -117,7 +118,7 @@ class PHPExcel_Chart_Renderer_jpgraph } else { // Format labels according to any formatting code if (!is_null($datasetLabelFormatCode)) { - $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode); + $datasetLabels[$i] = Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode); } } ++$testCurrentIndex; @@ -826,12 +827,12 @@ class PHPExcel_Chart_Renderer_jpgraph /** - * Create a new PHPExcel_Chart_Renderer_jpgraph + * Create a new PHPExcel\Chart_Renderer_jpgraph */ - public function __construct(PHPExcel_Chart $chart) + public function __construct(Chart $chart) { $this->_graph = null; $this->_chart = $chart; } // function __construct() -} // PHPExcel_Chart_Renderer_jpgraph +} diff --git a/Classes/PHPExcel/Chart/Title.php b/Classes/PHPExcel/Chart/Title.php index cacfae3..71c71fe 100644 --- a/Classes/PHPExcel/Chart/Title.php +++ b/Classes/PHPExcel/Chart/Title.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Chart_Title + * PHPExcel\Chart_Title * * @category PHPExcel - * @package PHPExcel_Chart + * @package PHPExcel\Chart * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Title +class Chart_Title { /** @@ -46,14 +48,14 @@ class PHPExcel_Chart_Title /** * Title Layout * - * @var PHPExcel_Chart_Layout + * @var PHPExcel\Chart_Layout */ private $_layout = null; /** - * Create a new PHPExcel_Chart_Title + * Create a new PHPExcel\Chart_Title */ - public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null) + public function __construct($caption = null, Chart_Layout $layout = null) { $this->_caption = $caption; $this->_layout = $layout; @@ -80,7 +82,7 @@ class PHPExcel_Chart_Title /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return PHPExcel\Chart_Layout */ public function getLayout() { return $this->_layout; diff --git a/Classes/PHPExcel/Comment.php b/Classes/PHPExcel/Comment.php index a8f599d..3d5545b 100644 --- a/Classes/PHPExcel/Comment.php +++ b/Classes/PHPExcel/Comment.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_Comment + * PHPExcel\Comment * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Comment implements PHPExcel_IComparable +class Comment implements IComparable { /** * Author @@ -45,7 +47,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable /** * Rich text comment * - * @var PHPExcel_RichText + * @var PHPExcel\RichText */ private $_text; @@ -87,7 +89,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable /** * Comment fill color * - * @var PHPExcel_Style_Color + * @var PHPExcel\Style_Color */ private $_fillColor; @@ -99,17 +101,17 @@ class PHPExcel_Comment implements PHPExcel_IComparable private $_alignment; /** - * Create a new PHPExcel_Comment + * Create a new PHPExcel\Comment * - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function __construct() { // Initialise variables $this->_author = 'Author'; - $this->_text = new PHPExcel_RichText(); - $this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); - $this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + $this->_text = new RichText(); + $this->_fillColor = new Style_Color('FFFFFFE1'); + $this->_alignment = Style_Alignment::HORIZONTAL_GENERAL; } /** @@ -125,7 +127,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set Author * * @param string $pValue - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setAuthor($pValue = '') { $this->_author = $pValue; @@ -135,7 +137,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable /** * Get Rich text comment * - * @return PHPExcel_RichText + * @return PHPExcel\RichText */ public function getText() { return $this->_text; @@ -144,10 +146,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable /** * Set Rich text comment * - * @param PHPExcel_RichText $pValue - * @return PHPExcel_Comment + * @param PHPExcel\RichText $pValue + * @return PHPExcel\Comment */ - public function setText(PHPExcel_RichText $pValue) { + public function setText(RichText $pValue) { $this->_text = $pValue; return $this; } @@ -165,7 +167,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set comment width (CSS style, i.e. XXpx or YYpt) * * @param string $value - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setWidth($value = '96pt') { $this->_width = $value; @@ -185,7 +187,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set comment height (CSS style, i.e. XXpx or YYpt) * * @param string $value - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setHeight($value = '55.5pt') { $this->_height = $value; @@ -205,7 +207,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set left margin (CSS style, i.e. XXpx or YYpt) * * @param string $value - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setMarginLeft($value = '59.25pt') { $this->_marginLeft = $value; @@ -225,7 +227,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set top margin (CSS style, i.e. XXpx or YYpt) * * @param string $value - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setMarginTop($value = '1.5pt') { $this->_marginTop = $value; @@ -245,7 +247,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set comment default visibility * * @param boolean $value - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function setVisible($value = false) { $this->_visible = $value; @@ -255,7 +257,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable /** * Get fill color * - * @return PHPExcel_Style_Color + * @return PHPExcel\Style_Color */ public function getFillColor() { return $this->_fillColor; @@ -265,9 +267,9 @@ class PHPExcel_Comment implements PHPExcel_IComparable * Set Alignment * * @param string $pValue - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ - public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { + public function setAlignment($pValue = Style_Alignment::HORIZONTAL_GENERAL) { $this->_alignment = $pValue; return $this; } diff --git a/Classes/PHPExcel/DocumentProperties.php b/Classes/PHPExcel/DocumentProperties.php index c8099dc..b04c750 100644 --- a/Classes/PHPExcel/DocumentProperties.php +++ b/Classes/PHPExcel/DocumentProperties.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_DocumentProperties + * PHPExcel\DocumentProperties * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_DocumentProperties +class DocumentProperties { /** constants */ const PROPERTY_TYPE_BOOLEAN = 'b'; @@ -129,7 +131,7 @@ class PHPExcel_DocumentProperties /** - * Create a new PHPExcel_DocumentProperties + * Create a new PHPExcel\DocumentProperties */ public function __construct() { @@ -152,7 +154,7 @@ class PHPExcel_DocumentProperties * Set Creator * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setCreator($pValue = '') { $this->_creator = $pValue; @@ -172,7 +174,7 @@ class PHPExcel_DocumentProperties * Set Last Modified By * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setLastModifiedBy($pValue = '') { $this->_lastModifiedBy = $pValue; @@ -192,7 +194,7 @@ class PHPExcel_DocumentProperties * Set Created * * @param datetime $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setCreated($pValue = null) { if ($pValue === NULL) { @@ -222,7 +224,7 @@ class PHPExcel_DocumentProperties * Set Modified * * @param datetime $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setModified($pValue = null) { if ($pValue === NULL) { @@ -252,7 +254,7 @@ class PHPExcel_DocumentProperties * Set Title * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setTitle($pValue = '') { $this->_title = $pValue; @@ -272,7 +274,7 @@ class PHPExcel_DocumentProperties * Set Description * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setDescription($pValue = '') { $this->_description = $pValue; @@ -292,7 +294,7 @@ class PHPExcel_DocumentProperties * Set Subject * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setSubject($pValue = '') { $this->_subject = $pValue; @@ -312,7 +314,7 @@ class PHPExcel_DocumentProperties * Set Keywords * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setKeywords($pValue = '') { $this->_keywords = $pValue; @@ -332,7 +334,7 @@ class PHPExcel_DocumentProperties * Set Category * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setCategory($pValue = '') { $this->_category = $pValue; @@ -352,7 +354,7 @@ class PHPExcel_DocumentProperties * Set Company * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setCompany($pValue = '') { $this->_company = $pValue; @@ -372,7 +374,7 @@ class PHPExcel_DocumentProperties * Set Manager * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setManager($pValue = '') { $this->_manager = $pValue; @@ -435,7 +437,7 @@ class PHPExcel_DocumentProperties * 's' : String * 'd' : Date/Time * 'b' : Boolean - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) { if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, diff --git a/Classes/PHPExcel/DocumentSecurity.php b/Classes/PHPExcel/DocumentSecurity.php index bbbe4b7..53042a1 100644 --- a/Classes/PHPExcel/DocumentSecurity.php +++ b/Classes/PHPExcel/DocumentSecurity.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_DocumentSecurity + * PHPExcel\DocumentSecurity * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_DocumentSecurity +class DocumentSecurity { /** * LockRevision @@ -71,7 +73,7 @@ class PHPExcel_DocumentSecurity private $_workbookPassword; /** - * Create a new PHPExcel_DocumentSecurity + * Create a new PHPExcel\DocumentSecurity */ public function __construct() { @@ -107,7 +109,7 @@ class PHPExcel_DocumentSecurity * Set LockRevision * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ function setLockRevision($pValue = false) { $this->_lockRevision = $pValue; @@ -127,7 +129,7 @@ class PHPExcel_DocumentSecurity * Set LockStructure * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ function setLockStructure($pValue = false) { $this->_lockStructure = $pValue; @@ -147,7 +149,7 @@ class PHPExcel_DocumentSecurity * Set LockWindows * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ function setLockWindows($pValue = false) { $this->_lockWindows = $pValue; @@ -168,11 +170,11 @@ class PHPExcel_DocumentSecurity * * @param string $pValue * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { if (!$pAlreadyHashed) { - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + $pValue = Shared_PasswordHasher::hashPassword($pValue); } $this->_revisionsPassword = $pValue; return $this; @@ -192,11 +194,11 @@ class PHPExcel_DocumentSecurity * * @param string $pValue * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { if (!$pAlreadyHashed) { - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + $pValue = Shared_PasswordHasher::hashPassword($pValue); } $this->_workbookPassword = $pValue; return $this; diff --git a/Classes/PHPExcel/Exception.php b/Classes/PHPExcel/Exception.php index e258036..7481afe 100644 --- a/Classes/PHPExcel/Exception.php +++ b/Classes/PHPExcel/Exception.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_Exception + * PHPExcel\Exception * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Exception extends Exception { +class Exception extends \Exception { /** * Error handler callback * diff --git a/Classes/PHPExcel/HashTable.php b/Classes/PHPExcel/HashTable.php index a94e19e..48a5c54 100644 --- a/Classes/PHPExcel/HashTable.php +++ b/Classes/PHPExcel/HashTable.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_HashTable + * PHPExcel\HashTable * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_HashTable +class HashTable { /** * HashTable elements @@ -50,10 +52,10 @@ class PHPExcel_HashTable public $_keyMap = array(); /** - * Create a new PHPExcel_HashTable + * Create a new PHPExcel\HashTable * - * @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from - * @throws PHPExcel_Exception + * @param PHPExcel\IComparable[] $pSource Optional source array to create HashTable from + * @throws PHPExcel\Exception */ public function __construct($pSource = null) { @@ -66,15 +68,15 @@ class PHPExcel_HashTable /** * Add HashTable items from source * - * @param PHPExcel_IComparable[] $pSource Source array to create HashTable from - * @throws PHPExcel_Exception + * @param PHPExcel\IComparable[] $pSource Source array to create HashTable from + * @throws PHPExcel\Exception */ public function addFromSource($pSource = null) { // Check if an array was passed if ($pSource == null) { return; } else if (!is_array($pSource)) { - throw new PHPExcel_Exception('Invalid array parameter passed.'); + throw new Exception('Invalid array parameter passed.'); } foreach ($pSource as $item) { @@ -85,10 +87,10 @@ class PHPExcel_HashTable /** * Add HashTable item * - * @param PHPExcel_IComparable $pSource Item to add - * @throws PHPExcel_Exception + * @param PHPExcel\IComparable $pSource Item to add + * @throws PHPExcel\Exception */ - public function add(PHPExcel_IComparable $pSource = null) { + public function add(IComparable $pSource = null) { $hash = $pSource->getHashCode(); if (!isset($this->_items[$hash])) { $this->_items[$hash] = $pSource; @@ -99,10 +101,10 @@ class PHPExcel_HashTable /** * Remove HashTable item * - * @param PHPExcel_IComparable $pSource Item to remove - * @throws PHPExcel_Exception + * @param PHPExcel\IComparable $pSource Item to remove + * @throws PHPExcel\Exception */ - public function remove(PHPExcel_IComparable $pSource = null) { + public function remove(IComparable $pSource = null) { $hash = $pSource->getHashCode(); if (isset($this->_items[$hash])) { unset($this->_items[$hash]); @@ -153,7 +155,7 @@ class PHPExcel_HashTable * Get by index * * @param int $pIndex - * @return PHPExcel_IComparable + * @return PHPExcel\IComparable * */ public function getByIndex($pIndex = 0) { @@ -168,7 +170,7 @@ class PHPExcel_HashTable * Get by hashcode * * @param string $pHashCode - * @return PHPExcel_IComparable + * @return PHPExcel\IComparable * */ public function getByHashCode($pHashCode = '') { @@ -182,7 +184,7 @@ class PHPExcel_HashTable /** * HashTable to array * - * @return PHPExcel_IComparable[] + * @return PHPExcel\IComparable[] */ public function toArray() { return $this->_items; diff --git a/Classes/PHPExcel/IComparable.php b/Classes/PHPExcel/IComparable.php index f1c8e9a..c0eb960 100644 --- a/Classes/PHPExcel/IComparable.php +++ b/Classes/PHPExcel/IComparable.php @@ -24,14 +24,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_IComparable + * PHPExcel\IComparable * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_IComparable +interface IComparable { /** * Get hash code diff --git a/Classes/PHPExcel/IOFactory.php b/Classes/PHPExcel/IOFactory.php index 4958012..0161d89 100644 --- a/Classes/PHPExcel/IOFactory.php +++ b/Classes/PHPExcel/IOFactory.php @@ -26,23 +26,16 @@ */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_IOFactory + * PHPExcel\IOFactory * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_IOFactory +class IOFactory { /** * Search locations @@ -52,8 +45,8 @@ class PHPExcel_IOFactory * @static */ private static $_searchLocations = array( - array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), - array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) + array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'Writer_{0}' ), + array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'Reader_{0}' ) ); /** @@ -75,7 +68,7 @@ class PHPExcel_IOFactory ); /** - * Private constructor for PHPExcel_IOFactory + * Private constructor for PHPExcel\IOFactory */ private function __construct() { } @@ -96,13 +89,13 @@ class PHPExcel_IOFactory * @static * @access public * @param array $value - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public static function setSearchLocations($value) { if (is_array($value)) { self::$_searchLocations = $value; } else { - throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); + throw new Reader_Exception('Invalid parameter passed.'); } } // function setSearchLocations() @@ -113,30 +106,31 @@ class PHPExcel_IOFactory * @access public * @param string $type Example: IWriter * @param string $location Example: PHPExcel/Writer/{0}.php - * @param string $classname Example: PHPExcel_Writer_{0} + * @param string $classname Example: PHPExcel\Writer_{0} */ public static function addSearchLocation($type = '', $location = '', $classname = '') { self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); } // function addSearchLocation() /** - * Create PHPExcel_Writer_IWriter + * Create PHPExcel\Writer_IWriter * * @static * @access public * @param PHPExcel $phpExcel * @param string $writerType Example: Excel2007 - * @return PHPExcel_Writer_IWriter - * @throws PHPExcel_Reader_Exception + * @return PHPExcel\Writer_IWriter + * @throws PHPExcel\Reader_Exception */ - public static function createWriter(PHPExcel $phpExcel, $writerType = '') { + public static function createWriter(Workbook $phpExcel, $writerType = '') { // Search type $searchType = 'IWriter'; // Include class foreach (self::$_searchLocations as $searchLocation) { - if ($searchLocation['type'] == $searchType) { - $className = str_replace('{0}', $writerType, $searchLocation['class']); + + if ($searchLocation['type'] == $searchType) { + $className = __NAMESPACE__ . '\\' . str_replace('{0}', $writerType, $searchLocation['class']); $instance = new $className($phpExcel); if ($instance !== NULL) { @@ -146,17 +140,17 @@ class PHPExcel_IOFactory } // Nothing found... - throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType"); + throw new Reader_Exception("No $searchType found for type $writerType"); } // function createWriter() /** - * Create PHPExcel_Reader_IReader + * Create PHPExcel\Reader_IReader * * @static * @access public * @param string $readerType Example: Excel2007 - * @return PHPExcel_Reader_IReader - * @throws PHPExcel_Reader_Exception + * @return PHPExcel\Reader_IReader + * @throws PHPExcel\Reader_Exception */ public static function createReader($readerType = '') { // Search type @@ -175,17 +169,17 @@ class PHPExcel_IOFactory } // Nothing found... - throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType"); + throw new Reader_Exception("No $searchType found for type $readerType"); } // function createReader() /** - * Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution + * Loads PHPExcel from file using automatic PHPExcel\Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public static function load($pFilename) { $reader = self::createReaderForFile($pFilename); @@ -193,13 +187,13 @@ class PHPExcel_IOFactory } // function load() /** - * Identify file type using automatic PHPExcel_Reader_IReader resolution + * Identify file type using automatic PHPExcel\Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file to identify * @return string - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public static function identify($pFilename) { $reader = self::createReaderForFile($pFilename); @@ -210,13 +204,13 @@ class PHPExcel_IOFactory } // function identify() /** - * Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution + * Create PHPExcel\Reader_IReader for file using automatic PHPExcel\Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file - * @return PHPExcel_Reader_IReader - * @throws PHPExcel_Reader_Exception + * @return PHPExcel\Reader_IReader + * @throws PHPExcel\Reader_Exception */ public static function createReaderForFile($pFilename) { @@ -283,6 +277,6 @@ class PHPExcel_IOFactory } } - throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file'); + throw new Reader_Exception('Unable to identify a reader for this file'); } // function createReaderForFile() } diff --git a/Classes/PHPExcel/NamedRange.php b/Classes/PHPExcel/NamedRange.php index 2ab04aa..4912bb4 100644 --- a/Classes/PHPExcel/NamedRange.php +++ b/Classes/PHPExcel/NamedRange.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_NamedRange + * PHPExcel\NamedRange * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_NamedRange +class NamedRange { /** * Range name @@ -45,7 +47,7 @@ class PHPExcel_NamedRange /** * Worksheet on which the named range can be resolved * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_worksheet; @@ -66,7 +68,7 @@ class PHPExcel_NamedRange /** * Scope * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_scope; @@ -74,17 +76,17 @@ class PHPExcel_NamedRange * Create a new NamedRange * * @param string $pName - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @param string $pRange * @param bool $pLocalOnly - * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. - * @throws PHPExcel_Exception + * @param PHPExcel\Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. + * @throws PHPExcel\Exception */ - public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) + public function __construct($pName = null, Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) { // Validate data if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { - throw new PHPExcel_Exception('Parameters can not be null.'); + throw new Exception('Parameters can not be null.'); } // Set local members @@ -109,7 +111,7 @@ class PHPExcel_NamedRange * Set name * * @param string $value - * @return PHPExcel_NamedRange + * @return PHPExcel\NamedRange */ public function setName($value = null) { if ($value !== NULL) { @@ -128,7 +130,7 @@ class PHPExcel_NamedRange // New title $newTitle = $this->_name; - PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); + ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); } return $this; } @@ -136,7 +138,7 @@ class PHPExcel_NamedRange /** * Get worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getWorksheet() { return $this->_worksheet; @@ -145,12 +147,12 @@ class PHPExcel_NamedRange /** * Set worksheet * - * @param PHPExcel_Worksheet $value - * @return PHPExcel_NamedRange + * @param PHPExcel\Worksheet $worksheet + * @return PHPExcel\NamedRange */ - public function setWorksheet(PHPExcel_Worksheet $value = null) { - if ($value !== NULL) { - $this->_worksheet = $value; + public function setWorksheet(Worksheet $worksheet = null) { + if ($worksheet !== NULL) { + $this->_worksheet = $worksheet; } return $this; } @@ -168,7 +170,7 @@ class PHPExcel_NamedRange * Set range * * @param string $value - * @return PHPExcel_NamedRange + * @return PHPExcel\NamedRange */ public function setRange($value = null) { if ($value !== NULL) { @@ -190,7 +192,7 @@ class PHPExcel_NamedRange * Set localOnly * * @param bool $value - * @return PHPExcel_NamedRange + * @return PHPExcel\NamedRange */ public function setLocalOnly($value = false) { $this->_localOnly = $value; @@ -201,7 +203,7 @@ class PHPExcel_NamedRange /** * Get scope * - * @return PHPExcel_Worksheet|null + * @return PHPExcel\Worksheet|NULL */ public function getScope() { return $this->_scope; @@ -210,12 +212,12 @@ class PHPExcel_NamedRange /** * Set scope * - * @param PHPExcel_Worksheet|null $value - * @return PHPExcel_NamedRange + * @param PHPExcel\Worksheet|NULL $worksheet + * @return PHPExcel\NamedRange */ - public function setScope(PHPExcel_Worksheet $value = null) { - $this->_scope = $value; - $this->_localOnly = ($value == null) ? false : true; + public function setScope(Worksheet $worksheet = null) { + $this->_scope = $worksheet; + $this->_localOnly = ($worksheet == null) ? false : true; return $this; } @@ -223,10 +225,10 @@ class PHPExcel_NamedRange * Resolve a named range to a regular cell range * * @param string $pNamedRange Named range - * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope - * @return PHPExcel_NamedRange + * @param PHPExcel\Worksheet|null $pSheet Scope. Use null for global scope + * @return PHPExcel\NamedRange */ - public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { + public static function resolveRange($pNamedRange = '', Worksheet $pSheet) { return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet); } diff --git a/Classes/PHPExcel/Reader/Abstract.php b/Classes/PHPExcel/Reader/Abstract.php index 1a5978d..624afc9 100644 --- a/Classes/PHPExcel/Reader/Abstract.php +++ b/Classes/PHPExcel/Reader/Abstract.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Reader_Abstract + * PHPExcel\Reader_Abstract * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +abstract class Reader_Abstract implements Reader_IReader { /** * Read data only? @@ -61,9 +63,9 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader protected $_loadSheetsOnly = NULL; /** - * PHPExcel_Reader_IReadFilter instance + * PHPExcel\Reader_IReadFilter instance * - * @var PHPExcel_Reader_IReadFilter + * @var PHPExcel\Reader_IReadFilter */ protected $_readFilter = NULL; @@ -88,7 +90,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * * @param boolean $pValue * - * @return PHPExcel_Reader_IReader + * @return PHPExcel\Reader_IReader */ public function setReadDataOnly($pValue = FALSE) { $this->_readDataOnly = $pValue; @@ -115,7 +117,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * * @param boolean $pValue * - * @return PHPExcel_Reader_IReader + * @return PHPExcel\Reader_IReader */ public function setIncludeCharts($pValue = FALSE) { $this->_includeCharts = (boolean) $pValue; @@ -141,7 +143,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. * If NULL, then it tells the Reader to read all worksheets in the workbook * - * @return PHPExcel_Reader_IReader + * @return PHPExcel\Reader_IReader */ public function setLoadSheetsOnly($value = NULL) { @@ -154,7 +156,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * Set all sheets to load * Tells the Reader to load all worksheets from the workbook. * - * @return PHPExcel_Reader_IReader + * @return PHPExcel\Reader_IReader */ public function setLoadAllSheets() { @@ -165,7 +167,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader /** * Read filter * - * @return PHPExcel_Reader_IReadFilter + * @return PHPExcel\Reader_IReadFilter */ public function getReadFilter() { return $this->_readFilter; @@ -174,10 +176,10 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader /** * Set read filter * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_IReader + * @param PHPExcel\Reader_IReadFilter $pValue + * @return PHPExcel\Reader_IReader */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { + public function setReadFilter(Reader_IReadFilter $pValue) { $this->_readFilter = $pValue; return $this; } @@ -186,29 +188,29 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * Open file for reading * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception * @return resource */ protected function _openFile($pFilename) { // Check if file exists if (!file_exists($pFilename) || !is_readable($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Open file $this->_fileHandle = fopen($pFilename, 'r'); if ($this->_fileHandle === FALSE) { - throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading."); + throw new Reader_Exception("Could not open file " . $pFilename . " for reading."); } } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index d45a0c6..b159142 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_CSV + * PHPExcel\Reader_CSV * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_CSV extends Reader_Abstract implements Reader_IReader { /** * Input encoding @@ -101,10 +94,10 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R /** - * Create a new PHPExcel_Reader_CSV + * Create a new PHPExcel\Reader_CSV */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** @@ -176,7 +169,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { @@ -184,7 +177,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R $this->_openFile($pFilename); if (!$this->_isValidFormat()) { fclose ($this->_fileHandle); - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $fileHandle = $this->_fileHandle; @@ -206,7 +199,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); } - $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']); + $worksheetInfo[0]['lastColumnLetter'] = Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']); $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1; // Close file @@ -220,12 +213,12 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new PHPExcel Workbook + $objPHPExcel = new Workbook(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -237,7 +230,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { @@ -248,7 +241,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R $this->_openFile($pFilename); if (!$this->_isValidFormat()) { fclose ($this->_fileHandle); - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $fileHandle = $this->_fileHandle; @@ -281,7 +274,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R // Convert encoding if necessary if ($this->_inputEncoding !== 'UTF-8') { - $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); + $rowDatum = Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); } // Set cell value @@ -318,7 +311,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Set delimiter * * @param string $pValue Delimiter, defaults to , - * @return PHPExcel_Reader_CSV + * @return PHPExcel\Reader_CSV */ public function setDelimiter($pValue = ',') { $this->_delimiter = $pValue; @@ -338,7 +331,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Set enclosure * * @param string $pValue Enclosure, defaults to " - * @return PHPExcel_Reader_CSV + * @return PHPExcel\Reader_CSV */ public function setEnclosure($pValue = '"') { if ($pValue == '') { @@ -361,7 +354,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Set line ending * * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) - * @return PHPExcel_Reader_CSV + * @return PHPExcel\Reader_CSV */ public function setLineEnding($pValue = PHP_EOL) { $this->_lineEnding = $pValue; @@ -381,7 +374,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Set sheet index * * @param integer $pValue Sheet index - * @return PHPExcel_Reader_CSV + * @return PHPExcel\Reader_CSV */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; diff --git a/Classes/PHPExcel/Reader/DefaultReadFilter.php b/Classes/PHPExcel/Reader/DefaultReadFilter.php index 6111c80..e49a2bd 100644 --- a/Classes/PHPExcel/Reader/DefaultReadFilter.php +++ b/Classes/PHPExcel/Reader/DefaultReadFilter.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_DefaultReadFilter + * PHPExcel\Reader_DefaultReadFilter * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter +class Reader_DefaultReadFilter implements Reader_IReadFilter { /** * Should this cell be read? diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index 1d16855..f74f9aa 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_Excel2003XML + * PHPExcel\Reader_Excel2003XML * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_Excel2003XML extends Reader_Abstract implements Reader_IReader { /** * Formats @@ -60,19 +53,19 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P /** - * Create a new PHPExcel_Reader_Excel2003XML + * Create a new PHPExcel\Reader_Excel2003XML */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { @@ -123,16 +116,16 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } if (!$this->canRead($pFilename)) { - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $worksheetNames = array(); @@ -154,13 +147,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); @@ -210,7 +203,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } } - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; $worksheetInfo[] = $tmpInfo; @@ -226,12 +219,12 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new PHPExcel Workbook + $objPHPExcel = new Workbook(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -288,7 +281,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { @@ -296,25 +289,25 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $toFormats = array('-', ' '); $underlineStyles = array ( - PHPExcel_Style_Font::UNDERLINE_NONE, - PHPExcel_Style_Font::UNDERLINE_DOUBLE, - PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING, - PHPExcel_Style_Font::UNDERLINE_SINGLE, - PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING + Style_Font::UNDERLINE_NONE, + Style_Font::UNDERLINE_DOUBLE, + Style_Font::UNDERLINE_DOUBLEACCOUNTING, + Style_Font::UNDERLINE_SINGLE, + Style_Font::UNDERLINE_SINGLEACCOUNTING ); $verticalAlignmentStyles = array ( - PHPExcel_Style_Alignment::VERTICAL_BOTTOM, - PHPExcel_Style_Alignment::VERTICAL_TOP, - PHPExcel_Style_Alignment::VERTICAL_CENTER, - PHPExcel_Style_Alignment::VERTICAL_JUSTIFY + Style_Alignment::VERTICAL_BOTTOM, + Style_Alignment::VERTICAL_TOP, + Style_Alignment::VERTICAL_CENTER, + Style_Alignment::VERTICAL_JUSTIFY ); $horizontalAlignmentStyles = array ( - PHPExcel_Style_Alignment::HORIZONTAL_GENERAL, - PHPExcel_Style_Alignment::HORIZONTAL_LEFT, - PHPExcel_Style_Alignment::HORIZONTAL_RIGHT, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS, - PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY + Style_Alignment::HORIZONTAL_GENERAL, + Style_Alignment::HORIZONTAL_LEFT, + Style_Alignment::HORIZONTAL_RIGHT, + Style_Alignment::HORIZONTAL_CENTER, + Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS, + Style_Alignment::HORIZONTAL_JUSTIFY ); $timezoneObj = new DateTimeZone('Europe/London'); @@ -323,11 +316,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } if (!$this->canRead($pFilename)) { - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $xml = simplexml_load_file($pFilename); @@ -378,27 +371,27 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P if (isset($xml->CustomDocumentProperties)) { foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { $propertyAttributes = $propertyValue->attributes($namespaces['dt']); - $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName); - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; + $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', __NAMESPACE__ . '\Reader_Excel2003XML::_hex2str', $propertyName); + $propertyType = DocumentProperties::PROPERTY_TYPE_UNKNOWN; switch((string) $propertyAttributes) { case 'string' : - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; + $propertyType = DocumentProperties::PROPERTY_TYPE_STRING; $propertyValue = trim($propertyValue); break; case 'boolean' : - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; + $propertyType = DocumentProperties::PROPERTY_TYPE_BOOLEAN; $propertyValue = (bool) $propertyValue; break; case 'integer' : - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER; + $propertyType = DocumentProperties::PROPERTY_TYPE_INTEGER; $propertyValue = intval($propertyValue); break; case 'float' : - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; + $propertyType = DocumentProperties::PROPERTY_TYPE_FLOAT; $propertyValue = floatval($propertyValue); break; case 'dateTime.tz' : - $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; + $propertyType = DocumentProperties::PROPERTY_TYPE_DATE; $propertyValue = strtotime(trim($propertyValue)); break; } @@ -448,7 +441,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P // echo $borderStyleKey.' = '.$borderStyleValue.'
'; switch ($borderStyleKey) { case 'LineStyle' : - $thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; + $thisBorder['style'] = Style_Border::BORDER_MEDIUM; // $thisBorder['style'] = $borderStyleValue; break; case 'Weight' : @@ -563,7 +556,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P foreach($worksheet->Table->Column as $columnData) { $columnData_ss = $columnData->attributes($namespaces['ss']); if (isset($columnData_ss['Index'])) { - $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1); + $columnID = Cell::stringFromColumnIndex($columnData_ss['Index']-1); } if (isset($columnData_ss['Width'])) { $columnWidth = $columnData_ss['Width']; @@ -589,7 +582,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $cell_ss = $cell->attributes($namespaces['ss']); if (isset($cell_ss['Index'])) { - $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1); + $columnID = Cell::stringFromColumnIndex($cell_ss['Index']-1); } $cellRange = $columnID.$rowID; @@ -602,7 +595,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { $columnTo = $columnID; if (isset($cell_ss['MergeAcross'])) { - $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); + $columnTo = Cell::stringFromColumnIndex(Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); } $rowTo = $rowID; if (isset($cell_ss['MergeDown'])) { @@ -625,7 +618,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } if (isset($cell->Data)) { $cellValue = $cellData = $cell->Data; - $type = PHPExcel_Cell_DataType::TYPE_NULL; + $type = Cell_DataType::TYPE_NULL; $cellData_ss = $cellData->attributes($namespaces['ss']); if (isset($cellData_ss['Type'])) { $cellDataType = $cellData_ss['Type']; @@ -641,33 +634,33 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P */ case 'String' : $cellValue = self::_convertStringEncoding($cellValue,$this->_charSet); - $type = PHPExcel_Cell_DataType::TYPE_STRING; + $type = Cell_DataType::TYPE_STRING; break; case 'Number' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; $cellValue = (float) $cellValue; if (floor($cellValue) == $cellValue) { $cellValue = (integer) $cellValue; } break; case 'Boolean' : - $type = PHPExcel_Cell_DataType::TYPE_BOOL; + $type = Cell_DataType::TYPE_BOOL; $cellValue = ($cellValue != 0); break; case 'DateTime' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue)); + $type = Cell_DataType::TYPE_NUMERIC; + $cellValue = Shared_Date::PHPToExcel(strtotime($cellValue)); break; case 'Error' : - $type = PHPExcel_Cell_DataType::TYPE_ERROR; + $type = Cell_DataType::TYPE_ERROR; break; } } if ($hasCalculatedValue) { // echo 'FORMULA
'; - $type = PHPExcel_Cell_DataType::TYPE_FORMULA; - $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID); + $type = Cell_DataType::TYPE_FORMULA; + $columnNumber = Cell::columnIndexFromString($columnID); if (substr($cellDataFormula,0,3) == 'of:') { $cellDataFormula = substr($cellDataFormula,3); // echo 'Before: ',$cellDataFormula,'
'; @@ -705,7 +698,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P if ($columnReference == '') $columnReference = $columnNumber; // Bracketed C references are relative to the current column if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]'); - $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; + $A1CellReference = Cell::stringFromColumnIndex($columnReference-1).$rowReference; $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); } } @@ -785,14 +778,14 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P private static function _convertStringEncoding($string,$charset) { if ($charset != 'UTF-8') { - return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset); + return Shared_String::ConvertEncoding($string,'UTF-8',$charset); } return $string; } private function _parseRichText($is = '') { - $value = new PHPExcel_RichText(); + $value = new RichText(); $value->createText(self::_convertStringEncoding($is,$this->_charSet)); diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index 410025b..0feb359 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -19,72 +19,65 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_Excel2007 + * PHPExcel\Reader_Excel2007 * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_Excel2007 extends Reader_Abstract implements Reader_IReader { /** - * PHPExcel_ReferenceHelper instance + * PHPExcel\ReferenceHelper instance * - * @var PHPExcel_ReferenceHelper + * @var PHPExcel\ReferenceHelper */ private $_referenceHelper = NULL; /** - * PHPExcel_Reader_Excel2007_Theme instance + * PHPExcel\Reader_Excel2007_Theme instance * - * @var PHPExcel_Reader_Excel2007_Theme + * @var PHPExcel\Reader_Excel2007_Theme */ private static $_theme = NULL; /** - * Create a new PHPExcel_Reader_Excel2007 instance + * Create a new PHPExcel\Reader_Excel2007 instance */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); - $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $this->_readFilter = new Reader_DefaultReadFilter(); + $this->_referenceHelper = ReferenceHelper::getInstance(); } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Check if zip class exists if (!class_exists('ZipArchive',FALSE)) { - throw new PHPExcel_Reader_Exception("ZipArchive library is not enabled"); + throw new Reader_Exception("ZipArchive library is not enabled"); } $xl = false; @@ -116,13 +109,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetNames = array(); @@ -160,13 +153,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); @@ -203,7 +196,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; $xml = new XMLReader(); - $res = $xml->open('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"); + $res = $xml->open('zip://' . Shared_File::realpath($pFilename) . '#' . "$dir/$fileWorksheet"); $xml->setParserProperty(2,true); $currCells = 0; @@ -221,7 +214,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $xml->close(); $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); $worksheetInfo[] = $tmpInfo; } @@ -292,11 +285,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // echo 'GETTING SHARED FORMULA
'; // echo 'Master is '.$sharedFormulas[$instance]['master'].'
'; // echo 'Formula is '.$sharedFormulas[$instance]['formula'].'
'; - $master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']); - $current = PHPExcel_Cell::coordinateFromString($r); + $master = Cell::coordinateFromString($sharedFormulas[$instance]['master']); + $current = Cell::coordinateFromString($r); $difference = array(0, 0); - $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); + $difference[0] = Cell::columnIndexFromString($current[0]) - Cell::columnIndexFromString($master[0]); $difference[1] = $current[1] - $master[1]; $value = $this->_referenceHelper->updateFormulaReferences( $sharedFormulas[$instance]['formula'], @@ -317,7 +310,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE { $fileName = substr($fileName, strpos($fileName, '//') + 1); } - $fileName = PHPExcel_Shared_File::realpath($fileName); + $fileName = Shared_File::realpath($fileName); // Apache POI fixes $contents = $archive->getFromName($fileName); @@ -334,17 +327,17 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE * Loads PHPExcel from file * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Initialisations - $excel = new PHPExcel; + $excel = new Workbook(); $excel->removeSheetByIndex(0); if (!$this->_readDataOnly) { $excel->removeCellStyleXfByIndex(0); // remove the default style @@ -385,7 +378,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $themeColours[$themePos] = $xmlColourData['val']; } } - self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours); + self::$_theme = new Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours); } break; } @@ -435,8 +428,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); $attributeType = $cellDataOfficeChildren->getName(); $attributeValue = (string) $cellDataOfficeChildren->{$attributeType}; - $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType); - $attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType); + $attributeValue = DocumentProperties::convertProperty($attributeValue,$attributeType); + $attributeType = DocumentProperties::convertPropertyType($attributeType); $docProps->setCustomProperty($propertyName,$attributeValue,$attributeType); } } @@ -454,7 +447,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($xmlStrings) && isset($xmlStrings->si)) { foreach ($xmlStrings->si as $val) { if (isset($val->t)) { - $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $val->t ); + $sharedStrings[] = Shared_String::ControlCharacterOOXML2PHP( (string) $val->t ); } elseif (isset($val->r)) { $sharedStrings[] = $this->_parseRichText($val); } @@ -481,7 +474,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (!$this->_readDataOnly && $xmlStyles) { foreach ($xmlStyles->cellXfs->xf as $xf) { - $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + $numFmt = Style_NumberFormat::FORMAT_GENERAL; if ($xf["numFmtId"]) { if (isset($numFmts)) { @@ -493,7 +486,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if ((int)$xf["numFmtId"] < 164) { - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); + $numFmt = Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); } } //$numFmt = str_replace('mm', 'i', $numFmt); @@ -510,19 +503,19 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $styles[] = $style; // add style to cellXf collection - $objStyle = new PHPExcel_Style; + $objStyle = new Style; self::_readStyle($objStyle, $style); $excel->addCellXf($objStyle); } foreach ($xmlStyles->cellStyleXfs->xf as $xf) { - $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + $numFmt = Style_NumberFormat::FORMAT_GENERAL; if ($numFmts && $xf["numFmtId"]) { $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); if (isset($tmpNumFmt["formatCode"])) { $numFmt = (string) $tmpNumFmt["formatCode"]; } else if ((int)$xf["numFmtId"] < 165) { - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); + $numFmt = Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); } } @@ -537,7 +530,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $cellStyles[] = $cellStyle; // add style to cellStyleXf collection - $objStyle = new PHPExcel_Style; + $objStyle = new Style; self::_readStyle($objStyle, $cellStyle); $excel->addCellStyleXf($objStyle); } @@ -548,7 +541,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Conditional Styles if ($xmlStyles->dxfs) { foreach ($xmlStyles->dxfs->dxf as $dxf) { - $style = new PHPExcel_Style(FALSE, TRUE); + $style = new Style(FALSE, TRUE); self::_readStyle($style, $dxf); $dxfs[] = $style; } @@ -559,7 +552,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (intval($cellStyle['builtinId']) == 0) { if (isset($cellStyles[intval($cellStyle['xfId'])])) { // Set default style - $style = new PHPExcel_Style; + $style = new Style; self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); // normal style, currently not using it for anything @@ -573,10 +566,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Set base date if ($xmlWorkbook->workbookPr) { - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + Shared_Date::setExcelCalendar(Shared_Date::CALENDAR_WINDOWS_1900); if (isset($xmlWorkbook->workbookPr['date1904'])) { if (self::boolean((string) $xmlWorkbook->workbookPr['date1904'])) { - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); + Shared_Date::setExcelCalendar(Shared_Date::CALENDAR_MAC_1904); } } } @@ -725,21 +718,21 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach ($xmlSheet->cols->col as $col) { for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { if ($col["style"] && !$this->_readDataOnly) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); + $docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); } if (self::boolean($col["bestFit"])) { - //$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(TRUE); + //$docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setAutoSize(TRUE); } if (self::boolean($col["hidden"])) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(FALSE); + $docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setVisible(FALSE); } if (self::boolean($col["collapsed"])) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(TRUE); + $docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setCollapsed(TRUE); } if ($col["outlineLevel"] > 0) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"])); + $docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"])); } - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setWidth(floatval($col["width"])); + $docSheet->getColumnDimension(Cell::stringFromColumnIndex($i))->setWidth(floatval($col["width"])); if (intval($col["max"]) == 16384) { break; @@ -791,7 +784,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Read cell? if ($this->getReadFilter() !== NULL) { - $coordinates = PHPExcel_Cell::coordinateFromString($r); + $coordinates = Cell::coordinateFromString($r); if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { continue; @@ -810,7 +803,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ((string)$c->v != '') { $value = $sharedStrings[intval($c->v)]; - if ($value instanceof PHPExcel_RichText) { + if ($value instanceof RichText) { $value = clone $value; } } else { @@ -874,7 +867,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Rich text? - if ($value instanceof PHPExcel_RichText && $this->_readDataOnly) { + if ($value instanceof RichText && $this->_readDataOnly) { $value = $value->getPlainText(); } @@ -905,10 +898,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach ($conditional->cfRule as $cfRule) { if ( ( - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION + (string)$cfRule["type"] == Style_Conditional::CONDITION_NONE || + (string)$cfRule["type"] == Style_Conditional::CONDITION_CELLIS || + (string)$cfRule["type"] == Style_Conditional::CONDITION_CONTAINSTEXT || + (string)$cfRule["type"] == Style_Conditional::CONDITION_EXPRESSION ) && isset($dxfs[intval($cfRule["dxfId"])]) ) { $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; @@ -920,7 +913,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE ksort($cfRules); $conditionalStyles = array(); foreach ($cfRules as $cfRule) { - $objConditional = new PHPExcel_Style_Conditional(); + $objConditional = new Style_Conditional(); $objConditional->setConditionType((string)$cfRule["type"]); $objConditional->setOperatorType((string)$cfRule["operator"]); @@ -940,7 +933,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Extract all cell references in $ref - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($ref); + $aReferences = Cell::extractAllCellReferencesInRange($ref); foreach ($aReferences as $reference) { $docSheet->getStyle($reference)->setConditionalStyles($conditionalStyles); } @@ -971,14 +964,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]); // Check for standard filters if ($filterColumn->filters) { - $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER); + $column->setFilterType(Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER); $filters = $filterColumn->filters; if ((isset($filters["blank"])) && ($filters["blank"] == 1)) { $column->createRule()->setRule( NULL, // Operator is undefined, but always treated as EQUAL '' ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER); } // Standard filters are always an OR join, so no join rule needs to be set // Entries can be either filter elements @@ -987,7 +980,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE NULL, // Operator is undefined, but always treated as EQUAL (string) $filterRule["val"] ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER); } // Or Date Group elements foreach ($filters->dateGroupItem as $dateGroupItem) { @@ -1003,29 +996,29 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE ), (string) $dateGroupItem["dateTimeGrouping"] ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP); } } // Check for custom filters if ($filterColumn->customFilters) { - $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER); + $column->setFilterType(Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER); $customFilters = $filterColumn->customFilters; // Custom filters can an AND or an OR join; // and there should only ever be one or two entries if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) { - $column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); + $column->setJoin(Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); } foreach ($customFilters->customFilter as $filterRule) { $column->createRule()->setRule( (string) $filterRule["operator"], (string) $filterRule["val"] ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); } } // Check for dynamic filters if ($filterColumn->dynamicFilter) { - $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); + $column->setFilterType(Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); // We should only ever have one dynamic filter foreach ($filterColumn->dynamicFilter as $filterRule) { $column->createRule()->setRule( @@ -1033,7 +1026,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE (string) $filterRule["val"], (string) $filterRule["type"] ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); if (isset($filterRule["val"])) { $column->setAttribute('val',(string) $filterRule["val"]); } @@ -1044,21 +1037,21 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Check for dynamic filters if ($filterColumn->top10) { - $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER); + $column->setFilterType(Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER); // We should only ever have one top10 filter foreach ($filterColumn->top10 as $filterRule) { $column->createRule()->setRule( (((isset($filterRule["percent"])) && ($filterRule["percent"] == 1)) - ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT - : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE + ? Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT + : Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE ), (string) $filterRule["val"], (((isset($filterRule["top"])) && ($filterRule["top"] == 1)) - ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP - : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM + ? Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP + : Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM ) ) - ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER); + ->setRuleType(Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER); } } } @@ -1146,14 +1139,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) { foreach ($xmlSheet->rowBreaks->brk as $brk) { if ($brk["man"]) { - $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW); + $docSheet->setBreak("A$brk[id]", Worksheet::BREAK_ROW); } } } if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) { foreach ($xmlSheet->colBreaks->brk as $brk) { if ($brk["man"]) { - $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex((string) $brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN); + $docSheet->setBreak(Cell::stringFromColumnIndex((string) $brk["id"]) . "1", Worksheet::BREAK_COLUMN); } } } @@ -1167,7 +1160,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $stRange = $docSheet->shrinkRangeToFit($range); // Extract all cell references in $range - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($stRange); + $aReferences = Cell::extractAllCellReferencesInRange($stRange); foreach ($aReferences as $reference) { // Create validation $docValidation = $docSheet->getCell($reference)->getDataValidation(); @@ -1208,7 +1201,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Link url $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); - foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { + foreach (Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { $cell = $docSheet->getCell( $cellReference ); if (isset($linkRel['id'])) { $hyperlinkUrl = $hyperlinks[ (string)$linkRel['id'] ]; @@ -1249,7 +1242,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Loop through comments foreach ($comments as $relName => $relPath) { // Load comments file - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); + $relPath = Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) ); // Utility variables @@ -1270,7 +1263,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Loop through VML comments foreach ($vmlComments as $relName => $relPath) { // Load VML comments file - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); + $relPath = Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); @@ -1356,12 +1349,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); $style = self::toCSSArray( (string)$shape['style'] ); - $hfImages[ (string)$shape['id'] ] = new PHPExcel_Worksheet_HeaderFooterDrawing(); + $hfImages[ (string)$shape['id'] ] = new Worksheet_HeaderFooterDrawing(); if (isset($imageData['title'])) { $hfImages[ (string)$shape['id'] ]->setName( (string)$imageData['title'] ); } - $hfImages[ (string)$shape['id'] ]->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $drawings[(string)$imageData['relid']], false); + $hfImages[ (string)$shape['id'] ]->setPath("zip://".Shared_File::realpath($pFilename)."#" . $drawings[(string)$imageData['relid']], false); $hfImages[ (string)$shape['id'] ]->setResizeProportional(false); $hfImages[ (string)$shape['id'] ]->setWidth($style['width']); $hfImages[ (string)$shape['id'] ]->setHeight($style['height']); @@ -1413,25 +1406,25 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip; $xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; $outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; - $objDrawing = new PHPExcel_Worksheet_Drawing; + $objDrawing = new Worksheet_Drawing; $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); - $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); - $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); + $objDrawing->setPath("zip://".Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setCoordinates(Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); + $objDrawing->setOffsetY(Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); $objDrawing->setResizeProportional(false); - $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"))); - $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"))); + $objDrawing->setWidth(Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"))); + $objDrawing->setHeight(Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"))); if ($xfrm) { - $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + $objDrawing->setRotation(Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); } if ($outerShdw) { $shadow = $objDrawing->getShadow(); $shadow->setVisible(true); - $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); - $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); - $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); + $shadow->setBlurRadius(Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); + $shadow->setDirection(Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); @@ -1439,11 +1432,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $objDrawing->setWorksheet($docSheet); } else { // ? Can charts be positioned with a oneCellAnchor ? - $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1); - $offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff); - $offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff); - $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); - $height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")); + $coordinates = Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1); + $offsetX = Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff); + $offsetY = Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff); + $width = Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); + $height = Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")); } } } @@ -1453,39 +1446,39 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip; $xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; $outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; - $objDrawing = new PHPExcel_Worksheet_Drawing; + $objDrawing = new Worksheet_Drawing; $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); - $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); - $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); + $objDrawing->setPath("zip://".Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setCoordinates(Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); + $objDrawing->setOffsetY(Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); $objDrawing->setResizeProportional(false); - $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx"))); - $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy"))); + $objDrawing->setWidth(Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx"))); + $objDrawing->setHeight(Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy"))); if ($xfrm) { - $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + $objDrawing->setRotation(Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); } if ($outerShdw) { $shadow = $objDrawing->getShadow(); $shadow->setVisible(true); - $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); - $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); - $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); + $shadow->setBlurRadius(Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); + $shadow->setDirection(Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); } $objDrawing->setWorksheet($docSheet); } elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) { - $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1); - $fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff); - $fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff); - $toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1); - $toOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff); - $toOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff); + $fromCoordinate = Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1); + $fromOffsetX = Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff); + $fromOffsetY = Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff); + $toCoordinate = Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1); + $toOffsetX = Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff); + $toOffsetY = Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff); $graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic; $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; $thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); @@ -1617,7 +1610,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { $extractedRange = str_replace('$', '', $range[1]); $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]); - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); + $excel->addNamedRange( new NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); } } } @@ -1629,7 +1622,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $extractedSheetName = ''; if (strpos( (string)$definedName, '!' ) !== false) { // Extract sheet name - $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle( (string)$definedName, true ); + $extractedSheetName = Worksheet::extractSheetTitle( (string)$definedName, true ); $extractedSheetName = $extractedSheetName[0]; // Locate sheet @@ -1641,7 +1634,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if ($locatedSheet !== NULL) { - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) ); + $excel->addNamedRange( new NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) ); } } } @@ -1676,7 +1669,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($this->_includeCharts) { $chartEntryRef = ltrim($contentType['PartName'],'/'); $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef)); - $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml')); + $objChart = Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml')); // echo 'Chart ',$chartEntryRef,'
'; // var_dump($charts[$chartEntryRef]); @@ -1714,13 +1707,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($color["rgb"])) { return (string)$color["rgb"]; } else if (isset($color["indexed"])) { - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); + return Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); } else if (isset($color["theme"])) { if (self::$_theme !== NULL) { $returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); if (isset($color["tint"])) { $tintAdjust = (float) $color["tint"]; - $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust); + $returnColour = Style_Color::changeBrightness($returnColour, $tintAdjust); } return 'FF'.$returnColour; } @@ -1759,7 +1752,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); if (isset($style->font->u) && !isset($style->font->u["val"])) { - $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + $docStyle->getFont()->setUnderline(Style_Font::UNDERLINE_SINGLE); } else if (isset($style->font->u) && isset($style->font->u["val"])) { $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); } @@ -1805,13 +1798,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $diagonalUp = self::boolean((string) $style->border["diagonalUp"]); $diagonalDown = self::boolean((string) $style->border["diagonalDown"]); if (!$diagonalUp && !$diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE); + $docStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_NONE); } elseif ($diagonalUp && !$diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP); + $docStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_UP); } elseif (!$diagonalUp && $diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN); + $docStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_DOWN); } else { - $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH); + $docStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_BOTH); } self::_readBorder($docStyle->getBorders()->getLeft(), $style->border->left); self::_readBorder($docStyle->getBorders()->getRight(), $style->border->right); @@ -1842,17 +1835,17 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($style->protection)) { if (isset($style->protection['locked'])) { if (self::boolean((string) $style->protection['locked'])) { - $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED); + $docStyle->getProtection()->setLocked(Style_Protection::PROTECTION_PROTECTED); } else { - $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + $docStyle->getProtection()->setLocked(Style_Protection::PROTECTION_UNPROTECTED); } } if (isset($style->protection['hidden'])) { if (self::boolean((string) $style->protection['hidden'])) { - $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED); + $docStyle->getProtection()->setHidden(Style_Protection::PROTECTION_PROTECTED); } else { - $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + $docStyle->getProtection()->setHidden(Style_Protection::PROTECTION_UNPROTECTED); } } } @@ -1870,17 +1863,17 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE private function _parseRichText($is = null) { - $value = new PHPExcel_RichText(); + $value = new RichText(); if (isset($is->t)) { - $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) ); + $value->createText( Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) ); } else { foreach ($is->r as $run) { if (!isset($run->rPr)) { - $objText = $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); + $objText = $value->createText( Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); } else { - $objText = $value->createTextRun( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); + $objText = $value->createTextRun( Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); if (isset($run->rPr->rFont["val"])) { $objText->getFont()->setName((string) $run->rPr->rFont["val"]); @@ -1891,7 +1884,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (isset($run->rPr->color)) { - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) ); + $objText->getFont()->setColor( new Style_Color( self::_readColor($run->rPr->color) ) ); } if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) || @@ -1915,7 +1908,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { - $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + $objText->getFont()->setUnderline(Style_Font::UNDERLINE_SINGLE); } else if (isset($run->rPr->u) && isset($run->rPr->u["val"])) { $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); } @@ -1955,15 +1948,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (strpos($item[1], 'pt') !== false) { $item[1] = str_replace('pt', '', $item[1]); - $item[1] = PHPExcel_Shared_Font::fontSizeToPixels($item[1]); + $item[1] = Shared_Font::fontSizeToPixels($item[1]); } if (strpos($item[1], 'in') !== false) { $item[1] = str_replace('in', '', $item[1]); - $item[1] = PHPExcel_Shared_Font::inchSizeToPixels($item[1]); + $item[1] = Shared_Font::inchSizeToPixels($item[1]); } if (strpos($item[1], 'cm') !== false) { $item[1] = str_replace('cm', '', $item[1]); - $item[1] = PHPExcel_Shared_Font::centimeterSizeToPixels($item[1]); + $item[1] = Shared_Font::centimeterSizeToPixels($item[1]); } $style[$item[0]] = $item[1]; diff --git a/Classes/PHPExcel/Reader/Excel2007/Chart.php b/Classes/PHPExcel/Reader/Excel2007/Chart.php index 0c33ef2..864b543 100644 --- a/Classes/PHPExcel/Reader/Excel2007/Chart.php +++ b/Classes/PHPExcel/Reader/Excel2007/Chart.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader_Excel2007 + * @package PHPExcel\Reader_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Reader_Excel2007_Chart + * PHPExcel\Reader_Excel2007_Chart * * @category PHPExcel - * @package PHPExcel_Reader_Excel2007 + * @package PHPExcel\Reader_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2007_Chart +class Reader_Excel2007_Chart { private static function _getAttribute($component, $name, $format) { $attributes = $component->attributes(); @@ -55,7 +58,7 @@ class PHPExcel_Reader_Excel2007_Chart if (isset($color["rgb"])) { return (string)$color["rgb"]; } else if (isset($color["indexed"])) { - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); + return Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); } } @@ -159,9 +162,9 @@ class PHPExcel_Reader_Excel2007_Chart } } if ($plotAreaLayout == NULL) { - $plotAreaLayout = new PHPExcel_Chart_Layout(); + $plotAreaLayout = new Chart_Layout(); } - $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries); + $plotArea = new Chart_PlotArea($plotAreaLayout,$plotSeries); self::_setChartAttributes($plotAreaLayout,$plotAttributes); break; case "plotVisOnly": @@ -190,13 +193,13 @@ class PHPExcel_Reader_Excel2007_Chart break; } } - $legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay); + $legend = new Chart_Legend($legendPos, $legendLayout, $legendOverlay); break; } } } } - $chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel); + $chart = new Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel); return $chart; } // function readChart() @@ -223,7 +226,7 @@ class PHPExcel_Reader_Excel2007_Chart } } - return new PHPExcel_Chart_Title($caption, $titleLayout); + return new Chart_Title($caption, $titleLayout); } // function _chartTitle() @@ -240,7 +243,7 @@ class PHPExcel_Reader_Excel2007_Chart // echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL; $layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); } - return new PHPExcel_Chart_Layout($layout); + return new Chart_Layout($layout); } // function _chartLayoutDetails() @@ -291,7 +294,7 @@ class PHPExcel_Reader_Excel2007_Chart } } } - return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine); + return new Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine); } // function _chartDataSeries() @@ -300,24 +303,24 @@ class PHPExcel_Reader_Excel2007_Chart $seriesSource = (string) $seriesDetail->strRef->f; $seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s'); - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); + return new Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); } elseif (isset($seriesDetail->numRef)) { $seriesSource = (string) $seriesDetail->numRef->f; $seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); - return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); + return new Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); } elseif (isset($seriesDetail->multiLvlStrRef)) { $seriesSource = (string) $seriesDetail->multiLvlStrRef->f; $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s'); $seriesData['pointCount'] = count($seriesData['dataValues']); - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); + return new Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); } elseif (isset($seriesDetail->multiLvlNumRef)) { $seriesSource = (string) $seriesDetail->multiLvlNumRef->f; $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s'); $seriesData['pointCount'] = count($seriesData['dataValues']); - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); + return new Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); } return null; } // function _chartDataSeriesValueSet() @@ -391,7 +394,7 @@ class PHPExcel_Reader_Excel2007_Chart } // function _chartDataSeriesValuesMultiLevel() private static function _parseRichText($titleDetailPart = null) { - $value = new PHPExcel_RichText(); + $value = new RichText(); foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { if (isset($titleDetailElement->t)) { @@ -409,7 +412,7 @@ class PHPExcel_Reader_Excel2007_Chart $fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); if (!is_null($fontColor)) { - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) ); + $objText->getFont()->setColor( new Style_Color( self::_readColor($fontColor) ) ); } $bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean'); @@ -434,11 +437,11 @@ class PHPExcel_Reader_Excel2007_Chart $underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string')); if (!is_null($underscore)) { if ($underscore == 'sng') { - $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + $objText->getFont()->setUnderline(Style_Font::UNDERLINE_SINGLE); } elseif($underscore == 'dbl') { - $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); + $objText->getFont()->setUnderline(Style_Font::UNDERLINE_DOUBLE); } else { - $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE); + $objText->getFont()->setUnderline(Style_Font::UNDERLINE_NONE); } } diff --git a/Classes/PHPExcel/Reader/Excel2007/Theme.php b/Classes/PHPExcel/Reader/Excel2007/Theme.php index 89176a2..5043ad1 100644 --- a/Classes/PHPExcel/Reader/Excel2007/Theme.php +++ b/Classes/PHPExcel/Reader/Excel2007/Theme.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader_Excel2007 + * @package PHPExcel\Reader_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Reader_Excel2007_Theme + * PHPExcel\Reader_Excel2007_Theme * * @category PHPExcel - * @package PHPExcel_Reader_Excel2007 + * @package PHPExcel\Reader_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2007_Theme +class Reader_Excel2007_Theme { /** * Theme Name @@ -66,7 +68,7 @@ class PHPExcel_Reader_Excel2007_Theme /** - * Create a new PHPExcel_Theme + * Create a new PHPExcel\Theme * */ public function __construct($themeName,$colourSchemeName,$colourMap) diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index 4955369..b57a438 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader_Excel5 + * @package PHPExcel\Reader_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -57,25 +57,18 @@ // external sheet reference structure -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_Excel5 + * PHPExcel\Reader_Excel5 * * This class uses {@link http://sourceforge.net/projects/phpexcelreader/parseXL} * * @category PHPExcel - * @package PHPExcel_Reader_Excel5 + * @package PHPExcel\Reader_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_Excel5 extends Reader_Abstract implements Reader_IReader { // ParseXL definitions const XLS_BIFF8 = 0x0600; @@ -212,7 +205,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Worksheet that is currently being built by the reader. * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_phpSheet; @@ -381,35 +374,35 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** - * Create a new PHPExcel_Reader_Excel5 instance + * Create a new PHPExcel\Reader_Excel5 instance */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } try { // Use ParseXL for the hard work. - $ole = new PHPExcel_Shared_OLERead(); + $ole = new Shared_OLERead(); // get excel data $res = $ole->read($pFilename); return true; - } catch (PHPExcel_Exception $e) { + } catch (Exception $e) { return false; } } @@ -419,13 +412,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetNames = array(); @@ -468,13 +461,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); @@ -548,7 +541,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } } - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; $worksheetInfo[] = $tmpInfo; @@ -563,7 +556,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { @@ -571,7 +564,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $this->_loadOLE($pFilename); // Initialisations - $this->_phpExcel = new PHPExcel; + $this->_phpExcel = new Workbook(); $this->_phpExcel->removeSheetByIndex(0); // remove 1st sheet if (!$this->_readDataOnly) { $this->_phpExcel->removeCellStyleXfByIndex(0); // remove the default style @@ -690,12 +683,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // treat MSODRAWINGGROUP records, workbook-level Escher if (!$this->_readDataOnly && $this->_drawingGroupData) { - $escherWorkbook = new PHPExcel_Shared_Escher(); - $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook); + $escherWorkbook = new Shared_Escher(); + $reader = new Reader_Excel5_Escher($escherWorkbook); $escherWorkbook = $reader->load($this->_drawingGroupData); // debug Escher stream - //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); + //$debug = new Debug_Escher(new Shared_Escher()); //$debug->load($this->_drawingGroupData); } @@ -808,12 +801,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // treat MSODRAWING records, sheet-level Escher if (!$this->_readDataOnly && $this->_drawingData) { - $escherWorksheet = new PHPExcel_Shared_Escher(); - $reader = new PHPExcel_Reader_Excel5_Escher($escherWorksheet); + $escherWorksheet = new Shared_Escher(); + $reader = new Reader_Excel5_Escher($escherWorksheet); $escherWorksheet = $reader->load($this->_drawingData); // debug Escher stream - //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); + //$debug = new Debug_Escher(new Shared_Escher()); //$debug->load($this->_drawingData); // get all spContainers in one long array, so they can be mapped to OBJ records @@ -836,20 +829,20 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // calculate the width and height of the shape - list($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($spContainer->getStartCoordinates()); - list($endColumn, $endRow) = PHPExcel_Cell::coordinateFromString($spContainer->getEndCoordinates()); + list($startColumn, $startRow) = Cell::coordinateFromString($spContainer->getStartCoordinates()); + list($endColumn, $endRow) = Cell::coordinateFromString($spContainer->getEndCoordinates()); $startOffsetX = $spContainer->getStartOffsetX(); $startOffsetY = $spContainer->getStartOffsetY(); $endOffsetX = $spContainer->getEndOffsetX(); $endOffsetY = $spContainer->getEndOffsetY(); - $width = PHPExcel_Shared_Excel5::getDistanceX($this->_phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); - $height = PHPExcel_Shared_Excel5::getDistanceY($this->_phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); + $width = Shared_Excel5::getDistanceX($this->_phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); + $height = Shared_Excel5::getDistanceY($this->_phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); // calculate offsetX and offsetY of the shape - $offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, $startColumn) / 1024; - $offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256; + $offsetX = $startOffsetX * Shared_Excel5::sizeCol($this->_phpSheet, $startColumn) / 1024; + $offsetY = $startOffsetY * Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256; switch ($obj['otObjType']) { case 0x19: @@ -880,7 +873,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // need check because some blip types are not supported by Escher reader such as EMF if ($blip = $BSE->getBlip()) { $ih = imagecreatefromstring($blip->getData()); - $drawing = new PHPExcel_Worksheet_MemoryDrawing(); + $drawing = new Worksheet_MemoryDrawing(); $drawing->setImageResource($ih); // width, height, offsetX, offsetY @@ -891,14 +884,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $drawing->setOffsetY($offsetY); switch ($blipType) { - case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: - $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG); - $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG); + case Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: + $drawing->setRenderingFunction(Worksheet_MemoryDrawing::RENDERING_JPEG); + $drawing->setMimeType(Worksheet_MemoryDrawing::MIMETYPE_JPEG); break; - case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: - $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG); - $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG); + case Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: + $drawing->setRenderingFunction(Worksheet_MemoryDrawing::RENDERING_PNG); + $drawing->setMimeType(Worksheet_MemoryDrawing::MIMETYPE_PNG); break; } @@ -919,10 +912,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // treat SHAREDFMLA records if ($this->_version == self::XLS_BIFF8) { foreach ($this->_sharedFormulaParts as $cell => $baseCell) { - list($column, $row) = PHPExcel_Cell::coordinateFromString($cell); + list($column, $row) = Cell::coordinateFromString($cell); if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle()) ) { $formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell); - $this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + $this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, Cell_DataType::TYPE_FORMULA); } } } @@ -1008,8 +1001,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $coordinateStrings = explode(':', $extractedRange); if (count($coordinateStrings) == 2) { - list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[0]); - list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[1]); + list($firstColumn, $firstRow) = Cell::coordinateFromString($coordinateStrings[0]); + list($lastColumn, $lastRow) = Cell::coordinateFromString($coordinateStrings[1]); if ($firstColumn == 'A' and $lastColumn == 'IV') { // then we have repeating rows @@ -1040,7 +1033,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $scope = ($definedName['scope'] == 0) ? null : $this->_phpExcel->getSheetByName($this->_sheets[$definedName['scope'] - 1]['name']); - $this->_phpExcel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope) ); + $this->_phpExcel->addNamedRange( new NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope) ); } } else { // Named Value @@ -1061,7 +1054,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce private function _loadOLE($pFilename) { // OLE reader - $ole = new PHPExcel_Shared_OLERead(); + $ole = new Shared_OLERead(); // get excel data, $res = $ole->read($pFilename); @@ -1143,13 +1136,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 0x1E: // null-terminated string prepended by dword string length $byteLength = self::_GetInt4d($this->_summaryInformation, $secOffset + 4 + $offset); $value = substr($this->_summaryInformation, $secOffset + 8 + $offset, $byteLength); - $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); + $value = Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); $value = rtrim($value); break; case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) // PHP-time - $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_summaryInformation, $secOffset + 4 + $offset, 8)); + $value = Shared_OLE::OLE2LocalDate(substr($this->_summaryInformation, $secOffset + 4 + $offset, 8)); break; case 0x47: // Clipboard format @@ -1159,7 +1152,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce switch ($id) { case 0x01: // Code Page - $codePage = PHPExcel_Shared_CodePage::NumberToName($value); + $codePage = Shared_CodePage::NumberToName($value); break; case 0x02: // Title @@ -1314,13 +1307,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 0x1E: // null-terminated string prepended by dword string length $byteLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset); $value = substr($this->_documentSummaryInformation, $secOffset + 8 + $offset, $byteLength); - $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); + $value = Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); $value = rtrim($value); break; case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) // PHP-Time - $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_documentSummaryInformation, $secOffset + 4 + $offset, 8)); + $value = Shared_OLE::OLE2LocalDate(substr($this->_documentSummaryInformation, $secOffset + 4 + $offset, 8)); break; case 0x47: // Clipboard format @@ -1330,7 +1323,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce switch ($id) { case 0x01: // Code Page - $codePage = PHPExcel_Shared_CodePage::NumberToName($value); + $codePage = Shared_CodePage::NumberToName($value); break; case 0x02: // Category @@ -1533,7 +1526,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case self::XLS_WorkbookGlobals: $version = self::_GetInt2d($recordData, 0); if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) { - throw new PHPExcel_Reader_Exception('Cannot read this Excel file. Version is too old.'); + throw new Reader_Exception('Cannot read this Excel file. Version is too old.'); } $this->_version = $version; break; @@ -1574,7 +1567,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // move stream pointer to next record $this->_pos += 4 + $length; - throw new PHPExcel_Reader_Exception('Cannot read encrypted file'); + throw new Reader_Exception('Cannot read encrypted file'); } @@ -1598,7 +1591,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 0; size: 2; code page identifier $codepage = self::_GetInt2d($recordData, 0); - $this->_codepage = PHPExcel_Shared_CodePage::NumberToName($codepage); + $this->_codepage = Shared_CodePage::NumberToName($codepage); } @@ -1623,9 +1616,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $this->_pos += 4 + $length; // offset: 0; size: 2; 0 = base 1900, 1 = base 1904 - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + Shared_Date::setExcelCalendar(Shared_Date::CALENDAR_WINDOWS_1900); if (ord($recordData{0}) == 1) { - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); + Shared_Date::setExcelCalendar(Shared_Date::CALENDAR_MAC_1904); } } @@ -1642,7 +1635,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $this->_pos += 4 + $length; if (!$this->_readDataOnly) { - $objFont = new PHPExcel_Style_Font(); + $objFont = new Style_Font(); // offset: 0; size: 2; height of the font (in twips = 1/20 of a point) $size = self::_GetInt2d($recordData, 0); @@ -1688,16 +1681,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 0x00: break; // no underline case 0x01: - $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + $objFont->setUnderline(Style_Font::UNDERLINE_SINGLE); break; case 0x02: - $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); + $objFont->setUnderline(Style_Font::UNDERLINE_DOUBLE); break; case 0x21: - $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING); + $objFont->setUnderline(Style_Font::UNDERLINE_SINGLEACCOUNTING); break; case 0x22: - $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING); + $objFont->setUnderline(Style_Font::UNDERLINE_DOUBLEACCOUNTING); break; } @@ -1777,7 +1770,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // move stream pointer to next record $this->_pos += 4 + $length; - $objStyle = new PHPExcel_Style(); + $objStyle = new Style(); if (!$this->_readDataOnly) { // offset: 0; size: 2; Index to FONT record @@ -1795,7 +1788,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if (isset($this->_formats[$numberFormatIndex])) { // then we have user-defined format code $numberformat = array('code' => $this->_formats[$numberFormatIndex]); - } elseif (($code = PHPExcel_Style_NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { + } elseif (($code = Style_NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { // then we have built-in format code $numberformat = array('code' => $code); } else { @@ -1810,12 +1803,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit 0; mask 0x01; 1 = cell is locked $isLocked = (0x01 & $xfTypeProt) >> 0; $objStyle->getProtection()->setLocked($isLocked ? - PHPExcel_Style_Protection::PROTECTION_INHERIT : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + Style_Protection::PROTECTION_INHERIT : Style_Protection::PROTECTION_UNPROTECTED); // bit 1; mask 0x02; 1 = Formula is hidden $isHidden = (0x02 & $xfTypeProt) >> 1; $objStyle->getProtection()->setHidden($isHidden ? - PHPExcel_Style_Protection::PROTECTION_PROTECTED : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + Style_Protection::PROTECTION_PROTECTED : Style_Protection::PROTECTION_UNPROTECTED); // bit 2; mask 0x04; 0 = Cell XF, 1 = Cell Style XF $isCellStyleXf = (0x04 & $xfTypeProt) >> 2; @@ -1825,22 +1818,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $horAlign = (0x07 & ord($recordData{6})) >> 0; switch ($horAlign) { case 0: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_GENERAL); break; case 1: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_LEFT); break; case 2: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_CENTER); break; case 3: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_RIGHT); break; case 5: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_JUSTIFY); break; case 6: - $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS); + $objStyle->getAlignment()->setHorizontal(Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS); break; } // bit 3, mask 0x08; wrap text @@ -1857,16 +1850,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $vertAlign = (0x70 & ord($recordData{6})) >> 4; switch ($vertAlign) { case 0: - $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP); + $objStyle->getAlignment()->setVertical(Style_Alignment::VERTICAL_TOP); break; case 1: - $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); + $objStyle->getAlignment()->setVertical(Style_Alignment::VERTICAL_CENTER); break; case 2: - $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_BOTTOM); + $objStyle->getAlignment()->setVertical(Style_Alignment::VERTICAL_BOTTOM); break; case 3: - $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY); + $objStyle->getAlignment()->setVertical(Style_Alignment::VERTICAL_JUSTIFY); break; } @@ -1933,13 +1926,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce true : false; if ($diagonalUp == false && $diagonalDown == false) { - $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE); + $objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_NONE); } elseif ($diagonalUp == true && $diagonalDown == false) { - $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP); + $objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_UP); } elseif ($diagonalUp == false && $diagonalDown == true) { - $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN); + $objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_DOWN); } elseif ($diagonalUp == true && $diagonalDown == true) { - $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH); + $objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_BOTH); } // offset: 14; size: 4; @@ -2316,10 +2309,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: 1; sheet state switch (ord($recordData{4})) { - case 0x00: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; - case 0x01: $sheetState = PHPExcel_Worksheet::SHEETSTATE_HIDDEN; break; - case 0x02: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN; break; - default: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; + case 0x00: $sheetState = Worksheet::SHEETSTATE_VISIBLE; break; + case 0x01: $sheetState = Worksheet::SHEETSTATE_HIDDEN; break; + case 0x02: $sheetState = Worksheet::SHEETSTATE_VERYHIDDEN; break; + default: $sheetState = Worksheet::SHEETSTATE_VISIBLE; break; } // offset: 5; size: 1; sheet type @@ -2520,7 +2513,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce try { $formula = $this->_getFormulaFromStructure($formulaStructure); - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { $formula = ''; } @@ -2828,7 +2821,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $cl = self::_GetInt2d($recordData, 2 + 6 * $i + 4); // not sure why two column indexes are necessary? - $this->_phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW); + $this->_phpSheet->setBreakByColumnAndRow($cf, $r, Worksheet::BREAK_ROW); } } } @@ -2856,7 +2849,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $rl = self::_GetInt2d($recordData, 2 + 6 * $i + 4); // not sure why two row indexes are necessary? - $this->_phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN); + $this->_phpSheet->setBreakByColumnAndRow($c, $rf, Worksheet::BREAK_COLUMN); } } } @@ -3065,8 +3058,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if (!$isNotInit) { $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); switch ($isPortrait) { - case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; - case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; + case 0: $this->_phpSheet->getPageSetup()->setOrientation(Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; + case 1: $this->_phpSheet->getPageSetup()->setOrientation(Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; } $this->_phpSheet->getPageSetup()->setScale($scale, false); @@ -3341,7 +3334,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; index to column $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3359,7 +3352,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // add cell - $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, Cell_DataType::TYPE_NUMERIC); } } @@ -3386,7 +3379,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; index to column $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3399,18 +3392,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // add cell if (($fmtRuns = $this->_sst[$index]['fmtRuns']) && !$this->_readDataOnly) { // then we should treat as rich text - $richText = new PHPExcel_RichText(); + $richText = new RichText(); $charPos = 0; $sstCount = count($this->_sst[$index]['fmtRuns']); for ($i = 0; $i <= $sstCount; ++$i) { if (isset($fmtRuns[$i])) { - $text = PHPExcel_Shared_String::Substring($this->_sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); + $text = Shared_String::Substring($this->_sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); $charPos = $fmtRuns[$i]['charPos']; } else { - $text = PHPExcel_Shared_String::Substring($this->_sst[$index]['value'], $charPos, PHPExcel_Shared_String::CountCharacters($this->_sst[$index]['value'])); + $text = Shared_String::Substring($this->_sst[$index]['value'], $charPos, Shared_String::CountCharacters($this->_sst[$index]['value'])); } - if (PHPExcel_Shared_String::CountCharacters($text) > 0) { + if (Shared_String::CountCharacters($text) > 0) { if ($i == 0) { // first text run, no style $richText->createText($text); } else { @@ -3429,10 +3422,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } } $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($richText, PHPExcel_Cell_DataType::TYPE_STRING); + $cell->setValueExplicit($richText, Cell_DataType::TYPE_STRING); } else { $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($this->_sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING); + $cell->setValueExplicit($this->_sst[$index]['value'], Cell_DataType::TYPE_STRING); } if (!$this->_readDataOnly) { @@ -3473,7 +3466,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $offset = 4; for ($i = 0; $i < $columns; ++$i) { - $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); + $columnString = Cell::stringFromColumnIndex($colFirst + $i); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3490,7 +3483,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // add cell value - $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, Cell_DataType::TYPE_NUMERIC); } $offset += 6; @@ -3519,7 +3512,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size 2; index to column $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3535,7 +3528,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // add cell value - $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, Cell_DataType::TYPE_NUMERIC); } } @@ -3561,7 +3554,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; col index $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // offset: 20: size: variable; formula structure $formulaStructure = substr($recordData, 20); @@ -3585,7 +3578,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // get the base cell, grab tExp token $baseRow = self::_GetInt2d($formulaStructure, 3); $baseCol = self::_GetInt2d($formulaStructure, 5); - $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); + $this->_baseCell = Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); } // Read cell? @@ -3607,7 +3600,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce && (ord($recordData{13}) == 255) ) { // String formula. Result follows in appended STRING record - $dataType = PHPExcel_Cell_DataType::TYPE_STRING; + $dataType = Cell_DataType::TYPE_STRING; // read possible SHAREDFMLA record $code = self::_GetInt2d($this->_data, $this->_pos); @@ -3623,7 +3616,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce && (ord($recordData{13}) == 255)) { // Boolean formula. Result is in +2; 0=false, 1=true - $dataType = PHPExcel_Cell_DataType::TYPE_BOOL; + $dataType = Cell_DataType::TYPE_BOOL; $value = (bool) ord($recordData{8}); } elseif ((ord($recordData{6}) == 2) @@ -3631,7 +3624,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce && (ord($recordData{13}) == 255)) { // Error formula. Error code is in +2 - $dataType = PHPExcel_Cell_DataType::TYPE_ERROR; + $dataType = Cell_DataType::TYPE_ERROR; $value = self::_mapErrorCode(ord($recordData{8})); } elseif ((ord($recordData{6}) == 3) @@ -3639,13 +3632,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce && (ord($recordData{13}) == 255)) { // Formula result is a null string - $dataType = PHPExcel_Cell_DataType::TYPE_NULL; + $dataType = Cell_DataType::TYPE_NULL; $value = ''; } else { // forumla result is a number, first 14 bytes like _NUMBER record - $dataType = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dataType = Cell_DataType::TYPE_NUMERIC; $value = self::_extractNumber(substr($recordData, 6, 8)); } @@ -3662,12 +3655,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // add cell value. If we can read formula, populate with formula, otherwise just used cached value try { if ($this->_version != self::XLS_BIFF8) { - throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas'); + throw new Reader_Exception('Not BIFF8. Can only read BIFF8 formulas'); } $formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language - $cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + $cell->setValueExplicit('=' . $formula, Cell_DataType::TYPE_FORMULA); - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { $cell->setValueExplicit($value, $dataType); } } else { @@ -3763,7 +3756,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; column index $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3782,14 +3775,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $value = (bool) $boolErr; // add cell value - $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_BOOL); + $cell->setValueExplicit($value, Cell_DataType::TYPE_BOOL); break; case 1: // error type $value = self::_mapErrorCode($boolErr); // add cell value - $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_ERROR); + $cell->setValueExplicit($value, Cell_DataType::TYPE_ERROR); break; } @@ -3827,7 +3820,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // add style information if (!$this->_readDataOnly) { for ($i = 0; $i < $length / 2 - 3; ++$i) { - $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i); + $columnString = Cell::stringFromColumnIndex($fc + $i); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3864,7 +3857,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; index to column $column = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + $columnString = Cell::stringFromColumnIndex($column); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -3881,7 +3874,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $value = $string['value']; } $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); + $cell->setValueExplicit($value, Cell_DataType::TYPE_STRING); if (!$this->_readDataOnly) { // add cell style @@ -3907,7 +3900,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; col index $col = self::_GetInt2d($recordData, 2); - $columnString = PHPExcel_Cell::stringFromColumnIndex($col); + $columnString = Cell::stringFromColumnIndex($col); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { @@ -4038,10 +4031,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce //FIXME: set $firstVisibleRow and $firstVisibleColumn - if ($this->_phpSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { + if ($this->_phpSheet->getSheetView()->getView() !== Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { //NOTE: this setting is inferior to page layout view(Excel2007-) - $view = $isPageBreakPreview? PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : - PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL; + $view = $isPageBreakPreview? Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : + Worksheet_SheetView::SHEETVIEW_NORMAL; $this->_phpSheet->getSheetView()->setView($view); if ($this->_version === self::XLS_BIFF8) { $zoomScale = $isPageBreakPreview? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView; @@ -4083,7 +4076,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support if ($fPageLayoutView === 1) { - $this->_phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT); + $this->_phpSheet->getSheetView()->setView(Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT); $this->_phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT } //otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW. @@ -4131,7 +4124,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if ($this->_frozen) { // frozen panes - $this->_phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1)); + $this->_phpSheet->freezePane(Cell::stringFromColumnIndex($px) . ($py + 1)); } else { // unfrozen panes; split windows; not supported by PHPExcel core } @@ -4195,7 +4188,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $includeCellRange = true; if ($this->getReadFilter() !== NULL) { $includeCellRange = false; - $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($cellRangeAddress); + $rangeBoundaries = Cell::getRangeBoundaries($cellRangeAddress); $rangeBoundaries[1][0]++; for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; $row++) { for ($column = $rangeBoundaries[0][0]; $column != $rangeBoundaries[1][0]; $column++) { @@ -4254,7 +4247,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 0; size: 8; cell range address of all cells containing this hyperlink try { $cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8); - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { return; } @@ -4408,7 +4401,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // apply the hyperlink to all the relevant cells - foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cellRange) as $coordinate) { + foreach (Cell::extractAllCellReferencesInRange($cellRange) as $coordinate) { $this->_phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url); } } @@ -4449,22 +4442,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 0-3; mask: 0x0000000F; type $type = (0x0000000F & $options) >> 0; switch ($type) { - case 0x00: $type = PHPExcel_Cell_DataValidation::TYPE_NONE; break; - case 0x01: $type = PHPExcel_Cell_DataValidation::TYPE_WHOLE; break; - case 0x02: $type = PHPExcel_Cell_DataValidation::TYPE_DECIMAL; break; - case 0x03: $type = PHPExcel_Cell_DataValidation::TYPE_LIST; break; - case 0x04: $type = PHPExcel_Cell_DataValidation::TYPE_DATE; break; - case 0x05: $type = PHPExcel_Cell_DataValidation::TYPE_TIME; break; - case 0x06: $type = PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH; break; - case 0x07: $type = PHPExcel_Cell_DataValidation::TYPE_CUSTOM; break; + case 0x00: $type = Cell_DataValidation::TYPE_NONE; break; + case 0x01: $type = Cell_DataValidation::TYPE_WHOLE; break; + case 0x02: $type = Cell_DataValidation::TYPE_DECIMAL; break; + case 0x03: $type = Cell_DataValidation::TYPE_LIST; break; + case 0x04: $type = Cell_DataValidation::TYPE_DATE; break; + case 0x05: $type = Cell_DataValidation::TYPE_TIME; break; + case 0x06: $type = Cell_DataValidation::TYPE_TEXTLENGTH; break; + case 0x07: $type = Cell_DataValidation::TYPE_CUSTOM; break; } // bit: 4-6; mask: 0x00000070; error type $errorStyle = (0x00000070 & $options) >> 4; switch ($errorStyle) { - case 0x00: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; break; - case 0x01: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_WARNING; break; - case 0x02: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_INFORMATION; break; + case 0x00: $errorStyle = Cell_DataValidation::STYLE_STOP; break; + case 0x01: $errorStyle = Cell_DataValidation::STYLE_WARNING; break; + case 0x02: $errorStyle = Cell_DataValidation::STYLE_INFORMATION; break; } // bit: 7; mask: 0x00000080; 1= formula is explicit (only applies to list) @@ -4486,14 +4479,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 20-23; mask: 0x00F00000; condition operator $operator = (0x00F00000 & $options) >> 20; switch ($operator) { - case 0x00: $operator = PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN ; break; - case 0x01: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN ; break; - case 0x02: $operator = PHPExcel_Cell_DataValidation::OPERATOR_EQUAL ; break; - case 0x03: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL ; break; - case 0x04: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN ; break; - case 0x05: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN ; break; - case 0x06: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL; break; - case 0x07: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL ; break; + case 0x00: $operator = Cell_DataValidation::OPERATOR_BETWEEN; break; + case 0x01: $operator = Cell_DataValidation::OPERATOR_NOTBETWEEN; break; + case 0x02: $operator = Cell_DataValidation::OPERATOR_EQUAL; break; + case 0x03: $operator = Cell_DataValidation::OPERATOR_NOTEQUAL; break; + case 0x04: $operator = Cell_DataValidation::OPERATOR_GREATERTHAN; break; + case 0x05: $operator = Cell_DataValidation::OPERATOR_LESSTHAN; break; + case 0x06: $operator = Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL; break; + case 0x07: $operator = Cell_DataValidation::OPERATOR_LESSTHANOREQUAL; break; } // offset: 4; size: var; title of the prompt box @@ -4535,10 +4528,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $formula1 = $this->_getFormulaFromStructure($formula1); // in list type validity, null characters are used as item separators - if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) { + if ($type == Cell_DataValidation::TYPE_LIST) { $formula1 = str_replace(chr(0), ',', $formula1); } - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { return; } $offset += $sz1; @@ -4555,7 +4548,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $formula2 = pack('v', $sz2) . $formula2; // prepend the length try { $formula2 = $this->_getFormulaFromStructure($formula2); - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { return; } $offset += $sz2; @@ -4566,7 +4559,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce foreach ($cellRangeAddresses as $cellRange) { $stRange = $this->_phpSheet->shrinkRangeToFit($cellRange); - $stRange = PHPExcel_Cell::extractAllCellReferencesInRange($stRange); + $stRange = Cell::extractAllCellReferencesInRange($stRange); foreach ($stRange as $coordinate) { $objValidation = $this->_phpSheet->getCell($coordinate)->getDataValidation(); $objValidation->setType($type); @@ -4767,7 +4760,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce for ($i = 0; $i < $cref; ++$i) { try { $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { return; } $cellRanges[] = $cellRange; @@ -4854,7 +4847,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } //imagepng($ih, 'image.png'); - $drawing = new PHPExcel_Worksheet_Drawing(); + $drawing = new Worksheet_Drawing(); $drawing->setPath($filename); $drawing->setWorksheet($this->_phpSheet); @@ -5199,7 +5192,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string Formula data * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return array - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ private function _getNextToken($formulaData, $baseCell = 'A1') { @@ -5300,7 +5293,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $spacetype = 'type5'; break; default: - throw new PHPExcel_Reader_Exception('Unrecognized space type in tAttrSpace token'); + throw new Reader_Exception('Unrecognized space type in tAttrSpace token'); break; } // offset: 3; size: 1; number of inserted spaces/carriage returns @@ -5309,7 +5302,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount); break; default: - throw new PHPExcel_Reader_Exception('Unrecognized attribute flag in tAttr token'); + throw new Reader_Exception('Unrecognized attribute flag in tAttr token'); break; } break; @@ -5514,7 +5507,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 360: $function = 'PHONETIC'; $args = 1; break; case 368: $function = 'BAHTTEXT'; $args = 1; break; default: - throw new PHPExcel_Reader_Exception('Unrecognized function in formula'); + throw new Reader_Exception('Unrecognized function in formula'); break; } $data = array('function' => $function, 'args' => $args); @@ -5618,7 +5611,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 366: $function = 'STDEVA'; break; case 367: $function = 'VARA'; break; default: - throw new PHPExcel_Reader_Exception('Unrecognized function in formula'); + throw new Reader_Exception('Unrecognized function in formula'); break; } $data = array('function' => $function, 'args' => $args); @@ -5719,7 +5712,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); $data = "$sheetRange!$cellAddress"; - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { // deleted sheet reference $data = '#REF!'; } @@ -5738,7 +5731,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); $data = "$sheetRange!$cellRangeAddress"; - } catch (PHPExcel_Exception $e) { + } catch (Reader_Exception $e) { // deleted sheet reference $data = '#REF!'; } @@ -5746,7 +5739,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; // Unknown cases // don't know how to deal with default: - throw new PHPExcel_Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); + throw new Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); break; } @@ -5774,7 +5767,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 2; size: 2; index to column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($cellAddressStructure, 2)); + $column = Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($cellAddressStructure, 2)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { @@ -5800,8 +5793,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce */ private function _readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') { - list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell); - $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1; + list($baseCol, $baseRow) = Cell::coordinateFromString($baseCell); + $baseCol = Cell::columnIndexFromString($baseCol) - 1; // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) $rowIndex = self::_GetInt2d($cellAddressStructure, 0); @@ -5814,11 +5807,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { - $column = PHPExcel_Cell::stringFromColumnIndex($colIndex); + $column = Cell::stringFromColumnIndex($colIndex); $column = '$' . $column; } else { $colIndex = ($colIndex <= 127) ? $colIndex : $colIndex - 256; - $column = PHPExcel_Cell::stringFromColumnIndex($baseCol + $colIndex); + $column = Cell::stringFromColumnIndex($baseCol + $colIndex); } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) @@ -5840,7 +5833,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @param string $subData * @return string - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ private function _readBIFF5CellRangeAddressFixed($subData) { @@ -5858,12 +5851,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // check values if ($fr > $lr || $fc > $lc) { - throw new PHPExcel_Reader_Exception('Not a cell range address'); + throw new Reader_Exception('Not a cell range address'); } // column index to letter - $fc = PHPExcel_Cell::stringFromColumnIndex($fc); - $lc = PHPExcel_Cell::stringFromColumnIndex($lc); + $fc = Cell::stringFromColumnIndex($fc); + $lc = Cell::stringFromColumnIndex($lc); if ($fr == $lr and $fc == $lc) { return "$fc$fr"; @@ -5879,7 +5872,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @param string $subData * @return string - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ private function _readBIFF8CellRangeAddressFixed($subData) { @@ -5897,12 +5890,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // check values if ($fr > $lr || $fc > $lc) { - throw new PHPExcel_Reader_Exception('Not a cell range address'); + throw new Reader_Exception('Not a cell range address'); } // column index to letter - $fc = PHPExcel_Cell::stringFromColumnIndex($fc); - $lc = PHPExcel_Cell::stringFromColumnIndex($lc); + $fc = Cell::stringFromColumnIndex($fc); + $lc = Cell::stringFromColumnIndex($lc); if ($fr == $lr and $fc == $lc) { return "$fc$fr"; @@ -5933,7 +5926,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: 2; index to first column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 4)); + $fc = Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 4)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($subData, 4))) { @@ -5948,7 +5941,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 6; size: 2; index to last column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 6)); + $lc = Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 6)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($subData, 6))) { @@ -5975,8 +5968,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce */ private function _readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') { - list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell); - $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1; + list($baseCol, $baseRow) = Cell::coordinateFromString($baseCell); + $baseCol = Cell::columnIndexFromString($baseCol) - 1; // TODO: if cell range is just a single cell, should this funciton // not just return e.g. 'A1' and not 'A1:A1' ? @@ -5995,12 +5988,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($subData, 4))) { // absolute column index - $fc = PHPExcel_Cell::stringFromColumnIndex($fcIndex); + $fc = Cell::stringFromColumnIndex($fcIndex); $fc = '$' . $fc; } else { // column offset $fcIndex = ($fcIndex <= 127) ? $fcIndex : $fcIndex - 256; - $fc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $fcIndex); + $fc = Cell::stringFromColumnIndex($baseCol + $fcIndex); } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) @@ -6019,17 +6012,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 7-0; mask 0x00FF; column index $lcIndex = 0x00FF & self::_GetInt2d($subData, 6); $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256; - $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex); + $lc = Cell::stringFromColumnIndex($baseCol + $lcIndex); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) if (!(0x4000 & self::_GetInt2d($subData, 6))) { // absolute column index - $lc = PHPExcel_Cell::stringFromColumnIndex($lcIndex); + $lc = Cell::stringFromColumnIndex($lcIndex); $lc = '$' . $lc; } else { // column offset $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256; - $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex); + $lc = Cell::stringFromColumnIndex($baseCol + $lcIndex); } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) @@ -6107,11 +6100,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * Get a sheet range like Sheet1:Sheet3 from REF index * Note: If there is only one sheet in the range, one gets e.g Sheet1 * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets, - * in which case an PHPExcel_Reader_Exception is thrown + * in which case an PHPExcel\Reader_Exception is thrown * * @param int $index * @return string|false - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ private function _readSheetRangeByRefIndex($index) { @@ -6123,7 +6116,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 'internal': // check if we have a deleted 3d reference if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) { - throw new PHPExcel_Reader_Exception('Deleted sheet reference'); + throw new Reader_Exception('Deleted sheet reference'); } // we have normal sheet range (collapsed or uncollapsed) @@ -6153,7 +6146,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce default: // TODO: external sheet support - throw new PHPExcel_Reader_Exception('Excel5 reader only supports internal sheets in fomulas'); + throw new Reader_Exception('Excel5 reader only supports internal sheets in fomulas'); break; } } @@ -6487,7 +6480,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $string = self::_uncompressByteString($string); } - return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); + return Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); } @@ -6517,7 +6510,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce */ private function _decodeCodepage($string) { - return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage); + return Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage); } @@ -6596,21 +6589,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce private static function _mapBorderStyle($index) { switch ($index) { - case 0x00: return PHPExcel_Style_Border::BORDER_NONE; - case 0x01: return PHPExcel_Style_Border::BORDER_THIN; - case 0x02: return PHPExcel_Style_Border::BORDER_MEDIUM; - case 0x03: return PHPExcel_Style_Border::BORDER_DASHED; - case 0x04: return PHPExcel_Style_Border::BORDER_DOTTED; - case 0x05: return PHPExcel_Style_Border::BORDER_THICK; - case 0x06: return PHPExcel_Style_Border::BORDER_DOUBLE; - case 0x07: return PHPExcel_Style_Border::BORDER_HAIR; - case 0x08: return PHPExcel_Style_Border::BORDER_MEDIUMDASHED; - case 0x09: return PHPExcel_Style_Border::BORDER_DASHDOT; - case 0x0A: return PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT; - case 0x0B: return PHPExcel_Style_Border::BORDER_DASHDOTDOT; - case 0x0C: return PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; - case 0x0D: return PHPExcel_Style_Border::BORDER_SLANTDASHDOT; - default: return PHPExcel_Style_Border::BORDER_NONE; + case 0x00: return Style_Border::BORDER_NONE; + case 0x01: return Style_Border::BORDER_THIN; + case 0x02: return Style_Border::BORDER_MEDIUM; + case 0x03: return Style_Border::BORDER_DASHED; + case 0x04: return Style_Border::BORDER_DOTTED; + case 0x05: return Style_Border::BORDER_THICK; + case 0x06: return Style_Border::BORDER_DOUBLE; + case 0x07: return Style_Border::BORDER_HAIR; + case 0x08: return Style_Border::BORDER_MEDIUMDASHED; + case 0x09: return Style_Border::BORDER_DASHDOT; + case 0x0A: return Style_Border::BORDER_MEDIUMDASHDOT; + case 0x0B: return Style_Border::BORDER_DASHDOTDOT; + case 0x0C: return Style_Border::BORDER_MEDIUMDASHDOTDOT; + case 0x0D: return Style_Border::BORDER_SLANTDASHDOT; + default: return Style_Border::BORDER_NONE; } } @@ -6625,26 +6618,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce private static function _mapFillPattern($index) { switch ($index) { - case 0x00: return PHPExcel_Style_Fill::FILL_NONE; - case 0x01: return PHPExcel_Style_Fill::FILL_SOLID; - case 0x02: return PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY; - case 0x03: return PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY; - case 0x04: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY; - case 0x05: return PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL; - case 0x06: return PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL; - case 0x07: return PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN; - case 0x08: return PHPExcel_Style_Fill::FILL_PATTERN_DARKUP; - case 0x09: return PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID; - case 0x0A: return PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS; - case 0x0B: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; - case 0x0C: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL; - case 0x0D: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN; - case 0x0E: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP; - case 0x0F: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID; - case 0x10: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS; - case 0x11: return PHPExcel_Style_Fill::FILL_PATTERN_GRAY125; - case 0x12: return PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625; - default: return PHPExcel_Style_Fill::FILL_NONE; + case 0x00: return Style_Fill::FILL_NONE; + case 0x01: return Style_Fill::FILL_SOLID; + case 0x02: return Style_Fill::FILL_PATTERN_MEDIUMGRAY; + case 0x03: return Style_Fill::FILL_PATTERN_DARKGRAY; + case 0x04: return Style_Fill::FILL_PATTERN_LIGHTGRAY; + case 0x05: return Style_Fill::FILL_PATTERN_DARKHORIZONTAL; + case 0x06: return Style_Fill::FILL_PATTERN_DARKVERTICAL; + case 0x07: return Style_Fill::FILL_PATTERN_DARKDOWN; + case 0x08: return Style_Fill::FILL_PATTERN_DARKUP; + case 0x09: return Style_Fill::FILL_PATTERN_DARKGRID; + case 0x0A: return Style_Fill::FILL_PATTERN_DARKTRELLIS; + case 0x0B: return Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; + case 0x0C: return Style_Fill::FILL_PATTERN_LIGHTVERTICAL; + case 0x0D: return Style_Fill::FILL_PATTERN_LIGHTDOWN; + case 0x0E: return Style_Fill::FILL_PATTERN_LIGHTUP; + case 0x0F: return Style_Fill::FILL_PATTERN_LIGHTGRID; + case 0x10: return Style_Fill::FILL_PATTERN_LIGHTTRELLIS; + case 0x11: return Style_Fill::FILL_PATTERN_GRAY125; + case 0x12: return Style_Fill::FILL_PATTERN_GRAY0625; + default: return Style_Fill::FILL_NONE; } } @@ -6835,7 +6828,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce private function _parseRichText($is = '') { - $value = new PHPExcel_RichText(); + $value = new RichText(); $value->createText($is); diff --git a/Classes/PHPExcel/Reader/Excel5/Escher.php b/Classes/PHPExcel/Reader/Excel5/Escher.php index 0970d1b..d0b900f 100644 --- a/Classes/PHPExcel/Reader/Excel5/Escher.php +++ b/Classes/PHPExcel/Reader/Excel5/Escher.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader_Excel5 + * @package PHPExcel\Reader_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Reader_Excel5_Escher + * PHPExcel\Reader_Excel5_Escher * * @category PHPExcel - * @package PHPExcel_Reader_Excel5 + * @package PHPExcel\Reader_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel5_Escher +class Reader_Excel5_Escher { const DGGCONTAINER = 0xF000; const BSTORECONTAINER = 0xF001; @@ -82,7 +85,7 @@ class PHPExcel_Reader_Excel5_Escher private $_object; /** - * Create a new PHPExcel_Reader_Excel5_Escher instance + * Create a new PHPExcel\Reader_Excel5_Escher instance * * @param mixed $object */ @@ -109,7 +112,7 @@ class PHPExcel_Reader_Excel5_Escher while ($this->_pos < $this->_dataSize) { // offset: 2; size: 2: Record Type - $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); + $fbt = Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); switch ($fbt) { case self::DGGCONTAINER: $this->_readDggContainer(); break; @@ -143,15 +146,15 @@ class PHPExcel_Reader_Excel5_Escher private function _readDefault() { // offset 0; size: 2; recVer and recInstance - $verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos); + $verInstance = Reader_Excel5::_GetInt2d($this->_data, $this->_pos); // offset: 2; size: 2: Record Type - $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); + $fbt = Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); // bit: 0-3; mask: 0x000F; recVer $recVer = (0x000F & $verInstance) >> 0; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -163,16 +166,16 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readDggContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // record is a container, read contents - $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); + $dggContainer = new Shared_Escher_DggContainer(); $this->_object->setDggContainer($dggContainer); - $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); + $reader = new Reader_Excel5_Escher($dggContainer); $reader->load($recordData); } @@ -181,7 +184,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readDgg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -193,16 +196,16 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readBstoreContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // record is a container, read contents - $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); + $bstoreContainer = new Shared_Escher_DggContainer_BstoreContainer(); $this->_object->setBstoreContainer($bstoreContainer); - $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); + $reader = new Reader_Excel5_Escher($bstoreContainer); $reader->load($recordData); } @@ -214,16 +217,16 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // add BSE to BstoreContainer - $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $BSE = new Shared_Escher_DggContainer_BstoreContainer_BSE(); $this->_object->addBSE($BSE); $BSE->setBLIPType($recInstance); @@ -238,16 +241,16 @@ class PHPExcel_Reader_Excel5_Escher $rgbUid = substr($recordData, 2, 16); // offset: 18; size: 2; tag - $tag = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 18); + $tag = Reader_Excel5::_GetInt2d($recordData, 18); // offset: 20; size: 4; size of BLIP in bytes - $size = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 20); + $size = Reader_Excel5::_GetInt4d($recordData, 20); // offset: 24; size: 4; number of references to this BLIP - $cRef = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 24); + $cRef = Reader_Excel5::_GetInt4d($recordData, 24); // offset: 28; size: 4; MSOFO file offset - $foDelay = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 28); + $foDelay = Reader_Excel5::_GetInt4d($recordData, 28); // offset: 32; size: 1; unused1 $unused1 = ord($recordData{32}); @@ -268,7 +271,7 @@ class PHPExcel_Reader_Excel5_Escher $blipData = substr($recordData, 36 + $cbName); // record is a container, read contents - $reader = new PHPExcel_Reader_Excel5_Escher($BSE); + $reader = new Reader_Excel5_Escher($BSE); $reader->load($blipData); } @@ -280,9 +283,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -307,7 +310,7 @@ class PHPExcel_Reader_Excel5_Escher // offset: var; size: var; the raw image data $data = substr($recordData, $pos); - $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip = new Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($data); $this->_object->setBlip($blip); @@ -321,9 +324,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -348,7 +351,7 @@ class PHPExcel_Reader_Excel5_Escher // offset: var; size: var; the raw image data $data = substr($recordData, $pos); - $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip = new Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($data); $this->_object->setBlip($blip); @@ -362,9 +365,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -381,9 +384,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -395,7 +398,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readSplitMenuColors() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -407,16 +410,16 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readDgContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // record is a container, read contents - $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); + $dgContainer = new Shared_Escher_DgContainer(); $this->_object->setDgContainer($dgContainer); - $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); + $reader = new Reader_Excel5_Escher($dgContainer); $escher = $reader->load($recordData); } @@ -425,7 +428,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readDg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -439,16 +442,16 @@ class PHPExcel_Reader_Excel5_Escher { // context is either context DgContainer or SpgrContainer - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // record is a container, read contents - $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); + $spgrContainer = new Shared_Escher_DgContainer_SpgrContainer(); - if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) { + if ($this->_object instanceof Shared_Escher_DgContainer) { // DgContainer $this->_object->setSpgrContainer($spgrContainer); } else { @@ -456,7 +459,7 @@ class PHPExcel_Reader_Excel5_Escher $this->_object->addChild($spgrContainer); } - $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); + $reader = new Reader_Excel5_Escher($spgrContainer); $escher = $reader->load($recordData); } @@ -465,18 +468,18 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readSpContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // add spContainer to spgrContainer - $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $spContainer = new Shared_Escher_DgContainer_SpgrContainer_SpContainer(); $this->_object->addChild($spContainer); // move stream pointer to next record $this->_pos += 8 + $length; // record is a container, read contents - $reader = new PHPExcel_Reader_Excel5_Escher($spContainer); + $reader = new Reader_Excel5_Escher($spContainer); $escher = $reader->load($recordData); } @@ -485,7 +488,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readSpgr() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -500,9 +503,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -517,9 +520,9 @@ class PHPExcel_Reader_Excel5_Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; + $recInstance = (0xFFF0 & Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -531,38 +534,38 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readClientAnchor() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record $this->_pos += 8 + $length; // offset: 2; size: 2; upper-left corner column index (0-based) - $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); + $c1 = Reader_Excel5::_GetInt2d($recordData, 2); // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width - $startOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 4); + $startOffsetX = Reader_Excel5::_GetInt2d($recordData, 4); // offset: 6; size: 2; upper-left corner row index (0-based) - $r1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 6); + $r1 = Reader_Excel5::_GetInt2d($recordData, 6); // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height - $startOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 8); + $startOffsetY = Reader_Excel5::_GetInt2d($recordData, 8); // offset: 10; size: 2; bottom-right corner column index (0-based) - $c2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 10); + $c2 = Reader_Excel5::_GetInt2d($recordData, 10); // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width - $endOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 12); + $endOffsetX = Reader_Excel5::_GetInt2d($recordData, 12); // offset: 14; size: 2; bottom-right corner row index (0-based) - $r2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 14); + $r2 = Reader_Excel5::_GetInt2d($recordData, 14); // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height - $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); + $endOffsetY = Reader_Excel5::_GetInt2d($recordData, 16); // set the start coordinates - $this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); + $this->_object->setStartCoordinates(Cell::stringFromColumnIndex($c1) . ($r1 + 1)); // set the start offsetX $this->_object->setStartOffsetX($startOffsetX); @@ -571,7 +574,7 @@ class PHPExcel_Reader_Excel5_Escher $this->_object->setStartOffsetY($startOffsetY); // set the end coordinates - $this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); + $this->_object->setEndCoordinates(Cell::stringFromColumnIndex($c2) . ($r2 + 1)); // set the end offsetX $this->_object->setEndOffsetX($endOffsetX); @@ -585,7 +588,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function _readClientData() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); + $length = Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $recordData = substr($this->_data, $this->_pos + 8, $length); // move stream pointer to next record @@ -608,7 +611,7 @@ class PHPExcel_Reader_Excel5_Escher $fopte = substr($data, 6 * $i, 6); // offset: 0; size: 2; opid - $opid = PHPExcel_Reader_Excel5::_GetInt2d($fopte, 0); + $opid = Reader_Excel5::_GetInt2d($fopte, 0); // bit: 0-13; mask: 0x3FFF; opid.opid $opidOpid = (0x3FFF & $opid) >> 0; @@ -620,7 +623,7 @@ class PHPExcel_Reader_Excel5_Escher $opidFComplex = (0x8000 & $opid) >> 15; // offset: 2; size: 4; the value for this property - $op = PHPExcel_Reader_Excel5::_GetInt4d($fopte, 2); + $op = Reader_Excel5::_GetInt4d($fopte, 2); if ($opidFComplex) { $complexData = substr($splicedComplexData, 0, $op); diff --git a/Classes/PHPExcel/Reader/Exception.php b/Classes/PHPExcel/Reader/Exception.php index 4980711..19adbc0 100644 --- a/Classes/PHPExcel/Reader/Exception.php +++ b/Classes/PHPExcel/Reader/Exception.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Reader_Exception + * PHPExcel\Reader_Exception * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Exception extends PHPExcel_Exception { +class Reader_Exception extends Exception { /** * Error handler callback * diff --git a/Classes/PHPExcel/Reader/Gnumeric.php b/Classes/PHPExcel/Reader/Gnumeric.php index 50e7a8a..02d36f0 100644 --- a/Classes/PHPExcel/Reader/Gnumeric.php +++ b/Classes/PHPExcel/Reader/Gnumeric.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_Gnumeric + * PHPExcel\Reader_Gnumeric * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_Gnumeric extends Reader_Abstract implements Reader_IReader { /** * Formats @@ -62,31 +55,31 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx /** - * Create a new PHPExcel_Reader_Gnumeric + * Create a new PHPExcel\Reader_Gnumeric */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); - $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $this->_readFilter = new Reader_DefaultReadFilter(); + $this->_referenceHelper = ReferenceHelper::getInstance(); } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Check if gzlib functions are available if (!function_exists('gzread')) { - throw new PHPExcel_Reader_Exception("gzlib library is not enabled"); + throw new Reader_Exception("gzlib library is not enabled"); } // Read signature data (first 3 bytes) @@ -106,13 +99,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $xml = new XMLReader(); @@ -140,13 +133,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $xml = new XMLReader(); @@ -180,7 +173,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx break; } } - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); $worksheetInfo[] = $tmpInfo; } } @@ -207,12 +200,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new PHPExcel Workbook + $objPHPExcel = new Workbook(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -220,18 +213,18 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx /** - * Loads PHPExcel from file into PHPExcel instance + * Loads Workbook from file into PHPExcel Workbook instance * * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $timezoneObj = new DateTimeZone('Europe/London'); @@ -414,7 +407,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx if ($row > $maxRow) $maxRow = $row; if ($column > $maxCol) $maxCol = $column; - $column = PHPExcel_Cell::stringFromColumnIndex($column); + $column = Cell::stringFromColumnIndex($column); // Read cell? if ($this->getReadFilter() !== NULL) { @@ -428,7 +421,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx // echo 'Cell ',$column,$row,'
'; // echo 'Type is ',$ValueType,'
'; // echo 'Value is ',$cell,'
'; - $type = PHPExcel_Cell_DataType::TYPE_FORMULA; + $type = Cell_DataType::TYPE_FORMULA; if ($ExprID > '') { if (((string) $cell) > '') { @@ -449,26 +442,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx // echo 'SHARED EXPRESSION ',$ExprID,'
'; // echo 'New Value is ',$cell,'
'; } - $type = PHPExcel_Cell_DataType::TYPE_FORMULA; + $type = Cell_DataType::TYPE_FORMULA; } else { switch($ValueType) { case '10' : // NULL - $type = PHPExcel_Cell_DataType::TYPE_NULL; + $type = Cell_DataType::TYPE_NULL; break; case '20' : // Boolean - $type = PHPExcel_Cell_DataType::TYPE_BOOL; + $type = Cell_DataType::TYPE_BOOL; $cell = ($cell == 'TRUE') ? True : False; break; case '30' : // Integer $cell = intval($cell); case '40' : // Float - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; break; case '50' : // Error - $type = PHPExcel_Cell_DataType::TYPE_ERROR; + $type = Cell_DataType::TYPE_ERROR; break; case '60' : // String - $type = PHPExcel_Cell_DataType::TYPE_STRING; + $type = Cell_DataType::TYPE_STRING; break; case '70' : // Cell Range case '80' : // Array @@ -495,11 +488,11 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx if (($styleAttributes['startRow'] <= $maxRow) && ($styleAttributes['startCol'] <= $maxCol)) { - $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']); + $startColumn = Cell::stringFromColumnIndex((int) $styleAttributes['startCol']); $startRow = $styleAttributes['startRow'] + 1; $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol']; - $endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn); + $endColumn = Cell::stringFromColumnIndex($endColumn); $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow']; $endRow += 1; $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow; @@ -511,45 +504,45 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx // We still set the number format mask for date/time values, even if _readDataOnly is true if ((!$this->_readDataOnly) || - (PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) { + (Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) { $styleArray = array(); $styleArray['numberformat']['code'] = (string) $styleAttributes['Format']; // If _readDataOnly is false, we set all formatting information if (!$this->_readDataOnly) { switch($styleAttributes['HAlign']) { case '1' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_GENERAL; break; case '2' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_LEFT; break; case '4' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_RIGHT; break; case '8' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_CENTER; break; case '16' : case '64' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS; break; case '32' : - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY; + $styleArray['alignment']['horizontal'] = Style_Alignment::HORIZONTAL_JUSTIFY; break; } switch($styleAttributes['VAlign']) { case '1' : - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP; + $styleArray['alignment']['vertical'] = Style_Alignment::VERTICAL_TOP; break; case '2' : - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + $styleArray['alignment']['vertical'] = Style_Alignment::VERTICAL_BOTTOM; break; case '4' : - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER; + $styleArray['alignment']['vertical'] = Style_Alignment::VERTICAL_CENTER; break; case '8' : - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY; + $styleArray['alignment']['vertical'] = Style_Alignment::VERTICAL_JUSTIFY; break; } @@ -567,64 +560,64 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $styleArray['fill']['endcolor']['rgb'] = $RGB2; switch($shade) { case '1' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID; + $styleArray['fill']['type'] = Style_Fill::FILL_SOLID; break; case '2' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR; + $styleArray['fill']['type'] = Style_Fill::FILL_GRADIENT_LINEAR; break; case '3' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH; + $styleArray['fill']['type'] = Style_Fill::FILL_GRADIENT_PATH; break; case '4' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKDOWN; break; case '5' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKGRAY; break; case '6' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKGRID; break; case '7' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKHORIZONTAL; break; case '8' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKTRELLIS; break; case '9' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKUP; break; case '10' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_DARKVERTICAL; break; case '11' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_GRAY0625; break; case '12' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_GRAY125; break; case '13' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTDOWN; break; case '14' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTGRAY; break; case '15' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTGRID; break; case '16' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; break; case '17' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTTRELLIS; break; case '18' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTUP; break; case '19' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_LIGHTVERTICAL; break; case '20' : - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY; + $styleArray['fill']['type'] = Style_Fill::FILL_PATTERN_MEDIUMGRAY; break; } } @@ -639,19 +632,19 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False; switch($fontAttributes['Underline']) { case '1' : - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE; + $styleArray['font']['underline'] = Style_Font::UNDERLINE_SINGLE; break; case '2' : - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE; + $styleArray['font']['underline'] = Style_Font::UNDERLINE_DOUBLE; break; case '3' : - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING; + $styleArray['font']['underline'] = Style_Font::UNDERLINE_SINGLEACCOUNTING; break; case '4' : - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING; + $styleArray['font']['underline'] = Style_Font::UNDERLINE_DOUBLEACCOUNTING; break; default : - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE; + $styleArray['font']['underline'] = Style_Font::UNDERLINE_NONE; break; } switch($fontAttributes['Script']) { @@ -678,13 +671,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx } if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) { $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH; + $styleArray['borders']['diagonaldirection'] = Style_Borders::DIAGONAL_BOTH; } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) { $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP; + $styleArray['borders']['diagonaldirection'] = Style_Borders::DIAGONAL_UP; } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) { $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes()); - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN; + $styleArray['borders']['diagonaldirection'] = Style_Borders::DIAGONAL_DOWN; } } if (isset($styleRegion->Style->HyperLink)) { @@ -711,19 +704,19 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false; $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1; while ($c < $column) { - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); + $objPHPExcel->getActiveSheet()->getColumnDimension(Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); ++$c; } while (($c < ($column+$columnCount)) && ($c <= $maxCol)) { - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth); + $objPHPExcel->getActiveSheet()->getColumnDimension(Cell::stringFromColumnIndex($c))->setWidth($columnWidth); if ($hidden) { - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false); + $objPHPExcel->getActiveSheet()->getColumnDimension(Cell::stringFromColumnIndex($c))->setVisible(false); } ++$c; } } while ($c <= $maxCol) { - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); + $objPHPExcel->getActiveSheet()->getColumnDimension(Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); ++$c; } } @@ -783,7 +776,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $range[0] = trim($range[0],"'");; if ($worksheet = $objPHPExcel->getSheetByName($range[0])) { $extractedRange = str_replace('$', '', $range[1]); - $objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) ); + $objPHPExcel->addNamedRange( new NamedRange($name, $worksheet, $extractedRange) ); } } } @@ -805,46 +798,46 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx switch ($borderAttributes["Style"]) { case '0' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE; + $styleArray['style'] = Style_Border::BORDER_NONE; break; case '1' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN; + $styleArray['style'] = Style_Border::BORDER_THIN; break; case '2' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; + $styleArray['style'] = Style_Border::BORDER_MEDIUM; break; case '4' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED; + $styleArray['style'] = Style_Border::BORDER_DASHED; break; case '5' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK; + $styleArray['style'] = Style_Border::BORDER_THICK; break; case '6' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE; + $styleArray['style'] = Style_Border::BORDER_DOUBLE; break; case '7' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED; + $styleArray['style'] = Style_Border::BORDER_DOTTED; break; case '9' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT; + $styleArray['style'] = Style_Border::BORDER_DASHDOT; break; case '10' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT; + $styleArray['style'] = Style_Border::BORDER_MEDIUMDASHDOT; break; case '11' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT; + $styleArray['style'] = Style_Border::BORDER_DASHDOTDOT; break; case '12' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; + $styleArray['style'] = Style_Border::BORDER_MEDIUMDASHDOTDOT; break; case '13' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; + $styleArray['style'] = Style_Border::BORDER_MEDIUMDASHDOTDOT; break; case '3' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT; + $styleArray['style'] = Style_Border::BORDER_SLANTDASHDOT; break; case '8' : - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED; + $styleArray['style'] = Style_Border::BORDER_MEDIUMDASHED; break; } return $styleArray; @@ -852,7 +845,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx private function _parseRichText($is = '') { - $value = new PHPExcel_RichText(); + $value = new RichText(); $value->createText($is); diff --git a/Classes/PHPExcel/Reader/HTML.php b/Classes/PHPExcel/Reader/HTML.php index 4780a95..7d69257 100644 --- a/Classes/PHPExcel/Reader/HTML.php +++ b/Classes/PHPExcel/Reader/HTML.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_HTML + * PHPExcel\Reader_HTML * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_HTML extends Reader_Abstract implements Reader_IReader { /** * Input encoding @@ -88,12 +81,12 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ ), ), // Bold, 7.5pt 'a' => array( 'font' => array( 'underline' => true, - 'color' => array( 'argb' => PHPExcel_Style_Color::COLOR_BLUE, + 'color' => array( 'argb' => Style_Color::COLOR_BLUE, ), ), ), // Blue underlined - 'hr' => array( 'borders' => array( 'bottom' => array( 'style' => PHPExcel_Style_Border::BORDER_THIN, - 'color' => array( PHPExcel_Style_Color::COLOR_BLACK, + 'hr' => array( 'borders' => array( 'bottom' => array( 'style' => Style_Border::BORDER_THIN, + 'color' => array( Style_Color::COLOR_BLACK, ), ), ), @@ -102,10 +95,10 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ /** - * Create a new PHPExcel_Reader_HTML + * Create a new PHPExcel\Reader_HTML */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** @@ -130,12 +123,12 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new PHPExcel Workbook + $objPHPExcel = new Workbook(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -402,7 +395,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { @@ -410,7 +403,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ $this->_openFile($pFilename); if (!$this->_isValidFormat()) { fclose ($this->_fileHandle); - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file."); + throw new Reader_Exception($pFilename . " is an Invalid HTML file."); } // Close after validating fclose ($this->_fileHandle); @@ -426,7 +419,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ // Reload the HTML file into the DOM object $loaded = $dom->loadHTMLFile($pFilename); if ($loaded === FALSE) { - throw new PHPExcel_Reader_Exception('Failed to load ',$pFilename,' as a DOM Document'); + throw new Reader_Exception('Failed to load ',$pFilename,' as a DOM Document'); } // Discard white space @@ -458,7 +451,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ * Set sheet index * * @param int $pValue Sheet index - * @return PHPExcel_Reader_HTML + * @return PHPExcel\Reader_HTML */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; diff --git a/Classes/PHPExcel/Reader/IReadFilter.php b/Classes/PHPExcel/Reader/IReadFilter.php index 584b928..146d951 100644 --- a/Classes/PHPExcel/Reader/IReadFilter.php +++ b/Classes/PHPExcel/Reader/IReadFilter.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Reader_IReadFilter + * PHPExcel\Reader_IReadFilter * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_Reader_IReadFilter +interface Reader_IReadFilter { /** * Should this cell be read? diff --git a/Classes/PHPExcel/Reader/IReader.php b/Classes/PHPExcel/Reader/IReader.php index 97cc503..f65f96c 100644 --- a/Classes/PHPExcel/Reader/IReader.php +++ b/Classes/PHPExcel/Reader/IReader.php @@ -19,24 +19,26 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Reader_IReader + * PHPExcel\Reader_IReader * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_Reader_IReader +interface Reader_IReader { /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean @@ -47,7 +49,7 @@ interface PHPExcel_Reader_IReader * Loads PHPExcel from file * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename); } diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index aa29609..4f11a7f 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_OOCalc + * PHPExcel\Reader_OOCalc * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_OOCalc extends Reader_Abstract implements Reader_IReader { /** * Formats @@ -53,30 +46,30 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce /** - * Create a new PHPExcel_Reader_OOCalc + * Create a new PHPExcel\Reader_OOCalc */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel\Reader_IReader read the file? * * @param string $pFilename * @return boolean - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Check if zip class exists if (!class_exists('ZipArchive',FALSE)) { - throw new PHPExcel_Reader_Exception("ZipArchive library is not enabled"); + throw new Reader_Exception("ZipArchive library is not enabled"); } $mimeType = 'UNKNOWN'; @@ -115,18 +108,18 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $zip = new ZipArchive; if (!$zip->open($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } $worksheetNames = array(); @@ -165,20 +158,20 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); $zip = new ZipArchive; if (!$zip->open($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } $xml = new XMLReader(); @@ -239,7 +232,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells); $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); $worksheetInfo[] = $tmpInfo; } } @@ -273,7 +266,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // } // } // -// $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); +// $tmpInfo['lastColumnLetter'] = Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); // $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; // // } @@ -289,7 +282,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { @@ -319,13 +312,13 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Check if file exists if (!file_exists($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $timezoneObj = new DateTimeZone('Europe/London'); @@ -333,7 +326,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce $zip = new ZipArchive; if (!$zip->open($pFilename)) { - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); + throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } // echo '

Meta Information

'; @@ -390,26 +383,26 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce $docProps->setCreated($creationDate); break; case 'user-defined' : - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; + $propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING; foreach ($propertyValueAttributes as $key => $value) { if ($key == 'name') { $propertyValueName = (string) $value; } elseif($key == 'value-type') { switch ($value) { case 'date' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; + $propertyValue = DocumentProperties::convertProperty($propertyValue,'date'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_DATE; break; case 'boolean' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; + $propertyValue = DocumentProperties::convertProperty($propertyValue,'bool'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_BOOLEAN; break; case 'float' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; + $propertyValue = DocumentProperties::convertProperty($propertyValue,'r4'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_FLOAT; break; default : - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; + $propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING; } } } @@ -540,7 +533,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'
'; switch ($cellDataOfficeAttributes['value-type']) { case 'string' : - $type = PHPExcel_Cell_DataType::TYPE_STRING; + $type = Cell_DataType::TYPE_STRING; $dataValue = $allCellDataText; if (isset($dataValue->a)) { $dataValue = $dataValue->a; @@ -549,27 +542,27 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce } break; case 'boolean' : - $type = PHPExcel_Cell_DataType::TYPE_BOOL; + $type = Cell_DataType::TYPE_BOOL; $dataValue = ($allCellDataText == 'TRUE') ? True : False; break; case 'percentage' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; $dataValue = (float) $cellDataOfficeAttributes['value']; if (floor($dataValue) == $dataValue) { $dataValue = (integer) $dataValue; } - $formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00; + $formatting = Style_NumberFormat::FORMAT_PERCENTAGE_00; break; case 'currency' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; $dataValue = (float) $cellDataOfficeAttributes['value']; if (floor($dataValue) == $dataValue) { $dataValue = (integer) $dataValue; } - $formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; + $formatting = Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; break; case 'float' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; $dataValue = (float) $cellDataOfficeAttributes['value']; if (floor($dataValue) == $dataValue) { if ($dataValue = (integer) $dataValue) @@ -579,21 +572,21 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce } break; case 'date' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $type = Cell_DataType::TYPE_NUMERIC; $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT); $dateObj->setTimeZone($timezoneObj); list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s')); - $dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second); + $dataValue = Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second); if ($dataValue != floor($dataValue)) { - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; + $formatting = Style_NumberFormat::FORMAT_DATE_XLSX15.' '.Style_NumberFormat::FORMAT_DATE_TIME4; } else { - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15; + $formatting = Style_NumberFormat::FORMAT_DATE_XLSX15; } break; case 'time' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS')))); - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; + $type = Cell_DataType::TYPE_NUMERIC; + $dataValue = Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS')))); + $formatting = Style_NumberFormat::FORMAT_DATE_TIME4; break; } // echo 'Data value is '.$dataValue.'
'; @@ -601,12 +594,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // echo 'Hyperlink is '.$hyperlink.'
'; // } } else { - $type = PHPExcel_Cell_DataType::TYPE_NULL; + $type = Cell_DataType::TYPE_NULL; $dataValue = NULL; } if ($hasCalculatedValue) { - $type = PHPExcel_Cell_DataType::TYPE_FORMULA; + $type = Cell_DataType::TYPE_FORMULA; // echo 'Formula: '.$cellDataFormula.'
'; $cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1); $temp = explode('"',$cellDataFormula); @@ -616,7 +609,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce if ($tKey = !$tKey) { $value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value); $value = preg_replace('/\[\.(.*)\]/Ui','$1',$value); - $value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces); + $value = Calculation::_translateSeparator(';',',',$value,$inBraces); } } unset($value); @@ -632,7 +625,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce if ($i > 0) { ++$columnID; } - if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) { + if ($type !== Cell_DataType::TYPE_NULL) { for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { $rID = $rowID + $rowAdjust; $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); @@ -643,7 +636,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce if ($formatting !== NULL) { $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); } else { - $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL); + $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(Style_NumberFormat::FORMAT_GENERAL); } if ($hyperlink !== NULL) { $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); @@ -655,10 +648,10 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // Merged cells if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) { - if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->_readDataOnly)) { + if (($type !== Cell_DataType::TYPE_NULL) || (!$this->_readDataOnly)) { $columnTo = $columnID; if (isset($cellDataTableAttributes['number-columns-spanned'])) { - $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); + $columnTo = Cell::stringFromColumnIndex(Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); } $rowTo = $rowID; if (isset($cellDataTableAttributes['number-rows-spanned'])) { @@ -685,7 +678,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce private function _parseRichText($is = '') { - $value = new PHPExcel_RichText(); + $value = new RichText(); $value->createText($is); diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index 3d3b59c..0751794 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -19,30 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; /** - * PHPExcel_Reader_SYLK + * PHPExcel\Reader_SYLK * * @category PHPExcel - * @package PHPExcel_Reader + * @package PHPExcel\Reader * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader +class Reader_SYLK extends Reader_Abstract implements Reader_IReader { /** * Input encoding @@ -73,10 +66,10 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ private $_format = 0; /** - * Create a new PHPExcel_Reader_SYLK + * Create a new PHPExcel\Reader_SYLK */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new Reader_DefaultReadFilter(); } /** @@ -129,7 +122,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function listWorksheetInfo($pFilename) { @@ -137,7 +130,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ $this->_openFile($pFilename); if (!$this->_isValidFormat()) { fclose ($this->_fileHandle); - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $fileHandle = $this->_fileHandle; rewind($fileHandle); @@ -158,7 +151,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ $columnIndex = 0; // convert SYLK encoded $rowData to UTF-8 - $rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData); + $rowData = Shared_String::SYLKtoUTF8($rowData); // explode each row at semicolons while taking into account that literal semicolon (;) // is escaped like this (;;) @@ -185,7 +178,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ } } - $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']); + $worksheetInfo[0]['lastColumnLetter'] = Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']); $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1; // Close file @@ -199,12 +192,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @param string $pFilename * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new PHPExcel Workbook + $objPHPExcel = new Workbook(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -216,7 +209,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { @@ -224,7 +217,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ $this->_openFile($pFilename); if (!$this->_isValidFormat()) { fclose ($this->_fileHandle); - throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $fileHandle = $this->_fileHandle; rewind($fileHandle); @@ -246,7 +239,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ while (($rowData = fgets($fileHandle)) !== FALSE) { // convert SYLK encoded $rowData to UTF-8 - $rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData); + $rowData = Shared_String::SYLKtoUTF8($rowData); // explode each row at semicolons while taking into account that literal semicolon (;) // is escaped like this (;;) @@ -272,13 +265,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ break; case 'D' : $formatArray['font']['bold'] = true; break; - case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'T' : $formatArray['borders']['top']['style'] = Style_Border::BORDER_THIN; break; - case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'B' : $formatArray['borders']['bottom']['style'] = Style_Border::BORDER_THIN; break; - case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'L' : $formatArray['borders']['left']['style'] = Style_Border::BORDER_THIN; break; - case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'R' : $formatArray['borders']['right']['style'] = Style_Border::BORDER_THIN; break; } } @@ -325,7 +318,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ if ($columnReference == '') $columnReference = $column; // Bracketed C references are relative to the current column if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]'); - $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; + $A1CellReference = Cell::stringFromColumnIndex($columnReference-1).$rowReference; $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); } @@ -338,13 +331,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ break; } } - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); - $cellData = PHPExcel_Calculation::_unwrapResult($cellData); + $columnLetter = Cell::stringFromColumnIndex($column-1); + $cellData = Calculation::_unwrapResult($cellData); // Set cell value $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); if ($hasCalculatedValue) { - $cellData = PHPExcel_Calculation::_unwrapResult($cellData); + $cellData = Calculation::_unwrapResult($cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData); } // Read cell formatting @@ -370,13 +363,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ break; case 'D' : $styleData['font']['bold'] = true; break; - case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'T' : $styleData['borders']['top']['style'] = Style_Border::BORDER_THIN; break; - case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'B' : $styleData['borders']['bottom']['style'] = Style_Border::BORDER_THIN; break; - case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'L' : $styleData['borders']['left']['style'] = Style_Border::BORDER_THIN; break; - case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; + case 'R' : $styleData['borders']['right']['style'] = Style_Border::BORDER_THIN; break; } } @@ -384,22 +377,22 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ } } if (($formatStyle > '') && ($column > '') && ($row > '')) { - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); + $columnLetter = Cell::stringFromColumnIndex($column-1); if (isset($this->_formats[$formatStyle])) { $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); } } if ((!empty($styleData)) && ($column > '') && ($row > '')) { - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); + $columnLetter = Cell::stringFromColumnIndex($column-1); $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData); } if ($columnWidth > '') { if ($startCol == $endCol) { - $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1); + $startCol = Cell::stringFromColumnIndex($startCol-1); $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); } else { - $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1); - $endCol = PHPExcel_Cell::stringFromColumnIndex($endCol-1); + $startCol = Cell::stringFromColumnIndex($startCol-1); + $endCol = Cell::stringFromColumnIndex($endCol-1); $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); do { $objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth); @@ -440,7 +433,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * Set sheet index * * @param int $pValue Sheet index - * @return PHPExcel_Reader_SYLK + * @return PHPExcel\Reader_SYLK */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; diff --git a/Classes/PHPExcel/ReferenceHelper.php b/Classes/PHPExcel/ReferenceHelper.php index f6fb72f..6d851de 100644 --- a/Classes/PHPExcel/ReferenceHelper.php +++ b/Classes/PHPExcel/ReferenceHelper.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_ReferenceHelper (Singleton) + * PHPExcel\ReferenceHelper (Singleton) * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_ReferenceHelper +class ReferenceHelper { /** Constants */ /** Regular Expressions */ @@ -45,25 +47,25 @@ class PHPExcel_ReferenceHelper /** * Instance of this class * - * @var PHPExcel_ReferenceHelper + * @var PHPExcel\ReferenceHelper */ private static $_instance; /** * Get an instance of this class * - * @return PHPExcel_ReferenceHelper + * @return PHPExcel\ReferenceHelper */ public static function getInstance() { if (!isset(self::$_instance) || (self::$_instance === NULL)) { - self::$_instance = new PHPExcel_ReferenceHelper(); + self::$_instance = new ReferenceHelper(); } return self::$_instance; } /** - * Create a new PHPExcel_ReferenceHelper + * Create a new PHPExcel\ReferenceHelper */ protected function __construct() { } @@ -139,8 +141,8 @@ class PHPExcel_ReferenceHelper * @return boolean */ private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) { - list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress); - $cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn); + list($cellColumn, $cellRow) = Cell::coordinateFromString($cellAddress); + $cellColumnIndex = Cell::columnIndexFromString($cellColumn); // Is cell within the range of rows/columns if we're deleting if ($pNumRows < 0 && ($cellRow >= ($beforeRow + $pNumRows)) && @@ -157,32 +159,32 @@ class PHPExcel_ReferenceHelper /** * Update page breaks when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) * @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function _adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) { $aBreaks = $pSheet->getBreaks(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) : - uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort')); + uksort($aBreaks, array(__NAMESPACE__ . '\ReferenceHelper','cellReverseSort')) : + uksort($aBreaks, array(__NAMESPACE__ . '\ReferenceHelper','cellSort')); foreach ($aBreaks as $key => $value) { if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { // If we're deleting, then clear any defined breaks that are within the range // of rows/columns that we're deleting - $pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE); + $pSheet->setBreak($key, Worksheet::BREAK_NONE); } else { // Otherwise update any affected breaks by inserting a new break at the appropriate point // and removing the old affected break $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); if ($key != $newReference) { $pSheet->setBreak($newReference, $value) - ->setBreak($key, PHPExcel_Worksheet::BREAK_NONE); + ->setBreak($key, Worksheet::BREAK_NONE); } } } @@ -191,7 +193,7 @@ class PHPExcel_ReferenceHelper /** * Update cell comments when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -218,7 +220,7 @@ class PHPExcel_ReferenceHelper /** * Update hyperlinks when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -229,8 +231,8 @@ class PHPExcel_ReferenceHelper { $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : - uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort')); + uksort($aHyperlinkCollection, array(__NAMESPACE__ . '\ReferenceHelper','cellReverseSort')) : + uksort($aHyperlinkCollection, array(__NAMESPACE__ . '\ReferenceHelper','cellSort')); foreach ($aHyperlinkCollection as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); @@ -244,7 +246,7 @@ class PHPExcel_ReferenceHelper /** * Update data validations when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -255,8 +257,8 @@ class PHPExcel_ReferenceHelper { $aDataValidationCollection = $pSheet->getDataValidationCollection(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : - uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort')); + uksort($aDataValidationCollection, array(__NAMESPACE__ . '\ReferenceHelper','cellReverseSort')) : + uksort($aDataValidationCollection, array(__NAMESPACE__ . '\ReferenceHelper','cellSort')); foreach ($aDataValidationCollection as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); if ($key != $newReference) { @@ -269,7 +271,7 @@ class PHPExcel_ReferenceHelper /** * Update merged cells when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -290,7 +292,7 @@ class PHPExcel_ReferenceHelper /** * Update protected cells when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -301,8 +303,8 @@ class PHPExcel_ReferenceHelper { $aProtectedCells = $pSheet->getProtectedCells(); ($pNumCols > 0 || $pNumRows > 0) ? - uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) : - uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort')); + uksort($aProtectedCells, array(__NAMESPACE__ . '\ReferenceHelper','cellReverseSort')) : + uksort($aProtectedCells, array(__NAMESPACE__ . '\ReferenceHelper','cellSort')); foreach ($aProtectedCells as $key => $value) { $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); if ($key != $newReference) { @@ -315,7 +317,7 @@ class PHPExcel_ReferenceHelper /** * Update column dimensions when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -328,7 +330,7 @@ class PHPExcel_ReferenceHelper if (!empty($aColumnDimensions)) { foreach ($aColumnDimensions as $objColumnDimension) { $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); - list($newReference) = PHPExcel_Cell::coordinateFromString($newReference); + list($newReference) = Cell::coordinateFromString($newReference); if ($objColumnDimension->getColumnIndex() != $newReference) { $objColumnDimension->setColumnIndex($newReference); } @@ -340,7 +342,7 @@ class PHPExcel_ReferenceHelper /** * Update row dimensions when inserting/deleting rows/columns * - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) @@ -353,7 +355,7 @@ class PHPExcel_ReferenceHelper if (!empty($aRowDimensions)) { foreach ($aRowDimensions as $objRowDimension) { $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); - list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference); + list(, $newReference) = Cell::coordinateFromString($newReference); if ($objRowDimension->getRowIndex() != $newReference) { $objRowDimension->setRowIndex($newReference); } @@ -377,10 +379,10 @@ class PHPExcel_ReferenceHelper * @param string $pBefore Insert before this cell address (e.g. 'A1') * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) - * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing - * @throws PHPExcel_Exception + * @param PHPExcel\Worksheet $pSheet The worksheet that we're editing + * @throws PHPExcel\Exception */ - public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL) + public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, Worksheet $pSheet = NULL) { $remove = ($pNumCols < 0 || $pNumRows < 0); $aCellCollection = $pSheet->getCellCollection(); @@ -388,8 +390,8 @@ class PHPExcel_ReferenceHelper // Get coordinates of $pBefore $beforeColumn = 'A'; $beforeRow = 1; - list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore); - $beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn); + list($beforeColumn, $beforeRow) = Cell::coordinateFromString($pBefore); + $beforeColumnIndex = Cell::columnIndexFromString($beforeColumn); // Clear cells if we are removing columns or rows $highestColumn = $pSheet->getHighestColumn(); @@ -399,10 +401,10 @@ class PHPExcel_ReferenceHelper if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { for ($i = 1; $i <= $highestRow - 1; ++$i) { for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) { - $coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i; + $coordinate = Cell::stringFromColumnIndex($j) . $i; $pSheet->removeConditionalStyles($coordinate); if ($pSheet->cellExists($coordinate)) { - $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setValueExplicit('', Cell_DataType::TYPE_NULL); $pSheet->getCell($coordinate)->setXfIndex(0); } } @@ -411,12 +413,12 @@ class PHPExcel_ReferenceHelper // 2. Clear row strips if we are removing rows if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { - for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($i = $beforeColumnIndex - 1; $i <= Cell::columnIndexFromString($highestColumn) - 1; ++$i) { for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { - $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j; + $coordinate = Cell::stringFromColumnIndex($i) . $j; $pSheet->removeConditionalStyles($coordinate); if ($pSheet->cellExists($coordinate)) { - $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setValueExplicit('', Cell_DataType::TYPE_NULL); $pSheet->getCell($coordinate)->setXfIndex(0); } } @@ -426,13 +428,13 @@ class PHPExcel_ReferenceHelper // Loop through cells, bottom-up, and change cell coordinates while (($cellID = $remove ? array_shift($aCellCollection) : array_pop($aCellCollection))) { $cell = $pSheet->getCell($cellID); - $cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn()); + $cellIndex = Cell::columnIndexFromString($cell->getColumn()); if ($cellIndex-1 + $pNumCols < 0) { continue; } // New coordinates - $newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows); + $newCoordinates = Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows); // Should the cell be updated? Move value and cellXf index from one cell to another. if (($cellIndex >= $beforeColumnIndex) && @@ -442,7 +444,7 @@ class PHPExcel_ReferenceHelper $pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex()); // Insert this cell at its new location - if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { + if ($cell->getDataType() == Cell_DataType::TYPE_FORMULA) { // Formula should be adjusted $pSheet->getCell($newCoordinates) ->setValue($this->updateFormulaReferences($cell->getValue(), @@ -458,7 +460,7 @@ class PHPExcel_ReferenceHelper } else { /* We don't need to update styles for rows/columns before our insertion position, but we do still need to adjust any formulae in those cells */ - if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { + if ($cell->getDataType() == Cell_DataType::TYPE_FORMULA) { // Formula should be adjusted $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); @@ -475,7 +477,7 @@ class PHPExcel_ReferenceHelper for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { // Style - $coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i; + $coordinate = Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i; if ($pSheet->cellExists($coordinate)) { $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? @@ -487,7 +489,7 @@ class PHPExcel_ReferenceHelper foreach ($conditionalStyles as $conditionalStyle) { $cloned[] = clone $conditionalStyle; } - $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j) . $i, $cloned); + $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($j) . $i, $cloned); } } } @@ -496,22 +498,22 @@ class PHPExcel_ReferenceHelper } if ($pNumRows > 0 && $beforeRow - 1 > 0) { - for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($i = $beforeColumnIndex - 1; $i <= Cell::columnIndexFromString($highestColumn) - 1; ++$i) { // Style - $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1); + $coordinate = Cell::stringFromColumnIndex($i) . ($beforeRow - 1); if ($pSheet->cellExists($coordinate)) { $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? $pSheet->getConditionalStyles($coordinate) : false; for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { - $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); + $pSheet->getCell(Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); if ($conditionalStyles) { $cloned = array(); foreach ($conditionalStyles as $conditionalStyle) { $cloned[] = clone $conditionalStyle; } - $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $cloned); + $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($i) . $j, $cloned); } } } @@ -550,8 +552,8 @@ class PHPExcel_ReferenceHelper $autoFilterColumns = array_keys($autoFilter->getColumns()); if (count($autoFilterColumns) > 0) { sscanf($pBefore,'%[A-Z]%d', $column, $row); - $columnIndex = PHPExcel_Cell::columnIndexFromString($column); - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange); + $columnIndex = Cell::columnIndexFromString($column); + list($rangeStart,$rangeEnd) = Cell::rangeBoundaries($autoFilterRange); if ($columnIndex <= $rangeEnd[0]) { if ($pNumCols < 0) { // If we're actually deleting any columns that fall within the autofilter range, @@ -559,8 +561,8 @@ class PHPExcel_ReferenceHelper $deleteColumn = $columnIndex + $pNumCols - 1; $deleteCount = abs($pNumCols); for ($i = 1; $i <= $deleteCount; ++$i) { - if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn),$autoFilterColumns)) { - $autoFilter->clearColumn(PHPExcel_Cell::stringFromColumnIndex($deleteColumn)); + if (in_array(Cell::stringFromColumnIndex($deleteColumn),$autoFilterColumns)) { + $autoFilter->clearColumn(Cell::stringFromColumnIndex($deleteColumn)); } ++$deleteColumn; } @@ -570,24 +572,24 @@ class PHPExcel_ReferenceHelper // Shuffle columns in autofilter range if ($pNumCols > 0) { // For insert, we shuffle from end to beginning to avoid overwriting - $startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1); - $toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1); - $endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]); + $startColID = Cell::stringFromColumnIndex($startCol-1); + $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1); + $endColID = Cell::stringFromColumnIndex($rangeEnd[0]); $startColRef = $startCol; $endColRef = $rangeEnd[0]; $toColRef = $rangeEnd[0]+$pNumCols; do { - $autoFilter->shiftColumn(PHPExcel_Cell::stringFromColumnIndex($endColRef-1),PHPExcel_Cell::stringFromColumnIndex($toColRef-1)); + $autoFilter->shiftColumn(Cell::stringFromColumnIndex($endColRef-1),Cell::stringFromColumnIndex($toColRef-1)); --$endColRef; --$toColRef; } while ($startColRef <= $endColRef); } else { // For delete, we shuffle from beginning to end to avoid overwriting - $startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1); - $toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1); - $endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]); + $startColID = Cell::stringFromColumnIndex($startCol-1); + $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1); + $endColID = Cell::stringFromColumnIndex($rangeEnd[0]); do { $autoFilter->shiftColumn($startColID,$toColID); ++$startColID; @@ -643,7 +645,7 @@ class PHPExcel_ReferenceHelper * @param int $pNumRows Number of rows to insert * @param string $sheetName Worksheet name/title * @return string Updated formula - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') { // Update cell references in the formula @@ -693,7 +695,7 @@ class PHPExcel_ReferenceHelper $toString = ($match[2] > '') ? $match[2].'!' : ''; $toString .= $modified3.':'.$modified4; // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more - $column = PHPExcel_Cell::columnIndexFromString(trim($match[3],'$')) + 100000; + $column = Cell::columnIndexFromString(trim($match[3],'$')) + 100000; $row = 10000000; $cellIndex = $column.$row; @@ -717,9 +719,9 @@ class PHPExcel_ReferenceHelper if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { $toString = ($match[2] > '') ? $match[2].'!' : ''; $toString .= $modified3.':'.$modified4; - list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]); + list($column,$row) = Cell::coordinateFromString($match[3]); // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more - $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; + $column = Cell::columnIndexFromString(trim($column,'$')) + 100000; $row = trim($row,'$') + 10000000; $cellIndex = $column.$row; @@ -742,9 +744,9 @@ class PHPExcel_ReferenceHelper if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { $toString = ($match[2] > '') ? $match[2].'!' : ''; $toString .= $modified3; - list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]); + list($column,$row) = Cell::coordinateFromString($match[3]); // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more - $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; + $column = Cell::columnIndexFromString(trim($column,'$')) + 100000; $row = trim($row,'$') + 10000000; $cellIndex = $column.$row; @@ -782,7 +784,7 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell range - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { // Is it in another worksheet? Will not have to update anything. @@ -808,7 +810,7 @@ class PHPExcel_ReferenceHelper * @param string $oldName Old name (name to replace) * @param string $newName New name */ - public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') { + public function updateNamedFormulas(Workbook $pPhpExcel, $oldName = '', $newName = '') { if ($oldName == '') { return; } @@ -816,12 +818,12 @@ class PHPExcel_ReferenceHelper foreach ($pPhpExcel->getWorksheetIterator() as $sheet) { foreach ($sheet->getCellCollection(false) as $cellID) { $cell = $sheet->getCell($cellID); - if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) { + if (($cell !== NULL) && ($cell->getDataType() == Cell_DataType::TYPE_FORMULA)) { $formula = $cell->getValue(); if (strpos($formula, $oldName) !== false) { $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); $formula = str_replace($oldName . "!", $newName . "!", $formula); - $cell->setValueExplicit($formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + $cell->setValueExplicit($formula, Cell_DataType::TYPE_FORMULA); } } } @@ -836,21 +838,21 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell range - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) { // Update range - $range = PHPExcel_Cell::splitRange($pCellRange); + $range = Cell::splitRange($pCellRange); $ic = count($range); for ($i = 0; $i < $ic; ++$i) { $jc = count($range[$i]); for ($j = 0; $j < $jc; ++$j) { if (ctype_alpha($range[$i][$j])) { - $r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); + $r = Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); $range[$i][$j] = $r[0]; } elseif(ctype_digit($range[$i][$j])) { - $r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); + $r = Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); $range[$i][$j] = $r[1]; } else { $range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); @@ -859,9 +861,9 @@ class PHPExcel_ReferenceHelper } // Recreate range string - return PHPExcel_Cell::buildRange($range); + return Cell::buildRange($range); } else { - throw new PHPExcel_Exception("Only cell ranges may be passed to this method."); + throw new Exception("Only cell ranges may be passed to this method."); } } @@ -873,26 +875,26 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell reference - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { // Get coordinates of $pBefore - list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); + list($beforeColumn, $beforeRow) = Cell::coordinateFromString( $pBefore ); // Get coordinates of $pCellReference - list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference ); + list($newColumn, $newRow) = Cell::coordinateFromString( $pCellReference ); // Verify which parts should be updated $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && - PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)); + Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn)); $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow); // Create new column reference if ($updateColumn) { - $newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols ); + $newColumn = Cell::stringFromColumnIndex( Cell::columnIndexFromString($newColumn) - 1 + $pNumCols ); } // Create new row reference @@ -903,16 +905,16 @@ class PHPExcel_ReferenceHelper // Return new reference return $newColumn . $newRow; } else { - throw new PHPExcel_Exception("Only single cell references may be passed to this method."); + throw new Exception("Only single cell references may be passed to this method."); } } /** * __clone implementation. Cloning should not be allowed in a Singleton! * - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public final function __clone() { - throw new PHPExcel_Exception("Cloning a Singleton is not allowed!"); + throw new Exception("Cloning a Singleton is not allowed!"); } } diff --git a/Classes/PHPExcel/RichText.php b/Classes/PHPExcel/RichText.php index 97c388a..cefe846 100644 --- a/Classes/PHPExcel/RichText.php +++ b/Classes/PHPExcel/RichText.php @@ -19,36 +19,38 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_RichText + * PHPExcel\RichText * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_RichText implements PHPExcel_IComparable +class RichText implements IComparable { /** * Rich text elements * - * @var PHPExcel_RichText_ITextElement[] + * @var PHPExcel\RichText_ITextElement[] */ private $_richTextElements; /** - * Create a new PHPExcel_RichText instance + * Create a new PHPExcel\RichText instance * - * @param PHPExcel_Cell $pCell - * @throws PHPExcel_Exception + * @param PHPExcel\Cell $pCell + * @throws PHPExcel\Exception */ - public function __construct(PHPExcel_Cell $pCell = null) + public function __construct(Cell $pCell = null) { // Initialise variables $this->_richTextElements = array(); @@ -57,24 +59,24 @@ class PHPExcel_RichText implements PHPExcel_IComparable if ($pCell !== NULL) { // Add cell text and style if ($pCell->getValue() != "") { - $objRun = new PHPExcel_RichText_Run($pCell->getValue()); + $objRun = new RichText_Run($pCell->getValue()); $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont()); $this->addText($objRun); } // Set parent value - $pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); + $pCell->setValueExplicit($this, Cell_DataType::TYPE_STRING); } } /** * Add text * - * @param PHPExcel_RichText_ITextElement $pText Rich text element - * @throws PHPExcel_Exception - * @return PHPExcel_RichText + * @param PHPExcel\RichText_ITextElement $pText Rich text element + * @throws PHPExcel\Exception + * @return PHPExcel\RichText */ - public function addText(PHPExcel_RichText_ITextElement $pText = null) + public function addText(RichText_ITextElement $pText = null) { $this->_richTextElements[] = $pText; return $this; @@ -84,12 +86,12 @@ class PHPExcel_RichText implements PHPExcel_IComparable * Create text * * @param string $pText Text - * @return PHPExcel_RichText_TextElement - * @throws PHPExcel_Exception + * @return PHPExcel\RichText_TextElement + * @throws PHPExcel\Exception */ public function createText($pText = '') { - $objText = new PHPExcel_RichText_TextElement($pText); + $objText = new RichText_TextElement($pText); $this->addText($objText); return $objText; } @@ -98,12 +100,12 @@ class PHPExcel_RichText implements PHPExcel_IComparable * Create text run * * @param string $pText Text - * @return PHPExcel_RichText_Run - * @throws PHPExcel_Exception + * @return PHPExcel\RichText_Run + * @throws PHPExcel\Exception */ public function createTextRun($pText = '') { - $objText = new PHPExcel_RichText_Run($pText); + $objText = new RichText_Run($pText); $this->addText($objText); return $objText; } @@ -118,7 +120,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable // Return value $returnValue = ''; - // Loop through all PHPExcel_RichText_ITextElement + // Loop through all PHPExcel\RichText_ITextElement foreach ($this->_richTextElements as $text) { $returnValue .= $text->getText(); } @@ -140,7 +142,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable /** * Get Rich Text elements * - * @return PHPExcel_RichText_ITextElement[] + * @return PHPExcel\RichText_ITextElement[] */ public function getRichTextElements() { @@ -150,16 +152,16 @@ class PHPExcel_RichText implements PHPExcel_IComparable /** * Set Rich Text elements * - * @param PHPExcel_RichText_ITextElement[] $pElements Array of elements - * @throws PHPExcel_Exception - * @return PHPExcel_RichText + * @param PHPExcel\RichText_ITextElement[] $pElements Array of elements + * @throws PHPExcel\Exception + * @return PHPExcel\RichText */ public function setRichTextElements($pElements = null) { if (is_array($pElements)) { $this->_richTextElements = $pElements; } else { - throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed."); + throw new Exception("Invalid PHPExcel\RichText_ITextElement[] array passed."); } return $this; } diff --git a/Classes/PHPExcel/RichText/ITextElement.php b/Classes/PHPExcel/RichText/ITextElement.php index da119dc..00e7141 100644 --- a/Classes/PHPExcel/RichText/ITextElement.php +++ b/Classes/PHPExcel/RichText/ITextElement.php @@ -17,21 +17,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_RichText_ITextElement + * PHPExcel\RichText_ITextElement * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_RichText_ITextElement +interface RichText_ITextElement { /** * Get text @@ -44,14 +46,14 @@ interface PHPExcel_RichText_ITextElement * Set text * * @param $pText string Text - * @return PHPExcel_RichText_ITextElement + * @return PHPExcel\RichText_ITextElement */ public function setText($pText = ''); /** * Get font * - * @return PHPExcel_Style_Font + * @return PHPExcel\Style_Font */ public function getFont(); diff --git a/Classes/PHPExcel/RichText/Run.php b/Classes/PHPExcel/RichText/Run.php index 7b82a71..67aa191 100644 --- a/Classes/PHPExcel/RichText/Run.php +++ b/Classes/PHPExcel/RichText/Run.php @@ -17,31 +17,33 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_RichText_Run + * PHPExcel\RichText_Run * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement +class RichText_Run extends RichText_TextElement implements RichText_ITextElement { /** * Font * - * @var PHPExcel_Style_Font + * @var PHPExcel\Style_Font */ private $_font; /** - * Create a new PHPExcel_RichText_Run instance + * Create a new PHPExcel\RichText_Run instance * * @param string $pText Text */ @@ -49,13 +51,13 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP { // Initialise variables $this->setText($pText); - $this->_font = new PHPExcel_Style_Font(); + $this->_font = new Style_Font(); } /** * Get font * - * @return PHPExcel_Style_Font + * @return PHPExcel\Style_Font */ public function getFont() { return $this->_font; @@ -64,11 +66,11 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP /** * Set font * - * @param PHPExcel_Style_Font $pFont Font - * @throws PHPExcel_Exception - * @return PHPExcel_RichText_ITextElement + * @param PHPExcel\Style_Font $pFont Font + * @throws PHPExcel\Exception + * @return PHPExcel\RichText_ITextElement */ - public function setFont(PHPExcel_Style_Font $pFont = null) { + public function setFont(Style_Font $pFont = null) { $this->_font = $pFont; return $this; } diff --git a/Classes/PHPExcel/RichText/TextElement.php b/Classes/PHPExcel/RichText/TextElement.php index 71a15d6..0f48e27 100644 --- a/Classes/PHPExcel/RichText/TextElement.php +++ b/Classes/PHPExcel/RichText/TextElement.php @@ -17,21 +17,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_RichText_TextElement + * PHPExcel\RichText_TextElement * * @category PHPExcel - * @package PHPExcel_RichText + * @package PHPExcel\RichText * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement +class RichText_TextElement implements RichText_ITextElement { /** * Text @@ -41,7 +43,7 @@ class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement private $_text; /** - * Create a new PHPExcel_RichText_TextElement instance + * Create a new PHPExcel\RichText_TextElement instance * * @param string $pText Text */ @@ -64,7 +66,7 @@ class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement * Set text * * @param $pText string Text - * @return PHPExcel_RichText_ITextElement + * @return PHPExcel\RichText_ITextElement */ public function setText($pText = '') { $this->_text = $pText; @@ -74,7 +76,7 @@ class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement /** * Get font * - * @return PHPExcel_Style_Font + * @return PHPExcel\Style_Font */ public function getFont() { return null; diff --git a/Classes/PHPExcel/Settings.php b/Classes/PHPExcel/Settings.php index 8cd1da3..4bb7ab9 100644 --- a/Classes/PHPExcel/Settings.php +++ b/Classes/PHPExcel/Settings.php @@ -19,23 +19,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Settings + * @package PHPExcel\Settings * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} +namespace PHPExcel; -class PHPExcel_Settings +class Settings { /** constants */ /** Available Zip library classes */ @@ -110,7 +103,7 @@ class PHPExcel_Settings * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive) * * @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management - * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive + * e.g. PHPExcel\Settings::PCLZip or PHPExcel\Settings::ZipArchive * @return boolean Success or failure */ public static function setZipClass($zipClass) @@ -130,7 +123,7 @@ class PHPExcel_Settings * * @return string Name of the Zip handler Class that PHPExcel is configured to use * for Zip file management - * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive + * e.g. PHPExcel\Settings::PCLZip or PHPExcel\Settings::ZipArchive */ public static function getZipClass() { @@ -145,7 +138,7 @@ class PHPExcel_Settings */ public static function getCacheStorageMethod() { - return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod(); + return CachedObjectStorageFactory::getCacheStorageMethod(); } // function getCacheStorageMethod() @@ -156,7 +149,7 @@ class PHPExcel_Settings */ public static function getCacheStorageClass() { - return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass(); + return CachedObjectStorageFactory::getCacheStorageClass(); } // function getCacheStorageClass() @@ -168,11 +161,11 @@ class PHPExcel_Settings * @return boolean Success or failure */ public static function setCacheStorageMethod( - $method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, + $method = CachedObjectStorageFactory::cache_in_memory, $arguments = array() ) { - return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments); + return CachedObjectStorageFactory::initialize($method, $arguments); } // function setCacheStorageMethod() @@ -184,7 +177,7 @@ class PHPExcel_Settings */ public static function setLocale($locale='en_us') { - return PHPExcel_Calculation::getInstance()->setLocale($locale); + return Calculation::getInstance()->setLocale($locale); } // function setLocale() @@ -192,7 +185,7 @@ class PHPExcel_Settings * Set details of the external library that PHPExcel should use for rendering charts * * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + * e.g. PHPExcel\Settings::CHART_RENDERER_JPGRAPH * @param string $libraryBaseDir Directory path to the library's base folder * * @return boolean Success or failure @@ -209,7 +202,7 @@ class PHPExcel_Settings * Identify to PHPExcel the external library to use for rendering charts * * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + * e.g. PHPExcel\Settings::CHART_RENDERER_JPGRAPH * * @return boolean Success or failure */ @@ -247,7 +240,7 @@ class PHPExcel_Settings * * @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is * currently configured to use - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + * e.g. PHPExcel\Settings::CHART_RENDERER_JPGRAPH */ public static function getChartRendererName() { @@ -271,9 +264,9 @@ class PHPExcel_Settings * Set details of the external library that PHPExcel should use for rendering PDF files * * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF + * e.g. PHPExcel\Settings::PDF_RENDERER_TCPDF, + * PHPExcel\Settings::PDF_RENDERER_DOMPDF + * or PHPExcel\Settings::PDF_RENDERER_MPDF * @param string $libraryBaseDir Directory path to the library's base folder * * @return boolean Success or failure @@ -290,9 +283,9 @@ class PHPExcel_Settings * Identify to PHPExcel the external library to use for rendering PDF files * * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF + * e.g. PHPExcel\Settings::PDF_RENDERER_TCPDF, + * PHPExcel\Settings::PDF_RENDERER_DOMPDF + * or PHPExcel\Settings::PDF_RENDERER_MPDF * * @return boolean Success or failure */ @@ -330,9 +323,9 @@ class PHPExcel_Settings * * @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is * currently configured to use - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF + * e.g. PHPExcel\Settings::PDF_RENDERER_TCPDF, + * PHPExcel\Settings::PDF_RENDERER_DOMPDF + * or PHPExcel\Settings::PDF_RENDERER_MPDF */ public static function getPdfRendererName() { diff --git a/Classes/PHPExcel/Shared/CodePage.php b/Classes/PHPExcel/Shared/CodePage.php index c91ecb3..fe9233d 100644 --- a/Classes/PHPExcel/Shared/CodePage.php +++ b/Classes/PHPExcel/Shared/CodePage.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_CodePage + * PHPExcel\Shared_CodePage * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_CodePage +class Shared_CodePage { /** * Convert Microsoft Code Page Identifier to Code Page Name which iconv @@ -41,14 +43,14 @@ class PHPExcel_Shared_CodePage * * @param integer $codePage Microsoft Code Page Indentifier * @return string Code Page Name - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function NumberToName($codePage = 1252) { switch ($codePage) { case 367: return 'ASCII'; break; // ASCII case 437: return 'CP437'; break; // OEM US - case 720: throw new PHPExcel_Exception('Code page 720 not supported.'); + case 720: throw new Exception('Code page 720 not supported.'); break; // OEM Arabic case 737: return 'CP737'; break; // OEM Greek case 775: return 'CP775'; break; // OEM Baltic @@ -89,13 +91,13 @@ class PHPExcel_Shared_CodePage case 10079: return 'MACICELAND'; break; // Macintosh Icelandic case 10081: return 'MACTURKISH'; break; // Macintosh Turkish case 32768: return 'MAC'; break; // Apple Roman - case 32769: throw new PHPExcel_Exception('Code page 32769 not supported.'); + case 32769: throw new Exception('Code page 32769 not supported.'); break; // ANSI Latin I (BIFF2-BIFF3) case 65000: return 'UTF-7'; break; // Unicode (UTF-7) case 65001: return 'UTF-8'; break; // Unicode (UTF-8) } - throw new PHPExcel_Exception('Unknown codepage: ' . $codePage); + throw new Exception('Unknown codepage: ' . $codePage); } } diff --git a/Classes/PHPExcel/Shared/Date.php b/Classes/PHPExcel/Shared/Date.php index fe8fc6a..6d5c3fa 100644 --- a/Classes/PHPExcel/Shared/Date.php +++ b/Classes/PHPExcel/Shared/Date.php @@ -20,21 +20,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_Date + * PHPExcel\Shared_Date * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Date +class Shared_Date { /** constants */ const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0 @@ -143,7 +145,7 @@ class PHPExcel_Shared_Date } $timezoneAdjustment = ($adjustToTimezone) ? - PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : + Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : 0; // Return @@ -248,10 +250,10 @@ class PHPExcel_Shared_Date /** * Is a given cell a date/time? * - * @param PHPExcel_Cell $pCell + * @param PHPExcel\Cell $pCell * @return boolean */ - public static function isDateTime(PHPExcel_Cell $pCell) { + public static function isDateTime(Cell $pCell) { return self::isDateTimeFormat( $pCell->getWorksheet()->getStyle( $pCell->getCoordinate() @@ -263,10 +265,10 @@ class PHPExcel_Shared_Date /** * Is a given number format a date/time? * - * @param PHPExcel_Style_NumberFormat $pFormat + * @param Style_NumberFormat $pFormat * @return boolean */ - public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) { + public static function isDateTimeFormat(Style_NumberFormat $pFormat) { return self::isDateTimeFormatCode($pFormat->getFormatCode()); } // function isDateTimeFormat() @@ -283,31 +285,31 @@ class PHPExcel_Shared_Date // Switch on formatcode switch ($pFormatCode) { // General contains an epoch letter 'e', so we trap for it explicitly here - case PHPExcel_Style_NumberFormat::FORMAT_GENERAL: + case Style_NumberFormat::FORMAT_GENERAL: return FALSE; // Explicitly defined date formats - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22: + case Style_NumberFormat::FORMAT_DATE_YYYYMMDD: + case Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: + case Style_NumberFormat::FORMAT_DATE_DDMMYYYY: + case Style_NumberFormat::FORMAT_DATE_DMYSLASH: + case Style_NumberFormat::FORMAT_DATE_DMYMINUS: + case Style_NumberFormat::FORMAT_DATE_DMMINUS: + case Style_NumberFormat::FORMAT_DATE_MYMINUS: + case Style_NumberFormat::FORMAT_DATE_DATETIME: + case Style_NumberFormat::FORMAT_DATE_TIME1: + case Style_NumberFormat::FORMAT_DATE_TIME2: + case Style_NumberFormat::FORMAT_DATE_TIME3: + case Style_NumberFormat::FORMAT_DATE_TIME4: + case Style_NumberFormat::FORMAT_DATE_TIME5: + case Style_NumberFormat::FORMAT_DATE_TIME6: + case Style_NumberFormat::FORMAT_DATE_TIME7: + case Style_NumberFormat::FORMAT_DATE_TIME8: + case Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: + case Style_NumberFormat::FORMAT_DATE_XLSX14: + case Style_NumberFormat::FORMAT_DATE_XLSX15: + case Style_NumberFormat::FORMAT_DATE_XLSX16: + case Style_NumberFormat::FORMAT_DATE_XLSX17: + case Style_NumberFormat::FORMAT_DATE_XLSX22: return TRUE; } @@ -350,14 +352,14 @@ class PHPExcel_Shared_Date if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) return FALSE; - $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue); + $dateValueNew = Calculation_DateTime::DATEVALUE($dateValue); - if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) { + if ($dateValueNew === Calculation_Functions::VALUE()) { return FALSE; } else { if (strpos($dateValue, ':') !== FALSE) { - $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue); - if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) { + $timeValue = Calculation_DateTime::TIMEVALUE($dateValue); + if ($timeValue === Calculation_Functions::VALUE()) { return FALSE; } $dateValueNew += $timeValue; diff --git a/Classes/PHPExcel/Shared/Drawing.php b/Classes/PHPExcel/Shared/Drawing.php index 7f7842b..451a103 100644 --- a/Classes/PHPExcel/Shared/Drawing.php +++ b/Classes/PHPExcel/Shared/Drawing.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_Drawing + * PHPExcel\Shared_Drawing * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Drawing +class Shared_Drawing { /** * Convert pixels to EMU @@ -65,25 +67,25 @@ class PHPExcel_Shared_Drawing * This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional. * * @param int $pValue Value in pixels - * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook + * @param PHPExcel\Style_Font $pDefaultFont Default font of the workbook * @return int Value in cell dimension */ - public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { + public static function pixelsToCellDimension($pValue = 0, Style_Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); - if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { + if (isset(Shared_Font::$defaultColumnWidths[$name][$size])) { // Exact width can be determined $colWidth = $pValue - * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] - / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']; + * Shared_Font::$defaultColumnWidths[$name][$size]['width'] + / Shared_Font::$defaultColumnWidths[$name][$size]['px']; } else { // We don't have data for this particular font and size, use approximation by // extrapolating from Calibri 11 $colWidth = $pValue * 11 - * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] - / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size; + * Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] + / Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size; } return $colWidth; @@ -93,26 +95,26 @@ class PHPExcel_Shared_Drawing * Convert column width from (intrinsic) Excel units to pixels * * @param float $pValue Value in cell dimension - * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook + * @param PHPExcel\Style_Font $pDefaultFont Default font of the workbook * @return int Value in pixels */ - public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { + public static function cellDimensionToPixels($pValue = 0, Style_Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); - if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { + if (isset(Shared_Font::$defaultColumnWidths[$name][$size])) { // Exact width can be determined $colWidth = $pValue - * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] - / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']; + * Shared_Font::$defaultColumnWidths[$name][$size]['px'] + / Shared_Font::$defaultColumnWidths[$name][$size]['width']; } else { // We don't have data for this particular font and size, use approximation by // extrapolating from Calibri 11 $colWidth = $pValue * $size - * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] - / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11; + * Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] + / Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11; } // Round pixels to closest integer diff --git a/Classes/PHPExcel/Shared/Escher.php b/Classes/PHPExcel/Shared/Escher.php index e3f1d55..8f52502 100644 --- a/Classes/PHPExcel/Shared/Escher.php +++ b/Classes/PHPExcel/Shared/Escher.php @@ -19,39 +19,42 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher + * PHPExcel\Shared_Escher * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher +class Shared_Escher { /** * Drawing Group Container * - * @var PHPExcel_Shared_Escher_DggContainer + * @var PHPExcel\Shared_Escher_DggContainer */ private $_dggContainer; /** * Drawing Container * - * @var PHPExcel_Shared_Escher_DgContainer + * @var PHPExcel\Shared_Escher_DgContainer */ private $_dgContainer; /** * Get Drawing Group Container * - * @return PHPExcel_Shared_Escher_DgContainer + * @return PHPExcel\Shared_Escher_DgContainer */ public function getDggContainer() { @@ -61,7 +64,7 @@ class PHPExcel_Shared_Escher /** * Set Drawing Group Container * - * @param PHPExcel_Shared_Escher_DggContainer $dggContainer + * @param PHPExcel\Shared_Escher_DggContainer $dggContainer */ public function setDggContainer($dggContainer) { @@ -71,7 +74,7 @@ class PHPExcel_Shared_Escher /** * Get Drawing Container * - * @return PHPExcel_Shared_Escher_DgContainer + * @return PHPExcel\Shared_Escher_DgContainer */ public function getDgContainer() { @@ -81,7 +84,7 @@ class PHPExcel_Shared_Escher /** * Set Drawing Container * - * @param PHPExcel_Shared_Escher_DgContainer $dgContainer + * @param PHPExcel\Shared_Escher_DgContainer $dgContainer */ public function setDgContainer($dgContainer) { diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer.php index bea1e44..c3b3880 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DgContainer + * PHPExcel\Shared_Escher_DgContainer * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DgContainer +class Shared_Escher_DgContainer { /** * Drawing index, 1-based. diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php index 827ac3d..bf8931e 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php @@ -19,25 +19,28 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DgContainer_SpgrContainer + * PHPExcel\Shared_Escher_DgContainer_SpgrContainer * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DgContainer_SpgrContainer +class Shared_Escher_DgContainer_SpgrContainer { /** * Parent Shape Group Container * - * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer + * @var PHPExcel\Shared_Escher_DgContainer_SpgrContainer */ private $_parent; @@ -51,7 +54,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer /** * Set parent Shape Group Container * - * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent + * @param PHPExcel\Shared_Escher_DgContainer_SpgrContainer $parent */ public function setParent($parent) { @@ -61,7 +64,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer /** * Get the parent Shape Group Container if any * - * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null + * @return PHPExcel\Shared_Escher_DgContainer_SpgrContainer|null */ public function getParent() { @@ -90,14 +93,14 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer /** * Recursively get all spContainers within this spgrContainer * - * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[] + * @return PHPExcel\Shared_Escher_DgContainer_SpgrContainer_SpContainer[] */ public function getAllSpContainers() { $allSpContainers = array(); foreach ($this->_children as $child) { - if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + if ($child instanceof Shared_Escher_DgContainer_SpgrContainer) { $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); } else { $allSpContainers[] = $child; diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index f3a8bab..5eca0da 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -19,25 +19,28 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer + * PHPExcel\Shared_Escher_DgContainer_SpgrContainer_SpContainer * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer +class Shared_Escher_DgContainer_SpgrContainer_SpContainer { /** * Parent Shape Group Container * - * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer + * @var PHPExcel\Shared_Escher_DgContainer_SpgrContainer */ private $_parent; @@ -121,7 +124,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer /** * Set parent Shape Group Container * - * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent + * @param PHPExcel\Shared_Escher_DgContainer_SpgrContainer $parent */ public function setParent($parent) { @@ -131,7 +134,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer /** * Get the parent Shape Group Container * - * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer + * @return PHPExcel\Shared_Escher_DgContainer_SpgrContainer */ public function getParent() { @@ -385,7 +388,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer $nestingLevel = 0; $parent = $this->getParent(); - while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + while ($parent instanceof Shared_Escher_DgContainer_SpgrContainer) { ++$nestingLevel; $parent = $parent->getParent(); } diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer.php b/Classes/PHPExcel/Shared/Escher/DggContainer.php index 5cb2ceb..733057e 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DggContainer + * PHPExcel\Shared_Escher_DggContainer * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DggContainer +class Shared_Escher_DggContainer { /** * Maximum shape index of all shapes in all drawings increased by one @@ -58,7 +61,7 @@ class PHPExcel_Shared_Escher_DggContainer /** * BLIP Store Container * - * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * @var PHPExcel\Shared_Escher_DggContainer_BstoreContainer */ private $_bstoreContainer; @@ -139,7 +142,7 @@ class PHPExcel_Shared_Escher_DggContainer /** * Get BLIP Store Container * - * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * @return PHPExcel\Shared_Escher_DggContainer_BstoreContainer */ public function getBstoreContainer() { @@ -149,7 +152,7 @@ class PHPExcel_Shared_Escher_DggContainer /** * Set BLIP Store Container * - * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $bstoreContainer + * @param PHPExcel\Shared_Escher_DggContainer_BstoreContainer $bstoreContainer */ public function setBstoreContainer($bstoreContainer) { diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php index fceb57b..45c531c 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * PHPExcel\Shared_Escher_DggContainer_BstoreContainer * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DggContainer_BstoreContainer +class Shared_Escher_DggContainer_BstoreContainer { /** * BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture) @@ -44,7 +47,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer /** * Add a BLIP Store Entry * - * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $BSE + * @param PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE $BSE */ public function addBSE($BSE) { @@ -55,7 +58,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer /** * Get the collection of BLIP Store Entries * - * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[] + * @return PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE[] */ public function getBSECollection() { diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php index e278f21..039721c 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -19,20 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE + * PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE +class Shared_Escher_DggContainer_BstoreContainer_BSE { const BLIPTYPE_ERROR = 0x00; const BLIPTYPE_UNKNOWN = 0x01; @@ -48,14 +51,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE /** * The parent BLIP Store Entry Container * - * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * @var PHPExcel\Shared_Escher_DggContainer_BstoreContainer */ private $_parent; /** * The BLIP (Big Large Image or Picture) * - * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + * @var PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ private $_blip; @@ -69,7 +72,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE /** * Set parent BLIP Store Entry Container * - * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $parent + * @param PHPExcel\Shared_Escher_DggContainer_BstoreContainer $parent */ public function setParent($parent) { @@ -79,7 +82,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE /** * Get the BLIP * - * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + * @return PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ public function getBlip() { @@ -89,7 +92,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE /** * Set the BLIP * - * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip + * @param PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip */ public function setBlip($blip) { diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php index b30ef87..357ec7f 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -19,25 +19,28 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + * PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE_Blip * * @category PHPExcel - * @package PHPExcel_Shared_Escher + * @package PHPExcel\Shared_Escher * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip +class Shared_Escher_DggContainer_BstoreContainer_BSE_Blip { /** * The parent BSE * - * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE + * @var PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE */ private $_parent; @@ -71,7 +74,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip /** * Set parent BSE * - * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent + * @param PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE $parent */ public function setParent($parent) { @@ -81,7 +84,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip /** * Get parent BSE * - * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent + * @return PHPExcel\Shared_Escher_DggContainer_BstoreContainer_BSE $parent */ public function getParent() { diff --git a/Classes/PHPExcel/Shared/Excel5.php b/Classes/PHPExcel/Shared/Excel5.php index b80d61c..2994839 100644 --- a/Classes/PHPExcel/Shared/Excel5.php +++ b/Classes/PHPExcel/Shared/Excel5.php @@ -19,27 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_Excel5 + * PHPExcel\Shared_Excel5 * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Excel5 +class Shared_Excel5 { /** * Get the width of a column in pixels. We use the relationship y = ceil(7x) where * x is the width in intrinsic Excel units (measuring width in number of normal characters) * This holds for Arial 10 * - * @param PHPExcel_Worksheet $sheet The sheet + * @param PHPExcel\Worksheet $sheet The sheet * @param string $col The column * @return integer The width in pixels */ @@ -56,19 +59,19 @@ class PHPExcel_Shared_Excel5 // then we have column dimension with explicit width $columnDimension = $columnDimensions[$col]; $width = $columnDimension->getWidth(); - $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font); + $pixelWidth = Shared_Drawing::cellDimensionToPixels($width, $font); } else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) { // then we have default column dimension with explicit width $defaultColumnDimension = $sheet->getDefaultColumnDimension(); $width = $defaultColumnDimension->getWidth(); - $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font); + $pixelWidth = Shared_Drawing::cellDimensionToPixels($width, $font); } else { // we don't even have any default column dimension. Width depends on default font - $pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true); + $pixelWidth = Shared_Font::getDefaultColumnWidthByFont($font, true); } // now find the effective column width in pixels @@ -86,7 +89,7 @@ class PHPExcel_Shared_Excel5 * the relationship is: y = 4/3x. If the height hasn't been set by the user we * use the default value. If the row is hidden we use a value of zero. * - * @param PHPExcel_Worksheet $sheet The sheet + * @param PHPExcel\Worksheet $sheet The sheet * @param integer $row The row index (1-based) * @return integer The width in pixels */ @@ -110,13 +113,13 @@ class PHPExcel_Shared_Excel5 // then we have a default row dimension with explicit height $defaultRowDimension = $sheet->getDefaultRowDimension(); $rowHeight = $defaultRowDimension->getRowHeight(); - $pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight); + $pixelRowHeight = Shared_Drawing::pointsToPixels($rowHeight); } else { // we don't even have any default row dimension. Height depends on default font - $pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font); - $pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight); + $pointRowHeight = Shared_Font::getDefaultRowHeightByFont($font); + $pixelRowHeight = Shared_Font::fontSizeToPixels($pointRowHeight); } @@ -134,22 +137,22 @@ class PHPExcel_Shared_Excel5 * Get the horizontal distance in pixels between two anchors * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets * - * @param PHPExcel_Worksheet $sheet + * @param PHPExcel\Worksheet $sheet * @param string $startColumn * @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn * @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width * @return integer Horizontal measured in pixels */ - public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) + public static function getDistanceX(Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) { $distanceX = 0; // add the widths of the spanning columns - $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based - $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based + $startColumnIndex = Cell::columnIndexFromString($startColumn) - 1; // 1-based + $endColumnIndex = Cell::columnIndexFromString($endColumn) - 1; // 1-based for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) { - $distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i)); + $distanceX += self::sizeCol($sheet, Cell::stringFromColumnIndex($i)); } // correct for offsetX in startcell @@ -165,14 +168,14 @@ class PHPExcel_Shared_Excel5 * Get the vertical distance in pixels between two anchors * The distanceY is found as sum of all the spanning rows minus two offsets * - * @param PHPExcel_Worksheet $sheet + * @param PHPExcel\Worksheet $sheet * @param integer $startRow (1-based) * @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height * @param integer $endRow (1-based) * @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height * @return integer Vertical distance measured in pixels */ - public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) + public static function getDistanceY(Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) { $distanceY = 0; @@ -234,7 +237,7 @@ class PHPExcel_Shared_Excel5 * W is the width of the cell * H is the height of the cell * - * @param PHPExcel_Worksheet $sheet + * @param PHPExcel\Worksheet $sheet * @param string $coordinates E.g. 'A1' * @param integer $offsetX Horizontal offset in pixels * @param integer $offsetY Vertical offset in pixels @@ -244,8 +247,8 @@ class PHPExcel_Shared_Excel5 */ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) { - list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates); - $col_start = PHPExcel_Cell::columnIndexFromString($column) - 1; + list($column, $row) = Cell::coordinateFromString($coordinates); + $col_start = Cell::columnIndexFromString($column) - 1; $row_start = $row - 1; $x1 = $offsetX; @@ -256,7 +259,7 @@ class PHPExcel_Shared_Excel5 $row_end = $row_start; // Row containing bottom right corner of object // Zero the specified offset if greater than the cell dimensions - if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { + if ($x1 >= self::sizeCol($sheet, Cell::stringFromColumnIndex($col_start))) { $x1 = 0; } if ($y1 >= self::sizeRow($sheet, $row_start + 1)) { @@ -267,8 +270,8 @@ class PHPExcel_Shared_Excel5 $height = $height + $y1 -1; // Subtract the underlying cell widths to find the end cell of the image - while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { - $width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)); + while ($width >= self::sizeCol($sheet, Cell::stringFromColumnIndex($col_end))) { + $width -= self::sizeCol($sheet, Cell::stringFromColumnIndex($col_end)); ++$col_end; } @@ -280,10 +283,10 @@ class PHPExcel_Shared_Excel5 // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell // with zero height or width. - if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { + if (self::sizeCol($sheet, Cell::stringFromColumnIndex($col_start)) == 0) { return; } - if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { + if (self::sizeCol($sheet, Cell::stringFromColumnIndex($col_end)) == 0) { return; } if (self::sizeRow($sheet, $row_start + 1) == 0) { @@ -294,13 +297,13 @@ class PHPExcel_Shared_Excel5 } // Convert the pixel values to the percentage value expected by Excel - $x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; + $x1 = $x1 / self::sizeCol($sheet, Cell::stringFromColumnIndex($col_start)) * 1024; $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256; - $x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $x2 = ($width + 1) / self::sizeCol($sheet, Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object - $startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1); - $endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1); + $startCoordinates = Cell::stringFromColumnIndex($col_start) . ($row_start + 1); + $endCoordinates = Cell::stringFromColumnIndex($col_end) . ($row_end + 1); $twoAnchor = array( 'startCoordinates' => $startCoordinates, diff --git a/Classes/PHPExcel/Shared/File.php b/Classes/PHPExcel/Shared/File.php index e325bb3..69998d4 100644 --- a/Classes/PHPExcel/Shared/File.php +++ b/Classes/PHPExcel/Shared/File.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_File + * PHPExcel\Shared_File * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_File +class Shared_File { /* * Use Temp or File Upload Temp for temporary files diff --git a/Classes/PHPExcel/Shared/Font.php b/Classes/PHPExcel/Shared/Font.php index 32d29df..5c4b1e5 100644 --- a/Classes/PHPExcel/Shared/Font.php +++ b/Classes/PHPExcel/Shared/Font.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_Font + * PHPExcel\Shared_Font * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_Font +class Shared_Font { /* Methods for resolving autosize value */ const AUTOSIZE_METHOD_APPROX = 'approx'; @@ -244,16 +246,16 @@ class PHPExcel_Shared_Font /** * Calculate an (approximate) OpenXML column width, based on font size and text contained * - * @param PHPExcel_Style_Font $font Font object - * @param PHPExcel_RichText|string $cellText Text to calculate width + * @param PHPExcel\Style_Font $font Font object + * @param PHPExcel\RichText|string $cellText Text to calculate width * @param integer $rotation Rotation angle - * @param PHPExcel_Style_Font|NULL $defaultFont Font object + * @param PHPExcel\Style_Font|NULL $defaultFont Font object * @return integer Column width */ - public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) { + public static function calculateColumnWidth(Style_Font $font, $cellText = '', $rotation = 0, Style_Font $defaultFont = null) { // If it is rich text, use plain text - if ($cellText instanceof PHPExcel_RichText) { + if ($cellText instanceof RichText) { $cellText = $cellText->getPlainText(); } @@ -271,7 +273,7 @@ class PHPExcel_Shared_Font try { // If autosize method is set to 'approx', use approximation if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) { - throw new PHPExcel_Exception('AutoSize method is set to approx'); + throw new Exception('AutoSize method is set to approx'); } // Width of text in pixels excl. padding @@ -280,7 +282,7 @@ class PHPExcel_Shared_Font // Excel adds some padding, use 1.07 of the width of an 'n' glyph $columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding - } catch (PHPExcel_Exception $e) { + } catch (Exception $e) { // Width of text in pixels excl. padding, approximation $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation); @@ -289,7 +291,7 @@ class PHPExcel_Shared_Font } // Convert from pixel width to column width - $columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont); + $columnWidth = Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont); // Return return round($columnWidth, 6); @@ -299,14 +301,14 @@ class PHPExcel_Shared_Font * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle * * @param string $text - * @param PHPExcel_Style_Font + * @param PHPExcel\Style_Font * @param int $rotation * @return int - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) { + public static function getTextWidthPixelsExact($text, Style_Font $font, $rotation = 0) { if (!function_exists('imagettfbbox')) { - throw new PHPExcel_Exception('GD library needs to be enabled'); + throw new Exception('GD library needs to be enabled'); } // font size should really be supplied in pixels in GD2, @@ -334,11 +336,11 @@ class PHPExcel_Shared_Font * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle * * @param string $columnText - * @param PHPExcel_Style_Font $font + * @param PHPExcel\Style_Font $font * @param int $rotation * @return int Text width in pixels (no padding added) */ - public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0) + public static function getTextWidthPixelsApprox($columnText, Style_Font $font = null, $rotation = 0) { $fontName = $font->getName(); $fontSize = $font->getSize(); @@ -347,25 +349,25 @@ class PHPExcel_Shared_Font switch ($fontName) { case 'Calibri': // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font. - $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8.26 * Shared_String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size break; case 'Arial': // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font. - $columnWidth = (int) (7 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (7 * Shared_String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; case 'Verdana': // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. - $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8 * Shared_String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; default: // just assume Calibri - $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8.26 * Shared_String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size break; } @@ -420,12 +422,12 @@ class PHPExcel_Shared_Font /** * Returns the font path given the font * - * @param PHPExcel_Style_Font + * @param PHPExcel\Style_Font * @return string Path to TrueType font file */ public static function getTrueTypeFontFileFromFont($font) { if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) { - throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified'); + throw new Exception('Valid directory to TrueType Font files not specified'); } $name = $font->getName(); @@ -530,7 +532,7 @@ class PHPExcel_Shared_Font break; default: - throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); + throw new Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); break; } @@ -538,7 +540,7 @@ class PHPExcel_Shared_Font // Check if file actually exists if (!file_exists($fontFile)) { - throw New PHPExcel_Exception('TrueType Font file not found'); + throw New Exception('TrueType Font file not found'); } return $fontFile; @@ -566,11 +568,11 @@ class PHPExcel_Shared_Font * Get the effective column width for columns without a column dimension or column with width -1 * For example, for Calibri 11 this is 9.140625 (64 px) * - * @param PHPExcel_Style_Font $font The workbooks default font + * @param PHPExcel\Style_Font $font The workbooks default font * @param boolean $pPixels true = return column width in pixels, false = return in OOXML units * @return mixed Column width */ - public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false) + public static function getDefaultColumnWidthByFont(Style_Font $font, $pPixels = false) { if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) { // Exact width can be determined @@ -599,10 +601,10 @@ class PHPExcel_Shared_Font * Get the effective row height for rows without a row dimension or rows with height -1 * For example, for Calibri 11 this is 15 points * - * @param PHPExcel_Style_Font $font The workbooks default font + * @param PHPExcel\Style_Font $font The workbooks default font * @return float Row height in points */ - public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font) + public static function getDefaultRowHeightByFont(Style_Font $font) { switch ($font->getName()) { case 'Arial': diff --git a/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php b/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php index cfbaa53..95e5297 100644 --- a/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php +++ b/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php @@ -73,7 +73,7 @@ class CholeskyDecomposition { } } } else { - throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); + throw new PHPExcel\Calculation_Exception(JAMAError(ArgumentTypeException)); } } // function __construct() @@ -136,13 +136,13 @@ class CholeskyDecomposition { return new Matrix($X, $this->m, $nx); } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException)); + throw new PHPExcel\Calculation_Exception(JAMAError(MatrixSPDException)); } } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException)); + throw new PHPExcel\Calculation_Exception(JAMAError(MatrixDimensionException)); } } else { - throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); + throw new PHPExcel\Calculation_Exception(JAMAError(ArgumentTypeException)); } } // function solve() diff --git a/Classes/PHPExcel/Shared/OLE.php b/Classes/PHPExcel/Shared/OLE.php index 9796282..9f2729c 100644 --- a/Classes/PHPExcel/Shared/OLE.php +++ b/Classes/PHPExcel/Shared/OLE.php @@ -20,6 +20,8 @@ // $Id: OLE.php,v 1.13 2007/03/07 14:38:25 schmidt Exp $ +namespace PHPExcel; + /** * Array for storing OLE instances that are accessed from * OLE_ChainedBlockStream::stream_open(). @@ -33,9 +35,9 @@ $GLOBALS['_OLE_INSTANCES'] = array(); * @author Xavier Noguer * @author Christian Schmidt * @category PHPExcel -* @package PHPExcel_Shared_OLE +* @package PHPExcel\Shared_OLE */ -class PHPExcel_Shared_OLE +class Shared_OLE { const OLE_PPS_TYPE_ROOT = 5; const OLE_PPS_TYPE_DIR = 1; @@ -97,18 +99,18 @@ class PHPExcel_Shared_OLE { $fh = fopen($file, "r"); if (!$fh) { - throw new PHPExcel_Reader_Exception("Can't open file $file"); + throw new Reader_Exception("Can't open file $file"); } $this->_file_handle = $fh; $signature = fread($fh, 8); if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) { - throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container."); + throw new Reader_Exception("File doesn't seem to be an OLE container."); } fseek($fh, 28); if (fread($fh, 2) != "\xFE\xFF") { // This shouldn't be a problem in practice - throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported."); + throw new Reader_Exception("Only Little-Endian encoding is supported."); } // Size of blocks and short blocks in bytes $this->bigBlockSize = pow(2, self::_readInt2($fh)); @@ -190,7 +192,7 @@ class PHPExcel_Shared_OLE /** * Returns a stream for use with fread() etc. External callers should - * use PHPExcel_Shared_OLE_PPS_File::getStream(). + * use PHPExcel\Shared_OLE_PPS_File::getStream(). * @param int|PPS block id or PPS * @return resource read-only stream */ @@ -199,7 +201,7 @@ class PHPExcel_Shared_OLE static $isRegistered = false; if (!$isRegistered) { stream_wrapper_register('ole-chainedblockstream', - 'PHPExcel_Shared_OLE_ChainedBlockStream'); + __NAMESPACE__ . '\Shared_OLE_ChainedBlockStream'); $isRegistered = true; } @@ -210,7 +212,7 @@ class PHPExcel_Shared_OLE $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES'])); $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; - if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) { + if ($blockIdOrPps instanceof Shared_OLE_PPS) { $path .= '&blockId=' . $blockIdOrPps->_StartBlock; $path .= '&size=' . $blockIdOrPps->Size; } else { @@ -276,15 +278,15 @@ class PHPExcel_Shared_OLE $type = self::_readInt1($fh); switch ($type) { case self::OLE_PPS_TYPE_ROOT: - $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array()); + $pps = new Shared_OLE_PPS_Root(null, null, array()); $this->root = $pps; break; case self::OLE_PPS_TYPE_DIR: - $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, + $pps = new Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array()); break; case self::OLE_PPS_TYPE_FILE: - $pps = new PHPExcel_Shared_OLE_PPS_File($name); + $pps = new Shared_OLE_PPS_File($name); break; default: continue; diff --git a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php index 025c6cb..95758dc 100644 --- a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php +++ b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php @@ -19,23 +19,26 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_OLE + * @package PHPExcel\Shared_OLE * @copyright Copyright (c) 2006 - 2007 Christian Schmidt * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + /** - * PHPExcel_Shared_OLE_ChainedBlockStream + * PHPExcel\Shared_OLE_ChainedBlockStream * * Stream wrapper for reading data stored in an OLE file. Implements methods * for PHP's stream_wrapper_register(). For creating streams using this - * wrapper, use PHPExcel_Shared_OLE_PPS_File::getStream(). + * wrapper, use PHPExcel\Shared_OLE_PPS_File::getStream(). * * @category PHPExcel - * @package PHPExcel_Shared_OLE + * @package PHPExcel\Shared_OLE */ -class PHPExcel_Shared_OLE_ChainedBlockStream +class Shared_OLE_ChainedBlockStream { /** * The OLE container of the file that is being read. diff --git a/Classes/PHPExcel/Shared/OLE/PPS.php b/Classes/PHPExcel/Shared/OLE/PPS.php index 4db0ae4..619427a 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS.php +++ b/Classes/PHPExcel/Shared/OLE/PPS.php @@ -20,14 +20,16 @@ // $Id: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $ +namespace PHPExcel; + /** * Class for creating PPS's for OLE containers * * @author Xavier Noguer * @category PHPExcel -* @package PHPExcel_Shared_OLE +* @package PHPExcel\Shared_OLE */ -class PHPExcel_Shared_OLE_PPS +class Shared_OLE_PPS { /** * The PPS index @@ -182,8 +184,8 @@ class PHPExcel_Shared_OLE_PPS . "\xc0\x00\x00\x00" // 92 . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root . "\x00\x00\x00\x00" // 100 - . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108 - . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116 + . Shared_OLE::LocalDate2OLE($this->Time1st) // 108 + . Shared_OLE::LocalDate2OLE($this->Time2nd) // 116 . pack("V", isset($this->_StartBlock)? $this->_StartBlock:0) // 120 . pack("V", $this->Size) // 124 diff --git a/Classes/PHPExcel/Shared/OLE/PPS/File.php b/Classes/PHPExcel/Shared/OLE/PPS/File.php index f061f56..ce3275d 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS/File.php +++ b/Classes/PHPExcel/Shared/OLE/PPS/File.php @@ -20,14 +20,16 @@ // $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $ +namespace PHPExcel; + /** * Class for creating File PPS's for OLE containers * * @author Xavier Noguer * @category PHPExcel -* @package PHPExcel_Shared_OLE +* @package PHPExcel\Shared_OLE */ -class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS +class Shared_OLE_PPS_File extends Shared_OLE_PPS { /** * The constructor @@ -41,7 +43,7 @@ class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS parent::__construct( null, $name, - PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, + Shared_OLE::OLE_PPS_TYPE_FILE, null, null, null, diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php index eb929d2..f21ec85 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS/Root.php +++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php @@ -20,14 +20,16 @@ // $Id: Root.php,v 1.9 2005/04/23 21:53:49 dufuz Exp $ +namespace PHPExcel; + /** * Class for creating Root PPS's for OLE containers * * @author Xavier Noguer * @category PHPExcel -* @package PHPExcel_Shared_OLE +* @package PHPExcel\Shared_OLE */ -class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS +class Shared_OLE_PPS_Root extends Shared_OLE_PPS { /** @@ -42,12 +44,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS */ public function __construct($time_1st, $time_2nd, $raChild) { - $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->_tempDir = Shared_File::sys_get_temp_dir(); parent::__construct( null, - PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'), - PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT, + Shared_OLE::Asc2Ucs('Root Entry'), + Shared_OLE::OLE_PPS_TYPE_ROOT, null, null, null, @@ -80,21 +82,21 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $this->_FILEH_ = $filename; } else if ($filename == '-' || $filename == '') { if ($this->_tmp_dir === NULL) - $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->_tmp_dir = Shared_File::sys_get_temp_dir(); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); if ($this->_FILEH_ == false) { - throw new PHPExcel_Writer_Exception("Can't create temporary file."); + throw new Writer_Exception("Can't create temporary file."); } } else { $this->_FILEH_ = fopen($filename, "wb"); } if ($this->_FILEH_ == false) { - throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected."); + throw new Writer_Exception("Can't open $filename. It may be in use or protected."); } // Make an array of PPS's (for Save) $aList = array(); - PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this)); + Shared_OLE_PPS::_savePpsSetPnt($aList, array($this)); // calculate values for header list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo); // Save Header @@ -132,9 +134,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $iSBcnt = 0; $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { - if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Type == Shared_OLE::OLE_PPS_TYPE_FILE) { $raList[$i]->Size = $raList[$i]->_DataLen(); - if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + if ($raList[$i]->Size < 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 { @@ -144,12 +146,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } } $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; - $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + $iSlCnt = floor($this->_BIG_BLOCK_SIZE / 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; + $iBdCnt = $this->_BIG_BLOCK_SIZE / Shared_OLE::OLE_PPS_SIZE; $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); return array($iSBDcnt, $iBBcnt, $iPPScnt); @@ -182,8 +184,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $FILE = $this->_FILEH_; // Calculate Basic Setting - $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; - $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + $iBlCnt = $this->_BIG_BLOCK_SIZE / Shared_OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / Shared_OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; @@ -249,7 +251,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } /** - * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * Saving big data (PPS's with data bigger than PHPExcel\Shared_OLE::OLE_DATA_SIZE_SMALL) * * @access public * @param integer $iStBlk @@ -262,10 +264,10 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS // cycle through PPS's $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { - if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) { + if ($raList[$i]->Type != Shared_OLE::OLE_PPS_TYPE_DIR) { $raList[$i]->Size = $raList[$i]->_DataLen(); - if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || - (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) + if (($raList[$i]->Size >= Shared_OLE::OLE_DATA_SIZE_SMALL) || + (($raList[$i]->Type == Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) { // Write Data //if (isset($raList[$i]->_PPS_FILE)) { @@ -299,7 +301,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } /** - * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * get small data (PPS's with data smaller than PHPExcel\Shared_OLE::OLE_DATA_SIZE_SMALL) * * @access public * @param array &$raList Reference to array of PPS's @@ -313,11 +315,11 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { // Make SBD, small data string - if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Type == Shared_OLE::OLE_PPS_TYPE_FILE) { if ($raList[$i]->Size <= 0) { continue; } - if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + if ($raList[$i]->Size < Shared_OLE::OLE_DATA_SIZE_SMALL) { $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); // Add to SBD @@ -345,7 +347,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } } } - $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + $iSbCnt = floor($this->_BIG_BLOCK_SIZE / Shared_OLE::OLE_LONG_INT_SIZE); if ($iSmBlk % $iSbCnt) { $iB = $iSbCnt - ($iSmBlk % $iSbCnt); for ($i = 0; $i < $iB; ++$i) { @@ -370,9 +372,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } // Adjust for Block $iCnt = count($raList); - $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; + $iBCnt = $this->_BIG_BLOCK_SIZE / Shared_OLE::OLE_PPS_SIZE; if ($iCnt % $iBCnt) { - fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE)); + fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * Shared_OLE::OLE_PPS_SIZE)); } } @@ -388,8 +390,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS { $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; + $iBbCnt = $this->_BIG_BLOCK_SIZE / Shared_OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / Shared_OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBsize + $iPpsCnt + $iSbdSize; diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php index 30e12a4..e591efb 100644 --- a/Classes/PHPExcel/Shared/OLERead.php +++ b/Classes/PHPExcel/Shared/OLERead.php @@ -19,16 +19,19 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ + +namespace PHPExcel; + defined('IDENTIFIER_OLE') || define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); -class PHPExcel_Shared_OLERead { +class Shared_OLERead { private $data = ''; // OLE identifier @@ -71,13 +74,13 @@ class PHPExcel_Shared_OLERead { * Read the file * * @param $sFileName string Filename - * @throws PHPExcel_Reader_Exception + * @throws PHPExcel\Reader_Exception */ public function read($sFileName) { // Check if file exists and is readable if(!is_readable($sFileName)) { - throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); + throw new Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); } // Get the file identifier @@ -86,7 +89,7 @@ class PHPExcel_Shared_OLERead { // Check OLE identifier if ($this->data != self::IDENTIFIER_OLE) { - throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); + throw new Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); } // Get the file data diff --git a/Classes/PHPExcel/Shared/PasswordHasher.php b/Classes/PHPExcel/Shared/PasswordHasher.php index 270e54d..42c045d 100644 --- a/Classes/PHPExcel/Shared/PasswordHasher.php +++ b/Classes/PHPExcel/Shared/PasswordHasher.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_PasswordHasher + * PHPExcel\Shared_PasswordHasher * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_PasswordHasher +class Shared_PasswordHasher { /** * Create a password hash from a given string. diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index 3ba1be2..90227cf 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_String + * PHPExcel\Shared_String * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_String +class Shared_String { /** Constants */ /** Regular Expressions */ @@ -637,7 +639,7 @@ class PHPExcel_Shared_String if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) { $sign = ($match[1] == '-') ? '-' : '+'; $fractionFormula = '='.$sign.$match[2].$sign.$match[3]; - $operand = PHPExcel_Calculation::getInstance()->_calculateFormulaValue($fractionFormula); + $operand = Calculation::getInstance()->_calculateFormulaValue($fractionFormula); return true; } return false; @@ -665,8 +667,8 @@ class PHPExcel_Shared_String } /** - * Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the decimal separator. Only used by PHPExcel\Style_NumberFormat::toFormattedString() + * to format output by PHPExcel\Writer_HTML and PHPExcel\Writer_PDF * * @param string $pValue Character for decimal separator */ @@ -697,8 +699,8 @@ class PHPExcel_Shared_String } /** - * Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the thousands separator. Only used by PHPExcel\Style_NumberFormat::toFormattedString() + * to format output by PHPExcel\Writer_HTML and PHPExcel\Writer_PDF * * @param string $pValue Character for thousands separator */ @@ -729,8 +731,8 @@ class PHPExcel_Shared_String } /** - * Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the currency code. Only used by PHPExcel\Style_NumberFormat::toFormattedString() + * to format output by PHPExcel\Writer_HTML and PHPExcel\Writer_PDF * * @param string $pValue Character for currency code */ diff --git a/Classes/PHPExcel/Shared/TimeZone.php b/Classes/PHPExcel/Shared/TimeZone.php index 9f1ba4a..cfea9c2 100644 --- a/Classes/PHPExcel/Shared/TimeZone.php +++ b/Classes/PHPExcel/Shared/TimeZone.php @@ -20,21 +20,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_TimeZone + * PHPExcel\Shared_TimeZone * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_TimeZone +class Shared_TimeZone { /* * Default Timezone used for date/time conversions @@ -112,12 +114,12 @@ class PHPExcel_Shared_TimeZone * @param string $timezone The timezone for finding the adjustment to UST * @param integer $timestamp PHP date/time value * @return integer Number of seconds for timezone adjustment - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public static function getTimeZoneAdjustment($timezone, $timestamp) { if ($timezone !== NULL) { if (!self::_validateTimezone($timezone)) { - throw new PHPExcel_Exception("Invalid timezone " . $timezone); + throw new Exception("Invalid timezone " . $timezone); } } else { $timezone = self::$_timezone; diff --git a/Classes/PHPExcel/Shared/XMLWriter.php b/Classes/PHPExcel/Shared/XMLWriter.php index dfbcef8..1e5a752 100644 --- a/Classes/PHPExcel/Shared/XMLWriter.php +++ b/Classes/PHPExcel/Shared/XMLWriter.php @@ -19,29 +19,27 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -if (!defined('DATE_W3C')) { + +namespace PHPExcel; + + if (!defined('DATE_W3C')) { define('DATE_W3C', 'Y-m-d\TH:i:sP'); } -if (!defined('DEBUGMODE_ENABLED')) { - define('DEBUGMODE_ENABLED', false); -} - - /** - * PHPExcel_Shared_XMLWriter + * PHPExcel\Shared_XMLWriter * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_XMLWriter extends XMLWriter { +class Shared_XMLWriter extends \XMLWriter { /** Temporary storage method */ const STORAGE_MEMORY = 1; const STORAGE_DISK = 2; @@ -54,7 +52,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter { private $_tempFileName = ''; /** - * Create a new PHPExcel_Shared_XMLWriter instance + * Create a new PHPExcel\Shared_XMLWriter instance * * @param int $pTemporaryStorage Temporary storage location * @param string $pTemporaryStorageFolder Temporary storage folder @@ -66,7 +64,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter { } else { // Create temporary filename if ($pTemporaryStorageFolder === NULL) - $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir(); + $pTemporaryStorageFolder = Shared_File::sys_get_temp_dir(); $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); // Open storage @@ -75,11 +73,6 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter { $this->openMemory(); } } - - // Set default values - if (DEBUGMODE_ENABLED) { - $this->setIndent(true); - } } /** diff --git a/Classes/PHPExcel/Shared/ZipArchive.php b/Classes/PHPExcel/Shared/ZipArchive.php index 50e2240..7fc26f3 100644 --- a/Classes/PHPExcel/Shared/ZipArchive.php +++ b/Classes/PHPExcel/Shared/ZipArchive.php @@ -19,26 +19,29 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared_ZipArchive + * @package PHPExcel\Shared_ZipArchive * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -if (!defined('PCLZIP_TEMPORARY_DIR')) { - define('PCLZIP_TEMPORARY_DIR', PHPExcel_Shared_File::sys_get_temp_dir()); + +namespace PHPExcel; + + if (!defined('PCLZIP_TEMPORARY_DIR')) { + define('PCLZIP_TEMPORARY_DIR', Shared_File::sys_get_temp_dir()); } require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php'; /** - * PHPExcel_Shared_ZipArchive + * PHPExcel\Shared_ZipArchive * * @category PHPExcel - * @package PHPExcel_Shared_ZipArchive + * @package PHPExcel\Shared_ZipArchive * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_ZipArchive +class Shared_ZipArchive { /** constants */ @@ -69,7 +72,7 @@ class PHPExcel_Shared_ZipArchive */ public function open($fileName) { - $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->_tempDir = Shared_File::sys_get_temp_dir(); $this->_zip = new PclZip($fileName); @@ -105,7 +108,7 @@ class PHPExcel_Shared_ZipArchive PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"] ); if ($res == 0) { - throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true)); + throw new Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true)); } unlink($this->_tempDir.'/'.$filenameParts["basename"]); diff --git a/Classes/PHPExcel/Shared/ZipStreamWrapper.php b/Classes/PHPExcel/Shared/ZipStreamWrapper.php index cc401ce..1ce89e1 100644 --- a/Classes/PHPExcel/Shared/ZipStreamWrapper.php +++ b/Classes/PHPExcel/Shared/ZipStreamWrapper.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_ZipStreamWrapper + * PHPExcel\Shared_ZipStreamWrapper * * @category PHPExcel - * @package PHPExcel_Shared + * @package PHPExcel\Shared * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Shared_ZipStreamWrapper { +class Shared_ZipStreamWrapper { /** * Internal ZipAcrhive * @@ -82,7 +84,7 @@ class PHPExcel_Shared_ZipStreamWrapper { public function stream_open($path, $mode, $options, &$opened_path) { // Check for mode if ($mode{0} != 'r') { - throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); + throw new Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); } $pos = strrpos($path, '#'); diff --git a/Classes/PHPExcel/Style.php b/Classes/PHPExcel/Style.php index 7669b69..788f362 100644 --- a/Classes/PHPExcel/Style.php +++ b/Classes/PHPExcel/Style.php @@ -19,68 +19,70 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Style + * PHPExcel\Style * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style extends Style_Supervisor implements IComparable { /** * Font * - * @var PHPExcel_Style_Font + * @var PHPExcel\Style_Font */ protected $_font; /** * Fill * - * @var PHPExcel_Style_Fill + * @var PHPExcel\Style_Fill */ protected $_fill; /** * Borders * - * @var PHPExcel_Style_Borders + * @var PHPExcel\Style_Borders */ protected $_borders; /** * Alignment * - * @var PHPExcel_Style_Alignment + * @var PHPExcel\Style_Alignment */ protected $_alignment; /** * Number Format * - * @var PHPExcel_Style_NumberFormat + * @var PHPExcel\Style_NumberFormat */ protected $_numberFormat; /** * Conditional styles * - * @var PHPExcel_Style_Conditional[] + * @var PHPExcel\Style_Conditional[] */ protected $_conditionalStyles; /** * Protection * - * @var PHPExcel_Style_Protection + * @var PHPExcel\Style_Protection */ protected $_protection; @@ -92,7 +94,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp protected $_index; /** - * Create a new PHPExcel_Style + * Create a new PHPExcel\Style * * @param boolean $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -108,12 +110,12 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp // Initialise values $this->_conditionalStyles = array(); - $this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional); - $this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional); - $this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional); - $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional); - $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional); - $this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional); + $this->_font = new Style_Font($isSupervisor, $isConditional); + $this->_fill = new Style_Fill($isSupervisor, $isConditional); + $this->_borders = new Style_Borders($isSupervisor, $isConditional); + $this->_alignment = new Style_Alignment($isSupervisor, $isConditional); + $this->_numberFormat = new Style_NumberFormat($isSupervisor, $isConditional); + $this->_protection = new Style_Protection($isSupervisor, $isConditional); // bind parent if we are a supervisor if ($isSupervisor) { @@ -130,7 +132,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor * - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getSharedComponent() { @@ -166,7 +168,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp * 'name' => 'Arial', * 'bold' => true, * 'italic' => false, - * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, + * 'underline' => PHPExcel\Style_Font::UNDERLINE_DOUBLE, * 'strike' => false, * 'color' => array( * 'rgb' => '808080' @@ -174,13 +176,13 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp * ), * 'borders' => array( * 'bottom' => array( - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'style' => PHPExcel\Style_Border::BORDER_DASHDOT, * 'color' => array( * 'rgb' => '808080' * ) * ), * 'top' => array( - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'style' => PHPExcel\Style_Border::BORDER_DASHDOT, * 'color' => array( * 'rgb' => '808080' * ) @@ -192,8 +194,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp * * @param array $pStyles Array containing style information * @param boolean $pAdvanced Advanced mode for setting borders. - * @throws PHPExcel_Exception - * @return PHPExcel_Style + * @throws PHPExcel\Exception + * @return PHPExcel\Style */ public function applyFromArray($pStyles = null, $pAdvanced = true) { @@ -214,12 +216,12 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp } // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + $rangeStart = Cell::coordinateFromString($rangeA); + $rangeEnd = Cell::coordinateFromString($rangeB); // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + $rangeStart[0] = Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = Cell::columnIndexFromString($rangeEnd[0]) - 1; // Make sure we can loop upwards on rows and columns if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { @@ -273,13 +275,13 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp for ($x = 1; $x <= $xMax; ++$x) { // start column index for region $colStart = ($x == 3) ? - PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]) - : PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); + Cell::stringFromColumnIndex($rangeEnd[0]) + : Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); // end column index for region $colEnd = ($x == 1) ? - PHPExcel_Cell::stringFromColumnIndex($rangeStart[0]) - : PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); + Cell::stringFromColumnIndex($rangeStart[0]) + : Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); for ($y = 1; $y <= $yMax; ++$y) { @@ -465,7 +467,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp } } } else { - throw new PHPExcel_Exception("Invalid style array passed."); + throw new Exception("Invalid style array passed."); } return $this; } @@ -473,7 +475,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Fill * - * @return PHPExcel_Style_Fill + * @return PHPExcel\Style_Fill */ public function getFill() { @@ -483,7 +485,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Font * - * @return PHPExcel_Style_Font + * @return PHPExcel\Style_Font */ public function getFont() { @@ -493,10 +495,10 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Set font * - * @param PHPExcel_Style_Font $font - * @return PHPExcel_Style + * @param PHPExcel\Style_Font $font + * @return PHPExcel\Style */ - public function setFont(PHPExcel_Style_Font $font) + public function setFont(Style_Font $font) { $this->_font = $font; return $this; @@ -505,7 +507,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Borders * - * @return PHPExcel_Style_Borders + * @return PHPExcel\Style_Borders */ public function getBorders() { @@ -515,7 +517,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Alignment * - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ public function getAlignment() { @@ -525,7 +527,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Number Format * - * @return PHPExcel_Style_NumberFormat + * @return PHPExcel\Style_NumberFormat */ public function getNumberFormat() { @@ -535,7 +537,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Conditional Styles. Only used on supervisor. * - * @return PHPExcel_Style_Conditional[] + * @return PHPExcel\Style_Conditional[] */ public function getConditionalStyles() { @@ -545,8 +547,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Set Conditional Styles. Only used on supervisor. * - * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles - * @return PHPExcel_Style + * @param PHPExcel\Style_Conditional[] $pValue Array of condtional styles + * @return PHPExcel\Style */ public function setConditionalStyles($pValue = null) { @@ -559,7 +561,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp /** * Get Protection * - * @return PHPExcel_Style_Protection + * @return PHPExcel\Style_Protection */ public function getProtection() { diff --git a/Classes/PHPExcel/Style/Alignment.php b/Classes/PHPExcel/Style/Alignment.php index 5bf2fa6..754425c 100644 --- a/Classes/PHPExcel/Style/Alignment.php +++ b/Classes/PHPExcel/Style/Alignment.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Style_Alignment + * PHPExcel\Style_Alignment * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Alignment extends Style_Supervisor implements IComparable { /* Horizontal alignment styles */ const HORIZONTAL_GENERAL = 'general'; @@ -54,14 +56,14 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * * @var string */ - protected $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + protected $_horizontal = Style_Alignment::HORIZONTAL_GENERAL; /** * Vertical * * @var string */ - protected $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + protected $_vertical = Style_Alignment::VERTICAL_BOTTOM; /** * Text rotation @@ -92,7 +94,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE protected $_indent = 0; /** - * Create a new PHPExcel_Style_Alignment + * Create a new PHPExcel\Style_Alignment * * @param boolean $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -117,7 +119,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor * - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ public function getSharedComponent() { @@ -141,8 +143,8 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( * array( - * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, - * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, + * 'horizontal' => PHPExcel\Style_Alignment::HORIZONTAL_CENTER, + * 'vertical' => PHPExcel\Style_Alignment::VERTICAL_CENTER, * 'rotation' => 0, * 'wrap' => TRUE * ) @@ -150,8 +152,8 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * * * @param array $pStyles Array containing style information - * @throws PHPExcel_Exception - * @return PHPExcel_Style_Alignment + * @throws PHPExcel\Exception + * @return PHPExcel\Style_Alignment */ public function applyFromArray($pStyles = NULL) { if (is_array($pStyles)) { @@ -179,7 +181,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE } } } else { - throw new PHPExcel_Exception("Invalid style array passed."); + throw new Exception("Invalid style array passed."); } return $this; } @@ -200,11 +202,11 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set Horizontal * * @param string $pValue - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ - public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { + public function setHorizontal($pValue = Style_Alignment::HORIZONTAL_GENERAL) { if ($pValue == '') { - $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + $pValue = Style_Alignment::HORIZONTAL_GENERAL; } if ($this->_isSupervisor) { @@ -233,11 +235,11 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set Vertical * * @param string $pValue - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ - public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) { + public function setVertical($pValue = Style_Alignment::VERTICAL_BOTTOM) { if ($pValue == '') { - $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + $pValue = Style_Alignment::VERTICAL_BOTTOM; } if ($this->_isSupervisor) { @@ -265,8 +267,8 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set TextRotation * * @param int $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Style_Alignment + * @throws PHPExcel\Exception + * @return PHPExcel\Style_Alignment */ public function setTextRotation($pValue = 0) { // Excel2007 value 255 => PHPExcel value -165 @@ -283,7 +285,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE $this->_textRotation = $pValue; } } else { - throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90."); + throw new Exception("Text rotation should be a value between -90 and 90."); } return $this; @@ -305,7 +307,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set Wrap Text * * @param boolean $pValue - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ public function setWrapText($pValue = FALSE) { if ($pValue == '') { @@ -336,7 +338,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set Shrink to fit * * @param boolean $pValue - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ public function setShrinkToFit($pValue = FALSE) { if ($pValue == '') { @@ -367,7 +369,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE * Set indent * * @param int $pValue - * @return PHPExcel_Style_Alignment + * @return PHPExcel\Style_Alignment */ public function setIndent($pValue = 0) { if ($pValue > 0) { diff --git a/Classes/PHPExcel/Style/Border.php b/Classes/PHPExcel/Style/Border.php index b75f82c..fb469b5 100644 --- a/Classes/PHPExcel/Style/Border.php +++ b/Classes/PHPExcel/Style/Border.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_Border * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Border extends Style_Supervisor implements IComparable { /* Border style */ const BORDER_NONE = 'none'; @@ -56,7 +58,7 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce * * @var string */ - protected $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; + protected $_borderStyle = Style_Border::BORDER_NONE; /** * Border color @@ -88,7 +90,7 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce parent::__construct($isSupervisor); // Initialise values - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); + $this->_color = new Style_Color(Style_Color::COLOR_BLACK, $isSupervisor); // bind parent if we are a supervisor if ($isSupervisor) { @@ -125,7 +127,7 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce case '_inside': case '_outline': case '_vertical': - throw new PHPExcel_Exception('Cannot get shared component for a pseudo-border.'); + throw new Exception('Cannot get shared component for a pseudo-border.'); break; case '_bottom': return $this->_parent->getSharedComponent()->getBottom(); break; diff --git a/Classes/PHPExcel/Style/Borders.php b/Classes/PHPExcel/Style/Borders.php index ccb1be8..01f4709 100644 --- a/Classes/PHPExcel/Style/Borders.php +++ b/Classes/PHPExcel/Style/Borders.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_Borders * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Borders extends Style_Supervisor implements IComparable { /* Diagonal directions */ const DIAGONAL_NONE = 0; @@ -134,21 +136,21 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc parent::__construct($isSupervisor); // Initialise values - $this->_left = new PHPExcel_Style_Border($isSupervisor, $isConditional); - $this->_right = new PHPExcel_Style_Border($isSupervisor, $isConditional); - $this->_top = new PHPExcel_Style_Border($isSupervisor, $isConditional); - $this->_bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional); - $this->_diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional); - $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE; + $this->_left = new Style_Border($isSupervisor, $isConditional); + $this->_right = new Style_Border($isSupervisor, $isConditional); + $this->_top = new Style_Border($isSupervisor, $isConditional); + $this->_bottom = new Style_Border($isSupervisor, $isConditional); + $this->_diagonal = new Style_Border($isSupervisor, $isConditional); + $this->_diagonalDirection = Style_Borders::DIAGONAL_NONE; // Specially for supervisor if ($isSupervisor) { // Initialize pseudo-borders - $this->_allBorders = new PHPExcel_Style_Border(TRUE); - $this->_outline = new PHPExcel_Style_Border(TRUE); - $this->_inside = new PHPExcel_Style_Border(TRUE); - $this->_vertical = new PHPExcel_Style_Border(TRUE); - $this->_horizontal = new PHPExcel_Style_Border(TRUE); + $this->_allBorders = new Style_Border(TRUE); + $this->_outline = new Style_Border(TRUE); + $this->_inside = new Style_Border(TRUE); + $this->_vertical = new Style_Border(TRUE); + $this->_horizontal = new Style_Border(TRUE); // bind parent if we are a supervisor $this->_left->bindParent($this, '_left'); @@ -388,9 +390,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc * @param int $pValue * @return PHPExcel_Style_Borders */ - public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE) { + public function setDiagonalDirection($pValue = Style_Borders::DIAGONAL_NONE) { if ($pValue == '') { - $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE; + $pValue = Style_Borders::DIAGONAL_NONE; } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue)); diff --git a/Classes/PHPExcel/Style/Color.php b/Classes/PHPExcel/Style/Color.php index 6248862..5226bdb 100644 --- a/Classes/PHPExcel/Style/Color.php +++ b/Classes/PHPExcel/Style/Color.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_Style_Color + * PHPExcel\Style_Color * * @category PHPExcel * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Color extends Style_Supervisor implements IComparable { /* Colors */ const COLOR_BLACK = 'FF000000'; diff --git a/Classes/PHPExcel/Style/Conditional.php b/Classes/PHPExcel/Style/Conditional.php index 1d3f950..1194c43 100644 --- a/Classes/PHPExcel/Style/Conditional.php +++ b/Classes/PHPExcel/Style/Conditional.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_Conditional * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Conditional implements PHPExcel_IComparable +class Style_Conditional implements IComparable { /* Condition types */ const CONDITION_NONE = 'none'; @@ -96,11 +98,11 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable public function __construct() { // Initialise values - $this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE; - $this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE; + $this->_conditionType = Style_Conditional::CONDITION_NONE; + $this->_operatorType = Style_Conditional::OPERATOR_NONE; $this->_text = null; $this->_condition = array(); - $this->_style = new PHPExcel_Style(FALSE, TRUE); + $this->_style = new Style(FALSE, TRUE); } /** @@ -118,7 +120,7 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable * @param string $pValue PHPExcel_Style_Conditional condition type * @return PHPExcel_Style_Conditional */ - public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE) { + public function setConditionType($pValue = Style_Conditional::CONDITION_NONE) { $this->_conditionType = $pValue; return $this; } @@ -138,7 +140,7 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable * @param string $pValue PHPExcel_Style_Conditional operator type * @return PHPExcel_Style_Conditional */ - public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE) { + public function setOperatorType($pValue = Style_Conditional::OPERATOR_NONE) { $this->_operatorType = $pValue; return $this; } @@ -241,7 +243,7 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable * @throws PHPExcel_Exception * @return PHPExcel_Style_Conditional */ - public function setStyle(PHPExcel_Style $pValue = null) { + public function setStyle(Style $pValue = null) { $this->_style = $pValue; return $this; } diff --git a/Classes/PHPExcel/Style/Fill.php b/Classes/PHPExcel/Style/Fill.php index 8f4eaf3..ac81e77 100644 --- a/Classes/PHPExcel/Style/Fill.php +++ b/Classes/PHPExcel/Style/Fill.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_Fill * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Fill extends Style_Supervisor implements IComparable { /* Fill types */ const FILL_NONE = 'none'; @@ -63,7 +65,7 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_ * * @var string */ - protected $_fillType = PHPExcel_Style_Fill::FILL_NONE; + protected $_fillType = Style_Fill::FILL_NONE; /** * Rotation @@ -105,8 +107,8 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_ if ($isConditional) { $this->_fillType = NULL; } - $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional); - $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional); + $this->_startColor = new Style_Color(Style_Color::COLOR_WHITE, $isSupervisor, $isConditional); + $this->_endColor = new Style_Color(Style_Color::COLOR_BLACK, $isSupervisor, $isConditional); // bind parent if we are a supervisor if ($isSupervisor) { @@ -204,7 +206,7 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_ * @param string $pValue PHPExcel_Style_Fill fill type * @return PHPExcel_Style_Fill */ - public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) { + public function setFillType($pValue = Style_Fill::FILL_NONE) { if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('type' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); diff --git a/Classes/PHPExcel/Style/Font.php b/Classes/PHPExcel/Style/Font.php index 6a00a15..db90ca6 100644 --- a/Classes/PHPExcel/Style/Font.php +++ b/Classes/PHPExcel/Style/Font.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** - * PHPExcel_Style_Font + * PHPExcel\Style\Font * * @category PHPExcel * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Font extends Style_Supervisor implements IComparable { /* Underline types */ const UNDERLINE_NONE = 'none'; @@ -130,9 +132,9 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_ $this->_subScript = NULL; $this->_underline = NULL; $this->_strikethrough = NULL; - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional); + $this->_color = new Style_Color(Style_Color::COLOR_BLACK, $isSupervisor, $isConditional); } else { - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); + $this->_color = new Style_Color(Style_Color::COLOR_BLACK, $isSupervisor); } // bind parent if we are a supervisor if ($isSupervisor) { diff --git a/Classes/PHPExcel/Style/NumberFormat.php b/Classes/PHPExcel/Style/NumberFormat.php index 80347bf..589277c 100644 --- a/Classes/PHPExcel/Style/NumberFormat.php +++ b/Classes/PHPExcel/Style/NumberFormat.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_NumberFormat * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_NumberFormat extends Style_Supervisor implements IComparable { /* Pre-defined formats */ const FORMAT_GENERAL = 'General'; @@ -94,7 +96,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P * * @var string */ - protected $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + protected $_formatCode = Style_NumberFormat::FORMAT_GENERAL; /** * Built-in format Code @@ -199,10 +201,10 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P * @param string $pValue * @return PHPExcel_Style_NumberFormat */ - public function setFormatCode($pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL) + public function setFormatCode($pValue = Style_NumberFormat::FORMAT_GENERAL) { if ($pValue == '') { - $pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + $pValue = Style_NumberFormat::FORMAT_GENERAL; } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('code' => $pValue)); diff --git a/Classes/PHPExcel/Style/Protection.php b/Classes/PHPExcel/Style/Protection.php index a8f65ce..f11d3d8 100644 --- a/Classes/PHPExcel/Style/Protection.php +++ b/Classes/PHPExcel/Style/Protection.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Style_Protection * @@ -33,7 +35,7 @@ * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable +class Style_Protection extends Style_Supervisor implements IComparable { /** Protection styles */ const PROTECTION_INHERIT = 'inherit'; @@ -127,7 +129,7 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP } } } else { - throw new PHPExcel_Exception("Invalid style array passed."); + throw new Exception("Invalid style array passed."); } return $this; } diff --git a/Classes/PHPExcel/Style/Supervisor.php b/Classes/PHPExcel/Style/Supervisor.php index d0fa06b..360ade2 100644 --- a/Classes/PHPExcel/Style/Supervisor.php +++ b/Classes/PHPExcel/Style/Supervisor.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Style_Supervisor + * PHPExcel\Style\Supervisor * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel\Style * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_Style_Supervisor +abstract class Style_Supervisor { /** * Supervisor? diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel/Workbook.php similarity index 82% rename from Classes/PHPExcel.php rename to Classes/PHPExcel/Workbook.php index 7bd0243..4cec695 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel/Workbook.php @@ -25,14 +25,8 @@ * @version ##VERSION##, ##DATE## */ - -/** PHPExcel root directory */ -if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); -} - - +namespace PHPExcel; + /** * PHPExcel * @@ -40,7 +34,7 @@ if (!defined('PHPEXCEL_ROOT')) { * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel +class Workbook { /** * Unique ID @@ -52,28 +46,28 @@ class PHPExcel /** * Document properties * - * @var PHPExcel_DocumentProperties + * @var PHPExcel\DocumentProperties */ private $_properties; /** * Document security * - * @var PHPExcel_DocumentSecurity + * @var PHPExcel\DocumentSecurity */ private $_security; /** * Collection of Worksheet objects * - * @var PHPExcel_Worksheet[] + * @var PHPExcel\Worksheet[] */ private $_workSheetCollection = array(); /** * Calculation Engine * - * @var PHPExcel_Calculation + * @var PHPExcel\Calculation */ private $_calculationEngine = NULL; @@ -87,28 +81,28 @@ class PHPExcel /** * Named ranges * - * @var PHPExcel_NamedRange[] + * @var PHPExcel\NamedRange[] */ private $_namedRanges = array(); /** * CellXf supervisor * - * @var PHPExcel_Style + * @var PHPExcel\Style */ private $_cellXfSupervisor; /** * CellXf collection * - * @var PHPExcel_Style[] + * @var PHPExcel\Style[] */ private $_cellXfCollection = array(); /** * CellStyleXf collection * - * @var PHPExcel_Style[] + * @var PHPExcel\Style[] */ private $_cellStyleXfCollection = array(); @@ -118,29 +112,29 @@ class PHPExcel public function __construct() { $this->_uniqueID = uniqid(); - $this->_calculationEngine = PHPExcel_Calculation::getInstance($this); + $this->_calculationEngine = Calculation::getInstance($this); // Initialise worksheet collection and add one worksheet $this->_workSheetCollection = array(); - $this->_workSheetCollection[] = new PHPExcel_Worksheet($this); + $this->_workSheetCollection[] = new Worksheet($this); $this->_activeSheetIndex = 0; // Create document properties - $this->_properties = new PHPExcel_DocumentProperties(); + $this->_properties = new DocumentProperties(); // Create document security - $this->_security = new PHPExcel_DocumentSecurity(); + $this->_security = new DocumentSecurity(); // Set named ranges $this->_namedRanges = array(); // Create the cellXf supervisor - $this->_cellXfSupervisor = new PHPExcel_Style(true); + $this->_cellXfSupervisor = new Style(true); $this->_cellXfSupervisor->bindParent($this); // Create the default style - $this->addCellXf(new PHPExcel_Style); - $this->addCellStyleXf(new PHPExcel_Style); + $this->addCellXf(new Style); + $this->addCellStyleXf(new Style); } /** @@ -148,7 +142,7 @@ class PHPExcel * */ public function __destruct() { - PHPExcel_Calculation::unsetInstance($this); + Calculation::unsetInstance($this); $this->disconnectWorksheets(); } // function __destruct() @@ -171,7 +165,7 @@ class PHPExcel /** * Return the calculation engine for this worksheet * - * @return PHPExcel_Calculation + * @return PHPExcel\Calculation */ public function getCalculationEngine() { @@ -181,7 +175,7 @@ class PHPExcel /** * Get properties * - * @return PHPExcel_DocumentProperties + * @return PHPExcel\DocumentProperties */ public function getProperties() { @@ -191,9 +185,9 @@ class PHPExcel /** * Set properties * - * @param PHPExcel_DocumentProperties $pValue + * @param PHPExcel\DocumentProperties $pValue */ - public function setProperties(PHPExcel_DocumentProperties $pValue) + public function setProperties(DocumentProperties $pValue) { $this->_properties = $pValue; } @@ -201,7 +195,7 @@ class PHPExcel /** * Get security * - * @return PHPExcel_DocumentSecurity + * @return PHPExcel\DocumentSecurity */ public function getSecurity() { @@ -211,9 +205,9 @@ class PHPExcel /** * Set security * - * @param PHPExcel_DocumentSecurity $pValue + * @param PHPExcel\DocumentSecurity $pValue */ - public function setSecurity(PHPExcel_DocumentSecurity $pValue) + public function setSecurity(DocumentSecurity $pValue) { $this->_security = $pValue; } @@ -221,7 +215,7 @@ class PHPExcel /** * Get active sheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getActiveSheet() { @@ -232,12 +226,12 @@ class PHPExcel * Create sheet and add it to this workbook * * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) - * @return PHPExcel_Worksheet - * @throws PHPExcel_Exception + * @return PHPExcel\Worksheet + * @throws PHPExcel\Exception */ public function createSheet($iSheetIndex = NULL) { - $newSheet = new PHPExcel_Worksheet($this); + $newSheet = new Worksheet($this); $this->addSheet($newSheet, $iSheetIndex); return $newSheet; } @@ -256,15 +250,15 @@ class PHPExcel /** * Add sheet * - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Worksheet $pSheet * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) - * @return PHPExcel_Worksheet - * @throws PHPExcel_Exception + * @return PHPExcel\Worksheet + * @throws PHPExcel\Exception */ - public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL) + public function addSheet(Worksheet $pSheet, $iSheetIndex = NULL) { if ($this->sheetNameExists($pSheet->getTitle())) { - throw new PHPExcel_Exception( + throw new Exception( "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first." ); } @@ -295,7 +289,7 @@ class PHPExcel * Remove sheet by index * * @param int $pIndex Active sheet index - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function removeSheetByIndex($pIndex = 0) { @@ -303,7 +297,7 @@ class PHPExcel $numSheets = count($this->_workSheetCollection); if ($pIndex > $numSheets - 1) { - throw new PHPExcel_Exception( + throw new Exception( "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ); } else { @@ -321,8 +315,8 @@ class PHPExcel * Get sheet by index * * @param int $pIndex Sheet index - * @return PHPExcel_Worksheet - * @throws PHPExcel_Exception + * @return PHPExcel\Worksheet + * @throws PHPExcel\Exception */ public function getSheet($pIndex = 0) { @@ -330,7 +324,7 @@ class PHPExcel $numSheets = count($this->_workSheetCollection); if ($pIndex > $numSheets - 1) { - throw new PHPExcel_Exception( + throw new Exception( "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}." ); } else { @@ -341,7 +335,7 @@ class PHPExcel /** * Get all sheets * - * @return PHPExcel_Worksheet[] + * @return PHPExcel\Worksheet[] */ public function getAllSheets() { @@ -352,7 +346,7 @@ class PHPExcel * Get sheet by name * * @param string $pName Sheet name - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getSheetByName($pName = '') { @@ -369,11 +363,11 @@ class PHPExcel /** * Get index for sheet * - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Worksheet $pSheet * @return Sheet index - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ - public function getIndex(PHPExcel_Worksheet $pSheet) + public function getIndex(Worksheet $pSheet) { foreach ($this->_workSheetCollection as $key => $value) { if ($value->getHashCode() == $pSheet->getHashCode()) { @@ -381,7 +375,7 @@ class PHPExcel } } - throw new PHPExcel_Exception("Sheet does not exist."); + throw new Exception("Sheet does not exist."); } /** @@ -390,7 +384,7 @@ class PHPExcel * @param string $sheetName Sheet name to modify index for * @param int $newIndex New index for the sheet * @return New sheet index - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function setIndexByName($sheetName, $newIndex) { @@ -433,15 +427,15 @@ class PHPExcel * Set active sheet index * * @param int $pIndex Active sheet index - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function setActiveSheetIndex($pIndex = 0) { $numSheets = count($this->_workSheetCollection); if ($pIndex > $numSheets - 1) { - throw new PHPExcel_Exception( + throw new Exception( "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ); } else { @@ -454,17 +448,17 @@ class PHPExcel * Set active sheet index by name * * @param string $pValue Sheet title - * @return PHPExcel_Worksheet - * @throws PHPExcel_Exception + * @return PHPExcel\Worksheet + * @throws PHPExcel\Exception */ public function setActiveSheetIndexByName($pValue = '') { - if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) { + if (($worksheet = $this->getSheetByName($pValue)) instanceof Worksheet) { $this->setActiveSheetIndex($this->getIndex($worksheet)); return $worksheet; } - throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue); + throw new Exception('Workbook does not contain sheet:' . $pValue); } /** @@ -486,14 +480,14 @@ class PHPExcel /** * Add external sheet * - * @param PHPExcel_Worksheet $pSheet External sheet to add + * @param PHPExcel\Worksheet $pSheet External sheet to add * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ - public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) { + public function addExternalSheet(Worksheet $pSheet, $iSheetIndex = null) { if ($this->sheetNameExists($pSheet->getTitle())) { - throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); + throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); } // count how many cellXfs there are in this workbook currently, we will need this below @@ -519,7 +513,7 @@ class PHPExcel /** * Get named ranges * - * @return PHPExcel_NamedRange[] + * @return PHPExcel\NamedRange[] */ public function getNamedRanges() { return $this->_namedRanges; @@ -528,10 +522,10 @@ class PHPExcel /** * Add named range * - * @param PHPExcel_NamedRange $namedRange - * @return PHPExcel + * @param PHPExcel\NamedRange $namedRange + * @return Workbook */ - public function addNamedRange(PHPExcel_NamedRange $namedRange) { + public function addNamedRange(NamedRange $namedRange) { if ($namedRange->getScope() == null) { // global scope $this->_namedRanges[$namedRange->getName()] = $namedRange; @@ -546,10 +540,10 @@ class PHPExcel * Get named range * * @param string $namedRange - * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope - * @return PHPExcel_NamedRange|null + * @param PHPExcel\Worksheet|null $pSheet Scope. Use null for global scope + * @return PHPExcel\NamedRange|null */ - public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + public function getNamedRange($namedRange, Worksheet $pSheet = null) { $returnValue = null; if ($namedRange != '' && ($namedRange !== NULL)) { @@ -571,10 +565,10 @@ class PHPExcel * Remove named range * * @param string $namedRange - * @param PHPExcel_Worksheet|null $pSheet Scope: use null for global scope. + * @param PHPExcel\Worksheet|null $pSheet Scope: use null for global scope. * @return PHPExcel */ - public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + public function removeNamedRange($namedRange, Worksheet $pSheet = null) { if ($pSheet === NULL) { if (isset($this->_namedRanges[$namedRange])) { unset($this->_namedRanges[$namedRange]); @@ -590,10 +584,10 @@ class PHPExcel /** * Get worksheet iterator * - * @return PHPExcel_WorksheetIterator + * @return PHPExcel\WorksheetIterator */ public function getWorksheetIterator() { - return new PHPExcel_WorksheetIterator($this); + return new WorksheetIterator($this); } /** @@ -627,7 +621,7 @@ class PHPExcel /** * Get the workbook collection of cellXfs * - * @return PHPExcel_Style[] + * @return PHPExcel\Style[] */ public function getCellXfCollection() { @@ -638,7 +632,7 @@ class PHPExcel * Get cellXf by index * * @param int $pIndex - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getCellXfByIndex($pIndex = 0) { @@ -649,7 +643,7 @@ class PHPExcel * Get cellXf by hash code * * @param string $pValue - * @return PHPExcel_Style|false + * @return PHPExcel\Style|false */ public function getCellXfByHashCode($pValue = '') { @@ -664,7 +658,7 @@ class PHPExcel /** * Check if style exists in style collection * - * @param PHPExcel_Style $pCellStyle + * @param PHPExcel\Style $pCellStyle * @return boolean */ public function cellXfExists($pCellStyle = null) @@ -675,23 +669,23 @@ class PHPExcel /** * Get default style * - * @return PHPExcel_Style - * @throws PHPExcel_Exception + * @return PHPExcel\Style + * @throws PHPExcel\Exception */ public function getDefaultStyle() { if (isset($this->_cellXfCollection[0])) { return $this->_cellXfCollection[0]; } - throw new PHPExcel_Exception('No default style found for this workbook'); + throw new Exception('No default style found for this workbook'); } /** * Add a cellXf to the workbook * - * @param PHPExcel_Style $style + * @param PHPExcel\Style $style */ - public function addCellXf(PHPExcel_Style $style) + public function addCellXf(Style $style) { $this->_cellXfCollection[] = $style; $style->setIndex(count($this->_cellXfCollection) - 1); @@ -701,12 +695,12 @@ class PHPExcel * Remove cellXf by index. It is ensured that all cells get their xf index updated. * * @param int $pIndex Index to cellXf - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function removeCellXfByIndex($pIndex = 0) { if ($pIndex > count($this->_cellXfCollection) - 1) { - throw new PHPExcel_Exception("CellXf index is out of bounds."); + throw new Exception("CellXf index is out of bounds."); } else { // first remove the cellXf array_splice($this->_cellXfCollection, $pIndex, 1); @@ -731,7 +725,7 @@ class PHPExcel /** * Get the cellXf supervisor * - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getCellXfSupervisor() { @@ -741,7 +735,7 @@ class PHPExcel /** * Get the workbook collection of cellStyleXfs * - * @return PHPExcel_Style[] + * @return PHPExcel\Style[] */ public function getCellStyleXfCollection() { @@ -752,7 +746,7 @@ class PHPExcel * Get cellStyleXf by index * * @param int $pIndex - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getCellStyleXfByIndex($pIndex = 0) { @@ -763,7 +757,7 @@ class PHPExcel * Get cellStyleXf by hash code * * @param string $pValue - * @return PHPExcel_Style|false + * @return PHPExcel\Style|false */ public function getCellStyleXfByHashCode($pValue = '') { @@ -778,9 +772,9 @@ class PHPExcel /** * Add a cellStyleXf to the workbook * - * @param PHPExcel_Style $pStyle + * @param PHPExcel\Style $pStyle */ - public function addCellStyleXf(PHPExcel_Style $pStyle) + public function addCellStyleXf(Style $pStyle) { $this->_cellStyleXfCollection[] = $pStyle; $pStyle->setIndex(count($this->_cellStyleXfCollection) - 1); @@ -790,12 +784,12 @@ class PHPExcel * Remove cellStyleXf by index * * @param int $pIndex - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function removeCellStyleXfByIndex($pIndex = 0) { if ($pIndex > count($this->_cellStyleXfCollection) - 1) { - throw new PHPExcel_Exception("CellStyleXf index is out of bounds."); + throw new Exception("CellStyleXf index is out of bounds."); } else { array_splice($this->_cellStyleXfCollection, $pIndex, 1); } @@ -854,7 +848,7 @@ class PHPExcel // make sure there is always at least one cellXf (there should be) if (empty($this->_cellXfCollection)) { - $this->_cellXfCollection[] = new PHPExcel_Style(); + $this->_cellXfCollection[] = new Style(); } // update the xfIndex for all cells, row dimensions, column dimensions diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 4c7b239..20c43f0 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet + * PHPExcel\Worksheet * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet implements PHPExcel_IComparable +class Worksheet implements IComparable { /* Break types */ const BREAK_NONE = 0; @@ -62,49 +64,49 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Cacheable collection of cells * - * @var PHPExcel_CachedObjectStorage_xxx + * @var PHPExcel\CachedObjectStorage_xxx */ private $_cellCollection = null; /** * Collection of row dimensions * - * @var PHPExcel_Worksheet_RowDimension[] + * @var PHPExcel\Worksheet_RowDimension[] */ private $_rowDimensions = array(); /** * Default row dimension * - * @var PHPExcel_Worksheet_RowDimension + * @var PHPExcel\Worksheet_RowDimension */ private $_defaultRowDimension = null; /** * Collection of column dimensions * - * @var PHPExcel_Worksheet_ColumnDimension[] + * @var PHPExcel\Worksheet_ColumnDimension[] */ private $_columnDimensions = array(); /** * Default column dimension * - * @var PHPExcel_Worksheet_ColumnDimension + * @var PHPExcel\Worksheet_ColumnDimension */ private $_defaultColumnDimension = null; /** * Collection of drawings * - * @var PHPExcel_Worksheet_BaseDrawing[] + * @var PHPExcel\Worksheet_BaseDrawing[] */ private $_drawingCollection = null; /** * Collection of Chart objects * - * @var PHPExcel_Chart[] + * @var PHPExcel\Chart[] */ private $_chartCollection = array(); @@ -125,42 +127,42 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Page setup * - * @var PHPExcel_Worksheet_PageSetup + * @var PHPExcel\Worksheet_PageSetup */ private $_pageSetup; /** * Page margins * - * @var PHPExcel_Worksheet_PageMargins + * @var PHPExcel\Worksheet_PageMargins */ private $_pageMargins; /** * Page header/footer * - * @var PHPExcel_Worksheet_HeaderFooter + * @var PHPExcel\Worksheet_HeaderFooter */ private $_headerFooter; /** * Sheet view * - * @var PHPExcel_Worksheet_SheetView + * @var PHPExcel\Worksheet_SheetView */ private $_sheetView; /** * Protection * - * @var PHPExcel_Worksheet_Protection + * @var PHPExcel\Worksheet_Protection */ private $_protection; /** * Collection of styles * - * @var PHPExcel_Style[] + * @var PHPExcel\Style[] */ private $_styles = array(); @@ -202,7 +204,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Autofilter Range and selection * - * @var PHPExcel_Worksheet_AutoFilter + * @var PHPExcel\Worksheet_AutoFilter */ private $_autoFilter = NULL; @@ -251,7 +253,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Collection of comments * - * @var PHPExcel_Comment[] + * @var PHPExcel\Comment[] */ private $_comments = array(); @@ -307,7 +309,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Tab color * - * @var PHPExcel_Style_Color + * @var PHPExcel\Style_Color */ private $_tabColor; @@ -331,48 +333,48 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param PHPExcel $pParent * @param string $pTitle */ - public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet') + public function __construct(Workbook $pParent = null, $pTitle = 'Worksheet') { // Set parent and title $this->_parent = $pParent; $this->setTitle($pTitle, FALSE); - $this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE); + $this->setSheetState(Worksheet::SHEETSTATE_VISIBLE); - $this->_cellCollection = PHPExcel_CachedObjectStorageFactory::getInstance($this); + $this->_cellCollection = CachedObjectStorageFactory::getInstance($this); // Set page setup - $this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); + $this->_pageSetup = new Worksheet_PageSetup(); // Set page margins - $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); + $this->_pageMargins = new Worksheet_PageMargins(); // Set page header/footer - $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); + $this->_headerFooter = new Worksheet_HeaderFooter(); // Set sheet view - $this->_sheetView = new PHPExcel_Worksheet_SheetView(); + $this->_sheetView = new Worksheet_SheetView(); // Drawing collection - $this->_drawingCollection = new ArrayObject(); + $this->_drawingCollection = new \ArrayObject(); // Chart collection - $this->_chartCollection = new ArrayObject(); + $this->_chartCollection = new \ArrayObject(); // Protection - $this->_protection = new PHPExcel_Worksheet_Protection(); + $this->_protection = new Worksheet_Protection(); // Default row dimension - $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(NULL); + $this->_defaultRowDimension = new Worksheet_RowDimension(NULL); // Default column dimension - $this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(NULL); + $this->_defaultColumnDimension = new Worksheet_ColumnDimension(NULL); - $this->_autoFilter = new PHPExcel_Worksheet_AutoFilter(NULL, $this); + $this->_autoFilter = new Worksheet_AutoFilter(NULL, $this); } /** - * Disconnect all cells from this PHPExcel_Worksheet object, + * Disconnect all cells from this PHPExcel\Worksheet object, * typically so that the worksheet object can be unset * */ @@ -390,7 +392,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * */ function __destruct() { - PHPExcel_Calculation::getInstance($this->_parent) + Calculation::getInstance($this->_parent) ->clearCalculationCacheForWorksheet($this->_title); $this->disconnectCells(); @@ -399,7 +401,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Return the cache controller for the cell collection * - * @return PHPExcel_CachedObjectStorage_xxx + * @return PHPExcel\CachedObjectStorage_xxx */ public function getCellCacheController() { return $this->_cellCollection; @@ -421,18 +423,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param string $pValue The string to check * @return string The valid string - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ private static function _checkSheetTitle($pValue) { // Some of the printable ASCII characters are invalid: * : / \ ? [ ] if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) { - throw new PHPExcel_Exception('Invalid character found in sheet title'); + throw new Exception('Invalid character found in sheet title'); } // Maximum 31 characters allowed for sheet title - if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) { - throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet title.'); + if (Shared_String::CountCharacters($pValue) > 31) { + throw new Exception('Maximum 31 characters allowed in sheet title.'); } return $pValue; @@ -442,7 +444,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get collection of cells * * @param boolean $pSorted Also sort the cell collection? - * @return PHPExcel_Cell[] + * @return PHPExcel\Cell[] */ public function getCellCollection($pSorted = true) { @@ -459,7 +461,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Sort collection of cells * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function sortCellCollection() { @@ -472,7 +474,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of row dimensions * - * @return PHPExcel_Worksheet_RowDimension[] + * @return PHPExcel\Worksheet_RowDimension[] */ public function getRowDimensions() { @@ -482,7 +484,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get default row dimension * - * @return PHPExcel_Worksheet_RowDimension + * @return PHPExcel\Worksheet_RowDimension */ public function getDefaultRowDimension() { @@ -492,7 +494,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of column dimensions * - * @return PHPExcel_Worksheet_ColumnDimension[] + * @return PHPExcel\Worksheet_ColumnDimension[] */ public function getColumnDimensions() { @@ -502,7 +504,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get default column dimension * - * @return PHPExcel_Worksheet_ColumnDimension + * @return PHPExcel\Worksheet_ColumnDimension */ public function getDefaultColumnDimension() { @@ -512,7 +514,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of drawings * - * @return PHPExcel_Worksheet_BaseDrawing[] + * @return PHPExcel\Worksheet_BaseDrawing[] */ public function getDrawingCollection() { @@ -522,7 +524,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of charts * - * @return PHPExcel_Chart[] + * @return PHPExcel\Chart[] */ public function getChartCollection() { @@ -532,11 +534,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Add chart * - * @param PHPExcel_Chart $pChart + * @param PHPExcel\Chart $pChart * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) - * @return PHPExcel_Chart + * @return PHPExcel\Chart */ - public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null) + public function addChart(Chart $pChart = null, $iChartIndex = null) { $pChart->setWorksheet($this); if (is_null($iChartIndex)) { @@ -563,8 +565,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get a chart by its index position * * @param string $index Chart index position - * @return false|PHPExcel_Chart - * @throws PHPExcel_Exception + * @return false|PHPExcel\Chart + * @throws PHPExcel\Exception */ public function getChartByIndex($index = null) { @@ -586,7 +588,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Return an array of the names of charts on this worksheet * * @return string[] The names of charts - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function getChartNames() { @@ -601,8 +603,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get a chart by name * * @param string $chartName Chart name - * @return false|PHPExcel_Chart - * @throws PHPExcel_Exception + * @return false|PHPExcel\Chart + * @throws PHPExcel\Exception */ public function getChartByName($chartName = '') { @@ -621,7 +623,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Refresh column dimensions * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function refreshColumnDimensions() { @@ -640,7 +642,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Refresh row dimensions * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function refreshRowDimensions() { @@ -682,7 +684,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Calculate widths for auto-size columns * * @param boolean $calculateMergeCells Calculate merge cell width - * @return PHPExcel_Worksheet; + * @return PHPExcel\Worksheet; */ public function calculateColumnWidths($calculateMergeCells = false) { @@ -700,7 +702,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // build list of cells references that participate in a merge $isMergeCell = array(); foreach ($this->getMergeCells() as $cells) { - foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cells) as $cellReference) { + foreach (Cell::extractAllCellReferencesInRange($cells) as $cellReference) { $isMergeCell[$cellReference] = true; } } @@ -713,14 +715,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (!isset($isMergeCell[$this->_cellCollection->getCurrentAddress()])) { // Calculated value // To formatted string - $cellValue = PHPExcel_Style_NumberFormat::toFormattedString( + $cellValue = Style_NumberFormat::toFormattedString( $cell->getCalculatedValue(), $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode() ); $autoSizes[$this->_cellCollection->getCurrentColumn()] = max( (float) $autoSizes[$this->_cellCollection->getCurrentColumn()], - (float)PHPExcel_Shared_Font::calculateColumnWidth( + (float) Shared_Font::calculateColumnWidth( $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(), $cellValue, $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(), @@ -744,7 +746,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get parent * - * @return PHPExcel + * @return PHPExcel\Workbook */ public function getParent() { return $this->_parent; @@ -753,10 +755,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Re-bind parent * - * @param PHPExcel $parent - * @return PHPExcel_Worksheet + * @param PHPExcel\Workbook $parent + * @return PHPExcel\Worksheet */ - public function rebindParent(PHPExcel $parent) { + public function rebindParent(Workbook $parent) { $namedRanges = $this->_parent->getNamedRanges(); foreach ($namedRanges as $namedRange) { $parent->addNamedRange($namedRange); @@ -789,7 +791,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * This should be left as the default true, unless you are * certain that no formula cells on any worksheet contain * references to this worksheet - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) { @@ -809,19 +811,19 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ($this->_parent->sheetNameExists($pValue)) { // Use name, but append with lowest possible integer - if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) { - $pValue = PHPExcel_Shared_String::Substring($pValue,0,29); + if (Shared_String::CountCharacters($pValue) > 29) { + $pValue = Shared_String::Substring($pValue,0,29); } $i = 1; while ($this->_parent->sheetNameExists($pValue . ' ' . $i)) { ++$i; if ($i == 10) { - if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) { - $pValue = PHPExcel_Shared_String::Substring($pValue,0,28); + if (Shared_String::CountCharacters($pValue) > 28) { + $pValue = Shared_String::Substring($pValue,0,28); } } elseif ($i == 100) { - if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) { - $pValue = PHPExcel_Shared_String::Substring($pValue,0,27); + if (Shared_String::CountCharacters($pValue) > 27) { + $pValue = Shared_String::Substring($pValue,0,27); } } } @@ -838,10 +840,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ($this->_parent) { // New title $newTitle = $this->getTitle(); - PHPExcel_Calculation::getInstance($this->_parent) + Calculation::getInstance($this->_parent) ->renameCalculationCacheForWorksheet($oldTitle, $newTitle); if ($updateFormulaCellReferences) - PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle); + ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle); } return $this; @@ -860,9 +862,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set sheet state * * @param string $value Sheet state (visible, hidden, veryHidden) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ - public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) { + public function setSheetState($value = Worksheet::SHEETSTATE_VISIBLE) { $this->_sheetState = $value; return $this; } @@ -870,7 +872,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get page setup * - * @return PHPExcel_Worksheet_PageSetup + * @return PHPExcel\Worksheet_PageSetup */ public function getPageSetup() { @@ -880,10 +882,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set page setup * - * @param PHPExcel_Worksheet_PageSetup $pValue - * @return PHPExcel_Worksheet + * @param PHPExcel\Worksheet_PageSetup $pValue + * @return PHPExcel\Worksheet */ - public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue) + public function setPageSetup(Worksheet_PageSetup $pValue) { $this->_pageSetup = $pValue; return $this; @@ -892,7 +894,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get page margins * - * @return PHPExcel_Worksheet_PageMargins + * @return PHPExcel\Worksheet_PageMargins */ public function getPageMargins() { @@ -902,10 +904,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set page margins * - * @param PHPExcel_Worksheet_PageMargins $pValue - * @return PHPExcel_Worksheet + * @param PHPExcel\Worksheet_PageMargins $pValue + * @return PHPExcel\Worksheet */ - public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue) + public function setPageMargins(Worksheet_PageMargins $pValue) { $this->_pageMargins = $pValue; return $this; @@ -914,7 +916,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get page header/footer * - * @return PHPExcel_Worksheet_HeaderFooter + * @return PHPExcel\Worksheet_HeaderFooter */ public function getHeaderFooter() { @@ -924,10 +926,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set page header/footer * - * @param PHPExcel_Worksheet_HeaderFooter $pValue - * @return PHPExcel_Worksheet + * @param PHPExcel\Worksheet_HeaderFooter $pValue + * @return PHPExcel\Worksheet */ - public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue) + public function setHeaderFooter(Worksheet_HeaderFooter $pValue) { $this->_headerFooter = $pValue; return $this; @@ -936,7 +938,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get sheet view * - * @return PHPExcel_Worksheet_SheetView + * @return PHPExcel\Worksheet_SheetView */ public function getSheetView() { @@ -946,10 +948,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set sheet view * - * @param PHPExcel_Worksheet_SheetView $pValue - * @return PHPExcel_Worksheet + * @param PHPExcel\Worksheet_SheetView $pValue + * @return PHPExcel\Worksheet */ - public function setSheetView(PHPExcel_Worksheet_SheetView $pValue) + public function setSheetView(Worksheet_SheetView $pValue) { $this->_sheetView = $pValue; return $this; @@ -958,7 +960,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get Protection * - * @return PHPExcel_Worksheet_Protection + * @return PHPExcel\Worksheet_Protection */ public function getProtection() { @@ -968,10 +970,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set Protection * - * @param PHPExcel_Worksheet_Protection $pValue - * @return PHPExcel_Worksheet + * @param PHPExcel\Worksheet_Protection $pValue + * @return PHPExcel\Worksheet */ - public function setProtection(PHPExcel_Worksheet_Protection $pValue) + public function setProtection(Worksheet_Protection $pValue) { $this->_protection = $pValue; $this->_dirty = true; @@ -1035,7 +1037,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param string $pCoordinate Coordinate of the cell * @param mixed $pValue Value of the cell * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + * @return PHPExcel\Worksheet|PHPExcel\Cell Depending on the last parameter being specified */ public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) { @@ -1046,11 +1048,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set a cell value by using numeric cell coordinates * - * @param string $pColumn Numeric column coordinate of the cell (A = 0) - * @param string $pRow Numeric row coordinate of the cell - * @param mixed $pValue Value of the cell - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + * @param string $pColumn Numeric column coordinate of the cell (A = 0) + * @param string $pRow Numeric row coordinate of the cell + * @param mixed $pValue Value of the cell + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel\Worksheet|PHPExcel\Cell Depending on the last parameter being specified */ public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) { @@ -1065,9 +1067,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + * @return PHPExcel\Worksheet|PHPExcel\Cell Depending on the last parameter being specified */ - public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) + public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = Cell_DataType::TYPE_STRING, $returnCell = false) { // Set value $cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); @@ -1082,9 +1084,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + * @return PHPExcel\Worksheet|PHPExcel\Cell Depending on the last parameter being specified */ - public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) + public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = Cell_DataType::TYPE_STRING, $returnCell = false) { $cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValueExplicit($pValue, $pDataType); return ($returnCell) ? $cell : $this; @@ -1094,8 +1096,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get cell at a specific coordinate * * @param string $pCoordinate Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found + * @throws PHPExcel\Exception + * @return PHPExcel\Cell Cell that was found */ public function getCell($pCoordinate = 'A1') { @@ -1106,14 +1108,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Worksheet reference? if (strpos($pCoordinate, '!') !== false) { - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + $worksheetReference = Worksheet::extractSheetTitle($pCoordinate, true); return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]); } // Named range? - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && - (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { - $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if ((!preg_match('/^'.Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { + $namedRange = NamedRange::resolveRange($pCoordinate, $this); if ($namedRange !== NULL) { $pCoordinate = $namedRange->getRange(); return $namedRange->getWorksheet()->getCell($pCoordinate); @@ -1124,9 +1126,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $pCoordinate = strtoupper($pCoordinate); if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) { - throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.'); + throw new Exception('Cell coordinate can not be a range of cells.'); } elseif (strpos($pCoordinate, '$') !== false) { - throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); + throw new Exception('Cell coordinate must not be absolute.'); } // Create new cell object @@ -1138,11 +1140,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param string $pColumn Numeric column coordinate of the cell * @param string $pRow Numeric row coordinate of the cell - * @return PHPExcel_Cell Cell that was found + * @return PHPExcel\Cell Cell that was found */ public function getCellByColumnAndRow($pColumn = 0, $pRow = 1) { - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn); + $columnLetter = Cell::stringFromColumnIndex($pColumn); $coordinate = $columnLetter . $pRow; if ($this->_cellCollection->isDataSet($coordinate)) { @@ -1156,23 +1158,23 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Create a new cell at the specified coordinate * * @param string $pCoordinate Coordinate of the cell - * @return PHPExcel_Cell Cell that was created + * @return PHPExcel\Cell Cell that was created */ private function _createNewCell($pCoordinate) { $cell = $this->_cellCollection->addCacheData( $pCoordinate, - new PHPExcel_Cell( + new Cell( NULL, - PHPExcel_Cell_DataType::TYPE_NULL, + Cell_DataType::TYPE_NULL, $this ) ); $this->_cellCollectionIsSorted = false; // Coordinates - $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); - if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0])) + $aCoordinates = Cell::coordinateFromString($pCoordinate); + if (Cell::columnIndexFromString($this->_cachedHighestColumn) < Cell::columnIndexFromString($aCoordinates[0])) $this->_cachedHighestColumn = $aCoordinates[0]; $this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]); @@ -1196,28 +1198,28 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Does the cell at a specific coordinate exist? * * @param string $pCoordinate Coordinate of the cell - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception * @return boolean */ public function cellExists($pCoordinate = 'A1') { // Worksheet reference? if (strpos($pCoordinate, '!') !== false) { - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + $worksheetReference = self::extractSheetTitle($pCoordinate, true); return $this->_parent->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]); } // Named range? - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && - (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { - $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if ((!preg_match('/^'.Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { + $namedRange = NamedRange::resolveRange($pCoordinate, $this); if ($namedRange !== NULL) { $pCoordinate = $namedRange->getRange(); if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { if (!$namedRange->getLocalOnly()) { return $namedRange->getWorksheet()->cellExists($pCoordinate); } else { - throw new PHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); + throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); } } } @@ -1228,12 +1230,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $pCoordinate = strtoupper($pCoordinate); if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { - throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.'); + throw new Exception('Cell coordinate can not be a range of cells.'); } elseif (strpos($pCoordinate,'$') !== false) { - throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); + throw new Exception('Cell coordinate must not be absolute.'); } else { // Coordinates - $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); + $aCoordinates = Cell::coordinateFromString($pCoordinate); // Cell exists? return $this->_cellCollection->isDataSet($pCoordinate); @@ -1249,14 +1251,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable */ public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) { - return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + return $this->cellExists(Cell::stringFromColumnIndex($pColumn) . $pRow); } /** * Get row dimension at a specific row * * @param int $pRow Numeric index of the row - * @return PHPExcel_Worksheet_RowDimension + * @return PHPExcel\Worksheet_RowDimension */ public function getRowDimension($pRow = 1, $create = TRUE) { @@ -1267,7 +1269,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (!isset($this->_rowDimensions[$pRow])) { if (!$create) return NULL; - $this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow); + $this->_rowDimensions[$pRow] = new Worksheet_RowDimension($pRow); $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow); } @@ -1278,7 +1280,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get column dimension at a specific column * * @param string $pColumn String index of the column - * @return PHPExcel_Worksheet_ColumnDimension + * @return PHPExcel\Worksheet_ColumnDimension */ public function getColumnDimension($pColumn = 'A', $create = TRUE) { @@ -1289,9 +1291,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (!isset($this->_columnDimensions[$pColumn])) { if (!$create) return NULL; - $this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn); + $this->_columnDimensions[$pColumn] = new Worksheet_ColumnDimension($pColumn); - if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn)) + if (Cell::columnIndexFromString($this->_cachedHighestColumn) < Cell::columnIndexFromString($pColumn)) $this->_cachedHighestColumn = $pColumn; } return $this->_columnDimensions[$pColumn]; @@ -1301,17 +1303,17 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get column dimension at a specific column by using numeric cell coordinates * * @param string $pColumn Numeric column coordinate of the cell - * @return PHPExcel_Worksheet_ColumnDimension + * @return PHPExcel\Worksheet_ColumnDimension */ public function getColumnDimensionByColumn($pColumn = 0) { - return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn)); + return $this->getColumnDimension(Cell::stringFromColumnIndex($pColumn)); } /** * Get styles * - * @return PHPExcel_Style[] + * @return PHPExcel\Style[] */ public function getStyles() { @@ -1322,8 +1324,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get default style of workbook. * * @deprecated - * @return PHPExcel_Style - * @throws PHPExcel_Exception + * @return PHPExcel\Style + * @throws PHPExcel\Exception */ public function getDefaultStyle() { @@ -1331,14 +1333,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } /** - * Set default style - should only be used by PHPExcel_IReader implementations! + * Set default style - should only be used by PHPExcel\IReader implementations! * * @deprecated - * @param PHPExcel_Style $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @param PHPExcel\Style $pValue + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ - public function setDefaultStyle(PHPExcel_Style $pValue) + public function setDefaultStyle(Style $pValue) { $this->_parent->getDefaultStyle()->applyFromArray(array( 'font' => array( @@ -1353,8 +1355,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get style for cell * * @param string $pCellCoordinate Cell coordinate to get style for - * @return PHPExcel_Style - * @throws PHPExcel_Exception + * @return PHPExcel\Style + * @throws PHPExcel\Exception */ public function getStyle($pCellCoordinate = 'A1') { @@ -1371,7 +1373,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get conditional styles for a cell * * @param string $pCoordinate - * @return PHPExcel_Style_Conditional[] + * @return PHPExcel\Style_Conditional[] */ public function getConditionalStyles($pCoordinate = 'A1') { @@ -1399,7 +1401,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Removes conditional styles for a cell * * @param string $pCoordinate - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function removeConditionalStyles($pCoordinate = 'A1') { @@ -1421,8 +1423,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set conditional styles * * @param $pCoordinate string E.g. 'A1' - * @param $pValue PHPExcel_Style_Conditional[] - * @return PHPExcel_Worksheet + * @param $pValue PHPExcel\Style_Conditional[] + * @return PHPExcel\Worksheet */ public function setConditionalStyles($pCoordinate = 'A1', $pValue) { @@ -1435,11 +1437,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell - * @return PHPExcel_Style + * @return PHPExcel\Style */ public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1) { - return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + return $this->getStyle(Cell::stringFromColumnIndex($pColumn) . $pRow); } /** @@ -1448,12 +1450,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Please note that this will overwrite existing cell styles for cells in range! * * @deprecated - * @param PHPExcel_Style $pSharedCellStyle Cell style to share + * @param PHPExcel\Style $pSharedCellStyle Cell style to share * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ - public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '') + public function setSharedStyle(Style $pSharedCellStyle = null, $pRange = '') { $this->duplicateStyle($pSharedCellStyle, $pRange); return $this; @@ -1464,12 +1466,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * Please note that this will overwrite existing cell styles for cells in range! * - * @param PHPExcel_Style $pCellStyle Cell style to duplicate + * @param PHPExcel\Style $pCellStyle Cell style to duplicate * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ - public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '') + public function duplicateStyle(Style $pCellStyle = null, $pRange = '') { // make sure we have a real style and not supervisor $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle; @@ -1499,12 +1501,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + $rangeStart = Cell::coordinateFromString($rangeA); + $rangeEnd = Cell::coordinateFromString($rangeB); // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + $rangeStart[0] = Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = Cell::columnIndexFromString($rangeEnd[0]) - 1; // Make sure we can loop upwards on rows and columns if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { @@ -1516,7 +1518,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Loop through cells and apply styles for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex); + $this->getCell(Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex); } } @@ -1528,16 +1530,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * Please note that this will overwrite existing cell styles for cells in range! * - * @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate + * @param array of PHPExcel\Style_Conditional $pCellStyle Cell style to duplicate * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') { foreach($pCellStyle as $cellStyle) { - if (!($cellStyle instanceof PHPExcel_Style_Conditional)) { - throw new PHPExcel_Exception('Style is not a conditional style'); + if (!($cellStyle instanceof Style_Conditional)) { + throw new Exception('Style is not a conditional style'); } } @@ -1555,12 +1557,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + $rangeStart = Cell::coordinateFromString($rangeA); + $rangeEnd = Cell::coordinateFromString($rangeB); // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + $rangeStart[0] = Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = Cell::columnIndexFromString($rangeEnd[0]) - 1; // Make sure we can loop upwards on rows and columns if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { @@ -1572,7 +1574,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Loop through cells and apply styles for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $this->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($col) . $row, $pCellStyle); + $this->setConditionalStyles(Cell::stringFromColumnIndex($col) . $row, $pCellStyle); } } @@ -1590,8 +1592,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param array $pStyles Array containing style information * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") * @param boolean $pAdvanced Advanced mode for setting borders. - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) { @@ -1603,17 +1605,17 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set break on a cell * * @param string $pCell Cell coordinate (e.g. A1) - * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @param int $pBreak Break type (type of PHPExcel\Worksheet::BREAK_*) + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ - public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE) + public function setBreak($pCell = 'A1', $pBreak = self::BREAK_NONE) { // Uppercase coordinate $pCell = strtoupper($pCell); if ($pCell != '') { - if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) { + if ($pBreak == self::BREAK_NONE) { if (isset($this->_breaks[$pCell])) { unset($this->_breaks[$pCell]); } @@ -1621,7 +1623,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $this->_breaks[$pCell] = $pBreak; } } else { - throw new PHPExcel_Exception('No cell coordinate specified.'); + throw new Exception('No cell coordinate specified.'); } return $this; @@ -1632,12 +1634,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param integer $pColumn Numeric column coordinate of the cell * @param integer $pRow Numeric row coordinate of the cell - * @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) - * @return PHPExcel_Worksheet + * @param integer $pBreak Break type (type of PHPExcel\Worksheet::BREAK_*) + * @return PHPExcel\Worksheet */ - public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE) + public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = Worksheet::BREAK_NONE) { - return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); + return $this->setBreak(Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); } /** @@ -1654,8 +1656,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set merge on a cell range * * @param string $pRange Cell range (e.g. A1:E1) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function mergeCells($pRange = 'A1:A1') { @@ -1668,22 +1670,22 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // make sure cells are created // get the cells in the range - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + $aReferences = Cell::extractAllCellReferencesInRange($pRange); // create upper left cell if it does not already exist $upperLeft = $aReferences[0]; if (!$this->cellExists($upperLeft)) { - $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); + $this->getCell($upperLeft)->setValueExplicit(null, Cell_DataType::TYPE_NULL); } // create or blank out the rest of the cells in the range $count = count($aReferences); for ($i = 1; $i < $count; $i++) { - $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); + $this->getCell($aReferences[$i])->setValueExplicit(null, Cell_DataType::TYPE_NULL); } } else { - throw new PHPExcel_Exception('Merge must be set on a range of cells.'); + throw new Exception('Merge must be set on a range of cells.'); } return $this; @@ -1696,12 +1698,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the last cell * @param int $pRow2 Numeric row coordinate of the last cell - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2; return $this->mergeCells($cellRange); } @@ -1709,8 +1711,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Remove merge on a cell range * * @param string $pRange Cell range (e.g. A1:E1) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function unmergeCells($pRange = 'A1:A1') { @@ -1721,10 +1723,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (isset($this->_mergeCells[$pRange])) { unset($this->_mergeCells[$pRange]); } else { - throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as merged.'); + throw new Exception('Cell range ' . $pRange . ' not known as merged.'); } } else { - throw new PHPExcel_Exception('Merge can only be removed from a range of cells.'); + throw new Exception('Merge can only be removed from a range of cells.'); } return $this; @@ -1737,12 +1739,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the last cell * @param int $pRow2 Numeric row coordinate of the last cell - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2; return $this->unmergeCells($cellRange); } @@ -1775,8 +1777,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) * @param string $pPassword Password to unlock the protection * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) { @@ -1784,7 +1786,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $pRange = strtoupper($pRange); if (!$pAlreadyHashed) { - $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword); + $pPassword = Shared_PasswordHasher::hashPassword($pPassword); } $this->_protectedCells[$pRange] = $pPassword; @@ -1800,12 +1802,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param int $pRow2 Numeric row coordinate of the last cell * @param string $pPassword Password to unlock the protection * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2; return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed); } @@ -1813,8 +1815,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Remove protection on a cell range * * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function unprotectCells($pRange = 'A1') { @@ -1824,7 +1826,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (isset($this->_protectedCells[$pRange])) { unset($this->_protectedCells[$pRange]); } else { - throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as protected.'); + throw new Exception('Cell range ' . $pRange . ' not known as protected.'); } return $this; } @@ -1838,12 +1840,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param int $pRow2 Numeric row coordinate of the last cell * @param string $pPassword Password to unlock the protection * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2; return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed); } @@ -1860,7 +1862,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get Autofilter * - * @return PHPExcel_Worksheet_AutoFilter + * @return PHPExcel\Worksheet_AutoFilter */ public function getAutoFilter() { @@ -1870,16 +1872,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set AutoFilter * - * @param PHPExcel_Worksheet_AutoFilter|string $pValue + * @param PHPExcel\Worksheet_AutoFilter|string $pValue * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function setAutoFilter($pValue) { if (is_string($pValue)) { $this->_autoFilter->setRange($pValue); - } elseif(is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) { + } elseif(is_object($pValue) && ($pValue instanceof Worksheet_AutoFilter)) { $this->_autoFilter = $pValue; } return $this; @@ -1892,22 +1894,22 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param integer $pRow1 Numeric row coordinate of the first cell * @param integer $pColumn2 Numeric column coordinate of the second cell * @param integer $pRow2 Numeric row coordinate of the second cell - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) { return $this->setAutoFilter( - PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 + Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . - PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2 + Cell::stringFromColumnIndex($pColumn2) . $pRow2 ); } /** * Remove autofilter * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function removeAutoFilter() { @@ -1934,8 +1936,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * B1 will freeze the columns to the left of cell B1 (i.e column A) * B2 will freeze the rows above and to the left of cell A2 * (i.e row 1 and column A) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function freezePane($pCell = '') { @@ -1945,7 +1947,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (strpos($pCell,':') === false && strpos($pCell,',') === false) { $this->_freezePane = $pCell; } else { - throw new PHPExcel_Exception('Freeze pane can not be set on a range of cells.'); + throw new Exception('Freeze pane can not be set on a range of cells.'); } return $this; } @@ -1955,18 +1957,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) { - return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + return $this->freezePane(Cell::stringFromColumnIndex($pColumn) . $pRow); } /** * Unfreeze Pane * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function unfreezePane() { @@ -1978,15 +1980,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pBefore Insert before this one * @param int $pNumRows Number of rows to insert - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) { if ($pBefore >= 1) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper = ReferenceHelper::getInstance(); $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this); } else { - throw new PHPExcel_Exception("Rows can only be inserted before at least row 1."); + throw new Exception("Rows can only be inserted before at least row 1."); } return $this; } @@ -1996,15 +1998,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to insert - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) { if (!is_numeric($pBefore)) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper = ReferenceHelper::getInstance(); $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this); } else { - throw new PHPExcel_Exception("Column references should not be numeric."); + throw new Exception("Column references should not be numeric."); } return $this; } @@ -2014,14 +2016,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pBefore Insert before this one (numeric column coordinate of the cell) * @param int $pNumCols Number of columns to insert - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) { if ($pBefore >= 0) { - return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols); + return $this->insertNewColumnBefore(Cell::stringFromColumnIndex($pBefore), $pNumCols); } else { - throw new PHPExcel_Exception("Columns can only be inserted before at least column A (0)."); + throw new Exception("Columns can only be inserted before at least column A (0)."); } } @@ -2030,15 +2032,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pRow Remove starting with this one * @param int $pNumRows Number of rows to remove - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function removeRow($pRow = 1, $pNumRows = 1) { if ($pRow >= 1) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper = ReferenceHelper::getInstance(); $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this); } else { - throw new PHPExcel_Exception("Rows to be deleted should at least start from row 1."); + throw new Exception("Rows to be deleted should at least start from row 1."); } return $this; } @@ -2048,16 +2050,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Remove starting with this one * @param int $pNumCols Number of columns to remove - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function removeColumn($pColumn = 'A', $pNumCols = 1) { if (!is_numeric($pColumn)) { - $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols); - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $pColumn = Cell::stringFromColumnIndex(Cell::columnIndexFromString($pColumn) - 1 + $pNumCols); + $objReferenceHelper = ReferenceHelper::getInstance(); $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this); } else { - throw new PHPExcel_Exception("Column references should not be numeric."); + throw new Exception("Column references should not be numeric."); } return $this; } @@ -2067,14 +2069,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) * @param int $pNumCols Number of columns to remove - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) { if ($pColumn >= 0) { - return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols); + return $this->removeColumn(Cell::stringFromColumnIndex($pColumn), $pNumCols); } else { - throw new PHPExcel_Exception("Columns to be deleted should at least start from column 0"); + throw new Exception("Columns to be deleted should at least start from column 0"); } } @@ -2091,7 +2093,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set show gridlines * * @param boolean $pValue Show gridlines (true/false) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setShowGridlines($pValue = false) { $this->_showGridlines = $pValue; @@ -2111,7 +2113,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set print gridlines * * @param boolean $pValue Print gridlines (true/false) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setPrintGridlines($pValue = false) { $this->_printGridlines = $pValue; @@ -2131,7 +2133,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set show row and column headers * * @param boolean $pValue Show row and column headers (true/false) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setShowRowColHeaders($pValue = false) { $this->_showRowColHeaders = $pValue; @@ -2151,7 +2153,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set show summary below * * @param boolean $pValue Show summary below (true/false) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setShowSummaryBelow($pValue = true) { $this->_showSummaryBelow = $pValue; @@ -2171,7 +2173,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set show summary right * * @param boolean $pValue Show summary right (true/false) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setShowSummaryRight($pValue = true) { $this->_showSummaryRight = $pValue; @@ -2181,7 +2183,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get comments * - * @return PHPExcel_Comment[] + * @return PHPExcel\Comment[] */ public function getComments() { @@ -2191,8 +2193,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Set comments array for the entire sheet. * - * @param array of PHPExcel_Comment - * @return PHPExcel_Worksheet + * @param array of PHPExcel\Comment + * @return PHPExcel\Worksheet */ public function setComments($pValue = array()) { @@ -2205,8 +2207,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get comment for cell * * @param string $pCellCoordinate Cell coordinate to get comment for - * @return PHPExcel_Comment - * @throws PHPExcel_Exception + * @return PHPExcel\Comment + * @throws PHPExcel\Exception */ public function getComment($pCellCoordinate = 'A1') { @@ -2214,18 +2216,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $pCellCoordinate = strtoupper($pCellCoordinate); if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) { - throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.'); + throw new Exception('Cell coordinate string can not be a range of cells.'); } else if (strpos($pCellCoordinate,'$') !== false) { - throw new PHPExcel_Exception('Cell coordinate string must not be absolute.'); + throw new Exception('Cell coordinate string must not be absolute.'); } else if ($pCellCoordinate == '') { - throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.'); + throw new Exception('Cell coordinate can not be zero-length string.'); } else { // Check if we already have a comment for this cell. // If not, create a new comment. if (isset($this->_comments[$pCellCoordinate])) { return $this->_comments[$pCellCoordinate]; } else { - $newComment = new PHPExcel_Comment(); + $newComment = new Comment(); $this->_comments[$pCellCoordinate] = $newComment; return $newComment; } @@ -2237,11 +2239,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell - * @return PHPExcel_Comment + * @return PHPExcel\Comment */ public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) { - return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + return $this->getComment(PHPExcel\Cell::stringFromColumnIndex($pColumn) . $pRow); } /** @@ -2279,7 +2281,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Selected cell * * @param string $pCoordinate Cell (i.e. A1) - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setSelectedCell($pCoordinate = 'A1') { @@ -2290,8 +2292,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Select a range of cells. * * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function setSelectedCells($pCoordinate = 'A1') { @@ -2311,7 +2313,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate); if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { - list($first, ) = PHPExcel_Cell::splitRange($pCoordinate); + list($first, ) = Cell::splitRange($pCoordinate); $this->_activeCell = $first[0]; } else { $this->_activeCell = $pCoordinate; @@ -2325,12 +2327,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) { - return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + return $this->setSelectedCells(Cell::stringFromColumnIndex($pColumn) . $pRow); } /** @@ -2346,7 +2348,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set right-to-left * * @param boolean $value Right-to-left true/false - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function setRightToLeft($value = false) { $this->_rightToLeft = $value; @@ -2360,8 +2362,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param mixed $nullValue Value in source array that stands for blank cell * @param string $startCell Insert array starting from this cell address as the top left coordinate * @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet */ public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) { if (is_array($source)) { @@ -2371,7 +2373,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } // start coordinate - list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell); + list ($startColumn, $startRow) = Cell::coordinateFromString($startCell); // Loop through $source foreach ($source as $rowData) { @@ -2393,7 +2395,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable ++$startRow; } } else { - throw new PHPExcel_Exception("Parameter \$source should be an array."); + throw new Exception("Parameter \$source should be an array."); } return $this; } @@ -2413,10 +2415,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Returnvalue $returnValue = array(); // Identify the range that we need to extract from the worksheet - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); - $minCol = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] -1); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($pRange); + $minCol = Cell::stringFromColumnIndex($rangeStart[0] -1); $minRow = $rangeStart[1]; - $maxCol = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1); + $maxCol = Cell::stringFromColumnIndex($rangeEnd[0] -1); $maxRow = $rangeEnd[1]; $maxCol++; @@ -2434,7 +2436,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Cell exists $cell = $this->_cellCollection->getCacheData($col.$row); if ($cell->getValue() !== null) { - if ($cell->getValue() instanceof PHPExcel_RichText) { + if ($cell->getValue() instanceof RichText) { $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText(); } else { if ($calculateFormulas) { @@ -2446,11 +2448,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ($formatData) { $style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); - $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString( + $returnValue[$rRef][$cRef] = Style_NumberFormat::toFormattedString( $returnValue[$rRef][$cRef], ($style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : - PHPExcel_Style_NumberFormat::FORMAT_GENERAL + Style_NumberFormat::FORMAT_GENERAL ); } } else { @@ -2479,10 +2481,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero * True - Return rows and columns indexed by their actual row and column IDs * @return array - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception */ public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { - $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); + $namedRange = NamedRange::resolveRange($pNamedRange, $this); if ($namedRange !== NULL) { $pWorkSheet = $namedRange->getWorksheet(); $pCellRange = $namedRange->getRange(); @@ -2491,7 +2493,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $nullValue, $calculateFormulas, $formatData, $returnCellRef); } - throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.'); + throw new Exception('Named Range '.$pNamedRange.' does not exist.'); } @@ -2521,16 +2523,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Get row iterator * * @param integer $startRow The row number at which to start iterating - * @return PHPExcel_Worksheet_RowIterator + * @return PHPExcel\Worksheet_RowIterator */ public function getRowIterator($startRow = 1) { - return new PHPExcel_Worksheet_RowIterator($this,$startRow); + return new Worksheet_RowIterator($this,$startRow); } /** * Run PHPExcel garabage collector. * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function garbageCollect() { // Flush cache @@ -2547,11 +2549,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Lookup highest column and highest row if cells are cleaned $colRow = $this->_cellCollection->getHighestRowAndColumn(); $highestRow = $colRow['row']; - $highestColumn = PHPExcel_Cell::columnIndexFromString($colRow['column']); + $highestColumn = Cell::columnIndexFromString($colRow['column']); // Loop through column dimensions foreach ($this->_columnDimensions as $dimension) { - $highestColumn = max($highestColumn,PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())); + $highestColumn = max($highestColumn,Cell::columnIndexFromString($dimension->getColumnIndex())); } // Loop through row dimensions @@ -2563,7 +2565,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ($highestColumn < 0) { $this->_cachedHighestColumn = 'A'; } else { - $this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn); + $this->_cachedHighestColumn = Cell::stringFromColumnIndex(--$highestColumn); } $this->_cachedHighestRow = $highestRow; @@ -2626,7 +2628,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } // else create hyperlink - $this->_hyperlinkCollection[$pCellCoordinate] = new PHPExcel_Cell_Hyperlink(); + $this->_hyperlinkCollection[$pCellCoordinate] = new Cell_Hyperlink(); return $this->_hyperlinkCollection[$pCellCoordinate]; } @@ -2634,10 +2636,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set hyperlnk * * @param string $pCellCoordinate Cell coordinate to insert hyperlink - * @param PHPExcel_Cell_Hyperlink $pHyperlink - * @return PHPExcel_Worksheet + * @param PHPExcel\Cell_Hyperlink $pHyperlink + * @return PHPExcel\Worksheet */ - public function setHyperlink($pCellCoordinate = 'A1', PHPExcel_Cell_Hyperlink $pHyperlink = null) + public function setHyperlink($pCellCoordinate = 'A1', Cell_Hyperlink $pHyperlink = null) { if ($pHyperlink === null) { unset($this->_hyperlinkCollection[$pCellCoordinate]); @@ -2661,7 +2663,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of hyperlinks * - * @return PHPExcel_Cell_Hyperlink[] + * @return PHPExcel\Cell_Hyperlink[] */ public function getHyperlinkCollection() { @@ -2681,7 +2683,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } // else create data validation - $this->_dataValidationCollection[$pCellCoordinate] = new PHPExcel_Cell_DataValidation(); + $this->_dataValidationCollection[$pCellCoordinate] = new Cell_DataValidation(); return $this->_dataValidationCollection[$pCellCoordinate]; } @@ -2689,10 +2691,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * Set data validation * * @param string $pCellCoordinate Cell coordinate to insert data validation - * @param PHPExcel_Cell_DataValidation $pDataValidation - * @return PHPExcel_Worksheet + * @param PHPExcel\Cell_DataValidation $pDataValidation + * @return PHPExcel\Worksheet */ - public function setDataValidation($pCellCoordinate = 'A1', PHPExcel_Cell_DataValidation $pDataValidation = null) + public function setDataValidation($pCellCoordinate = 'A1', Cell_DataValidation $pDataValidation = null) { if ($pDataValidation === null) { unset($this->_dataValidationCollection[$pCellCoordinate]); @@ -2716,7 +2718,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get collection of data validations * - * @return PHPExcel_Cell_DataValidation[] + * @return PHPExcel\Cell_DataValidation[] */ public function getDataValidationCollection() { @@ -2732,15 +2734,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable public function shrinkRangeToFit($range) { $maxCol = $this->getHighestColumn(); $maxRow = $this->getHighestRow(); - $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol); + $maxCol = Cell::columnIndexFromString($maxCol); $rangeBlocks = explode(' ',$range); foreach ($rangeBlocks as &$rangeSet) { - $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet); + $rangeBoundaries = Cell::getRangeBoundaries($rangeSet); - if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } + if (Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = Cell::stringFromColumnIndex($maxCol); } if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; } - if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } + if (Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = Cell::stringFromColumnIndex($maxCol); } if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; } $rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1]; } @@ -2753,12 +2755,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get tab color * - * @return PHPExcel_Style_Color + * @return PHPExcel\Style_Color */ public function getTabColor() { if ($this->_tabColor === NULL) - $this->_tabColor = new PHPExcel_Style_Color(); + $this->_tabColor = new Style_Color(); return $this->_tabColor; } @@ -2766,7 +2768,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Reset tab color * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function resetTabColor() { @@ -2789,7 +2791,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Copy worksheet (!= clone!) * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function copy() { $copied = clone $this; @@ -2814,7 +2816,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } elseif ($key == '_drawingCollection') { $newCollection = clone $this->_drawingCollection; $this->_drawingCollection = $newCollection; - } elseif (($key == '_autoFilter') && ($this->_autoFilter instanceof PHPExcel_Worksheet_AutoFilter)) { + } elseif (($key == '_autoFilter') && ($this->_autoFilter instanceof Worksheet_AutoFilter)) { $newAutoFilter = clone $this->_autoFilter; $this->_autoFilter = $newAutoFilter; $this->_autoFilter->setParent($this); diff --git a/Classes/PHPExcel/Worksheet/AutoFilter.php b/Classes/PHPExcel/Worksheet/AutoFilter.php index 3872d0e..522677c 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter.php @@ -19,26 +19,28 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_AutoFilter + * PHPExcel\Worksheet_AutoFilter * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_AutoFilter +class Worksheet_AutoFilter { /** * Autofilter Worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_workSheet = NULL; @@ -54,18 +56,18 @@ class PHPExcel_Worksheet_AutoFilter /** * Autofilter Column Ruleset * - * @var array of PHPExcel_Worksheet_AutoFilter_Column + * @var array of PHPExcel\Worksheet_AutoFilter_Column */ private $_columns = array(); /** - * Create a new PHPExcel_Worksheet_AutoFilter + * Create a new PHPExcel\Worksheet_AutoFilter * * @param string $pRange Cell range (i.e. A1:E10) - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Worksheet $pSheet */ - public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = NULL) + public function __construct($pRange = '', Worksheet $pSheet = NULL) { $this->_range = $pRange; $this->_workSheet = $pSheet; @@ -74,7 +76,7 @@ class PHPExcel_Worksheet_AutoFilter /** * Get AutoFilter Parent Worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getParent() { return $this->_workSheet; @@ -83,10 +85,10 @@ class PHPExcel_Worksheet_AutoFilter /** * Set AutoFilter Parent Worksheet * - * @param PHPExcel_Worksheet $pSheet - * @return PHPExcel_Worksheet_AutoFilter + * @param PHPExcel\Worksheet $pSheet + * @return PHPExcel\Worksheet_AutoFilter */ - public function setParent(PHPExcel_Worksheet $pSheet = NULL) { + public function setParent(Worksheet $pSheet = NULL) { $this->_workSheet = $pSheet; return $this; @@ -105,8 +107,8 @@ class PHPExcel_Worksheet_AutoFilter * Set AutoFilter Range * * @param string $pRange Cell range (i.e. A1:E10) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter */ public function setRange($pRange = '') { // Uppercase coordinate @@ -120,7 +122,7 @@ class PHPExcel_Worksheet_AutoFilter } elseif(empty($pRange)) { $this->_range = ''; } else { - throw new PHPExcel_Exception('Autofilter must be set on a range of cells.'); + throw new Exception('Autofilter must be set on a range of cells.'); } if (empty($pRange)) { @@ -128,9 +130,9 @@ class PHPExcel_Worksheet_AutoFilter $this->_columns = array(); } else { // Discard any column rules that are no longer valid within this range - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + list($rangeStart,$rangeEnd) = Cell::rangeBoundaries($this->_range); foreach($this->_columns as $key => $value) { - $colIndex = PHPExcel_Cell::columnIndexFromString($key); + $colIndex = Cell::columnIndexFromString($key); if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { unset($this->_columns[$key]); } @@ -143,8 +145,8 @@ class PHPExcel_Worksheet_AutoFilter /** * Get all AutoFilter Columns * - * @throws PHPExcel_Exception - * @return array of PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return array of PHPExcel\Worksheet_AutoFilter_Column */ public function getColumns() { return $this->_columns; @@ -154,18 +156,18 @@ class PHPExcel_Worksheet_AutoFilter * Validate that the specified column is in the AutoFilter range * * @param string $column Column name (e.g. A) - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception * @return integer The column offset within the autofilter range */ public function testColumnInRange($column) { if (empty($this->_range)) { - throw new PHPExcel_Exception("No autofilter range is defined."); + throw new Exception("No autofilter range is defined."); } - $columnIndex = PHPExcel_Cell::columnIndexFromString($column); - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + $columnIndex = Cell::columnIndexFromString($column); + list($rangeStart,$rangeEnd) = Cell::rangeBoundaries($this->_range); if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { - throw new PHPExcel_Exception("Column is outside of current autofilter range."); + throw new Exception("Column is outside of current autofilter range."); } return $columnIndex - $rangeStart[0]; @@ -175,7 +177,7 @@ class PHPExcel_Worksheet_AutoFilter * Get a specified AutoFilter Column Offset within the defined AutoFilter range * * @param string $pColumn Column name (e.g. A) - * @throws PHPExcel_Exception + * @throws PHPExcel\Exception * @return integer The offset of the specified column within the autofilter range */ public function getColumnOffset($pColumn) { @@ -186,14 +188,14 @@ class PHPExcel_Worksheet_AutoFilter * Get a specified AutoFilter Column * * @param string $pColumn Column name (e.g. A) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function getColumn($pColumn) { $this->testColumnInRange($pColumn); if (!isset($this->_columns[$pColumn])) { - $this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); + $this->_columns[$pColumn] = new Worksheet_AutoFilter_Column($pColumn, $this); } return $this->_columns[$pColumn]; @@ -203,12 +205,12 @@ class PHPExcel_Worksheet_AutoFilter * Get a specified AutoFilter Column by it's offset * * @param integer $pColumnOffset Column offset within range (starting from 0) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function getColumnByOffset($pColumnOffset = 0) { - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); - $pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); + list($rangeStart,$rangeEnd) = Cell::rangeBoundaries($this->_range); + $pColumn = Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); return $this->getColumn($pColumn); } @@ -216,25 +218,25 @@ class PHPExcel_Worksheet_AutoFilter /** * Set AutoFilter * - * @param PHPExcel_Worksheet_AutoFilter_Column|string $pColumn + * @param PHPExcel\Worksheet_AutoFilter_Column|string $pColumn * A simple string containing a Column ID like 'A' is permitted - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter */ public function setColumn($pColumn) { if ((is_string($pColumn)) && (!empty($pColumn))) { $column = $pColumn; - } elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) { + } elseif(is_object($pColumn) && ($pColumn instanceof Worksheet_AutoFilter_Column)) { $column = $pColumn->getColumnIndex(); } else { - throw new PHPExcel_Exception("Column is not within the autofilter range."); + throw new Exception("Column is not within the autofilter range."); } $this->testColumnInRange($column); if (is_string($pColumn)) { - $this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); - } elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) { + $this->_columns[$pColumn] = new Worksheet_AutoFilter_Column($pColumn, $this); + } elseif(is_object($pColumn) && ($pColumn instanceof Worksheet_AutoFilter_Column)) { $pColumn->setParent($this); $this->_columns[$column] = $pColumn; } @@ -247,8 +249,8 @@ class PHPExcel_Worksheet_AutoFilter * Clear a specified AutoFilter Column * * @param string $pColumn Column name (e.g. A) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter */ public function clearColumn($pColumn) { $this->testColumnInRange($pColumn); @@ -269,7 +271,7 @@ class PHPExcel_Worksheet_AutoFilter * * @param string $fromColumn Column name (e.g. A) * @param string $toColumn Column name (e.g. B) - * @return PHPExcel_Worksheet_AutoFilter + * @return PHPExcel\Worksheet_AutoFilter */ public function shiftColumn($fromColumn=NULL,$toColumn=NULL) { $fromColumn = strtoupper($fromColumn); @@ -322,7 +324,7 @@ class PHPExcel_Worksheet_AutoFilter } if (is_numeric($cellValue)) { - $dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue); + $dateValue = Shared_Date::ExcelToPHP($cellValue); if ($cellValue < 1) { // Just the time part $dtVal = date('His',$dateValue); @@ -365,36 +367,36 @@ class PHPExcel_Worksheet_AutoFilter return FALSE; } } - $returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); + $returnVal = ($join == Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); foreach($dataSet as $rule) { if (is_numeric($rule['value'])) { // Numeric values are tested using the appropriate operator switch ($rule['operator']) { - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : $retVal = ($cellValue == $rule['value']); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL : $retVal = ($cellValue != $rule['value']); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN : $retVal = ($cellValue > $rule['value']); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL : $retVal = ($cellValue >= $rule['value']); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN : $retVal = ($cellValue < $rule['value']); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL : $retVal = ($cellValue <= $rule['value']); break; } } elseif($rule['value'] == '') { switch ($rule['operator']) { - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : $retVal = (($cellValue == '') || ($cellValue === NULL)); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL : $retVal = (($cellValue != '') && ($cellValue !== NULL)); break; default : @@ -407,14 +409,14 @@ class PHPExcel_Worksheet_AutoFilter } // If there are multiple conditions, then we need to test both using the appropriate join operator switch ($join) { - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR : + case Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR : $returnVal = $returnVal || $retVal; // Break as soon as we have a TRUE match for OR joins, // to avoid unnecessary additional code execution if ($returnVal) return $returnVal; break; - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND : + case Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND : $returnVal = $returnVal && $retVal; break; } @@ -438,7 +440,7 @@ class PHPExcel_Worksheet_AutoFilter } if (is_numeric($cellValue)) { - $dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue)); + $dateValue = date('m',Shared_Date::ExcelToPHP($cellValue)); if (in_array($dateValue,$monthSet)) { return TRUE; } @@ -460,95 +462,95 @@ class PHPExcel_Worksheet_AutoFilter * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation * * @param string $dynamicRuleType - * @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn + * @param PHPExcel\Worksheet_AutoFilter_Column &$filterColumn * @return mixed[] */ private function _dynamicFilterDateRange($dynamicRuleType, &$filterColumn) { - $rDateType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); + $rDateType = Calculation_Functions::getReturnDateType(); + Calculation_Functions::setReturnDateType(Calculation_Functions::RETURNDATE_PHP_NUMERIC); $val = $maxVal = NULL; $ruleValues = array(); - $baseDate = PHPExcel_Calculation_DateTime::DATENOW(); + $baseDate = Calculation_DateTime::DATENOW(); // Calculate start/end dates for the required date range based on current date switch ($dynamicRuleType) { - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK : $baseDate = strtotime('-7 days',$baseDate); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK : $baseDate = strtotime('-7 days',$baseDate); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH : $baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : $baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER : $baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : $baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR : $baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : $baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; } switch ($dynamicRuleType) { - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW : - $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate)); - $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate); + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW : + $maxVal = (int) Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate)); + $val = (int) Shared_Date::PHPToExcel($baseDate); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE : - $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate)); - $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate))); + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE : + $maxVal = (int) Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate)); + $val = (int) Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : - $maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y',$baseDate))); + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : + $maxVal = (int) Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y',$baseDate))); ++$maxVal; - $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate))); + $val = (int) Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : $thisMonth = date('m',$baseDate); $thisQuarter = floor(--$thisMonth / 3); - $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),(1+$thisQuarter)*3,date('Y',$baseDate))); + $maxVal = (int) Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),(1+$thisQuarter)*3,date('Y',$baseDate))); ++$maxVal; - $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y',$baseDate))); + $val = (int) Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : - $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),date('m',$baseDate),date('Y',$baseDate))); + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : + $maxVal = (int) Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),date('m',$baseDate),date('Y',$baseDate))); ++$maxVal; - $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); + $val = (int) Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate))); break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK : - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK : $dayOfWeek = date('w',$baseDate); - $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek; + $val = (int) Shared_Date::PHPToExcel($baseDate) - $dayOfWeek; $maxVal = $val + 7; break; } switch ($dynamicRuleType) { // Adjust Today dates for Yesterday and Tomorrow - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY : --$maxVal; --$val; break; - case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW : + case Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW : ++$maxVal; ++$val; break; @@ -561,30 +563,30 @@ class PHPExcel_Worksheet_AutoFilter ); // Set the rules for identifying rows for hide/show - $ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, + $ruleValues[] = array( 'operator' => Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val ); - $ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, + $ruleValues[] = array( 'operator' => Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal ); - PHPExcel_Calculation_Functions::setReturnDateType($rDateType); + Calculation_Functions::setReturnDateType($rDateType); return array( 'method' => '_filterTestInCustomDataSet', 'arguments' => array( 'filterRules' => $ruleValues, - 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND + 'join' => Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND ) ); } private function _calculateTopTenValue($columnID,$startRow,$endRow,$ruleType,$ruleValue) { $range = $columnID.$startRow.':'.$columnID.$endRow; - $dataValues = PHPExcel_Calculation_Functions::flattenArray( + $dataValues = Calculation_Functions::flattenArray( $this->_workSheet->rangeToArray($range,NULL,TRUE,FALSE) ); $dataValues = array_filter($dataValues); - if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { + if ($ruleType == Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { rsort($dataValues); } else { sort($dataValues); @@ -596,12 +598,12 @@ class PHPExcel_Worksheet_AutoFilter /** * Apply the AutoFilter rules to the AutoFilter Range * - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter */ public function showHideRows() { - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + list($rangeStart,$rangeEnd) = Cell::rangeBoundaries($this->_range); // The heading row should always be visible // echo 'AutoFilter Heading Row ',$rangeStart[1],' is always SHOWN',PHP_EOL; @@ -611,7 +613,7 @@ class PHPExcel_Worksheet_AutoFilter foreach($this->_columns as $columnID => $filterColumn) { $rules = $filterColumn->getRules(); switch ($filterColumn->getFilterType()) { - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER : + case Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER : $ruleValues = array(); // Build a list of the filter value selections foreach($rules as $rule) { @@ -623,7 +625,7 @@ class PHPExcel_Worksheet_AutoFilter $ruleDataSet = array_filter($ruleValues); if (count($ruleValues) != count($ruleDataSet)) $blanks = TRUE; - if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) { + if ($ruleType == Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) { // Filter on absolute values $columnFilterTests[$columnID] = array( 'method' => '_filterTestInSimpleDataSet', @@ -636,24 +638,24 @@ class PHPExcel_Worksheet_AutoFilter $arguments = array(); foreach($ruleDataSet as $ruleValue) { $date = $time = ''; - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) - $date .= sprintf('%04d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]); - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) - $date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]); - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) - $date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]); - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) - $time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]); - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) - $time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]); - if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) && - ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) - $time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) + $date .= sprintf('%04d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) + $date .= sprintf('%02d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) + $date .= sprintf('%02d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) + $time .= sprintf('%02d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) + $time .= sprintf('%02d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]); + if ((isset($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) && + ($ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) + $time .= sprintf('%02d',$ruleValue[Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]); $dateTime = $date . $time; $arguments['date'][] = $date; $arguments['time'][] = $time; @@ -671,7 +673,7 @@ class PHPExcel_Worksheet_AutoFilter ); } break; - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER : + case Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER : $customRuleForBlanks = FALSE; $ruleValues = array(); // Build a list of the filter value selections @@ -700,28 +702,28 @@ class PHPExcel_Worksheet_AutoFilter ) ); break; - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER : + case Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER : $ruleValues = array(); foreach($rules as $rule) { // We should only ever have one Dynamic Filter Rule anyway $dynamicRuleType = $rule->getGrouping(); - if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) || - ($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) { + if (($dynamicRuleType == Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) || + ($dynamicRuleType == Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) { // Number (Average) based // Calculate the average $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')'; - $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL,$this->_workSheet->getCell('A1')); + $average = Calculation::getInstance()->calculateFormula($averageFormula,NULL,$this->_workSheet->getCell('A1')); // Set above/below rule based on greaterThan or LessTan - $operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) - ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN - : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; + $operator = ($dynamicRuleType === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) + ? Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN + : Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; $ruleValues[] = array( 'operator' => $operator, 'value' => $average ); $columnFilterTests[$columnID] = array( 'method' => '_filterTestInCustomDataSet', 'arguments' => array( 'filterRules' => $ruleValues, - 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR + 'join' => Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR ) ); } else { @@ -750,7 +752,7 @@ class PHPExcel_Worksheet_AutoFilter } } break; - case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER : + case Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER : $ruleValues = array(); $dataRowCount = $rangeEnd[1] - $rangeStart[1]; foreach($rules as $rule) { @@ -759,7 +761,7 @@ class PHPExcel_Worksheet_AutoFilter $ruleValue = $rule->getValue(); $ruleOperator = $rule->getOperator(); } - if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) { + if ($ruleOperator === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) { $ruleValue = floor($ruleValue * ($dataRowCount / 100)); } if ($ruleValue < 1) $ruleValue = 1; @@ -767,16 +769,16 @@ class PHPExcel_Worksheet_AutoFilter $maxVal = $this->_calculateTopTenValue($columnID,$rangeStart[1]+1,$rangeEnd[1],$toptenRuleType,$ruleValue); - $operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) - ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL - : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; + $operator = ($toptenRuleType == Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) + ? Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL + : Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; $ruleValues[] = array( 'operator' => $operator, 'value' => $maxVal ); $columnFilterTests[$columnID] = array( 'method' => '_filterTestInCustomDataSet', 'arguments' => array( 'filterRules' => $ruleValues, - 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR + 'join' => Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR ) ); $filterColumn->setAttributes( @@ -800,7 +802,7 @@ class PHPExcel_Worksheet_AutoFilter // Execute the filter test $result = $result && call_user_func_array( - array('PHPExcel_Worksheet_AutoFilter',$columnFilterTest['method']), + array(__NAMESPACE__ . '\Worksheet_AutoFilter',$columnFilterTest['method']), array( $cellValue, $columnFilterTest['arguments'] @@ -834,7 +836,7 @@ class PHPExcel_Worksheet_AutoFilter $this->{$key} = clone $value; } } elseif ((is_array($value)) && ($key == '_columns')) { - // The columns array of PHPExcel_Worksheet_AutoFilter objects + // The columns array of PHPExcel\Worksheet_AutoFilter objects $this->{$key} = array(); foreach ($value as $k => $v) { $this->{$key}[$k] = clone $v; diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php index e43a333..b8e4b2a 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_AutoFilter_Column + * PHPExcel\Worksheet_AutoFilter_Column * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_AutoFilter_Column +class Worksheet_AutoFilter_Column { const AUTOFILTER_FILTERTYPE_FILTER = 'filters'; const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters'; @@ -77,7 +79,7 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Autofilter * - * @var PHPExcel_Worksheet_AutoFilter + * @var PHPExcel\Worksheet_AutoFilter */ private $_parent = NULL; @@ -109,7 +111,7 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Autofilter Column Rules * - * @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule + * @var array of PHPExcel\Worksheet_AutoFilter_Column_Rule */ private $_ruleset = array(); @@ -123,12 +125,12 @@ class PHPExcel_Worksheet_AutoFilter_Column /** - * Create a new PHPExcel_Worksheet_AutoFilter_Column + * Create a new PHPExcel\Worksheet_AutoFilter_Column * * @param string $pColumn Column (e.g. A) - * @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column + * @param PHPExcel\Worksheet_AutoFilter $pParent Autofilter for this column */ - public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL) + public function __construct($pColumn, Worksheet_AutoFilter $pParent = NULL) { $this->_columnIndex = $pColumn; $this->_parent = $pParent; @@ -147,8 +149,8 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Column Index * * @param string $pColumn Column (e.g. A) - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setColumnIndex($pColumn) { // Uppercase coordinate @@ -165,7 +167,7 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Get this Column's AutoFilter Parent * - * @return PHPExcel_Worksheet_AutoFilter + * @return PHPExcel\Worksheet_AutoFilter */ public function getParent() { return $this->_parent; @@ -174,10 +176,10 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Set this Column's AutoFilter Parent * - * @param PHPExcel_Worksheet_AutoFilter - * @return PHPExcel_Worksheet_AutoFilter_Column + * @param PHPExcel\Worksheet_AutoFilter + * @return PHPExcel\Worksheet_AutoFilter_Column */ - public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) { + public function setParent(PHPExcel\Worksheet_AutoFilter $pParent = NULL) { $this->_parent = $pParent; return $this; @@ -196,12 +198,12 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Type * * @param string $pFilterType - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) { if (!in_array($pFilterType,self::$_filterTypes)) { - throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.'); + throw new Exception('Invalid filter type for column AutoFilter.'); } $this->_filterType = $pFilterType; @@ -222,14 +224,14 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Multiple Rules And/Or * * @param string $pJoin And/Or - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) { // Lowercase And/Or $pJoin = strtolower($pJoin); if (!in_array($pJoin,self::$_ruleJoins)) { - throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.'); + throw new Exception('Invalid rule connection for column AutoFilter.'); } $this->_join = $pJoin; @@ -241,8 +243,8 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Attributes * * @param string[] $pAttributes - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setAttributes($pAttributes = array()) { $this->_attributes = $pAttributes; @@ -255,8 +257,8 @@ class PHPExcel_Worksheet_AutoFilter_Column * * @param string $pName Attribute Name * @param string $pValue Attribute Value - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setAttribute($pName, $pValue) { $this->_attributes[$pName] = $pValue; @@ -288,8 +290,8 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Get all AutoFilter Column Rules * - * @throws PHPExcel_Exception - * @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule + * @throws PHPExcel\Exception + * @return array of PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function getRules() { return $this->_ruleset; @@ -299,11 +301,11 @@ class PHPExcel_Worksheet_AutoFilter_Column * Get a specified AutoFilter Column Rule * * @param integer $pIndex Rule index in the ruleset array - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function getRule($pIndex) { if (!isset($this->_ruleset[$pIndex])) { - $this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); + $this->_ruleset[$pIndex] = new Worksheet_AutoFilter_Column_Rule($this); } return $this->_ruleset[$pIndex]; } @@ -311,10 +313,10 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Create a new AutoFilter Column Rule in the ruleset * - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function createRule() { - $this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); + $this->_ruleset[] = new Worksheet_AutoFilter_Column_Rule($this); return end($this->_ruleset); } @@ -322,11 +324,11 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Add a new AutoFilter Column Rule to the ruleset * - * @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule + * @param PHPExcel\Worksheet_AutoFilter_Column_Rule $pRule * @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned - * @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule + * @return PHPExcel\Worksheet_AutoFilter_Column|PHPExcel\Worksheet_AutoFilter_Column_Rule */ - public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) { + public function addRule(Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) { $pRule->setParent($this); $this->_ruleset[] = $pRule; @@ -338,7 +340,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * If the number of rules is reduced to 1, then we reset And/Or logic to Or * * @param integer $pIndex Rule index in the ruleset array - * @return PHPExcel_Worksheet_AutoFilter_Column + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function deleteRule($pIndex) { if (isset($this->_ruleset[$pIndex])) { @@ -355,7 +357,7 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Delete all AutoFilter Column Rules * - * @return PHPExcel_Worksheet_AutoFilter_Column + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function clearRules() { $this->_ruleset = array(); @@ -378,7 +380,7 @@ class PHPExcel_Worksheet_AutoFilter_Column $this->$key = clone $value; } } elseif ((is_array($value)) && ($key == '_ruleset')) { - // The columns array of PHPExcel_Worksheet_AutoFilter objects + // The columns array of PHPExcel\Worksheet_AutoFilter objects $this->$key = array(); foreach ($value as $k => $v) { $this->$key[$k] = clone $v; diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php index 1b8c03e..391993e 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_AutoFilter_Column_Rule + * PHPExcel\Worksheet_AutoFilter_Column_Rule * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_AutoFilter_Column_Rule +class Worksheet_AutoFilter_Column_Rule { const AUTOFILTER_RULETYPE_FILTER = 'filter'; const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem'; @@ -232,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule /** * Autofilter Column * - * @var PHPExcel_Worksheet_AutoFilter_Column + * @var PHPExcel\Worksheet_AutoFilter_Column */ private $_parent = NULL; @@ -268,11 +270,11 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule /** - * Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule + * Create a new PHPExcel\Worksheet_AutoFilter_Column_Rule * - * @param PHPExcel_Worksheet_AutoFilter_Column $pParent + * @param PHPExcel\Worksheet_AutoFilter_Column $pParent */ - public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) + public function __construct(Worksheet_AutoFilter_Column $pParent = NULL) { $this->_parent = $pParent; } @@ -290,12 +292,12 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Type * * @param string $pRuleType - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) { if (!in_array($pRuleType,self::$_ruleTypes)) { - throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); + throw new Exception('Invalid rule type for column AutoFilter Rule.'); } $this->_ruleType = $pRuleType; @@ -316,8 +318,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Value * * @param string|string[] $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function setValue($pValue = '') { if (is_array($pValue)) { @@ -333,7 +335,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule } } if (count($pValue) == 0) { - throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.'); + throw new Exception('Invalid rule value for column AutoFilter Rule.'); } // Set the dateTime grouping that we've anticipated $this->setGrouping(self::$_dateTimeGroups[$grouping]); @@ -356,15 +358,15 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Operator * * @param string $pOperator - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) { if (empty($pOperator)) $pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL; if ((!in_array($pOperator,self::$_operators)) && (!in_array($pOperator,self::$_topTenValue))) { - throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.'); + throw new Exception('Invalid operator for column AutoFilter Rule.'); } $this->_operator = $pOperator; @@ -384,15 +386,15 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Grouping * * @param string $pGrouping - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function setGrouping($pGrouping = NULL) { if (($pGrouping !== NULL) && (!in_array($pGrouping,self::$_dateTimeGroups)) && (!in_array($pGrouping,self::$_dynamicTypes)) && (!in_array($pGrouping,self::$_topTenType))) { - throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); + throw new Exception('Invalid rule type for column AutoFilter Rule.'); } $this->_grouping = $pGrouping; @@ -406,8 +408,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * @param string $pOperator * @param string|string[] $pValue * @param string $pGrouping - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) { $this->setOperator($pOperator); @@ -424,7 +426,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule /** * Get this Rule's AutoFilter Column Parent * - * @return PHPExcel_Worksheet_AutoFilter_Column + * @return PHPExcel\Worksheet_AutoFilter_Column */ public function getParent() { return $this->_parent; @@ -433,10 +435,10 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule /** * Set this Rule's AutoFilter Column Parent * - * @param PHPExcel_Worksheet_AutoFilter_Column - * @return PHPExcel_Worksheet_AutoFilter_Column_Rule + * @param PHPExcel\Worksheet_AutoFilter_Column + * @return PHPExcel\Worksheet_AutoFilter_Column_Rule */ - public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) { + public function setParent(Worksheet_AutoFilter_Column $pParent = NULL) { $this->_parent = $pParent; return $this; diff --git a/Classes/PHPExcel/Worksheet/BaseDrawing.php b/Classes/PHPExcel/Worksheet/BaseDrawing.php index 392c4d5..ba83143 100644 --- a/Classes/PHPExcel/Worksheet/BaseDrawing.php +++ b/Classes/PHPExcel/Worksheet/BaseDrawing.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_BaseDrawing + * PHPExcel\Worksheet_BaseDrawing * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +class Worksheet_BaseDrawing implements IComparable { /** * Image counter @@ -66,7 +68,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ protected $_worksheet; @@ -122,12 +124,12 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Shadow * - * @var PHPExcel_Worksheet_Drawing_Shadow + * @var PHPExcel\Worksheet_Drawing_Shadow */ protected $_shadow; /** - * Create a new PHPExcel_Worksheet_BaseDrawing + * Create a new PHPExcel\Worksheet_BaseDrawing */ public function __construct() { @@ -142,7 +144,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable $this->_height = 0; $this->_resizeProportional = true; $this->_rotation = 0; - $this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow(); + $this->_shadow = new Worksheet_Drawing_Shadow(); // Set image index self::$_imageCounter++; @@ -171,7 +173,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Name * * @param string $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setName($pValue = '') { $this->_name = $pValue; @@ -191,7 +193,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Description * * @param string $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setDescription($pValue = '') { $this->_description = $pValue; @@ -201,7 +203,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Get Worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function getWorksheet() { return $this->_worksheet; @@ -210,20 +212,20 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Set Worksheet * - * @param PHPExcel_Worksheet $pValue + * @param PHPExcel\Worksheet $pValue * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_BaseDrawing + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_BaseDrawing */ - public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) { + public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false) { if (is_null($this->_worksheet)) { - // Add drawing to PHPExcel_Worksheet + // Add drawing to PHPExcel\Worksheet $this->_worksheet = $pValue; $this->_worksheet->getCell($this->_coordinates); $this->_worksheet->getDrawingCollection()->append($this); } else { if ($pOverrideOld) { - // Remove drawing from old PHPExcel_Worksheet + // Remove drawing from old PHPExcel\Worksheet $iterator = $this->_worksheet->getDrawingCollection()->getIterator(); while ($iterator->valid()) { @@ -234,10 +236,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable } } - // Set new PHPExcel_Worksheet + // Set new PHPExcel\Worksheet $this->setWorksheet($pValue); } else { - throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); + throw new Exception("A PHPExcel\Worksheet has already been assigned. Drawings can only exist on one PHPExcel\Worksheet."); } } return $this; @@ -256,7 +258,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Coordinates * * @param string $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setCoordinates($pValue = 'A1') { $this->_coordinates = $pValue; @@ -276,7 +278,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set OffsetX * * @param int $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setOffsetX($pValue = 0) { $this->_offsetX = $pValue; @@ -296,7 +298,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set OffsetY * * @param int $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setOffsetY($pValue = 0) { $this->_offsetY = $pValue; @@ -316,7 +318,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Width * * @param int $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setWidth($pValue = 0) { // Resize proportional? @@ -344,7 +346,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Height * * @param int $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setHeight($pValue = 0) { // Resize proportional? @@ -370,7 +372,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * @author Vincent@luo MSN:kele_100@hotmail.com * @param int $width * @param int $height - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setWidthAndHeight($width = 0, $height = 0) { $xratio = $width / $this->_width; @@ -400,7 +402,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set ResizeProportional * * @param boolean $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setResizeProportional($pValue = true) { $this->_resizeProportional = $pValue; @@ -420,7 +422,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Rotation * * @param int $pValue - * @return PHPExcel_Worksheet_BaseDrawing + * @return PHPExcel\Worksheet_BaseDrawing */ public function setRotation($pValue = 0) { $this->_rotation = $pValue; @@ -430,7 +432,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Get Shadow * - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function getShadow() { return $this->_shadow; @@ -439,11 +441,11 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable /** * Set Shadow * - * @param PHPExcel_Worksheet_Drawing_Shadow $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_BaseDrawing + * @param PHPExcel\Worksheet_Drawing_Shadow $pValue + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_BaseDrawing */ - public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) { + public function setShadow(Worksheet_Drawing_Shadow $pValue = null) { $this->_shadow = $pValue; return $this; } diff --git a/Classes/PHPExcel/Worksheet/CellIterator.php b/Classes/PHPExcel/Worksheet/CellIterator.php index f349d2a..a64bf94 100644 --- a/Classes/PHPExcel/Worksheet/CellIterator.php +++ b/Classes/PHPExcel/Worksheet/CellIterator.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_CellIterator + * PHPExcel\Worksheet_CellIterator * - * Used to iterate rows in a PHPExcel_Worksheet + * Used to iterate rows in a PHPExcel\Worksheet * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_CellIterator implements Iterator +class Worksheet_CellIterator implements \Iterator { /** - * PHPExcel_Worksheet to iterate + * PHPExcel\Worksheet to iterate * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_subject; @@ -68,10 +70,10 @@ class PHPExcel_Worksheet_CellIterator implements Iterator /** * Create a new cell iterator * - * @param PHPExcel_Worksheet $subject + * @param PHPExcel\Worksheet $subject * @param int $rowIndex */ - public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1) { + public function __construct(Worksheet $subject = null, $rowIndex = 1) { // Set subject and row index $this->_subject = $subject; $this->_rowIndex = $rowIndex; @@ -92,9 +94,9 @@ class PHPExcel_Worksheet_CellIterator implements Iterator } /** - * Current PHPExcel_Cell + * Current PHPExcel\Cell * - * @return PHPExcel_Cell + * @return PHPExcel\Cell */ public function current() { return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex); @@ -117,7 +119,7 @@ class PHPExcel_Worksheet_CellIterator implements Iterator } /** - * Are there any more PHPExcel_Cell instances available? + * Are there any more PHPExcel\Cell instances available? * * @return boolean */ @@ -125,7 +127,7 @@ class PHPExcel_Worksheet_CellIterator implements Iterator // columnIndexFromString() returns an index based at one, // treat it as a count when comparing it to the base zero // position. - $columnCount = PHPExcel_Cell::columnIndexFromString($this->_subject->getHighestColumn()); + $columnCount = Cell::columnIndexFromString($this->_subject->getHighestColumn()); if ($this->_onlyExistingCells) { // If we aren't looking at an existing cell, either diff --git a/Classes/PHPExcel/Worksheet/ColumnDimension.php b/Classes/PHPExcel/Worksheet/ColumnDimension.php index dddb287..cc39681 100644 --- a/Classes/PHPExcel/Worksheet/ColumnDimension.php +++ b/Classes/PHPExcel/Worksheet/ColumnDimension.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_ColumnDimension * @@ -33,7 +35,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_ColumnDimension +class Worksheet_ColumnDimension { /** * Column index diff --git a/Classes/PHPExcel/Worksheet/Drawing.php b/Classes/PHPExcel/Worksheet/Drawing.php index d3efa6a..cdcc22f 100644 --- a/Classes/PHPExcel/Worksheet/Drawing.php +++ b/Classes/PHPExcel/Worksheet/Drawing.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package PHPExcel\Worksheet_Drawing * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_Drawing + * PHPExcel\Worksheet_Drawing * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package PHPExcel\Worksheet_Drawing * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +class Worksheet_Drawing extends Worksheet_BaseDrawing implements IComparable { /** * Path @@ -43,7 +45,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen private $_path; /** - * Create a new PHPExcel_Worksheet_Drawing + * Create a new PHPExcel\Worksheet_Drawing */ public function __construct() { @@ -98,8 +100,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen * * @param string $pValue File path * @param boolean $pVerifyFile Verify file - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_Drawing + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_Drawing */ public function setPath($pValue = '', $pVerifyFile = true) { if ($pVerifyFile) { @@ -111,7 +113,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen list($this->_width, $this->_height) = getimagesize($pValue); } } else { - throw new PHPExcel_Exception("File $pValue not found!"); + throw new Exception("File $pValue not found!"); } } else { $this->_path = $pValue; diff --git a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php index 646b064..d63455d 100644 --- a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php +++ b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package PHPExcel\Worksheet_Drawing * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_Drawing_Shadow + * PHPExcel\Worksheet_Drawing_Shadow * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package PHPExcel\Worksheet_Drawing * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable +class Worksheet_Drawing_Shadow implements IComparable { /* Shadow alignment */ const SHADOW_BOTTOM = 'b'; @@ -87,7 +89,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable /** * Color * - * @var PHPExcel_Style_Color + * @var PHPExcel\Style_Color */ private $_color; @@ -99,7 +101,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable private $_alpha; /** - * Create a new PHPExcel_Worksheet_Drawing_Shadow + * Create a new PHPExcel\Worksheet_Drawing_Shadow */ public function __construct() { @@ -108,8 +110,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable $this->_blurRadius = 6; $this->_distance = 2; $this->_direction = 0; - $this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); + $this->_alignment = Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; + $this->_color = new Style_Color(Style_Color::COLOR_BLACK); $this->_alpha = 50; } @@ -126,7 +128,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Visible * * @param boolean $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setVisible($pValue = false) { $this->_visible = $pValue; @@ -146,7 +148,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Blur radius * * @param int $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setBlurRadius($pValue = 6) { $this->_blurRadius = $pValue; @@ -166,7 +168,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Shadow distance * * @param int $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setDistance($pValue = 2) { $this->_distance = $pValue; @@ -186,7 +188,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Shadow direction (in degrees) * * @param int $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setDirection($pValue = 0) { $this->_direction = $pValue; @@ -206,7 +208,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Shadow alignment * * @param int $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setAlignment($pValue = 0) { $this->_alignment = $pValue; @@ -216,7 +218,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable /** * Get Color * - * @return PHPExcel_Style_Color + * @return PHPExcel\Style_Color */ public function getColor() { return $this->_color; @@ -225,11 +227,11 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable /** * Set Color * - * @param PHPExcel_Style_Color $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_Drawing_Shadow + * @param PHPExcel\Style_Color $pValue + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_Drawing_Shadow */ - public function setColor(PHPExcel_Style_Color $pValue = null) { + public function setColor(Style_Color $pValue = null) { $this->_color = $pValue; return $this; } @@ -247,7 +249,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Alpha * * @param int $pValue - * @return PHPExcel_Worksheet_Drawing_Shadow + * @return PHPExcel\Worksheet_Drawing_Shadow */ public function setAlpha($pValue = 0) { $this->_alpha = $pValue; diff --git a/Classes/PHPExcel/Worksheet/HeaderFooter.php b/Classes/PHPExcel/Worksheet/HeaderFooter.php index 88c35da..b4e8013 100644 --- a/Classes/PHPExcel/Worksheet/HeaderFooter.php +++ b/Classes/PHPExcel/Worksheet/HeaderFooter.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_HeaderFooter * @@ -93,7 +95,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_HeaderFooter +class Worksheet_HeaderFooter { /* Header/footer image location */ const IMAGE_HEADER_LEFT = 'LH'; diff --git a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php index 7dd03a0..b006dae 100644 --- a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php +++ b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_HeaderFooterDrawing + * PHPExcel\Worksheet_HeaderFooterDrawing * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable +class Worksheet_HeaderFooterDrawing extends Worksheet_Drawing implements IComparable { /** * Path @@ -85,7 +87,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing protected $_resizeProportional; /** - * Create a new PHPExcel_Worksheet_HeaderFooterDrawing + * Create a new PHPExcel\Worksheet_HeaderFooterDrawing */ public function __construct() { @@ -112,7 +114,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set Name * * @param string $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setName($pValue = '') { $this->_name = $pValue; @@ -132,7 +134,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set OffsetX * * @param int $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setOffsetX($pValue = 0) { $this->_offsetX = $pValue; @@ -152,7 +154,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set OffsetY * * @param int $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setOffsetY($pValue = 0) { $this->_offsetY = $pValue; @@ -172,7 +174,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set Width * * @param int $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setWidth($pValue = 0) { // Resize proportional? @@ -200,7 +202,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set Height * * @param int $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setHeight($pValue = 0) { // Resize proportional? @@ -226,7 +228,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * @author Vincent@luo MSN:kele_100@hotmail.com * @param int $width * @param int $height - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setWidthAndHeight($width = 0, $height = 0) { $xratio = $width / $this->_width; @@ -256,7 +258,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * Set ResizeProportional * * @param boolean $pValue - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setResizeProportional($pValue = true) { $this->_resizeProportional = $pValue; @@ -296,8 +298,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * * @param string $pValue File path * @param boolean $pVerifyFile Verify file - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_HeaderFooterDrawing + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_HeaderFooterDrawing */ public function setPath($pValue = '', $pVerifyFile = true) { if ($pVerifyFile) { @@ -309,7 +311,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing list($this->_width, $this->_height) = getimagesize($pValue); } } else { - throw new PHPExcel_Exception("File $pValue not found!"); + throw new Exception("File $pValue not found!"); } } else { $this->_path = $pValue; diff --git a/Classes/PHPExcel/Worksheet/MemoryDrawing.php b/Classes/PHPExcel/Worksheet/MemoryDrawing.php index 753a135..3d871e3 100644 --- a/Classes/PHPExcel/Worksheet/MemoryDrawing.php +++ b/Classes/PHPExcel/Worksheet/MemoryDrawing.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_MemoryDrawing + * PHPExcel\Worksheet_MemoryDrawing * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +class Worksheet_MemoryDrawing extends Worksheet_BaseDrawing implements IComparable { /* Rendering functions */ const RENDERING_DEFAULT = 'imagepng'; @@ -76,7 +78,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im private $_uniqueName; /** - * Create a new PHPExcel_Worksheet_MemoryDrawing + * Create a new PHPExcel\Worksheet_MemoryDrawing */ public function __construct() { @@ -103,7 +105,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im * Set image resource * * @param $value resource - * @return PHPExcel_Worksheet_MemoryDrawing + * @return PHPExcel\Worksheet_MemoryDrawing */ public function setImageResource($value = null) { $this->_imageResource = $value; @@ -129,9 +131,9 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im * Set rendering function * * @param string $value - * @return PHPExcel_Worksheet_MemoryDrawing + * @return PHPExcel\Worksheet_MemoryDrawing */ - public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) { + public function setRenderingFunction($value = Worksheet_MemoryDrawing::RENDERING_DEFAULT) { $this->_renderingFunction = $value; return $this; } @@ -149,9 +151,9 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im * Set mime type * * @param string $value - * @return PHPExcel_Worksheet_MemoryDrawing + * @return PHPExcel\Worksheet_MemoryDrawing */ - public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) { + public function setMimeType($value = Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) { $this->_mimeType = $value; return $this; } diff --git a/Classes/PHPExcel/Worksheet/PageMargins.php b/Classes/PHPExcel/Worksheet/PageMargins.php index 8fc4cbe..80d10da 100644 --- a/Classes/PHPExcel/Worksheet/PageMargins.php +++ b/Classes/PHPExcel/Worksheet/PageMargins.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_PageMargins * @@ -33,7 +35,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_PageMargins +class Worksheet_PageMargins { /** * Left diff --git a/Classes/PHPExcel/Worksheet/PageSetup.php b/Classes/PHPExcel/Worksheet/PageSetup.php index e822754..1a242fb 100644 --- a/Classes/PHPExcel/Worksheet/PageSetup.php +++ b/Classes/PHPExcel/Worksheet/PageSetup.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_PageSetup * @@ -104,7 +106,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_PageSetup +class Worksheet_PageSetup { /* Paper size */ const PAPERSIZE_LETTER = 1; @@ -189,14 +191,14 @@ class PHPExcel_Worksheet_PageSetup * * @var int */ - private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; + private $_paperSize = Worksheet_PageSetup::PAPERSIZE_LETTER; /** * Orientation * * @var string */ - private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; + private $_orientation = Worksheet_PageSetup::ORIENTATION_DEFAULT; /** * Scale (Print Scale) diff --git a/Classes/PHPExcel/Worksheet/Protection.php b/Classes/PHPExcel/Worksheet/Protection.php index e968c11..c1f7046 100644 --- a/Classes/PHPExcel/Worksheet/Protection.php +++ b/Classes/PHPExcel/Worksheet/Protection.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_Protection * @@ -33,7 +35,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_Protection +class Worksheet_Protection { /** * Sheet diff --git a/Classes/PHPExcel/Worksheet/Row.php b/Classes/PHPExcel/Worksheet/Row.php index 07025e8..81e0f2b 100644 --- a/Classes/PHPExcel/Worksheet/Row.php +++ b/Classes/PHPExcel/Worksheet/Row.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_Row + * PHPExcel\Worksheet_Row * - * Represents a row in PHPExcel_Worksheet, used by PHPExcel_Worksheet_RowIterator + * Represents a row in PHPExcel\Worksheet, used by PHPExcel\Worksheet_RowIterator * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_Row +class Worksheet_Row { /** - * PHPExcel_Worksheet + * PHPExcel\Worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_parent; @@ -54,10 +56,10 @@ class PHPExcel_Worksheet_Row /** * Create a new row * - * @param PHPExcel_Worksheet $parent + * @param PHPExcel\Worksheet $parent * @param int $rowIndex */ - public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1) { + public function __construct(Worksheet $parent = null, $rowIndex = 1) { // Set parent and row index $this->_parent = $parent; $this->_rowIndex = $rowIndex; @@ -82,9 +84,9 @@ class PHPExcel_Worksheet_Row /** * Get cell iterator * - * @return PHPExcel_Worksheet_CellIterator + * @return PHPExcel\Worksheet_CellIterator */ public function getCellIterator() { - return new PHPExcel_Worksheet_CellIterator($this->_parent, $this->_rowIndex); + return new Worksheet_CellIterator($this->_parent, $this->_rowIndex); } } diff --git a/Classes/PHPExcel/Worksheet/RowDimension.php b/Classes/PHPExcel/Worksheet/RowDimension.php index 1c6abaa..5609556 100644 --- a/Classes/PHPExcel/Worksheet/RowDimension.php +++ b/Classes/PHPExcel/Worksheet/RowDimension.php @@ -26,6 +26,8 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_RowDimension * @@ -33,7 +35,7 @@ * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_RowDimension +class Worksheet_RowDimension { /** * Row index diff --git a/Classes/PHPExcel/Worksheet/RowIterator.php b/Classes/PHPExcel/Worksheet/RowIterator.php index 840f7f9..a3bb0b1 100644 --- a/Classes/PHPExcel/Worksheet/RowIterator.php +++ b/Classes/PHPExcel/Worksheet/RowIterator.php @@ -19,28 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Worksheet_RowIterator + * PHPExcel\Worksheet_RowIterator * - * Used to iterate rows in a PHPExcel_Worksheet + * Used to iterate rows in a PHPExcel\Worksheet * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_RowIterator implements Iterator +class Worksheet_RowIterator implements \Iterator { /** - * PHPExcel_Worksheet to iterate + * PHPExcel\Worksheet to iterate * - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ private $_subject; @@ -62,10 +64,10 @@ class PHPExcel_Worksheet_RowIterator implements Iterator /** * Create a new row iterator * - * @param PHPExcel_Worksheet $subject The worksheet to iterate over + * @param PHPExcel\Worksheet $subject The worksheet to iterate over * @param integer $startRow The row number at which to start iterating */ - public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1) { + public function __construct(Worksheet $subject = null, $startRow = 1) { // Set subject $this->_subject = $subject; $this->resetStart($startRow); @@ -107,10 +109,10 @@ class PHPExcel_Worksheet_RowIterator implements Iterator /** * Return the current row in this worksheet * - * @return PHPExcel_Worksheet_Row + * @return PHPExcel\Worksheet_Row */ public function current() { - return new PHPExcel_Worksheet_Row($this->_subject, $this->_position); + return new Worksheet_Row($this->_subject, $this->_position); } /** diff --git a/Classes/PHPExcel/Worksheet/SheetView.php b/Classes/PHPExcel/Worksheet/SheetView.php index f37ba81..a2d208a 100644 --- a/Classes/PHPExcel/Worksheet/SheetView.php +++ b/Classes/PHPExcel/Worksheet/SheetView.php @@ -26,14 +26,16 @@ */ +namespace PHPExcel; + /** * PHPExcel_Worksheet_SheetView * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Worksheet_SheetView +class Worksheet_SheetView { /* Sheet View types */ @@ -75,7 +77,7 @@ class PHPExcel_Worksheet_SheetView private $_sheetviewType = self::SHEETVIEW_NORMAL; /** - * Create a new PHPExcel_Worksheet_SheetView + * Create a new PHPExcel\Worksheet_SheetView */ public function __construct() { @@ -96,8 +98,8 @@ class PHPExcel_Worksheet_SheetView * Valid values range from 10 to 400. * * @param int $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_SheetView + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_SheetView */ public function setZoomScale($pValue = 100) { // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, @@ -105,7 +107,7 @@ class PHPExcel_Worksheet_SheetView if (($pValue >= 1) || is_null($pValue)) { $this->_zoomScale = $pValue; } else { - throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); + throw new Exception("Scale must be greater than or equal to 1."); } return $this; } @@ -125,14 +127,14 @@ class PHPExcel_Worksheet_SheetView * Valid values range from 10 to 400. * * @param int $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_SheetView + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_SheetView */ public function setZoomScaleNormal($pValue = 100) { if (($pValue >= 1) || is_null($pValue)) { $this->_zoomScaleNormal = $pValue; } else { - throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); + throw new Exception("Scale must be greater than or equal to 1."); } return $this; } @@ -155,8 +157,8 @@ class PHPExcel_Worksheet_SheetView * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * * @param string $pValue - * @throws PHPExcel_Exception - * @return PHPExcel_Worksheet_SheetView + * @throws PHPExcel\Exception + * @return PHPExcel\Worksheet_SheetView */ public function setView($pValue = NULL) { // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' @@ -166,7 +168,7 @@ class PHPExcel_Worksheet_SheetView if (in_array($pValue, self::$_sheetViewTypes)) { $this->_sheetviewType = $pValue; } else { - throw new PHPExcel_Exception("Invalid sheetview layout type."); + throw new Exception("Invalid sheetview layout type."); } return $this; diff --git a/Classes/PHPExcel/WorksheetIterator.php b/Classes/PHPExcel/WorksheetIterator.php index 27cc1d2..5a891cc 100644 --- a/Classes/PHPExcel/WorksheetIterator.php +++ b/Classes/PHPExcel/WorksheetIterator.php @@ -26,8 +26,10 @@ */ +namespace PHPExcel; + /** - * PHPExcel_WorksheetIterator + * PHPExcel\WorksheetIterator * * Used to iterate worksheets in PHPExcel * @@ -35,7 +37,7 @@ * @package PHPExcel * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_WorksheetIterator implements Iterator +class WorksheetIterator implements \Iterator { /** * Spreadsheet to iterate @@ -56,7 +58,7 @@ class PHPExcel_WorksheetIterator implements Iterator * * @param PHPExcel $subject */ - public function __construct(PHPExcel $subject = null) + public function __construct(Workbook $subject = null) { // Set subject $this->_subject = $subject; @@ -79,9 +81,9 @@ class PHPExcel_WorksheetIterator implements Iterator } /** - * Current PHPExcel_Worksheet + * Current PHPExcel\Worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel\Worksheet */ public function current() { @@ -107,7 +109,7 @@ class PHPExcel_WorksheetIterator implements Iterator } /** - * More PHPExcel_Worksheet instances available? + * More PHPExcel\Worksheet instances available? * * @return boolean */ diff --git a/Classes/PHPExcel/Writer/Abstract.php b/Classes/PHPExcel/Writer/Abstract.php index 8b9fe50..7a0f749 100644 --- a/Classes/PHPExcel/Writer/Abstract.php +++ b/Classes/PHPExcel/Writer/Abstract.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Abstract + * PHPExcel\Writer_Abstract * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter +abstract class Writer_Abstract implements Writer_IWriter { /** * Write charts that are defined in the workbook? @@ -83,7 +85,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter * Set to false (the default) to ignore charts. * * @param boolean $pValue - * @return PHPExcel_Writer_IWriter + * @return PHPExcel\Writer_IWriter */ public function setIncludeCharts($pValue = FALSE) { $this->_includeCharts = (boolean) $pValue; @@ -110,7 +112,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter * Set to false to prevent precalculation of formulae on save. * * @param boolean $pValue Pre-Calculate Formulas? - * @return PHPExcel_Writer_IWriter + * @return PHPExcel\Writer_IWriter */ public function setPreCalculateFormulas($pValue = TRUE) { $this->_preCalculateFormulas = (boolean) $pValue; @@ -131,8 +133,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter * * @param boolean $pValue * @param string $pDirectory Disk caching directory - * @throws PHPExcel_Writer_Exception when directory does not exist - * @return PHPExcel_Writer_Excel2007 + * @throws PHPExcel\Writer_Exception when directory does not exist + * @return PHPExcel\Writer_Excel2007 */ public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) { $this->_useDiskCaching = $pValue; @@ -141,7 +143,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter if (is_dir($pDirectory)) { $this->_diskCachingDirectory = $pDirectory; } else { - throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory"); + throw new Writer_Exception("Directory does not exist: $pDirectory"); } } return $this; diff --git a/Classes/PHPExcel/Writer/CSV.php b/Classes/PHPExcel/Writer/CSV.php index 2ca7c25..6e94771 100644 --- a/Classes/PHPExcel/Writer/CSV.php +++ b/Classes/PHPExcel/Writer/CSV.php @@ -19,21 +19,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_CSV + * @package PHPExcel\Writer_CSV * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; /** - * PHPExcel_Writer_CSV + * PHPExcel\Writer_CSV * * @category PHPExcel - * @package PHPExcel_Writer_CSV + * @package PHPExcel\Writer_CSV * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { +class Writer_CSV extends Writer_Abstract implements Writer_IWriter { /** * PHPExcel object * @@ -84,11 +85,11 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W private $_excelCompatibility = false; /** - * Create a new PHPExcel_Writer_CSV + * Create a new PHPExcel\Writer_CSV * - * @param PHPExcel $phpExcel PHPExcel object + * @param PHPExcel\Workbook $phpExcel PHPExcel object */ - public function __construct(PHPExcel $phpExcel) { + public function __construct(Workbook $phpExcel) { $this->_phpExcel = $phpExcel; } @@ -96,21 +97,21 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = null) { // Fetch sheet $sheet = $this->_phpExcel->getSheet($this->_sheetIndex); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + $saveDebugLog = Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); + $saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); // Open file $fileHandle = fopen($pFilename, 'wb+'); if ($fileHandle === false) { - throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + throw new Writer_Exception("Could not open file $pFilename for writing."); } if ($this->_excelCompatibility) { @@ -138,8 +139,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W // Close file fclose($fileHandle); - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); + Calculation::setArrayReturnType($saveArrayReturnType); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -155,7 +156,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Set delimiter * * @param string $pValue Delimiter, defaults to , - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setDelimiter($pValue = ',') { $this->_delimiter = $pValue; @@ -175,7 +176,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Set enclosure * * @param string $pValue Enclosure, defaults to " - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setEnclosure($pValue = '"') { if ($pValue == '') { @@ -198,7 +199,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Set line ending * * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setLineEnding($pValue = PHP_EOL) { $this->_lineEnding = $pValue; @@ -218,7 +219,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Set whether BOM should be used * * @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setUseBOM($pValue = false) { $this->_useBOM = $pValue; @@ -239,7 +240,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * * @param boolean $pValue Set the file to be written as a fully Excel compatible csv file * Note that this overrides other settings such as useBOM, enclosure and delimiter - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setExcelCompatibility($pValue = false) { $this->_excelCompatibility = $pValue; @@ -259,7 +260,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * Set sheet index * * @param int $pValue Sheet index - * @return PHPExcel_Writer_CSV + * @return PHPExcel\Writer_CSV */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; @@ -271,7 +272,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * * @param mixed $pFileHandle PHP filehandle * @param array $pValues Array containing values in a row - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ private function _writeLine($pFileHandle = null, $pValues = null) { if (is_array($pValues)) { @@ -306,7 +307,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W fwrite($pFileHandle, $line); } } else { - throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); + throw new Writer_Exception("Invalid data row passed to CSV writer."); } } diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php index 9c78dff..42ccfcd 100644 --- a/Classes/PHPExcel/Writer/Excel2007.php +++ b/Classes/PHPExcel/Writer/Excel2007.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007 + * PHPExcel\Writer_Excel2007 * * @category PHPExcel - * @package PHPExcel_Writer_2007 + * @package PHPExcel\Writer_2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter +class Writer_Excel2007 extends Writer_Abstract implements Writer_IWriter { /** * Office2003 compatibility @@ -45,7 +47,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE /** * Private writer parts * - * @var PHPExcel_Writer_Excel2007_WriterPart[] + * @var PHPExcel\Writer_Excel2007_WriterPart[] */ private $_writerParts = array(); @@ -64,68 +66,68 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE private $_stringTable = array(); /** - * Private unique PHPExcel_Style_Conditional HashTable + * Private unique PHPExcel\Style_Conditional HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_stylesConditionalHashTable; /** - * Private unique PHPExcel_Style_Fill HashTable + * Private unique PHPExcel\Style_Fill HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_fillHashTable; /** - * Private unique PHPExcel_Style_Font HashTable + * Private unique PHPExcel\Style_Font HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_fontHashTable; /** - * Private unique PHPExcel_Style_Borders HashTable + * Private unique PHPExcel\Style_Borders HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_bordersHashTable ; /** - * Private unique PHPExcel_Style_NumberFormat HashTable + * Private unique PHPExcel\Style_NumberFormat HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_numFmtHashTable; /** - * Private unique PHPExcel_Worksheet_BaseDrawing HashTable + * Private unique PHPExcel\Worksheet_BaseDrawing HashTable * - * @var PHPExcel_HashTable + * @var PHPExcel\HashTable */ private $_drawingHashTable; /** - * Create a new PHPExcel_Writer_Excel2007 + * Create a new PHPExcel\Writer_Excel2007 * * @param PHPExcel $pPHPExcel */ - public function __construct(PHPExcel $pPHPExcel = null) + public function __construct(Workbook $pPHPExcel = null) { // Assign PHPExcel $this->setPHPExcel($pPHPExcel); - $writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable', - 'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes', - 'docprops' => 'PHPExcel_Writer_Excel2007_DocProps', - 'rels' => 'PHPExcel_Writer_Excel2007_Rels', - 'theme' => 'PHPExcel_Writer_Excel2007_Theme', - 'style' => 'PHPExcel_Writer_Excel2007_Style', - 'workbook' => 'PHPExcel_Writer_Excel2007_Workbook', - 'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet', - 'drawing' => 'PHPExcel_Writer_Excel2007_Drawing', - 'comments' => 'PHPExcel_Writer_Excel2007_Comments', - 'chart' => 'PHPExcel_Writer_Excel2007_Chart', + $writerPartsArray = array( 'stringtable' => __NAMESPACE__ . '\Writer_Excel2007_StringTable', + 'contenttypes' => __NAMESPACE__ . '\Writer_Excel2007_ContentTypes', + 'docprops' => __NAMESPACE__ . '\Writer_Excel2007_DocProps', + 'rels' => __NAMESPACE__ . '\Writer_Excel2007_Rels', + 'theme' => __NAMESPACE__ . '\Writer_Excel2007_Theme', + 'style' => __NAMESPACE__ . '\Writer_Excel2007_Style', + 'workbook' => __NAMESPACE__ . '\Writer_Excel2007_Workbook', + 'worksheet' => __NAMESPACE__ . '\Writer_Excel2007_Worksheet', + 'drawing' => __NAMESPACE__ . '\Writer_Excel2007_Drawing', + 'comments' => __NAMESPACE__ . '\Writer_Excel2007_Comments', + 'chart' => __NAMESPACE__ . '\Writer_Excel2007_Chart', ); // Initialise writer parts @@ -140,7 +142,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE // Set HashTable variables foreach ($hashTablesArray as $tableName) { - $this->$tableName = new PHPExcel_HashTable(); + $this->$tableName = new HashTable(); } } @@ -148,7 +150,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE * Get writer part * * @param string $pPartName Writer part name - * @return PHPExcel_Writer_Excel2007_WriterPart + * @return PHPExcel\Writer_Excel2007_WriterPart */ public function getWriterPart($pPartName = '') { if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) { @@ -162,7 +164,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = null) { @@ -173,16 +175,16 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE // If $pFilename is php://output or php://stdout, make it a temporary file... $originalFilename = $pFilename; if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') { - $pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp'); + $pFilename = @tempnam(Shared_File::sys_get_temp_dir(), 'phpxltmp'); if ($pFilename == '') { $pFilename = $originalFilename; } } - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE); - $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveDebugLog = Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE); + $saveDateReturnType = Calculation_Functions::getReturnDateType(); + Calculation_Functions::setReturnDateType(Calculation_Functions::RETURNDATE_EXCEL); // Create string lookup table $this->_stringTable = array(); @@ -201,12 +203,12 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE $this->_drawingHashTable->addFromSource( $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet) ); // Create new ZIP file and open it for writing - $zipClass = PHPExcel_Settings::getZipClass(); + $zipClass = Settings::getZipClass(); $objZip = new $zipClass(); // Retrieve OVERWRITE and CREATE constants from the instantiated zip class // This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP - $ro = new ReflectionObject($objZip); + $ro = new \ReflectionObject($objZip); $zipOverWrite = $ro->getConstant('OVERWRITE'); $zipCreate = $ro->getConstant('CREATE'); @@ -216,7 +218,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE // Try opening the ZIP file if ($objZip->open($pFilename, $zipOverWrite) !== true) { if ($objZip->open($pFilename, $zipCreate) !== true) { - throw new PHPExcel_Writer_Exception("Could not open " . $pFilename . " for writing."); + throw new Writer_Exception("Could not open " . $pFilename . " for writing."); } } @@ -310,7 +312,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE // Add media for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { - if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + if ($this->getDrawingHashTable()->getByIndex($i) instanceof Worksheet_Drawing) { $imageContents = null; $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath(); if (strpos($imagePath, 'zip://') !== false) { @@ -327,7 +329,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE } $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); - } else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + } else if ($this->getDrawingHashTable()->getByIndex($i) instanceof Worksheet_MemoryDrawing) { ob_start(); call_user_func( $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), @@ -340,48 +342,48 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE } } - PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); - PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); + Calculation_Functions::setReturnDateType($saveDateReturnType); + Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); // Close file if ($objZip->close() === false) { - throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename."); + throw new Writer_Exception("Could not close zip file $pFilename."); } // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } } else { - throw new PHPExcel_Writer_Exception("PHPExcel object unassigned."); + throw new Writer_Exception("PHPExcel object unassigned."); } } /** * Get PHPExcel object * - * @return PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Workbook + * @throws PHPExcel\Writer_Exception */ public function getPHPExcel() { if ($this->_spreadSheet !== null) { return $this->_spreadSheet; } else { - throw new PHPExcel_Writer_Exception("No PHPExcel assigned."); + throw new Writer_Exception("No PHPExcel assigned."); } } /** * Set PHPExcel object * - * @param PHPExcel $pPHPExcel PHPExcel object - * @throws PHPExcel_Writer_Exception - * @return PHPExcel_Writer_Excel2007 + * @param PHPExcel\Workbook $pPHPExcel PHPExcel object + * @throws PHPExcel\Writer_Exception + * @return PHPExcel\Writer_Excel2007 */ - public function setPHPExcel(PHPExcel $pPHPExcel = null) { + public function setPHPExcel(Workbook $pPHPExcel = null) { $this->_spreadSheet = $pPHPExcel; return $this; } @@ -396,54 +398,54 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE } /** - * Get PHPExcel_Style_Conditional HashTable + * Get PHPExcel\Style_Conditional HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getStylesConditionalHashTable() { return $this->_stylesConditionalHashTable; } /** - * Get PHPExcel_Style_Fill HashTable + * Get PHPExcel\Style_Fill HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getFillHashTable() { return $this->_fillHashTable; } /** - * Get PHPExcel_Style_Font HashTable + * Get PHPExcel\Style_Font HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getFontHashTable() { return $this->_fontHashTable; } /** - * Get PHPExcel_Style_Borders HashTable + * Get PHPExcel\Style_Borders HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getBordersHashTable() { return $this->_bordersHashTable; } /** - * Get PHPExcel_Style_NumberFormat HashTable + * Get PHPExcel\Style_NumberFormat HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getNumFmtHashTable() { return $this->_numFmtHashTable; } /** - * Get PHPExcel_Worksheet_BaseDrawing HashTable + * Get PHPExcel\Worksheet_BaseDrawing HashTable * - * @return PHPExcel_HashTable + * @return PHPExcel\HashTable */ public function getDrawingHashTable() { return $this->_drawingHashTable; @@ -462,7 +464,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE * Set Office2003 compatibility * * @param boolean $pValue Office2003 compatibility? - * @return PHPExcel_Writer_Excel2007 + * @return PHPExcel\Writer_Excel2007 */ public function setOffice2003Compatibility($pValue = false) { $this->_office2003compatibility = $pValue; diff --git a/Classes/PHPExcel/Writer/Excel2007/Chart.php b/Classes/PHPExcel/Writer/Excel2007/Chart.php index 763f8af..4a29723 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Chart.php +++ b/Classes/PHPExcel/Writer/Excel2007/Chart.php @@ -19,37 +19,39 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Chart + * PHPExcel\Writer_Excel2007_Chart * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Chart extends Writer_Excel2007_WriterPart { /** * Write charts to XML format * - * @param PHPExcel_Chart $pChart + * @param PHPExcel\Chart $pChart * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeChart(PHPExcel_Chart $pChart = null) + public function writeChart(Chart $pChart = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // Ensure that data series values are up-to-date before we save $pChart->refresh(); @@ -118,11 +120,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Chart Title * - * @param PHPExcel_Chart_Title $title - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_Title $title + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) + private function _writeTitle(Chart_Title $title = null, $objWriter) { if (is_null($title)) { return; @@ -162,11 +164,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Chart Legend * - * @param PHPExcel_Chart_Legend $legend - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_Legend $legend + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) + private function _writeLegend(Chart_Legend $legend = null, $objWriter) { if (is_null($legend)) { return; @@ -213,17 +215,17 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Chart Plot Area * - * @param PHPExcel_Chart_PlotArea $plotArea - * @param PHPExcel_Chart_Title $xAxisLabel - * @param PHPExcel_Chart_Title $yAxisLabel - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_PlotArea $plotArea + * @param PHPExcel\Chart_Title $xAxisLabel + * @param PHPExcel\Chart_Title $yAxisLabel + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, - PHPExcel_Chart_Title $xAxisLabel = NULL, - PHPExcel_Chart_Title $yAxisLabel = NULL, + private function _writePlotArea(Chart_PlotArea $plotArea, + Chart_Title $xAxisLabel = NULL, + Chart_Title $yAxisLabel = NULL, $objWriter, - PHPExcel_Worksheet $pSheet) + Worksheet $pSheet) { if (is_null($plotArea)) { return; @@ -250,11 +252,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa if ($groupType == $chartType) { $plotStyle = $plotGroup->getPlotStyle(); - if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) { + if ($groupType === Chart_DataSeries::TYPE_RADARCHART) { $objWriter->startElement('c:radarStyle'); $objWriter->writeAttribute('val', $plotStyle ); $objWriter->endElement(); - } elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) { + } elseif ($groupType === Chart_DataSeries::TYPE_SCATTERCHART) { $objWriter->startElement('c:scatterStyle'); $objWriter->writeAttribute('val', $plotStyle ); $objWriter->endElement(); @@ -266,14 +268,14 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $this->_writeDataLbls($objWriter, $layout); - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) { + if ($chartType === Chart_DataSeries::TYPE_LINECHART) { // Line only, Line3D can't be smoothed $objWriter->startElement('c:smooth'); $objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine() ); $objWriter->endElement(); - } elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || - ($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) { + } elseif (($chartType === Chart_DataSeries::TYPE_BARCHART) || + ($chartType === Chart_DataSeries::TYPE_BARCHART_3D)) { $objWriter->startElement('c:gapWidth'); $objWriter->writeAttribute('val', 150 ); @@ -286,7 +288,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('val', 100 ); $objWriter->endElement(); } - } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + } elseif ($chartType === Chart_DataSeries::TYPE_BUBBLECHART) { $objWriter->startElement('c:bubbleScale'); $objWriter->writeAttribute('val', 25 ); @@ -295,7 +297,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('c:showNegBubbles'); $objWriter->writeAttribute('val', 0 ); $objWriter->endElement(); - } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) { + } elseif ($chartType === Chart_DataSeries::TYPE_STOCKCHART) { $objWriter->startElement('c:hiLowLines'); $objWriter->endElement(); @@ -309,9 +311,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $id1 = '75091328'; $id2 = '75089408'; - if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && - ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && - ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($chartType !== Chart_DataSeries::TYPE_PIECHART) && + ($chartType !== Chart_DataSeries::TYPE_PIECHART_3D) && + ($chartType !== Chart_DataSeries::TYPE_DONUTCHART)) { $objWriter->startElement('c:axId'); $objWriter->writeAttribute('val', $id1 ); @@ -324,7 +326,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('val', 0); $objWriter->endElement(); - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) { + if ($chartType === Chart_DataSeries::TYPE_DONUTCHART) { $objWriter->startElement('c:holeSize'); $objWriter->writeAttribute('val', 50); @@ -335,11 +337,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); } - if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && - ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && - ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($chartType !== Chart_DataSeries::TYPE_PIECHART) && + ($chartType !== Chart_DataSeries::TYPE_PIECHART_3D) && + ($chartType !== Chart_DataSeries::TYPE_DONUTCHART)) { - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($chartType === Chart_DataSeries::TYPE_BUBBLECHART) { $this->_writeValAx($objWriter,$plotArea,$xAxisLabel,$chartType,$id1,$id2,$catIsMultiLevelSeries); } else { $this->_writeCatAx($objWriter,$plotArea,$xAxisLabel,$chartType,$id1,$id2,$catIsMultiLevelSeries); @@ -354,9 +356,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Data Labels * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Chart_Layout $chartLayout Chart layout - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Chart_Layout $chartLayout Chart layout + * @throws PHPExcel\Writer_Exception */ private function _writeDataLbls($objWriter, $chartLayout) { @@ -404,16 +406,16 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Category Axis * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Chart_PlotArea $plotArea - * @param PHPExcel_Chart_Title $xAxisLabel + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Chart_PlotArea $plotArea + * @param PHPExcel\Chart_Title $xAxisLabel * @param string $groupType Chart type * @param string $id1 * @param string $id2 * @param boolean $isMultiLevelSeries - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) + private function _writeCatAx($objWriter, Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) { $objWriter->startElement('c:catAx'); @@ -456,7 +458,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $caption = $caption[0]; $objWriter->startElement('a:t'); // $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $caption )); + $objWriter->writeRawData(Shared_String::ControlCharacterPHP2OOXML( $caption )); $objWriter->endElement(); $objWriter->endElement(); @@ -527,16 +529,16 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Value Axis * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Chart_PlotArea $plotArea - * @param PHPExcel_Chart_Title $yAxisLabel + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Chart_PlotArea $plotArea + * @param PHPExcel\Chart_Title $yAxisLabel * @param string $groupType Chart type * @param string $id1 * @param string $id2 * @param boolean $isMultiLevelSeries - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) + private function _writeValAx($objWriter, Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) { $objWriter->startElement('c:valAx'); @@ -582,7 +584,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $caption = $caption[0]; $objWriter->startElement('a:t'); // $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $caption )); + $objWriter->writeRawData(Shared_String::ControlCharacterPHP2OOXML( $caption )); $objWriter->endElement(); $objWriter->endElement(); @@ -590,7 +592,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); $objWriter->endElement(); - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType !== Chart_DataSeries::TYPE_BUBBLECHART) { $layout = $yAxisLabel->getLayout(); $this->_writeLayout($layout, $objWriter); } @@ -634,7 +636,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } if ($isMultiLevelSeries) { - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType !== Chart_DataSeries::TYPE_BUBBLECHART) { $objWriter->startElement('c:noMultiLvlLbl'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); @@ -648,9 +650,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Get the data series type(s) for a chart plot series * - * @param PHPExcel_Chart_PlotArea $plotArea + * @param PHPExcel\Chart_PlotArea $plotArea * @return string|array - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ private static function _getChartType($plotArea) { @@ -665,7 +667,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } $chartType = array_unique($chartTypes); if (count($chartTypes) == 0) { - throw new PHPExcel_Writer_Exception('Chart is not yet implemented'); + throw new Writer_Exception('Chart is not yet implemented'); } } @@ -675,14 +677,14 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Plot Group (series of related plots) * - * @param PHPExcel_Chart_DataSeries $plotGroup + * @param PHPExcel\Chart_DataSeries $plotGroup * @param string $groupType Type of plot for dataseries - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param boolean &$catIsMultiLevelSeries Is category a multi-series category * @param boolean &$valIsMultiLevelSeries Is value set a multi-series set * @param string &$plotGroupingType Type of grouping for multi-series values - * @param PHPExcel_Worksheet $pSheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Worksheet $pSheet + * @throws PHPExcel\Writer_Exception */ private function _writePlotGroup( $plotGroup, $groupType, @@ -690,15 +692,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, - PHPExcel_Worksheet $pSheet + Worksheet $pSheet ) { if (is_null($plotGroup)) { return; } - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) { + if (($groupType == Chart_DataSeries::TYPE_BARCHART) || + ($groupType == Chart_DataSeries::TYPE_BARCHART_3D)) { $objWriter->startElement('c:barDir'); $objWriter->writeAttribute('val', $plotGroup->getPlotDirection()); $objWriter->endElement(); @@ -715,13 +717,13 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $plotSeriesOrder = $plotGroup->getPlotOrder(); $plotSeriesCount = count($plotSeriesOrder); - if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && - ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) { + if (($groupType !== Chart_DataSeries::TYPE_RADARCHART) && + ($groupType !== Chart_DataSeries::TYPE_STOCKCHART)) { - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) { - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || + if ($groupType !== Chart_DataSeries::TYPE_LINECHART) { + if (($groupType == Chart_DataSeries::TYPE_PIECHART) || + ($groupType == Chart_DataSeries::TYPE_PIECHART_3D) || + ($groupType == Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) { $objWriter->startElement('c:varyColors'); $objWriter->writeAttribute('val', 1); @@ -745,9 +747,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef); $objWriter->endElement(); - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType == Chart_DataSeries::TYPE_PIECHART) || + ($groupType == Chart_DataSeries::TYPE_PIECHART_3D) || + ($groupType == Chart_DataSeries::TYPE_DONUTCHART)) { $objWriter->startElement('c:dPt'); $objWriter->startElement('c:idx'); @@ -779,7 +781,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } // Formatting for the points - if ($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) { + if ($groupType == Chart_DataSeries::TYPE_LINECHART) { $objWriter->startElement('c:spPr'); $objWriter->startElement('a:ln'); $objWriter->writeAttribute('w', 12700); @@ -805,9 +807,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } } - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || - ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || - ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) { + if (($groupType === Chart_DataSeries::TYPE_BARCHART) || + ($groupType === Chart_DataSeries::TYPE_BARCHART_3D) || + ($groupType === Chart_DataSeries::TYPE_BUBBLECHART)) { $objWriter->startElement('c:invertIfNegative'); $objWriter->writeAttribute('val', 0); @@ -819,9 +821,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) { $catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries(); - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || - ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType == Chart_DataSeries::TYPE_PIECHART) || + ($groupType == Chart_DataSeries::TYPE_PIECHART_3D) || + ($groupType == Chart_DataSeries::TYPE_DONUTCHART)) { if (!is_null($plotGroup->getPlotStyle())) { $plotStyle = $plotGroup->getPlotStyle(); @@ -833,8 +835,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } } - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || - ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) { + if (($groupType === Chart_DataSeries::TYPE_BUBBLECHART) || + ($groupType === Chart_DataSeries::TYPE_SCATTERCHART)) { $objWriter->startElement('c:xVal'); } else { $objWriter->startElement('c:cat'); @@ -848,8 +850,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa if ($plotSeriesValues) { $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries(); - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || - ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) { + if (($groupType === Chart_DataSeries::TYPE_BUBBLECHART) || + ($groupType === Chart_DataSeries::TYPE_SCATTERCHART)) { $objWriter->startElement('c:yVal'); } else { $objWriter->startElement('c:val'); @@ -859,7 +861,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); } - if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType === Chart_DataSeries::TYPE_BUBBLECHART) { $this->_writeBubbles($plotSeriesValues, $objWriter, $pSheet); } @@ -873,9 +875,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Plot Series Label * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_DataSeriesValues $plotSeriesLabel + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) { @@ -908,18 +910,18 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Plot Series Values * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Chart_DataSeriesValues $plotSeriesValues + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $groupType Type of plot for dataseries * @param string $dataType Datatype of series values - * @param PHPExcel_Worksheet $pSheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Worksheet $pSheet + * @throws PHPExcel\Writer_Exception */ private function _writePlotSeriesValues( $plotSeriesValues, $objWriter, $groupType, $dataType='str', - PHPExcel_Worksheet $pSheet + Worksheet $pSheet ) { if (is_null($plotSeriesValues)) { @@ -971,9 +973,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('c:'.$dataType.'Cache'); - if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && - ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && - ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType != Chart_DataSeries::TYPE_PIECHART) && + ($groupType != Chart_DataSeries::TYPE_PIECHART_3D) && + ($groupType != Chart_DataSeries::TYPE_DONUTCHART)) { if (($plotSeriesValues->getFormatCode() !== NULL) && ($plotSeriesValues->getFormatCode() !== '')) { @@ -1011,11 +1013,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Bubble Chart Details * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_DataSeriesValues $plotSeriesValues + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) + private function _writeBubbles($plotSeriesValues, $objWriter, Worksheet $pSheet) { if (is_null($plotSeriesValues)) { return; @@ -1057,11 +1059,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Layout * - * @param PHPExcel_Chart_Layout $layout - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Chart_Layout $layout + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter) + private function _writeLayout(Chart_Layout $layout = NULL, $objWriter) { $objWriter->startElement('c:layout'); @@ -1126,8 +1128,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Alternate Content block * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ private function _writeAlternateContent($objWriter) { @@ -1155,8 +1157,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Printer Settings * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ private function _writePrintSettings($objWriter) { diff --git a/Classes/PHPExcel/Writer/Excel2007/Comments.php b/Classes/PHPExcel/Writer/Excel2007/Comments.php index cfaffef..0764313 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Comments.php +++ b/Classes/PHPExcel/Writer/Excel2007/Comments.php @@ -19,37 +19,39 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Comments + * PHPExcel\Writer_Excel2007_Comments * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Comments extends Writer_Excel2007_WriterPart { /** * Write comments to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeComments(PHPExcel_Worksheet $pWorksheet = null) + public function writeComments(Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -94,13 +96,13 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference - * @param PHPExcel_Comment $pComment Comment + * @param PHPExcel\Comment $pComment Comment * @param array $pAuthors Array of authors - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function _writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) + public function _writeComment(Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', Comment $pComment = null, $pAuthors = null) { // comment $objWriter->startElement('comment'); @@ -118,18 +120,18 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write VML comments to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) + public function writeVMLComments(Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -190,16 +192,16 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write VML comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference - * @param PHPExcel_Comment $pComment Comment - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Comment $pComment Comment + * @throws PHPExcel\Writer_Exception */ - public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) + public function _writeVMLComment(Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', Comment $pComment = null) { // Metadata - list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference); - $column = PHPExcel_Cell::columnIndexFromString($column); + list($column, $row) = Cell::coordinateFromString($pCellReference); + $column = Cell::columnIndexFromString($column); $id = 1024 + $column + $row; $id = substr($id, 0, 4); diff --git a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php index 9fdc9dd..3c4364f 100644 --- a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php +++ b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_ContentTypes + * PHPExcel\Writer_Excel2007_ContentTypes * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_ContentTypes extends Writer_Excel2007_WriterPart { /** * Write content types to XML format @@ -41,16 +43,16 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * @param PHPExcel $pPHPExcel * @param boolean $includeCharts Flag indicating if we should include drawing details for charts * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE) + public function writeContentTypes(Workbook $pPHPExcel = null, $includeCharts = FALSE) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -159,10 +161,10 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $extension = ''; $mimeType = ''; - if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof Worksheet_Drawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() ); - } else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + } else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof Worksheet_MemoryDrawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = explode('/', $extension); $extension = $extension[1]; @@ -205,27 +207,27 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * * @param string $pFile Filename * @return string Mime Type - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ private function _getImageMimeType($pFile = '') { - if (PHPExcel_Shared_File::file_exists($pFile)) { + if (Shared_File::file_exists($pFile)) { $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { - throw new PHPExcel_Writer_Exception("File $pFile does not exist"); + throw new Writer_Exception("File $pFile does not exist"); } } /** * Write Default content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + private function _writeDefaultContentType(Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { if ($pPartname != '' && $pContentType != '') { // Write content type @@ -234,19 +236,19 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } /** * Write Override content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + private function _writeOverrideContentType(Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { if ($pPartname != '' && $pContentType != '') { // Write content type @@ -255,7 +257,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } } diff --git a/Classes/PHPExcel/Writer/Excel2007/DocProps.php b/Classes/PHPExcel/Writer/Excel2007/DocProps.php index 3d1497a..508df74 100644 --- a/Classes/PHPExcel/Writer/Excel2007/DocProps.php +++ b/Classes/PHPExcel/Writer/Excel2007/DocProps.php @@ -19,37 +19,39 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_DocProps + * PHPExcel\Writer_Excel2007_DocProps * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_DocProps extends Writer_Excel2007_WriterPart { /** * Write docProps/app.xml to XML format * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeDocPropsApp(PHPExcel $pPHPExcel = null) + public function writeDocPropsApp(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -137,16 +139,16 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeDocPropsCore(PHPExcel $pPHPExcel = null) + public function writeDocPropsCore(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -204,9 +206,9 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeDocPropsCustom(PHPExcel $pPHPExcel = null) + public function writeDocPropsCustom(Workbook $pPHPExcel = null) { $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); if (empty($customPropertyList)) { @@ -216,9 +218,9 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header diff --git a/Classes/PHPExcel/Writer/Excel2007/Drawing.php b/Classes/PHPExcel/Writer/Excel2007/Drawing.php index 2bc4b39..93fd15d 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Drawing.php +++ b/Classes/PHPExcel/Writer/Excel2007/Drawing.php @@ -19,39 +19,41 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Drawing + * PHPExcel\Writer_Excel2007_Drawing * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Drawing extends Writer_Excel2007_WriterPart { /** * Write drawings to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param boolean $includeCharts Flag indicating if we should include drawing details for charts * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) + public function writeDrawings(Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -92,31 +94,31 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write drawings to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Chart $pChart + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Chart $pChart * @param int $pRelationId - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function _writeChart(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1) + public function _writeChart(Shared_XMLWriter $objWriter = null, Chart $pChart = null, $pRelationId = -1) { $tl = $pChart->getTopLeftPosition(); - $tl['colRow'] = PHPExcel_Cell::coordinateFromString($tl['cell']); + $tl['colRow'] = Cell::coordinateFromString($tl['cell']); $br = $pChart->getBottomRightPosition(); - $br['colRow'] = PHPExcel_Cell::coordinateFromString($br['cell']); + $br['colRow'] = Cell::coordinateFromString($br['cell']); $objWriter->startElement('xdr:twoCellAnchor'); $objWriter->startElement('xdr:from'); - $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($tl['colRow'][0]) - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['xOffset'])); + $objWriter->writeElement('xdr:col', Cell::columnIndexFromString($tl['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', Shared_Drawing::pixelsToEMU($tl['xOffset'])); $objWriter->writeElement('xdr:row', $tl['colRow'][1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['yOffset'])); + $objWriter->writeElement('xdr:rowOff', Shared_Drawing::pixelsToEMU($tl['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:to'); - $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($br['colRow'][0]) - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['xOffset'])); + $objWriter->writeElement('xdr:col', Cell::columnIndexFromString($br['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', Shared_Drawing::pixelsToEMU($br['xOffset'])); $objWriter->writeElement('xdr:row', $br['colRow'][1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['yOffset'])); + $objWriter->writeElement('xdr:rowOff', Shared_Drawing::pixelsToEMU($br['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:graphicFrame'); @@ -164,32 +166,32 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write drawings to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet_BaseDrawing $pDrawing + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet_BaseDrawing $pDrawing * @param int $pRelationId - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function _writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1) + public function _writeDrawing(Shared_XMLWriter $objWriter = null, Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1) { if ($pRelationId >= 0) { // xdr:oneCellAnchor $objWriter->startElement('xdr:oneCellAnchor'); // Image location - $aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates()); - $aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]); + $aCoordinates = Cell::coordinateFromString($pDrawing->getCoordinates()); + $aCoordinates[0] = Cell::columnIndexFromString($aCoordinates[0]); // xdr:from $objWriter->startElement('xdr:from'); $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX())); + $objWriter->writeElement('xdr:colOff', Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX())); $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY())); + $objWriter->writeElement('xdr:rowOff', Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY())); $objWriter->endElement(); // xdr:ext $objWriter->startElement('xdr:ext'); - $objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth())); - $objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight())); + $objWriter->writeAttribute('cx', Shared_Drawing::pixelsToEMU($pDrawing->getWidth())); + $objWriter->writeAttribute('cy', Shared_Drawing::pixelsToEMU($pDrawing->getHeight())); $objWriter->endElement(); // xdr:pic @@ -238,7 +240,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer // a:xfrm $objWriter->startElement('a:xfrm'); - $objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation())); + $objWriter->writeAttribute('rot', Shared_Drawing::degreesToAngle($pDrawing->getRotation())); $objWriter->endElement(); // a:prstGeom @@ -297,9 +299,9 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer // a:outerShdw $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); - $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); - $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); + $objWriter->writeAttribute('blurRad', Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); @@ -375,25 +377,25 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } /** * Write VML header/footer images to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null) + public function writeVMLHeaderFooterImages(Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -529,12 +531,12 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write VML comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pReference Reference - * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Worksheet_HeaderFooterDrawing $pImage Image + * @throws PHPExcel\Writer_Exception */ - public function _writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null) + public function _writeVMLHeaderFooterImage(Shared_XMLWriter $objWriter = null, $pReference = '', Worksheet_HeaderFooterDrawing $pImage = null) { // Calculate object id preg_match('{(\d+)}', md5($pReference), $m); @@ -572,11 +574,11 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Get an array of all drawings * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Workbook $pPHPExcel + * @return PHPExcel\Worksheet_Drawing[] All drawings in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allDrawings(PHPExcel $pPHPExcel = null) + public function allDrawings(Workbook $pPHPExcel = null) { // Get an array of all drawings $aDrawings = array(); diff --git a/Classes/PHPExcel/Writer/Excel2007/Rels.php b/Classes/PHPExcel/Writer/Excel2007/Rels.php index fa225ee..3378459 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Rels.php +++ b/Classes/PHPExcel/Writer/Excel2007/Rels.php @@ -19,37 +19,39 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Rels + * PHPExcel\Writer_Excel2007_Rels * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Rels extends Writer_Excel2007_WriterPart { /** * Write relationships to XML format * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeRelationships(PHPExcel $pPHPExcel = null) + public function writeRelationships(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -106,16 +108,16 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null) + public function writeWorkbookRelationships(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -173,20 +175,20 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * rId1 - Drawings * rId_hyperlink_x - Hyperlinks * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @param int $pWorksheetId * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE) + public function writeWorksheetRelationships(Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -282,20 +284,20 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write drawing relationships to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) + public function writeDrawingRelationships(Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -309,8 +311,8 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar $i = 1; $iterator = $pWorksheet->getDrawingCollection()->getIterator(); while ($iterator->valid()) { - if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing - || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) { + if ($iterator->current() instanceof Worksheet_Drawing + || $iterator->current() instanceof Worksheet_MemoryDrawing) { // Write relationship for image drawing $this->_writeRelationship( $objWriter, @@ -348,18 +350,18 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write header/footer drawing relationships to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param PHPExcel\Worksheet $pWorksheet * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) + public function writeHeaderFooterDrawingRelationships(Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -389,14 +391,14 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write Override content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param int $pId Relationship ID. rId will be prepended! * @param string $pType Relationship type * @param string $pTarget Relationship target * @param string $pTargetMode Relationship target mode - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') + private function _writeRelationship(Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') { if ($pType != '' && $pTarget != '') { // Write relationship @@ -411,7 +413,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } } diff --git a/Classes/PHPExcel/Writer/Excel2007/StringTable.php b/Classes/PHPExcel/Writer/Excel2007/StringTable.php index d6a7027..ca41ab6 100644 --- a/Classes/PHPExcel/Writer/Excel2007/StringTable.php +++ b/Classes/PHPExcel/Writer/Excel2007/StringTable.php @@ -19,29 +19,31 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_StringTable + * PHPExcel\Writer_Excel2007_StringTable * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_StringTable extends Writer_Excel2007_WriterPart { /** * Create worksheet stringtable * - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel\Worksheet $pSheet Worksheet * @param string[] $pExistingTable Existing table to eventually merge with * @return string[] String table for worksheet - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function createStringTable($pSheet = null, $pExistingTable = null) { @@ -67,10 +69,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr ($cellValue !== NULL) && $cellValue !== '' && !isset($aFlippedStringTable[$cellValue]) && - ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) { + ($cell->getDataType() == Cell_DataType::TYPE_STRING || $cell->getDataType() == Cell_DataType::TYPE_STRING2 || $cell->getDataType() == Cell_DataType::TYPE_NULL)) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue] = true; - } elseif ($cellValue instanceof PHPExcel_RichText && + } elseif ($cellValue instanceof RichText && ($cellValue !== NULL) && !isset($aFlippedStringTable[$cellValue->getHashCode()])) { $aStringTable[] = $cellValue; @@ -81,7 +83,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Return return $aStringTable; } else { - throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); + throw new Writer_Exception("Invalid PHPExcel\Worksheet object passed."); } } @@ -90,7 +92,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr * * @param string[] $pStringTable * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function writeStringTable($pStringTable = null) { @@ -98,9 +100,9 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -115,15 +117,15 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr foreach ($pStringTable as $textElement) { $objWriter->startElement('si'); - if (! $textElement instanceof PHPExcel_RichText) { - $textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement ); + if (! $textElement instanceof RichText) { + $textToWrite = Shared_String::ControlCharacterPHP2OOXML( $textElement ); $objWriter->startElement('t'); if ($textToWrite !== trim($textToWrite)) { $objWriter->writeAttribute('xml:space', 'preserve'); } $objWriter->writeRawData($textToWrite); $objWriter->endElement(); - } else if ($textElement instanceof PHPExcel_RichText) { + } else if ($textElement instanceof RichText) { $this->writeRichText($objWriter, $textElement); } @@ -135,19 +137,19 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Return return $objWriter->getData(); } else { - throw new PHPExcel_Writer_Exception("Invalid string table array passed."); + throw new Writer_Exception("Invalid string table array passed."); } } /** * Write Rich Text * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_RichText $pRichText Rich text + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\RichText $pRichText Rich text * @param string $prefix Optional Namespace prefix - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL) + public function writeRichText(Shared_XMLWriter $objWriter = null, RichText $pRichText = null, $prefix=NULL) { if ($prefix !== NULL) $prefix .= ':'; @@ -158,7 +160,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr $objWriter->startElement($prefix.'r'); // rPr - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof RichText_Run) { // rPr $objWriter->startElement($prefix.'rPr'); @@ -214,7 +216,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // t $objWriter->startElement($prefix.'t'); $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); + $objWriter->writeRawData(Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); $objWriter->endElement(); $objWriter->endElement(); @@ -224,16 +226,16 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr /** * Write Rich Text * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param string|PHPExcel_RichText $pRichText text string or Rich text + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param string|PHPExcel\RichText $pRichText text string or Rich text * @param string $prefix Optional Namespace prefix - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL) + public function writeRichTextForCharts(Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL) { - if (!$pRichText instanceof PHPExcel_RichText) { + if (!$pRichText instanceof RichText) { $textRun = $pRichText; - $pRichText = new PHPExcel_RichText(); + $pRichText = new RichText(); $pRichText->createTextRun($textRun); } @@ -287,7 +289,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // t $objWriter->startElement($prefix.'t'); // $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); + $objWriter->writeRawData(Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); $objWriter->endElement(); $objWriter->endElement(); @@ -306,9 +308,9 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Loop through stringtable and add flipped items to $returnValue foreach ($stringTable as $key => $value) { - if (! $value instanceof PHPExcel_RichText) { + if (! $value instanceof RichText) { $returnValue[$value] = $key; - } else if ($value instanceof PHPExcel_RichText) { + } else if ($value instanceof RichText) { $returnValue[$value->getHashCode()] = $key; } } diff --git a/Classes/PHPExcel/Writer/Excel2007/Style.php b/Classes/PHPExcel/Writer/Excel2007/Style.php index 887b5ab..edac85b 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Style.php +++ b/Classes/PHPExcel/Writer/Excel2007/Style.php @@ -19,37 +19,39 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Style + * PHPExcel\Writer_Excel2007_Style * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Style extends Writer_Excel2007_WriterPart { /** * Write styles to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Workbook $pPHPExcel + * @return string XML Output + * @throws PHPExcel\Writer_Exception */ - public function writeStyles(PHPExcel $pPHPExcel = null) + public function writeStyles(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -168,15 +170,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_Fill $pFill Fill style + * @throws PHPExcel\Writer_Exception */ - private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function _writeFill(Shared_XMLWriter $objWriter = null, Style_Fill $pFill = null) { // Check if this is a pattern type or gradient type - if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR || - $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) { + if ($pFill->getFillType() === Style_Fill::FILL_GRADIENT_LINEAR || + $pFill->getFillType() === Style_Fill::FILL_GRADIENT_PATH) { // Gradient fill $this->_writeGradientFill($objWriter, $pFill); } elseif($pFill->getFillType() !== NULL) { @@ -188,11 +190,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Gradient Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_Fill $pFill Fill style + * @throws PHPExcel\Writer_Exception */ - private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function _writeGradientFill(Shared_XMLWriter $objWriter = null, Style_Fill $pFill = null) { // fill $objWriter->startElement('fill'); @@ -232,11 +234,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Pattern Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_Fill $pFill Fill style + * @throws PHPExcel\Writer_Exception */ - private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function _writePatternFill(Shared_XMLWriter $objWriter = null, Style_Fill $pFill = null) { // fill $objWriter->startElement('fill'); @@ -245,7 +247,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('patternFill'); $objWriter->writeAttribute('patternType', $pFill->getFillType()); - if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { + if ($pFill->getFillType() !== Style_Fill::FILL_NONE) { // fgColor if ($pFill->getStartColor()->getARGB()) { $objWriter->startElement('fgColor'); @@ -253,7 +255,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); } } - if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { + if ($pFill->getFillType() !== Style_Fill::FILL_NONE) { // bgColor if ($pFill->getEndColor()->getARGB()) { $objWriter->startElement('bgColor'); @@ -270,11 +272,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Font * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Font $pFont Font style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_Font $pFont Font style + * @throws PHPExcel\Writer_Exception */ - private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) + private function _writeFont(Shared_XMLWriter $objWriter = null, Style_Font $pFont = null) { // font $objWriter->startElement('font'); @@ -350,25 +352,25 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Border * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Borders $pBorders Borders style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_Borders $pBorders Borders style + * @throws PHPExcel\Writer_Exception */ - private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) + private function _writeBorder(Shared_XMLWriter $objWriter = null, Style_Borders $pBorders = null) { // Write border $objWriter->startElement('border'); // Diagonal? switch ($pBorders->getDiagonalDirection()) { - case PHPExcel_Style_Borders::DIAGONAL_UP: + case Style_Borders::DIAGONAL_UP: $objWriter->writeAttribute('diagonalUp', 'true'); $objWriter->writeAttribute('diagonalDown', 'false'); break; - case PHPExcel_Style_Borders::DIAGONAL_DOWN: + case Style_Borders::DIAGONAL_DOWN: $objWriter->writeAttribute('diagonalUp', 'false'); $objWriter->writeAttribute('diagonalDown', 'true'); break; - case PHPExcel_Style_Borders::DIAGONAL_BOTH: + case Style_Borders::DIAGONAL_BOTH: $objWriter->writeAttribute('diagonalUp', 'true'); $objWriter->writeAttribute('diagonalDown', 'true'); break; @@ -386,12 +388,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Cell Style Xf * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style $pStyle Style - * @param PHPExcel $pPHPExcel Workbook - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style $pStyle Style + * @param PHPExcel\Workbook $pPHPExcel Workbook + * @throws PHPExcel\Writer_Exception */ - private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) + private function _writeCellStyleXf(Shared_XMLWriter $objWriter = null, Style $pStyle = null, Workbook $pPHPExcel = null) { // xf $objWriter->startElement('xf'); @@ -413,7 +415,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0'); $objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0'); $objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0'); - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() != Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Style_Protection::PROTECTION_INHERIT) { $objWriter->writeAttribute('applyProtection', 'true'); } @@ -439,13 +441,13 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); // protection - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() != Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Style_Protection::PROTECTION_INHERIT) { $objWriter->startElement('protection'); - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { - $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + if ($pStyle->getProtection()->getLocked() != Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } - if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { - $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + if ($pStyle->getProtection()->getHidden() != Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } $objWriter->endElement(); } @@ -456,11 +458,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Cell Style Dxf * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style $pStyle Style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style $pStyle Style + * @throws PHPExcel\Writer_Exception */ - private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) + private function _writeCellStyleDxf(Shared_XMLWriter $objWriter = null, Style $pStyle = null) { // dxf $objWriter->startElement('dxf'); @@ -500,16 +502,16 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa // protection if (($pStyle->getProtection()->getLocked() !== NULL) || ($pStyle->getProtection()->getHidden() !== NULL)) { - if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT || - $pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() !== Style_Protection::PROTECTION_INHERIT || + $pStyle->getProtection()->getHidden() !== Style_Protection::PROTECTION_INHERIT) { $objWriter->startElement('protection'); if (($pStyle->getProtection()->getLocked() !== NULL) && - ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { - $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + ($pStyle->getProtection()->getLocked() !== Style_Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } if (($pStyle->getProtection()->getHidden() !== NULL) && - ($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { - $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + ($pStyle->getProtection()->getHidden() !== Style_Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } $objWriter->endElement(); } @@ -521,15 +523,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write BorderPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pName Element name - * @param PHPExcel_Style_Border $pBorder Border style - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Style_Border $pBorder Border style + * @throws PHPExcel\Writer_Exception */ - private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) + private function _writeBorderPr(Shared_XMLWriter $objWriter = null, $pName = 'left', Style_Border $pBorder = null) { // Write BorderPr - if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { + if ($pBorder->getBorderStyle() != Style_Border::BORDER_NONE) { $objWriter->startElement($pName); $objWriter->writeAttribute('style', $pBorder->getBorderStyle()); @@ -545,12 +547,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write NumberFormat * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Style_NumberFormat $pNumberFormat Number Format * @param int $pId Number Format identifier - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) + private function _writeNumFmt(Shared_XMLWriter $objWriter = null, Style_NumberFormat $pNumberFormat = null, $pId = 0) { // Translate formatcode $formatCode = $pNumberFormat->getFormatCode(); @@ -568,10 +570,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all styles * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style[] All styles in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style[] All styles in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allStyles(PHPExcel $pPHPExcel = null) + public function allStyles(Workbook $pPHPExcel = null) { $aStyles = $pPHPExcel->getCellXfCollection(); @@ -582,10 +584,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all conditional styles * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style_Conditional[] All conditional styles in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allConditionalStyles(PHPExcel $pPHPExcel = null) + public function allConditionalStyles(Workbook $pPHPExcel = null) { // Get an array of all styles $aStyles = array(); @@ -606,21 +608,21 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all fills * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Fill[] All fills in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style_Fill[] All fills in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allFills(PHPExcel $pPHPExcel = null) + public function allFills(Workbook $pPHPExcel = null) { // Get an array of unique fills $aFills = array(); // Two first fills are predefined - $fill0 = new PHPExcel_Style_Fill(); - $fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE); + $fill0 = new Style_Fill(); + $fill0->setFillType(Style_Fill::FILL_NONE); $aFills[] = $fill0; - $fill1 = new PHPExcel_Style_Fill(); - $fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125); + $fill1 = new Style_Fill(); + $fill1->setFillType(Style_Fill::FILL_PATTERN_GRAY125); $aFills[] = $fill1; // The remaining fills $aStyles = $this->allStyles($pPHPExcel); @@ -637,10 +639,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all fonts * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Font[] All fonts in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style_Font[] All fonts in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allFonts(PHPExcel $pPHPExcel = null) + public function allFonts(Workbook $pPHPExcel = null) { // Get an array of unique fonts $aFonts = array(); @@ -659,10 +661,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all borders * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Borders[] All borders in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style_Borders[] All borders in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allBorders(PHPExcel $pPHPExcel = null) + public function allBorders(Workbook $pPHPExcel = null) { // Get an array of unique borders $aBorders = array(); @@ -681,10 +683,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * Get an array of all number formats * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Style_NumberFormat[] All number formats in PHPExcel + * @throws PHPExcel\Writer_Exception */ - public function allNumberFormats(PHPExcel $pPHPExcel = null) + public function allNumberFormats(Workbook $pPHPExcel = null) { // Get an array of unique number formats $aNumFmts = array(); diff --git a/Classes/PHPExcel/Writer/Excel2007/Theme.php b/Classes/PHPExcel/Writer/Excel2007/Theme.php index ba85639..aae177a 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Theme.php +++ b/Classes/PHPExcel/Writer/Excel2007/Theme.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Theme + * PHPExcel\Writer_Excel2007_Theme * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Theme extends Writer_Excel2007_WriterPart { /** * Map of Major fonts to write @@ -132,18 +134,18 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa /** * Write theme to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Workbook $pPHPExcel + * @return string XML Output + * @throws PHPExcel\Writer_Exception */ - public function writeTheme(PHPExcel $pPHPExcel = null) + public function writeTheme(Workbook $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -816,13 +818,13 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa /** * Write fonts to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter + * @param PHPExcel\Shared_XMLWriter $objWriter * @param string $latinFont * @param array of string $fontSet * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeFonts($objWriter, $latinFont, $fontSet) + private function _writeFonts(Shared_XMLWriter $objWriter, $latinFont, $fontSet) { // a:latin $objWriter->startElement('a:latin'); @@ -851,11 +853,11 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa /** * Write colour scheme to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter + * @param PHPExcel\Shared_XMLWriter $objWriter * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeColourScheme($objWriter) + private function _writeColourScheme(Shared_XMLWriter $objWriter) { foreach(self::$_colourScheme as $colourName => $colourValue) { $objWriter->startElement('a:'.$colourName); diff --git a/Classes/PHPExcel/Writer/Excel2007/Workbook.php b/Classes/PHPExcel/Writer/Excel2007/Workbook.php index db88e74..9614fe7 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Workbook.php +++ b/Classes/PHPExcel/Writer/Excel2007/Workbook.php @@ -19,38 +19,40 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Workbook + * PHPExcel\Writer_Excel2007_Workbook * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Workbook extends Writer_Excel2007_WriterPart { /** * Write workbook to XML format * - * @param PHPExcel $pPHPExcel - * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Workbook $pPHPExcel + * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing + * @return string XML Output + * @throws PHPExcel\Writer_Exception */ - public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE) + public function writeWorkbook(Workbook $pPHPExcel = null, $recalcRequired = FALSE) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -94,10 +96,10 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write file version * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null) + private function _writeFileVersion(Shared_XMLWriter $objWriter = null) { $objWriter->startElement('fileVersion'); $objWriter->writeAttribute('appName', 'xl'); @@ -110,14 +112,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write WorkbookPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @throws PHPExcel\Writer_Exception */ - private function _writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null) + private function _writeWorkbookPr(Shared_XMLWriter $objWriter = null) { $objWriter->startElement('workbookPr'); - if (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) { + if (Shared_Date::getExcelCalendar() == Shared_Date::CALENDAR_MAC_1904) { $objWriter->writeAttribute('date1904', '1'); } @@ -129,11 +131,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write BookViews * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Workbook $pPHPExcel + * @throws PHPExcel\Writer_Exception */ - private function _writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function _writeBookViews(Shared_XMLWriter $objWriter = null, Workbook $pPHPExcel = null) { // bookViews $objWriter->startElement('bookViews'); @@ -159,11 +161,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write WorkbookProtection * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Workbook $pPHPExcel + * @throws PHPExcel\Writer_Exception */ - private function _writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function _writeWorkbookProtection(Shared_XMLWriter $objWriter = null, Workbook $pPHPExcel = null) { if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { $objWriter->startElement('workbookProtection'); @@ -186,11 +188,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write calcPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE) + private function _writeCalcPr(Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE) { $objWriter->startElement('calcPr'); @@ -205,11 +207,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write sheets * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Workbook $pPHPExcel + * @throws PHPExcel\Writer_Exception */ - private function _writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function _writeSheets(Shared_XMLWriter $objWriter = null, Workbook $pPHPExcel = null) { // Write sheets $objWriter->startElement('sheets'); @@ -231,14 +233,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write sheet * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param string $pSheetname Sheet name * @param int $pSheetId Sheet id * @param int $pRelId Relationship ID * @param string $sheetState Sheet state (visible, hidden, veryHidden) - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') + private function _writeSheet(Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') { if ($pSheetname != '') { // Write sheet @@ -251,18 +253,18 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->writeAttribute('r:id', 'rId' . $pRelId); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } /** * Write Defined Names * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Workbook $pPHPExcel + * @throws PHPExcel\Writer_Exception */ - private function _writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function _writeDefinedNames(Shared_XMLWriter $objWriter = null, Workbook $pPHPExcel = null) { // Write defined names $objWriter->startElement('definedNames'); @@ -292,11 +294,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write named ranges * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) + private function _writeNamedRanges(Shared_XMLWriter $objWriter = null, Workbook $pPHPExcel) { // Loop named ranges $namedRanges = $pPHPExcel->getNamedRanges(); @@ -308,11 +310,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for named range * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_NamedRange $pNamedRange - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\NamedRange $pNamedRange + * @throws PHPExcel\Writer_Exception */ - private function _writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) + private function _writeDefinedNameForNamedRange(Shared_XMLWriter $objWriter = null, NamedRange $pNamedRange) { // definedName for named range $objWriter->startElement('definedName'); @@ -322,14 +324,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write } // Create absolute coordinate and write as raw text - $range = PHPExcel_Cell::splitRange($pNamedRange->getRange()); + $range = Cell::splitRange($pNamedRange->getRange()); for ($i = 0; $i < count($range); $i++) { - $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]); + $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . Cell::absoluteReference($range[$i][0]); if (isset($range[$i][1])) { - $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]); + $range[$i][1] = Cell::absoluteReference($range[$i][1]); } } - $range = PHPExcel_Cell::buildRange($range); + $range = Cell::buildRange($range); $objWriter->writeRawData($range); @@ -339,12 +341,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for autoFilter * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + private function _writeDefinedNameForAutofilter(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $pSheetId = 0) { // definedName for autoFilter $autoFilterRange = $pSheet->getAutoFilter()->getRange(); @@ -355,15 +357,15 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->writeAttribute('hidden', '1'); // Create absolute coordinate and write as raw text - $range = PHPExcel_Cell::splitRange($autoFilterRange); + $range = Cell::splitRange($autoFilterRange); $range = $range[0]; // Strip any worksheet ref so we can make the cell ref absolute if (strpos($range[0],'!') !== false) { list($ws,$range[0]) = explode('!',$range[0]); } - $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]); - $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]); + $range[0] = Cell::absoluteCoordinate($range[0]); + $range[1] = Cell::absoluteCoordinate($range[1]); $range = implode(':', $range); $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range); @@ -375,12 +377,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for PrintTitles * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + private function _writeDefinedNameForPrintTitles(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintTitles if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { @@ -418,12 +420,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for PrintTitles * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + private function _writeDefinedNameForPrintArea(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintArea if ($pSheet->getPageSetup()->isPrintAreaSet()) { @@ -435,12 +437,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $settingString = ''; // Print area - $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); + $printArea = Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); $chunks = array(); foreach ($printArea as $printAreaRect) { - $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]); - $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]); + $printAreaRect[0] = Cell::absoluteReference($printAreaRect[0]); + $printAreaRect[1] = Cell::absoluteReference($printAreaRect[1]); $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect); } diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php index f70d4fe..81e7162 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php @@ -19,30 +19,32 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_Worksheet + * PHPExcel\Writer_Excel2007_Worksheet * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_WriterPart +class Writer_Excel2007_Worksheet extends Writer_Excel2007_WriterPart { /** * Write worksheet to XML format * - * @param PHPExcel_Worksheet $pSheet + * @param PHPExcel\Worksheet $pSheet * @param string[] $pStringTable * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE) { @@ -50,9 +52,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new Shared_XMLWriter(Shared_XMLWriter::STORAGE_MEMORY); } // XML header @@ -132,18 +134,18 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Return return $objWriter->getData(); } else { - throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); + throw new Writer_Exception("Invalid PHPExcel\Worksheet object passed."); } } /** * Write SheetPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeSheetPr(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // sheetPr $objWriter->startElement('sheetPr'); @@ -180,11 +182,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Dimension * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeDimension(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // dimension $objWriter->startElement('dimension'); @@ -195,11 +197,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetViews * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL) + private function _writeSheetViews(Shared_XMLWriter $objWriter = NULL, Worksheet $pSheet = NULL) { // sheetViews $objWriter->startElement('sheetViews'); @@ -224,7 +226,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ } // View Layout Type - if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) { + if ($pSheet->getSheetView()->getView() !== Worksheet_SheetView::SHEETVIEW_NORMAL) { $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); } @@ -257,8 +259,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Calculate freeze coordinates $xSplit = $ySplit = 0; - list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell); - $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit); + list($xSplit, $ySplit) = Cell::coordinateFromString($topLeftCell); + $xSplit = Cell::columnIndexFromString($xSplit); // pane $pane = 'topRight'; @@ -302,11 +304,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetFormatPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeSheetFormatPr(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // sheetFormatPr $objWriter->startElement('sheetFormatPr'); @@ -314,7 +316,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Default row height if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { $objWriter->writeAttribute('customHeight', 'true'); - $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); + $objWriter->writeAttribute('defaultRowHeight', Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); } else { $objWriter->writeAttribute('defaultRowHeight', '14.4'); } @@ -327,7 +329,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Default column width if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { - $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); + $objWriter->writeAttribute('defaultColWidth', Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); } // Outline level - row @@ -354,11 +356,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Cols * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeCols(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // cols if (count($pSheet->getColumnDimensions()) > 0) { @@ -370,15 +372,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ foreach ($pSheet->getColumnDimensions() as $colDimension) { // col $objWriter->startElement('col'); - $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); - $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('min', Cell::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('max', Cell::columnIndexFromString($colDimension->getColumnIndex())); if ($colDimension->getWidth() < 0) { // No width set, apply default of 10 $objWriter->writeAttribute('width', '9.10'); } else { // Width set - $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth())); + $objWriter->writeAttribute('width', Shared_String::FormatNumber($colDimension->getWidth())); } // Column visibility @@ -419,11 +421,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetProtection * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeSheetProtection(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // sheetProtection $objWriter->startElement('sheetProtection'); @@ -454,11 +456,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write ConditionalFormatting * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeConditionalFormatting(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // Conditional id $id = 1; @@ -470,7 +472,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ) == '') { // continue; // } - if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) { + if ($conditional->getConditionType() != Style_Conditional::CONDITION_NONE) { // conditionalFormatting $objWriter->startElement('conditionalFormatting'); $objWriter->writeAttribute('sqref', $cellCoordinate); @@ -481,37 +483,37 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() )); $objWriter->writeAttribute('priority', $id++); - if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS + if (($conditional->getConditionType() == Style_Conditional::CONDITION_CELLIS || - $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) - && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) { + $conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT) + && $conditional->getOperatorType() != Style_Conditional::OPERATOR_NONE) { $objWriter->writeAttribute('operator', $conditional->getOperatorType()); } - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT + if ($conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT && !is_null($conditional->getText())) { $objWriter->writeAttribute('text', $conditional->getText()); } - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT + if ($conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Style_Conditional::OPERATOR_CONTAINSTEXT && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); - } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH + } else if ($conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Style_Conditional::OPERATOR_BEGINSWITH && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); - } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH + } else if ($conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Style_Conditional::OPERATOR_ENDSWITH && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); - } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS + } else if ($conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Style_Conditional::OPERATOR_NOTCONTAINS && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); - } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { + } else if ($conditional->getConditionType() == Style_Conditional::CONDITION_CELLIS + || $conditional->getConditionType() == Style_Conditional::CONDITION_CONTAINSTEXT + || $conditional->getConditionType() == Style_Conditional::CONDITION_EXPRESSION) { foreach ($conditional->getConditions() as $formula) { // Formula $objWriter->writeElement('formula', $formula); @@ -529,11 +531,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write DataValidations * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeDataValidations(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // Datavalidation collection $dataValidationCollection = $pSheet->getDataValidationCollection(); @@ -595,11 +597,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Hyperlinks * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeHyperlinks(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // Hyperlink collection $hyperlinkCollection = $pSheet->getHyperlinkCollection(); @@ -636,11 +638,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write ProtectedRanges * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeProtectedRanges(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { if (count($pSheet->getProtectedCells()) > 0) { // protectedRanges @@ -665,11 +667,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write MergeCells * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeMergeCells(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { if (count($pSheet->getMergeCells()) > 0) { // mergeCells @@ -690,11 +692,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PrintOptions * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writePrintOptions(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // printOptions $objWriter->startElement('printOptions'); @@ -716,31 +718,31 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PageMargins * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel|Writer_Exception */ - private function _writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writePageMargins(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // pageMargins $objWriter->startElement('pageMargins'); - $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); - $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); - $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); - $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); - $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); - $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); + $objWriter->writeAttribute('left', Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); + $objWriter->writeAttribute('right', Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); + $objWriter->writeAttribute('top', Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); + $objWriter->writeAttribute('bottom', Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); + $objWriter->writeAttribute('header', Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); + $objWriter->writeAttribute('footer', Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); $objWriter->endElement(); } /** * Write AutoFilter * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeAutoFilter(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { $autoFilterRange = $pSheet->getAutoFilter()->getRange(); if (!empty($autoFilterRange)) { @@ -748,7 +750,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('autoFilter'); // Strip any worksheet reference from the filter coordinates - $range = PHPExcel_Cell::splitRange($autoFilterRange); + $range = Cell::splitRange($autoFilterRange); $range = $range[0]; // Strip any worksheet ref if (strpos($range[0],'!') !== false) { @@ -767,17 +769,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID)); $objWriter->startElement( $column->getFilterType()); - if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) { + if ($column->getJoin() == Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) { $objWriter->writeAttribute('and', 1); } foreach ($rules as $rule) { - if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) && - ($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && + if (($column->getFilterType() === Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) && + ($rule->getOperator() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && ($rule->getValue() === '')) { // Filter rule for Blanks $objWriter->writeAttribute('blank', 1); - } elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { + } elseif($rule->getRuleType() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { // Dynamic Filter Rule $objWriter->writeAttribute('type', $rule->getGrouping()); $val = $column->getAttribute('val'); @@ -788,19 +790,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ if ($maxVal !== NULL) { $objWriter->writeAttribute('maxVal', $maxVal); } - } elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) { + } elseif($rule->getRuleType() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) { // Top 10 Filter Rule $objWriter->writeAttribute('val', $rule->getValue()); - $objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); - $objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0')); + $objWriter->writeAttribute('percent', (($rule->getOperator() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); + $objWriter->writeAttribute('top', (($rule->getGrouping() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0')); } else { // Filter, DateGroupItem or CustomFilter $objWriter->startElement($rule->getRuleType()); - if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) { + if ($rule->getOperator() !== Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) { $objWriter->writeAttribute('operator', $rule->getOperator()); } - if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) { + if ($rule->getRuleType() === Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) { // Date Group filters foreach($rule->getValue() as $key => $value) { if ($value > '') $objWriter->writeAttribute($key, $value); @@ -828,11 +830,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PageSetup * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writePageSetup(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // pageSetup $objWriter->startElement('pageSetup'); @@ -863,11 +865,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Header / Footer * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeHeaderFooter(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // headerFooter $objWriter->startElement('headerFooter'); @@ -888,19 +890,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Breaks * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeBreaks(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // Get row and column breaks $aRowBreaks = array(); $aColumnBreaks = array(); foreach ($pSheet->getBreaks() as $cell => $breakType) { - if ($breakType == PHPExcel_Worksheet::BREAK_ROW) { + if ($breakType == Worksheet::BREAK_ROW) { $aRowBreaks[] = $cell; - } else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { + } else if ($breakType == Worksheet::BREAK_COLUMN) { $aColumnBreaks[] = $cell; } } @@ -912,7 +914,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); foreach ($aRowBreaks as $cell) { - $coords = PHPExcel_Cell::coordinateFromString($cell); + $coords = Cell::coordinateFromString($cell); $objWriter->startElement('brk'); $objWriter->writeAttribute('id', $coords[1]); @@ -930,11 +932,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); foreach ($aColumnBreaks as $cell) { - $coords = PHPExcel_Cell::coordinateFromString($cell); + $coords = Cell::coordinateFromString($cell); $objWriter->startElement('brk'); - $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1); - $objWriter->writeAttribute('man', '1'); + $objWriter->writeAttribute('id', Cell::columnIndexFromString($coords[0]) - 1); + $objWriter->writeAttribute('man', '1'); $objWriter->endElement(); } @@ -945,12 +947,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetData * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet * @param string[] $pStringTable String table - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null) + private function _writeSheetData(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $pStringTable = null) { if (is_array($pStringTable)) { // Flipped stringtable, for faster index searching @@ -960,7 +962,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('sheetData'); // Get column count - $colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()); + $colCount = Cell::columnIndexFromString($pSheet->getHighestColumn()); // Highest row number $highestRow = $pSheet->getHighestRow(); @@ -968,7 +970,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Loop through cells $cellsByRow = array(); foreach ($pSheet->getCellCollection() as $cellID) { - $cellAddress = PHPExcel_Cell::coordinateFromString($cellID); + $cellAddress = Cell::coordinateFromString($cellID); $cellsByRow[$cellAddress[1]][] = $cellID; } @@ -994,7 +996,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Row dimensions if ($rowDimension->getRowHeight() >= 0) { $objWriter->writeAttribute('customHeight', '1'); - $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight())); + $objWriter->writeAttribute('ht', Shared_String::FormatNumber($rowDimension->getRowHeight())); } // Row visibility @@ -1033,21 +1035,21 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } /** * Write Cell * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @param PHPExcel_Cell $pCellAddress Cell Address + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @param PHPExcel\Cell $pCellAddress Cell Address * @param string[] $pStringTable String table * @param string[] $pFlippedStringTable String table (flipped), for faster index searching - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) + private function _writeCell(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) { if (is_array($pStringTable) && is_array($pFlippedStringTable)) { // Cell @@ -1088,9 +1090,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Write data depending on its type switch (strtolower($mappedType)) { case 'inlinestr': // Inline string - if (! $cellValue instanceof PHPExcel_RichText) { - $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) ); - } else if ($cellValue instanceof PHPExcel_RichText) { + if (! $cellValue instanceof RichText) { + $objWriter->writeElement('t', Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) ); + } else if ($cellValue instanceof RichText) { $objWriter->startElement('is'); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); $objWriter->endElement(); @@ -1098,11 +1100,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ break; case 's': // String - if (! $cellValue instanceof PHPExcel_RichText) { + if (! $cellValue instanceof RichText) { if (isset($pFlippedStringTable[$cellValue])) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); } - } else if ($cellValue instanceof PHPExcel_RichText) { + } else if ($cellValue instanceof RichText) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]); } @@ -1124,7 +1126,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ if ($this->getParentWriter()->getPreCalculateFormulas()) { // $calculatedValue = $pCell->getCalculatedValue(); if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { - $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue)); + $objWriter->writeElement('v', Shared_String::FormatNumber($calculatedValue)); } else { $objWriter->writeElement('v', '0'); } @@ -1154,19 +1156,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } /** * Write Drawings * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet * @param boolean $includeCharts Flag indicating if we should include drawing details for charts - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE) + private function _writeDrawings(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null, $includeCharts = FALSE) { $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0; // If sheet contains drawings, add the relationships @@ -1181,11 +1183,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write LegacyDrawing * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeLegacyDrawing(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // If sheet contains comments, add the relationships if (count($pSheet->getComments()) > 0) { @@ -1198,11 +1200,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write LegacyDrawingHF * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel\Worksheet $pSheet Worksheet + * @throws PHPExcel\Writer_Exception */ - private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function _writeLegacyDrawingHF(Shared_XMLWriter $objWriter = null, Worksheet $pSheet = null) { // If sheet contains images, add the relationships if (count($pSheet->getHeaderFooter()->getImages()) > 0) { diff --git a/Classes/PHPExcel/Writer/Excel2007/WriterPart.php b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php index 0667ed4..bc0e56c 100644 --- a/Classes/PHPExcel/Writer/Excel2007/WriterPart.php +++ b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php @@ -19,60 +19,62 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel2007_WriterPart + * PHPExcel\Writer_Excel2007_WriterPart * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 + * @package PHPExcel\Writer_Excel2007 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_Writer_Excel2007_WriterPart +abstract class Writer_Excel2007_WriterPart { /** * Parent IWriter object * - * @var PHPExcel_Writer_IWriter + * @var PHPExcel\Writer_IWriter */ private $_parentWriter; /** * Set parent IWriter object * - * @param PHPExcel_Writer_IWriter $pWriter - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Writer_IWriter $pWriter + * @throws PHPExcel\Writer_Exception */ - public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) { + public function setParentWriter(Writer_IWriter $pWriter = null) { $this->_parentWriter = $pWriter; } /** * Get parent IWriter object * - * @return PHPExcel_Writer_IWriter - * @throws PHPExcel_Writer_Exception + * @return PHPExcel\Writer_IWriter + * @throws PHPExcel\Writer_Exception */ public function getParentWriter() { if (!is_null($this->_parentWriter)) { return $this->_parentWriter; } else { - throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned."); + throw new Writer_Exception("No parent PHPExcel\Writer_IWriter assigned."); } } /** * Set parent IWriter object * - * @param PHPExcel_Writer_IWriter $pWriter - * @throws PHPExcel_Writer_Exception + * @param PHPExcel\Writer_IWriter $pWriter + * @throws PHPExcel\Writer_Exception */ - public function __construct(PHPExcel_Writer_IWriter $pWriter = null) { + public function __construct(Writer_IWriter $pWriter = null) { if (!is_null($pWriter)) { $this->_parentWriter = $pWriter; } diff --git a/Classes/PHPExcel/Writer/Excel5.php b/Classes/PHPExcel/Writer/Excel5.php index 5ba73f0..0c2f42f 100644 --- a/Classes/PHPExcel/Writer/Excel5.php +++ b/Classes/PHPExcel/Writer/Excel5.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5 + * PHPExcel\Writer_Excel5 * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter +class Writer_Excel5 extends Writer_Abstract implements Writer_IWriter { /** * PHPExcel object @@ -73,7 +75,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce /** * Formula parser * - * @var PHPExcel_Writer_Excel5_Parser + * @var PHPExcel\Writer_Excel5_Parser */ private $_parser; @@ -99,48 +101,48 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce private $_documentSummaryInformation; /** - * Create a new PHPExcel_Writer_Excel5 + * Create a new PHPExcel\Writer_Excel5 * - * @param PHPExcel $phpExcel PHPExcel object + * @param PHPExcel\Workbook $phpExcel PHPExcel object */ - public function __construct(PHPExcel $phpExcel) { - $this->_phpExcel = $phpExcel; + public function __construct(Workbook $phpExcel) { + $this->_phpExcel = $phpExcel; - $this->_parser = new PHPExcel_Writer_Excel5_Parser(); + $this->_parser = new Writer_Excel5_Parser(); } /** * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = null) { // garbage collect $this->_phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); - $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveDebugLog = Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); + $saveDateReturnType = Calculation_Functions::getReturnDateType(); + Calculation_Functions::setReturnDateType(Calculation_Functions::RETURNDATE_EXCEL); // initialize colors array $this->_colors = array(); // Initialise workbook writer - $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, - $this->_str_total, $this->_str_unique, $this->_str_table, - $this->_colors, $this->_parser); + $this->_writerWorkbook = new Writer_Excel5_Workbook($this->_phpExcel, + $this->_str_total, $this->_str_unique, $this->_str_table, + $this->_colors, $this->_parser); // Initialise worksheet writers $countSheets = $this->_phpExcel->getSheetCount(); for ($i = 0; $i < $countSheets; ++$i) { - $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, - $this->_str_table, $this->_colors, - $this->_parser, - $this->_preCalculateFormulas, - $this->_phpExcel->getSheet($i)); + $this->_writerWorksheets[$i] = new Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, + $this->_str_table, $this->_colors, + $this->_parser, + $this->_preCalculateFormulas, + $this->_phpExcel->getSheet($i)); } // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook. @@ -164,10 +166,10 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce foreach ($this->_writerWorksheets[$i]->_phpSheet->getCellCollection() as $cellID) { $cell = $this->_writerWorksheets[$i]->_phpSheet->getCell($cellID); $cVal = $cell->getValue(); - if ($cVal instanceof PHPExcel_RichText) { + if ($cVal instanceof RichText) { $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof RichText_Run) { $font = $element->getFont(); $this->_writerWorksheets[$i]->_fntHashIndex[$font->getHashCode()] = $this->_writerWorkbook->_addFont($font); } @@ -178,7 +180,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce // initialize OLE file $workbookStreamName = 'Workbook'; - $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName)); + $OLE = new Shared_OLE_PPS_File(Shared_OLE::Asc2Ucs($workbookStreamName)); // Write the worksheet streams before the global workbook stream, // because the byte sizes of these are needed in the global workbook stream @@ -199,14 +201,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation(); // initialize OLE Document Summary Information if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){ - $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation')); + $OLE_DocumentSummaryInformation = new Shared_OLE_PPS_File(Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation')); $OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation); } $this->_summaryInformation = $this->_writeSummaryInformation(); // initialize OLE Summary Information if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){ - $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation')); + $OLE_SummaryInformation = new Shared_OLE_PPS_File(Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation')); $OLE_SummaryInformation->append($this->_summaryInformation); } @@ -221,12 +223,12 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $arrRootData[] = $OLE_DocumentSummaryInformation; } - $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), $arrRootData); + $root = new Shared_OLE_PPS_Root(time(), time(), $arrRootData); // save the OLE file $res = $root->save($pFilename); - PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); + Calculation_Functions::setReturnDateType($saveDateReturnType); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -234,8 +236,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce * * @deprecated * @param string $pValue Temporary storage directory - * @throws PHPExcel_Writer_Exception when directory does not exist - * @return PHPExcel_Writer_Excel5 + * @throws PHPExcel\Writer_Exception when directory does not exist + * @return PHPExcel\Writer_Excel5 */ public function setTempDir($pValue = '') { return $this; @@ -265,10 +267,10 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce } // create intermediate Escher object - $escher = new PHPExcel_Shared_Escher(); + $escher = new Shared_Escher(); // dgContainer - $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); + $dgContainer = new Shared_Escher_DgContainer(); // set the drawing index (we use sheet index + 1) $dgId = $sheet->getParent()->getIndex($sheet) + 1; @@ -276,11 +278,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $escher->setDgContainer($dgContainer); // spgrContainer - $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); + $spgrContainer = new Shared_Escher_DgContainer_SpgrContainer(); $dgContainer->setSpgrContainer($spgrContainer); // add one shape which is the group shape - $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $spContainer = new Shared_Escher_DgContainer_SpgrContainer_SpContainer(); $spContainer->setSpgr(true); $spContainer->setSpType(0); $spContainer->setSpId(($sheet->getParent()->getIndex($sheet) + 1) << 10); @@ -296,7 +298,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce ++$countShapes[$sheetIndex]; // add the shape - $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $spContainer = new Shared_Escher_DgContainer_SpgrContainer_SpContainer(); // set the shape type $spContainer->setSpType(0x004B); @@ -325,7 +327,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $width = $drawing->getWidth(); $height = $drawing->getHeight(); - $twoAnchor = PHPExcel_Shared_Excel5::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height); + $twoAnchor = Shared_Excel5::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height); $spContainer->setStartCoordinates($twoAnchor['startCoordinates']); $spContainer->setStartOffsetX($twoAnchor['startOffsetX']); @@ -339,7 +341,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce // AutoFilters if(!empty($filterRange)){ - $rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange); + $rangeBounds = Cell::rangeBoundaries($filterRange); $iNumColStart = $rangeBounds[0][0]; $iNumColEnd = $rangeBounds[1][0]; @@ -348,14 +350,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce ++$countShapes[$sheetIndex]; // create an Drawing Object for the dropdown - $oDrawing = new PHPExcel_Worksheet_BaseDrawing(); + $oDrawing = new Worksheet_BaseDrawing(); // get the coordinates of drawing - $cDrawing = PHPExcel_Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1]; + $cDrawing = Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1]; $oDrawing->setCoordinates($cDrawing); $oDrawing->setWorksheet($sheet); // add the shape - $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $spContainer = new Shared_Escher_DgContainer_SpgrContainer_SpContainer(); // set the shape type $spContainer->setSpType(0x00C9); // set the shape flag @@ -380,7 +382,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $spContainer->setOPT(0x03BF, 0x000A0000); // Group Shape -> fPrint // set coordinates and offsets, client anchor - $endCoordinates = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::stringFromColumnIndex($iInc - 1)); + $endCoordinates = Cell::stringFromColumnIndex(Cell::stringFromColumnIndex($iInc - 1)); $endCoordinates .= $rangeBounds[0][1] + 1; $spContainer->setStartCoordinates($cDrawing); @@ -428,10 +430,10 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce } // if we reach here, then there are drawings in the workbook - $escher = new PHPExcel_Shared_Escher(); + $escher = new Shared_Escher(); // dggContainer - $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); + $dggContainer = new Shared_Escher_DggContainer(); $escher->setDggContainer($dggContainer); // set IDCLs (identifier clusters) @@ -464,13 +466,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dggContainer->setCSpSaved($totalCountShapes + $countDrawings); // total number of shapes incl. one group shapes per drawing // bstoreContainer - $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); + $bstoreContainer = new Shared_Escher_DggContainer_BstoreContainer(); $dggContainer->setBstoreContainer($bstoreContainer); // the BSE's (all the images) foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($sheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing instanceof Worksheet_Drawing) { $filename = $drawing->getPath(); @@ -479,7 +481,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce switch ($imageFormat) { case 1: // GIF, not supported by BIFF8, we convert to PNG - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; ob_start(); imagepng(imagecreatefromgif($filename)); $blipData = ob_get_contents(); @@ -487,19 +489,19 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce break; case 2: // JPEG - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $blipData = file_get_contents($filename); break; case 3: // PNG - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $blipData = file_get_contents($filename); break; case 6: // Windows DIB (BMP), we convert to PNG - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; ob_start(); - imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename)); + imagepng(Shared_Drawing::imagecreatefrombmp($filename)); $blipData = ob_get_contents(); ob_end_clean(); break; @@ -508,28 +510,28 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce } - $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip = new Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($blipData); - $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $BSE = new Shared_Escher_DggContainer_BstoreContainer_BSE(); $BSE->setBlipType($blipType); $BSE->setBlip($blip); $bstoreContainer->addBSE($BSE); - } else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { + } else if ($drawing instanceof Worksheet_MemoryDrawing) { switch ($drawing->getRenderingFunction()) { - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; + case Worksheet_MemoryDrawing::RENDERING_JPEG: + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $renderingFunction = 'imagejpeg'; break; - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + case Worksheet_MemoryDrawing::RENDERING_GIF: + case Worksheet_MemoryDrawing::RENDERING_PNG: + case Worksheet_MemoryDrawing::RENDERING_DEFAULT: + $blipType = Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $renderingFunction = 'imagepng'; break; @@ -540,10 +542,10 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $blipData = ob_get_contents(); ob_end_clean(); - $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip = new Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($blipData); - $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $BSE = new Shared_Escher_DggContainer_BstoreContainer_BSE(); $BSE->setBlipType($blipType); $BSE->setBlip($blip); @@ -853,7 +855,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), 'offset' => array('pack' => 'V'), 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) - 'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp))); + 'data' => array('data' => Shared_OLE::LocalDate2OLE($dataProp))); $dataSection_NumProps++; } // Modified Date/Time @@ -862,7 +864,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D), 'offset' => array('pack' => 'V'), 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) - 'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp))); + 'data' => array('data' => Shared_OLE::LocalDate2OLE($dataProp))); $dataSection_NumProps++; } // Security diff --git a/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php index d75c33b..58acb50 100644 --- a/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php +++ b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -60,14 +60,16 @@ // */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_BIFFwriter + * PHPExcel\Writer_Excel5_BIFFwriter * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_BIFFwriter +class Writer_Excel5_BIFFwriter { /** * The byte order of this architecture. 0 => little endian, 1 => big endian @@ -122,7 +124,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter $byte_order = 1; // Big Endian } else { // Give up. I'll fix this in a later version. - throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform."); + throw new Writer_Exception("Required floating point format not supported on this platform."); } self::$_byte_order = $byte_order; } diff --git a/Classes/PHPExcel/Writer/Excel5/Escher.php b/Classes/PHPExcel/Writer/Excel5/Escher.php index 8286bc1..9b68859 100644 --- a/Classes/PHPExcel/Writer/Excel5/Escher.php +++ b/Classes/PHPExcel/Writer/Excel5/Escher.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * PHPExcel\Shared_Escher_DggContainer_BstoreContainer * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Escher +class Writer_Excel5_Escher { /** * The object we are writing @@ -79,19 +81,19 @@ class PHPExcel_Writer_Excel5_Escher switch (get_class($this->_object)) { - case 'PHPExcel_Shared_Escher': + case __NAMESPACE__ . '\Shared_Escher': if ($dggContainer = $this->_object->getDggContainer()) { - $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer); + $writer = new Writer_Excel5_Escher($dggContainer); $this->_data = $writer->close(); } else if ($dgContainer = $this->_object->getDgContainer()) { - $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer); + $writer = new Writer_Excel5_Escher($dgContainer); $this->_data = $writer->close(); $this->_spOffsets = $writer->getSpOffsets(); $this->_spTypes = $writer->getSpTypes(); } break; - case 'PHPExcel_Shared_Escher_DggContainer': + case __NAMESPACE__ . '\Shared_Escher_DggContainer': // this is a container record // initialize @@ -126,7 +128,7 @@ class PHPExcel_Writer_Excel5_Escher // write the bstoreContainer if ($bstoreContainer = $this->_object->getBstoreContainer()) { - $writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer); + $writer = new Writer_Excel5_Escher($bstoreContainer); $innerData .= $writer->close(); } @@ -144,7 +146,7 @@ class PHPExcel_Writer_Excel5_Escher $this->_data = $header . $innerData; break; - case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer': + case __NAMESPACE__ . '\Shared_Escher_DggContainer_BstoreContainer': // this is a container record // initialize @@ -153,7 +155,7 @@ class PHPExcel_Writer_Excel5_Escher // treat the inner data if ($BSECollection = $this->_object->getBSECollection()) { foreach ($BSECollection as $BSE) { - $writer = new PHPExcel_Writer_Excel5_Escher($BSE); + $writer = new Writer_Excel5_Escher($BSE); $innerData .= $writer->close(); } } @@ -172,7 +174,7 @@ class PHPExcel_Writer_Excel5_Escher $this->_data = $header . $innerData; break; - case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE': + case __NAMESPACE__ . '\Shared_Escher_DggContainer_BstoreContainer_BSE': // this is a semi-container record // initialize @@ -180,7 +182,7 @@ class PHPExcel_Writer_Excel5_Escher // here we treat the inner data if ($blip = $this->_object->getBlip()) { - $writer = new PHPExcel_Writer_Excel5_Escher($blip); + $writer = new Writer_Excel5_Escher($blip); $innerData .= $writer->close(); } @@ -222,13 +224,13 @@ class PHPExcel_Writer_Excel5_Escher $this->_data .= $data; break; - case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip': + case __NAMESPACE__ . '\Shared_Escher_DggContainer_BstoreContainer_BSE_Blip': // this is an atom record // write the record switch ($this->_object->getParent()->getBlipType()) { - case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: + case Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: // initialize $innerData = ''; @@ -255,7 +257,7 @@ class PHPExcel_Writer_Excel5_Escher $this->_data .= $innerData; break; - case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: + case Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: // initialize $innerData = ''; @@ -285,7 +287,7 @@ class PHPExcel_Writer_Excel5_Escher } break; - case 'PHPExcel_Shared_Escher_DgContainer': + case __NAMESPACE__ . '\Shared_Escher_DgContainer': // this is a container record // initialize @@ -309,7 +311,7 @@ class PHPExcel_Writer_Excel5_Escher // write the spgrContainer if ($spgrContainer = $this->_object->getSpgrContainer()) { - $writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer); + $writer = new Writer_Excel5_Escher($spgrContainer); $innerData .= $writer->close(); // get the shape offsets relative to the spgrContainer record @@ -339,7 +341,7 @@ class PHPExcel_Writer_Excel5_Escher $this->_data = $header . $innerData; break; - case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer': + case __NAMESPACE__ . '\Shared_Escher_DgContainer_SpgrContainer': // this is a container record // initialize @@ -352,7 +354,7 @@ class PHPExcel_Writer_Excel5_Escher // treat the inner data foreach ($this->_object->getChildren() as $spContainer) { - $writer = new PHPExcel_Writer_Excel5_Escher($spContainer); + $writer = new Writer_Excel5_Escher($spContainer); $spData = $writer->close(); $innerData .= $spData; @@ -379,7 +381,7 @@ class PHPExcel_Writer_Excel5_Escher $this->_spTypes = $spTypes; break; - case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer': + case __NAMESPACE__ . '\Shared_Escher_DgContainer_SpgrContainer_SpContainer': // initialize $data = ''; @@ -443,8 +445,8 @@ class PHPExcel_Writer_Excel5_Escher $recType = 0xF010; // start coordinates - list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates()); - $c1 = PHPExcel_Cell::columnIndexFromString($column) - 1; + list($column, $row) = Cell::coordinateFromString($this->_object->getStartCoordinates()); + $c1 = Cell::columnIndexFromString($column) - 1; $r1 = $row - 1; // start offsetX @@ -454,8 +456,8 @@ class PHPExcel_Writer_Excel5_Escher $startOffsetY = $this->_object->getStartOffsetY(); // end coordinates - list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates()); - $c2 = PHPExcel_Cell::columnIndexFromString($column) - 1; + list($column, $row) = Cell::coordinateFromString($this->_object->getEndCoordinates()); + $c2 = Cell::columnIndexFromString($column) - 1; $r2 = $row - 1; // end offsetX diff --git a/Classes/PHPExcel/Writer/Excel5/Font.php b/Classes/PHPExcel/Writer/Excel5/Font.php index a0936eb..8955bf2 100644 --- a/Classes/PHPExcel/Writer/Excel5/Font.php +++ b/Classes/PHPExcel/Writer/Excel5/Font.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_Font + * PHPExcel\Writer_Excel5_Font * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Font +class Writer_Excel5_Font { /** * Color index @@ -45,16 +47,16 @@ class PHPExcel_Writer_Excel5_Font /** * Font * - * @var PHPExcel_Style_Font + * @var PHPExcel\Style_Font */ private $_font; /** * Constructor * - * @param PHPExcel_Style_Font $font + * @param PHPExcel\Style_Font $font */ - public function __construct(PHPExcel_Style_Font $font = null) + public function __construct(Style_Font $font = null) { $this->_colorIndex = 0x7FFF; $this->_font = $font; @@ -89,7 +91,7 @@ class PHPExcel_Writer_Excel5_Font $sss = 0; } $bFamily = 0; // Font family - $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set + $bCharSet = Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set $record = 0x31; // Record identifier $reserved = 0x00; // Reserved @@ -118,7 +120,7 @@ class PHPExcel_Writer_Excel5_Font $bCharSet, $reserved ); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName()); + $data .= Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName()); $length = strlen($data); $header = pack("vv", $record, $length); @@ -144,11 +146,11 @@ class PHPExcel_Writer_Excel5_Font * @static array of int * */ - private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00, - PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01, - PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02, - PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21, - PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22, + private static $_mapUnderline = array( Style_Font::UNDERLINE_NONE => 0x00, + Style_Font::UNDERLINE_SINGLE => 0x01, + Style_Font::UNDERLINE_DOUBLE => 0x02, + Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21, + Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22, ); /** * Map underline diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php index 2018c5b..e7e2524 100644 --- a/Classes/PHPExcel/Writer/Excel5/Parser.php +++ b/Classes/PHPExcel/Writer/Excel5/Parser.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -50,14 +50,16 @@ // */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_Parser + * PHPExcel\Writer_Excel5_Parser * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Parser +class Writer_Excel5_Parser { /** Constants */ // Sheet title in unquoted form @@ -564,7 +566,7 @@ class PHPExcel_Writer_Excel5_Parser } // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown token $token"); + throw new Writer_Exception("Unknown token $token"); } /** @@ -579,7 +581,7 @@ class PHPExcel_Writer_Excel5_Parser if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { return pack("Cv", $this->ptg['ptgInt'], $num); } else { // A float - if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + if (Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian $num = strrev($num); } return pack("Cd", $this->ptg['ptgNum'], $num); @@ -598,10 +600,10 @@ class PHPExcel_Writer_Excel5_Parser // chop away beggining and ending quotes $string = substr($string, 1, strlen($string) - 2); if (strlen($string) > 255) { - throw new PHPExcel_Writer_Exception("String is too long"); + throw new Writer_Exception("String is too long"); } - return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string); + return pack('C', $this->ptg['ptgStr']) . Shared_String::UTF8toBIFF8UnicodeShort($string); } /** @@ -644,7 +646,7 @@ class PHPExcel_Writer_Excel5_Parser list($cell1, $cell2) = explode(':', $range); } else { // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown range separator"); + throw new Writer_Exception("Unknown range separator"); } // Convert the cell references @@ -660,7 +662,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgArea = pack("C", $this->ptg['ptgAreaA']); } else { // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown class $class"); + throw new Writer_Exception("Unknown class $class"); } return $ptgArea . $row1 . $row2 . $col1. $col2; } @@ -702,7 +704,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { // $ptgArea = pack("C", $this->ptg['ptgArea3dA']); // } else { -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new Writer_Exception("Unknown class $class"); // } return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2; @@ -732,7 +734,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgRef = pack("C", $this->ptg['ptgRefA']); // } else { // // TODO: use real error codes -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new Writer_Exception("Unknown class $class"); // } return $ptgRef.$row.$col; } @@ -766,7 +768,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { $ptgRef = pack("C", $this->ptg['ptgRef3dA']); // } else { -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new Writer_Exception("Unknown class $class"); // } return $ptgRef . $ext_ref. $row . $col; @@ -812,11 +814,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->_getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); + throw new Writer_Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->_getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); + throw new Writer_Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -826,7 +828,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->_getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); + throw new Writer_Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -858,11 +860,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->_getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); + throw new Writer_Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->_getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); + throw new Writer_Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -872,7 +874,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->_getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); + throw new Writer_Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -900,7 +902,7 @@ class PHPExcel_Writer_Excel5_Parser /** * Look up the index that corresponds to an external sheet name. The hash of * sheet names is updated by the addworksheet() method of the - * PHPExcel_Writer_Excel5_Workbook class. + * PHPExcel\Writer_Excel5_Workbook class. * * @access private * @param string $sheet_name Sheet name @@ -918,10 +920,10 @@ class PHPExcel_Writer_Excel5_Parser /** * This method is used to update the array of sheet names. It is * called by the addWorksheet() method of the - * PHPExcel_Writer_Excel5_Workbook class. + * PHPExcel\Writer_Excel5_Workbook class. * * @access public - * @see PHPExcel_Writer_Excel5_Workbook::addWorksheet() + * @see PHPExcel\Writer_Excel5_Workbook::addWorksheet() * @param string $name The name of the worksheet being added * @param integer $index The index of the worksheet being added */ @@ -942,10 +944,10 @@ class PHPExcel_Writer_Excel5_Parser $cell = strtoupper($cell); list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell); if ($col >= 256) { - throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255"); + throw new Writer_Exception("Column in: $cell greater than 255"); } if ($row >= 65536) { - throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 "); + throw new Writer_Exception("Row in: $cell greater than 65536 "); } // Set the high bits to indicate if row or col are relative. @@ -983,7 +985,7 @@ class PHPExcel_Writer_Excel5_Parser // FIXME: this changes for BIFF8 if (($row1 >= 65536) or ($row2 >= 65536)) { - throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 "); + throw new Writer_Exception("Row in: $range greater than 65536 "); } // Set the high bits to indicate if rows are relative. @@ -1372,7 +1374,7 @@ class PHPExcel_Writer_Excel5_Parser $this->_advance(); // eat the "(" $result = $this->_parenthesizedExpression(); if ($this->_current_token != ")") { - throw new PHPExcel_Writer_Exception("')' token expected."); + throw new Writer_Exception("')' token expected."); } $this->_advance(); // eat the ")" return $result; @@ -1442,7 +1444,7 @@ class PHPExcel_Writer_Excel5_Parser $result = $this->_func(); return $result; } - throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token. + throw new Writer_Exception("Syntax error: ".$this->_current_token. ", lookahead: ".$this->_lookahead. ", current char: ".$this->_current_char); } @@ -1469,7 +1471,7 @@ class PHPExcel_Writer_Excel5_Parser { $this->_advance(); // eat the "," or ";" } else { - throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ". + throw new Writer_Exception("Syntax error: comma expected in ". "function $function, arg #{$num_args}"); } $result2 = $this->_condition(); @@ -1481,12 +1483,12 @@ class PHPExcel_Writer_Excel5_Parser ++$num_args; } if (!isset($this->_functions[$function])) { - throw new PHPExcel_Writer_Exception("Function $function() doesn't exist"); + throw new Writer_Exception("Function $function() doesn't exist"); } $args = $this->_functions[$function][1]; // If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid. if (($args >= 0) and ($args != $num_args)) { - throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() "); + throw new Writer_Exception("Incorrect number of arguments in function $function() "); } $result = $this->_createTree($function, $result, $num_args); diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php b/Classes/PHPExcel/Writer/Excel5/Workbook.php index 915096f..aa2c517 100644 --- a/Classes/PHPExcel/Writer/Excel5/Workbook.php +++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -61,19 +61,21 @@ // */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_Workbook + * PHPExcel\Writer_Excel5_Workbook * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter +class Writer_Excel5_Workbook extends Writer_Excel5_BIFFwriter { /** * Formula parser * - * @var PHPExcel_Writer_Excel5_Parser + * @var PHPExcel\Writer_Excel5_Parser */ private $_parser; @@ -86,7 +88,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * XF Writers - * @var PHPExcel_Writer_Excel5_Xf[] + * @var PHPExcel\Writer_Excel5_Xf[] */ private $_xfWriters = array(); @@ -117,7 +119,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Fonts writers * - * @var PHPExcel_Writer_Excel5_Font[] + * @var PHPExcel\Writer_Excel5_Font[] */ private $_fontWriters = array(); @@ -185,7 +187,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Escher object corresponding to MSODRAWINGGROUP * - * @var PHPExcel_Shared_Escher + * @var PHPExcel\Shared_Escher */ private $_escher; @@ -193,14 +195,14 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Class constructor * - * @param PHPExcel $phpExcel The Workbook - * @param int &$str_total Total number of strings - * @param int &$str_unique Total number of unique strings - * @param array &$str_table String Table - * @param array &$colors Colour Table - * @param mixed $parser The formula parser created for the Workbook + * @param PHPExcel\Workbook $phpExcel The Workbook + * @param int &$str_total Total number of strings + * @param int &$str_unique Total number of unique strings + * @param array &$str_table String Table + * @param array &$colors Colour Table + * @param mixed $parser The formula parser created for the Workbook */ - public function __construct(PHPExcel $phpExcel = null, + public function __construct(Workbook $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser ) { @@ -246,13 +248,13 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Add a new XF writer * - * @param PHPExcel_Style + * @param PHPExcel\Style * @param boolean Is it a style XF? * @return int Index to XF record */ public function addXfWriter($style, $isStyleXf = false) { - $xfWriter = new PHPExcel_Writer_Excel5_Xf($style); + $xfWriter = new Writer_Excel5_Xf($style); $xfWriter->setIsStyleXf($isStyleXf); // Add the font if not already added @@ -297,10 +299,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Add a font to added fonts * - * @param PHPExcel_Style_Font $font + * @param PHPExcel\Style_Font $font * @return int Index to FONT record */ - public function _addFont(PHPExcel_Style_Font $font) + public function _addFont(Style_Font $font) { $fontHashCode = $font->getHashCode(); if(isset($this->_addedFonts[$fontHashCode])){ @@ -309,7 +311,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $countFonts = count($this->_fontWriters); $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1; - $fontWriter = new PHPExcel_Writer_Excel5_Font($font); + $fontWriter = new Writer_Excel5_Font($font); $fontWriter->setColorIndex($this->_addColor($font->getColor()->getRGB())); $this->_fontWriters[] = $fontWriter; @@ -487,7 +489,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // add size of Workbook globals part 2, the length of the SHEET records $total_worksheets = count($this->_phpExcel->getAllSheets()); foreach ($this->_phpExcel->getWorksheetIterator() as $sheet) { - $offset += $boundsheet_length + strlen(PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle())); + $offset += $boundsheet_length + strlen(Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle())); } // add the sizes of each of the Sheet substreams, respectively @@ -566,15 +568,15 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // Write a Name record if the print area has been defined if ($sheetSetup->isPrintAreaSet()) { // Print area - $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea()); + $printArea = Cell::splitRange($sheetSetup->getPrintArea()); $printArea = $printArea[0]; - $printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]); - $printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]); + $printArea[0] = Cell::coordinateFromString($printArea[0]); + $printArea[1] = Cell::coordinateFromString($printArea[1]); $print_rowmin = $printArea[0][1] - 1; $print_rowmax = $printArea[1][1] - 1; - $print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1; - $print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1; + $print_colmin = Cell::columnIndexFromString($printArea[0][0]) - 1; + $print_colmax = Cell::columnIndexFromString($printArea[1][0]) - 1; $this->_writeNameShort( $i, // sheet index @@ -594,8 +596,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // simultaneous repeatColumns repeatRows if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) { $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); - $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; - $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + $colmin = Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = Cell::columnIndexFromString($repeat[1]) - 1; $repeat = $sheetSetup->getRowsToRepeatAtTop(); $rowmin = $repeat[0] - 1; @@ -616,8 +618,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // Columns to repeat if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); - $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; - $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + $colmin = Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = Cell::columnIndexFromString($repeat[1]) - 1; } else { $colmin = 0; $colmax = 255; @@ -660,14 +662,14 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter foreach ($namedRanges as $namedRange) { // Create absolute coordinate - $range = PHPExcel_Cell::splitRange($namedRange->getRange()); + $range = Cell::splitRange($namedRange->getRange()); for ($i = 0; $i < count($range); $i++) { - $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]); + $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . Cell::absoluteCoordinate($range[$i][0]); if (isset($range[$i][1])) { - $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]); + $range[$i][1] = Cell::absoluteCoordinate($range[$i][1]); } } - $range = PHPExcel_Cell::buildRange($range); // e.g. Sheet1!$A$1:$B$2 + $range = Cell::buildRange($range); // e.g. Sheet1!$A$1:$B$2 // parse formula try { @@ -688,7 +690,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter } $chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false)); - } catch(PHPExcel_Exception $e) { + } catch(Exception $e) { // do nothing } } @@ -703,8 +705,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // simultaneous repeatColumns repeatRows if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) { $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); - $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; - $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + $colmin = Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = Cell::columnIndexFromString($repeat[1]) - 1; $repeat = $sheetSetup->getRowsToRepeatAtTop(); $rowmin = $repeat[0] - 1; @@ -725,8 +727,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // Columns to repeat if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); - $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; - $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + $colmin = Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = Cell::columnIndexFromString($repeat[1]) - 1; } else { $colmin = 0; $colmax = 255; @@ -754,19 +756,19 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $sheetSetup = $this->_phpExcel->getSheet($i)->getPageSetup(); if ($sheetSetup->isPrintAreaSet()) { // Print area, e.g. A3:J6,H1:X20 - $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea()); + $printArea = Cell::splitRange($sheetSetup->getPrintArea()); $countPrintArea = count($printArea); $formulaData = ''; for ($j = 0; $j < $countPrintArea; ++$j) { $printAreaRect = $printArea[$j]; // e.g. A3:J6 - $printAreaRect[0] = PHPExcel_Cell::coordinateFromString($printAreaRect[0]); - $printAreaRect[1] = PHPExcel_Cell::coordinateFromString($printAreaRect[1]); + $printAreaRect[0] = Cell::coordinateFromString($printAreaRect[0]); + $printAreaRect[1] = Cell::coordinateFromString($printAreaRect[1]); $print_rowmin = $printAreaRect[0][1] - 1; $print_rowmax = $printAreaRect[1][1] - 1; - $print_colmin = PHPExcel_Cell::columnIndexFromString($printAreaRect[0][0]) - 1; - $print_colmax = PHPExcel_Cell::columnIndexFromString($printAreaRect[1][0]) - 1; + $print_colmin = Cell::columnIndexFromString($printAreaRect[0][0]) - 1; + $print_colmax = Cell::columnIndexFromString($printAreaRect[1][0]) - 1; // construct formula data manually because parser does not recognize absolute 3d cell references $formulaData .= pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax); @@ -786,7 +788,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter(); $autoFilterRange = $sheetAutoFilter->getRange(); if(!empty($autoFilterRange)) { - $rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange); + $rangeBounds = Cell::rangeBoundaries($autoFilterRange); //Autofilter built in name $name = pack('C', 0x0D); @@ -815,10 +817,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $options = $isBuiltIn ? 0x20 : 0x00; // length of the name, character count - $nlen = PHPExcel_Shared_String::CountCharacters($name); + $nlen = Shared_String::CountCharacters($name); // name with stripped length field - $name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2); + $name = substr(Shared_String::UTF8toBIFF8UnicodeLong($name), 2); // size of the formula (in bytes) $sz = strlen($formulaData); @@ -919,7 +921,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Writes Excel BIFF BOUNDSHEET record. * - * @param PHPExcel_Worksheet $sheet Worksheet name + * @param PHPExcel\Worksheet $sheet Worksheet name * @param integer $offset Location of worksheet BOF */ private function _writeBoundsheet($sheet, $offset) @@ -929,9 +931,9 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // sheet state switch ($sheet->getSheetState()) { - case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break; - case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break; - case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break; + case Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break; + case Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break; + case Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break; default: $ss = 0x00; break; } @@ -941,7 +943,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $grbit = 0x0000; // Visibility and sheet type $data = pack("VCC", $offset, $ss, $st); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname); + $data .= Shared_String::UTF8toBIFF8UnicodeShort($sheetname); $length = strlen($data); $header = pack("vv", $record, $length); @@ -1008,7 +1010,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter { $record = 0x041E; // Record identifier - $numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format); + $numberFormatString = Shared_String::UTF8toBIFF8UnicodeLong($format); $length = 2 + strlen($numberFormatString); // Number of bytes to follow @@ -1025,7 +1027,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x0022; // Record identifier $length = 0x0002; // Bytes to follow - $f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) ? + $f1904 = (Shared_Date::getExcelCalendar() == Shared_Date::CALENDAR_MAC_1904) ? 1 : 0; // Flag for 1904 date system $header = pack("vv", $record, $length); @@ -1414,7 +1416,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter { // write the Escher stream if necessary if (isset($this->_escher)) { - $writer = new PHPExcel_Writer_Excel5_Escher($this->_escher); + $writer = new Writer_Excel5_Escher($this->_escher); $data = $writer->close(); $record = 0x00EB; @@ -1431,7 +1433,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Get Escher object * - * @return PHPExcel_Shared_Escher + * @return PHPExcel\Shared_Escher */ public function getEscher() { @@ -1441,9 +1443,9 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Set Escher object * - * @param PHPExcel_Shared_Escher $pValue + * @param PHPExcel\Shared_Escher $pValue */ - public function setEscher(PHPExcel_Shared_Escher $pValue = null) + public function setEscher(Shared_Escher $pValue = null) { $this->_escher = $pValue; } diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index cc39513..7ad827a 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -61,19 +61,21 @@ // */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_Worksheet + * PHPExcel\Writer_Excel5_Worksheet * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter +class Writer_Excel5_Worksheet extends Writer_Excel5_BIFFwriter { /** * Formula parser * - * @var PHPExcel_Writer_Excel5_Parser + * @var PHPExcel\Writer_Excel5_Parser */ private $_parser; @@ -174,7 +176,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Sheet object - * @var PHPExcel_Worksheet + * @var PHPExcel\Worksheet */ public $_phpSheet; @@ -188,7 +190,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Escher object corresponding to MSODRAWING * - * @var PHPExcel_Shared_Escher + * @var PHPExcel\Shared_Escher */ private $_escher; @@ -209,7 +211,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param mixed $parser The formula parser created for the Workbook * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written * @param string $phpSheet The worksheet to write - * @param PHPExcel_Worksheet $phpSheet + * @param PHPExcel\Worksheet $phpSheet */ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) @@ -257,8 +259,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // $this->_firstRowIndex = ($minR > 65535) ? 65535 : $minR; $this->_lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ; - $this->_firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC); - $this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC); + $this->_firstColumnIndex = Cell::columnIndexFromString($minC); + $this->_lastColumnIndex = Cell::columnIndexFromString($maxC); // if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255; if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255; @@ -271,7 +273,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * and to the end of the workbook. * * @access public - * @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook() + * @see PHPExcel\Writer_Excel5_Workbook::storeWorkbook() */ function close() { @@ -296,7 +298,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Column dimensions if (($defaultWidth = $_phpSheet->getDefaultColumnDimension()->getWidth()) < 0) { - $defaultWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($_phpSheet->getParent()->getDefaultStyle()->getFont()); + $defaultWidth = Shared_Font::getDefaultColumnWidthByFont($_phpSheet->getParent()->getDefaultStyle()->getFont()); } $columnDimensions = $_phpSheet->getColumnDimensions(); @@ -308,7 +310,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $width = $defaultWidth; - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($i); + $columnLetter = Cell::stringFromColumnIndex($i); if (isset($columnDimensions[$columnLetter])) { $columnDimension = $columnDimensions[$columnLetter]; if ($columnDimension->getWidth() >= 0) { @@ -409,7 +411,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter foreach ($_phpSheet->getCellCollection() as $cellID) { $cell = $_phpSheet->getCell($cellID); $row = $cell->getRow() - 1; - $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1; + $column = Cell::columnIndexFromString($cell->getColumn()) - 1; // Don't break Excel! // if ($row + 1 > 65536 or $column + 1 > 256) { @@ -421,15 +423,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs $cVal = $cell->getValue(); - if ($cVal instanceof PHPExcel_RichText) { + if ($cVal instanceof RichText) { // $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex); $arrcRun = array(); - $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8'); + $str_len = Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8'); $str_pos = 0; $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { // FONT Index - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof RichText_Run) { $str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()]; } else { @@ -437,13 +439,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx); // Position FROM - $str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8'); + $str_pos += Shared_String::CountCharacters($element->getText(), 'UTF-8'); } $this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); } else { switch ($cell->getDatatype()) { - case PHPExcel_Cell_DataType::TYPE_STRING: - case PHPExcel_Cell_DataType::TYPE_NULL: + case Cell_DataType::TYPE_STRING: + case Cell_DataType::TYPE_NULL: if ($cVal === '' || $cVal === null) { $this->_writeBlank($row, $column, $xfIndex); } else { @@ -451,21 +453,21 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } break; - case PHPExcel_Cell_DataType::TYPE_NUMERIC: + case Cell_DataType::TYPE_NUMERIC: $this->_writeNumber($row, $column, $cVal, $xfIndex); break; - case PHPExcel_Cell_DataType::TYPE_FORMULA: + case Cell_DataType::TYPE_FORMULA: $calculatedValue = $this->_preCalculateFormulas ? $cell->getCalculatedValue() : null; $this->_writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue); break; - case PHPExcel_Cell_DataType::TYPE_BOOL: + case Cell_DataType::TYPE_BOOL: $this->_writeBoolErr($row, $column, $cVal, 0, $xfIndex); break; - case PHPExcel_Cell_DataType::TYPE_ERROR: + case Cell_DataType::TYPE_ERROR: $this->_writeBoolErr($row, $column, self::_mapErrorCode($cVal), 1, $xfIndex); break; @@ -496,7 +498,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Hyperlinks foreach ($_phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) { - list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinate); + list($column, $row) = Cell::coordinateFromString($coordinate); $url = $hyperlink->getUrl(); @@ -513,7 +515,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $url = 'external:' . $url; } - $this->_writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url); + $this->_writeUrl($row - 1, Cell::columnIndexFromString($column) - 1, $url); } $this->_writeDataValidity(); @@ -532,8 +534,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Write ConditionalFormattingTable records foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + if($conditional->getConditionType() == Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == Style_Conditional::CONDITION_CELLIS){ if(!in_array($conditional->getHashCode(), $arrConditional)){ $arrConditional[] = $conditional->getHashCode(); // Write CFRULE record @@ -569,14 +571,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $lastCell = $explodes[1]; } - $firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1) - $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6) + $firstCellCoordinates = Cell::coordinateFromString($firstCell); // e.g. array(0, 1) + $lastCellCoordinates = Cell::coordinateFromString($lastCell); // e.g. array(1, 6) return(pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, - PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, - PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1 + Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, + Cell::columnIndexFromString($lastCellCoordinates[0]) - 1 )); } @@ -688,7 +690,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){ $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow - $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun); + $str = Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun); /* check if string is already present */ if (!isset($this->_str_table[$str])) { @@ -757,7 +759,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow - $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str); + $str = Shared_String::UTF8toBIFF8UnicodeLong($str); /* check if string is already present */ if (!isset($this->_str_table[$str])) { @@ -881,7 +883,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Numeric value $num = pack('d', $calculatedValue); } elseif (is_string($calculatedValue)) { - if (array_key_exists($calculatedValue, PHPExcel_Cell_DataType::getErrorCodes())) { + if (array_key_exists($calculatedValue, Cell_DataType::getErrorCodes())) { // Error value $num = pack('CCCvCv', 0x02, 0x00, self::_mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF); } elseif ($calculatedValue === '') { @@ -934,7 +936,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter return 0; - } catch (PHPExcel_Exception $e) { + } catch (Exception $e) { // do nothing } @@ -948,7 +950,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter private function _writeStringRecord($stringValue) { $record = 0x0207; // Record identifier - $data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue); + $data = Shared_String::UTF8toBIFF8UnicodeLong($stringValue); $length = strlen($data); $header = pack('vv', $record, $length); @@ -1086,10 +1088,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $url .= "\0"; // character count - $url_len = PHPExcel_Shared_String::CountCharacters($url); + $url_len = Shared_String::CountCharacters($url); $url_len = pack('V', $url_len); - $url = PHPExcel_Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8'); + $url = Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8'); // Calculate the data length $length = 0x24 + strlen($url); @@ -1309,7 +1311,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet $fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0; $fPaged = 1; // 2 - $fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; + $fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; $grbit = $fDspFmla; $grbit |= $fDspGrid << 1; @@ -1440,7 +1442,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter { // look up the selected cell range $selectedCells = $this->_phpSheet->getSelectedCells(); - $selectedCells = PHPExcel_Cell::splitRange($this->_phpSheet->getSelectedCells()); + $selectedCells = Cell::splitRange($this->_phpSheet->getSelectedCells()); $selectedCells = $selectedCells[0]; if (count($selectedCells) == 2) { list($first, $last) = $selectedCells; @@ -1449,12 +1451,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $last = $selectedCells[0]; } - list($colFirst, $rwFirst) = PHPExcel_Cell::coordinateFromString($first); - $colFirst = PHPExcel_Cell::columnIndexFromString($colFirst) - 1; // base 0 column index + list($colFirst, $rwFirst) = Cell::coordinateFromString($first); + $colFirst = Cell::columnIndexFromString($colFirst) - 1; // base 0 column index --$rwFirst; // base 0 row index - list($colLast, $rwLast) = PHPExcel_Cell::coordinateFromString($last); - $colLast = PHPExcel_Cell::columnIndexFromString($colLast) - 1; // base 0 column index + list($colLast, $rwLast) = Cell::coordinateFromString($last); + $colLast = Cell::columnIndexFromString($colLast) - 1; // base 0 column index --$rwLast; // base 0 row index // make sure we are not out of bounds @@ -1530,12 +1532,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter ++$j; // extract the row and column indexes - $range = PHPExcel_Cell::splitRange($mergeCell); + $range = Cell::splitRange($mergeCell); list($first, $last) = $range[0]; - list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first); - list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last); + list($firstColumn, $firstRow) = Cell::coordinateFromString($first); + list($lastColumn, $lastRow) = Cell::coordinateFromString($last); - $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1); + $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Cell::columnIndexFromString($firstColumn) - 1, Cell::columnIndexFromString($lastColumn) - 1); // flush record if we have reached limit for number of merged cells, or reached final merged cell if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) { @@ -1660,7 +1662,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter hexdec($password) ); - $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); + $recordData .= Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); $length = strlen($recordData); @@ -1733,9 +1735,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter { $panes = array(); if ($freezePane = $this->_phpSheet->getFreezePane()) { - list($column, $row) = PHPExcel_Cell::coordinateFromString($freezePane); + list($column, $row) = Cell::coordinateFromString($freezePane); $panes[0] = $row - 1; - $panes[1] = PHPExcel_Cell::columnIndexFromString($column) - 1; + $panes[1] = Cell::columnIndexFromString($column) - 1; } else { // thaw panes return; @@ -1834,7 +1836,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fLeftToRight = 0x0; // Print over then down // Page orientation - $fLandscape = ($this->_phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? + $fLandscape = ($this->_phpSheet->getPageSetup()->getOrientation() == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 0x0 : 0x1; $fNoPls = 0x0; // Setup not read from printer @@ -1890,7 +1892,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } */ - $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddHeader()); + $recordData = Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddHeader()); $length = strlen($recordData); $header = pack("vv", $record, $length); @@ -1914,7 +1916,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } */ - $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddFooter()); + $recordData = Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddFooter()); $length = strlen($recordData); $header = pack("vv", $record, $length); @@ -2085,7 +2087,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x009D; // Record identifier $length = 0x0002; // Bytes to follow - $rangeBounds = PHPExcel_Cell::rangeBoundaries($this->_phpSheet->getAutoFilter()->getRange()); + $rangeBounds = Cell::rangeBoundaries($this->_phpSheet->getAutoFilter()->getRange()); $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0]; $header = pack("vv", $record, $length); @@ -2187,21 +2189,21 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) { // Fetch coordinates - $coordinates = PHPExcel_Cell::coordinateFromString($cell); + $coordinates = Cell::coordinateFromString($cell); // Decide what to do by the type of break switch ($breakType) { - case PHPExcel_Worksheet::BREAK_COLUMN: + case Worksheet::BREAK_COLUMN: // Add to list of vertical breaks - $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1; + $vbreaks[] = Cell::columnIndexFromString($coordinates[0]) - 1; break; - case PHPExcel_Worksheet::BREAK_ROW: + case Worksheet::BREAK_ROW: // Add to list of horizontal breaks $hbreaks[] = $coordinates[1]; break; - case PHPExcel_Worksheet::BREAK_NONE: + case Worksheet::BREAK_NONE: default: // Nothing to do break; @@ -2444,10 +2446,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $row_end = $row_start; // Row containing bottom right corner of object // Zero the specified offset if greater than the cell dimensions - if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { + if ($x1 >= Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_start))) { $x1 = 0; } - if ($y1 >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1)) { + if ($y1 >= Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1)) { $y1 = 0; } @@ -2455,38 +2457,38 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $height = $height + $y1 -1; // Subtract the underlying cell widths to find the end cell of the image - while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { - $width -= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)); + while ($width >= Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_end))) { + $width -= Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_end)); ++$col_end; } // Subtract the underlying cell heights to find the end cell of the image - while ($height >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1)) { - $height -= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1); + while ($height >= Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1)) { + $height -= Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1); ++$row_end; } // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell // with zero eight or width. // - if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { + if (Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_start)) == 0) { return; } - if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { + if (Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_end)) == 0) { return; } - if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) == 0) { + if (Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) == 0) { return; } - if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) { + if (Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) { return; } // Convert the pixel values to the percentage value expected by Excel - $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; - $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256; - $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object - $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object + $x1 = $x1 / Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_start)) * 1024; + $y1 = $y1 / Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256; + $x2 = $width / Shared_Excel5::sizeCol($this->_phpSheet, Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $y2 = $height / Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object $this->_writeObjPicture($col_start, $x1, $row_start, $y1, @@ -2615,7 +2617,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Open file. $bmp_fd = @fopen($bitmap,"rb"); if (!$bmp_fd) { - throw new PHPExcel_Writer_Exception("Couldn't import $bitmap"); + throw new Writer_Exception("Couldn't import $bitmap"); } // Slurp the file into a string. @@ -2623,13 +2625,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Check that the file is big enough to be a bitmap. if (strlen($data) <= 0x36) { - throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n"); + throw new Writer_Exception("$bitmap doesn't contain enough data.\n"); } // The first 2 bytes are used to identify the bitmap. $identity = unpack("A2ident", $data); if ($identity['ident'] != "BM") { - throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); + throw new Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); } // Remove bitmap data: ID. @@ -2653,20 +2655,20 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $height = $width_and_height[2]; $data = substr($data, 8); if ($width > 0xFFFF) { - throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n"); + throw new Writer_Exception("$bitmap: largest image width supported is 65k.\n"); } if ($height > 0xFFFF) { - throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n"); + throw new Writer_Exception("$bitmap: largest image height supported is 65k.\n"); } // Read and remove the bitmap planes and bpp data. Verify them. $planes_and_bitcount = unpack("v2", substr($data, 0, 4)); $data = substr($data, 4); if ($planes_and_bitcount[2] != 24) { // Bitcount - throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n"); + throw new Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n"); } if ($planes_and_bitcount[1] != 1) { - throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n"); + throw new Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n"); } // Read and remove the bitmap compression. Verify compression. @@ -2675,7 +2677,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //$compression = 0; if ($compression['comp'] != 0) { - throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n"); + throw new Writer_Exception("$bitmap: compression not supported in bitmap image.\n"); } // Remove bitmap data: data size, hres, vres, colours, imp. colours. @@ -2710,7 +2712,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Get Escher object * - * @return PHPExcel_Shared_Escher + * @return PHPExcel\Shared_Escher */ public function getEscher() { @@ -2720,9 +2722,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Set Escher object * - * @param PHPExcel_Shared_Escher $pValue + * @param PHPExcel\Shared_Escher $pValue */ - public function setEscher(PHPExcel_Shared_Escher $pValue = null) + public function setEscher(Shared_Escher $pValue = null) { $this->_escher = $pValue; } @@ -2734,7 +2736,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter { // write the Escher stream if necessary if (isset($this->_escher)) { - $writer = new PHPExcel_Writer_Excel5_Escher($this->_escher); + $writer = new Writer_Excel5_Escher($this->_escher); $data = $writer->close(); $spOffsets = $writer->getSpOffsets(); $spTypes = $writer->getSpTypes(); @@ -2848,23 +2850,23 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // data type $type = $dataValidation->getType(); switch ($type) { - case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break; - case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break; - case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break; - case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break; - case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break; - case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break; - case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break; - case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break; + case Cell_DataValidation::TYPE_NONE: $type = 0x00; break; + case Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break; + case Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break; + case Cell_DataValidation::TYPE_LIST: $type = 0x03; break; + case Cell_DataValidation::TYPE_DATE: $type = 0x04; break; + case Cell_DataValidation::TYPE_TIME: $type = 0x05; break; + case Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break; + case Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break; } $options |= $type << 0; // error style $errorStyle = $dataValidation->getType(); switch ($errorStyle) { - case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break; - case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break; - case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break; + case Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break; + case Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break; + case Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break; } $options |= $errorStyle << 4; @@ -2888,14 +2890,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // condition operator $operator = $dataValidation->getOperator(); switch ($operator) { - case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break; - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break; + case Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break; + case Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break; + case Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break; + case Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break; + case Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break; + case Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break; + case Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break; + case Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break; } $options |= $operator << 20; @@ -2904,22 +2906,22 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // prompt title $promptTitle = $dataValidation->getPromptTitle() !== '' ? $dataValidation->getPromptTitle() : chr(0); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($promptTitle); + $data .= Shared_String::UTF8toBIFF8UnicodeLong($promptTitle); // error title $errorTitle = $dataValidation->getErrorTitle() !== '' ? $dataValidation->getErrorTitle() : chr(0); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($errorTitle); + $data .= Shared_String::UTF8toBIFF8UnicodeLong($errorTitle); // prompt text $prompt = $dataValidation->getPrompt() !== '' ? $dataValidation->getPrompt() : chr(0); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($prompt); + $data .= Shared_String::UTF8toBIFF8UnicodeLong($prompt); // error text $error = $dataValidation->getError() !== '' ? $dataValidation->getError() : chr(0); - $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($error); + $data .= Shared_String::UTF8toBIFF8UnicodeLong($error); // formula 1 try { @@ -2931,7 +2933,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $formula1 = $this->_parser->toReversePolish(); $sz1 = strlen($formula1); - } catch(PHPExcel_Exception $e) { + } catch(Exception $e) { $sz1 = 0; $formula1 = ''; } @@ -2942,13 +2944,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter try { $formula2 = $dataValidation->getFormula2(); if ($formula2 === '') { - throw new PHPExcel_Writer_Exception('No formula2'); + throw new Writer_Exception('No formula2'); } $this->_parser->parse($formula2); $formula2 = $this->_parser->toReversePolish(); $sz2 = strlen($formula2); - } catch(PHPExcel_Exception $e) { + } catch(Exception $e) { $sz2 = 0; $formula2 = ''; } @@ -3000,7 +3002,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $wScalvePLV = $this->_phpSheet->getSheetView()->getZoomScale(); // 2 // The options flags that comprise $grbit - if($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){ + if($this->_phpSheet->getSheetView()->getView() == Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){ $fPageLayoutView = 1; } else { $fPageLayoutView = 0; @@ -3019,42 +3021,42 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Write CFRule Record - * @param PHPExcel_Style_Conditional $conditional + * @param PHPExcel\Style_Conditional $conditional */ - private function _writeCFRule(PHPExcel_Style_Conditional $conditional){ + private function _writeCFRule(Style_Conditional $conditional){ $record = 0x01B1; // Record identifier // $type : Type of the CF // $operatorType : Comparison operator - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION){ + if($conditional->getConditionType() == Style_Conditional::CONDITION_EXPRESSION){ $type = 0x02; $operatorType = 0x00; - } else if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + } else if($conditional->getConditionType() == Style_Conditional::CONDITION_CELLIS){ $type = 0x01; switch ($conditional->getOperatorType()){ - case PHPExcel_Style_Conditional::OPERATOR_NONE: + case Style_Conditional::OPERATOR_NONE: $operatorType = 0x00; break; - case PHPExcel_Style_Conditional::OPERATOR_EQUAL: + case Style_Conditional::OPERATOR_EQUAL: $operatorType = 0x03; break; - case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN: + case Style_Conditional::OPERATOR_GREATERTHAN: $operatorType = 0x05; break; - case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL: + case Style_Conditional::OPERATOR_GREATERTHANOREQUAL: $operatorType = 0x07; break; - case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN: + case Style_Conditional::OPERATOR_LESSTHAN: $operatorType = 0x06; break; - case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL: + case Style_Conditional::OPERATOR_LESSTHANOREQUAL: $operatorType = 0x08; break; - case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL: + case Style_Conditional::OPERATOR_NOTEQUAL: $operatorType = 0x04; break; - case PHPExcel_Style_Conditional::OPERATOR_BETWEEN: + case Style_Conditional::OPERATOR_BETWEEN: $operatorType = 0x01; break; // not OPERATOR_NOTBETWEEN 0x02 @@ -3070,7 +3072,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $szValue2 = 0x0000; $operand1 = pack('Cv', 0x1E, $arrConditions[0]); $operand2 = null; - } else if($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)){ + } else if($numConditions == 2 && ($conditional->getOperatorType() == Style_Conditional::OPERATOR_BETWEEN)){ $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); $operand1 = pack('Cv', 0x1E, $arrConditions[0]); @@ -3104,14 +3106,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $bFormatProt = 0; } // Border - $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == Style_Border::BORDER_NONE ? 1 : 0); + $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == Style_Border::BORDER_NONE ? 1 : 0); + $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == Style_Border::BORDER_NONE ? 1 : 0); + $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == Style_Border::BORDER_NONE ? 1 : 0); if($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0){ $bFormatBorder = 1; } else { @@ -3187,7 +3189,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); } else { - $dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); + $dataBlockFont = Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); } // Font Size if($conditional->getStyle()->getFont()->getSize() == null){ @@ -3216,11 +3218,11 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } // Underline type switch ($conditional->getStyle()->getFont()->getUnderline()){ - case PHPExcel_Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break; + case Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break; + case Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break; + case Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break; + case Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break; + case Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break; default : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 1; break; } // Not used (3) @@ -3314,12 +3316,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $blockAlign = 0; // Alignment and text break switch ($conditional->getStyle()->getAlignment()->getHorizontal()){ - case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break; - case PHPExcel_Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break; - case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break; - case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break; + case Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break; + case Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break; + case Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break; + case Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break; + case Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break; + case Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break; } if($conditional->getStyle()->getAlignment()->getWrapText() == true){ $blockAlign |= 1 << 3; @@ -3327,10 +3329,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $blockAlign |= 0 << 3; } switch ($conditional->getStyle()->getAlignment()->getVertical()){ - case PHPExcel_Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break; + case Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break; + case Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break; + case Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break; + case Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break; } $blockAlign |= 0 << 7; @@ -3354,68 +3356,68 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter if($bFormatBorder == 1){ $blockLineStyle = 0; switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break; + case Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break; + case Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break; + case Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break; + case Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break; + case Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break; + case Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break; + case Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break; + case Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break; + case Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break; + case Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break; + case Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break; + case Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break; + case Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break; + case Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break; } switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break; + case Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break; + case Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break; + case Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break; + case Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break; + case Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break; + case Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break; + case Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break; + case Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break; + case Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break; + case Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break; + case Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break; + case Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break; + case Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break; + case Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break; } switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break; + case Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break; + case Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break; + case Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break; + case Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break; + case Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break; + case Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break; + case Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break; + case Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break; + case Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break; + case Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break; + case Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break; + case Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break; + case Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break; + case Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break; } switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break; + case Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break; + case Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break; + case Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break; + case Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break; + case Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break; + case Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break; + case Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break; + case Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break; + case Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break; + case Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break; + case Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break; + case Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break; + case Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break; + case Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break; } //@todo _writeCFRule() => $blockLineStyle => Index Color for left line //@todo _writeCFRule() => $blockLineStyle => Index Color for right line @@ -3426,20 +3428,20 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //@todo _writeCFRule() => $blockColor => Index Color for bottom line //@todo _writeCFRule() => $blockColor => Index Color for diagonal line switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break; + case Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break; + case Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break; + case Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break; + case Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break; + case Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break; + case Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break; + case Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break; + case Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break; + case Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break; + case Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break; + case Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break; + case Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break; + case Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break; + case Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break; } $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor); } @@ -3447,27 +3449,27 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Fill Patern Style $blockFillPatternStyle = 0; switch ($conditional->getStyle()->getFill()->getFillType()){ - case PHPExcel_Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break; - case PHPExcel_Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break; - case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break; - case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 - case PHPExcel_Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 + case Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break; + case Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break; + case Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break; + case Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break; + case Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break; + case Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break; + case Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break; + case Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break; + case Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break; + case Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break; + case Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break; + case Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break; + case Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break; + case Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break; + case Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break; + case Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break; + case Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break; + case Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break; + case Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break; + case Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 + case Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 default : $blockFillPatternStyle = 0x00; break; } // Color @@ -3595,10 +3597,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } if($bFormatProt == 1){ $dataBlockProtection = 0; - if($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + if($conditional->getStyle()->getProtection()->getLocked() == Style_Protection::PROTECTION_PROTECTED){ $dataBlockProtection = 1; } - if($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + if($conditional->getStyle()->getProtection()->getHidden() == Style_Protection::PROTECTION_PROTECTED){ $dataBlockProtection = 1 << 1; } } @@ -3643,15 +3645,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $arrConditional = array(); foreach ($this->_phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + if($conditional->getConditionType() == Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == Style_Conditional::CONDITION_CELLIS){ if(!in_array($conditional->getHashCode(), $arrConditional)){ $arrConditional[] = $conditional->getHashCode(); } // Cells - $arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate); + $arrCoord = Cell::coordinateFromString($cellCoordinate); if(!is_numeric($arrCoord[0])){ - $arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]); + $arrCoord[0] = Cell::columnIndexFromString($arrCoord[0]); } if(is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])){ $numColumnMin = $arrCoord[0]; diff --git a/Classes/PHPExcel/Writer/Excel5/Xf.php b/Classes/PHPExcel/Writer/Excel5/Xf.php index 241b5f8..4a1bdfa 100644 --- a/Classes/PHPExcel/Writer/Excel5/Xf.php +++ b/Classes/PHPExcel/Writer/Excel5/Xf.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## @@ -61,14 +61,16 @@ // */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Excel5_Xf + * PHPExcel\Writer_Excel5_Xf * * @category PHPExcel - * @package PHPExcel_Writer_Excel5 + * @package PHPExcel\Writer_Excel5 * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5_Xf +class Writer_Excel5_Xf { /** * Style XF or a cell XF ? @@ -135,9 +137,9 @@ class PHPExcel_Writer_Excel5_Xf * Constructor * * @access public - * @param PHPExcel_Style The XF format + * @param PHPExcel\Style The XF format */ - public function __construct(PHPExcel_Style $style = null) + public function __construct(Style $style = null) { $this->_isStyleXf = false; $this->_fontIndex = 0; @@ -236,10 +238,10 @@ class PHPExcel_Writer_Excel5_Xf $border1 |= $this->_right_color << 23; $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); - $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH - || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN; - $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH - || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP; + $diag_tl_to_rb = $diagonalDirection == Style_Borders::DIAGONAL_BOTH + || $diagonalDirection == Style_Borders::DIAGONAL_DOWN; + $diag_tr_to_lb = $diagonalDirection == Style_Borders::DIAGONAL_BOTH + || $diagonalDirection == Style_Borders::DIAGONAL_UP; $border1 |= $diag_tl_to_rb << 30; $border1 |= $diag_tr_to_lb << 31; @@ -381,20 +383,20 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00, - PHPExcel_Style_Border::BORDER_THIN => 0x01, - PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, - PHPExcel_Style_Border::BORDER_DASHED => 0x03, - PHPExcel_Style_Border::BORDER_DOTTED => 0x04, - PHPExcel_Style_Border::BORDER_THICK => 0x05, - PHPExcel_Style_Border::BORDER_DOUBLE => 0x06, - PHPExcel_Style_Border::BORDER_HAIR => 0x07, - PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08, - PHPExcel_Style_Border::BORDER_DASHDOT => 0x09, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, - PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, - PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D, + private static $_mapBorderStyle = array ( Style_Border::BORDER_NONE => 0x00, + Style_Border::BORDER_THIN => 0x01, + Style_Border::BORDER_MEDIUM => 0x02, + Style_Border::BORDER_DASHED => 0x03, + Style_Border::BORDER_DOTTED => 0x04, + Style_Border::BORDER_THICK => 0x05, + Style_Border::BORDER_DOUBLE => 0x06, + Style_Border::BORDER_HAIR => 0x07, + Style_Border::BORDER_MEDIUMDASHED => 0x08, + Style_Border::BORDER_DASHDOT => 0x09, + Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, + Style_Border::BORDER_DASHDOTDOT => 0x0B, + Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, + Style_Border::BORDER_SLANTDASHDOT => 0x0D, ); /** @@ -414,27 +416,27 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00, - PHPExcel_Style_Fill::FILL_SOLID => 0x01, - PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, - PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, - PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, - PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, - PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09, - PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, - PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 - PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 + private static $_mapFillType = array( Style_Fill::FILL_NONE => 0x00, + Style_Fill::FILL_SOLID => 0x01, + Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, + Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, + Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, + Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, + Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, + Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, + Style_Fill::FILL_PATTERN_DARKUP => 0x08, + Style_Fill::FILL_PATTERN_DARKGRID => 0x09, + Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, + Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, + Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, + Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, + Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, + Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, + Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, + Style_Fill::FILL_PATTERN_GRAY125 => 0x11, + Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, + Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 + Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 ); /** * Map fill type @@ -453,12 +455,12 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, - PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, - PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, - PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, + private static $_mapHAlign = array( Style_Alignment::HORIZONTAL_GENERAL => 0, + Style_Alignment::HORIZONTAL_LEFT => 1, + Style_Alignment::HORIZONTAL_CENTER => 2, + Style_Alignment::HORIZONTAL_RIGHT => 3, + Style_Alignment::HORIZONTAL_JUSTIFY => 5, + Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, ); /** * Map to BIFF2-BIFF8 codes for horizontal alignment @@ -478,10 +480,10 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0, - PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, - PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, - PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, + private static $_mapVAlign = array( Style_Alignment::VERTICAL_TOP => 0, + Style_Alignment::VERTICAL_CENTER => 1, + Style_Alignment::VERTICAL_BOTTOM => 2, + Style_Alignment::VERTICAL_JUSTIFY => 3, ); /** * Map to BIFF2-BIFF8 codes for vertical alignment @@ -521,9 +523,9 @@ class PHPExcel_Writer_Excel5_Xf */ private static function _mapLocked($locked) { switch ($locked) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; + case Style_Protection::PROTECTION_INHERIT: return 1; + case Style_Protection::PROTECTION_PROTECTED: return 1; + case Style_Protection::PROTECTION_UNPROTECTED: return 0; default: return 1; } } @@ -536,9 +538,9 @@ class PHPExcel_Writer_Excel5_Xf */ private static function _mapHidden($hidden) { switch ($hidden) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; + case Style_Protection::PROTECTION_INHERIT: return 0; + case Style_Protection::PROTECTION_PROTECTED: return 1; + case Style_Protection::PROTECTION_UNPROTECTED: return 0; default: return 0; } } diff --git a/Classes/PHPExcel/Writer/Exception.php b/Classes/PHPExcel/Writer/Exception.php index b5d437d..d0e0adf 100644 --- a/Classes/PHPExcel/Writer/Exception.php +++ b/Classes/PHPExcel/Writer/Exception.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_Exception + * PHPExcel\Writer_Exception * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Exception extends PHPExcel_Exception { +class Writer_Exception extends Exception { /** * Error handler callback * diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index 3affa7e..55a8591 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_HTML + * @package PHPExcel\Writer_HTML * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_HTML + * PHPExcel\Writer_HTML * * @category PHPExcel - * @package PHPExcel_Writer_HTML + * @package PHPExcel\Writer_HTML * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { +class Writer_HTML extends Writer_Abstract implements Writer_IWriter { /** * PHPExcel object * @@ -86,7 +88,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Default font * - * @var PHPExcel_Style_Font + * @var PHPExcel\Style_Font */ private $_defaultFont; @@ -133,11 +135,11 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ private $_generateSheetNavigationBlock = true; /** - * Create a new PHPExcel_Writer_HTML + * Create a new PHPExcel\Writer_HTML * - * @param PHPExcel $phpExcel PHPExcel object + * @param PHPExcel\Workbook $phpExcel PHPExcel object */ - public function __construct(PHPExcel $phpExcel) { + public function __construct(Workbook $phpExcel) { $this->_phpExcel = $phpExcel; $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont(); } @@ -146,16 +148,16 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = null) { // garbage collect $this->_phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + $saveDebugLog = Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); + $saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); // Build CSS $this->buildCSS(!$this->_useInlineCss); @@ -163,7 +165,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Open file $fileHandle = fopen($pFilename, 'wb+'); if ($fileHandle === false) { - throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + throw new Writer_Exception("Could not open file $pFilename for writing."); } // Write headers @@ -183,8 +185,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Close file fclose($fileHandle); - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); + Calculation::setArrayReturnType($saveArrayReturnType); + Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -195,10 +197,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ private function _mapVAlign($vAlign) { switch ($vAlign) { - case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: return 'bottom'; - case PHPExcel_Style_Alignment::VERTICAL_TOP: return 'top'; - case PHPExcel_Style_Alignment::VERTICAL_CENTER: - case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: return 'middle'; + case Style_Alignment::VERTICAL_BOTTOM: return 'bottom'; + case Style_Alignment::VERTICAL_TOP: return 'top'; + case Style_Alignment::VERTICAL_CENTER: + case Style_Alignment::VERTICAL_JUSTIFY: return 'middle'; default: return 'baseline'; } } @@ -211,12 +213,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ private function _mapHAlign($hAlign) { switch ($hAlign) { - case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: return false; - case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: return 'left'; - case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: return 'right'; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: return 'center'; - case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: return 'justify'; + case Style_Alignment::HORIZONTAL_GENERAL: return false; + case Style_Alignment::HORIZONTAL_LEFT: return 'left'; + case Style_Alignment::HORIZONTAL_RIGHT: return 'right'; + case Style_Alignment::HORIZONTAL_CENTER: + case Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: return 'center'; + case Style_Alignment::HORIZONTAL_JUSTIFY: return 'justify'; default: return false; } } @@ -229,20 +231,20 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ private function _mapBorderStyle($borderStyle) { switch ($borderStyle) { - case PHPExcel_Style_Border::BORDER_NONE: return 'none'; - case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed'; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted'; - case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed'; - case PHPExcel_Style_Border::BORDER_DOTTED: return '1px dotted'; - case PHPExcel_Style_Border::BORDER_DOUBLE: return '3px double'; - case PHPExcel_Style_Border::BORDER_HAIR: return '1px solid'; - case PHPExcel_Style_Border::BORDER_MEDIUM: return '2px solid'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: return '2px dotted'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_THICK: return '3px solid'; - case PHPExcel_Style_Border::BORDER_THIN: return '1px solid'; + case Style_Border::BORDER_NONE: return 'none'; + case Style_Border::BORDER_DASHDOT: return '1px dashed'; + case Style_Border::BORDER_DASHDOTDOT: return '1px dotted'; + case Style_Border::BORDER_DASHED: return '1px dashed'; + case Style_Border::BORDER_DOTTED: return '1px dotted'; + case Style_Border::BORDER_DOUBLE: return '3px double'; + case Style_Border::BORDER_HAIR: return '1px solid'; + case Style_Border::BORDER_MEDIUM: return '2px solid'; + case Style_Border::BORDER_MEDIUMDASHDOT: return '2px dashed'; + case Style_Border::BORDER_MEDIUMDASHDOTDOT: return '2px dotted'; + case Style_Border::BORDER_MEDIUMDASHED: return '2px dashed'; + case Style_Border::BORDER_SLANTDASHDOT: return '2px dashed'; + case Style_Border::BORDER_THICK: return '3px solid'; + case Style_Border::BORDER_THIN: return '1px solid'; default: return '1px solid'; // map others to thin } } @@ -260,7 +262,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Set sheet index * * @param int $pValue Sheet index - * @return PHPExcel_Writer_HTML + * @return PHPExcel\Writer_HTML */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; @@ -280,7 +282,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Set sheet index * * @param boolean $pValue Flag indicating whether the sheet navigation block should be generated or not - * @return PHPExcel_Writer_HTML + * @return PHPExcel\Writer_HTML */ public function setGenerateSheetNavigationBlock($pValue = true) { $this->_generateSheetNavigationBlock = (bool) $pValue; @@ -300,12 +302,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $pIncludeStyles Include styles? * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML @@ -351,12 +353,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Generate sheet data * * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function generateSheetData() { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Ensure that Spans have been calculated? @@ -383,10 +385,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Get worksheet dimension $dimension = explode(':', $sheet->calculateWorksheetDimension()); - $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]); - $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1; - $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]); - $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1; + $dimension[0] = Cell::coordinateFromString($dimension[0]); + $dimension[0][0] = Cell::columnIndexFromString($dimension[0][0]) - 1; + $dimension[1] = Cell::coordinateFromString($dimension[1]); + $dimension[1][0] = Cell::columnIndexFromString($dimension[1][0]) - 1; // row min,max $rowMin = $dimension[0][1]; @@ -468,13 +470,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Generate sheet tabs * * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function generateNavigation() { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Fetch sheets @@ -506,18 +508,18 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ return $html; } - private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) { + private function _extendRowsForChartsAndImages(Worksheet $pSheet, $row) { $rowMax = $row; $colMax = 'A'; if ($this->_includeCharts) { foreach ($pSheet->getChartCollection() as $chart) { - if ($chart instanceof PHPExcel_Chart) { + if ($chart instanceof Chart) { $chartCoordinates = $chart->getTopLeftPosition(); - $chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']); - $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]); + $chartTL = Cell::coordinateFromString($chartCoordinates['cell']); + $chartCol = Cell::columnIndexFromString($chartTL[0]); if ($chartTL[1] > $rowMax) { $rowMax = $chartTL[1]; - if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + if ($chartCol > Cell::columnIndexFromString($colMax)) { $colMax = $chartTL[0]; } } @@ -526,12 +528,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } foreach ($pSheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { - $imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates()); - $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]); + if ($drawing instanceof Worksheet_Drawing) { + $imageTL = Cell::coordinateFromString($drawing->getCoordinates()); + $imageCol = Cell::columnIndexFromString($imageTL[0]); if ($imageTL[1] > $rowMax) { $rowMax = $imageTL[1]; - if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + if ($imageCol > Cell::columnIndexFromString($colMax)) { $colMax = $imageTL[0]; } } @@ -559,18 +561,18 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate image tag in cell * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param PHPExcel\Worksheet $pSheet PHPExcel Worksheet * @param string $coordinates Cell coordinates * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) { + private function _writeImageInCell(Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; // Write images foreach ($pSheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing instanceof Worksheet_Drawing) { if ($drawing->getCoordinates() == $coordinates) { $filename = $drawing->getPath(); @@ -621,21 +623,21 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate chart tag in cell * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param PHPExcel\Worksheet $pSheet PHPExcel Worksheet * @param string $coordinates Cell coordinates * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { + private function _writeChartInCell(Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; // Write charts foreach ($pSheet->getChartCollection() as $chart) { - if ($chart instanceof PHPExcel_Chart) { + if ($chart instanceof Chart) { $chartCoordinates = $chart->getTopLeftPosition(); if ($chartCoordinates['cell'] == $coordinates) { - $chartFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/'.uniqid().'.png'; + $chartFileName = Shared_File::sys_get_temp_dir().'/'.uniqid().'.png'; if (!$chart->render($chartFileName)) { return; } @@ -669,12 +671,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $generateSurroundingHTML Generate surrounding HTML tags? () * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function generateStyles($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Build CSS @@ -710,12 +712,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { }) * @return array - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function buildCSS($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Cached? @@ -790,7 +792,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $sheet->calculateColumnWidths(); // col elements, initialize - $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; + $highestColumnIndex = Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; $column = -1; while($column++ < $highestColumnIndex) { $this->_columnWidths[$sheetIndex][$column] = 42; // approximation @@ -799,9 +801,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // col elements, loop through columnDimensions and set width foreach ($sheet->getColumnDimensions() as $columnDimension) { - if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->_defaultFont)) >= 0) { - $width = PHPExcel_Shared_Drawing::pixelsToPoints($width); - $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; + if (($width = Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->_defaultFont)) >= 0) { + $width = Shared_Drawing::pixelsToPoints($width); + $column = Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; $this->_columnWidths[$sheetIndex][$column] = $width; $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; @@ -819,7 +821,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $css['table.sheet' . $sheetIndex . ' tr'] = array(); if ($rowDimension->getRowHeight() == -1) { - $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); + $pt_height = Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); } else { $pt_height = $rowDimension->getRowHeight(); } @@ -837,7 +839,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array(); if ($rowDimension->getRowHeight() == -1) { - $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); + $pt_height = Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); } else { $pt_height = $rowDimension->getRowHeight(); } @@ -861,10 +863,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Create CSS style * - * @param PHPExcel_Style $pStyle PHPExcel_Style + * @param PHPExcel\Style $pStyle PHPExcel Style * @return array */ - private function _createCSSStyle(PHPExcel_Style $pStyle) { + private function _createCSSStyle(Style $pStyle) { // Construct CSS $css = ''; @@ -881,12 +883,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Alignment) + * Create CSS style (PHPExcel\Style_Alignment) * - * @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment + * @param PHPExcel\Style_Alignment $pStyle PHPExcel Style Alignment * @return array */ - private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) { + private function _createCSSStyleAlignment(Style_Alignment $pStyle) { // Construct CSS $css = array(); @@ -903,12 +905,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Font) + * Create CSS style (PHPExcel\Style_Font) * - * @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font + * @param PHPExcel\Style_Font $pStyle Font Style * @return array */ - private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) { + private function _createCSSStyleFont(Style_Font $pStyle) { // Construct CSS $css = array(); @@ -916,9 +918,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ if ($pStyle->getBold()) { $css['font-weight'] = 'bold'; } - if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { + if ($pStyle->getUnderline() != Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { $css['text-decoration'] = 'underline line-through'; - } else if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) { + } else if ($pStyle->getUnderline() != Style_Font::UNDERLINE_NONE) { $css['text-decoration'] = 'underline'; } else if ($pStyle->getStrikethrough()) { $css['text-decoration'] = 'line-through'; @@ -936,12 +938,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Borders) + * Create CSS style (PHPExcel\Style_Borders) * - * @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders + * @param PHPExcel\Style_Borders $pStyle Cell Borders Style * @return array */ - private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) { + private function _createCSSStyleBorders(Style_Borders $pStyle) { // Construct CSS $css = array(); @@ -956,12 +958,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Border) + * Create CSS style (PHPExcel\Style_Border) * - * @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border + * @param PHPExcel\Style_Border $pStyle Border Style * @return string */ - private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) { + private function _createCSSStyleBorder(Style_Border $pStyle) { // Create CSS // $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); // Create CSS - add !important to non-none border styles for merged cells @@ -973,17 +975,17 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Fill) + * Create CSS style (PHPExcel\Style_Fill) * - * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill + * @param PHPExcel\Style_Fill $pStyle Fill Style * @return array */ - private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) { + private function _createCSSStyleFill(Style_Fill $pStyle) { // Construct HTML $css = array(); // Create CSS - $value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? + $value = $pStyle->getFillType() == Style_Fill::FILL_NONE ? 'white' : '#' . $pStyle->getStartColor()->getRGB(); $css['background-color'] = $value; @@ -1007,9 +1009,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate table header * - * @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing + * @param PHPExcel\Worksheet $pSheet The worksheet for the table we are writing * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ private function _generateTableHeader($pSheet) { $sheetIndex = $pSheet->getParent()->getIndex($pSheet); @@ -1033,7 +1035,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } // Write elements - $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; + $highestColumnIndex = Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; $i = -1; while($i++ < $highestColumnIndex) { if (!$this->_isPdf) { @@ -1054,7 +1056,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate table footer * - * @throws PHPExcel_Writer_Exception */ private function _generateTableFooter() { // Construct HTML @@ -1068,13 +1069,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate row * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param PHPExcel\Worksheet $pSheet Worksheet * @param array $pValues Array containing cells in a row * @param int $pRow Row number (0-based) * @return string - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ - private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0) { + private function _generateRow(Worksheet $pSheet, $pValues = null, $pRow = 0) { if (is_array($pValues)) { // Construct HTML $html = ''; @@ -1112,7 +1113,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Write cells $colNum = 0; foreach ($pValues as $cell) { - $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1); + $coordinate = Cell::stringFromColumnIndex($colNum) . ($pRow + 1); if (!$this->_useInlineCss) { $cssClass = ''; @@ -1129,19 +1130,19 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // initialize $cellData = ' '; - // PHPExcel_Cell - if ($cell instanceof PHPExcel_Cell) { + // PHPExcel Cell + if ($cell instanceof Cell) { $cellData = ''; if (is_null($cell->getParent())) { $cell->attach($pSheet); } // Value - if ($cell->getValue() instanceof PHPExcel_RichText) { + if ($cell->getValue() instanceof RichText) { // Loop through rich text elements $elements = $cell->getValue()->getRichTextElements(); foreach ($elements as $element) { // Rich text start? - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof RichText_Run) { $cellData .= ''; if ($element->getFont()->getSuperScript()) { @@ -1155,7 +1156,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $cellText = $element->getText(); $cellData .= htmlspecialchars($cellText); - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof RichText_Run) { if ($element->getFont()->getSuperScript()) { $cellData .= ''; } else if ($element->getFont()->getSubScript()) { @@ -1167,13 +1168,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } } else { if ($this->_preCalculateFormulas) { - $cellData = PHPExcel_Style_NumberFormat::toFormattedString( + $cellData = Style_NumberFormat::toFormattedString( $cell->getCalculatedValue(), $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(), array($this, 'formatColor') ); } else { - $cellData = PHPExcel_Style_NumberFormat::ToFormattedString( + $cellData = Style_NumberFormat::ToFormattedString( $cell->getValue(), $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(), array($this, 'formatColor') @@ -1205,7 +1206,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // General horizontal alignment: Actual horizontal alignment depends on dataType $sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() ); - if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL + if ($sharedStyle->getAlignment()->getHorizontal() == Style_Alignment::HORIZONTAL_GENERAL && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) { $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align']; @@ -1232,7 +1233,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Also apply style from last cell in merge to fix borders - // relies on !important for non-none border declarations in _createCSSStyleBorder - $endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan); + $endCellCoord = Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan); if (!$this->_useInlineCss) { $cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex(); } @@ -1245,7 +1246,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ if (!$this->_useInlineCss) { $html .= ' class="' . $cssClass . '"'; } else { - //** Necessary redundant code for the sake of PHPExcel_Writer_PDF ** + //** Necessary redundant code for the sake of PHPExcel\Writer_PDF ** // We must explicitly write the width of the element because TCPDF // does not recognize e.g. $width = 0; @@ -1301,7 +1302,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Return return $html; } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new Writer_Exception("Invalid parameters passed."); } } @@ -1335,7 +1336,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Set images root * * @param string $pValue - * @return PHPExcel_Writer_HTML + * @return PHPExcel\Writer_HTML */ public function setImagesRoot($pValue = '.') { $this->_imagesRoot = $pValue; @@ -1355,7 +1356,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Set embed images * * @param boolean $pValue - * @return PHPExcel_Writer_HTML + * @return PHPExcel\Writer_HTML */ public function setEmbedImages($pValue = '.') { $this->_embedImages = $pValue; @@ -1375,7 +1376,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Set use inline CSS? * * @param boolean $pValue - * @return PHPExcel_Writer_HTML + * @return PHPExcel\Writer_HTML */ public function setUseInlineCss($pValue = false) { $this->_useInlineCss = $pValue; @@ -1431,15 +1432,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // loop through all Excel merged cells foreach ($sheet->getMergeCells() as $cells) { - list($cells, ) = PHPExcel_Cell::splitRange($cells); + list($cells, ) = Cell::splitRange($cells); $first = $cells[0]; $last = $cells[1]; - list($fc, $fr) = PHPExcel_Cell::coordinateFromString($first); - $fc = PHPExcel_Cell::columnIndexFromString($fc) - 1; + list($fc, $fr) = Cell::coordinateFromString($first); + $fc = Cell::columnIndexFromString($fc) - 1; - list($lc, $lr) = PHPExcel_Cell::coordinateFromString($last); - $lc = PHPExcel_Cell::columnIndexFromString($lc) - 1; + list($lc, $lr) = Cell::coordinateFromString($last); + $lc = Cell::columnIndexFromString($lc) - 1; // loop through the individual cells in the individual merge $r = $fr - 1; @@ -1469,7 +1470,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Identify which rows should be omitted in HTML. These are the rows where all the cells // participate in a merge and the where base cells are somewhere above. - $countColumns = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()); + $countColumns = Cell::columnIndexFromString($sheet->getHighestColumn()); foreach ($candidateSpannedRow as $rowIndex) { if (isset($this->_isSpannedCell[$sheetIndex][$rowIndex])) { if (count($this->_isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) { @@ -1503,20 +1504,20 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $this->_spansAreCalculated = true; } - private function _setMargins(PHPExcel_Worksheet $pSheet) { + private function _setMargins(Worksheet $pSheet) { $htmlPage = '@page { '; $htmlBody = 'body { '; - $left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; + $left = Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; $htmlPage .= 'left-margin: ' . $left; $htmlBody .= 'left-margin: ' . $left; - $right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; + $right = Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; $htmlPage .= 'right-margin: ' . $right; $htmlBody .= 'right-margin: ' . $right; - $top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; + $top = Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; $htmlPage .= 'top-margin: ' . $top; $htmlBody .= 'top-margin: ' . $top; - $bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; + $bottom = Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; $htmlPage .= 'bottom-margin: ' . $bottom; $htmlBody .= 'bottom-margin: ' . $bottom; diff --git a/Classes/PHPExcel/Writer/IWriter.php b/Classes/PHPExcel/Writer/IWriter.php index 6bb8a39..36f08f6 100644 --- a/Classes/PHPExcel/Writer/IWriter.php +++ b/Classes/PHPExcel/Writer/IWriter.php @@ -19,27 +19,29 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_IWriter + * PHPExcel\Writer_IWriter * * @category PHPExcel - * @package PHPExcel_Writer + * @package PHPExcel\Writer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -interface PHPExcel_Writer_IWriter +interface Writer_IWriter { /** * Save PHPExcel to file * * @param string $pFilename Name of the file to save - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = NULL); diff --git a/Classes/PHPExcel/Writer/PDF.php b/Classes/PHPExcel/Writer/PDF.php index a2524d4..214f135 100644 --- a/Classes/PHPExcel/Writer/PDF.php +++ b/Classes/PHPExcel/Writer/PDF.php @@ -19,46 +19,48 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_PDF + * PHPExcel\Writer_PDF * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_PDF +class Writer_PDF { /** * The wrapper for the requested PDF rendering engine * - * @var PHPExcel_Writer_PDF_Core + * @var PHPExcel\Writer_PDF_Core */ private $_renderer = NULL; /** * Instantiate a new renderer of the configured type within this container class * - * @param PHPExcel $phpExcel PHPExcel object - * @throws PHPExcel_Writer_Exception when PDF library is not configured + * @param PHPExcel\Workbook $phpExcel PHPExcel object + * @throws PHPExcel\Writer_Exception when PDF library is not configured */ - public function __construct(PHPExcel $phpExcel) + public function __construct(Workbook $phpExcel) { - $pdfLibraryName = PHPExcel_Settings::getPdfRendererName(); + $pdfLibraryName = Settings::getPdfRendererName(); if (is_null($pdfLibraryName)) { - throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined."); + throw new Writer_Exception("PDF Rendering library has not been defined."); } - $pdfLibraryPath = PHPExcel_Settings::getPdfRendererPath(); + $pdfLibraryPath = Settings::getPdfRendererPath(); if (is_null($pdfLibraryName)) { - throw new PHPExcel_Writer_Exception("PDF Rendering library path has not been defined."); + throw new Writer_Exception("PDF Rendering library path has not been defined."); } $includePath = str_replace('\\', '/', get_include_path()); $rendererPath = str_replace('\\', '/', $pdfLibraryPath); @@ -66,7 +68,7 @@ class PHPExcel_Writer_PDF set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath); } - $rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName; + $rendererName = __NAMESPACE__ . '\Writer_PDF_' . $pdfLibraryName; $this->_renderer = new $rendererName($phpExcel); } @@ -81,7 +83,7 @@ class PHPExcel_Writer_PDF public function __call($name, $arguments) { if ($this->_renderer === NULL) { - throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined."); + throw new Writer_Exception("PDF Rendering library has not been defined."); } return call_user_func_array(array($this->_renderer, $name), $arguments); diff --git a/Classes/PHPExcel/Writer/PDF/Core.php b/Classes/PHPExcel/Writer/PDF/Core.php index 24d104c..af5b251 100644 --- a/Classes/PHPExcel/Writer/PDF/Core.php +++ b/Classes/PHPExcel/Writer/PDF/Core.php @@ -19,21 +19,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** - * PHPExcel_Writer_PDF_Core + * PHPExcel\Writer_PDF_Core * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML +abstract class Writer_PDF_Core extends Writer_HTML { /** * Temporary storage directory @@ -77,150 +79,150 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * @var array */ protected static $_paperSizes = array( - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER + Worksheet_PageSetup::PAPERSIZE_LETTER => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL + Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID + Worksheet_PageSetup::PAPERSIZE_TABLOID => array(792.00, 1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER + Worksheet_PageSetup::PAPERSIZE_LEDGER => array(1224.00, 792.00), // (17 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL + Worksheet_PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT + Worksheet_PageSetup::PAPERSIZE_STATEMENT => array(396.00, 612.00), // (5.5 in. by 8.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE + Worksheet_PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3 + Worksheet_PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4 + Worksheet_PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL + Worksheet_PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5 + Worksheet_PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4 + Worksheet_PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5 + Worksheet_PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO + Worksheet_PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO + Worksheet_PageSetup::PAPERSIZE_QUARTO => array(609.45, 779.53), // (215 mm by 275 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1 + Worksheet_PageSetup::PAPERSIZE_STANDARD_1 => array(720.00, 1008.00), // (10 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2 + Worksheet_PageSetup::PAPERSIZE_STANDARD_2 => array(792.00, 1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE + Worksheet_PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE => array(279.00, 639.00), // (3.875 in. by 8.875 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE => array(297.00, 684.00), // (4.125 in. by 9.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE => array(324.00, 747.00), // (4.5 in. by 10.375 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE => array(342.00, 792.00), // (4.75 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE => array(360.00, 828.00), // (5 in. by 11.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C + Worksheet_PageSetup::PAPERSIZE_C => array(1224.00, 1584.00), // (17 in. by 22 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_D + Worksheet_PageSetup::PAPERSIZE_D => array(1584.00, 2448.00), // (22 in. by 34 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_E + Worksheet_PageSetup::PAPERSIZE_E => array(2448.00, 3168.00), // (34 in. by 44 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE => array(311.81, 623.62), // (110 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE => array(323.15, 649.13), // (114 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE => array(498.90, 354.33), // (176 mm by 125 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE => array(311.81, 651.97), // (110 mm by 230 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE => array(279.00, 540.00), // (3.875 in. by 7.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE => array(261.00, 468.00), // (3.625 in. by 6.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD + Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => array(1071.00, 792.00), // (14.875 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD + Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => array(612.00, 864.00), // (8.5 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD + Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4 + Worksheet_PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD + Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => array(566.93, 419.53), // (200 mm by 148 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 + Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 => array(648.00, 792.00), // (9 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 + Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 => array(720.00, 792.00), // (10 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 + Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 => array(1080.00, 792.00), // (15 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE + Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE => array(623.62, 623.62), // (220 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => array(667.80, 864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => array(667.80, 1080.00), // (9.275 in. by 15 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => array(841.68, 1296.00), // (11.69 in. by 18 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER => array(668.98, 912.76), // (236 mm by 322 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => array(595.80, 792.00), // (8.275 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => array(667.80, 864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER + Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => array(643.46, 1009.13), // (227 mm by 356 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER + Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => array(864.57, 1380.47), // (305 mm by 487 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER + Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => array(612.00, 913.68), // (8.5 in. by 12.69 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER + Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER => array(595.28, 935.43), // (210 mm by 330 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => array(515.91, 728.50), // (182 mm by 257 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER => array(912.76, 1261.42), // (322 mm by 445 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER => array(493.23, 666.14), // (174 mm by 235 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER + Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => array(569.76, 782.36), // (201 mm by 276 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER + Worksheet_PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER + Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => array(912.76, 1261.42) // (322 mm by 445 mm) ); /** - * Create a new PHPExcel_Writer_PDF + * Create a new PHPExcel\Writer_PDF * - * @param PHPExcel $phpExcel PHPExcel object + * @param PHPExcel\Workbook $phpExcel Workbook object */ - public function __construct(PHPExcel $phpExcel) + public function __construct(Workbook $phpExcel) { parent::__construct($phpExcel); $this->setUseInlineCss(TRUE); - $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->_tempDir = Shared_File::sys_get_temp_dir(); } /** @@ -262,9 +264,9 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * Set Paper Size * * @param string $pValue Paper size - * @return PHPExcel_Writer_PDF + * @return PHPExcel\Writer_PDF */ - public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) + public function setPaperSize($pValue = Worksheet_PageSetup::PAPERSIZE_LETTER) { $this->_paperSize = $pValue; return $this; @@ -284,9 +286,9 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * Set Orientation * * @param string $pValue Page orientation - * @return PHPExcel_Writer_PDF + * @return PHPExcel\Writer_PDF */ - public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) + public function setOrientation($pValue = Worksheet_PageSetup::ORIENTATION_DEFAULT) { $this->_orientation = $pValue; return $this; @@ -306,15 +308,15 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * Set temporary storage directory * * @param string $pValue Temporary storage directory - * @throws PHPExcel_Writer_Exception when directory does not exist - * @return PHPExcel_Writer_PDF + * @throws PHPExcel\Writer_Exception when directory does not exist + * @return PHPExcel\Writer_PDF */ public function setTempDir($pValue = '') { if (is_dir($pValue)) { $this->_tempDir = $pValue; } else { - throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); + throw new Writer_Exception("Directory does not exist: $pValue"); } return $this; } @@ -323,20 +325,20 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * Save PHPExcel to PDF file, pre-save * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ protected function prepareForSave($pFilename = NULL) { // garbage collect $this->_phpExcel->garbageCollect(); - $this->_saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + $this->_saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); // Open file $fileHandle = fopen($pFilename, 'w'); if ($fileHandle === FALSE) { - throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + throw new Writer_Exception("Could not open file $pFilename for writing."); } // Set PDF @@ -351,14 +353,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * Save PHPExcel to PDF file, post-save * * @param resource $fileHandle - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ protected function restoreStateAfterSave($fileHandle) { // Close file fclose($fileHandle); - PHPExcel_Calculation::setArrayReturnType($this->_saveArrayReturnType); + Calculation::setArrayReturnType($this->_saveArrayReturnType); } } diff --git a/Classes/PHPExcel/Writer/PDF/DomPDF.php b/Classes/PHPExcel/Writer/PDF/DomPDF.php index 4563a95..9c797f5 100644 --- a/Classes/PHPExcel/Writer/PDF/DomPDF.php +++ b/Classes/PHPExcel/Writer/PDF/DomPDF.php @@ -19,32 +19,34 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** Require DomPDF library */ -$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/dompdf_config.inc.php'; +$pdfRendererClassFile = Settings::getPdfRendererPath() . '/dompdf_config.inc.php'; if (file_exists($pdfRendererClassFile)) { require_once $pdfRendererClassFile; } else { - throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); + throw new Writer_Exception('Unable to load PDF Rendering library'); } /** - * PHPExcel_Writer_PDF_DomPDF + * PHPExcel\Writer_PDF_DomPDF * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter +class Writer_PDF_DomPDF extends Writer_PDF_Core implements Writer_IWriter { /** - * Create a new PHPExcel_Writer_PDF + * Create a new PHPExcel\Writer_PDF * * @param PHPExcel $phpExcel PHPExcel object */ @@ -57,7 +59,7 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP * Save PHPExcel to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = NULL) { @@ -69,14 +71,14 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); @@ -85,8 +87,8 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) - ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + $orientation = ($this->getOrientation() == Worksheet_PageSetup::ORIENTATION_DEFAULT) + ? Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); } // Override Paper Size diff --git a/Classes/PHPExcel/Writer/PDF/mPDF.php b/Classes/PHPExcel/Writer/PDF/mPDF.php index 1e20e6f..61eeda1 100644 --- a/Classes/PHPExcel/Writer/PDF/mPDF.php +++ b/Classes/PHPExcel/Writer/PDF/mPDF.php @@ -19,32 +19,34 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** Require mPDF library */ -$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/mpdf.php'; +$pdfRendererClassFile = Settings::getPdfRendererPath() . '/mpdf.php'; if (file_exists($pdfRendererClassFile)) { require_once $pdfRendererClassFile; } else { - throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); + throw new Writer_Exception('Unable to load PDF Rendering library'); } /** - * PHPExcel_Writer_PDF_mPDF + * PHPExcel\Writer_PDF_mPDF * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter +class Writer_PDF_mPDF extends Writer_PDF_Core implements Writer_IWriter { /** - * Create a new PHPExcel_Writer_PDF + * Create a new PHPExcel\Writer_PDF * * @param PHPExcel $phpExcel PHPExcel object */ @@ -57,7 +59,7 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx * Save PHPExcel to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = NULL) { @@ -69,14 +71,14 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); @@ -86,8 +88,8 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) - ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + $orientation = ($this->getOrientation() == Worksheet_PageSetup::ORIENTATION_DEFAULT) + ? Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); } $orientation = strtoupper($orientation); diff --git a/Classes/PHPExcel/Writer/PDF/tcPDF.php b/Classes/PHPExcel/Writer/PDF/tcPDF.php index 2895512..15746e6 100644 --- a/Classes/PHPExcel/Writer/PDF/tcPDF.php +++ b/Classes/PHPExcel/Writer/PDF/tcPDF.php @@ -19,33 +19,35 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ +namespace PHPExcel; + /** Require tcPDF library */ -$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/tcpdf.php'; +$pdfRendererClassFile = Settings::getPdfRendererPath() . '/tcpdf.php'; if (file_exists($pdfRendererClassFile)) { - $k_path_url = PHPExcel_Settings::getPdfRendererPath(); + $k_path_url = Settings::getPdfRendererPath(); require_once $pdfRendererClassFile; } else { - throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); + throw new Writer_Exception('Unable to load PDF Rendering library'); } /** - * PHPExcel_Writer_PDF_tcPDF + * PHPExcel\Writer_PDF_tcPDF * * @category PHPExcel - * @package PHPExcel_Writer_PDF + * @package PHPExcel\Writer_PDF * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter +class Writer_PDF_tcPDF extends Writer_PDF_Core implements Writer_IWriter { /** - * Create a new PHPExcel_Writer_PDF + * Create a new PHPExcel\Writer_PDF * * @param PHPExcel $phpExcel PHPExcel object */ @@ -58,7 +60,7 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE * Save PHPExcel to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws PHPExcel\Writer_Exception */ public function save($pFilename = NULL) { @@ -70,14 +72,14 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); @@ -86,7 +88,7 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + $orientation = ($this->getOrientation() == Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; }