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;
} // function getCellCacheController()
/**
* Code to execute when this worksheet is unset()
*
*/
function __destruct() {
$this->disconnectWorksheets();
}
/**
* Get properties
*

View File

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

View File

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

View File

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

View File

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

View File

@ -252,19 +252,22 @@ class PHPExcel_Shared_OLERead {
$name = str_replace("\x00", "", substr($d,0,$nameSize));
$this->props[] = array (
'name' => $name,
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);
// tmp helper to simplify checks
$upName = strtoupper($name);
// 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;
}
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry
if ($name == 'Root Entry' || $name == 'ROOT ENTRY' || $name == 'R') {
$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
* @return PHPExcel_Style
*/
public function applyFromArray($pStyles = null, $pAdvanced = true) {
public function applyFromArray($pStyles = null, $pAdvanced = true)
{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
@ -474,7 +475,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_Fill
*/
public function getFill() {
public function getFill()
{
return $this->_fill;
}
@ -483,7 +485,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_Font
*/
public function getFont() {
public function getFont()
{
return $this->_font;
}
@ -504,7 +507,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_Borders
*/
public function getBorders() {
public function getBorders()
{
return $this->_borders;
}
@ -513,7 +517,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_Alignment
*/
public function getAlignment() {
public function getAlignment()
{
return $this->_alignment;
}
@ -522,7 +527,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_NumberFormat
*/
public function getNumberFormat() {
public function getNumberFormat()
{
return $this->_numberFormat;
}
@ -531,7 +537,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return PHPExcel_Style_Conditional[]
*/
public function getConditionalStyles() {
public function getConditionalStyles()
{
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
* @return PHPExcel_Style
*/
public function setConditionalStyles($pValue = null) {
public function setConditionalStyles($pValue = null)
{
if (is_array($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
*/
public function getProtection() {
public function getProtection()
{
return $this->_protection;
}
@ -562,7 +571,8 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
$hashConditionals = '';
foreach ($this->_conditionalStyles as $conditional) {
$hashConditionals .= $conditional->getHashCode();

View File

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