Merge branch 'develop' of https://github.com/PHPOffice/PHPExcel into calcEngine

Conflicts:
	Classes/PHPExcel.php
	Classes/PHPExcel/Worksheet.php
This commit is contained in:
Mark Baker 2013-02-13 09:09:28 +00:00
commit 5451b63cdc
11 changed files with 1496 additions and 1444 deletions

View File

@ -177,6 +177,14 @@ class PHPExcel
return $this->_calculationEngine; return $this->_calculationEngine;
} // function getCellCacheController() } // function getCellCacheController()
/**
* Code to execute when this worksheet is unset()
*
*/
function __destruct() {
$this->disconnectWorksheets();
}
/** /**
* Get properties * Get properties
* *

View File

@ -110,7 +110,7 @@ class PHPExcel_Chart_PlotArea
/** /**
* Set Plot Series * Set Plot Series
* *
* @param array of PHPExcel_Chart_DataSeries * @param [PHPExcel_Chart_DataSeries]
*/ */
public function setPlotSeries($plotSeries = array()) { public function setPlotSeries($plotSeries = array()) {
$this->_plotSeries = $plotSeries; $this->_plotSeries = $plotSeries;

View File

@ -43,7 +43,6 @@ class PHPExcel_DocumentProperties
const PROPERTY_TYPE_STRING = 's'; const PROPERTY_TYPE_STRING = 's';
const PROPERTY_TYPE_UNKNOWN = 'u'; const PROPERTY_TYPE_UNKNOWN = 'u';
/** /**
* Creator * Creator
* *

View File

@ -132,7 +132,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
* *
* @return string * @return string
*/ */
public function __toString() { public function __toString()
{
return $this->getPlainText(); return $this->getPlainText();
} }
@ -168,7 +169,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
$hashElements = ''; $hashElements = '';
foreach ($this->_richTextElements as $element) { foreach ($this->_richTextElements as $element) {
$hashElements .= $element->getHashCode(); $hashElements .= $element->getHashCode();
@ -183,7 +185,8 @@ class PHPExcel_RichText 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

@ -113,7 +113,8 @@ class PHPExcel_Settings
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setZipClass($zipClass) { public static function setZipClass($zipClass)
{
if (($zipClass === self::PCLZIP) || if (($zipClass === self::PCLZIP) ||
($zipClass === self::ZIPARCHIVE)) { ($zipClass === self::ZIPARCHIVE)) {
self::$_zipClass = $zipClass; self::$_zipClass = $zipClass;
@ -125,13 +126,14 @@ class PHPExcel_Settings
/** /**
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) * Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
* for Zip file management * or Zip file management
* *
* @return string Name of the Zip handler Class that PHPExcel is configured to use * @return string Name of the Zip handler Class that PHPExcel is configured to use
* for Zip file management * for Zip file management
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
*/ */
public static function getZipClass() { public static function getZipClass()
{
return self::$_zipClass; return self::$_zipClass;
} // function getZipClass() } // function getZipClass()
@ -141,7 +143,8 @@ class PHPExcel_Settings
* *
* @return string Name of the cacheing method * @return string Name of the cacheing method
*/ */
public static function getCacheStorageMethod() { public static function getCacheStorageMethod()
{
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod(); return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
} // function getCacheStorageMethod() } // function getCacheStorageMethod()
@ -151,7 +154,8 @@ class PHPExcel_Settings
* *
* @return string Name of the class currently being used for cacheing * @return string Name of the class currently being used for cacheing
*/ */
public static function getCacheStorageClass() { public static function getCacheStorageClass()
{
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass(); return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
} // function getCacheStorageClass() } // function getCacheStorageClass()
@ -163,8 +167,11 @@ class PHPExcel_Settings
* @param array $arguments Optional configuration arguments for the cacheing method * @param array $arguments Optional configuration arguments for the cacheing method
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, public static function setCacheStorageMethod(
$arguments = array()) { $method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
$arguments = array()
)
{
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments); return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
} // function setCacheStorageMethod() } // function setCacheStorageMethod()
@ -175,7 +182,8 @@ class PHPExcel_Settings
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setLocale($locale='en_us') { public static function setLocale($locale='en_us')
{
return PHPExcel_Calculation::getInstance()->setLocale($locale); return PHPExcel_Calculation::getInstance()->setLocale($locale);
} // function setLocale() } // function setLocale()
@ -186,9 +194,11 @@ class PHPExcel_Settings
* @param string $libraryName Internal reference name of the library * @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
* @param string $libraryBaseDir Directory path to the library's base folder * @param string $libraryBaseDir Directory path to the library's base folder
*
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setChartRenderer($libraryName, $libraryBaseDir) { public static function setChartRenderer($libraryName, $libraryBaseDir)
{
if (!self::setChartRendererName($libraryName)) if (!self::setChartRendererName($libraryName))
return FALSE; return FALSE;
return self::setChartRendererPath($libraryBaseDir); return self::setChartRendererPath($libraryBaseDir);
@ -200,9 +210,11 @@ class PHPExcel_Settings
* *
* @param string $libraryName Internal reference name of the library * @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
*
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setChartRendererName($libraryName) { public static function setChartRendererName($libraryName)
{
if (!in_array($libraryName,self::$_chartRenderers)) { if (!in_array($libraryName,self::$_chartRenderers)) {
return FALSE; return FALSE;
} }
@ -219,7 +231,8 @@ class PHPExcel_Settings
* @param string $libraryBaseDir Directory path to the library's base folder * @param string $libraryBaseDir Directory path to the library's base folder
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setChartRendererPath($libraryBaseDir) { public static function setChartRendererPath($libraryBaseDir)
{
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
return FALSE; return FALSE;
} }
@ -236,7 +249,8 @@ class PHPExcel_Settings
* currently configured to use * currently configured to use
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
*/ */
public static function getChartRendererName() { public static function getChartRendererName()
{
return self::$_chartRendererName; return self::$_chartRendererName;
} // function getChartRendererName() } // function getChartRendererName()
@ -247,7 +261,8 @@ class PHPExcel_Settings
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is * @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
* currently configured to use * currently configured to use
*/ */
public static function getChartRendererPath() { public static function getChartRendererPath()
{
return self::$_chartRendererPath; return self::$_chartRendererPath;
} // function getChartRendererPath() } // function getChartRendererPath()
@ -260,9 +275,11 @@ class PHPExcel_Settings
* PHPExcel_Settings::PDF_RENDERER_DOMPDF * PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF * or PHPExcel_Settings::PDF_RENDERER_MPDF
* @param string $libraryBaseDir Directory path to the library's base folder * @param string $libraryBaseDir Directory path to the library's base folder
*
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setPdfRenderer($libraryName, $libraryBaseDir) { public static function setPdfRenderer($libraryName, $libraryBaseDir)
{
if (!self::setPdfRendererName($libraryName)) if (!self::setPdfRendererName($libraryName))
return FALSE; return FALSE;
return self::setPdfRendererPath($libraryBaseDir); return self::setPdfRendererPath($libraryBaseDir);
@ -276,9 +293,11 @@ class PHPExcel_Settings
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
* PHPExcel_Settings::PDF_RENDERER_DOMPDF * PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF * or PHPExcel_Settings::PDF_RENDERER_MPDF
*
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setPdfRendererName($libraryName) { public static function setPdfRendererName($libraryName)
{
if (!in_array($libraryName,self::$_pdfRenderers)) { if (!in_array($libraryName,self::$_pdfRenderers)) {
return FALSE; return FALSE;
} }
@ -295,7 +314,8 @@ class PHPExcel_Settings
* @param string $libraryBaseDir Directory path to the library's base folder * @param string $libraryBaseDir Directory path to the library's base folder
* @return boolean Success or failure * @return boolean Success or failure
*/ */
public static function setPdfRendererPath($libraryBaseDir) { public static function setPdfRendererPath($libraryBaseDir)
{
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
return FALSE; return FALSE;
} }
@ -314,7 +334,8 @@ class PHPExcel_Settings
* PHPExcel_Settings::PDF_RENDERER_DOMPDF * PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF * or PHPExcel_Settings::PDF_RENDERER_MPDF
*/ */
public static function getPdfRendererName() { public static function getPdfRendererName()
{
return self::$_pdfRendererName; return self::$_pdfRendererName;
} // function getPdfRendererName() } // function getPdfRendererName()
@ -325,7 +346,8 @@ class PHPExcel_Settings
* @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is * @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
* currently configured to use * currently configured to use
*/ */
public static function getPdfRendererPath() { public static function getPdfRendererPath()
{
return self::$_pdfRendererPath; return self::$_pdfRendererPath;
} // function getPdfRendererPath() } // function getPdfRendererPath()

View File

@ -252,19 +252,22 @@ class PHPExcel_Shared_OLERead {
$name = str_replace("\x00", "", substr($d,0,$nameSize)); $name = str_replace("\x00", "", substr($d,0,$nameSize));
$this->props[] = array ( $this->props[] = array (
'name' => $name, 'name' => $name,
'type' => $type, 'type' => $type,
'startBlock' => $startBlock, 'startBlock' => $startBlock,
'size' => $size); 'size' => $size);
// tmp helper to simplify checks
$upName = strtoupper($name);
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
if (($name == 'Workbook') || ($name == 'Book') || ($name == 'WORKBOOK') || ($name == 'BOOK')) { if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
$this->wrkbook = count($this->props) - 1; $this->wrkbook = count($this->props) - 1;
} }
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry // Root entry
if ($name == 'Root Entry' || $name == 'ROOT ENTRY' || $name == 'R') {
$this->rootentry = count($this->props) - 1; $this->rootentry = count($this->props) - 1;
} }

View File

@ -195,7 +195,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Style * @return PHPExcel_Style
*/ */
public function applyFromArray($pStyles = null, $pAdvanced = true) { public function applyFromArray($pStyles = null, $pAdvanced = true)
{
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
@ -474,7 +475,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function getFill() { public function getFill()
{
return $this->_fill; return $this->_fill;
} }
@ -483,7 +485,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function getFont() { public function getFont()
{
return $this->_font; return $this->_font;
} }
@ -504,7 +507,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Borders * @return PHPExcel_Style_Borders
*/ */
public function getBorders() { public function getBorders()
{
return $this->_borders; return $this->_borders;
} }
@ -513,7 +517,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function getAlignment() { public function getAlignment()
{
return $this->_alignment; return $this->_alignment;
} }
@ -522,7 +527,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_NumberFormat * @return PHPExcel_Style_NumberFormat
*/ */
public function getNumberFormat() { public function getNumberFormat()
{
return $this->_numberFormat; return $this->_numberFormat;
} }
@ -531,7 +537,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Conditional[] * @return PHPExcel_Style_Conditional[]
*/ */
public function getConditionalStyles() { public function getConditionalStyles()
{
return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell());
} }
@ -541,7 +548,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles
* @return PHPExcel_Style * @return PHPExcel_Style
*/ */
public function setConditionalStyles($pValue = null) { public function setConditionalStyles($pValue = null)
{
if (is_array($pValue)) { if (is_array($pValue)) {
$this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue);
} }
@ -553,7 +561,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return PHPExcel_Style_Protection * @return PHPExcel_Style_Protection
*/ */
public function getProtection() { public function getProtection()
{
return $this->_protection; return $this->_protection;
} }
@ -562,7 +571,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
$hashConditionals = ''; $hashConditionals = '';
foreach ($this->_conditionalStyles as $conditional) { foreach ($this->_conditionalStyles as $conditional) {
$hashConditionals .= $conditional->getHashCode(); $hashConditionals .= $conditional->getHashCode();

View File

@ -56,7 +56,8 @@ class PHPExcel_WorksheetIterator implements Iterator
* *
* @param PHPExcel $subject * @param PHPExcel $subject
*/ */
public function __construct(PHPExcel $subject = null) { public function __construct(PHPExcel $subject = null)
{
// Set subject // Set subject
$this->_subject = $subject; $this->_subject = $subject;
} }
@ -64,14 +65,16 @@ class PHPExcel_WorksheetIterator implements Iterator
/** /**
* Destructor * Destructor
*/ */
public function __destruct() { public function __destruct()
{
unset($this->_subject); unset($this->_subject);
} }
/** /**
* Rewind iterator * Rewind iterator
*/ */
public function rewind() { public function rewind()
{
$this->_position = 0; $this->_position = 0;
} }
@ -80,7 +83,8 @@ class PHPExcel_WorksheetIterator implements Iterator
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function current() { public function current()
{
return $this->_subject->getSheet($this->_position); return $this->_subject->getSheet($this->_position);
} }
@ -89,14 +93,16 @@ class PHPExcel_WorksheetIterator implements Iterator
* *
* @return int * @return int
*/ */
public function key() { public function key()
{
return $this->_position; return $this->_position;
} }
/** /**
* Next value * Next value
*/ */
public function next() { public function next()
{
++$this->_position; ++$this->_position;
} }
@ -105,7 +111,8 @@ class PHPExcel_WorksheetIterator implements Iterator
* *
* @return boolean * @return boolean
*/ */
public function valid() { public function valid()
{
return $this->_position < $this->_subject->getSheetCount(); return $this->_position < $this->_subject->getSheetCount();
} }
} }