Another large chunk of namespacing work

This commit is contained in:
MarkBaker 2015-06-02 00:07:00 +01:00
parent c86a72ac1a
commit 0d956534eb
14 changed files with 429 additions and 586 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
<?php <?php
namespace PHPExcel\Reader\Excel2007;
/** /**
* PHPExcel * PHPExcel_Reader_Excel2007_Chart
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +27,7 @@
* @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##
*/ */
class Chart
/**
* PHPExcel_Reader_Excel2007_Chart
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2007_Chart
{ {
private static function getAttribute($component, $name, $format) private static function getAttribute($component, $name, $format)
{ {
@ -57,7 +52,7 @@ class PHPExcel_Reader_Excel2007_Chart
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} elseif (isset($color["indexed"])) { } elseif (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB(); return \PHPExcel\Style\Color::indexedColor($color["indexed"]-7, $background)->getARGB();
} }
} }
@ -161,9 +156,9 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
if ($plotAreaLayout == null) { if ($plotAreaLayout == null) {
$plotAreaLayout = new PHPExcel_Chart_Layout(); $plotAreaLayout = new \PHPExcel\Chart\Layout();
} }
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); $plotArea = new \PHPExcel\Chart\PlotArea($plotAreaLayout, $plotSeries);
self::setChartAttributes($plotAreaLayout, $plotAttributes); self::setChartAttributes($plotAreaLayout, $plotAttributes);
break; break;
case "plotVisOnly": case "plotVisOnly":
@ -192,13 +187,13 @@ class PHPExcel_Reader_Excel2007_Chart
break; break;
} }
} }
$legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay); $legend = new \PHPExcel\Chart\Legend($legendPos, $legendLayout, $legendOverlay);
break; break;
} }
} }
} }
} }
$chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); $chart = new \PHPExcel\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
return $chart; return $chart;
} }
@ -225,7 +220,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
return new PHPExcel_Chart_Title($caption, $titleLayout); return new \PHPExcel\Chart\Title($caption, $titleLayout);
} }
private static function chartLayoutDetails($chartDetail, $namespacesChartMeta) private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
@ -242,7 +237,7 @@ class PHPExcel_Reader_Excel2007_Chart
// echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL; // echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::getAttribute($detail, 'val', 'string'); $layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
} }
return new PHPExcel_Chart_Layout($layout); return new \PHPExcel\Chart\Layout($layout);
} }
private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
@ -293,7 +288,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
} }
return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); return new \PHPExcel\Chart\DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
} }
@ -303,24 +298,24 @@ class PHPExcel_Reader_Excel2007_Chart
$seriesSource = (string) $seriesDetail->strRef->f; $seriesSource = (string) $seriesDetail->strRef->f;
$seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's'); $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new \PHPExcel\Chart\DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->numRef)) { } elseif (isset($seriesDetail->numRef)) {
$seriesSource = (string) $seriesDetail->numRef->f; $seriesSource = (string) $seriesDetail->numRef->f;
$seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new \PHPExcel\Chart\DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlStrRef)) { } elseif (isset($seriesDetail->multiLvlStrRef)) {
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f; $seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
$seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new \PHPExcel\Chart\DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlNumRef)) { } elseif (isset($seriesDetail->multiLvlNumRef)) {
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f; $seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
$seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new \PHPExcel\Chart\DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} }
return null; return null;
} }
@ -398,7 +393,7 @@ class PHPExcel_Reader_Excel2007_Chart
private static function parseRichText($titleDetailPart = null) private static function parseRichText($titleDetailPart = null)
{ {
$value = new PHPExcel_RichText(); $value = new \PHPExcel\RichText();
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
if (isset($titleDetailElement->t)) { if (isset($titleDetailElement->t)) {
@ -416,7 +411,7 @@ class PHPExcel_Reader_Excel2007_Chart
$fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string')); $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
if (!is_null($fontColor)) { if (!is_null($fontColor)) {
$objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor))); $objText->getFont()->setColor(new \PHPExcel\Style\Color(self::readColor($fontColor)));
} }
$bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean'); $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
@ -441,11 +436,11 @@ class PHPExcel_Reader_Excel2007_Chart
$underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string')); $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
if (!is_null($underscore)) { if (!is_null($underscore)) {
if ($underscore == 'sng') { if ($underscore == 'sng') {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); $objText->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE);
} elseif ($underscore == 'dbl') { } elseif ($underscore == 'dbl') {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); $objText->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_DOUBLE);
} else { } else {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE); $objText->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_NONE);
} }
} }

View File

@ -1,6 +1,9 @@
<?php <?php
namespace PHPExcel\Reader\Excel2007;
/** /**
* PHPExcel * PHPExcel_Reader_Excel2007_Theme
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,16 +27,7 @@
* @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##
*/ */
class Theme
/**
* PHPExcel_Reader_Excel2007_Theme
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2007_Theme
{ {
/** /**
* Theme Name * Theme Name
@ -66,7 +60,7 @@ class PHPExcel_Reader_Excel2007_Theme
/** /**
* Create a new PHPExcel_Theme * Create a new Theme
* *
*/ */
public function __construct($themeName, $colourSchemeName, $colourMap) public function __construct($themeName, $colourSchemeName, $colourMap)

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Reader\Excel5;
/** /**
* PHPExcel_Reader_Excel5_Escher * PHPExcel_Reader_Excel5_Escher
* *
@ -20,12 +22,12 @@
* 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
* @package PHPExcel_Reader_Excel5 * @package \PHPExcel\Reader\Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @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##
*/ */
class PHPExcel_Reader_Excel5_Escher class Escher
{ {
const DGGCONTAINER = 0xF000; const DGGCONTAINER = 0xF000;
const BSTORECONTAINER = 0xF001; const BSTORECONTAINER = 0xF001;
@ -75,7 +77,7 @@ class PHPExcel_Reader_Excel5_Escher
private $object; private $object;
/** /**
* Create a new PHPExcel_Reader_Excel5_Escher instance * Create a new Escher instance
* *
* @param mixed $object * @param mixed $object
*/ */
@ -101,7 +103,7 @@ class PHPExcel_Reader_Excel5_Escher
// Parse Escher stream // Parse Escher stream
while ($this->pos < $this->dataSize) { while ($this->pos < $this->dataSize) {
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2); $fbt = \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos + 2);
switch ($fbt) { switch ($fbt) {
case self::DGGCONTAINER: case self::DGGCONTAINER:
@ -173,15 +175,15 @@ class PHPExcel_Reader_Excel5_Escher
private function readDefault() private function readDefault()
{ {
// offset 0; size: 2; recVer and recInstance // offset 0; size: 2; recVer and recInstance
$verInstance = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos); $verInstance = \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos);
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2); $fbt = \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos + 2);
// bit: 0-3; mask: 0x000F; recVer // bit: 0-3; mask: 0x000F; recVer
$recVer = (0x000F & $verInstance) >> 0; $recVer = (0x000F & $verInstance) >> 0;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -193,16 +195,16 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readDggContainer() private function readDggContainer()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dggContainer = new PHPExcel_Shared_Escher_DggContainer(); $dggContainer = new \PHPExcel\Shared\Escher\DggContainer();
$this->object->setDggContainer($dggContainer); $this->object->setDggContainer($dggContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); $reader = new Escher($dggContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -211,7 +213,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readDgg() private function readDgg()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -223,16 +225,16 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readBstoreContainer() private function readBstoreContainer()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); $bstoreContainer = new \PHPExcel\Shared\Escher\DggContainer\BstoreContainer();
$this->object->setBstoreContainer($bstoreContainer); $this->object->setBstoreContainer($bstoreContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); $reader = new Escher($bstoreContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -244,16 +246,16 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// add BSE to BstoreContainer // add BSE to BstoreContainer
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); $BSE = new \PHPExcel\Shared\Escher\DggContainer\BstoreContainer\BSE();
$this->object->addBSE($BSE); $this->object->addBSE($BSE);
$BSE->setBLIPType($recInstance); $BSE->setBLIPType($recInstance);
@ -268,16 +270,16 @@ class PHPExcel_Reader_Excel5_Escher
$rgbUid = substr($recordData, 2, 16); $rgbUid = substr($recordData, 2, 16);
// offset: 18; size: 2; tag // offset: 18; size: 2; tag
$tag = PHPExcel_Reader_Excel5::getInt2d($recordData, 18); $tag = \PHPExcel\Reader\Excel5::getInt2d($recordData, 18);
// offset: 20; size: 4; size of BLIP in bytes // offset: 20; size: 4; size of BLIP in bytes
$size = PHPExcel_Reader_Excel5::getInt4d($recordData, 20); $size = \PHPExcel\Reader\Excel5::getInt4d($recordData, 20);
// offset: 24; size: 4; number of references to this BLIP // offset: 24; size: 4; number of references to this BLIP
$cRef = PHPExcel_Reader_Excel5::getInt4d($recordData, 24); $cRef = \PHPExcel\Reader\Excel5::getInt4d($recordData, 24);
// offset: 28; size: 4; MSOFO file offset // offset: 28; size: 4; MSOFO file offset
$foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28); $foDelay = \PHPExcel\Reader\Excel5::getInt4d($recordData, 28);
// offset: 32; size: 1; unused1 // offset: 32; size: 1; unused1
$unused1 = ord($recordData{32}); $unused1 = ord($recordData{32});
@ -298,7 +300,7 @@ class PHPExcel_Reader_Excel5_Escher
$blipData = substr($recordData, 36 + $cbName); $blipData = substr($recordData, 36 + $cbName);
// record is a container, read contents // record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($BSE); $reader = new \PHPExcel\Reader\Excel5_Escher($BSE);
$reader->load($blipData); $reader->load($blipData);
} }
@ -310,9 +312,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -337,7 +339,7 @@ class PHPExcel_Reader_Excel5_Escher
// offset: var; size: var; the raw image data // offset: var; size: var; the raw image data
$data = substr($recordData, $pos); $data = substr($recordData, $pos);
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new \PHPExcel\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip();
$blip->setData($data); $blip->setData($data);
$this->object->setBlip($blip); $this->object->setBlip($blip);
@ -351,9 +353,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -378,7 +380,7 @@ class PHPExcel_Reader_Excel5_Escher
// offset: var; size: var; the raw image data // offset: var; size: var; the raw image data
$data = substr($recordData, $pos); $data = substr($recordData, $pos);
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new \PHPExcel\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip();
$blip->setData($data); $blip->setData($data);
$this->object->setBlip($blip); $this->object->setBlip($blip);
@ -392,9 +394,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -411,9 +413,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -425,7 +427,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readSplitMenuColors() private function readSplitMenuColors()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -437,16 +439,16 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readDgContainer() private function readDgContainer()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dgContainer = new PHPExcel_Shared_Escher_DgContainer(); $dgContainer = new \PHPExcel\Shared_Escher\DgContainer();
$this->object->setDgContainer($dgContainer); $this->object->setDgContainer($dgContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); $reader = new \PHPExcel\Reader\Excel5\Escher($dgContainer);
$escher = $reader->load($recordData); $escher = $reader->load($recordData);
} }
@ -455,7 +457,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readDg() private function readDg()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -469,16 +471,16 @@ class PHPExcel_Reader_Excel5_Escher
{ {
// context is either context DgContainer or SpgrContainer // context is either context DgContainer or SpgrContainer
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); $spgrContainer = new \PHPExcel\Shared\Escher\DgContainer\SpgrContainer();
if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) { if ($this->object instanceof \PHPExcel\Shared\Escher\DgContainer) {
// DgContainer // DgContainer
$this->object->setSpgrContainer($spgrContainer); $this->object->setSpgrContainer($spgrContainer);
} else { } else {
@ -486,7 +488,7 @@ class PHPExcel_Reader_Excel5_Escher
$this->object->addChild($spgrContainer); $this->object->addChild($spgrContainer);
} }
$reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); $reader = new Escher($spgrContainer);
$escher = $reader->load($recordData); $escher = $reader->load($recordData);
} }
@ -495,18 +497,18 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readSpContainer() private function readSpContainer()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// add spContainer to spgrContainer // add spContainer to spgrContainer
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); $spContainer = new \PHPExcel\Shared\Escher\DgContainer\SpgrContainer\SpContainer();
$this->object->addChild($spContainer); $this->object->addChild($spContainer);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($spContainer); $reader = new Escher($spContainer);
$escher = $reader->load($recordData); $escher = $reader->load($recordData);
} }
@ -515,7 +517,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readSpgr() private function readSpgr()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -530,9 +532,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -547,9 +549,9 @@ class PHPExcel_Reader_Excel5_Escher
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4; $recInstance = (0xFFF0 & \PHPExcel\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -561,38 +563,38 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readClientAnchor() private function readClientAnchor()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->pos += 8 + $length; $this->pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-based) // offset: 2; size: 2; upper-left corner column index (0-based)
$c1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 2); $c1 = \PHPExcel\Reader\Excel5::getInt2d($recordData, 2);
// offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
$startOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 4); $startOffsetX = \PHPExcel\Reader\Excel5::getInt2d($recordData, 4);
// offset: 6; size: 2; upper-left corner row index (0-based) // offset: 6; size: 2; upper-left corner row index (0-based)
$r1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 6); $r1 = \PHPExcel\Reader\Excel5::getInt2d($recordData, 6);
// offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
$startOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 8); $startOffsetY = \PHPExcel\Reader\Excel5::getInt2d($recordData, 8);
// offset: 10; size: 2; bottom-right corner column index (0-based) // offset: 10; size: 2; bottom-right corner column index (0-based)
$c2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 10); $c2 = \PHPExcel\Reader\Excel5::getInt2d($recordData, 10);
// offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
$endOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 12); $endOffsetX = \PHPExcel\Reader\Excel5::getInt2d($recordData, 12);
// offset: 14; size: 2; bottom-right corner row index (0-based) // offset: 14; size: 2; bottom-right corner row index (0-based)
$r2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 14); $r2 = \PHPExcel\Reader\Excel5::getInt2d($recordData, 14);
// offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
$endOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 16); $endOffsetY = \PHPExcel\Reader\Excel5::getInt2d($recordData, 16);
// set the start coordinates // set the start coordinates
$this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); $this->object->setStartCoordinates(\PHPExcel\Cell::stringFromColumnIndex($c1) . ($r1 + 1));
// set the start offsetX // set the start offsetX
$this->object->setStartOffsetX($startOffsetX); $this->object->setStartOffsetX($startOffsetX);
@ -601,7 +603,7 @@ class PHPExcel_Reader_Excel5_Escher
$this->object->setStartOffsetY($startOffsetY); $this->object->setStartOffsetY($startOffsetY);
// set the end coordinates // set the end coordinates
$this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); $this->object->setEndCoordinates(\PHPExcel\Cell::stringFromColumnIndex($c2) . ($r2 + 1));
// set the end offsetX // set the end offsetX
$this->object->setEndOffsetX($endOffsetX); $this->object->setEndOffsetX($endOffsetX);
@ -615,7 +617,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
private function readClientData() private function readClientData()
{ {
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $length = \PHPExcel\Reader\Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
@ -638,7 +640,7 @@ class PHPExcel_Reader_Excel5_Escher
$fopte = substr($data, 6 * $i, 6); $fopte = substr($data, 6 * $i, 6);
// offset: 0; size: 2; opid // offset: 0; size: 2; opid
$opid = PHPExcel_Reader_Excel5::getInt2d($fopte, 0); $opid = \PHPExcel\Reader\Excel5::getInt2d($fopte, 0);
// bit: 0-13; mask: 0x3FFF; opid.opid // bit: 0-13; mask: 0x3FFF; opid.opid
$opidOpid = (0x3FFF & $opid) >> 0; $opidOpid = (0x3FFF & $opid) >> 0;
@ -650,7 +652,7 @@ class PHPExcel_Reader_Excel5_Escher
$opidFComplex = (0x8000 & $opid) >> 15; $opidFComplex = (0x8000 & $opid) >> 15;
// offset: 2; size: 4; the value for this property // offset: 2; size: 4; the value for this property
$op = PHPExcel_Reader_Excel5::getInt4d($fopte, 2); $op = \PHPExcel\Reader\Excel5::getInt4d($fopte, 2);
if ($opidFComplex) { if ($opidFComplex) {
$complexData = substr($splicedComplexData, 0, $op); $complexData = substr($splicedComplexData, 0, $op);

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Reader\Excel5;
/** /**
* PHPExcel_Reader_Excel5_MD5 * PHPExcel_Reader_Excel5_MD5
* *
@ -25,7 +27,7 @@
* @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##
*/ */
class PHPExcel_Reader_Excel5_MD5 class MD5
{ {
// Context // Context
private $a; private $a;
@ -85,10 +87,10 @@ class PHPExcel_Reader_Excel5_MD5
$C = $this->c; $C = $this->c;
$D = $this->d; $D = $this->d;
$F = array('PHPExcel_Reader_Excel5_MD5','f'); $F = ['self','f'];
$G = array('PHPExcel_Reader_Excel5_MD5','g'); $G = ['self','g'];
$H = array('PHPExcel_Reader_Excel5_MD5','h'); $H = ['self','h'];
$I = array('PHPExcel_Reader_Excel5_MD5','i'); $I = ['self','i'];
/* ROUND 1 */ /* ROUND 1 */
self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478); self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478);

View File

@ -214,7 +214,7 @@ class OLE
$path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
if ($blockIdOrPps instanceof OLE\PPS) { if ($blockIdOrPps instanceof OLE\PPS) {
$path .= '&blockId=' . $blockIdOrPps->_StartBlock; $path .= '&blockId=' . $blockIdOrPps->startBlock;
$path .= '&size=' . $blockIdOrPps->Size; $path .= '&size=' . $blockIdOrPps->Size;
} else { } else {
$path .= '&blockId=' . $blockIdOrPps; $path .= '&blockId=' . $blockIdOrPps;
@ -300,7 +300,7 @@ class OLE
fseek($fh, 20, SEEK_CUR); fseek($fh, 20, SEEK_CUR);
$pps->Time1st = self::OLE2LocalDate(fread($fh, 8)); $pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
$pps->Time2nd = self::OLE2LocalDate(fread($fh, 8)); $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
$pps->_StartBlock = self::_readInt4($fh); $pps->startBlock = self::_readInt4($fh);
$pps->Size = self::_readInt4($fh); $pps->Size = self::_readInt4($fh);
$pps->No = count($this->_list); $pps->No = count($this->_list);
$this->_list[] = $pps; $this->_list[] = $pps;

View File

@ -85,9 +85,9 @@ class ChainedBlockStream
$blockId = $this->params['blockId']; $blockId = $this->params['blockId'];
$this->data = ''; $this->data = '';
if (isset($this->params['size']) && $this->params['size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->_StartBlock) { if (isset($this->params['size']) && $this->params['size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->startBlock) {
// Block id refers to small blocks // Block id refers to small blocks
$rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock); $rootPos = $this->ole->_getBlockOffset($this->ole->root->startBlock);
while ($blockId != -2) { while ($blockId != -2) {
$pos = $rootPos + $blockId * $this->ole->bigBlockSize; $pos = $rootPos + $blockId * $this->ole->bigBlockSize;
$blockId = $this->ole->sbat[$blockId]; $blockId = $this->ole->sbat[$blockId];

View File

@ -84,7 +84,7 @@ class PPS
* Starting block (small or big) for this PPS's data inside the container * Starting block (small or big) for this PPS's data inside the container
* @var integer * @var integer
*/ */
public $_StartBlock; public $startBlock;
/** /**
* The size of the PPS's data (in bytes) * The size of the PPS's data (in bytes)
@ -187,8 +187,7 @@ class PPS
. "\x00\x00\x00\x00" // 100 . "\x00\x00\x00\x00" // 100
. \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time1st) // 108 . \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time1st) // 108
. \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time2nd) // 116 . \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time2nd) // 116
. pack("V", isset($this->_StartBlock)? . pack("V", isset($this->startBlock) ? $this->startBlock : 0) // 120
$this->_StartBlock:0) // 120
. pack("V", $this->Size) // 124 . pack("V", $this->Size) // 124
. pack("V", 0); // 128 . pack("V", 0); // 128
return $ret; return $ret;

View File

@ -282,7 +282,7 @@ class Root extends \PHPExcel\Shared\OLE\PPS
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE))); fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
} }
// Set For PPS // Set For PPS
$raList[$i]->_StartBlock = $iStBlk; $raList[$i]->startBlock = $iStBlk;
$iStBlk += $iStBlk +=
(floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
@ -339,7 +339,7 @@ class Root extends \PHPExcel\Shared\OLE\PPS
$sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)); $sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
} }
// Set for PPS // Set for PPS
$raList[$i]->_StartBlock = $iSmBlk; $raList[$i]->startBlock = $iSmBlk;
$iSmBlk += $iSmbCnt; $iSmBlk += $iSmbCnt;
} }
} }

View File

@ -1,157 +0,0 @@
<?php
/**
* PHPExcel_Writer_Abstract
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Writer
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
{
/**
* Write charts that are defined in the workbook?
* Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object;
*
* @var boolean
*/
protected $includeCharts = false;
/**
* Pre-calculate formulas
* Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are
* immediately available to MS Excel or other office spreadsheet viewer when opening the file
*
* @var boolean
*/
protected $preCalculateFormulas = true;
/**
* Use disk caching where possible?
*
* @var boolean
*/
protected $_useDiskCaching = false;
/**
* Disk caching directory
*
* @var string
*/
protected $_diskCachingDirectory = './';
/**
* Write charts in workbook?
* If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object.
* If false (the default) it will ignore any charts defined in the PHPExcel object.
*
* @return boolean
*/
public function getIncludeCharts()
{
return $this->includeCharts;
}
/**
* Set write charts in workbook
* Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.
* Set to false (the default) to ignore charts.
*
* @param boolean $pValue
* @return PHPExcel_Writer_IWriter
*/
public function setIncludeCharts($pValue = false)
{
$this->includeCharts = (boolean) $pValue;
return $this;
}
/**
* Get Pre-Calculate Formulas flag
* If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
* so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
* viewer when opening the file
* If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower
* when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself
*
* @return boolean
*/
public function getPreCalculateFormulas()
{
return $this->preCalculateFormulas;
}
/**
* Set Pre-Calculate Formulas
* Set to true (the default) to advise the Writer to calculate all formulae on save
* Set to false to prevent precalculation of formulae on save.
*
* @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter
*/
public function setPreCalculateFormulas($pValue = true)
{
$this->preCalculateFormulas = (boolean) $pValue;
return $this;
}
/**
* Get use disk caching where possible?
*
* @return boolean
*/
public function getUseDiskCaching()
{
return $this->_useDiskCaching;
}
/**
* Set use disk caching where possible?
*
* @param boolean $pValue
* @param string $pDirectory Disk caching directory
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007
*/
public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue;
if ($pDirectory !== null) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory");
}
}
return $this;
}
/**
* Get disk caching directory
*
* @return string
*/
public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory;
}
}

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Writer;
/** /**
* PHPExcel_Writer_CSV * PHPExcel_Writer_CSV
* *
@ -25,7 +27,7 @@
* @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##
*/ */
class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter class CSV extends BaseWriter implements IWriter
{ {
/** /**
* PHPExcel object * PHPExcel object
@ -77,11 +79,11 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
private $excelCompatibility = false; private $excelCompatibility = false;
/** /**
* Create a new PHPExcel_Writer_CSV * Create a new CSV
* *
* @param PHPExcel $phpExcel PHPExcel object * @param Spreadsheet $phpExcel Spreadsheet object
*/ */
public function __construct(PHPExcel $phpExcel) public function __construct(Spreadsheet $phpExcel)
{ {
$this->phpExcel = $phpExcel; $this->phpExcel = $phpExcel;
} }
@ -90,22 +92,22 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Save PHPExcel to file * Save PHPExcel to file
* *
* @param string $pFilename * @param string $pFilename
* @throws PHPExcel_Writer_Exception * @throws Exception
*/ */
public function save($pFilename = null) public function save($pFilename = null)
{ {
// Fetch sheet // Fetch sheet
$sheet = $this->phpExcel->getSheet($this->sheetIndex); $sheet = $this->phpExcel->getSheet($this->sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = \PHPExcel\Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); \PHPExcel\Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); $saveArrayReturnType = \PHPExcel\Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); \PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_VALUE);
// Open file // Open file
$fileHandle = fopen($pFilename, 'wb+'); $fileHandle = fopen($pFilename, 'wb+');
if ($fileHandle === false) { if ($fileHandle === false) {
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); throw new Exception("Could not open file $pFilename for writing.");
} }
if ($this->excelCompatibility) { if ($this->excelCompatibility) {
@ -134,8 +136,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
// Close file // Close file
fclose($fileHandle); fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); \PHPExcel\Calculation::setArrayReturnType($saveArrayReturnType);
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); \PHPExcel\Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
} }
/** /**
@ -152,7 +154,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Set delimiter * Set delimiter
* *
* @param string $pValue Delimiter, defaults to , * @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setDelimiter($pValue = ',') public function setDelimiter($pValue = ',')
{ {
@ -174,7 +176,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Set enclosure * Set enclosure
* *
* @param string $pValue Enclosure, defaults to " * @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setEnclosure($pValue = '"') public function setEnclosure($pValue = '"')
{ {
@ -199,7 +201,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Set line ending * Set line ending
* *
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setLineEnding($pValue = PHP_EOL) public function setLineEnding($pValue = PHP_EOL)
{ {
@ -221,7 +223,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Set whether BOM should be used * Set whether BOM should be used
* *
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false * @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setUseBOM($pValue = false) public function setUseBOM($pValue = false)
{ {
@ -244,7 +246,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* *
* @param boolean $pValue Set the file to be written as a fully Excel compatible csv file * @param boolean $pValue Set the file to be written as a fully Excel compatible csv file
* Note that this overrides other settings such as useBOM, enclosure and delimiter * Note that this overrides other settings such as useBOM, enclosure and delimiter
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setExcelCompatibility($pValue = false) public function setExcelCompatibility($pValue = false)
{ {
@ -266,7 +268,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Set sheet index * Set sheet index
* *
* @param int $pValue Sheet index * @param int $pValue Sheet index
* @return PHPExcel_Writer_CSV * @return CSV
*/ */
public function setSheetIndex($pValue = 0) public function setSheetIndex($pValue = 0)
{ {
@ -279,7 +281,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* *
* @param mixed $pFileHandle PHP filehandle * @param mixed $pFileHandle PHP filehandle
* @param array $pValues Array containing values in a row * @param array $pValues Array containing values in a row
* @throws PHPExcel_Writer_Exception * @throws Exception
*/ */
private function writeLine($pFileHandle = null, $pValues = null) private function writeLine($pFileHandle = null, $pValues = null)
{ {
@ -311,7 +313,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
// Write to file // Write to file
fwrite($pFileHandle, $line); fwrite($pFileHandle, $line);
} else { } else {
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); throw new Exception("Invalid data row passed to CSV writer.");
} }
} }
} }

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Writer;
/** /**
* PHPExcel_Writer_Exception * PHPExcel_Writer_Exception
* *
@ -25,7 +27,7 @@
* @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##
*/ */
class PHPExcel_Writer_Exception extends PHPExcel_Exception class Exception extends \PHPExcel\Exception
{ {
/** /**
* Error handler callback * Error handler callback

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Writer;
/** /**
* PHPExcel_Writer_IWriter * PHPExcel_Writer_IWriter
* *
@ -25,7 +27,7 @@
* @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##
*/ */
interface PHPExcel_Writer_IWriter interface IWriter
{ {
/** /**
* Save PHPExcel to file * Save PHPExcel to file

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Writer;
/** /**
* PHPExcel_Writer_PDF * PHPExcel_Writer_PDF
* *
@ -25,13 +27,13 @@
* @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##
*/ */
class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter class PDF implements IWriter
{ {
/** /**
* The wrapper for the requested PDF rendering engine * The wrapper for the requested PDF rendering engine
* *
* @var PHPExcel_Writer_PDF_Core * @var PDF\Core
*/ */
private $renderer = null; private $renderer = null;
@ -39,18 +41,18 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
* Instantiate a new renderer of the configured type within this container class * Instantiate a new renderer of the configured type within this container class
* *
* @param PHPExcel $phpExcel PHPExcel object * @param PHPExcel $phpExcel PHPExcel object
* @throws PHPExcel_Writer_Exception when PDF library is not configured * @throws Exception when PDF library is not configured
*/ */
public function __construct(PHPExcel $phpExcel) public function __construct(PHPExcel $phpExcel)
{ {
$pdfLibraryName = PHPExcel_Settings::getPdfRendererName(); $pdfLibraryName = \PHPExcel\Settings::getPdfRendererName();
if (is_null($pdfLibraryName)) { if (is_null($pdfLibraryName)) {
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined."); throw new Exception("PDF Rendering library has not been defined.");
} }
$pdfLibraryPath = PHPExcel_Settings::getPdfRendererPath(); $pdfLibraryPath = \PHPExcel\Settings::getPdfRendererPath();
if (is_null($pdfLibraryName)) { if (is_null($pdfLibraryName)) {
throw new PHPExcel_Writer_Exception("PDF Rendering library path has not been defined."); throw new Exception("PDF Rendering library path has not been defined.");
} }
$includePath = str_replace('\\', '/', get_include_path()); $includePath = str_replace('\\', '/', get_include_path());
$rendererPath = str_replace('\\', '/', $pdfLibraryPath); $rendererPath = str_replace('\\', '/', $pdfLibraryPath);
@ -58,7 +60,7 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath); set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath);
} }
$rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName; $rendererName = 'PDF\\' . $pdfLibraryName;
$this->renderer = new $rendererName($phpExcel); $this->renderer = new $rendererName($phpExcel);
} }
@ -73,7 +75,7 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
public function __call($name, $arguments) public function __call($name, $arguments)
{ {
if ($this->renderer === null) { if ($this->renderer === null) {
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined."); throw new Exception("PDF Rendering library has not been defined.");
} }
return call_user_func_array(array($this->renderer, $name), $arguments); return call_user_func_array(array($this->renderer, $name), $arguments);