composer update
This commit is contained in:
170
vendor/phpoffice/phpexcel/Classes/PHPExcel/Style.php
vendored
170
vendor/phpoffice/phpexcel/Classes/PHPExcel/Style.php
vendored
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* 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
|
||||
@@ -20,19 +21,10 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2014 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
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
@@ -40,96 +32,96 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*
|
||||
* @var PHPExcel_Style_Font
|
||||
*/
|
||||
protected $_font;
|
||||
protected $font;
|
||||
|
||||
/**
|
||||
* Fill
|
||||
*
|
||||
* @var PHPExcel_Style_Fill
|
||||
*/
|
||||
protected $_fill;
|
||||
protected $fill;
|
||||
|
||||
/**
|
||||
* Borders
|
||||
*
|
||||
* @var PHPExcel_Style_Borders
|
||||
*/
|
||||
protected $_borders;
|
||||
protected $borders;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var PHPExcel_Style_Alignment
|
||||
*/
|
||||
protected $_alignment;
|
||||
protected $alignment;
|
||||
|
||||
/**
|
||||
* Number Format
|
||||
*
|
||||
* @var PHPExcel_Style_NumberFormat
|
||||
*/
|
||||
protected $_numberFormat;
|
||||
protected $numberFormat;
|
||||
|
||||
/**
|
||||
* Conditional styles
|
||||
*
|
||||
* @var PHPExcel_Style_Conditional[]
|
||||
*/
|
||||
protected $_conditionalStyles;
|
||||
protected $conditionalStyles;
|
||||
|
||||
/**
|
||||
* Protection
|
||||
*
|
||||
* @var PHPExcel_Style_Protection
|
||||
*/
|
||||
protected $_protection;
|
||||
protected $protection;
|
||||
|
||||
/**
|
||||
* Index of style in collection. Only used for real style.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_index;
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* Use Quote Prefix when displaying in cell editor. Only used for real style.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_quotePrefix = false;
|
||||
protected $quotePrefix = false;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
$this->isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_conditionalStyles = array();
|
||||
$this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
|
||||
$this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
|
||||
$this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
|
||||
$this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
|
||||
$this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
|
||||
$this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
|
||||
$this->conditionalStyles = array();
|
||||
$this->font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
|
||||
$this->fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
|
||||
$this->borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
|
||||
$this->alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
|
||||
$this->numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
|
||||
$this->protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_font->bindParent($this);
|
||||
$this->_fill->bindParent($this);
|
||||
$this->_borders->bindParent($this);
|
||||
$this->_alignment->bindParent($this);
|
||||
$this->_numberFormat->bindParent($this);
|
||||
$this->_protection->bindParent($this);
|
||||
$this->font->bindParent($this);
|
||||
$this->fill->bindParent($this);
|
||||
$this->borders->bindParent($this);
|
||||
$this->alignment->bindParent($this);
|
||||
$this->numberFormat->bindParent($this);
|
||||
$this->protection->bindParent($this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +142,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
$xfIndex = 0;
|
||||
}
|
||||
|
||||
return $this->_parent->getCellXfByIndex($xfIndex);
|
||||
return $this->parent->getCellXfByIndex($xfIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,19 +152,19 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->_parent;
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build style array from subcomponents
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public function getStyleArray($array)
|
||||
{
|
||||
return array('quotePrefix' => $array);
|
||||
}
|
||||
/**
|
||||
* Build style array from subcomponents
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public function getStyleArray($array)
|
||||
{
|
||||
return array('quotePrefix' => $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply styles from array
|
||||
@@ -217,8 +209,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
public function applyFromArray($pStyles = null, $pAdvanced = true)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
|
||||
if ($this->isSupervisor) {
|
||||
$pRange = $this->getSelectedCells();
|
||||
|
||||
// Uppercase coordinate
|
||||
@@ -234,7 +225,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
|
||||
// Calculate range outer borders
|
||||
$rangeStart = PHPExcel_Cell::coordinateFromString($rangeA);
|
||||
$rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB);
|
||||
$rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB);
|
||||
|
||||
// Translate column into index
|
||||
$rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
|
||||
@@ -248,9 +239,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
|
||||
// ADVANCED MODE:
|
||||
|
||||
if ($pAdvanced && isset($pStyles['borders'])) {
|
||||
|
||||
// 'allborders' is a shorthand property for 'outline' and 'inside' and
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['allborders'])) {
|
||||
@@ -261,7 +250,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
unset($pStyles['borders']['allborders']); // not needed any more
|
||||
}
|
||||
|
||||
// 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left'
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['outline'])) {
|
||||
@@ -272,7 +260,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
unset($pStyles['borders']['outline']); // not needed any more
|
||||
}
|
||||
|
||||
// 'inside' is a shorthand property for 'vertical' and 'horizontal'
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['inside'])) {
|
||||
@@ -283,7 +270,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
unset($pStyles['borders']['inside']); // not needed any more
|
||||
}
|
||||
|
||||
// width and height characteristics of selection, 1, 2, or 3 (for 3 or more)
|
||||
$xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3);
|
||||
$yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3);
|
||||
@@ -294,34 +280,28 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
$colStart = ($x == 3) ?
|
||||
PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0])
|
||||
: PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1);
|
||||
|
||||
// end column index for region
|
||||
$colEnd = ($x == 1) ?
|
||||
PHPExcel_Cell::stringFromColumnIndex($rangeStart[0])
|
||||
: PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x);
|
||||
|
||||
for ($y = 1; $y <= $yMax; ++$y) {
|
||||
|
||||
// which edges are touching the region
|
||||
$edges = array();
|
||||
|
||||
// are we at left edge
|
||||
if ($x == 1) {
|
||||
// are we at left edge
|
||||
$edges[] = 'left';
|
||||
}
|
||||
|
||||
// are we at right edge
|
||||
if ($x == $xMax) {
|
||||
// are we at right edge
|
||||
$edges[] = 'right';
|
||||
}
|
||||
|
||||
// are we at top edge?
|
||||
if ($y == 1) {
|
||||
// are we at top edge?
|
||||
$edges[] = 'top';
|
||||
}
|
||||
|
||||
// are we at bottom edge?
|
||||
if ($y == $yMax) {
|
||||
// are we at bottom edge?
|
||||
$edges[] = 'bottom';
|
||||
}
|
||||
|
||||
@@ -341,7 +321,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
unset($regionStyles['borders']['inside']);
|
||||
|
||||
// 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
|
||||
foreach ($innerEdges as $innerEdge) {
|
||||
@@ -375,11 +355,10 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
|
||||
// SIMPLE MODE:
|
||||
|
||||
// Selection type, inspect
|
||||
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
|
||||
$selectionType = 'COLUMN';
|
||||
} else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
|
||||
} elseif (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
|
||||
$selectionType = 'ROW';
|
||||
} else {
|
||||
$selectionType = 'CELL';
|
||||
@@ -393,7 +372,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
$oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ROW':
|
||||
$oldXfIndexes = array();
|
||||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||
@@ -404,7 +382,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CELL':
|
||||
$oldXfIndexes = array();
|
||||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||
@@ -483,7 +460,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
$this->getProtection()->applyFromArray($pStyles['protection']);
|
||||
}
|
||||
if (array_key_exists('quotePrefix', $pStyles)) {
|
||||
$this->_quotePrefix = $pStyles['quotePrefix'];
|
||||
$this->quotePrefix = $pStyles['quotePrefix'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -499,7 +476,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getFill()
|
||||
{
|
||||
return $this->_fill;
|
||||
return $this->fill;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,7 +486,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getFont()
|
||||
{
|
||||
return $this->_font;
|
||||
return $this->font;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -520,7 +497,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function setFont(PHPExcel_Style_Font $font)
|
||||
{
|
||||
$this->_font = $font;
|
||||
$this->font = $font;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -531,7 +508,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getBorders()
|
||||
{
|
||||
return $this->_borders;
|
||||
return $this->borders;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,7 +518,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getAlignment()
|
||||
{
|
||||
return $this->_alignment;
|
||||
return $this->alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,7 +528,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getNumberFormat()
|
||||
{
|
||||
return $this->_numberFormat;
|
||||
return $this->numberFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,7 +562,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getProtection()
|
||||
{
|
||||
return $this->_protection;
|
||||
return $this->protection;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -595,10 +572,10 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getQuotePrefix()
|
||||
{
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getQuotePrefix();
|
||||
}
|
||||
return $this->_quotePrefix;
|
||||
return $this->quotePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,11 +588,11 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = array('quotePrefix' => $pValue);
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_quotePrefix = (boolean) $pValue;
|
||||
$this->quotePrefix = (boolean) $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
@@ -628,20 +605,20 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
public function getHashCode()
|
||||
{
|
||||
$hashConditionals = '';
|
||||
foreach ($this->_conditionalStyles as $conditional) {
|
||||
foreach ($this->conditionalStyles as $conditional) {
|
||||
$hashConditionals .= $conditional->getHashCode();
|
||||
}
|
||||
|
||||
return md5(
|
||||
$this->_fill->getHashCode()
|
||||
. $this->_font->getHashCode()
|
||||
. $this->_borders->getHashCode()
|
||||
. $this->_alignment->getHashCode()
|
||||
. $this->_numberFormat->getHashCode()
|
||||
. $hashConditionals
|
||||
. $this->_protection->getHashCode()
|
||||
. ($this->_quotePrefix ? 't' : 'f')
|
||||
. __CLASS__
|
||||
$this->fill->getHashCode() .
|
||||
$this->font->getHashCode() .
|
||||
$this->borders->getHashCode() .
|
||||
$this->alignment->getHashCode() .
|
||||
$this->numberFormat->getHashCode() .
|
||||
$hashConditionals .
|
||||
$this->protection->getHashCode() .
|
||||
($this->quotePrefix ? 't' : 'f') .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
@@ -652,7 +629,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->_index;
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,7 +639,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
*/
|
||||
public function setIndex($pValue)
|
||||
{
|
||||
$this->_index = $pValue;
|
||||
$this->index = $pValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user