ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Style_Borders Class Reference
+ Inheritance diagram for PHPExcel_Style_Borders:
+ Collaboration diagram for PHPExcel_Style_Borders:

Public Member Functions

 __construct ($isSupervisor=FALSE, $isConditional=FALSE)
 Create a new PHPExcel_Style_Borders. 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...
 
 getLeft ()
 Get Left. More...
 
 getRight ()
 Get Right. More...
 
 getTop ()
 Get Top. More...
 
 getBottom ()
 Get Bottom. More...
 
 getDiagonal ()
 Get Diagonal. More...
 
 getAllBorders ()
 Get AllBorders (pseudo-border). More...
 
 getOutline ()
 Get Outline (pseudo-border). More...
 
 getInside ()
 Get Inside (pseudo-border). More...
 
 getVertical ()
 Get Vertical (pseudo-border). More...
 
 getHorizontal ()
 Get Horizontal (pseudo-border). More...
 
 getDiagonalDirection ()
 Get DiagonalDirection. More...
 
 setDiagonalDirection ($pValue=PHPExcel_Style_Borders::DIAGONAL_NONE)
 Set DiagonalDirection. 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...
 

Data Fields

const DIAGONAL_NONE = 0
 
const DIAGONAL_UP = 1
 
const DIAGONAL_DOWN = 2
 
const DIAGONAL_BOTH = 3
 

Protected Attributes

 $_left
 
 $_right
 
 $_top
 
 $_bottom
 
 $_diagonal
 
 $_diagonalDirection
 
 $_allBorders
 
 $_outline
 
 $_inside
 
 $_vertical
 
 $_horizontal
 
- Protected Attributes inherited from PHPExcel_Style_Supervisor
 $_isSupervisor
 
 $_parent
 

Detailed Description

Definition at line 36 of file Borders.php.

Constructor & Destructor Documentation

◆ __construct()

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

Create a new PHPExcel_Style_Borders.

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 131 of file Borders.php.

References DIAGONAL_NONE.

132  {
133  // Supervisor?
134  parent::__construct($isSupervisor);
135 
136  // Initialise values
137  $this->_left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
138  $this->_right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
139  $this->_top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
140  $this->_bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
141  $this->_diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
142  $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
143 
144  // Specially for supervisor
145  if ($isSupervisor) {
146  // Initialize pseudo-borders
147  $this->_allBorders = new PHPExcel_Style_Border(TRUE);
148  $this->_outline = new PHPExcel_Style_Border(TRUE);
149  $this->_inside = new PHPExcel_Style_Border(TRUE);
150  $this->_vertical = new PHPExcel_Style_Border(TRUE);
151  $this->_horizontal = new PHPExcel_Style_Border(TRUE);
152 
153  // bind parent if we are a supervisor
154  $this->_left->bindParent($this, '_left');
155  $this->_right->bindParent($this, '_right');
156  $this->_top->bindParent($this, '_top');
157  $this->_bottom->bindParent($this, '_bottom');
158  $this->_diagonal->bindParent($this, '_diagonal');
159  $this->_allBorders->bindParent($this, '_allBorders');
160  $this->_outline->bindParent($this, '_outline');
161  $this->_inside->bindParent($this, '_inside');
162  $this->_vertical->bindParent($this, '_vertical');
163  $this->_horizontal->bindParent($this, '_horizontal');
164  }
165  }

Member Function Documentation

◆ applyFromArray()

PHPExcel_Style_Borders::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( array( 'bottom' => array( 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, 'color' => array( 'rgb' => '808080' ) ), 'top' => array( 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, 'color' => array( 'rgb' => '808080' ) ) ) ); $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( array( 'allborders' => array( 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, 'color' => array( 'rgb' => '808080' ) ) ) );

Parameters
array$pStylesArray containing style information
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Borders

Definition at line 227 of file Borders.php.

References PHPExcel_Style_Supervisor\getActiveSheet(), getBottom(), getDiagonal(), getLeft(), getRight(), PHPExcel_Style_Supervisor\getSelectedCells(), getStyleArray(), getTop(), and setDiagonalDirection().

227  {
228  if (is_array($pStyles)) {
229  if ($this->_isSupervisor) {
230  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
231  } else {
232  if (array_key_exists('left', $pStyles)) {
233  $this->getLeft()->applyFromArray($pStyles['left']);
234  }
235  if (array_key_exists('right', $pStyles)) {
236  $this->getRight()->applyFromArray($pStyles['right']);
237  }
238  if (array_key_exists('top', $pStyles)) {
239  $this->getTop()->applyFromArray($pStyles['top']);
240  }
241  if (array_key_exists('bottom', $pStyles)) {
242  $this->getBottom()->applyFromArray($pStyles['bottom']);
243  }
244  if (array_key_exists('diagonal', $pStyles)) {
245  $this->getDiagonal()->applyFromArray($pStyles['diagonal']);
246  }
247  if (array_key_exists('diagonaldirection', $pStyles)) {
248  $this->setDiagonalDirection($pStyles['diagonaldirection']);
249  }
250  if (array_key_exists('allborders', $pStyles)) {
251  $this->getLeft()->applyFromArray($pStyles['allborders']);
252  $this->getRight()->applyFromArray($pStyles['allborders']);
253  $this->getTop()->applyFromArray($pStyles['allborders']);
254  $this->getBottom()->applyFromArray($pStyles['allborders']);
255  }
256  }
257  } else {
258  throw new PHPExcel_Exception("Invalid style array passed.");
259  }
260  return $this;
261  }
getBottom()
Get Bottom.
Definition: Borders.php:295
getDiagonal()
Get Diagonal.
Definition: Borders.php:304
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103
getLeft()
Get Left.
Definition: Borders.php:268
getStyleArray($array)
Build style array from subcomponents.
Definition: Borders.php:184
setDiagonalDirection($pValue=PHPExcel_Style_Borders::DIAGONAL_NONE)
Set DiagonalDirection.
Definition: Borders.php:391
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
getRight()
Get Right.
Definition: Borders.php:277
+ Here is the call graph for this function:

◆ getAllBorders()

PHPExcel_Style_Borders::getAllBorders ( )

Get AllBorders (pseudo-border).

Only applies to supervisor.

Returns
PHPExcel_Style_Border
Exceptions
PHPExcel_Exception

Definition at line 314 of file Borders.php.

References $_allBorders.

314  {
315  if (!$this->_isSupervisor) {
316  throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
317  }
318  return $this->_allBorders;
319  }

◆ getBottom()

PHPExcel_Style_Borders::getBottom ( )

Get Bottom.

Returns
PHPExcel_Style_Border

Definition at line 295 of file Borders.php.

References $_bottom.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorders(), applyFromArray(), and getHashCode().

295  {
296  return $this->_bottom;
297  }
+ Here is the caller graph for this function:

◆ getDiagonal()

PHPExcel_Style_Borders::getDiagonal ( )

Get Diagonal.

Returns
PHPExcel_Style_Border

Definition at line 304 of file Borders.php.

References $_diagonal.

Referenced by applyFromArray(), and getHashCode().

304  {
305  return $this->_diagonal;
306  }
+ Here is the caller graph for this function:

◆ getDiagonalDirection()

PHPExcel_Style_Borders::getDiagonalDirection ( )

Get DiagonalDirection.

Returns
int

Definition at line 378 of file Borders.php.

References $_diagonalDirection, and getSharedComponent().

Referenced by getHashCode().

378  {
379  if ($this->_isSupervisor) {
380  return $this->getSharedComponent()->getDiagonalDirection();
381  }
383  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Borders.php:173
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHashCode()

PHPExcel_Style_Borders::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 409 of file Borders.php.

References getBottom(), getDiagonal(), getDiagonalDirection(), getLeft(), getRight(), getSharedComponent(), and getTop().

409  {
410  if ($this->_isSupervisor) {
411  return $this->getSharedComponent()->getHashcode();
412  }
413  return md5(
414  $this->getLeft()->getHashCode()
415  . $this->getRight()->getHashCode()
416  . $this->getTop()->getHashCode()
417  . $this->getBottom()->getHashCode()
418  . $this->getDiagonal()->getHashCode()
419  . $this->getDiagonalDirection()
420  . __CLASS__
421  );
422  }
getBottom()
Get Bottom.
Definition: Borders.php:295
getDiagonal()
Get Diagonal.
Definition: Borders.php:304
getHashCode()
Get hash code.
Definition: Borders.php:409
getLeft()
Get Left.
Definition: Borders.php:268
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Borders.php:173
getDiagonalDirection()
Get DiagonalDirection.
Definition: Borders.php:378
getRight()
Get Right.
Definition: Borders.php:277
+ Here is the call graph for this function:

◆ getHorizontal()

PHPExcel_Style_Borders::getHorizontal ( )

Get Horizontal (pseudo-border).

Only applies to supervisor.

Returns
PHPExcel_Style_Border
Exceptions
PHPExcel_Exception

Definition at line 366 of file Borders.php.

References $_horizontal.

366  {
367  if (!$this->_isSupervisor) {
368  throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
369  }
370  return $this->_horizontal;
371  }

◆ getInside()

PHPExcel_Style_Borders::getInside ( )

Get Inside (pseudo-border).

Only applies to supervisor.

Returns
boolean
Exceptions
PHPExcel_Exception

Definition at line 340 of file Borders.php.

References $_inside.

340  {
341  if (!$this->_isSupervisor) {
342  throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
343  }
344  return $this->_inside;
345  }

◆ getLeft()

PHPExcel_Style_Borders::getLeft ( )

Get Left.

Returns
PHPExcel_Style_Border

Definition at line 268 of file Borders.php.

References $_left.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorders(), applyFromArray(), and getHashCode().

268  {
269  return $this->_left;
270  }
+ Here is the caller graph for this function:

◆ getOutline()

PHPExcel_Style_Borders::getOutline ( )

Get Outline (pseudo-border).

Only applies to supervisor.

Returns
boolean
Exceptions
PHPExcel_Exception

Definition at line 327 of file Borders.php.

References $_outline.

327  {
328  if (!$this->_isSupervisor) {
329  throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
330  }
331  return $this->_outline;
332  }

◆ getRight()

PHPExcel_Style_Borders::getRight ( )

Get Right.

Returns
PHPExcel_Style_Border

Definition at line 277 of file Borders.php.

References $_right.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorders(), applyFromArray(), and getHashCode().

277  {
278  return $this->_right;
279  }
+ Here is the caller graph for this function:

◆ getSharedComponent()

PHPExcel_Style_Borders::getSharedComponent ( )

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

Only used for style supervisor

Returns
PHPExcel_Style_Borders

Definition at line 173 of file Borders.php.

Referenced by getDiagonalDirection(), and getHashCode().

174  {
175  return $this->_parent->getSharedComponent()->getBorders();
176  }
+ Here is the caller graph for this function:

◆ getStyleArray()

PHPExcel_Style_Borders::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 184 of file Borders.php.

References array.

Referenced by applyFromArray(), and setDiagonalDirection().

185  {
186  return array('borders' => $array);
187  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getTop()

PHPExcel_Style_Borders::getTop ( )

Get Top.

Returns
PHPExcel_Style_Border

Definition at line 286 of file Borders.php.

References $_top.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorders(), applyFromArray(), and getHashCode().

286  {
287  return $this->_top;
288  }
+ Here is the caller graph for this function:

◆ getVertical()

PHPExcel_Style_Borders::getVertical ( )

Get Vertical (pseudo-border).

Only applies to supervisor.

Returns
PHPExcel_Style_Border
Exceptions
PHPExcel_Exception

Definition at line 353 of file Borders.php.

References $_vertical.

353  {
354  if (!$this->_isSupervisor) {
355  throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
356  }
357  return $this->_vertical;
358  }

◆ setDiagonalDirection()

PHPExcel_Style_Borders::setDiagonalDirection (   $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE)

Set DiagonalDirection.

Parameters
int$pValue
Returns
PHPExcel_Style_Borders

Definition at line 391 of file Borders.php.

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

Referenced by applyFromArray().

391  {
392  if ($pValue == '') {
394  }
395  if ($this->_isSupervisor) {
396  $styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
397  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
398  } else {
399  $this->_diagonalDirection = $pValue;
400  }
401  return $this;
402  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103
getStyleArray($array)
Build style array from subcomponents.
Definition: Borders.php:184
Create styles array
The data for the language used.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_allBorders

PHPExcel_Style_Borders::$_allBorders
protected

Definition at line 91 of file Borders.php.

Referenced by getAllBorders().

◆ $_bottom

PHPExcel_Style_Borders::$_bottom
protected

Definition at line 70 of file Borders.php.

Referenced by getBottom().

◆ $_diagonal

PHPExcel_Style_Borders::$_diagonal
protected

Definition at line 77 of file Borders.php.

Referenced by getDiagonal().

◆ $_diagonalDirection

PHPExcel_Style_Borders::$_diagonalDirection
protected

Definition at line 84 of file Borders.php.

Referenced by getDiagonalDirection().

◆ $_horizontal

PHPExcel_Style_Borders::$_horizontal
protected

Definition at line 119 of file Borders.php.

Referenced by getHorizontal().

◆ $_inside

PHPExcel_Style_Borders::$_inside
protected

Definition at line 105 of file Borders.php.

Referenced by getInside().

◆ $_left

PHPExcel_Style_Borders::$_left
protected

Definition at line 49 of file Borders.php.

Referenced by getLeft().

◆ $_outline

PHPExcel_Style_Borders::$_outline
protected

Definition at line 98 of file Borders.php.

Referenced by getOutline().

◆ $_right

PHPExcel_Style_Borders::$_right
protected

Definition at line 56 of file Borders.php.

Referenced by getRight().

◆ $_top

PHPExcel_Style_Borders::$_top
protected

Definition at line 63 of file Borders.php.

Referenced by getTop().

◆ $_vertical

PHPExcel_Style_Borders::$_vertical
protected

Definition at line 112 of file Borders.php.

Referenced by getVertical().

◆ DIAGONAL_BOTH

◆ DIAGONAL_DOWN

◆ DIAGONAL_NONE

const PHPExcel_Style_Borders::DIAGONAL_NONE = 0

◆ DIAGONAL_UP


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