ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Style_Fill Class Reference
+ Inheritance diagram for PHPExcel_Style_Fill:
+ Collaboration diagram for PHPExcel_Style_Fill:

Public Member Functions

 __construct ($isSupervisor=FALSE, $isConditional=FALSE)
 Create a new PHPExcel_Style_Fill. More...
 
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet. More...
 
 getStyleArray ($array)
 Build style array from subcomponents. More...
 
 applyFromArray ($pStyles=null)
 Apply styles from array. More...
 
 getFillType ()
 Get Fill Type. More...
 
 setFillType ($pValue=PHPExcel_Style_Fill::FILL_NONE)
 Set Fill Type. More...
 
 getRotation ()
 Get Rotation. More...
 
 setRotation ($pValue=0)
 Set Rotation. More...
 
 getStartColor ()
 Get Start Color. More...
 
 setStartColor (PHPExcel_Style_Color $pValue=null)
 Set Start Color. More...
 
 getEndColor ()
 Get End Color. More...
 
 setEndColor (PHPExcel_Style_Color $pValue=null)
 Set End Color. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PHPExcel_Style_Supervisor
 __construct ($isSupervisor=FALSE)
 Create a new PHPExcel_Style_Alignment. More...
 
 bindParent ($parent, $parentPropertyName=NULL)
 Bind parent. More...
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component? More...
 
 getActiveSheet ()
 Get the currently active sheet. More...
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 
 getHashCode ()
 Get hash code. More...
 

Data Fields

const FILL_NONE = 'none'
 
const FILL_SOLID = 'solid'
 
const FILL_GRADIENT_LINEAR = 'linear'
 
const FILL_GRADIENT_PATH = 'path'
 
const FILL_PATTERN_DARKDOWN = 'darkDown'
 
const FILL_PATTERN_DARKGRAY = 'darkGray'
 
const FILL_PATTERN_DARKGRID = 'darkGrid'
 
const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal'
 
const FILL_PATTERN_DARKTRELLIS = 'darkTrellis'
 
const FILL_PATTERN_DARKUP = 'darkUp'
 
const FILL_PATTERN_DARKVERTICAL = 'darkVertical'
 
const FILL_PATTERN_GRAY0625 = 'gray0625'
 
const FILL_PATTERN_GRAY125 = 'gray125'
 
const FILL_PATTERN_LIGHTDOWN = 'lightDown'
 
const FILL_PATTERN_LIGHTGRAY = 'lightGray'
 
const FILL_PATTERN_LIGHTGRID = 'lightGrid'
 
const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal'
 
const FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis'
 
const FILL_PATTERN_LIGHTUP = 'lightUp'
 
const FILL_PATTERN_LIGHTVERTICAL = 'lightVertical'
 
const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'
 

Protected Attributes

 $_fillType = PHPExcel_Style_Fill::FILL_NONE
 
 $_rotation = 0
 
 $_startColor
 
 $_endColor
 
- Protected Attributes inherited from PHPExcel_Style_Supervisor
 $_isSupervisor
 
 $_parent
 

Detailed Description

Definition at line 36 of file Fill.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Style_Fill::__construct (   $isSupervisor = FALSE,
  $isConditional = FALSE 
)

Create a new PHPExcel_Style_Fill.

Parameters
boolean$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
boolean$isConditionalFlag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

Definition at line 99 of file Fill.php.

100 {
101 // Supervisor?
102 parent::__construct($isSupervisor);
103
104 // Initialise values
105 if ($isConditional) {
106 $this->_fillType = NULL;
107 }
108 $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional);
109 $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
110
111 // bind parent if we are a supervisor
112 if ($isSupervisor) {
113 $this->_startColor->bindParent($this, '_startColor');
114 $this->_endColor->bindParent($this, '_endColor');
115 }
116 }

References PHPExcel_Style_Color\COLOR_BLACK, and PHPExcel_Style_Color\COLOR_WHITE.

Member Function Documentation

◆ applyFromArray()

PHPExcel_Style_Fill::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( array( 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 0, 'startcolor' => array( 'rgb' => '000000' ), 'endcolor' => array( 'argb' => 'FFFFFFFF' ) ) );

Parameters
array$pStylesArray containing style information
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Fill

Definition at line 162 of file Fill.php.

162 {
163 if (is_array($pStyles)) {
164 if ($this->_isSupervisor) {
165 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
166 } else {
167 if (array_key_exists('type', $pStyles)) {
168 $this->setFillType($pStyles['type']);
169 }
170 if (array_key_exists('rotation', $pStyles)) {
171 $this->setRotation($pStyles['rotation']);
172 }
173 if (array_key_exists('startcolor', $pStyles)) {
174 $this->getStartColor()->applyFromArray($pStyles['startcolor']);
175 }
176 if (array_key_exists('endcolor', $pStyles)) {
177 $this->getEndColor()->applyFromArray($pStyles['endcolor']);
178 }
179 if (array_key_exists('color', $pStyles)) {
180 $this->getStartColor()->applyFromArray($pStyles['color']);
181 }
182 }
183 } else {
184 throw new PHPExcel_Exception("Invalid style array passed.");
185 }
186 return $this;
187 }
getStartColor()
Get Start Color.
Definition: Fill.php:250
getEndColor()
Get End Color.
Definition: Fill.php:279
setFillType($pValue=PHPExcel_Style_Fill::FILL_NONE)
Set Fill Type.
Definition: Fill.php:207
setRotation($pValue=0)
Set Rotation.
Definition: Fill.php:235
getStyleArray($array)
Build style array from subcomponents.
Definition: Fill.php:135
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103

References PHPExcel_Style_Supervisor\getActiveSheet(), getEndColor(), PHPExcel_Style_Supervisor\getSelectedCells(), getStartColor(), getStyleArray(), setFillType(), and setRotation().

+ Here is the call graph for this function:

◆ getEndColor()

PHPExcel_Style_Fill::getEndColor ( )

Get End Color.

Returns
PHPExcel_Style_Color

Definition at line 279 of file Fill.php.

279 {
280 return $this->_endColor;
281 }

References $_endColor.

Referenced by applyFromArray(), getHashCode(), and setEndColor().

+ Here is the caller graph for this function:

◆ getFillType()

PHPExcel_Style_Fill::getFillType ( )

Get Fill Type.

Returns
string

Definition at line 194 of file Fill.php.

194 {
195 if ($this->_isSupervisor) {
196 return $this->getSharedComponent()->getFillType();
197 }
198 return $this->_fillType;
199 }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Fill.php:124

References $_fillType, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFill(), and getHashCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHashCode()

PHPExcel_Style_Fill::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 308 of file Fill.php.

308 {
309 if ($this->_isSupervisor) {
310 return $this->getSharedComponent()->getHashCode();
311 }
312 return md5(
313 $this->getFillType()
314 . $this->getRotation()
315 . $this->getStartColor()->getHashCode()
316 . $this->getEndColor()->getHashCode()
317 . __CLASS__
318 );
319 }
getFillType()
Get Fill Type.
Definition: Fill.php:194
getRotation()
Get Rotation.
Definition: Fill.php:222
getHashCode()
Get hash code.
Definition: Fill.php:308

References getEndColor(), getFillType(), getHashCode(), getRotation(), getSharedComponent(), and getStartColor().

Referenced by getHashCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRotation()

PHPExcel_Style_Fill::getRotation ( )

Get Rotation.

Returns
double

Definition at line 222 of file Fill.php.

222 {
223 if ($this->_isSupervisor) {
224 return $this->getSharedComponent()->getRotation();
225 }
226 return $this->_rotation;
227 }

References $_rotation, and getSharedComponent().

Referenced by getHashCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSharedComponent()

PHPExcel_Style_Fill::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns
PHPExcel_Style_Fill

Definition at line 124 of file Fill.php.

125 {
126 return $this->_parent->getSharedComponent()->getFill();
127 }

Referenced by getFillType(), getHashCode(), and getRotation().

+ Here is the caller graph for this function:

◆ getStartColor()

PHPExcel_Style_Fill::getStartColor ( )

Get Start Color.

Returns
PHPExcel_Style_Color

Definition at line 250 of file Fill.php.

250 {
251 return $this->_startColor;
252 }

References $_startColor.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFill(), applyFromArray(), getHashCode(), and setStartColor().

+ Here is the caller graph for this function:

◆ getStyleArray()

PHPExcel_Style_Fill::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 135 of file Fill.php.

136 {
137 return array('fill' => $array);
138 }

Referenced by applyFromArray(), setFillType(), and setRotation().

+ Here is the caller graph for this function:

◆ setEndColor()

PHPExcel_Style_Fill::setEndColor ( PHPExcel_Style_Color  $pValue = null)

Set End Color.

Parameters
PHPExcel_Style_Color$pValue
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Fill

Definition at line 290 of file Fill.php.

290 {
291 // make sure parameter is a real color and not a supervisor
292 $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
293
294 if ($this->_isSupervisor) {
295 $styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB()));
296 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
297 } else {
298 $this->_endColor = $color;
299 }
300 return $this;
301 }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Color.php:114
getIsSupervisor()
Is this a supervisor or a cell style component?
Definition: Supervisor.php:82

References PHPExcel_Style_Supervisor\getActiveSheet(), getEndColor(), and PHPExcel_Style_Supervisor\getSelectedCells().

+ Here is the call graph for this function:

◆ setFillType()

PHPExcel_Style_Fill::setFillType (   $pValue = PHPExcel_Style_Fill::FILL_NONE)

Set Fill Type.

Parameters
string$pValuePHPExcel_Style_Fill fill type
Returns
PHPExcel_Style_Fill

Definition at line 207 of file Fill.php.

207 {
208 if ($this->_isSupervisor) {
209 $styleArray = $this->getStyleArray(array('type' => $pValue));
210 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
211 } else {
212 $this->_fillType = $pValue;
213 }
214 return $this;
215 }

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRotation()

PHPExcel_Style_Fill::setRotation (   $pValue = 0)

Set Rotation.

Parameters
double$pValue
Returns
PHPExcel_Style_Fill

Definition at line 235 of file Fill.php.

235 {
236 if ($this->_isSupervisor) {
237 $styleArray = $this->getStyleArray(array('rotation' => $pValue));
238 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
239 } else {
240 $this->_rotation = $pValue;
241 }
242 return $this;
243 }

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStartColor()

PHPExcel_Style_Fill::setStartColor ( PHPExcel_Style_Color  $pValue = null)

Set Start Color.

Parameters
PHPExcel_Style_Color$pValue
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Fill

Definition at line 261 of file Fill.php.

261 {
262 // make sure parameter is a real color and not a supervisor
263 $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
264
265 if ($this->_isSupervisor) {
266 $styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB()));
267 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
268 } else {
269 $this->_startColor = $color;
270 }
271 return $this;
272 }

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), and getStartColor().

+ Here is the call graph for this function:

Field Documentation

◆ $_endColor

PHPExcel_Style_Fill::$_endColor
protected

Definition at line 87 of file Fill.php.

Referenced by getEndColor().

◆ $_fillType

PHPExcel_Style_Fill::$_fillType = PHPExcel_Style_Fill::FILL_NONE
protected

Definition at line 66 of file Fill.php.

Referenced by getFillType().

◆ $_rotation

PHPExcel_Style_Fill::$_rotation = 0
protected

Definition at line 73 of file Fill.php.

Referenced by getRotation().

◆ $_startColor

PHPExcel_Style_Fill::$_startColor
protected

Definition at line 80 of file Fill.php.

Referenced by getStartColor().

◆ FILL_GRADIENT_LINEAR

const PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR = 'linear'

◆ FILL_GRADIENT_PATH

const PHPExcel_Style_Fill::FILL_GRADIENT_PATH = 'path'

◆ FILL_NONE

◆ FILL_PATTERN_DARKDOWN

const PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN = 'darkDown'

◆ FILL_PATTERN_DARKGRAY

const PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY = 'darkGray'

◆ FILL_PATTERN_DARKGRID

const PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID = 'darkGrid'

◆ FILL_PATTERN_DARKHORIZONTAL

const PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal'

◆ FILL_PATTERN_DARKTRELLIS

const PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS = 'darkTrellis'

◆ FILL_PATTERN_DARKUP

const PHPExcel_Style_Fill::FILL_PATTERN_DARKUP = 'darkUp'

◆ FILL_PATTERN_DARKVERTICAL

const PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL = 'darkVertical'

◆ FILL_PATTERN_GRAY0625

const PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 = 'gray0625'

◆ FILL_PATTERN_GRAY125

const PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 = 'gray125'

◆ FILL_PATTERN_LIGHTDOWN

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN = 'lightDown'

◆ FILL_PATTERN_LIGHTGRAY

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY = 'lightGray'

◆ FILL_PATTERN_LIGHTGRID

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID = 'lightGrid'

◆ FILL_PATTERN_LIGHTHORIZONTAL

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal'

◆ FILL_PATTERN_LIGHTTRELLIS

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis'

◆ FILL_PATTERN_LIGHTUP

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP = 'lightUp'

◆ FILL_PATTERN_LIGHTVERTICAL

const PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL = 'lightVertical'

◆ FILL_PATTERN_MEDIUMGRAY

const PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY = 'mediumGray'

◆ FILL_SOLID

const PHPExcel_Style_Fill::FILL_SOLID = 'solid'

The documentation for this class was generated from the following file: