Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-15 23:42:53 +01:00
commit 2af5e55f2c
46 changed files with 2909 additions and 2706 deletions

View File

@ -83,7 +83,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var PHPExcel_Calculation * @var PHPExcel_Calculation
*/ */
private static $_instance; private static $instance;
/** /**
@ -92,7 +92,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var PHPExcel * @var PHPExcel
*/ */
private $_workbook; private $workbook;
/** /**
* List of instances of the calculation engine that we've instantiated for individual workbooks * List of instances of the calculation engine that we've instantiated for individual workbooks
@ -100,7 +100,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var PHPExcel_Calculation[] * @var PHPExcel_Calculation[]
*/ */
private static $_workbookSets; private static $workbookSets;
/** /**
* Calculation cache * Calculation cache
@ -108,7 +108,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var array * @var array
*/ */
private $_calculationCache = array (); private $calculationCache = array ();
/** /**
@ -117,7 +117,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var boolean * @var boolean
*/ */
private $_calculationCacheEnabled = true; private $calculationCacheEnabled = true;
/** /**
@ -127,7 +127,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var array * @var array
*/ */
private static $_operators = array( private static $operators = array(
'+' => true, '-' => true, '*' => true, '/' => true, '+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '%' => false, '~' => false, '^' => true, '&' => true, '%' => false, '~' => false,
'>' => true, '<' => true, '=' => true, '>=' => true, '>' => true, '<' => true, '=' => true, '>=' => true,
@ -140,7 +140,7 @@ class PHPExcel_Calculation
* @access private * @access private
* @var array * @var array
*/ */
private static $_binaryOperators = array( private static $binaryOperators = array(
'+' => true, '-' => true, '*' => true, '/' => true, '+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '>' => true, '<' => true, '^' => true, '&' => true, '>' => true, '<' => true,
'=' => true, '>=' => true, '<=' => true, '<>' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true,
@ -183,9 +183,9 @@ class PHPExcel_Calculation
* @var array of string * @var array of string
* *
*/ */
private $_cyclicReferenceStack; private $cyclicReferenceStack;
private $_cellStack = array(); private $cellStack = array();
/** /**
* Current iteration counter for cyclic formulae * Current iteration counter for cyclic formulae
@ -195,9 +195,9 @@ class PHPExcel_Calculation
* @var integer * @var integer
* *
*/ */
private $_cyclicFormulaCount = 1; private $cyclicFormulaCounter = 1;
private $_cyclicFormulaCell = ''; private $cyclicFormulaCell = '';
/** /**
* Number of iterations for cyclic formulae * Number of iterations for cyclic formulae
@ -213,7 +213,7 @@ class PHPExcel_Calculation
* @var integer * @var integer
* *
*/ */
private $_savedPrecision = 14; private $savedPrecision = 14;
/** /**
@ -222,7 +222,7 @@ class PHPExcel_Calculation
* @var string * @var string
* *
*/ */
private static $_localeLanguage = 'en_us'; // US English (default locale) private static $localeLanguage = 'en_us'; // US English (default locale)
/** /**
* List of available locale settings * List of available locale settings
@ -231,7 +231,7 @@ class PHPExcel_Calculation
* @var string[] * @var string[]
* *
*/ */
private static $_validLocaleLanguages = array( private static $validLocaleLanguages = array(
'en' // English (default language) 'en' // English (default language)
); );
@ -241,8 +241,8 @@ class PHPExcel_Calculation
* @var string * @var string
* *
*/ */
private static $_localeArgumentSeparator = ','; private static $localeArgumentSeparator = ',';
private static $_localeFunctions = array(); private static $localeFunctions = array();
/** /**
* Locale-specific translations for Excel constants (True, False and Null) * Locale-specific translations for Excel constants (True, False and Null)
@ -250,7 +250,7 @@ class PHPExcel_Calculation
* @var string[] * @var string[]
* *
*/ */
public static $_localeBoolean = array( public static $localeBoolean = array(
'TRUE' => 'TRUE', 'TRUE' => 'TRUE',
'FALSE' => 'FALSE', 'FALSE' => 'FALSE',
'NULL' => 'NULL' 'NULL' => 'NULL'
@ -263,14 +263,14 @@ class PHPExcel_Calculation
* @var string[] * @var string[]
* *
*/ */
private static $_ExcelConstants = array( private static $excelConstants = array(
'TRUE' => true, 'TRUE' => true,
'FALSE' => false, 'FALSE' => false,
'NULL' => null 'NULL' => null
); );
// PHPExcel functions // PHPExcel functions
private static $_PHPExcelFunctions = array( // PHPExcel functions private static $PHPExcelFunctions = array( // PHPExcel functions
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, 'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs', 'functionCall' => 'abs',
'argumentCount' => '1' 'argumentCount' => '1'
@ -1705,7 +1705,7 @@ class PHPExcel_Calculation
// Internal functions used for special control purposes // Internal functions used for special control purposes
private static $_controlFunctions = array( private static $controlFunctions = array(
'MKMATRIX' => array( 'MKMATRIX' => array(
'argumentCount' => '*', 'argumentCount' => '*',
'functionCall' => 'self::_mkMatrix' 'functionCall' => 'self::_mkMatrix'
@ -1716,26 +1716,26 @@ class PHPExcel_Calculation
private function __construct(PHPExcel $workbook = null) private function __construct(PHPExcel $workbook = null)
{ {
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16; $setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
$this->_savedPrecision = ini_get('precision'); $this->savedPrecision = ini_get('precision');
if ($this->_savedPrecision < $setPrecision) { if ($this->savedPrecision < $setPrecision) {
ini_set('precision', $setPrecision); ini_set('precision', $setPrecision);
} }
$this->delta = 1 * pow(10, -$setPrecision); $this->delta = 1 * pow(10, -$setPrecision);
if ($workbook !== null) { if ($workbook !== null) {
self::$_workbookSets[$workbook->getID()] = $this; self::$workbookSets[$workbook->getID()] = $this;
} }
$this->_workbook = $workbook; $this->workbook = $workbook;
$this->_cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack(); $this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->_cyclicReferenceStack); $this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
} }
public function __destruct() public function __destruct()
{ {
if ($this->_savedPrecision != ini_get('precision')) { if ($this->savedPrecision != ini_get('precision')) {
ini_set('precision', $this->_savedPrecision); ini_set('precision', $this->savedPrecision);
} }
} }
@ -1745,7 +1745,7 @@ class PHPExcel_Calculation
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) { foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
$filename = substr($filename, strlen($localeFileDirectory)+1); $filename = substr($filename, strlen($localeFileDirectory)+1);
if ($filename != 'en') { if ($filename != 'en') {
self::$_validLocaleLanguages[] = $filename; self::$validLocaleLanguages[] = $filename;
} }
} }
} }
@ -1761,17 +1761,17 @@ class PHPExcel_Calculation
public static function getInstance(PHPExcel $workbook = null) public static function getInstance(PHPExcel $workbook = null)
{ {
if ($workbook !== null) { if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) { if (isset(self::$workbookSets[$workbook->getID()])) {
return self::$_workbookSets[$workbook->getID()]; return self::$workbookSets[$workbook->getID()];
} }
return new PHPExcel_Calculation($workbook); return new PHPExcel_Calculation($workbook);
} }
if (!isset(self::$_instance) || (self::$_instance === null)) { if (!isset(self::$instance) || (self::$instance === null)) {
self::$_instance = new PHPExcel_Calculation(); self::$instance = new PHPExcel_Calculation();
} }
return self::$_instance; return self::$instance;
} }
/** /**
@ -1783,8 +1783,8 @@ class PHPExcel_Calculation
public static function unsetInstance(PHPExcel $workbook = null) public static function unsetInstance(PHPExcel $workbook = null)
{ {
if ($workbook !== null) { if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) { if (isset(self::$workbookSets[$workbook->getID()])) {
unset(self::$_workbookSets[$workbook->getID()]); unset(self::$workbookSets[$workbook->getID()]);
} }
} }
} }
@ -1833,7 +1833,7 @@ class PHPExcel_Calculation
*/ */
public static function getTRUE() public static function getTRUE()
{ {
return self::$_localeBoolean['TRUE']; return self::$localeBoolean['TRUE'];
} }
/** /**
@ -1844,7 +1844,7 @@ class PHPExcel_Calculation
*/ */
public static function getFALSE() public static function getFALSE()
{ {
return self::$_localeBoolean['FALSE']; return self::$localeBoolean['FALSE'];
} }
/** /**
@ -1886,7 +1886,7 @@ class PHPExcel_Calculation
*/ */
public function getCalculationCacheEnabled() public function getCalculationCacheEnabled()
{ {
return $this->_calculationCacheEnabled; return $this->calculationCacheEnabled;
} }
/** /**
@ -1897,7 +1897,7 @@ class PHPExcel_Calculation
*/ */
public function setCalculationCacheEnabled($pValue = true) public function setCalculationCacheEnabled($pValue = true)
{ {
$this->_calculationCacheEnabled = $pValue; $this->calculationCacheEnabled = $pValue;
$this->clearCalculationCache(); $this->clearCalculationCache();
} }
@ -1925,7 +1925,7 @@ class PHPExcel_Calculation
*/ */
public function clearCalculationCache() public function clearCalculationCache()
{ {
$this->_calculationCache = array(); $this->calculationCache = array();
} }
/** /**
@ -1935,8 +1935,8 @@ class PHPExcel_Calculation
*/ */
public function clearCalculationCacheForWorksheet($worksheetName) public function clearCalculationCacheForWorksheet($worksheetName)
{ {
if (isset($this->_calculationCache[$worksheetName])) { if (isset($this->calculationCache[$worksheetName])) {
unset($this->_calculationCache[$worksheetName]); unset($this->calculationCache[$worksheetName]);
} }
} }
@ -1948,9 +1948,9 @@ class PHPExcel_Calculation
*/ */
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName) public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
{ {
if (isset($this->_calculationCache[$fromWorksheetName])) { if (isset($this->calculationCache[$fromWorksheetName])) {
$this->_calculationCache[$toWorksheetName] = &$this->_calculationCache[$fromWorksheetName]; $this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
unset($this->_calculationCache[$fromWorksheetName]); unset($this->calculationCache[$fromWorksheetName]);
} }
} }
@ -1962,7 +1962,7 @@ class PHPExcel_Calculation
*/ */
public function getLocale() public function getLocale()
{ {
return self::$_localeLanguage; return self::$localeLanguage;
} }
@ -1980,15 +1980,15 @@ class PHPExcel_Calculation
list($language) = explode('_', $locale); list($language) = explode('_', $locale);
} }
if (count(self::$_validLocaleLanguages) == 1) { if (count(self::$validLocaleLanguages) == 1) {
self::_loadLocales(); self::_loadLocales();
} }
// Test whether we have any language data for this language (any locale) // Test whether we have any language data for this language (any locale)
if (in_array($language, self::$_validLocaleLanguages)) { if (in_array($language, self::$validLocaleLanguages)) {
// initialise language/locale settings // initialise language/locale settings
self::$_localeFunctions = array(); self::$localeFunctions = array();
self::$_localeArgumentSeparator = ','; self::$localeArgumentSeparator = ',';
self::$_localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL'); self::$localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
// Default is English, if user isn't requesting english, then read the necessary data from the locale files // Default is English, if user isn't requesting english, then read the necessary data from the locale files
if ($locale != 'en_us') { if ($locale != 'en_us') {
// Search for a file with a list of function names for locale // Search for a file with a list of function names for locale
@ -2008,17 +2008,17 @@ class PHPExcel_Calculation
list($fName, $lfName) = explode('=', $localeFunction); list($fName, $lfName) = explode('=', $localeFunction);
$fName = trim($fName); $fName = trim($fName);
$lfName = trim($lfName); $lfName = trim($lfName);
if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) { if ((isset(self::$PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$_localeFunctions[$fName] = $lfName; self::$localeFunctions[$fName] = $lfName;
} }
} }
} }
// Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions // Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
if (isset(self::$_localeFunctions['TRUE'])) { if (isset(self::$localeFunctions['TRUE'])) {
self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE']; self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
} }
if (isset(self::$_localeFunctions['FALSE'])) { if (isset(self::$localeFunctions['FALSE'])) {
self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE']; self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
} }
$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config'; $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
@ -2034,7 +2034,7 @@ class PHPExcel_Calculation
$settingName = strtoupper(trim($settingName)); $settingName = strtoupper(trim($settingName));
switch ($settingName) { switch ($settingName) {
case 'ARGUMENTSEPARATOR': case 'ARGUMENTSEPARATOR':
self::$_localeArgumentSeparator = trim($settingValue); self::$localeArgumentSeparator = trim($settingValue);
break; break;
} }
} }
@ -2044,7 +2044,7 @@ class PHPExcel_Calculation
self::$functionReplaceFromExcel = self::$functionReplaceToExcel = self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null; self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
self::$_localeLanguage = $locale; self::$localeLanguage = $locale;
return true; return true;
} }
return false; return false;
@ -2076,7 +2076,7 @@ class PHPExcel_Calculation
private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator) private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
{ {
// Convert any Excel function names to the required language // Convert any Excel function names to the required language
if (self::$_localeLanguage !== 'en_us') { if (self::$localeLanguage !== 'en_us') {
$inBraces = false; $inBraces = false;
// If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
if (strpos($formula, '"') !== false) { if (strpos($formula, '"') !== false) {
@ -2111,10 +2111,10 @@ class PHPExcel_Calculation
{ {
if (self::$functionReplaceFromExcel === null) { if (self::$functionReplaceFromExcel === null) {
self::$functionReplaceFromExcel = array(); self::$functionReplaceFromExcel = array();
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) { foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
} }
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) { foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
} }
@ -2122,15 +2122,15 @@ class PHPExcel_Calculation
if (self::$functionReplaceToLocale === null) { if (self::$functionReplaceToLocale === null) {
self::$functionReplaceToLocale = array(); self::$functionReplaceToLocale = array();
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) { foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
} }
foreach (array_values(self::$_localeBoolean) as $localeBoolean) { foreach (array_values(self::$localeBoolean) as $localeBoolean) {
self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2'; self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
} }
} }
return self::_translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$_localeArgumentSeparator); return self::_translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
} }
@ -2141,35 +2141,35 @@ class PHPExcel_Calculation
{ {
if (self::$functionReplaceFromLocale === null) { if (self::$functionReplaceFromLocale === null) {
self::$functionReplaceFromLocale = array(); self::$functionReplaceFromLocale = array();
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) { foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
} }
foreach (array_values(self::$_localeBoolean) as $excelBoolean) { foreach (array_values(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
} }
} }
if (self::$functionReplaceToExcel === null) { if (self::$functionReplaceToExcel === null) {
self::$functionReplaceToExcel = array(); self::$functionReplaceToExcel = array();
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) { foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
} }
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) { foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2'; self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
} }
} }
return self::_translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$_localeArgumentSeparator, ','); return self::_translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$localeArgumentSeparator, ',');
} }
public static function _localeFunc($function) public static function localeFunc($function)
{ {
if (self::$_localeLanguage !== 'en_us') { if (self::$localeLanguage !== 'en_us') {
$functionName = trim($function, '('); $functionName = trim($function, '(');
if (isset(self::$_localeFunctions[$functionName])) { if (isset(self::$localeFunctions[$functionName])) {
$brace = ($functionName != $function); $brace = ($functionName != $function);
$function = self::$_localeFunctions[$functionName]; $function = self::$localeFunctions[$functionName];
if ($brace) { if ($brace) {
$function .= '('; $function .= '(';
} }
@ -2267,24 +2267,24 @@ class PHPExcel_Calculation
// Initialise the logging settings if requested // Initialise the logging settings if requested
$this->formulaError = null; $this->formulaError = null;
$this->_debugLog->clearLog(); $this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear(); $this->cyclicReferenceStack->clear();
$this->_cyclicFormulaCount = 1; $this->cyclicFormulaCounter = 1;
self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY; self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY;
} }
// Execute the calculation for the cell formula // Execute the calculation for the cell formula
$this->_cellStack[] = array( $this->cellStack[] = array(
'sheet' => $pCell->getWorksheet()->getTitle(), 'sheet' => $pCell->getWorksheet()->getTitle(),
'cell' => $pCell->getCoordinate(), 'cell' => $pCell->getCoordinate(),
); );
try { try {
$result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); $result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
$cellAddress = array_pop($this->_cellStack); $cellAddress = array_pop($this->cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$cellAddress = array_pop($this->_cellStack); $cellAddress = array_pop($this->cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
throw new PHPExcel_Calculation_Exception($e->getMessage()); throw new PHPExcel_Calculation_Exception($e->getMessage());
} }
@ -2363,12 +2363,12 @@ class PHPExcel_Calculation
// Initialise the logging settings // Initialise the logging settings
$this->formulaError = null; $this->formulaError = null;
$this->_debugLog->clearLog(); $this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear(); $this->cyclicReferenceStack->clear();
// Disable calculation cacheing because it only applies to cell calculations, not straight formulae // Disable calculation cacheing because it only applies to cell calculations, not straight formulae
// But don't actually flush any cache // But don't actually flush any cache
$resetCache = $this->getCalculationCacheEnabled(); $resetCache = $this->getCalculationCacheEnabled();
$this->_calculationCacheEnabled = false; $this->calculationCacheEnabled = false;
// Execute the calculation // Execute the calculation
try { try {
$result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); $result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
@ -2377,7 +2377,7 @@ class PHPExcel_Calculation
} }
// Reset calculation cacheing to its previous state // Reset calculation cacheing to its previous state
$this->_calculationCacheEnabled = $resetCache; $this->calculationCacheEnabled = $resetCache;
return $result; return $result;
} }
@ -2388,10 +2388,10 @@ class PHPExcel_Calculation
// Is calculation cacheing enabled? // Is calculation cacheing enabled?
// Is the value present in calculation cache? // Is the value present in calculation cache?
$this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference); $this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
if (($this->_calculationCacheEnabled) && (isset($this->_calculationCache[$cellReference]))) { if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
$this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache'); $this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
// Return the cached result // Return the cached result
$cellValue = $this->_calculationCache[$cellReference]; $cellValue = $this->calculationCache[$cellReference];
return true; return true;
} }
return false; return false;
@ -2399,8 +2399,8 @@ class PHPExcel_Calculation
public function saveValueToCache($cellReference, $cellValue) public function saveValueToCache($cellReference, $cellValue)
{ {
if ($this->_calculationCacheEnabled) { if ($this->calculationCacheEnabled) {
$this->_calculationCache[$cellReference] = $cellValue; $this->calculationCache[$cellReference] = $cellValue;
} }
} }
@ -2436,28 +2436,28 @@ class PHPExcel_Calculation
return $cellValue; return $cellValue;
} }
if (($wsTitle{0} !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsCellReference))) { if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
if ($this->cyclicFormulaCount <= 0) { if ($this->cyclicFormulaCount <= 0) {
$this->_cyclicFormulaCell = ''; $this->cyclicFormulaCell = '';
return $this->_raiseFormulaError('Cyclic Reference in Formula'); return $this->_raiseFormulaError('Cyclic Reference in Formula');
} elseif ($this->_cyclicFormulaCell === $wsCellReference) { } elseif ($this->cyclicFormulaCell === $wsCellReference) {
++$this->_cyclicFormulaCount; ++$this->cyclicFormulaCounter;
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) { if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
$this->_cyclicFormulaCell = ''; $this->cyclicFormulaCell = '';
return $cellValue; return $cellValue;
} }
} elseif ($this->_cyclicFormulaCell == '') { } elseif ($this->cyclicFormulaCell == '') {
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) { if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
return $cellValue; return $cellValue;
} }
$this->_cyclicFormulaCell = $wsCellReference; $this->cyclicFormulaCell = $wsCellReference;
} }
} }
// Parse the formula onto the token stack and calculate the value // Parse the formula onto the token stack and calculate the value
$this->_cyclicReferenceStack->push($wsCellReference); $this->cyclicReferenceStack->push($wsCellReference);
$cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell); $cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
$this->_cyclicReferenceStack->pop(); $this->cyclicReferenceStack->pop();
// Save to calculation cache // Save to calculation cache
if ($cellID !== null) { if ($cellID !== null) {
@ -2656,7 +2656,7 @@ class PHPExcel_Calculation
} elseif (is_string($value) && (trim($value, '"') == $value)) { } elseif (is_string($value) && (trim($value, '"') == $value)) {
return '"'.$value.'"'; return '"'.$value.'"';
} elseif (is_bool($value)) { } elseif (is_bool($value)) {
return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE']; return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
} }
} }
return PHPExcel_Calculation_Functions::flattenSingleValue($value); return PHPExcel_Calculation_Functions::flattenSingleValue($value);
@ -2848,11 +2848,11 @@ class PHPExcel_Calculation
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
} elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
//echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL; //echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL;
while ($stack->count() > 0 && while ($stack->count() > 0 &&
($o2 = $stack->last()) && ($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) && isset(self::$operators[$o2['value']]) &&
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) { @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
$output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output
} }
@ -2885,14 +2885,14 @@ class PHPExcel_Calculation
//} //}
$output[] = $d; // Dump the argument count on the output $output[] = $d; // Dump the argument count on the output
$output[] = $stack->pop(); // Pop the function and push onto the output $output[] = $stack->pop(); // Pop the function and push onto the output
if (isset(self::$_controlFunctions[$functionName])) { if (isset(self::$controlFunctions[$functionName])) {
//echo 'Built-in function '.$functionName, PHP_EOL; //echo 'Built-in function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_controlFunctions[$functionName]['argumentCount']; $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$_controlFunctions[$functionName]['functionCall']; $functionCall = self::$controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$_PHPExcelFunctions[$functionName])) { } elseif (isset(self::$PHPExcelFunctions[$functionName])) {
//echo 'PHPExcel function '.$functionName, PHP_EOL; //echo 'PHPExcel function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_PHPExcelFunctions[$functionName]['argumentCount']; $expectedArgumentCount = self::$PHPExcelFunctions[$functionName]['argumentCount'];
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall']; $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
} else { // did we somehow push a non-function on the stack? this should never happen } else { // did we somehow push a non-function on the stack? this should never happen
return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack"); return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack");
} }
@ -2955,7 +2955,7 @@ class PHPExcel_Calculation
// If we've a comma when we're expecting an operand, then what we actually have is a null operand; // If we've a comma when we're expecting an operand, then what we actually have is a null operand;
// so push a null onto the stack // so push a null onto the stack
if (($expectingOperand) || (!$expectingOperator)) { if (($expectingOperand) || (!$expectingOperator)) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null); $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
} }
// make sure there was a function // make sure there was a function
$d = $stack->last(2); $d = $stack->last(2);
@ -2984,7 +2984,7 @@ class PHPExcel_Calculation
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
$val = preg_replace('/\s/u', '', $val); $val = preg_replace('/\s/u', '', $val);
// echo 'Element '.$val.' is a Function<br />'; // echo 'Element '.$val.' is a Function<br />';
if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function
$stack->push('Function', strtoupper($val)); $stack->push('Function', strtoupper($val));
$ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch); $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
if ($ax) { if ($ax) {
@ -3071,13 +3071,13 @@ class PHPExcel_Calculation
// echo 'Casting '.$val.' to integer<br />'; // echo 'Casting '.$val.' to integer<br />';
$val = (integer) $val; $val = (integer) $val;
} }
} elseif (isset(self::$_ExcelConstants[trim(strtoupper($val))])) { } elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
$excelConstant = trim(strtoupper($val)); $excelConstant = trim(strtoupper($val));
// echo 'Element '.$excelConstant.' is an Excel Constant<br />'; // echo 'Element '.$excelConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$excelConstant]; $val = self::$excelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== false) { } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
// echo 'Element '.$localeConstant.' is an Excel Constant<br />'; // echo 'Element '.$localeConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$localeConstant]; $val = self::$excelConstants[$localeConstant];
} }
$details = array('type' => 'Value', 'value' => $val, 'reference' => null); $details = array('type' => 'Value', 'value' => $val, 'reference' => null);
if ($localeConstant) { if ($localeConstant) {
@ -3091,13 +3091,13 @@ class PHPExcel_Calculation
++$index; ++$index;
} elseif ($opCharacter == ')') { // miscellaneous error checking } elseif ($opCharacter == ')') { // miscellaneous error checking
if ($expectingOperand) { if ($expectingOperand) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null); $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
$expectingOperand = false; $expectingOperand = false;
$expectingOperator = true; $expectingOperator = true;
} else { } else {
return $this->_raiseFormulaError("Formula Error: Unexpected ')'"); return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
} }
} elseif (isset(self::$_operators[$opCharacter]) && !$expectingOperator) { } elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'"); return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
} else { // I don't even want to know what you did to get here } else { // I don't even want to know what you did to get here
return $this->_raiseFormulaError("Formula Error: An unexpected error occured"); return $this->_raiseFormulaError("Formula Error: An unexpected error occured");
@ -3106,7 +3106,7 @@ class PHPExcel_Calculation
if ($index == strlen($formula)) { if ($index == strlen($formula)) {
// Did we end with an operator?. // Did we end with an operator?.
// Only valid for the % unary operator // Only valid for the % unary operator
if ((isset(self::$_operators[$opCharacter])) && ($opCharacter != '%')) { if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands"); return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
} else { } else {
break; break;
@ -3128,7 +3128,7 @@ class PHPExcel_Calculation
// echo 'Element is an Intersect Operator<br />'; // echo 'Element is an Intersect Operator<br />';
while ($stack->count() > 0 && while ($stack->count() > 0 &&
($o2 = $stack->last()) && ($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) && isset(self::$operators[$o2['value']]) &&
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) { @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
$output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output
} }
@ -3183,7 +3183,7 @@ class PHPExcel_Calculation
$token = $tokenData['value']; $token = $tokenData['value'];
// echo '<b>Token is '.$token.'</b><br />'; // echo '<b>Token is '.$token.'</b><br />';
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$_binaryOperators[$token])) { if (isset(self::$binaryOperators[$token])) {
// echo 'Token is a binary operator<br />'; // echo 'Token is a binary operator<br />';
// We must have two operands, error if we don't // We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) { if (($operand2Data = $stack->pop()) === null) {
@ -3256,7 +3256,7 @@ class PHPExcel_Calculation
} }
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
if ($pCellParent !== null) { if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), false); $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
} else { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
} }
@ -3285,10 +3285,10 @@ class PHPExcel_Calculation
// (converting the other operand to a matrix if need be); then perform the required // (converting the other operand to a matrix if need be); then perform the required
// matrix operation // matrix operation
if (is_bool($operand1)) { if (is_bool($operand1)) {
$operand1 = ($operand1) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE']; $operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
} }
if (is_bool($operand2)) { if (is_bool($operand2)) {
$operand2 = ($operand2) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE']; $operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
} }
if ((is_array($operand1)) || (is_array($operand2))) { if ((is_array($operand1)) || (is_array($operand2))) {
// Ensure that both operands are arrays/matrices // Ensure that both operands are arrays/matrices
@ -3377,7 +3377,7 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />'; // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]); $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) { if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false); $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
} else { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
} }
@ -3410,9 +3410,9 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />'; // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]); $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) { if ($pCellParent !== null) {
$cellSheet = $this->_workbook->getSheetByName($matches[2]); $cellSheet = $this->workbook->getSheetByName($matches[2]);
if ($cellSheet && $cellSheet->cellExists($cellRef)) { if ($cellSheet && $cellSheet->cellExists($cellRef)) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false); $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
$pCell->attach($pCellParent); $pCell->attach($pCellParent);
} else { } else {
$cellValue = null; $cellValue = null;
@ -3444,17 +3444,17 @@ class PHPExcel_Calculation
$argCount = $stack->pop(); $argCount = $stack->pop();
$argCount = $argCount['value']; $argCount = $argCount['value'];
if ($functionName != 'MKMATRIX') { if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluating Function ', self::_localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's')); $this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
} }
if ((isset(self::$_PHPExcelFunctions[$functionName])) || (isset(self::$_controlFunctions[$functionName]))) { // function if ((isset(self::$PHPExcelFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function
if (isset(self::$_PHPExcelFunctions[$functionName])) { if (isset(self::$PHPExcelFunctions[$functionName])) {
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall']; $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_PHPExcelFunctions[$functionName]['passByReference']); $passByReference = isset(self::$PHPExcelFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_PHPExcelFunctions[$functionName]['passCellReference']); $passCellReference = isset(self::$PHPExcelFunctions[$functionName]['passCellReference']);
} elseif (isset(self::$_controlFunctions[$functionName])) { } elseif (isset(self::$controlFunctions[$functionName])) {
$functionCall = self::$_controlFunctions[$functionName]['functionCall']; $functionCall = self::$controlFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_controlFunctions[$functionName]['passByReference']); $passByReference = isset(self::$controlFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_controlFunctions[$functionName]['passCellReference']); $passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
} }
// get the arguments for this function // get the arguments for this function
// echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />'; // echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
@ -3463,8 +3463,8 @@ class PHPExcel_Calculation
$arg = $stack->pop(); $arg = $stack->pop();
$a = $argCount - $i - 1; $a = $argCount - $i - 1;
if (($passByReference) && if (($passByReference) &&
(isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) && (isset(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) { (self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) {
if ($arg['reference'] === null) { if ($arg['reference'] === null) {
$args[] = $cellID; $args[] = $cellID;
if ($functionName != 'MKMATRIX') { if ($functionName != 'MKMATRIX') {
@ -3495,7 +3495,7 @@ class PHPExcel_Calculation
if ($functionName != 'MKMATRIX') { if ($functionName != 'MKMATRIX') {
if ($this->_debugLog->getWriteDebugLog()) { if ($this->_debugLog->getWriteDebugLog()) {
krsort($argArrayVals); 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.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
} }
} }
// Process each argument in turn, building the return value as an array // Process each argument in turn, building the return value as an array
@ -3507,16 +3507,16 @@ class PHPExcel_Calculation
// foreach($operand1 as $args) { // foreach($operand1 as $args) {
// if (is_array($args)) { // if (is_array($args)) {
// foreach($args as $arg) { // foreach($args as $arg) {
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($arg), ' )'); // $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
// $r = call_user_func_array($functionCall, $arg); // $r = call_user_func_array($functionCall, $arg);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r)); // $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $result[$row][] = $r; // $result[$row][] = $r;
// } // }
// ++$row; // ++$row;
// } else { // } else {
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($args), ' )'); // $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($args), ' )');
// $r = call_user_func_array($functionCall, $args); // $r = call_user_func_array($functionCall, $args);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r)); // $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $result[] = $r; // $result[] = $r;
// } // }
// } // }
@ -3535,18 +3535,18 @@ class PHPExcel_Calculation
$result = call_user_func_array($functionCall, $args); $result = call_user_func_array($functionCall, $args);
} }
if ($functionName != 'MKMATRIX') { if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result)); $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result));
} }
$stack->push('Value', self::_wrapResult($result)); $stack->push('Value', self::_wrapResult($result));
} }
} else { } else {
// if the token is a number, boolean, string or an Excel error, push it onto the stack // if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$_ExcelConstants[strtoupper($token)])) { if (isset(self::$excelConstants[strtoupper($token)])) {
$excelConstant = strtoupper($token); $excelConstant = strtoupper($token);
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />'; // echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
$stack->push('Constant Value', self::$_ExcelConstants[$excelConstant]); $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant])); $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$excelConstants[$excelConstant]));
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
// echo 'Token is a number, boolean, string, null or an Excel error<br />'; // echo 'Token is a number, boolean, string, null or an Excel error<br />';
$stack->push('Value', $token); $stack->push('Value', $token);
@ -3828,7 +3828,7 @@ class PHPExcel_Calculation
protected function _raiseFormulaError($errorMessage) protected function _raiseFormulaError($errorMessage)
{ {
$this->formulaError = $errorMessage; $this->formulaError = $errorMessage;
$this->_cyclicReferenceStack->clear(); $this->cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) { if (!$this->suppressFormulaErrors) {
throw new PHPExcel_Calculation_Exception($errorMessage); throw new PHPExcel_Calculation_Exception($errorMessage);
} }
@ -3860,7 +3860,7 @@ class PHPExcel_Calculation
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL; // echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL; // echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName); $pSheet = $this->workbook->getSheetByName($pSheetName);
} }
// Extract range // Extract range
@ -3918,7 +3918,7 @@ class PHPExcel_Calculation
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL; // echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL; // echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName); $pSheet = $this->workbook->getSheetByName($pSheetName);
} }
// Named range? // Named range?
@ -3990,8 +3990,8 @@ class PHPExcel_Calculation
public function isImplemented($pFunction = '') public function isImplemented($pFunction = '')
{ {
$pFunction = strtoupper($pFunction); $pFunction = strtoupper($pFunction);
if (isset(self::$_PHPExcelFunctions[$pFunction])) { if (isset(self::$PHPExcelFunctions[$pFunction])) {
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY'); return (self::$PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
} else { } else {
return false; return false;
} }
@ -4007,7 +4007,7 @@ class PHPExcel_Calculation
{ {
$returnValue = array(); $returnValue = array();
foreach (self::$_PHPExcelFunctions as $functionName => $function) { foreach (self::$PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') { if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[$functionName] = new PHPExcel_Calculation_Function( $returnValue[$functionName] = new PHPExcel_Calculation_Function(
$function['category'], $function['category'],
@ -4028,7 +4028,7 @@ class PHPExcel_Calculation
*/ */
public function listAllFunctionNames() public function listAllFunctionNames()
{ {
return array_keys(self::$_PHPExcelFunctions); return array_keys(self::$PHPExcelFunctions);
} }
/** /**
@ -4039,7 +4039,7 @@ class PHPExcel_Calculation
public function listFunctionNames() public function listFunctionNames()
{ {
$returnValue = array(); $returnValue = array();
foreach (self::$_PHPExcelFunctions as $functionName => $function) { foreach (self::$PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') { if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[] = $functionName; $returnValue[] = $functionName;
} }

View File

@ -66,7 +66,7 @@ class PHPExcel_Calculation_Token_Stack
'reference' => $reference 'reference' => $reference
); );
if ($type == 'Function') { if ($type == 'Function') {
$localeFunction = PHPExcel_Calculation::_localeFunc($value); $localeFunction = PHPExcel_Calculation::localeFunc($value);
if ($localeFunction != $value) { if ($localeFunction != $value) {
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction; $this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
} }

View File

@ -40,14 +40,14 @@ class PHPExcel_Cell
* *
* @var PHPExcel_Cell_IValueBinder * @var PHPExcel_Cell_IValueBinder
*/ */
private static $_valueBinder; private static $valueBinder;
/** /**
* Value of the cell * Value of the cell
* *
* @var mixed * @var mixed
*/ */
private $_value; private $value;
/** /**
* Calculated value of the cell (used for caching) * Calculated value of the cell (used for caching)
@ -59,34 +59,34 @@ class PHPExcel_Cell
* *
* @var mixed * @var mixed
*/ */
private $_calculatedValue; private $calculatedValue;
/** /**
* Type of the cell data * Type of the cell data
* *
* @var string * @var string
*/ */
private $_dataType; private $dataType;
/** /**
* Parent worksheet * Parent worksheet
* *
* @var PHPExcel_CachedObjectStorage_CacheBase * @var PHPExcel_CachedObjectStorage_CacheBase
*/ */
private $_parent; private $parent;
/** /**
* Index to cellXf * Index to cellXf
* *
* @var int * @var int
*/ */
private $_xfIndex = 0; private $xfIndex = 0;
/** /**
* Attributes of the formula * Attributes of the formula
* *
*/ */
private $_formulaAttributes; private $formulaAttributes;
/** /**
@ -96,19 +96,19 @@ class PHPExcel_Cell
**/ **/
public function notifyCacheController() public function notifyCacheController()
{ {
$this->_parent->updateCacheData($this); $this->parent->updateCacheData($this);
return $this; return $this;
} }
public function detach() public function detach()
{ {
$this->_parent = null; $this->parent = null;
} }
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
@ -123,17 +123,17 @@ class PHPExcel_Cell
public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null) public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Initialise cell value // Initialise cell value
$this->_value = $pValue; $this->value = $pValue;
// Set worksheet cache // Set worksheet cache
$this->_parent = $pSheet->getCellCacheController(); $this->parent = $pSheet->getCellCacheController();
// Set datatype? // Set datatype?
if ($pDataType !== null) { if ($pDataType !== null) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
} }
$this->_dataType = $pDataType; $this->dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) { } elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell."); throw new PHPExcel_Exception("Value could not be bound to cell.");
} }
@ -146,7 +146,7 @@ class PHPExcel_Cell
*/ */
public function getColumn() public function getColumn()
{ {
return $this->_parent->getCurrentColumn(); return $this->parent->getCurrentColumn();
} }
/** /**
@ -156,7 +156,7 @@ class PHPExcel_Cell
*/ */
public function getRow() public function getRow()
{ {
return $this->_parent->getCurrentRow(); return $this->parent->getCurrentRow();
} }
/** /**
@ -166,7 +166,7 @@ class PHPExcel_Cell
*/ */
public function getCoordinate() public function getCoordinate()
{ {
return $this->_parent->getCurrentAddress(); return $this->parent->getCurrentAddress();
} }
/** /**
@ -176,7 +176,7 @@ class PHPExcel_Cell
*/ */
public function getValue() public function getValue()
{ {
return $this->_value; return $this->value;
} }
/** /**
@ -223,7 +223,7 @@ class PHPExcel_Cell
// set the value according to data type // set the value according to data type
switch ($pDataType) { switch ($pDataType) {
case PHPExcel_Cell_DataType::TYPE_NULL: case PHPExcel_Cell_DataType::TYPE_NULL:
$this->_value = $pValue; $this->value = $pValue;
break; break;
case PHPExcel_Cell_DataType::TYPE_STRING2: case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
@ -231,19 +231,19 @@ class PHPExcel_Cell
// Synonym for string // Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE: case PHPExcel_Cell_DataType::TYPE_INLINE:
// Rich text // Rich text
$this->_value = PHPExcel_Cell_DataType::checkString($pValue); $this->value = PHPExcel_Cell_DataType::checkString($pValue);
break; break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC: case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (float) $pValue; $this->value = (float) $pValue;
break; break;
case PHPExcel_Cell_DataType::TYPE_FORMULA: case PHPExcel_Cell_DataType::TYPE_FORMULA:
$this->_value = (string) $pValue; $this->value = (string) $pValue;
break; break;
case PHPExcel_Cell_DataType::TYPE_BOOL: case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_value = (bool) $pValue; $this->value = (bool) $pValue;
break; break;
case PHPExcel_Cell_DataType::TYPE_ERROR: case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue); $this->value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
break; break;
default: default:
throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType); throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType);
@ -251,7 +251,7 @@ class PHPExcel_Cell
} }
// set the datatype // set the datatype
$this->_dataType = $pDataType; $this->dataType = $pDataType;
return $this->notifyCacheController(); return $this->notifyCacheController();
} }
@ -267,8 +267,8 @@ class PHPExcel_Cell
*/ */
public function getCalculatedValue($resetLog = true) public function getCalculatedValue($resetLog = true)
{ {
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL; //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 == PHPExcel_Cell_DataType::TYPE_FORMULA) {
try { try {
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL; //echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
$result = PHPExcel_Calculation::getInstance( $result = PHPExcel_Calculation::getInstance(
@ -282,9 +282,9 @@ class PHPExcel_Cell
} }
} }
} catch (PHPExcel_Exception $ex) { } catch (PHPExcel_Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== null)) { if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; //echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback for calculations referencing external files. return $this->calculatedValue; // Fallback for calculations referencing external files.
} }
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL; //echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
$result = '#N/A'; $result = '#N/A';
@ -294,17 +294,17 @@ class PHPExcel_Cell
} }
if ($result === '#Not Yet Implemented') { if ($result === '#Not Yet Implemented') {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; //echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula. return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
} }
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL; //echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
return $result; return $result;
} elseif ($this->_value instanceof PHPExcel_RichText) { } elseif ($this->value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />'; // echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->value.'<br />';
return $this->_value->getPlainText(); return $this->value->getPlainText();
} }
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />'; // echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->value.'<br />';
return $this->_value; return $this->value;
} }
/** /**
@ -316,7 +316,7 @@ class PHPExcel_Cell
public function setCalculatedValue($pValue = null) public function setCalculatedValue($pValue = null)
{ {
if ($pValue !== null) { if ($pValue !== null) {
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; $this->calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
} }
return $this->notifyCacheController(); return $this->notifyCacheController();
@ -334,7 +334,7 @@ class PHPExcel_Cell
*/ */
public function getOldCalculatedValue() public function getOldCalculatedValue()
{ {
return $this->_calculatedValue; return $this->calculatedValue;
} }
/** /**
@ -344,7 +344,7 @@ class PHPExcel_Cell
*/ */
public function getDataType() public function getDataType()
{ {
return $this->_dataType; return $this->dataType;
} }
/** /**
@ -358,7 +358,7 @@ class PHPExcel_Cell
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
} }
$this->_dataType = $pDataType; $this->dataType = $pDataType;
return $this->notifyCacheController(); return $this->notifyCacheController();
} }
@ -370,7 +370,7 @@ class PHPExcel_Cell
*/ */
public function isFormula() public function isFormula()
{ {
return $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA; return $this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
} }
/** /**
@ -381,7 +381,7 @@ class PHPExcel_Cell
*/ */
public function hasDataValidation() public function hasDataValidation()
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
} }
@ -396,7 +396,7 @@ class PHPExcel_Cell
*/ */
public function getDataValidation() public function getDataValidation()
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
} }
@ -412,7 +412,7 @@ class PHPExcel_Cell
*/ */
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null) public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
} }
@ -429,7 +429,7 @@ class PHPExcel_Cell
*/ */
public function hasHyperlink() public function hasHyperlink()
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
} }
@ -444,7 +444,7 @@ class PHPExcel_Cell
*/ */
public function getHyperlink() public function getHyperlink()
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
} }
@ -460,7 +460,7 @@ class PHPExcel_Cell
*/ */
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null) public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{ {
if (!isset($this->_parent)) { if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
} }
@ -476,7 +476,7 @@ class PHPExcel_Cell
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
/** /**
@ -486,7 +486,7 @@ class PHPExcel_Cell
*/ */
public function getWorksheet() public function getWorksheet()
{ {
return $this->_parent->getParent(); return $this->parent->getParent();
} }
/** /**
@ -549,7 +549,7 @@ class PHPExcel_Cell
*/ */
public function rebindParent(PHPExcel_Worksheet $parent) public function rebindParent(PHPExcel_Worksheet $parent)
{ {
$this->_parent = $parent->getCellCacheController(); $this->parent = $parent->getCellCacheController();
return $this->notifyCacheController(); return $this->notifyCacheController();
} }
@ -943,11 +943,11 @@ class PHPExcel_Cell
*/ */
public static function getValueBinder() public static function getValueBinder()
{ {
if (self::$_valueBinder === null) { if (self::$valueBinder === null) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder(); self::$valueBinder = new PHPExcel_Cell_DefaultValueBinder();
} }
return self::$_valueBinder; return self::$valueBinder;
} }
/** /**
@ -962,7 +962,7 @@ class PHPExcel_Cell
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
} }
self::$_valueBinder = $binder; self::$valueBinder = $binder;
} }
/** /**
@ -972,7 +972,7 @@ class PHPExcel_Cell
{ {
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) { if ((is_object($value)) && ($key != 'parent')) {
$this->$key = clone $value; $this->$key = clone $value;
} else { } else {
$this->$key = $value; $this->$key = $value;
@ -987,7 +987,7 @@ class PHPExcel_Cell
*/ */
public function getXfIndex() public function getXfIndex()
{ {
return $this->_xfIndex; return $this->xfIndex;
} }
/** /**
@ -998,7 +998,7 @@ class PHPExcel_Cell
*/ */
public function setXfIndex($pValue = 0) public function setXfIndex($pValue = 0)
{ {
$this->_xfIndex = $pValue; $this->xfIndex = $pValue;
return $this->notifyCacheController(); return $this->notifyCacheController();
} }
@ -1008,7 +1008,7 @@ class PHPExcel_Cell
*/ */
public function setFormulaAttributes($pAttributes) public function setFormulaAttributes($pAttributes)
{ {
$this->_formulaAttributes = $pAttributes; $this->formulaAttributes = $pAttributes;
return $this; return $this;
} }
@ -1017,7 +1017,7 @@ class PHPExcel_Cell
*/ */
public function getFormulaAttributes() public function getFormulaAttributes()
{ {
return $this->_formulaAttributes; return $this->formulaAttributes;
} }
/** /**

View File

@ -14,7 +14,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_axis_number = array( private $axisNumber = array(
'format' => self::FORMAT_CODE_GENERAL, 'format' => self::FORMAT_CODE_GENERAL,
'source_linked' => 1 'source_linked' => 1
); );
@ -24,7 +24,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_axis_options = array( private $axisOptions = array(
'minimum' => null, 'minimum' => null,
'maximum' => null, 'maximum' => null,
'major_unit' => null, 'major_unit' => null,
@ -42,7 +42,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_fill_properties = array( private $fillProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null, 'value' => null,
'alpha' => 0 'alpha' => 0
@ -53,7 +53,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_line_properties = array( private $lineProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null, 'value' => null,
'alpha' => 0 'alpha' => 0
@ -64,7 +64,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_line_style_properties = array( private $lineStyleProperties = array(
'width' => '9525', 'width' => '9525',
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE, 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
'dash' => self::LINE_STYLE_DASH_SOLID, 'dash' => self::LINE_STYLE_DASH_SOLID,
@ -87,7 +87,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_shadow_properties = array( private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW, 'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => array( 'color' => array(
@ -112,7 +112,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_glow_properties = array( private $glowProperties = array(
'size' => null, 'size' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -126,7 +126,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_soft_edges = array( private $softEdges = array(
'size' => null 'size' => null
); );
@ -137,8 +137,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setAxisNumberProperties($format_code) public function setAxisNumberProperties($format_code)
{ {
$this->_axis_number['format'] = (string) $format_code; $this->axisNumber['format'] = (string) $format_code;
$this->_axis_number['source_linked'] = 0; $this->axisNumber['source_linked'] = 0;
} }
/** /**
@ -148,7 +148,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisNumberFormat() public function getAxisNumberFormat()
{ {
return $this->_axis_number['format']; return $this->axisNumber['format'];
} }
/** /**
@ -158,7 +158,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisNumberSourceLinked() public function getAxisNumberSourceLinked()
{ {
return (string) $this->_axis_number['source_linked']; return (string) $this->axisNumber['source_linked'];
} }
/** /**
@ -178,17 +178,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null) public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
{ {
$this->_axis_options['axis_labels'] = (string) $axis_labels; $this->axisOptions['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null; ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : null; ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->_axis_options['orientation'] = (string) $axis_orientation : null; ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : null; ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null; ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null; ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->_axis_options['minimum'] = (string) $minimum : null; ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->_axis_options['maximum'] = (string) $maximum : null; ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->_axis_options['major_unit'] = (string) $major_unit : null; ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : null; ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
} }
/** /**
@ -200,7 +200,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisOptionsProperty($property) public function getAxisOptionsProperty($property)
{ {
return $this->_axis_options[$property]; return $this->axisOptions[$property];
} }
/** /**
@ -224,7 +224,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{ {
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type); $this->fillProperties = $this->setColorProperties($color, $alpha, $type);
} }
/** /**
@ -237,7 +237,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{ {
$this->_line_properties = $this->setColorProperties($color, $alpha, $type); $this->lineProperties = $this->setColorProperties($color, $alpha, $type);
} }
/** /**
@ -249,7 +249,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getFillProperty($property) public function getFillProperty($property)
{ {
return $this->_fill_properties[$property]; return $this->fillProperties[$property];
} }
/** /**
@ -261,7 +261,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineProperty($property) public function getLineProperty($property)
{ {
return $this->_line_properties[$property]; return $this->lineProperties[$property];
} }
/** /**
@ -278,16 +278,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $end_arrow_size * @param string $end_arrow_size
* *
*/ */
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) { public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width) : null; {
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null; (!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : null; (!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : null; (!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : null; (!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type : null; (!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size : null; (!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type : null; (!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size : null; (!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
} }
/** /**
@ -299,7 +300,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleProperty($elements) public function getLineStyleProperty($elements)
{ {
return $this->getArrayElementsValue($this->_line_style_properties, $elements); return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
} }
/** /**
@ -311,7 +312,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleArrowWidth($arrow) public function getLineStyleArrowWidth($arrow)
{ {
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w'); return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
} }
/** /**
@ -323,7 +324,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleArrowLength($arrow) public function getLineStyleArrowLength($arrow)
{ {
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len'); return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
} }
/** /**
@ -338,15 +339,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param float $sh_distance * @param float $sh_distance
* *
*/ */
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) { public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
$this->_setShadowPresetsProperties((int) $sh_presets) {
->_setShadowColor( $this->setShadowPresetsProperties((int) $sh_presets)
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value ->setShadowColor(
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type) is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
->_setShadowBlur($sh_blur) is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
->_setShadowAngle($sh_angle) )
->_setShadowDistance($sh_distance); ->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
} }
/** /**
@ -356,9 +359,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowPresetsProperties($shadow_presets) { private function setShadowPresetsProperties($shadow_presets)
$this->_shadow_properties['presets'] = $shadow_presets; {
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); $this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this; return $this;
} }
@ -371,19 +375,20 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) { private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference; $base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) { foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) { if (is_array($property_val)) {
if ($reference === null) { if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key]; $reference = & $this->shadowProperties[$property_key];
} else { } else {
$reference = & $reference[$property_key]; $reference = & $reference[$property_key];
} }
$this->_setShadowProperiesMapValues($property_val, $reference); $this->setShadowProperiesMapValues($property_val, $reference);
} else { } else {
if ($base_reference === null) { if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val; $this->shadowProperties[$property_key] = $property_val;
} else { } else {
$reference[$property_key] = $property_val; $reference[$property_key] = $property_val;
} }
@ -402,8 +407,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowColor($color, $alpha, $type) { private function setShadowColor($color, $alpha, $type)
$this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type); {
$this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this; return $this;
} }
@ -415,9 +421,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowBlur($blur) { private function setShadowBlur($blur)
{
if ($blur !== null) { if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur); $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
} }
return $this; return $this;
@ -430,9 +437,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowAngle($angle) { private function setShadowAngle($angle)
{
if ($angle !== null) { if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle); $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
} }
return $this; return $this;
@ -445,9 +453,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowDistance($distance) { private function setShadowDistance($distance)
{
if ($distance !== null) { if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance); $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
} }
return $this; return $this;
@ -461,8 +470,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha * @param int $color_alpha
* @param string $color_type * @param string $color_type
*/ */
public function getShadowProperty($elements) { public function getShadowProperty($elements)
return $this->getArrayElementsValue($this->_shadow_properties, $elements); {
return $this->getArrayElementsValue($this->shadowProperties, $elements);
} }
/** /**
@ -473,12 +483,13 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha * @param int $color_alpha
* @param string $color_type * @param string $color_type
*/ */
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) { public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
$this->_setGlowSize($size) {
->_setGlowColor( $this->setGlowSize($size)
is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value ->setGlowColor(
, is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
, is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
); );
} }
@ -489,8 +500,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getGlowProperty($property) { public function getGlowProperty($property)
return $this->getArrayElementsValue($this->_glow_properties, $property); {
return $this->getArrayElementsValue($this->glowProperties, $property);
} }
/** /**
@ -500,9 +512,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setGlowSize($size) { private function setGlowSize($size)
{
if (!is_null($size)) { if (!is_null($size)) {
$this->_glow_properties['size'] = $this->getExcelPointsWidth($size); $this->glowProperties['size'] = $this->getExcelPointsWidth($size);
} }
return $this; return $this;
@ -517,8 +530,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setGlowColor($color, $alpha, $type) { private function setGlowColor($color, $alpha, $type)
$this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type); {
$this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this; return $this;
} }
@ -528,9 +542,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @param float $size * @param float $size
*/ */
public function setSoftEdges($size) { public function setSoftEdges($size)
{
if (!is_null($size)) { if (!is_null($size)) {
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size); $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
} }
} }
@ -539,7 +554,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getSoftEdgesSize() { public function getSoftEdgesSize()
return $this->_soft_edges['size']; {
return $this->softEdges['size'];
} }
} }

View File

@ -75,90 +75,90 @@ class PHPExcel_Chart_DataSeries
* *
* @var string * @var string
*/ */
private $_plotType = null; private $plotType;
/** /**
* Plot Grouping Type * Plot Grouping Type
* *
* @var boolean * @var boolean
*/ */
private $_plotGrouping = null; private $plotGrouping;
/** /**
* Plot Direction * Plot Direction
* *
* @var boolean * @var boolean
*/ */
private $_plotDirection = null; private $plotDirection;
/** /**
* Plot Style * Plot Style
* *
* @var string * @var string
*/ */
private $_plotStyle = null; private $plotStyle;
/** /**
* Order of plots in Series * Order of plots in Series
* *
* @var array of integer * @var array of integer
*/ */
private $_plotOrder = array(); private $plotOrder = array();
/** /**
* Plot Label * Plot Label
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotLabel = array(); private $plotLabel = array();
/** /**
* Plot Category * Plot Category
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotCategory = array(); private $plotCategory = array();
/** /**
* Smooth Line * Smooth Line
* *
* @var string * @var string
*/ */
private $_smoothLine = null; private $smoothLine;
/** /**
* Plot Values * Plot Values
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotValues = array(); 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(), $plotDirection = null, $smoothLine = null, $plotStyle = null) public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
{ {
$this->_plotType = $plotType; $this->plotType = $plotType;
$this->_plotGrouping = $plotGrouping; $this->plotGrouping = $plotGrouping;
$this->_plotOrder = $plotOrder; $this->plotOrder = $plotOrder;
$keys = array_keys($plotValues); $keys = array_keys($plotValues);
$this->_plotValues = $plotValues; $this->plotValues = $plotValues;
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
} }
$this->_plotLabel = $plotLabel; $this->plotLabel = $plotLabel;
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
} }
$this->_plotCategory = $plotCategory; $this->plotCategory = $plotCategory;
$this->_smoothLine = $smoothLine; $this->smoothLine = $smoothLine;
$this->_plotStyle = $plotStyle; $this->plotStyle = $plotStyle;
if (is_null($plotDirection)) { if (is_null($plotDirection)) {
$plotDirection = self::DIRECTION_COL; $plotDirection = self::DIRECTION_COL;
} }
$this->_plotDirection = $plotDirection; $this->plotDirection = $plotDirection;
} }
/** /**
@ -168,7 +168,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotType() public function getPlotType()
{ {
return $this->_plotType; return $this->plotType;
} }
/** /**
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotType($plotType = '') public function setPlotType($plotType = '')
{ {
$this->_plotType = $plotType; $this->plotType = $plotType;
return $this; return $this;
} }
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotGrouping() public function getPlotGrouping()
{ {
return $this->_plotGrouping; return $this->plotGrouping;
} }
/** /**
@ -201,7 +201,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotGrouping($groupingType = null) public function setPlotGrouping($groupingType = null)
{ {
$this->_plotGrouping = $groupingType; $this->plotGrouping = $groupingType;
return $this; return $this;
} }
@ -212,7 +212,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotDirection() public function getPlotDirection()
{ {
return $this->_plotDirection; return $this->plotDirection;
} }
/** /**
@ -223,7 +223,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotDirection($plotDirection = null) public function setPlotDirection($plotDirection = null)
{ {
$this->_plotDirection = $plotDirection; $this->plotDirection = $plotDirection;
return $this; return $this;
} }
@ -234,7 +234,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotOrder() public function getPlotOrder()
{ {
return $this->_plotOrder; return $this->plotOrder;
} }
/** /**
@ -244,7 +244,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotLabels() public function getPlotLabels()
{ {
return $this->_plotLabel; return $this->plotLabel;
} }
/** /**
@ -254,11 +254,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotLabelByIndex($index) public function getPlotLabelByIndex($index)
{ {
$keys = array_keys($this->_plotLabel); $keys = array_keys($this->plotLabel);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotLabel[$index]; return $this->plotLabel[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]]; return $this->plotLabel[$keys[$index]];
} }
return false; return false;
} }
@ -270,7 +270,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotCategories() public function getPlotCategories()
{ {
return $this->_plotCategory; return $this->plotCategory;
} }
/** /**
@ -280,11 +280,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotCategoryByIndex($index) public function getPlotCategoryByIndex($index)
{ {
$keys = array_keys($this->_plotCategory); $keys = array_keys($this->plotCategory);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotCategory[$index]; return $this->plotCategory[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]]; return $this->plotCategory[$keys[$index]];
} }
return false; return false;
} }
@ -296,7 +296,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotStyle() public function getPlotStyle()
{ {
return $this->_plotStyle; return $this->plotStyle;
} }
/** /**
@ -307,7 +307,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotStyle($plotStyle = null) public function setPlotStyle($plotStyle = null)
{ {
$this->_plotStyle = $plotStyle; $this->plotStyle = $plotStyle;
return $this; return $this;
} }
@ -318,7 +318,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotValues() public function getPlotValues()
{ {
return $this->_plotValues; return $this->plotValues;
} }
/** /**
@ -328,11 +328,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotValuesByIndex($index) public function getPlotValuesByIndex($index)
{ {
$keys = array_keys($this->_plotValues); $keys = array_keys($this->plotValues);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotValues[$index]; return $this->plotValues[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotValues[$keys[$index]]; return $this->plotValues[$keys[$index]];
} }
return false; return false;
} }
@ -344,7 +344,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotSeriesCount() public function getPlotSeriesCount()
{ {
return count($this->_plotValues); return count($this->plotValues);
} }
/** /**
@ -354,7 +354,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getSmoothLine() public function getSmoothLine()
{ {
return $this->_smoothLine; return $this->smoothLine;
} }
/** /**
@ -365,23 +365,23 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setSmoothLine($smoothLine = true) public function setSmoothLine($smoothLine = true)
{ {
$this->_smoothLine = $smoothLine; $this->smoothLine = $smoothLine;
return $this; return $this;
} }
public function refresh(PHPExcel_Worksheet $worksheet) public function refresh(PHPExcel_Worksheet $worksheet)
{ {
foreach ($this->_plotValues as $plotValues) { foreach ($this->plotValues as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, true); $plotValues->refresh($worksheet, true);
} }
} }
foreach ($this->_plotLabel as $plotValues) { foreach ($this->plotLabel as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, true); $plotValues->refresh($worksheet, true);
} }
} }
foreach ($this->_plotCategory as $plotValues) { foreach ($this->plotCategory as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, false); $plotValues->refresh($worksheet, false);
} }

View File

@ -31,7 +31,7 @@ class PHPExcel_Chart_DataSeriesValues
const DATASERIES_TYPE_STRING = 'String'; const DATASERIES_TYPE_STRING = 'String';
const DATASERIES_TYPE_NUMBER = 'Number'; const DATASERIES_TYPE_NUMBER = 'Number';
private static $_dataTypeValues = array( private static $dataTypeValues = array(
self::DATASERIES_TYPE_STRING, self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER, self::DATASERIES_TYPE_NUMBER,
); );
@ -41,42 +41,42 @@ class PHPExcel_Chart_DataSeriesValues
* *
* @var string * @var string
*/ */
private $_dataType = null; private $dataType;
/** /**
* Series Data Source * Series Data Source
* *
* @var string * @var string
*/ */
private $_dataSource = null; private $dataSource;
/** /**
* Format Code * Format Code
* *
* @var string * @var string
*/ */
private $_formatCode = null; private $formatCode;
/** /**
* Series Point Marker * Series Point Marker
* *
* @var string * @var string
*/ */
private $_marker = null; private $pointMarker;
/** /**
* Point Count (The number of datapoints in the dataseries) * Point Count (The number of datapoints in the dataseries)
* *
* @var integer * @var integer
*/ */
private $_pointCount = 0; private $pointCount = 0;
/** /**
* Data Values * Data Values
* *
* @var array of mixed * @var array of mixed
*/ */
private $_dataValues = array(); private $dataValues = array();
/** /**
* Create a new PHPExcel_Chart_DataSeriesValues object * Create a new PHPExcel_Chart_DataSeriesValues object
@ -84,11 +84,11 @@ class PHPExcel_Chart_DataSeriesValues
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
{ {
$this->setDataType($dataType); $this->setDataType($dataType);
$this->_dataSource = $dataSource; $this->dataSource = $dataSource;
$this->_formatCode = $formatCode; $this->formatCode = $formatCode;
$this->_pointCount = $pointCount; $this->pointCount = $pointCount;
$this->_dataValues = $dataValues; $this->dataValues = $dataValues;
$this->_marker = $marker; $this->pointMarker = $marker;
} }
/** /**
@ -98,7 +98,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataType() public function getDataType()
{ {
return $this->_dataType; return $this->dataType;
} }
/** /**
@ -114,10 +114,10 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
{ {
if (!in_array($dataType, self::$_dataTypeValues)) { if (!in_array($dataType, self::$dataTypeValues)) {
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
} }
$this->_dataType = $dataType; $this->dataType = $dataType;
return $this; return $this;
} }
@ -129,7 +129,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataSource() public function getDataSource()
{ {
return $this->_dataSource; return $this->dataSource;
} }
/** /**
@ -140,7 +140,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataSource($dataSource = null, $refreshDataValues = true) public function setDataSource($dataSource = null, $refreshDataValues = true)
{ {
$this->_dataSource = $dataSource; $this->dataSource = $dataSource;
if ($refreshDataValues) { if ($refreshDataValues) {
// TO DO // TO DO
@ -156,7 +156,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getPointMarker() public function getPointMarker()
{ {
return $this->_marker; return $this->pointMarker;
} }
/** /**
@ -167,7 +167,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setPointMarker($marker = null) public function setPointMarker($marker = null)
{ {
$this->_marker = $marker; $this->pointMarker = $marker;
return $this; return $this;
} }
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getFormatCode() public function getFormatCode()
{ {
return $this->_formatCode; return $this->formatCode;
} }
/** /**
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setFormatCode($formatCode = null) public function setFormatCode($formatCode = null)
{ {
$this->_formatCode = $formatCode; $this->formatCode = $formatCode;
return $this; return $this;
} }
@ -202,7 +202,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getPointCount() public function getPointCount()
{ {
return $this->_pointCount; return $this->pointCount;
} }
/** /**
@ -212,8 +212,8 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function isMultiLevelSeries() public function isMultiLevelSeries()
{ {
if (count($this->_dataValues) > 0) { if (count($this->dataValues) > 0) {
return is_array($this->_dataValues[0]); return is_array($this->dataValues[0]);
} }
return null; return null;
} }
@ -226,8 +226,8 @@ class PHPExcel_Chart_DataSeriesValues
public function multiLevelCount() public function multiLevelCount()
{ {
$levelCount = 0; $levelCount = 0;
foreach ($this->_dataValues as $dataValueSet) { foreach ($this->dataValues as $dataValueSet) {
$levelCount = max($levelCount,count($dataValueSet)); $levelCount = max($levelCount, count($dataValueSet));
} }
return $levelCount; return $levelCount;
} }
@ -239,7 +239,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataValues() public function getDataValues()
{ {
return $this->_dataValues; return $this->dataValues;
} }
/** /**
@ -249,13 +249,13 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataValue() public function getDataValue()
{ {
$count = count($this->_dataValues); $count = count($this->dataValues);
if ($count == 0) { if ($count == 0) {
return null; return null;
} elseif ($count == 1) { } elseif ($count == 1) {
return $this->_dataValues[0]; return $this->dataValues[0];
} }
return $this->_dataValues; return $this->dataValues;
} }
/** /**
@ -263,14 +263,14 @@ class PHPExcel_Chart_DataSeriesValues
* *
* @param array $dataValues * @param array $dataValues
* @param boolean $refreshDataSource * @param boolean $refreshDataSource
* TRUE - refresh the value of _dataSource based on the values of $dataValues * TRUE - refresh the value of dataSource based on the values of $dataValues
* FALSE - don't change the value of _dataSource * FALSE - don't change the value of dataSource
* @return PHPExcel_Chart_DataSeriesValues * @return PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataValues($dataValues = array(), $refreshDataSource = true) public function setDataValues($dataValues = array(), $refreshDataSource = true)
{ {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->_pointCount = count($dataValues); $this->pointCount = count($dataValues);
if ($refreshDataSource) { if ($refreshDataSource) {
// TO DO // TO DO
@ -279,39 +279,39 @@ class PHPExcel_Chart_DataSeriesValues
return $this; return $this;
} }
private function _stripNulls($var) private function stripNulls($var)
{ {
return $var !== null; return $var !== null;
} }
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true) public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
{ {
if ($this->_dataSource !== null) { if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult( $newDataValues = PHPExcel_Calculation::_unwrapResult(
$calcEngine->_calculateFormulaValue( $calcEngine->_calculateFormulaValue(
'='.$this->_dataSource, '='.$this->dataSource,
null, null,
$worksheet->getCell('A1') $worksheet->getCell('A1')
) )
); );
if ($flatten) { if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach ($this->_dataValues as &$dataValue) { foreach ($this->dataValues as &$dataValue) {
if ((!empty($dataValue)) && ($dataValue[0] == '#')) { if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
$dataValue = 0.0; $dataValue = 0.0;
} }
} }
unset($dataValue); unset($dataValue);
} else { } else {
$cellRange = explode('!', $this->_dataSource); $cellRange = explode('!', $this->dataSource);
if (count($cellRange) > 1) { if (count($cellRange) > 1) {
list(, $cellRange) = $cellRange; list(, $cellRange) = $cellRange;
} }
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange)); $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else { } else {
$newArray = array_values(array_shift($newDataValues)); $newArray = array_values(array_shift($newDataValues));
foreach ($newArray as $i => $newDataSet) { foreach ($newArray as $i => $newDataSet) {
@ -324,10 +324,10 @@ class PHPExcel_Chart_DataSeriesValues
array_unshift($newArray[$i++], $newDataVal); array_unshift($newArray[$i++], $newDataVal);
} }
} }
$this->_dataValues = $newArray; $this->dataValues = $newArray;
} }
} }
$this->_pointCount = count($this->_dataValues); $this->pointCount = count($this->dataValues);
} }
} }
} }

View File

@ -20,9 +20,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* *
*/ */
private $_object_state = false; private $objectState = false;
private $_line_properties = array( private $lineProperties = array(
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => null, 'value' => null,
@ -47,7 +47,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
) )
); );
private $_shadow_properties = array( private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW, 'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => array( 'color' => array(
@ -67,7 +67,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
'rotWithShape' => null 'rotWithShape' => null
); );
private $_glow_properties = array( private $glowProperties = array(
'size' => null, 'size' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -76,7 +76,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
) )
); );
private $_soft_edges = array( private $softEdges = array(
'size' => null 'size' => null
); );
@ -88,7 +88,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getObjectState() public function getObjectState()
{ {
return $this->_object_state; return $this->objectState;
} }
/** /**
@ -97,9 +97,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _activateObject() private function activateObject()
{ {
$this->_object_state = true; $this->objectState = true;
return $this; return $this;
} }
@ -114,12 +114,12 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{ {
$this $this->activateObject()
->_activateObject() ->lineProperties['color'] = $this->setColorProperties(
->_line_properties['color'] = $this->setColorProperties(
$value, $value,
$alpha, $alpha,
$type); $type
);
} }
/** /**
@ -138,33 +138,33 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
{ {
$this->_activateObject(); $this->activateObject();
(!is_null($line_width)) (!is_null($line_width))
? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width) ? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
: null; : null;
(!is_null($compound_type)) (!is_null($compound_type))
? $this->_line_properties['style']['compound'] = (string) $compound_type ? $this->lineProperties['style']['compound'] = (string) $compound_type
: null; : null;
(!is_null($dash_type)) (!is_null($dash_type))
? $this->_line_properties['style']['dash'] = (string) $dash_type ? $this->lineProperties['style']['dash'] = (string) $dash_type
: null; : null;
(!is_null($cap_type)) (!is_null($cap_type))
? $this->_line_properties['style']['cap'] = (string) $cap_type ? $this->lineProperties['style']['cap'] = (string) $cap_type
: null; : null;
(!is_null($join_type)) (!is_null($join_type))
? $this->_line_properties['style']['join'] = (string) $join_type ? $this->lineProperties['style']['join'] = (string) $join_type
: null; : null;
(!is_null($head_arrow_type)) (!is_null($head_arrow_type))
? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type ? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
: null; : null;
(!is_null($head_arrow_size)) (!is_null($head_arrow_size))
? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size ? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
: null; : null;
(!is_null($end_arrow_type)) (!is_null($end_arrow_type))
? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type ? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
: null; : null;
(!is_null($end_arrow_size)) (!is_null($end_arrow_size))
? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size ? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
: null; : null;
} }
@ -178,7 +178,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineColorProperty($parameter) public function getLineColorProperty($parameter)
{ {
return $this->_line_properties['color'][$parameter]; return $this->lineProperties['color'][$parameter];
} }
/** /**
@ -191,7 +191,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleProperty($elements) public function getLineStyleProperty($elements)
{ {
return $this->getArrayElementsValue($this->_line_properties['style'], $elements); return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
} }
/** /**
@ -207,9 +207,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{ {
$this $this
->_activateObject() ->activateObject()
->_setGlowSize($size) ->setGlowSize($size)
->_setGlowColor($color_value, $color_alpha, $color_type); ->setGlowColor($color_value, $color_alpha, $color_type);
} }
/** /**
@ -222,7 +222,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowColor($property) public function getGlowColor($property)
{ {
return $this->_glow_properties['color'][$property]; return $this->glowProperties['color'][$property];
} }
/** /**
@ -233,7 +233,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowSize() public function getGlowSize()
{ {
return $this->_glow_properties['size']; return $this->glowProperties['size'];
} }
/** /**
@ -244,9 +244,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setGlowSize($size) private function setGlowSize($size)
{ {
$this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size); $this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
return $this; return $this;
} }
@ -261,16 +261,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setGlowColor($color, $alpha, $type) private function setGlowColor($color, $alpha, $type)
{ {
if (!is_null($color)) { if (!is_null($color)) {
$this->_glow_properties['color']['value'] = (string) $color; $this->glowProperties['color']['value'] = (string) $color;
} }
if (!is_null($alpha)) { if (!is_null($alpha)) {
$this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
} }
if (!is_null($type)) { if (!is_null($type)) {
$this->_glow_properties['color']['type'] = (string) $type; $this->glowProperties['color']['type'] = (string) $type;
} }
return $this; return $this;
@ -287,7 +287,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleArrowParameters($arrow_selector, $property_selector) public function getLineStyleArrowParameters($arrow_selector, $property_selector)
{ {
return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector); return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
} }
/** /**
@ -305,17 +305,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
{ {
$this $this->activateObject()
->_activateObject() ->setShadowPresetsProperties((int) $sh_presets)
->_setShadowPresetsProperties((int) $sh_presets) ->setShadowColor(
->_setShadowColor( is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
: $this->getTrueAlpha($sh_color_alpha) )
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type) ->setShadowBlur($sh_blur)
->_setShadowBlur($sh_blur) ->setShadowAngle($sh_angle)
->_setShadowAngle($sh_angle) ->setShadowDistance($sh_distance);
->_setShadowDistance($sh_distance);
} }
/** /**
@ -326,10 +325,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowPresetsProperties($shadow_presets) private function setShadowPresetsProperties($shadow_presets)
{ {
$this->_shadow_properties['presets'] = $shadow_presets; $this->shadowProperties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this; return $this;
} }
@ -343,20 +342,20 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{ {
$base_reference = $reference; $base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) { foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) { if (is_array($property_val)) {
if ($reference === null) { if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key]; $reference = & $this->shadowProperties[$property_key];
} else { } else {
$reference = & $reference[$property_key]; $reference = & $reference[$property_key];
} }
$this->_setShadowProperiesMapValues($property_val, $reference); $this->setShadowProperiesMapValues($property_val, $reference);
} else { } else {
if ($base_reference === null) { if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val; $this->shadowProperties[$property_key] = $property_val;
} else { } else {
$reference[$property_key] = $property_val; $reference[$property_key] = $property_val;
} }
@ -374,16 +373,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param string $type * @param string $type
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowColor($color, $alpha, $type) private function setShadowColor($color, $alpha, $type)
{ {
if (!is_null($color)) { if (!is_null($color)) {
$this->_shadow_properties['color']['value'] = (string) $color; $this->shadowProperties['color']['value'] = (string) $color;
} }
if (!is_null($alpha)) { if (!is_null($alpha)) {
$this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); $this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
} }
if (!is_null($type)) { if (!is_null($type)) {
$this->_shadow_properties['color']['type'] = (string) $type; $this->shadowProperties['color']['type'] = (string) $type;
} }
return $this; return $this;
@ -396,10 +395,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowBlur($blur) private function setShadowBlur($blur)
{ {
if ($blur !== null) { if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur); $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
} }
return $this; return $this;
@ -412,10 +411,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowAngle($angle) private function setShadowAngle($angle)
{ {
if ($angle !== null) { if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle); $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
} }
return $this; return $this;
@ -427,10 +426,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param float $distance * @param float $distance
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowDistance($distance) private function setShadowDistance($distance)
{ {
if ($distance !== null) { if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance); $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
} }
return $this; return $this;
@ -445,7 +444,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/ */
public function getShadowProperty($elements) public function getShadowProperty($elements)
{ {
return $this->getArrayElementsValue($this->_shadow_properties, $elements); return $this->getArrayElementsValue($this->shadowProperties, $elements);
} }
/** /**
@ -456,8 +455,8 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setSoftEdgesSize($size) public function setSoftEdgesSize($size)
{ {
if (!is_null($size)) { if (!is_null($size)) {
$this->_activateObject(); $this->activateObject();
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size); $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
} }
} }
@ -468,6 +467,6 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/ */
public function getSoftEdgesSize() public function getSoftEdgesSize()
{ {
return $this->_soft_edges['size']; return $this->softEdges['size'];
} }
} }

View File

@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
* *
* @var string * @var string
*/ */
private $_layoutTarget = null; private $layoutTarget;
/** /**
* X Mode * X Mode
* *
* @var string * @var string
*/ */
private $_xMode = null; private $xMode;
/** /**
* Y Mode * Y Mode
* *
* @var string * @var string
*/ */
private $_yMode = null; private $yMode;
/** /**
* X-Position * X-Position
* *
* @var float * @var float
*/ */
private $_xPos = null; private $xPos;
/** /**
* Y-Position * Y-Position
* *
* @var float * @var float
*/ */
private $_yPos = null; private $yPos;
/** /**
* width * width
* *
* @var float * @var float
*/ */
private $_width = null; private $width;
/** /**
* height * height
* *
* @var float * @var float
*/ */
private $_height = null; private $height;
/** /**
* show legend key * show legend key
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showLegendKey = null; private $showLegendKey;
/** /**
* show value * show value
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showVal = null; private $showVal;
/** /**
* show category name * show category name
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showCatName = null; private $showCatName;
/** /**
* show data series name * show data series name
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showSerName = null; private $showSerName;
/** /**
* show percentage * show percentage
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showPercent = null; private $showPercent;
/** /**
* show bubble size * show bubble size
* *
* @var boolean * @var boolean
*/ */
private $_showBubbleSize = null; private $showBubbleSize;
/** /**
* show leader lines * show leader lines
@ -137,7 +137,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showLeaderLines = null; private $showLeaderLines;
/** /**
@ -146,25 +146,25 @@ class PHPExcel_Chart_Layout
public function __construct($layout = array()) public function __construct($layout = array())
{ {
if (isset($layout['layoutTarget'])) { if (isset($layout['layoutTarget'])) {
$this->_layoutTarget = $layout['layoutTarget']; $this->layoutTarget = $layout['layoutTarget'];
} }
if (isset($layout['xMode'])) { if (isset($layout['xMode'])) {
$this->_xMode = $layout['xMode']; $this->xMode = $layout['xMode'];
} }
if (isset($layout['yMode'])) { if (isset($layout['yMode'])) {
$this->_yMode = $layout['yMode']; $this->yMode = $layout['yMode'];
} }
if (isset($layout['x'])) { if (isset($layout['x'])) {
$this->_xPos = (float) $layout['x']; $this->xPos = (float) $layout['x'];
} }
if (isset($layout['y'])) { if (isset($layout['y'])) {
$this->_yPos = (float) $layout['y']; $this->yPos = (float) $layout['y'];
} }
if (isset($layout['w'])) { if (isset($layout['w'])) {
$this->_width = (float) $layout['w']; $this->width = (float) $layout['w'];
} }
if (isset($layout['h'])) { if (isset($layout['h'])) {
$this->_height = (float) $layout['h']; $this->height = (float) $layout['h'];
} }
} }
@ -175,7 +175,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getLayoutTarget() public function getLayoutTarget()
{ {
return $this->_layoutTarget; return $this->layoutTarget;
} }
/** /**
@ -186,7 +186,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setLayoutTarget($value) public function setLayoutTarget($value)
{ {
$this->_layoutTarget = $value; $this->layoutTarget = $value;
return $this; return $this;
} }
@ -197,7 +197,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getXMode() public function getXMode()
{ {
return $this->_xMode; return $this->xMode;
} }
/** /**
@ -208,7 +208,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setXMode($value) public function setXMode($value)
{ {
$this->_xMode = $value; $this->xMode = $value;
return $this; return $this;
} }
@ -219,7 +219,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getYMode() public function getYMode()
{ {
return $this->_yMode; return $this->yMode;
} }
/** /**
@ -230,7 +230,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setYMode($value) public function setYMode($value)
{ {
$this->_yMode = $value; $this->yMode = $value;
return $this; return $this;
} }
@ -241,7 +241,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getXPosition() public function getXPosition()
{ {
return $this->_xPos; return $this->xPos;
} }
/** /**
@ -252,7 +252,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setXPosition($value) public function setXPosition($value)
{ {
$this->_xPos = $value; $this->xPos = $value;
return $this; return $this;
} }
@ -263,7 +263,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getYPosition() public function getYPosition()
{ {
return $this->_yPos; return $this->yPos;
} }
/** /**
@ -274,7 +274,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setYPosition($value) public function setYPosition($value)
{ {
$this->_yPos = $value; $this->yPos = $value;
return $this; return $this;
} }
@ -285,7 +285,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -296,7 +296,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setWidth($value) public function setWidth($value)
{ {
$this->_width = $value; $this->width = $value;
return $this; return $this;
} }
@ -307,7 +307,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getHeight() public function getHeight()
{ {
return $this->_height; return $this->height;
} }
/** /**
@ -318,7 +318,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setHeight($value) public function setHeight($value)
{ {
$this->_height = $value; $this->height = $value;
return $this; return $this;
} }
@ -330,7 +330,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowLegendKey() public function getShowLegendKey()
{ {
return $this->_showLegendKey; return $this->showLegendKey;
} }
/** /**
@ -342,7 +342,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowLegendKey($value) public function setShowLegendKey($value)
{ {
$this->_showLegendKey = $value; $this->showLegendKey = $value;
return $this; return $this;
} }
@ -353,7 +353,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowVal() public function getShowVal()
{ {
return $this->_showVal; return $this->showVal;
} }
/** /**
@ -365,7 +365,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowVal($value) public function setShowVal($value)
{ {
$this->_showVal = $value; $this->showVal = $value;
return $this; return $this;
} }
@ -376,7 +376,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowCatName() public function getShowCatName()
{ {
return $this->_showCatName; return $this->showCatName;
} }
/** /**
@ -388,7 +388,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowCatName($value) public function setShowCatName($value)
{ {
$this->_showCatName = $value; $this->showCatName = $value;
return $this; return $this;
} }
@ -399,7 +399,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowSerName() public function getShowSerName()
{ {
return $this->_showSerName; return $this->showSerName;
} }
/** /**
@ -411,7 +411,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowSerName($value) public function setShowSerName($value)
{ {
$this->_showSerName = $value; $this->showSerName = $value;
return $this; return $this;
} }
@ -422,7 +422,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowPercent() public function getShowPercent()
{ {
return $this->_showPercent; return $this->showPercent;
} }
/** /**
@ -434,7 +434,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowPercent($value) public function setShowPercent($value)
{ {
$this->_showPercent = $value; $this->showPercent = $value;
return $this; return $this;
} }
@ -445,7 +445,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowBubbleSize() public function getShowBubbleSize()
{ {
return $this->_showBubbleSize; return $this->showBubbleSize;
} }
/** /**
@ -457,7 +457,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowBubbleSize($value) public function setShowBubbleSize($value)
{ {
$this->_showBubbleSize = $value; $this->showBubbleSize = $value;
return $this; return $this;
} }
@ -468,7 +468,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowLeaderLines() public function getShowLeaderLines()
{ {
return $this->_showLeaderLines; return $this->showLeaderLines;
} }
/** /**
@ -480,7 +480,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowLeaderLines($value) public function setShowLeaderLines($value)
{ {
$this->_showLeaderLines = $value; $this->showLeaderLines = $value;
return $this; return $this;
} }
} }

View File

@ -55,30 +55,30 @@ class PHPExcel_Chart_Legend
* *
* @var string * @var string
*/ */
private $_position = self::POSITION_RIGHT; private $position = self::POSITION_RIGHT;
/** /**
* Allow overlay of other elements? * Allow overlay of other elements?
* *
* @var boolean * @var boolean
*/ */
private $_overlay = TRUE; private $overlay = true;
/** /**
* Legend Layout * Legend Layout
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = NULL; 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, PHPExcel_Chart_Layout $layout = null, $overlay = false)
{ {
$this->setPosition($position); $this->setPosition($position);
$this->_layout = $layout; $this->layout = $layout;
$this->setOverlay($overlay); $this->setOverlay($overlay);
} }
@ -87,8 +87,9 @@ class PHPExcel_Chart_Legend
* *
* @return string * @return string
*/ */
public function getPosition() { public function getPosition()
return $this->_position; {
return $this->position;
} }
/** /**
@ -96,12 +97,13 @@ class PHPExcel_Chart_Legend
* *
* @param string $position * @param string $position
*/ */
public function setPosition($position = self::POSITION_RIGHT) { public function setPosition($position = self::POSITION_RIGHT)
if (!in_array($position,self::$_positionXLref)) { {
if (!in_array($position, self::$_positionXLref)) {
return false; return false;
} }
$this->_position = $position; $this->position = $position;
return true; return true;
} }
@ -110,8 +112,9 @@ class PHPExcel_Chart_Legend
* *
* @return number * @return number
*/ */
public function getPositionXL() { public function getPositionXL()
return array_search($this->_position,self::$_positionXLref); {
return array_search($this->position, self::$_positionXLref);
} }
/** /**
@ -119,12 +122,13 @@ class PHPExcel_Chart_Legend
* *
* @param number $positionXL * @param number $positionXL
*/ */
public function setPositionXL($positionXL = self::xlLegendPositionRight) { public function setPositionXL($positionXL = self::xlLegendPositionRight)
if (!array_key_exists($positionXL,self::$_positionXLref)) { {
if (!array_key_exists($positionXL, self::$_positionXLref)) {
return false; return false;
} }
$this->_position = self::$_positionXLref[$positionXL]; $this->position = self::$_positionXLref[$positionXL];
return true; return true;
} }
@ -133,8 +137,9 @@ class PHPExcel_Chart_Legend
* *
* @return boolean * @return boolean
*/ */
public function getOverlay() { public function getOverlay()
return $this->_overlay; {
return $this->overlay;
} }
/** /**
@ -143,12 +148,13 @@ class PHPExcel_Chart_Legend
* @param boolean $overlay * @param boolean $overlay
* @return boolean * @return boolean
*/ */
public function setOverlay($overlay = FALSE) { public function setOverlay($overlay = false)
{
if (!is_bool($overlay)) { if (!is_bool($overlay)) {
return false; return false;
} }
$this->_overlay = $overlay; $this->overlay = $overlay;
return true; return true;
} }
@ -157,8 +163,8 @@ class PHPExcel_Chart_Legend
* *
* @return PHPExcel_Chart_Layout * @return PHPExcel_Chart_Layout
*/ */
public function getLayout() { public function getLayout()
return $this->_layout; {
return $this->layout;
} }
} }

View File

@ -32,22 +32,22 @@ class PHPExcel_Chart_PlotArea
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = null; private $layout = null;
/** /**
* Plot Series * Plot Series
* *
* @var array of PHPExcel_Chart_DataSeries * @var array of PHPExcel_Chart_DataSeries
*/ */
private $_plotSeries = array(); 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(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
{ {
$this->_layout = $layout; $this->layout = $layout;
$this->_plotSeries = $plotSeries; $this->plotSeries = $plotSeries;
} }
/** /**
@ -57,7 +57,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getLayout() public function getLayout()
{ {
return $this->_layout; return $this->layout;
} }
/** /**
@ -67,7 +67,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroupCount() public function getPlotGroupCount()
{ {
return count($this->_plotSeries); return count($this->plotSeries);
} }
/** /**
@ -78,7 +78,7 @@ class PHPExcel_Chart_PlotArea
public function getPlotSeriesCount() public function getPlotSeriesCount()
{ {
$seriesCount = 0; $seriesCount = 0;
foreach ($this->_plotSeries as $plot) { foreach ($this->plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount(); $seriesCount += $plot->getPlotSeriesCount();
} }
return $seriesCount; return $seriesCount;
@ -91,7 +91,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroup() public function getPlotGroup()
{ {
return $this->_plotSeries; return $this->plotSeries;
} }
/** /**
@ -101,7 +101,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroupByIndex($index) public function getPlotGroupByIndex($index)
{ {
return $this->_plotSeries[$index]; return $this->plotSeries[$index];
} }
/** /**
@ -112,14 +112,14 @@ class PHPExcel_Chart_PlotArea
*/ */
public function setPlotSeries($plotSeries = array()) public function setPlotSeries($plotSeries = array())
{ {
$this->_plotSeries = $plotSeries; $this->plotSeries = $plotSeries;
return $this; return $this;
} }
public function refresh(PHPExcel_Worksheet $worksheet) public function refresh(PHPExcel_Worksheet $worksheet)
{ {
foreach ($this->_plotSeries as $plotSeries) { foreach ($this->plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet); $plotSeries->refresh($worksheet);
} }
} }

View File

@ -70,7 +70,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_JOIN_MITER = 'miter', LINE_STYLE_JOIN_MITER = 'miter',
LINE_STYLE_JOIN_BEVEL = 'bevel', LINE_STYLE_JOIN_BEVEL = 'bevel',
LINE_STYLE_ARROW_TYPE_NOARROW = NULL, LINE_STYLE_ARROW_TYPE_NOARROW = null,
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle', LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow', LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth', LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
@ -88,7 +88,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_ARROW_SIZE_9 = 9; LINE_STYLE_ARROW_SIZE_9 = 9;
const const
SHADOW_PRESETS_NOSHADOW = NULL, SHADOW_PRESETS_NOSHADOW = null,
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1, SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
SHADOW_PRESETS_OUTER_BOTTOM = 2, SHADOW_PRESETS_OUTER_BOTTOM = 2,
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3, SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
@ -137,7 +137,8 @@ abstract class PHPExcel_Chart_Properties
); );
} }
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) { protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
{
$sizes = array( $sizes = array(
1 => array('w' => 'sm', 'len' => 'sm'), 1 => array('w' => 'sm', 'len' => 'sm'),
2 => array('w' => 'sm', 'len' => 'med'), 2 => array('w' => 'sm', 'len' => 'med'),
@ -153,7 +154,8 @@ abstract class PHPExcel_Chart_Properties
return $sizes[$array_selector][$array_kay_selector]; return $sizes[$array_selector][$array_kay_selector];
} }
protected function getShadowPresetsMap($shadow_presets_option) { protected function getShadowPresetsMap($shadow_presets_option)
{
$presets_options = array( $presets_options = array(
//OUTER //OUTER
1 => array( 1 => array(
@ -345,7 +347,8 @@ abstract class PHPExcel_Chart_Properties
return $presets_options[$shadow_presets_option]; return $presets_options[$shadow_presets_option];
} }
protected function getArrayElementsValue($properties, $elements) { protected function getArrayElementsValue($properties, $elements)
{
$reference = & $properties; $reference = & $properties;
if (!is_array($elements)) { if (!is_array($elements)) {
return $reference[$elements]; return $reference[$elements];

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_Title
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Chart_Title
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Title class PHPExcel_Chart_Title
{ {
@ -41,22 +33,22 @@ class PHPExcel_Chart_Title
* *
* @var string * @var string
*/ */
private $_caption = null; private $caption = null;
/** /**
* Title Layout * Title Layout
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = null; 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, PHPExcel_Chart_Layout $layout = null)
{ {
$this->_caption = $caption; $this->caption = $caption;
$this->_layout = $layout; $this->layout = $layout;
} }
/** /**
@ -64,8 +56,9 @@ class PHPExcel_Chart_Title
* *
* @return string * @return string
*/ */
public function getCaption() { public function getCaption()
return $this->_caption; {
return $this->caption;
} }
/** /**
@ -74,8 +67,9 @@ class PHPExcel_Chart_Title
* @param string $caption * @param string $caption
* @return PHPExcel_Chart_Title * @return PHPExcel_Chart_Title
*/ */
public function setCaption($caption = null) { public function setCaption($caption = null)
$this->_caption = $caption; {
$this->caption = $caption;
return $this; return $this;
} }
@ -85,8 +79,8 @@ class PHPExcel_Chart_Title
* *
* @return PHPExcel_Chart_Layout * @return PHPExcel_Chart_Layout
*/ */
public function getLayout() { public function getLayout()
return $this->_layout; {
return $this->layout;
} }
} }

View File

@ -109,7 +109,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getAuthor() { public function getAuthor()
{
return $this->_author; return $this->_author;
} }
@ -119,7 +120,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue * @param string $pValue
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setAuthor($pValue = '') { public function setAuthor($pValue = '')
{
$this->_author = $pValue; $this->_author = $pValue;
return $this; return $this;
} }
@ -129,7 +131,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return PHPExcel_RichText * @return PHPExcel_RichText
*/ */
public function getText() { public function getText()
{
return $this->_text; return $this->_text;
} }
@ -139,7 +142,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param PHPExcel_RichText $pValue * @param PHPExcel_RichText $pValue
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setText(PHPExcel_RichText $pValue) { public function setText(PHPExcel_RichText $pValue)
{
$this->_text = $pValue; $this->_text = $pValue;
return $this; return $this;
} }
@ -149,7 +153,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getWidth() { public function getWidth()
{
return $this->_width; return $this->_width;
} }
@ -159,7 +164,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value * @param string $value
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setWidth($value = '96pt') { public function setWidth($value = '96pt')
{
$this->_width = $value; $this->_width = $value;
return $this; return $this;
} }
@ -169,7 +175,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getHeight() { public function getHeight()
{
return $this->_height; return $this->_height;
} }
@ -179,7 +186,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value * @param string $value
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setHeight($value = '55.5pt') { public function setHeight($value = '55.5pt')
{
$this->_height = $value; $this->_height = $value;
return $this; return $this;
} }
@ -189,7 +197,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getMarginLeft() { public function getMarginLeft()
{
return $this->_marginLeft; return $this->_marginLeft;
} }
@ -199,7 +208,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value * @param string $value
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setMarginLeft($value = '59.25pt') { public function setMarginLeft($value = '59.25pt')
{
$this->_marginLeft = $value; $this->_marginLeft = $value;
return $this; return $this;
} }
@ -209,7 +219,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getMarginTop() { public function getMarginTop()
{
return $this->_marginTop; return $this->_marginTop;
} }
@ -219,7 +230,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value * @param string $value
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setMarginTop($value = '1.5pt') { public function setMarginTop($value = '1.5pt')
{
$this->_marginTop = $value; $this->_marginTop = $value;
return $this; return $this;
} }
@ -229,7 +241,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return boolean * @return boolean
*/ */
public function getVisible() { public function getVisible()
{
return $this->_visible; return $this->_visible;
} }
@ -239,7 +252,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param boolean $value * @param boolean $value
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setVisible($value = false) { public function setVisible($value = false)
{
$this->_visible = $value; $this->_visible = $value;
return $this; return $this;
} }
@ -249,7 +263,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getFillColor() { public function getFillColor()
{
return $this->_fillColor; return $this->_fillColor;
} }
@ -259,7 +274,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue * @param string $pValue
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{
$this->_alignment = $pValue; $this->_alignment = $pValue;
return $this; return $this;
} }
@ -269,7 +285,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function getAlignment() { public function getAlignment()
{
return $this->_alignment; return $this->_alignment;
} }
@ -278,7 +295,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
$this->_author $this->_author
. $this->_text->getHashCode() . $this->_text->getHashCode()
@ -296,7 +314,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {
@ -312,8 +331,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function __toString() { public function __toString()
{
return $this->_text->getPlainText(); return $this->_text->getPlainText();
} }
} }

View File

@ -33,7 +33,8 @@
* @package PHPExcel * @package PHPExcel
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Exception extends Exception { class PHPExcel_Exception extends Exception
{
/** /**
* Error handler callback * Error handler callback
* *
@ -43,7 +44,8 @@ class PHPExcel_Exception extends Exception {
* @param mixed $line * @param mixed $line
* @param mixed $context * @param mixed $context
*/ */
public static function errorHandlerCallback($code, $string, $file, $line, $context) { public static function errorHandlerCallback($code, $string, $file, $line, $context)
{
$e = new self($string, $code); $e = new self($string, $code);
$e->line = $line; $e->line = $line;
$e->file = $file; $e->file = $file;

View File

@ -157,7 +157,7 @@ class PHPExcel_HashTable
public function getByIndex($pIndex = 0) public function getByIndex($pIndex = 0)
{ {
if (isset($this->_keyMap[$pIndex])) { if (isset($this->_keyMap[$pIndex])) {
return $this->getByHashCode( $this->_keyMap[$pIndex] ); return $this->getByHashCode($this->_keyMap[$pIndex]);
} }
return null; return null;

View File

@ -69,7 +69,9 @@ class PHPExcel_IOFactory
/** /**
* Private constructor for PHPExcel_IOFactory * Private constructor for PHPExcel_IOFactory
*/ */
private function __construct() { } private function __construct()
{
}
/** /**
* Get search locations * Get search locations
@ -135,7 +137,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $writerType, $searchLocation['class']); $className = str_replace('{0}', $writerType, $searchLocation['class']);
$instance = new $className($phpExcel); $instance = new $className($phpExcel);
if ($instance !== NULL) { if ($instance !== null) {
return $instance; return $instance;
} }
} }
@ -165,7 +167,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $readerType, $searchLocation['class']); $className = str_replace('{0}', $readerType, $searchLocation['class']);
$instance = new $className(); $instance = new $className();
if ($instance !== NULL) { if ($instance !== null) {
return $instance; return $instance;
} }
} }
@ -222,7 +224,7 @@ class PHPExcel_IOFactory
// First, lucky guess by inspecting file extension // First, lucky guess by inspecting file extension
$pathinfo = pathinfo($pFilename); $pathinfo = pathinfo($pFilename);
$extensionType = NULL; $extensionType = null;
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
switch (strtolower($pathinfo['extension'])) { switch (strtolower($pathinfo['extension'])) {
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet

View File

@ -75,7 +75,7 @@ class PHPExcel_NamedRange
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{ {
// Validate data // Validate data
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
throw new PHPExcel_Exception('Parameters can not be null.'); throw new PHPExcel_Exception('Parameters can not be null.');
} }
@ -93,7 +93,8 @@ class PHPExcel_NamedRange
* *
* @return string * @return string
*/ */
public function getName() { public function getName()
{
return $this->_name; return $this->_name;
} }
@ -103,18 +104,19 @@ class PHPExcel_NamedRange
* @param string $value * @param string $value
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setName($value = null) { public function setName($value = null)
if ($value !== NULL) { {
if ($value !== null) {
// Old title // Old title
$oldTitle = $this->_name; $oldTitle = $this->_name;
// Re-attach // Re-attach
if ($this->_worksheet !== NULL) { if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet); $this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
} }
$this->_name = $value; $this->_name = $value;
if ($this->_worksheet !== NULL) { if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this); $this->_worksheet->getParent()->addNamedRange($this);
} }
@ -130,7 +132,8 @@ class PHPExcel_NamedRange
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function getWorksheet() { public function getWorksheet()
{
return $this->_worksheet; return $this->_worksheet;
} }
@ -140,8 +143,9 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet $value * @param PHPExcel_Worksheet $value
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setWorksheet(PHPExcel_Worksheet $value = null) { public function setWorksheet(PHPExcel_Worksheet $value = null)
if ($value !== NULL) { {
if ($value !== null) {
$this->_worksheet = $value; $this->_worksheet = $value;
} }
return $this; return $this;
@ -152,7 +156,8 @@ class PHPExcel_NamedRange
* *
* @return string * @return string
*/ */
public function getRange() { public function getRange()
{
return $this->_range; return $this->_range;
} }
@ -162,8 +167,9 @@ class PHPExcel_NamedRange
* @param string $value * @param string $value
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setRange($value = null) { public function setRange($value = null)
if ($value !== NULL) { {
if ($value !== null) {
$this->_range = $value; $this->_range = $value;
} }
return $this; return $this;
@ -174,7 +180,8 @@ class PHPExcel_NamedRange
* *
* @return bool * @return bool
*/ */
public function getLocalOnly() { public function getLocalOnly()
{
return $this->_localOnly; return $this->_localOnly;
} }
@ -184,7 +191,8 @@ class PHPExcel_NamedRange
* @param bool $value * @param bool $value
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setLocalOnly($value = false) { public function setLocalOnly($value = false)
{
$this->_localOnly = $value; $this->_localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null; $this->_scope = $value ? $this->_worksheet : null;
return $this; return $this;
@ -195,7 +203,8 @@ class PHPExcel_NamedRange
* *
* @return PHPExcel_Worksheet|null * @return PHPExcel_Worksheet|null
*/ */
public function getScope() { public function getScope()
{
return $this->_scope; return $this->_scope;
} }
@ -205,7 +214,8 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet|null $value * @param PHPExcel_Worksheet|null $value
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setScope(PHPExcel_Worksheet $value = null) { public function setScope(PHPExcel_Worksheet $value = null)
{
$this->_scope = $value; $this->_scope = $value;
$this->_localOnly = ($value == null) ? false : true; $this->_localOnly = ($value == null) ? false : true;
return $this; return $this;
@ -218,14 +228,16 @@ class PHPExcel_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_NamedRange * @return PHPExcel_NamedRange
*/ */
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
{
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet); return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -46,8 +46,9 @@ class PHPExcel_ReferenceHelper
* *
* @return PHPExcel_ReferenceHelper * @return PHPExcel_ReferenceHelper
*/ */
public static function getInstance() { public static function getInstance()
if (!isset(self::$_instance) || (self::$_instance === NULL)) { {
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper(); self::$_instance = new PHPExcel_ReferenceHelper();
} }
@ -57,7 +58,8 @@ class PHPExcel_ReferenceHelper
/** /**
* Create a new PHPExcel_ReferenceHelper * Create a new PHPExcel_ReferenceHelper
*/ */
protected function __construct() { protected function __construct()
{
} }
/** /**
@ -68,7 +70,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z') * @param string $b Second column to test (e.g. 'Z')
* @return integer * @return integer
*/ */
public static function columnSort($a, $b) { public static function columnSort($a, $b)
{
return strcasecmp(strlen($a) . $a, strlen($b) . $b); return strcasecmp(strlen($a) . $a, strlen($b) . $b);
} }
@ -80,7 +83,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z') * @param string $b Second column to test (e.g. 'Z')
* @return integer * @return integer
*/ */
public static function columnReverseSort($a, $b) { public static function columnReverseSort($a, $b)
{
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b); return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
} }
@ -92,9 +96,10 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1') * @param string $b Second cell to test (e.g. 'Z1')
* @return integer * @return integer
*/ */
public static function cellSort($a, $b) { public static function cellSort($a, $b)
sscanf($a,'%[A-Z]%d', $ac, $ar); {
sscanf($b,'%[A-Z]%d', $bc, $br); sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) { if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -110,9 +115,10 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1') * @param string $b Second cell to test (e.g. 'Z1')
* @return integer * @return integer
*/ */
public static function cellReverseSort($a, $b) { public static function cellReverseSort($a, $b)
sscanf($a,'%[A-Z]%d', $ac, $ar); {
sscanf($b,'%[A-Z]%d', $bc, $br); sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) { if ($ar == $br) {
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -130,20 +136,21 @@ class PHPExcel_ReferenceHelper
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @return boolean * @return boolean
*/ */
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) { private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
{
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress); list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn); $cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting // Is cell within the range of rows/columns if we're deleting
if ($pNumRows < 0 && if ($pNumRows < 0 &&
($cellRow >= ($beforeRow + $pNumRows)) && ($cellRow >= ($beforeRow + $pNumRows)) &&
($cellRow < $beforeRow)) { ($cellRow < $beforeRow)) {
return TRUE; return true;
} elseif ($pNumCols < 0 && } elseif ($pNumCols < 0 &&
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) && ($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
($cellColumnIndex < $beforeColumnIndex)) { ($cellColumnIndex < $beforeColumnIndex)) {
return TRUE; return true;
} }
return FALSE; return false;
} }
/** /**
@ -220,15 +227,13 @@ class PHPExcel_ReferenceHelper
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aHyperlinkCollection = $pSheet->getHyperlinkCollection(); $aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aHyperlinkCollection as $key => $value) { foreach ($aHyperlinkCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) { if ($key != $newReference) {
$pSheet->setHyperlink( $newReference, $value ); $pSheet->setHyperlink($newReference, $value);
$pSheet->setHyperlink( $key, null ); $pSheet->setHyperlink($key, null);
} }
} }
} }
@ -246,14 +251,13 @@ class PHPExcel_ReferenceHelper
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aDataValidationCollection = $pSheet->getDataValidationCollection(); $aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aDataValidationCollection as $key => $value) { foreach ($aDataValidationCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) { if ($key != $newReference) {
$pSheet->setDataValidation( $newReference, $value ); $pSheet->setDataValidation($newReference, $value);
$pSheet->setDataValidation( $key, null ); $pSheet->setDataValidation($key, null);
} }
} }
} }
@ -298,8 +302,8 @@ class PHPExcel_ReferenceHelper
foreach ($aProtectedCells as $key => $value) { foreach ($aProtectedCells as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) { if ($key != $newReference) {
$pSheet->protectCells( $newReference, $value, true ); $pSheet->protectCells($newReference, $value, true);
$pSheet->unprotectCells( $key ); $pSheet->unprotectCells($key);
} }
} }
} }
@ -372,7 +376,7 @@ class PHPExcel_ReferenceHelper
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @throws PHPExcel_Exception * @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, PHPExcel_Worksheet $pSheet = null)
{ {
$remove = ($pNumCols < 0 || $pNumRows < 0); $remove = ($pNumCols < 0 || $pNumRows < 0);
$aCellCollection = $pSheet->getCellCollection(); $aCellCollection = $pSheet->getCellCollection();
@ -442,8 +446,7 @@ class PHPExcel_ReferenceHelper
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted // Formula should be adjusted
$pSheet->getCell($newCoordinates) $pSheet->getCell($newCoordinates)
->setValue($this->updateFormulaReferences($cell->getValue(), ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} else { } else {
// Formula should not be adjusted // Formula should not be adjusted
$pSheet->getCell($newCoordinates)->setValue($cell->getValue()); $pSheet->getCell($newCoordinates)->setValue($cell->getValue());
@ -451,14 +454,12 @@ class PHPExcel_ReferenceHelper
// Clear the original cell // Clear the original cell
$pSheet->getCellCacheController()->deleteCacheData($cellID); $pSheet->getCellCacheController()->deleteCacheData($cellID);
} else { } else {
/* We don't need to update styles for rows/columns before our insertion position, /* 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 */ but we do still need to adjust any formulae in those cells */
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted // Formula should be adjusted
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} }
} }
@ -472,7 +473,7 @@ class PHPExcel_ReferenceHelper
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
// Style // Style
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i; $coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
if ($pSheet->cellExists($coordinate)) { if ($pSheet->cellExists($coordinate)) {
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); $xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
@ -594,17 +595,17 @@ class PHPExcel_ReferenceHelper
} }
} }
} }
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) ); $pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows));
} }
// Update worksheet: freeze pane // Update worksheet: freeze pane
if ($pSheet->getFreezePane() != '') { if ($pSheet->getFreezePane() != '') {
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) ); $pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows));
} }
// Page setup // Page setup
if ($pSheet->getPageSetup()->isPrintAreaSet()) { if ($pSheet->getPageSetup()->isPrintAreaSet()) {
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) ); $pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows));
} }
// Update worksheet: drawings // Update worksheet: drawings
@ -620,9 +621,7 @@ class PHPExcel_ReferenceHelper
if (count($pSheet->getParent()->getNamedRanges()) > 0) { if (count($pSheet->getParent()->getNamedRanges()) > 0) {
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) { foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) { if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
$namedRange->setRange( $namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
);
} }
} }
} }
@ -642,7 +641,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated formula * @return string Updated formula
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') { public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
{
// Update cell references in the formula // Update cell references in the formula
$formulaBlocks = explode('"', $pFormula); $formulaBlocks = explode('"', $pFormula);
$i = false; $i = false;
@ -657,8 +657,8 @@ class PHPExcel_ReferenceHelper
foreach ($matches as $match) { foreach ($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : ''; $fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3].':'.$match[4]; $fromString .= $match[3].':'.$match[4];
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows),2); $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2);
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows),2); $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2);
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
@ -682,8 +682,8 @@ class PHPExcel_ReferenceHelper
foreach ($matches as $match) { foreach ($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : ''; $fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3].':'.$match[4]; $fromString .= $match[3].':'.$match[4];
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows),0,-2); $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows),0,-2); $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
@ -781,7 +781,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range * @return string Updated cell range
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
// Is it in another worksheet? Will not have to update anything. // Is it in another worksheet? Will not have to update anything.
if (strpos($pCellRange, "!") !== false) { if (strpos($pCellRange, "!") !== false) {
return $pCellRange; return $pCellRange;
@ -805,7 +806,8 @@ class PHPExcel_ReferenceHelper
* @param string $oldName Old name (name to replace) * @param string $oldName Old name (name to replace)
* @param string $newName New name * @param string $newName New name
*/ */
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') { public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
{
if ($oldName == '') { if ($oldName == '') {
return; return;
} }
@ -813,7 +815,7 @@ class PHPExcel_ReferenceHelper
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) { foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
foreach ($sheet->getCellCollection(false) as $cellID) { foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID); $cell = $sheet->getCell($cellID);
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) { if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
$formula = $cell->getValue(); $formula = $cell->getValue();
if (strpos($formula, $oldName) !== false) { if (strpos($formula, $oldName) !== false) {
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
@ -835,7 +837,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range * @return string Updated cell range
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) { if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
// Update range // Update range
$range = PHPExcel_Cell::splitRange($pCellRange); $range = PHPExcel_Cell::splitRange($pCellRange);
@ -872,23 +875,22 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference * @return string Updated cell reference
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore // Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
// Get coordinates of $pCellReference // Get coordinates of $pCellReference
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference ); list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
// Verify which parts should be updated // Verify which parts should be updated
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)); $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
$newRow >= $beforeRow);
// Create new column reference // Create new column reference
if ($updateColumn) { if ($updateColumn) {
$newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols ); $newColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
} }
// Create new row reference // Create new row reference
@ -908,7 +910,8 @@ class PHPExcel_ReferenceHelper
* *
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public final function __clone() { final public function __clone()
{
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!"); throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
} }
} }

View File

@ -41,7 +41,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels * @param int $pValue Value in pixels
* @return int Value in EMU * @return int Value in EMU
*/ */
public static function pixelsToEMU($pValue = 0) { public static function pixelsToEMU($pValue = 0)
{
return round($pValue * 9525); return round($pValue * 9525);
} }
@ -51,7 +52,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in EMU * @param int $pValue Value in EMU
* @return int Value in pixels * @return int Value in pixels
*/ */
public static function EMUToPixels($pValue = 0) { public static function EMUToPixels($pValue = 0)
{
if ($pValue != 0) { if ($pValue != 0) {
return round($pValue / 9525); return round($pValue / 9525);
} else { } else {
@ -68,22 +70,19 @@ class PHPExcel_Shared_Drawing
* @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 * @return int Value in cell dimension
*/ */
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size // Font name and size
$name = $pDefaultFont->getName(); $name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize(); $size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined // Exact width can be determined
$colWidth = $pValue $colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
} else { } else {
// We don't have data for this particular font and size, use approximation by // We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11 // extrapolating from Calibri 11
$colWidth = $pValue * 11 $colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
} }
return $colWidth; return $colWidth;
@ -96,23 +95,19 @@ class PHPExcel_Shared_Drawing
* @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 * @return int Value in pixels
*/ */
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size // Font name and size
$name = $pDefaultFont->getName(); $name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize(); $size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined // Exact width can be determined
$colWidth = $pValue $colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
} else { } else {
// We don't have data for this particular font and size, use approximation by // We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11 // extrapolating from Calibri 11
$colWidth = $pValue * $size $colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
} }
// Round pixels to closest integer // Round pixels to closest integer
@ -127,7 +122,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels * @param int $pValue Value in pixels
* @return int Value in points * @return int Value in points
*/ */
public static function pixelsToPoints($pValue = 0) { public static function pixelsToPoints($pValue = 0)
{
return $pValue * 0.67777777; return $pValue * 0.67777777;
} }
@ -137,7 +133,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in points * @param int $pValue Value in points
* @return int Value in pixels * @return int Value in pixels
*/ */
public static function pointsToPixels($pValue = 0) { public static function pointsToPixels($pValue = 0)
{
if ($pValue != 0) { if ($pValue != 0) {
return (int) ceil($pValue * 1.333333333); return (int) ceil($pValue * 1.333333333);
} else { } else {
@ -151,7 +148,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Degrees * @param int $pValue Degrees
* @return int Angle * @return int Angle
*/ */
public static function degreesToAngle($pValue = 0) { public static function degreesToAngle($pValue = 0)
{
return (int)round($pValue * 60000); return (int)round($pValue * 60000);
} }
@ -161,7 +159,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Angle * @param int $pValue Angle
* @return int Degrees * @return int Degrees
*/ */
public static function angleToDegrees($pValue = 0) { public static function angleToDegrees($pValue = 0)
{
if ($pValue != 0) { if ($pValue != 0) {
return round($pValue / 60000); return round($pValue / 60000);
} else { } else {
@ -179,21 +178,21 @@ class PHPExcel_Shared_Drawing
public static function imagecreatefrombmp($p_sFile) public static function imagecreatefrombmp($p_sFile)
{ {
// Load the image into a string // Load the image into a string
$file = fopen($p_sFile,"rb"); $file = fopen($p_sFile, "rb");
$read = fread($file,10); $read = fread($file, 10);
while (!feof($file)&&($read<>"")) while (!feof($file) && ($read<>"")) {
$read .= fread($file,1024); $read .= fread($file, 1024);
}
$temp = unpack("H*", $read); $temp = unpack("H*", $read);
$hex = $temp[1]; $hex = $temp[1];
$header = substr($hex,0,108); $header = substr($hex, 0, 108);
// Process the header // Process the header
// Structure: http://www.fastgraph.com/help/bmp_header_format.html // Structure: http://www.fastgraph.com/help/bmp_header_format.html
if (substr($header,0,4)=="424d") if (substr($header, 0, 4)=="424d") {
{
// Cut it in parts of 2 bytes // Cut it in parts of 2 bytes
$header_parts = str_split($header,2); $header_parts = str_split($header, 2);
// Get the width 4 bytes // Get the width 4 bytes
$width = hexdec($header_parts[19].$header_parts[18]); $width = hexdec($header_parts[19].$header_parts[18]);
@ -213,7 +212,7 @@ class PHPExcel_Shared_Drawing
$image = imagecreatetruecolor($width, $height); $image = imagecreatetruecolor($width, $height);
// Grab the body from the image // Grab the body from the image
$body = substr($hex,108); $body = substr($hex, 108);
// Calculate if padding at the end-line is needed // Calculate if padding at the end-line is needed
// Divided by two to keep overview. // Divided by two to keep overview.
@ -226,15 +225,14 @@ class PHPExcel_Shared_Drawing
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
// Calculate the next DWORD-position in the body // Calculate the next DWORD-position in the body
for ($i=0;$i<$body_size;$i+=3) for ($i = 0 ; $i < $body_size ; $i += 3) {
{
// Calculate line-ending and padding // Calculate line-ending and padding
if ($x>=$width) if ($x >= $width) {
{
// If padding needed, ignore image-padding // If padding needed, ignore image-padding
// Shift i to the ending of the current 32-bit-block // Shift i to the ending of the current 32-bit-block
if ($usePadding) if ($usePadding) {
$i += $width%4; $i += $width%4;
}
// Reset horizontal position // Reset horizontal position
$x = 0; $x = 0;
@ -243,13 +241,14 @@ class PHPExcel_Shared_Drawing
$y++; $y++;
// Reached the image-height? Break the for-loop // Reached the image-height? Break the for-loop
if ($y>$height) if ($y > $height) {
break; break;
} }
}
// Calculation of the RGB-pixel (defined as BGR in image-data) // Calculation of the RGB-pixel (defined as BGR in image-data)
// Define $i_pos as absolute position in the body // Define $i_pos as absolute position in the body
$i_pos = $i*2; $i_pos = $i * 2;
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]); $r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]); $g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
$b = hexdec($body[$i_pos].$body[$i_pos+1]); $b = hexdec($body[$i_pos].$body[$i_pos+1]);
@ -268,5 +267,4 @@ class PHPExcel_Shared_Drawing
// Return image-object // Return image-object
return $image; return $image;
} }
} }

View File

@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher
{ {
return $this->_dgContainer = $dgContainer; return $this->_dgContainer = $dgContainer;
} }
} }

View File

@ -41,7 +41,7 @@ class PHPExcel_Shared_File
* @protected * @protected
* @var boolean * @var boolean
*/ */
protected static $_useUploadTempDirectory = FALSE; protected static $_useUploadTempDirectory = false;
/** /**
@ -49,9 +49,10 @@ class PHPExcel_Shared_File
* *
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false) * @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
*/ */
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) { public static function setUseUploadTempDirectory($useUploadTempDir = false)
{
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir; self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
} // function setUseUploadTempDirectory() }
/** /**
@ -59,9 +60,10 @@ class PHPExcel_Shared_File
* *
* @return boolean Use File Upload Temporary directory (true or false) * @return boolean Use File Upload Temporary directory (true or false)
*/ */
public static function getUseUploadTempDirectory() { public static function getUseUploadTempDirectory()
{
return self::$_useUploadTempDirectory; return self::$_useUploadTempDirectory;
} // function getUseUploadTempDirectory() }
/** /**
@ -70,11 +72,12 @@ class PHPExcel_Shared_File
* @param string $pFilename Filename * @param string $pFilename Filename
* @return bool * @return bool
*/ */
public static function file_exists($pFilename) { public static function file_exists($pFilename)
{
// Sick construction, but it seems that // Sick construction, but it seems that
// file_exists returns strange values when // file_exists returns strange values when
// doing the original file_exists on ZIP archives... // doing the original file_exists on ZIP archives...
if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) { if (strtolower(substr($pFilename, 0, 3)) == 'zip') {
// Open ZIP file and verify if the file exists // Open ZIP file and verify if the file exists
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6); $zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1); $archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
@ -99,7 +102,8 @@ class PHPExcel_Shared_File
* @param string $pFilename * @param string $pFilename
* @return string * @return string
*/ */
public static function realpath($pFilename) { public static function realpath($pFilename)
{
// Returnvalue // Returnvalue
$returnValue = ''; $returnValue = '';
@ -109,8 +113,8 @@ class PHPExcel_Shared_File
} }
// Found something? // Found something?
if ($returnValue == '' || ($returnValue === NULL)) { if ($returnValue == '' || ($returnValue === null)) {
$pathArray = explode('/' , $pFilename); $pathArray = explode('/', $pFilename);
while (in_array('..', $pathArray) && $pathArray[0] != '..') { while (in_array('..', $pathArray) && $pathArray[0] != '..') {
for ($i = 0; $i < count($pathArray); ++$i) { for ($i = 0; $i < count($pathArray); ++$i) {
if ($pathArray[$i] == '..' && $i > 0) { if ($pathArray[$i] == '..' && $i > 0) {
@ -137,25 +141,32 @@ class PHPExcel_Shared_File
if (self::$_useUploadTempDirectory) { if (self::$_useUploadTempDirectory) {
// use upload-directory when defined to allow running on environments having very restricted // use upload-directory when defined to allow running on environments having very restricted
// open_basedir configs // open_basedir configs
if (ini_get('upload_tmp_dir') !== FALSE) { if (ini_get('upload_tmp_dir') !== false) {
if ($temp = ini_get('upload_tmp_dir')) { if ($temp = ini_get('upload_tmp_dir')) {
if (file_exists($temp)) if (file_exists($temp)) {
return realpath($temp); return realpath($temp);
} }
} }
} }
}
// sys_get_temp_dir is only available since PHP 5.2.1 // sys_get_temp_dir is only available since PHP 5.2.1
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119 // http://php.net/manual/en/function.sys-get-temp-dir.php#94119
if ( !function_exists('sys_get_temp_dir')) { if ( !function_exists('sys_get_temp_dir')) {
if ($temp = getenv('TMP') ) { if ($temp = getenv('TMP') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
} }
if ($temp = getenv('TEMP') ) { if ($temp = getenv('TEMP') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
} }
if ($temp = getenv('TMPDIR') ) { if ($temp = getenv('TMPDIR') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
} }
// trick for creating a file in system's temporary dir // trick for creating a file in system's temporary dir
@ -174,5 +185,4 @@ class PHPExcel_Shared_File
// be called if we're running 5.2.1 or earlier // be called if we're running 5.2.1 or earlier
return realpath(sys_get_temp_dir()); return realpath(sys_get_temp_dir());
} }
} }

View File

@ -159,7 +159,7 @@ class PHPExcel_Shared_OLE
for ($i = 0; $i < $bbatBlockCount; ++$i) { for ($i = 0; $i < $bbatBlockCount; ++$i) {
$pos = $this->_getBlockOffset($mbatBlocks[$i]); $pos = $this->_getBlockOffset($mbatBlocks[$i]);
fseek($fh, $pos); fseek($fh, $pos);
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) { for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
$this->bbat[] = self::_readInt4($fh); $this->bbat[] = self::_readInt4($fh);
} }
} }
@ -198,8 +198,7 @@ class PHPExcel_Shared_OLE
{ {
static $isRegistered = false; static $isRegistered = false;
if (!$isRegistered) { if (!$isRegistered) {
stream_wrapper_register('ole-chainedblockstream', stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
'PHPExcel_Shared_OLE_ChainedBlockStream');
$isRegistered = true; $isRegistered = true;
} }
@ -266,7 +265,7 @@ class PHPExcel_Shared_OLE
public function _readPpsWks($blockId) public function _readPpsWks($blockId)
{ {
$fh = $this->getStream($blockId); $fh = $this->getStream($blockId);
for ($pos = 0; ; $pos += 128) { for ($pos = 0;; $pos += 128) {
fseek($fh, $pos, SEEK_SET); fseek($fh, $pos, SEEK_SET);
$nameUtf16 = fread($fh, 64); $nameUtf16 = fread($fh, 64);
$nameLength = self::_readInt2($fh); $nameLength = self::_readInt2($fh);
@ -280,8 +279,7 @@ class PHPExcel_Shared_OLE
$this->root = $pps; $this->root = $pps;
break; break;
case self::OLE_PPS_TYPE_DIR: case self::OLE_PPS_TYPE_DIR:
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
null, null, null, null, array());
break; break;
case self::OLE_PPS_TYPE_FILE: case self::OLE_PPS_TYPE_FILE:
$pps = new PHPExcel_Shared_OLE_PPS_File($name); $pps = new PHPExcel_Shared_OLE_PPS_File($name);
@ -304,9 +302,7 @@ class PHPExcel_Shared_OLE
$this->_list[] = $pps; $this->_list[] = $pps;
// check if the PPS tree (starting from root) is complete // check if the PPS tree (starting from root) is complete
if (isset($this->root) && if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
$this->_ppsTreeComplete($this->root->No)) {
break; break;
} }
} }
@ -473,8 +469,7 @@ class PHPExcel_Shared_OLE
// days from 1-1-1601 until the beggining of UNIX era // days from 1-1-1601 until the beggining of UNIX era
$days = 134774; $days = 134774;
// calculate seconds // calculate seconds
$big_date = $days*24*3600 + gmmktime(date("H", $date),date("i", $date),date("s", $date), $big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
date("m", $date),date("d", $date),date("Y", $date));
// multiply just to make MS happy // multiply just to make MS happy
$big_date *= 10000000; $big_date *= 10000000;
@ -513,7 +508,7 @@ class PHPExcel_Shared_OLE
} }
// factor used for separating numbers into 4 bytes parts // factor used for separating numbers into 4 bytes parts
$factor = pow(2,32); $factor = pow(2, 32);
list(, $high_part) = unpack('V', substr($string, 4, 4)); list(, $high_part) = unpack('V', substr($string, 4, 4));
list(, $low_part) = unpack('V', substr($string, 0, 4)); list(, $low_part) = unpack('V', substr($string, 0, 4));

View File

@ -5689,3 +5689,4 @@
return $p_path; return $p_path;
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------

View File

@ -57,9 +57,10 @@ class PHPExcel_Shared_ZipStreamWrapper {
/** /**
* Register wrapper * Register wrapper
*/ */
public static function register() { public static function register()
@stream_wrapper_unregister("zip"); {
@stream_wrapper_register("zip", __CLASS__); @stream_wrapper_unregister('zip');
@stream_wrapper_register('zip', __CLASS__);
} }
/** /**
@ -71,7 +72,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param string &$openedPath absolute path of the opened stream (out parameter) * @param string &$openedPath absolute path of the opened stream (out parameter)
* @return bool true on success * @return bool true on success
*/ */
public function stream_open($path, $mode, $options, &$opened_path) { public function stream_open($path, $mode, $options, &$opened_path)
{
// Check for mode // Check for mode
if ($mode{0} != 'r') { if ($mode{0} != 'r') {
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
@ -87,7 +89,7 @@ class PHPExcel_Shared_ZipStreamWrapper {
$this->_fileNameInArchive = $url['fragment']; $this->_fileNameInArchive = $url['fragment'];
$this->_position = 0; $this->_position = 0;
$this->_data = $this->_archive->getFromName( $this->_fileNameInArchive ); $this->_data = $this->_archive->getFromName($this->_fileNameInArchive);
return true; return true;
} }
@ -97,7 +99,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* *
* @return boolean * @return boolean
*/ */
public function statName() { public function statName()
{
return $this->_fileNameInArchive; return $this->_fileNameInArchive;
} }
@ -106,8 +109,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
* *
* @return boolean * @return boolean
*/ */
public function url_stat() { public function url_stat()
return $this->statName( $this->_fileNameInArchive ); {
return $this->statName($this->_fileNameInArchive);
} }
/** /**
@ -115,8 +119,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
* *
* @return boolean * @return boolean
*/ */
public function stream_stat() { public function stream_stat()
return $this->_archive->statName( $this->_fileNameInArchive ); {
return $this->_archive->statName($this->_fileNameInArchive);
} }
/** /**
@ -125,7 +130,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $count maximum number of bytes to read * @param int $count maximum number of bytes to read
* @return string * @return string
*/ */
function stream_read($count) { function stream_read($count)
{
$ret = substr($this->_data, $this->_position, $count); $ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret); $this->_position += strlen($ret);
return $ret; return $ret;
@ -137,7 +143,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* *
* @return int * @return int
*/ */
public function stream_tell() { public function stream_tell()
{
return $this->_position; return $this->_position;
} }
@ -146,7 +153,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* *
* @return bool * @return bool
*/ */
public function stream_eof() { public function stream_eof()
{
return $this->_position >= strlen($this->_data); return $this->_position >= strlen($this->_data);
} }
@ -157,7 +165,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
* @return bool * @return bool
*/ */
public function stream_seek($offset, $whence) { public function stream_seek($offset, $whence)
{
switch ($whence) { switch ($whence) {
case SEEK_SET: case SEEK_SET:
if ($offset < strlen($this->_data) && $offset >= 0) { if ($offset < strlen($this->_data) && $offset >= 0) {
@ -167,7 +176,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false; return false;
} }
break; break;
case SEEK_CUR: case SEEK_CUR:
if ($offset >= 0) { if ($offset >= 0) {
$this->_position += $offset; $this->_position += $offset;
@ -176,7 +184,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false; return false;
} }
break; break;
case SEEK_END: case SEEK_END:
if (strlen($this->_data) + $offset >= 0) { if (strlen($this->_data) + $offset >= 0) {
$this->_position = strlen($this->_data) + $offset; $this->_position = strlen($this->_data) + $offset;
@ -185,7 +192,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false; return false;
} }
break; break;
default: default:
return false; return false;
} }

View File

@ -210,7 +210,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
{ {
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->isSupervisor) { if ($this->isSupervisor) {
$pRange = $this->getSelectedCells(); $pRange = $this->getSelectedCells();
// Uppercase coordinate // Uppercase coordinate
@ -322,7 +321,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
unset($regionStyles['borders']['inside']); unset($regionStyles['borders']['inside']);
// what are the inner edges of the region when looking at the selection // what are the inner edges of the region when looking at the selection
$innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); $innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges);
// inner edges that are not touching the region should take the 'inside' border properties if they have been set // inner edges that are not touching the region should take the 'inside' border properties if they have been set
foreach ($innerEdges as $innerEdge) { foreach ($innerEdges as $innerEdge) {

View File

@ -40,7 +40,7 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_workSheet = NULL; private $_workSheet = null;
/** /**
@ -65,7 +65,7 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $pRange Cell range (i.e. A1:E10) * @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 = '', PHPExcel_Worksheet $pSheet = null)
{ {
$this->_range = $pRange; $this->_range = $pRange;
$this->_workSheet = $pSheet; $this->_workSheet = $pSheet;
@ -76,7 +76,8 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function getParent() { public function getParent()
{
return $this->_workSheet; return $this->_workSheet;
} }
@ -86,7 +87,8 @@ class PHPExcel_Worksheet_AutoFilter
* @param PHPExcel_Worksheet $pSheet * @param PHPExcel_Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function setParent(PHPExcel_Worksheet $pSheet = NULL) { public function setParent(PHPExcel_Worksheet $pSheet = null)
{
$this->_workSheet = $pSheet; $this->_workSheet = $pSheet;
return $this; return $this;
@ -97,7 +99,8 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @return string * @return string
*/ */
public function getRange() { public function getRange()
{
return $this->_range; return $this->_range;
} }
@ -108,14 +111,15 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function setRange($pRange = '') { public function setRange($pRange = '')
{
// Uppercase coordinate // Uppercase coordinate
$cellAddress = explode('!',strtoupper($pRange)); $cellAddress = explode('!',strtoupper($pRange));
if (count($cellAddress) > 1) { if (count($cellAddress) > 1) {
list($worksheet, $pRange) = $cellAddress; list($worksheet, $pRange) = $cellAddress;
} }
if (strpos($pRange,':') !== FALSE) { if (strpos($pRange, ':') !== false) {
$this->_range = $pRange; $this->_range = $pRange;
} elseif (empty($pRange)) { } elseif (empty($pRange)) {
$this->_range = ''; $this->_range = '';
@ -146,7 +150,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column * @return array of PHPExcel_Worksheet_AutoFilter_Column
*/ */
public function getColumns() { public function getColumns()
{
return $this->_columns; return $this->_columns;
} }
@ -157,7 +162,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return integer The column offset within the autofilter range * @return integer The column offset within the autofilter range
*/ */
public function testColumnInRange($column) { public function testColumnInRange($column)
{
if (empty($this->_range)) { if (empty($this->_range)) {
throw new PHPExcel_Exception("No autofilter range is defined."); throw new PHPExcel_Exception("No autofilter range is defined.");
} }
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return integer The offset of the specified column within the autofilter range * @return integer The offset of the specified column within the autofilter range
*/ */
public function getColumnOffset($pColumn) { public function getColumnOffset($pColumn)
{
return $this->testColumnInRange($pColumn); return $this->testColumnInRange($pColumn);
} }
@ -189,7 +196,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return PHPExcel_Worksheet_AutoFilter_Column
*/ */
public function getColumn($pColumn) { public function getColumn($pColumn)
{
$this->testColumnInRange($pColumn); $this->testColumnInRange($pColumn);
if (!isset($this->_columns[$pColumn])) { if (!isset($this->_columns[$pColumn])) {
@ -206,7 +214,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return PHPExcel_Worksheet_AutoFilter_Column
*/ */
public function getColumnByOffset($pColumnOffset = 0) { public function getColumnByOffset($pColumnOffset = 0)
{
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); $pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
@ -250,7 +259,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function clearColumn($pColumn) { public function clearColumn($pColumn)
{
$this->testColumnInRange($pColumn); $this->testColumnInRange($pColumn);
if (isset($this->_columns[$pColumn])) { if (isset($this->_columns[$pColumn])) {
@ -271,11 +281,12 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $toColumn Column name (e.g. B) * @param string $toColumn Column name (e.g. B)
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) { public function shiftColumn($fromColumn = null, $toColumn = null)
{
$fromColumn = strtoupper($fromColumn); $fromColumn = strtoupper($fromColumn);
$toColumn = strtoupper($toColumn); $toColumn = strtoupper($toColumn);
if (($fromColumn !== NULL) && (isset($this->_columns[$fromColumn])) && ($toColumn !== NULL)) { if (($fromColumn !== null) && (isset($this->_columns[$fromColumn])) && ($toColumn !== null)) {
$this->_columns[$fromColumn]->setParent(); $this->_columns[$fromColumn]->setParent();
$this->_columns[$fromColumn]->setColumnIndex($toColumn); $this->_columns[$fromColumn]->setColumnIndex($toColumn);
$this->_columns[$toColumn] = $this->_columns[$fromColumn]; $this->_columns[$toColumn] = $this->_columns[$fromColumn];
@ -300,7 +311,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dataSetValues = $dataSet['filterValues']; $dataSetValues = $dataSet['filterValues'];
$blanks = $dataSet['blanks']; $blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return $blanks; return $blanks;
} }
return in_array($cellValue, $dataSetValues); return in_array($cellValue, $dataSetValues);
@ -317,7 +328,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dateSet = $dataSet['filterValues']; $dateSet = $dataSet['filterValues'];
$blanks = $dataSet['blanks']; $blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return $blanks; return $blanks;
} }
@ -338,12 +349,12 @@ class PHPExcel_Worksheet_AutoFilter
} }
foreach ($dateSet as $dateValue) { foreach ($dateSet as $dateValue) {
// Use of substr to extract value at the appropriate group level // Use of substr to extract value at the appropriate group level
if (substr($dtVal,0,strlen($dateValue)) == $dateValue) if (substr($dtVal,0,strlen($dateValue)) == $dateValue) {
return TRUE; return true;
} }
} }
}
return FALSE; return false;
} }
/** /**
@ -357,12 +368,12 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dataSet = $ruleSet['filterRules']; $dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join']; $join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : FALSE; $customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
if (!$customRuleForBlanks) { if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE // Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return FALSE; return false;
} }
} }
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); $returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
@ -392,13 +403,13 @@ class PHPExcel_Worksheet_AutoFilter
} elseif ($rule['value'] == '') { } elseif ($rule['value'] == '') {
switch ($rule['operator']) { switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
$retVal = (($cellValue == '') || ($cellValue === NULL)); $retVal = (($cellValue == '') || ($cellValue === null));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL :
$retVal = (($cellValue != '') && ($cellValue !== NULL)); $retVal = (($cellValue != '') && ($cellValue !== null));
break; break;
default : default :
$retVal = TRUE; $retVal = true;
break; break;
} }
} else { } else {
@ -411,8 +422,9 @@ class PHPExcel_Worksheet_AutoFilter
$returnVal = $returnVal || $retVal; $returnVal = $returnVal || $retVal;
// Break as soon as we have a TRUE match for OR joins, // Break as soon as we have a TRUE match for OR joins,
// to avoid unnecessary additional code execution // to avoid unnecessary additional code execution
if ($returnVal) if ($returnVal) {
return $returnVal; return $returnVal;
}
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND : case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND :
$returnVal = $returnVal && $retVal; $returnVal = $returnVal && $retVal;
@ -433,18 +445,18 @@ class PHPExcel_Worksheet_AutoFilter
private static function _filterTestInPeriodDateSet($cellValue, $monthSet) private static function _filterTestInPeriodDateSet($cellValue, $monthSet)
{ {
// Blank cells are always ignored, so return a FALSE // Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return FALSE; return false;
} }
if (is_numeric($cellValue)) { if (is_numeric($cellValue)) {
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue)); $dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
if (in_array($dateValue, $monthSet)) { if (in_array($dateValue, $monthSet)) {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
/** /**
@ -467,7 +479,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$rDateType = PHPExcel_Calculation_Functions::getReturnDateType(); $rDateType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$val = $maxVal = NULL; $val = $maxVal = null;
$ruleValues = array(); $ruleValues = array();
$baseDate = PHPExcel_Calculation_DateTime::DATENOW(); $baseDate = PHPExcel_Calculation_DateTime::DATENOW();
@ -480,22 +492,22 @@ class PHPExcel_Worksheet_AutoFilter
$baseDate = strtotime('-7 days', $baseDate); $baseDate = strtotime('-7 days', $baseDate);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
$baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('-1 month',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH :
$baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('+1 month',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
$baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('-3 month',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
$baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('+3 month',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
$baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('-1 year',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR :
$baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $baseDate = strtotime('+1 year',gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
} }
@ -508,30 +520,30 @@ class PHPExcel_Worksheet_AutoFilter
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE :
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate)); $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))); $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR : 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_LASTYEAR :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR : 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))); $maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y', $baseDate))); $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER : 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_LASTQUARTER :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER : case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
$thisMonth = date('m', $baseDate); $thisMonth = date('m', $baseDate);
$thisQuarter = floor(--$thisMonth / 3); $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) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y', $baseDate))); $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH : 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_LASTMONTH :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH : 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))); $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate))); $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK : 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_LASTWEEK :
@ -555,33 +567,20 @@ class PHPExcel_Worksheet_AutoFilter
} }
// Set the filter column rule attributes ready for writing // Set the filter column rule attributes ready for writing
$filterColumn->setAttributes(array( 'val' => $val, $filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
'maxVal' => $maxVal
)
);
// Set the rules for identifying rows for hide/show // Set the rules for identifying rows for hide/show
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
'value' => $val $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
);
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN,
'value' => $maxVal
);
PHPExcel_Calculation_Functions::setReturnDateType($rDateType); PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
return array( return array('method' => '_filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND
)
);
} }
private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) { private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue)
{
$range = $columnID.$startRow.':'.$columnID.$endRow; $range = $columnID.$startRow.':'.$columnID.$endRow;
$dataValues = PHPExcel_Calculation_Functions::flattenArray( $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->_workSheet->rangeToArray($range, null, true, false));
$this->_workSheet->rangeToArray($range,NULL,TRUE,FALSE)
);
$dataValues = array_filter($dataValues); $dataValues = array_filter($dataValues);
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
@ -605,7 +604,7 @@ class PHPExcel_Worksheet_AutoFilter
// The heading row should always be visible // The heading row should always be visible
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL; // echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE); $this->_workSheet->getRowDimension($rangeStart[1])->setVisible(true);
$columnFilterTests = array(); $columnFilterTests = array();
foreach ($this->_columns as $columnID => $filterColumn) { foreach ($this->_columns as $columnID => $filterColumn) {
@ -619,17 +618,15 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValues[] = $rule->getValue(); $ruleValues[] = $rule->getValue();
} }
// Test if we want to include blanks in our filter criteria // Test if we want to include blanks in our filter criteria
$blanks = FALSE; $blanks = false;
$ruleDataSet = array_filter($ruleValues); $ruleDataSet = array_filter($ruleValues);
if (count($ruleValues) != count($ruleDataSet)) if (count($ruleValues) != count($ruleDataSet))
$blanks = TRUE; $blanks = true;
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) { if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values // Filter on absolute values
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInSimpleDataSet', 'method' => '_filterTestInSimpleDataSet',
'arguments' => array( 'filterValues' => $ruleDataSet, 'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
'blanks' => $blanks
)
); );
} else { } else {
// Filter on date group values // Filter on date group values
@ -669,14 +666,12 @@ class PHPExcel_Worksheet_AutoFilter
$arguments['dateTime'] = array_filter($arguments['dateTime']); $arguments['dateTime'] = array_filter($arguments['dateTime']);
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInDateGroupSet', 'method' => '_filterTestInDateGroupSet',
'arguments' => array( 'filterValues' => $arguments, 'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
'blanks' => $blanks
)
); );
} }
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER : case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER :
$customRuleForBlanks = FALSE; $customRuleForBlanks = false;
$ruleValues = array(); $ruleValues = array();
// Build a list of the filter value selections // Build a list of the filter value selections
foreach ($rules as $rule) { foreach ($rules as $rule) {
@ -687,21 +682,16 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValue = preg_quote($ruleValue); $ruleValue = preg_quote($ruleValue);
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue); $ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
if (trim($ruleValue) == '') { if (trim($ruleValue) == '') {
$customRuleForBlanks = TRUE; $customRuleForBlanks = true;
$ruleValue = trim($ruleValue); $ruleValue = trim($ruleValue);
} }
} }
$ruleValues[] = array( 'operator' => $rule->getOperator(), $ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
'value' => $ruleValue
);
} }
$join = $filterColumn->getJoin(); $join = $filterColumn->getJoin();
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
'join' => $join,
'customRuleForBlanks' => $customRuleForBlanks
)
); );
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER : case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
@ -714,19 +704,17 @@ class PHPExcel_Worksheet_AutoFilter
// Number (Average) based // Number (Average) based
// Calculate the average // Calculate the average
$averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')'; $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL, $this->_workSheet->getCell('A1')); $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,null, $this->_workSheet->getCell('A1'));
// Set above/below rule based on greaterThan or LessTan // Set above/below rule based on greaterThan or LessTan
$operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) $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_GREATERTHAN
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
$ruleValues[] = array( 'operator' => $operator, $ruleValues[] = array('operator' => $operator,
'value' => $average 'value' => $average
); );
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
); );
} else { } else {
// Date based // Date based
@ -774,18 +762,12 @@ class PHPExcel_Worksheet_AutoFilter
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) $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_GREATERTHANOREQUAL
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
$ruleValues[] = array( 'operator' => $operator, $ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
'value' => $maxVal
);
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
);
$filterColumn->setAttributes(
array('maxVal' => $maxVal)
); );
$filterColumn->setAttributes(array('maxVal' => $maxVal));
break; break;
} }
} }
@ -796,7 +778,7 @@ class PHPExcel_Worksheet_AutoFilter
// Execute the column tests for each row in the autoFilter range to determine show/hide, // Execute the column tests for each row in the autoFilter range to determine show/hide,
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) { for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
// echo 'Testing Row = ', $row,PHP_EOL; // echo 'Testing Row = ', $row,PHP_EOL;
$result = TRUE; $result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) { foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL; // echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue(); $cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
@ -805,16 +787,14 @@ class PHPExcel_Worksheet_AutoFilter
$result = $result && $result = $result &&
call_user_func_array( call_user_func_array(
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']), array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
array( array($cellValue, $columnFilterTest['arguments'])
$cellValue,
$columnFilterTest['arguments']
)
); );
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL; // echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result) if (!$result) {
break; break;
} }
}
// Set show/hide for the row based on the result of the autoFilter result // Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL; // echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
$this->_workSheet->getRowDimension($row)->setVisible($result); $this->_workSheet->getRowDimension($row)->setVisible($result);
@ -827,13 +807,14 @@ class PHPExcel_Worksheet_AutoFilter
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {
if ($key == '_workSheet') { if ($key == '_workSheet') {
// Detach from worksheet // Detach from worksheet
$this->{$key} = NULL; $this->{$key} = null;
} else { } else {
$this->{$key} = clone $value; $this->{$key} = clone $value;
} }
@ -858,5 +839,4 @@ class PHPExcel_Worksheet_AutoFilter
public function __toString() { public function __toString() {
return (string) $this->_range; return (string) $this->_range;
} }
} }

View File

@ -220,7 +220,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* *
* @return string * @return string
*/ */
public function getJoin() { public function getJoin()
{
return $this->_join; return $this->_join;
} }
@ -409,5 +410,4 @@ class PHPExcel_Worksheet_AutoFilter_Column
} }
} }
} }
} }

View File

@ -333,7 +333,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
unset($pValue[$key]); unset($pValue[$key]);
} else { } else {
// Work out what the dateTime grouping will be // Work out what the dateTime grouping will be
$grouping = max($grouping, array_search($key,self::$_dateTimeGroups)); $grouping = max($grouping, array_search($key, self::$_dateTimeGroups));
} }
} }
if (count($pValue) == 0) { if (count($pValue) == 0) {

View File

@ -267,5 +267,4 @@ class PHPExcel_Worksheet_ColumnDimension
} }
} }
} }
} }

View File

@ -59,7 +59,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getFilename() { public function getFilename()
{
return basename($this->_path); return basename($this->_path);
} }
@ -68,7 +69,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getIndexedFilename() { public function getIndexedFilename()
{
$fileName = $this->getFilename(); $fileName = $this->getFilename();
$fileName = str_replace(' ', '_', $fileName); $fileName = str_replace(' ', '_', $fileName);
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension(); return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
@ -79,7 +81,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getExtension() { public function getExtension()
{
$exploded = explode(".", basename($this->_path)); $exploded = explode(".", basename($this->_path));
return $exploded[count($exploded) - 1]; return $exploded[count($exploded) - 1];
} }
@ -89,7 +92,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getPath() { public function getPath()
{
return $this->_path; return $this->_path;
} }
@ -101,7 +105,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing * @return PHPExcel_Worksheet_Drawing
*/ */
public function setPath($pValue = '', $pVerifyFile = true) { public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) { if ($pVerifyFile) {
if (file_exists($pValue)) { if (file_exists($pValue)) {
$this->_path = $pValue; $this->_path = $pValue;
@ -124,7 +129,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
$this->_path $this->_path
. parent::getHashCode() . parent::getHashCode()
@ -135,7 +141,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -118,7 +118,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return boolean * @return boolean
*/ */
public function getVisible() { public function getVisible()
{
return $this->_visible; return $this->_visible;
} }
@ -128,7 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setVisible($pValue = false) { public function setVisible($pValue = false)
{
$this->_visible = $pValue; $this->_visible = $pValue;
return $this; return $this;
} }
@ -138,7 +140,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getBlurRadius() { public function getBlurRadius()
{
return $this->_blurRadius; return $this->_blurRadius;
} }
@ -148,7 +151,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setBlurRadius($pValue = 6) { public function setBlurRadius($pValue = 6)
{
$this->_blurRadius = $pValue; $this->_blurRadius = $pValue;
return $this; return $this;
} }
@ -158,7 +162,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getDistance() { public function getDistance()
{
return $this->_distance; return $this->_distance;
} }
@ -168,7 +173,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setDistance($pValue = 2) { public function setDistance($pValue = 2)
{
$this->_distance = $pValue; $this->_distance = $pValue;
return $this; return $this;
} }
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getDirection() { public function getDirection()
{
return $this->_direction; return $this->_direction;
} }
@ -188,7 +195,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setDirection($pValue = 0) { public function setDirection($pValue = 0)
{
$this->_direction = $pValue; $this->_direction = $pValue;
return $this; return $this;
} }
@ -198,7 +206,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getAlignment() { public function getAlignment()
{
return $this->_alignment; return $this->_alignment;
} }
@ -208,7 +217,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setAlignment($pValue = 0) { public function setAlignment($pValue = 0)
{
$this->_alignment = $pValue; $this->_alignment = $pValue;
return $this; return $this;
} }
@ -218,7 +228,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getColor() { public function getColor()
{
return $this->_color; return $this->_color;
} }
@ -229,7 +240,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setColor(PHPExcel_Style_Color $pValue = null) { public function setColor(PHPExcel_Style_Color $pValue = null)
{
$this->_color = $pValue; $this->_color = $pValue;
return $this; return $this;
} }
@ -239,7 +251,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getAlpha() { public function getAlpha()
{
return $this->_alpha; return $this->_alpha;
} }
@ -249,7 +262,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setAlpha($pValue = 0) { public function setAlpha($pValue = 0)
{
$this->_alpha = $pValue; $this->_alpha = $pValue;
return $this; return $this;
} }
@ -259,7 +273,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
($this->_visible ? 't' : 'f') ($this->_visible ? 't' : 'f')
. $this->_blurRadius . $this->_blurRadius
@ -275,7 +290,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -15,7 +15,7 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not,241 write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
@ -192,7 +192,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getOddHeader() { public function getOddHeader()
{
return $this->_oddHeader; return $this->_oddHeader;
} }
@ -202,7 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setOddHeader($pValue) { public function setOddHeader($pValue)
{
$this->_oddHeader = $pValue; $this->_oddHeader = $pValue;
return $this; return $this;
} }
@ -212,7 +214,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getOddFooter() { public function getOddFooter()
{
return $this->_oddFooter; return $this->_oddFooter;
} }
@ -222,7 +225,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setOddFooter($pValue) { public function setOddFooter($pValue)
{
$this->_oddFooter = $pValue; $this->_oddFooter = $pValue;
return $this; return $this;
} }
@ -232,7 +236,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getEvenHeader() { public function getEvenHeader()
{
return $this->_evenHeader; return $this->_evenHeader;
} }
@ -242,7 +247,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setEvenHeader($pValue) { public function setEvenHeader($pValue)
{
$this->_evenHeader = $pValue; $this->_evenHeader = $pValue;
return $this; return $this;
} }
@ -252,7 +258,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getEvenFooter() { public function getEvenFooter()
{
return $this->_evenFooter; return $this->_evenFooter;
} }
@ -262,7 +269,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setEvenFooter($pValue) { public function setEvenFooter($pValue)
{
$this->_evenFooter = $pValue; $this->_evenFooter = $pValue;
return $this; return $this;
} }
@ -272,7 +280,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getFirstHeader() { public function getFirstHeader()
{
return $this->_firstHeader; return $this->_firstHeader;
} }
@ -282,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstHeader($pValue) { public function setFirstHeader($pValue)
{
$this->_firstHeader = $pValue; $this->_firstHeader = $pValue;
return $this; return $this;
} }
@ -292,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getFirstFooter() { public function getFirstFooter()
{
return $this->_firstFooter; return $this->_firstFooter;
} }
@ -302,7 +313,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstFooter($pValue) { public function setFirstFooter($pValue)
{
$this->_firstFooter = $pValue; $this->_firstFooter = $pValue;
return $this; return $this;
} }
@ -312,7 +324,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getDifferentOddEven() { public function getDifferentOddEven()
{
return $this->_differentOddEven; return $this->_differentOddEven;
} }
@ -322,7 +335,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setDifferentOddEven($pValue = false) { public function setDifferentOddEven($pValue = false)
{
$this->_differentOddEven = $pValue; $this->_differentOddEven = $pValue;
return $this; return $this;
} }
@ -332,7 +346,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getDifferentFirst() { public function getDifferentFirst()
{
return $this->_differentFirst; return $this->_differentFirst;
} }
@ -342,7 +357,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setDifferentFirst($pValue = false) { public function setDifferentFirst($pValue = false)
{
$this->_differentFirst = $pValue; $this->_differentFirst = $pValue;
return $this; return $this;
} }
@ -352,7 +368,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getScaleWithDocument() { public function getScaleWithDocument()
{
return $this->_scaleWithDocument; return $this->_scaleWithDocument;
} }
@ -362,7 +379,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setScaleWithDocument($pValue = true) { public function setScaleWithDocument($pValue = true)
{
$this->_scaleWithDocument = $pValue; $this->_scaleWithDocument = $pValue;
return $this; return $this;
} }
@ -372,7 +390,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getAlignWithMargins() { public function getAlignWithMargins()
{
return $this->_alignWithMargins; return $this->_alignWithMargins;
} }
@ -382,7 +401,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setAlignWithMargins($pValue = true) { public function setAlignWithMargins($pValue = true)
{
$this->_alignWithMargins = $pValue; $this->_alignWithMargins = $pValue;
return $this; return $this;
} }
@ -395,7 +415,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) { public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
{
$this->_headerFooterImages[$location] = $image; $this->_headerFooterImages[$location] = $image;
return $this; return $this;
} }
@ -407,7 +428,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function removeImage($location = self::IMAGE_HEADER_LEFT) { public function removeImage($location = self::IMAGE_HEADER_LEFT)
{
if (isset($this->_headerFooterImages[$location])) { if (isset($this->_headerFooterImages[$location])) {
unset($this->_headerFooterImages[$location]); unset($this->_headerFooterImages[$location]);
} }
@ -421,7 +443,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setImages($images) { public function setImages($images)
{
if (!is_array($images)) { if (!is_array($images)) {
throw new PHPExcel_Exception('Invalid parameter!'); throw new PHPExcel_Exception('Invalid parameter!');
} }
@ -435,15 +458,28 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return PHPExcel_Worksheet_HeaderFooterDrawing[] * @return PHPExcel_Worksheet_HeaderFooterDrawing[]
*/ */
public function getImages() { public function getImages()
{
// Sort array // Sort array
$images = array(); $images = array();
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT]; if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) {
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER]; $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT]; }
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT]; if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) {
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER]; $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT]; }
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
$images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
$images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
$images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
$images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
}
$this->_headerFooterImages = $images; $this->_headerFooterImages = $images;
return $this->_headerFooterImages; return $this->_headerFooterImages;
@ -452,7 +488,8 @@ class PHPExcel_Worksheet_HeaderFooter
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -195,7 +195,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var boolean * @var boolean
*/ */
private $_fitToPage = FALSE; private $_fitToPage = false;
/** /**
* Fit To Height * Fit To Height
@ -251,28 +251,28 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var boolean * @var boolean
*/ */
private $_horizontalCentered = FALSE; private $_horizontalCentered = false;
/** /**
* Center page vertically * Center page vertically
* *
* @var boolean * @var boolean
*/ */
private $_verticalCentered = FALSE; private $_verticalCentered = false;
/** /**
* Print area * Print area
* *
* @var string * @var string
*/ */
private $_printArea = NULL; private $_printArea = null;
/** /**
* First page number * First page number
* *
* @var int * @var int
*/ */
private $_firstPageNumber = NULL; private $_firstPageNumber = null;
/** /**
* Create a new PHPExcel_Worksheet_PageSetup * Create a new PHPExcel_Worksheet_PageSetup
@ -286,7 +286,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int * @return int
*/ */
public function getPaperSize() { public function getPaperSize()
{
return $this->_paperSize; return $this->_paperSize;
} }
@ -296,7 +297,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) { public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
{
$this->_paperSize = $pValue; $this->_paperSize = $pValue;
return $this; return $this;
} }
@ -306,7 +308,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return string * @return string
*/ */
public function getOrientation() { public function getOrientation()
{
return $this->_orientation; return $this->_orientation;
} }
@ -316,7 +319,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) { public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
{
$this->_orientation = $pValue; $this->_orientation = $pValue;
return $this; return $this;
} }
@ -326,7 +330,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getScale() { public function getScale()
{
return $this->_scale; return $this->_scale;
} }
@ -341,7 +346,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setScale($pValue = 100, $pUpdate = true) { public function setScale($pValue = 100, $pUpdate = true)
{
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 0, where 0 results in 100 // but it is apparently still able to handle any scale >= 0, where 0 results in 100
if (($pValue >= 0) || is_null($pValue)) { if (($pValue >= 0) || is_null($pValue)) {
@ -370,7 +376,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToPage($pValue = TRUE) { public function setFitToPage($pValue = true)
{
$this->_fitToPage = $pValue; $this->_fitToPage = $pValue;
return $this; return $this;
} }
@ -380,7 +387,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getFitToHeight() { public function getFitToHeight()
{
return $this->_fitToHeight; return $this->_fitToHeight;
} }
@ -391,10 +399,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToHeight($pValue = 1, $pUpdate = TRUE) { public function setFitToHeight($pValue = 1, $pUpdate = true)
{
$this->_fitToHeight = $pValue; $this->_fitToHeight = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = TRUE; $this->_fitToPage = true;
} }
return $this; return $this;
} }
@ -404,7 +413,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getFitToWidth() { public function getFitToWidth()
{
return $this->_fitToWidth; return $this->_fitToWidth;
} }
@ -415,10 +425,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToWidth($pValue = 1, $pUpdate = TRUE) { public function setFitToWidth($pValue = 1, $pUpdate = true)
{
$this->_fitToWidth = $pValue; $this->_fitToWidth = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = TRUE; $this->_fitToPage = true;
} }
return $this; return $this;
} }
@ -428,7 +439,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return boolean * @return boolean
*/ */
public function isColumnsToRepeatAtLeftSet() { public function isColumnsToRepeatAtLeftSet()
{
if (is_array($this->_columnsToRepeatAtLeft)) { if (is_array($this->_columnsToRepeatAtLeft)) {
if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') { if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
return true; return true;
@ -443,7 +455,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return array Containing start column and end column, empty array if option unset * @return array Containing start column and end column, empty array if option unset
*/ */
public function getColumnsToRepeatAtLeft() { public function getColumnsToRepeatAtLeft()
{
return $this->_columnsToRepeatAtLeft; return $this->_columnsToRepeatAtLeft;
} }
@ -453,7 +466,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset * @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setColumnsToRepeatAtLeft($pValue = null) { public function setColumnsToRepeatAtLeft($pValue = null)
{
if (is_array($pValue)) { if (is_array($pValue)) {
$this->_columnsToRepeatAtLeft = $pValue; $this->_columnsToRepeatAtLeft = $pValue;
} }
@ -467,7 +481,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pEnd * @param string $pEnd
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') { public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A')
{
$this->_columnsToRepeatAtLeft = array($pStart, $pEnd); $this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
return $this; return $this;
} }
@ -477,7 +492,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return boolean * @return boolean
*/ */
public function isRowsToRepeatAtTopSet() { public function isRowsToRepeatAtTopSet()
{
if (is_array($this->_rowsToRepeatAtTop)) { if (is_array($this->_rowsToRepeatAtTop)) {
if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) { if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
return true; return true;
@ -492,7 +508,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return array Containing start column and end column, empty array if option unset * @return array Containing start column and end column, empty array if option unset
*/ */
public function getRowsToRepeatAtTop() { public function getRowsToRepeatAtTop()
{
return $this->_rowsToRepeatAtTop; return $this->_rowsToRepeatAtTop;
} }
@ -502,7 +519,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset * @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setRowsToRepeatAtTop($pValue = null) { public function setRowsToRepeatAtTop($pValue = null)
{
if (is_array($pValue)) { if (is_array($pValue)) {
$this->_rowsToRepeatAtTop = $pValue; $this->_rowsToRepeatAtTop = $pValue;
} }
@ -516,7 +534,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pEnd * @param int $pEnd
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) { public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1)
{
$this->_rowsToRepeatAtTop = array($pStart, $pEnd); $this->_rowsToRepeatAtTop = array($pStart, $pEnd);
return $this; return $this;
} }
@ -526,7 +545,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return bool * @return bool
*/ */
public function getHorizontalCentered() { public function getHorizontalCentered()
{
return $this->_horizontalCentered; return $this->_horizontalCentered;
} }
@ -536,7 +556,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value * @param bool $value
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setHorizontalCentered($value = false) { public function setHorizontalCentered($value = false)
{
$this->_horizontalCentered = $value; $this->_horizontalCentered = $value;
return $this; return $this;
} }
@ -546,7 +567,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return bool * @return bool
*/ */
public function getVerticalCentered() { public function getVerticalCentered()
{
return $this->_verticalCentered; return $this->_verticalCentered;
} }
@ -556,7 +578,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value * @param bool $value
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setVerticalCentered($value = false) { public function setVerticalCentered($value = false)
{
$this->_verticalCentered = $value; $this->_verticalCentered = $value;
return $this; return $this;
} }
@ -571,7 +594,8 @@ class PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return string * @return string
*/ */
public function getPrintArea($index = 0) { public function getPrintArea($index = 0)
{
if ($index == 0) { if ($index == 0) {
return $this->_printArea; return $this->_printArea;
} }
@ -591,7 +615,8 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1 * Print areas are numbered from 1
* @return boolean * @return boolean
*/ */
public function isPrintAreaSet($index = 0) { public function isPrintAreaSet($index = 0)
{
if ($index == 0) { if ($index == 0) {
return !is_null($this->_printArea); return !is_null($this->_printArea);
} }
@ -608,9 +633,10 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1 * Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function clearPrintArea($index = 0) { public function clearPrintArea($index = 0)
{
if ($index == 0) { if ($index == 0) {
$this->_printArea = NULL; $this->_printArea = null;
} else { } else {
$printAreas = explode(',', $this->_printArea); $printAreas = explode(',', $this->_printArea);
if (isset($printAreas[$index-1])) { if (isset($printAreas[$index-1])) {
@ -642,12 +668,13 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) { public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
if (strpos($value,'!') !== false) { {
if (strpos($value, '!') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.'); throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
} elseif (strpos($value,':') === false) { } elseif (strpos($value, ':') === false) {
throw new PHPExcel_Exception('Cell coordinate must be a range of cells.'); throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
} elseif (strpos($value,'$') !== false) { } elseif (strpos($value, '$') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
} }
$value = strtoupper($value); $value = strtoupper($value);
@ -677,7 +704,7 @@ class PHPExcel_Worksheet_PageSetup
if ($index > count($printAreas)) { if ($index > count($printAreas)) {
throw new PHPExcel_Exception('Invalid index for setting print range.'); throw new PHPExcel_Exception('Invalid index for setting print range.');
} }
$printAreas = array_merge(array_slice($printAreas,0, $index),array($value),array_slice($printAreas, $index)); $printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index));
$this->_printArea = implode(',', $printAreas); $this->_printArea = implode(',', $printAreas);
} }
} else { } else {
@ -700,7 +727,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function addPrintArea($value, $index = -1) { public function addPrintArea($value, $index = -1)
{
return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT); return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
} }
@ -758,7 +786,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int * @return int
*/ */
public function getFirstPageNumber() { public function getFirstPageNumber()
{
return $this->_firstPageNumber; return $this->_firstPageNumber;
} }
@ -768,7 +797,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $value * @param int $value
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstPageNumber($value = null) { public function setFirstPageNumber($value = null)
{
$this->_firstPageNumber = $value; $this->_firstPageNumber = $value;
return $this; return $this;
} }
@ -778,14 +808,16 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function resetFirstPageNumber() { public function resetFirstPageNumber()
{
return $this->setFirstPageNumber(null); return $this->setFirstPageNumber(null);
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -166,7 +166,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function isProtectionEnabled() { function isProtectionEnabled()
{
return $this->_sheet || return $this->_sheet ||
$this->_objects || $this->_objects ||
$this->_scenarios || $this->_scenarios ||
@ -190,7 +191,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSheet() { function getSheet()
{
return $this->_sheet; return $this->_sheet;
} }
@ -200,7 +202,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSheet($pValue = false) { function setSheet($pValue = false)
{
$this->_sheet = $pValue; $this->_sheet = $pValue;
return $this; return $this;
} }
@ -210,7 +213,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getObjects() { function getObjects()
{
return $this->_objects; return $this->_objects;
} }
@ -220,7 +224,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setObjects($pValue = false) { function setObjects($pValue = false)
{
$this->_objects = $pValue; $this->_objects = $pValue;
return $this; return $this;
} }
@ -230,7 +235,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getScenarios() { function getScenarios()
{
return $this->_scenarios; return $this->_scenarios;
} }
@ -240,7 +246,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setScenarios($pValue = false) { function setScenarios($pValue = false)
{
$this->_scenarios = $pValue; $this->_scenarios = $pValue;
return $this; return $this;
} }
@ -250,7 +257,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatCells() { function getFormatCells()
{
return $this->_formatCells; return $this->_formatCells;
} }
@ -260,7 +268,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatCells($pValue = false) { function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue; $this->_formatCells = $pValue;
return $this; return $this;
} }
@ -270,7 +279,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatColumns() { function getFormatColumns()
{
return $this->_formatColumns; return $this->_formatColumns;
} }
@ -280,7 +290,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatColumns($pValue = false) { function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue; $this->_formatColumns = $pValue;
return $this; return $this;
} }
@ -290,7 +301,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatRows() { function getFormatRows()
{
return $this->_formatRows; return $this->_formatRows;
} }
@ -300,7 +312,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatRows($pValue = false) { function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue; $this->_formatRows = $pValue;
return $this; return $this;
} }
@ -310,7 +323,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertColumns() { function getInsertColumns()
{
return $this->_insertColumns; return $this->_insertColumns;
} }
@ -320,7 +334,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertColumns($pValue = false) { function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue; $this->_insertColumns = $pValue;
return $this; return $this;
} }
@ -330,7 +345,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertRows() { function getInsertRows()
{
return $this->_insertRows; return $this->_insertRows;
} }
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertRows($pValue = false) { function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue; $this->_insertRows = $pValue;
return $this; return $this;
} }
@ -350,7 +367,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertHyperlinks() { function getInsertHyperlinks()
{
return $this->_insertHyperlinks; return $this->_insertHyperlinks;
} }
@ -360,7 +378,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertHyperlinks($pValue = false) { function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue; $this->_insertHyperlinks = $pValue;
return $this; return $this;
} }
@ -370,7 +389,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteColumns() { function getDeleteColumns()
{
return $this->_deleteColumns; return $this->_deleteColumns;
} }
@ -380,7 +400,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteColumns($pValue = false) { function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue; $this->_deleteColumns = $pValue;
return $this; return $this;
} }
@ -390,7 +411,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteRows() { function getDeleteRows()
{
return $this->_deleteRows; return $this->_deleteRows;
} }
@ -400,7 +422,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteRows($pValue = false) { function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue; $this->_deleteRows = $pValue;
return $this; return $this;
} }
@ -410,7 +433,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectLockedCells() { function getSelectLockedCells()
{
return $this->_selectLockedCells; return $this->_selectLockedCells;
} }
@ -420,7 +444,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectLockedCells($pValue = false) { function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue; $this->_selectLockedCells = $pValue;
return $this; return $this;
} }
@ -430,7 +455,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSort() { function getSort()
{
return $this->_sort; return $this->_sort;
} }
@ -440,7 +466,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSort($pValue = false) { function setSort($pValue = false)
{
$this->_sort = $pValue; $this->_sort = $pValue;
return $this; return $this;
} }
@ -450,7 +477,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getAutoFilter() { function getAutoFilter()
{
return $this->_autoFilter; return $this->_autoFilter;
} }
@ -460,7 +488,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setAutoFilter($pValue = false) { function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue; $this->_autoFilter = $pValue;
return $this; return $this;
} }
@ -470,7 +499,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getPivotTables() { function getPivotTables()
{
return $this->_pivotTables; return $this->_pivotTables;
} }
@ -480,7 +510,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPivotTables($pValue = false) { function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue; $this->_pivotTables = $pValue;
return $this; return $this;
} }
@ -490,7 +521,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectUnlockedCells() { function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells; return $this->_selectUnlockedCells;
} }
@ -500,7 +532,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectUnlockedCells($pValue = false) { function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue; $this->_selectUnlockedCells = $pValue;
return $this; return $this;
} }
@ -510,7 +543,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return string * @return string
*/ */
function getPassword() { function getPassword()
{
return $this->_password; return $this->_password;
} }
@ -521,7 +555,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPassword($pValue = '', $pAlreadyHashed = false) { function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
} }
@ -532,7 +567,8 @@ class PHPExcel_Worksheet_Protection
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -65,7 +65,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getIncludeCharts() { public function getIncludeCharts()
{
return $this->_includeCharts; return $this->_includeCharts;
} }
@ -93,7 +94,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getPreCalculateFormulas() { public function getPreCalculateFormulas()
{
return $this->_preCalculateFormulas; return $this->_preCalculateFormulas;
} }
@ -105,7 +107,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @param boolean $pValue Pre-Calculate Formulas? * @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter * @return PHPExcel_Writer_IWriter
*/ */
public function setPreCalculateFormulas($pValue = TRUE) { public function setPreCalculateFormulas($pValue = true)
{
$this->_preCalculateFormulas = (boolean) $pValue; $this->_preCalculateFormulas = (boolean) $pValue;
return $this; return $this;
} }
@ -115,7 +118,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getUseDiskCaching() { public function getUseDiskCaching()
{
return $this->_useDiskCaching; return $this->_useDiskCaching;
} }
@ -127,10 +131,11 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception when directory does not exist * @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007 * @return PHPExcel_Writer_Excel2007
*/ */
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) { public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue; $this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) { if ($pDirectory !== null) {
if (is_dir($pDirectory)) { if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory; $this->_diskCachingDirectory = $pDirectory;
} else { } else {
@ -145,7 +150,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return string * @return string
*/ */
public function getDiskCachingDirectory() { public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory; return $this->_diskCachingDirectory;
} }
} }

View File

@ -257,7 +257,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
if ($this->_spreadSheet->hasRibbonBinObjects()) { if ($this->_spreadSheet->hasRibbonBinObjects()) {
$tmpRootPath=dirname($tmpRibbonTarget).'/'; $tmpRootPath=dirname($tmpRibbonTarget).'/';
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write $ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write
foreach ($ribbonBinObjects as $aPath=>$aContent) { foreach ($ribbonBinObjects as $aPath => $aContent) {
$objZip->addFromString($tmpRootPath.$aPath, $aContent); $objZip->addFromString($tmpRootPath.$aPath, $aContent);
} }
//the rels for files //the rels for files

View File

@ -32,7 +32,8 @@
* @package PHPExcel_Writer_Excel2007 * @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart { class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{
/** /**
* Write charts to XML format * Write charts to XML format
* *
@ -41,7 +42,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output * @return string XML Output
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function writeChart(PHPExcel_Chart $pChart = null) { public function writeChart(PHPExcel_Chart $pChart = null)
{
// Create XML writer // Create XML writer
$objWriter = null; $objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {
@ -115,7 +117,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) { private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{
if (is_null($title)) { if (is_null($title)) {
return; return;
} }
@ -159,7 +162,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) { private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{
if (is_null($legend)) { if (is_null($legend)) {
return; return;
} }
@ -213,7 +217,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines ) private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
{ {
if (is_null($plotArea)) { if (is_null($plotArea)) {
return; return;
@ -349,7 +353,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDataLbls($objWriter, $chartLayout) { private function _writeDataLbls($objWriter, $chartLayout)
{
$objWriter->startElement('c:dLbls'); $objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey'); $objWriter->startElement('c:showLegendKey');
@ -403,7 +408,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) { private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{
$objWriter->startElement('c:catAx'); $objWriter->startElement('c:catAx');
if ($id1 > 0) { if ($id1 > 0) {
@ -524,7 +530,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) { private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{
$objWriter->startElement('c:valAx'); $objWriter->startElement('c:valAx');
if ($id2 > 0) { if ($id2 > 0) {
@ -1004,7 +1011,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array * @return string|array
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private static function _getChartType($plotArea) { private static function _getChartType($plotArea)
{
$groupCount = $plotArea->getPlotGroupCount(); $groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) { if ($groupCount == 1) {
@ -1036,7 +1044,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) { private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotGroup)) { if (is_null($plotGroup)) {
return; return;
} }
@ -1209,7 +1218,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) { private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{
if (is_null($plotSeriesLabel)) { if (is_null($plotSeriesLabel)) {
return; return;
} }
@ -1246,7 +1256,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) { private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
} }
@ -1337,7 +1348,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) { private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
} }
@ -1383,7 +1395,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) { private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{
$objWriter->startElement('c:layout'); $objWriter->startElement('c:layout');
if (!is_null($layout)) { if (!is_null($layout)) {
@ -1451,7 +1464,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeAlternateContent($objWriter) { private function _writeAlternateContent($objWriter)
{
$objWriter->startElement('mc:AlternateContent'); $objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1480,7 +1494,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePrintSettings($objWriter) { private function _writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings'); $objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter'); $objWriter->startElement('c:headerFooter');

View File

@ -144,7 +144,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() ); $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 PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension); $extension = explode('/', $extension);
@ -153,14 +153,15 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
} }
if (!isset( $aMediaContentTypes[$extension]) ) { if (!isset( $aMediaContentTypes[$extension])) {
$aMediaContentTypes[$extension] = $mimeType; $aMediaContentTypes[$extension] = $mimeType;
$this->_writeDefaultContentType($objWriter, $extension, $mimeType); $this->_writeDefaultContentType($objWriter, $extension, $mimeType);
} }
} }
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ? if ($pPHPExcel->hasRibbonBinObjects()) {
//we need to write "Extension" but not already write for media content // Some additional objects in the ribbon ?
// we need to write "Extension" but not already write for media content
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes)); $tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) { foreach ($tabRibbonTypes as $aRibbonType) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor $mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor

View File

@ -240,21 +240,21 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('name', $customProperty); $objWriter->writeAttribute('name', $customProperty);
switch ($propertyType) { switch ($propertyType) {
case 'i' : case 'i':
$objWriter->writeElement('vt:i4', $propertyValue); $objWriter->writeElement('vt:i4', $propertyValue);
break; break;
case 'f' : case 'f':
$objWriter->writeElement('vt:r8', $propertyValue); $objWriter->writeElement('vt:r8', $propertyValue);
break; break;
case 'b' : case 'b':
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false'); $objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
break; break;
case 'd' : case 'd':
$objWriter->startElement('vt:filetime'); $objWriter->startElement('vt:filetime');
$objWriter->writeRawData(date(DATE_W3C, $propertyValue)); $objWriter->writeRawData(date(DATE_W3C, $propertyValue));
$objWriter->endElement(); $objWriter->endElement();
break; break;
default : default:
$objWriter->writeElement('vt:lpwstr', $propertyValue); $objWriter->writeElement('vt:lpwstr', $propertyValue);
break; break;
} }

View File

@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
* @return string XML Output * @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(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
{ {
// Create XML writer // Create XML writer
$objWriter = null; $objWriter = null;
@ -82,7 +82,6 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
} }
} }
$objWriter->endElement(); $objWriter->endElement();
// Return // Return

View File

@ -259,10 +259,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// Underline // Underline
$underlineType = $element->getFont()->getUnderline(); $underlineType = $element->getFont()->getUnderline();
switch ($underlineType) { switch ($underlineType) {
case 'single' : case 'single':
$underlineType = 'sng'; $underlineType = 'sng';
break; break;
case 'double' : case 'double':
$underlineType = 'dbl'; $underlineType = 'dbl';
break; break;
} }
@ -304,7 +304,8 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param array $stringTable Stringtable * @param array $stringTable Stringtable
* @return array * @return array
*/ */
public function flipStringTable($stringTable = array()) { public function flipStringTable($stringTable = array())
{
// Return value // Return value
$returnValue = array(); $returnValue = array();

View File

@ -269,8 +269,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// pane // pane
$pane = 'topRight'; $pane = 'topRight';
$objWriter->startElement('pane'); $objWriter->startElement('pane');
if ($xSplit > 1) if ($xSplit > 1) {
$objWriter->writeAttribute('xSplit', $xSplit - 1); $objWriter->writeAttribute('xSplit', $xSplit - 1);
}
if ($ySplit > 1) { if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1); $objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft'; $pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
@ -491,9 +492,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode())); $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++); $objWriter->writeAttribute('priority', $id++);
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) { && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
$objWriter->writeAttribute('operator', $conditional->getOperatorType()); $objWriter->writeAttribute('operator', $conditional->getOperatorType());
} }
@ -761,18 +760,18 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$range = PHPExcel_Cell::splitRange($autoFilterRange); $range = PHPExcel_Cell::splitRange($autoFilterRange);
$range = $range[0]; $range = $range[0];
// Strip any worksheet ref // Strip any worksheet ref
if (strpos($range[0],'!') !== false) { if (strpos($range[0], '!') !== false) {
list($ws, $range[0]) = explode('!', $range[0]); list($ws, $range[0]) = explode('!', $range[0]);
} }
$range = implode(':', $range); $range = implode(':', $range);
$objWriter->writeAttribute('ref', str_replace('$','', $range)); $objWriter->writeAttribute('ref', str_replace('$', '', $range));
$columns = $pSheet->getAutoFilter()->getColumns(); $columns = $pSheet->getAutoFilter()->getColumns();
if (count($columns > 0)) { if (count($columns > 0)) {
foreach ($columns as $columnID => $column) { foreach ($columns as $columnID => $column) {
$rules = $column->getRules(); $rules = $column->getRules();
if (count($rules > 0)) { if (count($rules) > 0) {
$objWriter->startElement('filterColumn'); $objWriter->startElement('filterColumn');
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID)); $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
@ -813,7 +812,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) { if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters // Date Group filters
foreach ($rule->getValue() as $key => $value) { foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value); if ($value > '') {
$objWriter->writeAttribute($key, $value);
}
} }
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping()); $objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else { } else {
@ -830,7 +831,6 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
} }
} }
} }
$objWriter->endElement(); $objWriter->endElement();
} }
} }

View File

@ -1135,8 +1135,7 @@ class PHPExcel_Writer_Excel5_Parser
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) { } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
return $token; return $token;
} } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
return $token; return $token;
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) { } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
@ -1253,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Parser
$this->_advance(); $this->_advance();
return $result; return $result;
// If it's an error code // If it's an error code
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A'){ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A') {
$result = $this->_createTree($this->_current_token, 'ptgErr', ''); $result = $this->_createTree($this->_current_token, 'ptgErr', '');
$this->_advance(); $this->_advance();
return $result; return $result;
@ -1361,45 +1360,39 @@ class PHPExcel_Writer_Excel5_Parser
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) { preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
// if it's a range A1:B2 or $A$1:$B$2
// must be an error? // must be an error?
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2) // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error? // must be an error?
//$result = $this->_current_token; //$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2) // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error? // must be an error?
//$result = $this->_current_token; //$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', ''); $result = $this->_createTree($this->_current_token, '', '');
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (is_numeric($this->_current_token)) {
// If it's a number or a percent // If it's a number or a percent
elseif (is_numeric($this->_current_token)) {
if ($this->_lookahead == '%') { if ($this->_lookahead == '%') {
$result = $this->_createTree('ptgPercent', $this->_current_token, ''); $result = $this->_createTree('ptgPercent', $this->_current_token, '');
$this->_advance(); // Skip the percentage operator once we've pre-built that tree $this->_advance(); // Skip the percentage operator once we've pre-built that tree
@ -1408,15 +1401,12 @@ class PHPExcel_Writer_Excel5_Parser
} }
$this->_advance(); $this->_advance();
return $result; return $result;
} } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
// if it's a function call // if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
$result = $this->_func(); $result = $this->_func();
return $result; return $result;
} }
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token. throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.", lookahead: ".$this->_lookahead.", current char: ".$this->_current_char);
", lookahead: ".$this->_lookahead.
", current char: ".$this->_current_char);
} }
/** /**