@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private $_index; |
107 | 107 | |
108 | - /** |
|
109 | - * Create a new PHPExcel_Style |
|
108 | + /** |
|
109 | + * Create a new PHPExcel_Style |
|
110 | 110 | * |
111 | 111 | * @param boolean $isSupervisor |
112 | - */ |
|
113 | - public function __construct($isSupervisor = false) |
|
114 | - { |
|
115 | - // Supervisor? |
|
112 | + */ |
|
113 | + public function __construct($isSupervisor = false) |
|
114 | + { |
|
115 | + // Supervisor? |
|
116 | 116 | $this->_isSupervisor = $isSupervisor; |
117 | 117 | |
118 | 118 | // Initialise values |
119 | - $this->_conditionalStyles = array(); |
|
119 | + $this->_conditionalStyles = array(); |
|
120 | 120 | $this->_font = new PHPExcel_Style_Font($isSupervisor); |
121 | 121 | $this->_fill = new PHPExcel_Style_Fill($isSupervisor); |
122 | 122 | $this->_borders = new PHPExcel_Style_Borders($isSupervisor); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->_numberFormat->bindParent($this); |
134 | 134 | $this->_protection->bindParent($this); |
135 | 135 | } |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Bind parent. Only used for supervisor |
@@ -219,45 +219,45 @@ discard block |
||
219 | 219 | return $this->_parent; |
220 | 220 | } |
221 | 221 | |
222 | - /** |
|
223 | - * Apply styles from array |
|
224 | - * |
|
225 | - * <code> |
|
226 | - * $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray( |
|
227 | - * array( |
|
228 | - * 'font' => array( |
|
229 | - * 'name' => 'Arial', |
|
230 | - * 'bold' => true, |
|
231 | - * 'italic' => false, |
|
232 | - * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, |
|
233 | - * 'strike' => false, |
|
234 | - * 'color' => array( |
|
235 | - * 'rgb' => '808080' |
|
236 | - * ) |
|
237 | - * ), |
|
238 | - * 'borders' => array( |
|
239 | - * 'bottom' => array( |
|
240 | - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
241 | - * 'color' => array( |
|
242 | - * 'rgb' => '808080' |
|
243 | - * ) |
|
244 | - * ), |
|
245 | - * 'top' => array( |
|
246 | - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
247 | - * 'color' => array( |
|
248 | - * 'rgb' => '808080' |
|
249 | - * ) |
|
250 | - * ) |
|
251 | - * ) |
|
252 | - * ) |
|
253 | - * ); |
|
254 | - * </code> |
|
255 | - * |
|
256 | - * @param array $pStyles Array containing style information |
|
257 | - * @param boolean $pAdvanced Advanced mode for setting borders. |
|
258 | - * @throws Exception |
|
259 | - * @return PHPExcel_Style |
|
260 | - */ |
|
222 | + /** |
|
223 | + * Apply styles from array |
|
224 | + * |
|
225 | + * <code> |
|
226 | + * $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray( |
|
227 | + * array( |
|
228 | + * 'font' => array( |
|
229 | + * 'name' => 'Arial', |
|
230 | + * 'bold' => true, |
|
231 | + * 'italic' => false, |
|
232 | + * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, |
|
233 | + * 'strike' => false, |
|
234 | + * 'color' => array( |
|
235 | + * 'rgb' => '808080' |
|
236 | + * ) |
|
237 | + * ), |
|
238 | + * 'borders' => array( |
|
239 | + * 'bottom' => array( |
|
240 | + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
241 | + * 'color' => array( |
|
242 | + * 'rgb' => '808080' |
|
243 | + * ) |
|
244 | + * ), |
|
245 | + * 'top' => array( |
|
246 | + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
247 | + * 'color' => array( |
|
248 | + * 'rgb' => '808080' |
|
249 | + * ) |
|
250 | + * ) |
|
251 | + * ) |
|
252 | + * ) |
|
253 | + * ); |
|
254 | + * </code> |
|
255 | + * |
|
256 | + * @param array $pStyles Array containing style information |
|
257 | + * @param boolean $pAdvanced Advanced mode for setting borders. |
|
258 | + * @throws Exception |
|
259 | + * @return PHPExcel_Style |
|
260 | + */ |
|
261 | 261 | public function applyFromArray($pStyles = null, $pAdvanced = true) { |
262 | 262 | if (is_array($pStyles)) { |
263 | 263 | if ($this->_isSupervisor) { |
@@ -532,23 +532,23 @@ discard block |
||
532 | 532 | return $this; |
533 | 533 | } |
534 | 534 | |
535 | - /** |
|
536 | - * Get Fill |
|
537 | - * |
|
538 | - * @return PHPExcel_Style_Fill |
|
539 | - */ |
|
540 | - public function getFill() { |
|
535 | + /** |
|
536 | + * Get Fill |
|
537 | + * |
|
538 | + * @return PHPExcel_Style_Fill |
|
539 | + */ |
|
540 | + public function getFill() { |
|
541 | 541 | return $this->_fill; |
542 | - } |
|
543 | - |
|
544 | - /** |
|
545 | - * Get Font |
|
546 | - * |
|
547 | - * @return PHPExcel_Style_Font |
|
548 | - */ |
|
549 | - public function getFont() { |
|
542 | + } |
|
543 | + |
|
544 | + /** |
|
545 | + * Get Font |
|
546 | + * |
|
547 | + * @return PHPExcel_Style_Font |
|
548 | + */ |
|
549 | + public function getFont() { |
|
550 | 550 | return $this->_font; |
551 | - } |
|
551 | + } |
|
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Set font |
@@ -562,63 +562,63 @@ discard block |
||
562 | 562 | return $this; |
563 | 563 | } |
564 | 564 | |
565 | - /** |
|
566 | - * Get Borders |
|
567 | - * |
|
568 | - * @return PHPExcel_Style_Borders |
|
569 | - */ |
|
570 | - public function getBorders() { |
|
565 | + /** |
|
566 | + * Get Borders |
|
567 | + * |
|
568 | + * @return PHPExcel_Style_Borders |
|
569 | + */ |
|
570 | + public function getBorders() { |
|
571 | 571 | return $this->_borders; |
572 | - } |
|
573 | - |
|
574 | - /** |
|
575 | - * Get Alignment |
|
576 | - * |
|
577 | - * @return PHPExcel_Style_Alignment |
|
578 | - */ |
|
579 | - public function getAlignment() { |
|
572 | + } |
|
573 | + |
|
574 | + /** |
|
575 | + * Get Alignment |
|
576 | + * |
|
577 | + * @return PHPExcel_Style_Alignment |
|
578 | + */ |
|
579 | + public function getAlignment() { |
|
580 | 580 | return $this->_alignment; |
581 | - } |
|
582 | - |
|
583 | - /** |
|
584 | - * Get Number Format |
|
585 | - * |
|
586 | - * @return PHPExcel_Style_NumberFormat |
|
587 | - */ |
|
588 | - public function getNumberFormat() { |
|
581 | + } |
|
582 | + |
|
583 | + /** |
|
584 | + * Get Number Format |
|
585 | + * |
|
586 | + * @return PHPExcel_Style_NumberFormat |
|
587 | + */ |
|
588 | + public function getNumberFormat() { |
|
589 | 589 | return $this->_numberFormat; |
590 | - } |
|
591 | - |
|
592 | - /** |
|
593 | - * Get Conditional Styles. Only used on supervisor. |
|
594 | - * |
|
595 | - * @return PHPExcel_Style_Conditional[] |
|
596 | - */ |
|
597 | - public function getConditionalStyles() { |
|
590 | + } |
|
591 | + |
|
592 | + /** |
|
593 | + * Get Conditional Styles. Only used on supervisor. |
|
594 | + * |
|
595 | + * @return PHPExcel_Style_Conditional[] |
|
596 | + */ |
|
597 | + public function getConditionalStyles() { |
|
598 | 598 | return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); |
599 | - } |
|
600 | - |
|
601 | - /** |
|
602 | - * Set Conditional Styles. Only used on supervisor. |
|
603 | - * |
|
604 | - * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles |
|
605 | - * @return PHPExcel_Style |
|
606 | - */ |
|
607 | - public function setConditionalStyles($pValue = null) { |
|
599 | + } |
|
600 | + |
|
601 | + /** |
|
602 | + * Set Conditional Styles. Only used on supervisor. |
|
603 | + * |
|
604 | + * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles |
|
605 | + * @return PHPExcel_Style |
|
606 | + */ |
|
607 | + public function setConditionalStyles($pValue = null) { |
|
608 | 608 | if (is_array($pValue)) { |
609 | 609 | $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); |
610 | 610 | } |
611 | 611 | return $this; |
612 | - } |
|
613 | - |
|
614 | - /** |
|
615 | - * Get Protection |
|
616 | - * |
|
617 | - * @return PHPExcel_Style_Protection |
|
618 | - */ |
|
619 | - public function getProtection() { |
|
612 | + } |
|
613 | + |
|
614 | + /** |
|
615 | + * Get Protection |
|
616 | + * |
|
617 | + * @return PHPExcel_Style_Protection |
|
618 | + */ |
|
619 | + public function getProtection() { |
|
620 | 620 | return $this->_protection; |
621 | - } |
|
621 | + } |
|
622 | 622 | |
623 | 623 | /** |
624 | 624 | * Get hash code |
@@ -631,17 +631,17 @@ discard block |
||
631 | 631 | $hashConditionals .= $conditional->getHashCode(); |
632 | 632 | } |
633 | 633 | |
634 | - return md5( |
|
635 | - $this->_fill->getHashCode() |
|
636 | - . $this->_font->getHashCode() |
|
637 | - . $this->_borders->getHashCode() |
|
638 | - . $this->_alignment->getHashCode() |
|
639 | - . $this->_numberFormat->getHashCode() |
|
640 | - . $hashConditionals |
|
641 | - . $this->_protection->getHashCode() |
|
642 | - . __CLASS__ |
|
643 | - ); |
|
644 | - } |
|
634 | + return md5( |
|
635 | + $this->_fill->getHashCode() |
|
636 | + . $this->_font->getHashCode() |
|
637 | + . $this->_borders->getHashCode() |
|
638 | + . $this->_alignment->getHashCode() |
|
639 | + . $this->_numberFormat->getHashCode() |
|
640 | + . $hashConditionals |
|
641 | + . $this->_protection->getHashCode() |
|
642 | + . __CLASS__ |
|
643 | + ); |
|
644 | + } |
|
645 | 645 | |
646 | 646 | /** |
647 | 647 | * Get own index in style collection |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | $this->_isSupervisor = $isSupervisor; |
117 | 117 | |
118 | 118 | // Initialise values |
119 | - $this->_conditionalStyles = array(); |
|
119 | + $this->_conditionalStyles = array(); |
|
120 | 120 | $this->_font = new PHPExcel_Style_Font($isSupervisor); |
121 | 121 | $this->_fill = new PHPExcel_Style_Fill($isSupervisor); |
122 | - $this->_borders = new PHPExcel_Style_Borders($isSupervisor); |
|
123 | - $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor); |
|
124 | - $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor); |
|
125 | - $this->_protection = new PHPExcel_Style_Protection($isSupervisor); |
|
122 | + $this->_borders = new PHPExcel_Style_Borders($isSupervisor); |
|
123 | + $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor); |
|
124 | + $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor); |
|
125 | + $this->_protection = new PHPExcel_Style_Protection($isSupervisor); |
|
126 | 126 | |
127 | 127 | // bind parent if we are a supervisor |
128 | 128 | if ($isSupervisor) { |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | |
278 | 278 | // Calculate range outer borders |
279 | 279 | $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); |
280 | - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
280 | + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
281 | 281 | |
282 | 282 | // Translate column into index |
283 | - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; |
|
284 | - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; |
|
283 | + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; |
|
284 | + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; |
|
285 | 285 | |
286 | 286 | // Make sure we can loop upwards on rows and columns |
287 | 287 | if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // it applies to components that have not been set explicitly |
299 | 299 | if (isset($pStyles['borders']['allborders'])) { |
300 | 300 | foreach (array('outline', 'inside') as $component) { |
301 | - if (!isset($pStyles['borders'][$component])) { |
|
301 | + if ( ! isset($pStyles['borders'][$component])) { |
|
302 | 302 | $pStyles['borders'][$component] = $pStyles['borders']['allborders']; |
303 | 303 | } |
304 | 304 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | // it applies to components that have not been set explicitly |
310 | 310 | if (isset($pStyles['borders']['outline'])) { |
311 | 311 | foreach (array('top', 'right', 'bottom', 'left') as $component) { |
312 | - if (!isset($pStyles['borders'][$component])) { |
|
312 | + if ( ! isset($pStyles['borders'][$component])) { |
|
313 | 313 | $pStyles['borders'][$component] = $pStyles['borders']['outline']; |
314 | 314 | } |
315 | 315 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // it applies to components that have not been set explicitly |
321 | 321 | if (isset($pStyles['borders']['inside'])) { |
322 | 322 | foreach (array('vertical', 'horizontal') as $component) { |
323 | - if (!isset($pStyles['borders'][$component])) { |
|
323 | + if ( ! isset($pStyles['borders'][$component])) { |
|
324 | 324 | $pStyles['borders'][$component] = $pStyles['borders']['inside']; |
325 | 325 | } |
326 | 326 | } |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | $rangeStart[1] : $rangeEnd[1] - $yMax + $y; |
378 | 378 | |
379 | 379 | // build range for region |
380 | - $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; |
|
380 | + $range = $colStart.$rowStart.':'.$colEnd.$rowEnd; |
|
381 | 381 | |
382 | 382 | // retrieve relevant style array for region |
383 | 383 | $regionStyles = $pStyles; |
384 | 384 | unset($regionStyles['borders']['inside']); |
385 | 385 | |
386 | 386 | // what are the inner edges of the region when looking at the selection |
387 | - $innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); |
|
387 | + $innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges); |
|
388 | 388 | |
389 | 389 | // inner edges that are not touching the region should take the 'inside' border properties if they have been set |
390 | 390 | foreach ($innerEdges as $innerEdge) { |
@@ -37,59 +37,59 @@ discard block |
||
37 | 37 | { |
38 | 38 | /* Horizontal alignment styles */ |
39 | 39 | const HORIZONTAL_GENERAL = 'general'; |
40 | - const HORIZONTAL_LEFT = 'left'; |
|
41 | - const HORIZONTAL_RIGHT = 'right'; |
|
40 | + const HORIZONTAL_LEFT = 'left'; |
|
41 | + const HORIZONTAL_RIGHT = 'right'; |
|
42 | 42 | const HORIZONTAL_CENTER = 'center'; |
43 | - const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; |
|
43 | + const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; |
|
44 | 44 | const HORIZONTAL_JUSTIFY = 'justify'; |
45 | 45 | |
46 | 46 | /* Vertical alignment styles */ |
47 | 47 | const VERTICAL_BOTTOM = 'bottom'; |
48 | - const VERTICAL_TOP = 'top'; |
|
48 | + const VERTICAL_TOP = 'top'; |
|
49 | 49 | const VERTICAL_CENTER = 'center'; |
50 | - const VERTICAL_JUSTIFY = 'justify'; |
|
50 | + const VERTICAL_JUSTIFY = 'justify'; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Horizontal |
54 | 54 | * |
55 | 55 | * @var string |
56 | 56 | */ |
57 | - private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; |
|
57 | + private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Vertical |
61 | 61 | * |
62 | 62 | * @var string |
63 | 63 | */ |
64 | - private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; |
|
64 | + private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Text rotation |
68 | 68 | * |
69 | 69 | * @var int |
70 | 70 | */ |
71 | - private $_textRotation = 0; |
|
71 | + private $_textRotation = 0; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Wrap text |
75 | 75 | * |
76 | 76 | * @var boolean |
77 | 77 | */ |
78 | - private $_wrapText = false; |
|
78 | + private $_wrapText = false; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Shrink to fit |
82 | 82 | * |
83 | 83 | * @var boolean |
84 | 84 | */ |
85 | - private $_shrinkToFit = false; |
|
85 | + private $_shrinkToFit = false; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Indent - only possible with horizontal alignment left and right |
89 | 89 | * |
90 | 90 | * @var int |
91 | 91 | */ |
92 | - private $_indent = 0; |
|
92 | + private $_indent = 0; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Parent Borders |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | // Set rotation |
341 | - if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) { |
|
341 | + if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) { |
|
342 | 342 | if ($this->_isSupervisor) { |
343 | 343 | $styleArray = $this->getStyleArray(array('rotation' => $pValue)); |
344 | 344 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
@@ -273,8 +273,7 @@ |
||
273 | 273 | if ($this->_isSupervisor) { |
274 | 274 | $styleArray = $this->getStyleArray(array('horizontal' => $pValue)); |
275 | 275 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
276 | - } |
|
277 | - else { |
|
276 | + } else { |
|
278 | 277 | $this->_horizontal = $pValue; |
279 | 278 | } |
280 | 279 | return $this; |
@@ -211,45 +211,45 @@ |
||
211 | 211 | public function getStyleArray($array) |
212 | 212 | { |
213 | 213 | switch ($this->_parentPropertyName) { |
214 | - case '_allBorders': |
|
215 | - $key = 'allborders'; |
|
216 | - break; |
|
214 | + case '_allBorders': |
|
215 | + $key = 'allborders'; |
|
216 | + break; |
|
217 | 217 | |
218 | - case '_bottom': |
|
219 | - $key = 'bottom'; |
|
220 | - break; |
|
218 | + case '_bottom': |
|
219 | + $key = 'bottom'; |
|
220 | + break; |
|
221 | 221 | |
222 | - case '_diagonal': |
|
223 | - $key = 'diagonal'; |
|
224 | - break; |
|
222 | + case '_diagonal': |
|
223 | + $key = 'diagonal'; |
|
224 | + break; |
|
225 | 225 | |
226 | - case '_horizontal': |
|
227 | - $key = 'horizontal'; |
|
228 | - break; |
|
226 | + case '_horizontal': |
|
227 | + $key = 'horizontal'; |
|
228 | + break; |
|
229 | 229 | |
230 | - case '_inside': |
|
231 | - $key = 'inside'; |
|
232 | - break; |
|
230 | + case '_inside': |
|
231 | + $key = 'inside'; |
|
232 | + break; |
|
233 | 233 | |
234 | - case '_left': |
|
235 | - $key = 'left'; |
|
236 | - break; |
|
234 | + case '_left': |
|
235 | + $key = 'left'; |
|
236 | + break; |
|
237 | 237 | |
238 | - case '_outline': |
|
239 | - $key = 'outline'; |
|
240 | - break; |
|
238 | + case '_outline': |
|
239 | + $key = 'outline'; |
|
240 | + break; |
|
241 | 241 | |
242 | - case '_right': |
|
243 | - $key = 'right'; |
|
244 | - break; |
|
242 | + case '_right': |
|
243 | + $key = 'right'; |
|
244 | + break; |
|
245 | 245 | |
246 | - case '_top': |
|
247 | - $key = 'top'; |
|
248 | - break; |
|
246 | + case '_top': |
|
247 | + $key = 'top'; |
|
248 | + break; |
|
249 | 249 | |
250 | - case '_vertical': |
|
251 | - $key = 'vertical'; |
|
252 | - break; |
|
250 | + case '_vertical': |
|
251 | + $key = 'vertical'; |
|
252 | + break; |
|
253 | 253 | } |
254 | 254 | return $this->_parent->getStyleArray(array($key => $array)); |
255 | 255 | } |
@@ -36,27 +36,27 @@ discard block |
||
36 | 36 | class PHPExcel_Style_Border implements PHPExcel_IComparable |
37 | 37 | { |
38 | 38 | /* Border style */ |
39 | - const BORDER_NONE = 'none'; |
|
39 | + const BORDER_NONE = 'none'; |
|
40 | 40 | const BORDER_DASHDOT = 'dashDot'; |
41 | - const BORDER_DASHDOTDOT = 'dashDotDot'; |
|
41 | + const BORDER_DASHDOTDOT = 'dashDotDot'; |
|
42 | 42 | const BORDER_DASHED = 'dashed'; |
43 | 43 | const BORDER_DOTTED = 'dotted'; |
44 | 44 | const BORDER_DOUBLE = 'double'; |
45 | - const BORDER_HAIR = 'hair'; |
|
45 | + const BORDER_HAIR = 'hair'; |
|
46 | 46 | const BORDER_MEDIUM = 'medium'; |
47 | - const BORDER_MEDIUMDASHDOT = 'mediumDashDot'; |
|
48 | - const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'; |
|
47 | + const BORDER_MEDIUMDASHDOT = 'mediumDashDot'; |
|
48 | + const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'; |
|
49 | 49 | const BORDER_MEDIUMDASHED = 'mediumDashed'; |
50 | 50 | const BORDER_SLANTDASHDOT = 'slantDashDot'; |
51 | - const BORDER_THICK = 'thick'; |
|
52 | - const BORDER_THIN = 'thin'; |
|
51 | + const BORDER_THICK = 'thick'; |
|
52 | + const BORDER_THIN = 'thin'; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Border style |
56 | 56 | * |
57 | 57 | * @var string |
58 | 58 | */ |
59 | - private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; |
|
59 | + private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Border color |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->_isSupervisor = $isSupervisor; |
98 | 98 | |
99 | 99 | // Initialise values |
100 | - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); |
|
100 | + $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); |
|
101 | 101 | |
102 | 102 | // bind parent if we are a supervisor |
103 | 103 | if ($isSupervisor) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | /* Diagonal directions */ |
39 | 39 | const DIAGONAL_NONE = 0; |
40 | - const DIAGONAL_UP = 1; |
|
40 | + const DIAGONAL_UP = 1; |
|
41 | 41 | const DIAGONAL_DOWN = 2; |
42 | 42 | const DIAGONAL_BOTH = 3; |
43 | 43 | |
@@ -151,20 +151,20 @@ discard block |
||
151 | 151 | |
152 | 152 | // Initialise values |
153 | 153 | $this->_left = new PHPExcel_Style_Border($isSupervisor); |
154 | - $this->_right = new PHPExcel_Style_Border($isSupervisor); |
|
154 | + $this->_right = new PHPExcel_Style_Border($isSupervisor); |
|
155 | 155 | $this->_top = new PHPExcel_Style_Border($isSupervisor); |
156 | - $this->_bottom = new PHPExcel_Style_Border($isSupervisor); |
|
157 | - $this->_diagonal = new PHPExcel_Style_Border($isSupervisor); |
|
158 | - $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE; |
|
156 | + $this->_bottom = new PHPExcel_Style_Border($isSupervisor); |
|
157 | + $this->_diagonal = new PHPExcel_Style_Border($isSupervisor); |
|
158 | + $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE; |
|
159 | 159 | |
160 | 160 | // Specially for supervisor |
161 | 161 | if ($isSupervisor) { |
162 | 162 | // Initialize pseudo-borders |
163 | - $this->_allBorders = new PHPExcel_Style_Border(true); |
|
163 | + $this->_allBorders = new PHPExcel_Style_Border(true); |
|
164 | 164 | $this->_outline = new PHPExcel_Style_Border(true); |
165 | - $this->_inside = new PHPExcel_Style_Border(true); |
|
165 | + $this->_inside = new PHPExcel_Style_Border(true); |
|
166 | 166 | $this->_vertical = new PHPExcel_Style_Border(true); |
167 | - $this->_horizontal = new PHPExcel_Style_Border(true); |
|
167 | + $this->_horizontal = new PHPExcel_Style_Border(true); |
|
168 | 168 | |
169 | 169 | // bind parent if we are a supervisor |
170 | 170 | $this->_left->bindParent($this, '_left'); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @throws Exception |
383 | 383 | */ |
384 | 384 | public function getAllBorders() { |
385 | - if (!$this->_isSupervisor) { |
|
385 | + if ( ! $this->_isSupervisor) { |
|
386 | 386 | throw new Exception('Can only get pseudo-border for supervisor.'); |
387 | 387 | } |
388 | 388 | return $this->_allBorders; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * @throws Exception |
396 | 396 | */ |
397 | 397 | public function getOutline() { |
398 | - if (!$this->_isSupervisor) { |
|
398 | + if ( ! $this->_isSupervisor) { |
|
399 | 399 | throw new Exception('Can only get pseudo-border for supervisor.'); |
400 | 400 | } |
401 | 401 | return $this->_outline; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @throws Exception |
409 | 409 | */ |
410 | 410 | public function getInside() { |
411 | - if (!$this->_isSupervisor) { |
|
411 | + if ( ! $this->_isSupervisor) { |
|
412 | 412 | throw new Exception('Can only get pseudo-border for supervisor.'); |
413 | 413 | } |
414 | 414 | return $this->_inside; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @throws Exception |
422 | 422 | */ |
423 | 423 | public function getVertical() { |
424 | - if (!$this->_isSupervisor) { |
|
424 | + if ( ! $this->_isSupervisor) { |
|
425 | 425 | throw new Exception('Can only get pseudo-border for supervisor.'); |
426 | 426 | } |
427 | 427 | return $this->_vertical; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @throws Exception |
435 | 435 | */ |
436 | 436 | public function getHorizontal() { |
437 | - if (!$this->_isSupervisor) { |
|
437 | + if ( ! $this->_isSupervisor) { |
|
438 | 438 | throw new Exception('Can only get pseudo-border for supervisor.'); |
439 | 439 | } |
440 | 440 | return $this->_horizontal; |
@@ -140,21 +140,21 @@ discard block |
||
140 | 140 | private $_parent; |
141 | 141 | |
142 | 142 | /** |
143 | - * Create a new PHPExcel_Style_Borders |
|
143 | + * Create a new PHPExcel_Style_Borders |
|
144 | 144 | * |
145 | 145 | * @param boolean $isSupervisor Flag indicating if this is a supervisor or not |
146 | - */ |
|
147 | - public function __construct($isSupervisor = false) |
|
148 | - { |
|
149 | - // Supervisor? |
|
146 | + */ |
|
147 | + public function __construct($isSupervisor = false) |
|
148 | + { |
|
149 | + // Supervisor? |
|
150 | 150 | $this->_isSupervisor = $isSupervisor; |
151 | 151 | |
152 | - // Initialise values |
|
153 | - $this->_left = new PHPExcel_Style_Border($isSupervisor); |
|
154 | - $this->_right = new PHPExcel_Style_Border($isSupervisor); |
|
155 | - $this->_top = new PHPExcel_Style_Border($isSupervisor); |
|
156 | - $this->_bottom = new PHPExcel_Style_Border($isSupervisor); |
|
157 | - $this->_diagonal = new PHPExcel_Style_Border($isSupervisor); |
|
152 | + // Initialise values |
|
153 | + $this->_left = new PHPExcel_Style_Border($isSupervisor); |
|
154 | + $this->_right = new PHPExcel_Style_Border($isSupervisor); |
|
155 | + $this->_top = new PHPExcel_Style_Border($isSupervisor); |
|
156 | + $this->_bottom = new PHPExcel_Style_Border($isSupervisor); |
|
157 | + $this->_diagonal = new PHPExcel_Style_Border($isSupervisor); |
|
158 | 158 | $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE; |
159 | 159 | |
160 | 160 | // Specially for supervisor |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $this->_vertical->bindParent($this, '_vertical'); |
179 | 179 | $this->_horizontal->bindParent($this, '_horizontal'); |
180 | 180 | } |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Bind parent. Only used for supervisor |
@@ -257,43 +257,43 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
260 | - * Apply styles from array |
|
261 | - * |
|
262 | - * <code> |
|
263 | - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( |
|
264 | - * array( |
|
265 | - * 'bottom' => array( |
|
266 | - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
267 | - * 'color' => array( |
|
268 | - * 'rgb' => '808080' |
|
269 | - * ) |
|
270 | - * ), |
|
271 | - * 'top' => array( |
|
272 | - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
273 | - * 'color' => array( |
|
274 | - * 'rgb' => '808080' |
|
275 | - * ) |
|
276 | - * ) |
|
277 | - * ) |
|
278 | - * ); |
|
279 | - * </code> |
|
280 | - * <code> |
|
281 | - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( |
|
282 | - * array( |
|
283 | - * 'allborders' => array( |
|
284 | - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
285 | - * 'color' => array( |
|
286 | - * 'rgb' => '808080' |
|
287 | - * ) |
|
288 | - * ) |
|
289 | - * ) |
|
290 | - * ); |
|
291 | - * </code> |
|
292 | - * |
|
293 | - * @param array $pStyles Array containing style information |
|
294 | - * @throws Exception |
|
295 | - * @return PHPExcel_Style_Borders |
|
296 | - */ |
|
260 | + * Apply styles from array |
|
261 | + * |
|
262 | + * <code> |
|
263 | + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( |
|
264 | + * array( |
|
265 | + * 'bottom' => array( |
|
266 | + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
267 | + * 'color' => array( |
|
268 | + * 'rgb' => '808080' |
|
269 | + * ) |
|
270 | + * ), |
|
271 | + * 'top' => array( |
|
272 | + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
273 | + * 'color' => array( |
|
274 | + * 'rgb' => '808080' |
|
275 | + * ) |
|
276 | + * ) |
|
277 | + * ) |
|
278 | + * ); |
|
279 | + * </code> |
|
280 | + * <code> |
|
281 | + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( |
|
282 | + * array( |
|
283 | + * 'allborders' => array( |
|
284 | + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|
285 | + * 'color' => array( |
|
286 | + * 'rgb' => '808080' |
|
287 | + * ) |
|
288 | + * ) |
|
289 | + * ) |
|
290 | + * ); |
|
291 | + * </code> |
|
292 | + * |
|
293 | + * @param array $pStyles Array containing style information |
|
294 | + * @throws Exception |
|
295 | + * @return PHPExcel_Style_Borders |
|
296 | + */ |
|
297 | 297 | public function applyFromArray($pStyles = null) { |
298 | 298 | if (is_array($pStyles)) { |
299 | 299 | if ($this->_isSupervisor) { |
@@ -330,138 +330,138 @@ discard block |
||
330 | 330 | return $this; |
331 | 331 | } |
332 | 332 | |
333 | - /** |
|
334 | - * Get Left |
|
335 | - * |
|
336 | - * @return PHPExcel_Style_Border |
|
337 | - */ |
|
338 | - public function getLeft() { |
|
333 | + /** |
|
334 | + * Get Left |
|
335 | + * |
|
336 | + * @return PHPExcel_Style_Border |
|
337 | + */ |
|
338 | + public function getLeft() { |
|
339 | 339 | return $this->_left; |
340 | - } |
|
341 | - |
|
342 | - /** |
|
343 | - * Get Right |
|
344 | - * |
|
345 | - * @return PHPExcel_Style_Border |
|
346 | - */ |
|
347 | - public function getRight() { |
|
340 | + } |
|
341 | + |
|
342 | + /** |
|
343 | + * Get Right |
|
344 | + * |
|
345 | + * @return PHPExcel_Style_Border |
|
346 | + */ |
|
347 | + public function getRight() { |
|
348 | 348 | return $this->_right; |
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * Get Top |
|
353 | - * |
|
354 | - * @return PHPExcel_Style_Border |
|
355 | - */ |
|
356 | - public function getTop() { |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * Get Top |
|
353 | + * |
|
354 | + * @return PHPExcel_Style_Border |
|
355 | + */ |
|
356 | + public function getTop() { |
|
357 | 357 | return $this->_top; |
358 | - } |
|
359 | - |
|
360 | - /** |
|
361 | - * Get Bottom |
|
362 | - * |
|
363 | - * @return PHPExcel_Style_Border |
|
364 | - */ |
|
365 | - public function getBottom() { |
|
358 | + } |
|
359 | + |
|
360 | + /** |
|
361 | + * Get Bottom |
|
362 | + * |
|
363 | + * @return PHPExcel_Style_Border |
|
364 | + */ |
|
365 | + public function getBottom() { |
|
366 | 366 | return $this->_bottom; |
367 | - } |
|
368 | - |
|
369 | - /** |
|
370 | - * Get Diagonal |
|
371 | - * |
|
372 | - * @return PHPExcel_Style_Border |
|
373 | - */ |
|
374 | - public function getDiagonal() { |
|
367 | + } |
|
368 | + |
|
369 | + /** |
|
370 | + * Get Diagonal |
|
371 | + * |
|
372 | + * @return PHPExcel_Style_Border |
|
373 | + */ |
|
374 | + public function getDiagonal() { |
|
375 | 375 | return $this->_diagonal; |
376 | - } |
|
377 | - |
|
378 | - /** |
|
379 | - * Get AllBorders (pseudo-border). Only applies to supervisor. |
|
380 | - * |
|
381 | - * @return PHPExcel_Style_Border |
|
382 | - * @throws Exception |
|
383 | - */ |
|
384 | - public function getAllBorders() { |
|
376 | + } |
|
377 | + |
|
378 | + /** |
|
379 | + * Get AllBorders (pseudo-border). Only applies to supervisor. |
|
380 | + * |
|
381 | + * @return PHPExcel_Style_Border |
|
382 | + * @throws Exception |
|
383 | + */ |
|
384 | + public function getAllBorders() { |
|
385 | 385 | if (!$this->_isSupervisor) { |
386 | 386 | throw new Exception('Can only get pseudo-border for supervisor.'); |
387 | 387 | } |
388 | 388 | return $this->_allBorders; |
389 | - } |
|
390 | - |
|
391 | - /** |
|
392 | - * Get Outline (pseudo-border). Only applies to supervisor. |
|
393 | - * |
|
394 | - * @return boolean |
|
395 | - * @throws Exception |
|
396 | - */ |
|
397 | - public function getOutline() { |
|
389 | + } |
|
390 | + |
|
391 | + /** |
|
392 | + * Get Outline (pseudo-border). Only applies to supervisor. |
|
393 | + * |
|
394 | + * @return boolean |
|
395 | + * @throws Exception |
|
396 | + */ |
|
397 | + public function getOutline() { |
|
398 | 398 | if (!$this->_isSupervisor) { |
399 | 399 | throw new Exception('Can only get pseudo-border for supervisor.'); |
400 | 400 | } |
401 | - return $this->_outline; |
|
402 | - } |
|
403 | - |
|
404 | - /** |
|
405 | - * Get Inside (pseudo-border). Only applies to supervisor. |
|
406 | - * |
|
407 | - * @return boolean |
|
408 | - * @throws Exception |
|
409 | - */ |
|
410 | - public function getInside() { |
|
401 | + return $this->_outline; |
|
402 | + } |
|
403 | + |
|
404 | + /** |
|
405 | + * Get Inside (pseudo-border). Only applies to supervisor. |
|
406 | + * |
|
407 | + * @return boolean |
|
408 | + * @throws Exception |
|
409 | + */ |
|
410 | + public function getInside() { |
|
411 | 411 | if (!$this->_isSupervisor) { |
412 | 412 | throw new Exception('Can only get pseudo-border for supervisor.'); |
413 | 413 | } |
414 | - return $this->_inside; |
|
415 | - } |
|
416 | - |
|
417 | - /** |
|
418 | - * Get Vertical (pseudo-border). Only applies to supervisor. |
|
419 | - * |
|
420 | - * @return PHPExcel_Style_Border |
|
421 | - * @throws Exception |
|
422 | - */ |
|
423 | - public function getVertical() { |
|
414 | + return $this->_inside; |
|
415 | + } |
|
416 | + |
|
417 | + /** |
|
418 | + * Get Vertical (pseudo-border). Only applies to supervisor. |
|
419 | + * |
|
420 | + * @return PHPExcel_Style_Border |
|
421 | + * @throws Exception |
|
422 | + */ |
|
423 | + public function getVertical() { |
|
424 | 424 | if (!$this->_isSupervisor) { |
425 | 425 | throw new Exception('Can only get pseudo-border for supervisor.'); |
426 | 426 | } |
427 | 427 | return $this->_vertical; |
428 | - } |
|
429 | - |
|
430 | - /** |
|
431 | - * Get Horizontal (pseudo-border). Only applies to supervisor. |
|
432 | - * |
|
433 | - * @return PHPExcel_Style_Border |
|
434 | - * @throws Exception |
|
435 | - */ |
|
436 | - public function getHorizontal() { |
|
428 | + } |
|
429 | + |
|
430 | + /** |
|
431 | + * Get Horizontal (pseudo-border). Only applies to supervisor. |
|
432 | + * |
|
433 | + * @return PHPExcel_Style_Border |
|
434 | + * @throws Exception |
|
435 | + */ |
|
436 | + public function getHorizontal() { |
|
437 | 437 | if (!$this->_isSupervisor) { |
438 | 438 | throw new Exception('Can only get pseudo-border for supervisor.'); |
439 | 439 | } |
440 | 440 | return $this->_horizontal; |
441 | - } |
|
442 | - |
|
443 | - /** |
|
444 | - * Get DiagonalDirection |
|
445 | - * |
|
446 | - * @return int |
|
447 | - */ |
|
448 | - public function getDiagonalDirection() { |
|
441 | + } |
|
442 | + |
|
443 | + /** |
|
444 | + * Get DiagonalDirection |
|
445 | + * |
|
446 | + * @return int |
|
447 | + */ |
|
448 | + public function getDiagonalDirection() { |
|
449 | 449 | if ($this->_isSupervisor) { |
450 | 450 | return $this->getSharedComponent()->getDiagonalDirection(); |
451 | 451 | } |
452 | - return $this->_diagonalDirection; |
|
453 | - } |
|
454 | - |
|
455 | - /** |
|
456 | - * Set DiagonalDirection |
|
457 | - * |
|
458 | - * @param int $pValue |
|
459 | - * @return PHPExcel_Style_Borders |
|
460 | - */ |
|
461 | - public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE) { |
|
462 | - if ($pValue == '') { |
|
463 | - $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE; |
|
464 | - } |
|
452 | + return $this->_diagonalDirection; |
|
453 | + } |
|
454 | + |
|
455 | + /** |
|
456 | + * Set DiagonalDirection |
|
457 | + * |
|
458 | + * @param int $pValue |
|
459 | + * @return PHPExcel_Style_Borders |
|
460 | + */ |
|
461 | + public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE) { |
|
462 | + if ($pValue == '') { |
|
463 | + $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE; |
|
464 | + } |
|
465 | 465 | if ($this->_isSupervisor) { |
466 | 466 | $styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue)); |
467 | 467 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $this->_diagonalDirection = $pValue; |
470 | 470 | } |
471 | 471 | return $this; |
472 | - } |
|
472 | + } |
|
473 | 473 | |
474 | 474 | /** |
475 | 475 | * Get hash code |
@@ -480,16 +480,16 @@ discard block |
||
480 | 480 | if ($this->_isSupervisor) { |
481 | 481 | return $this->getSharedComponent()->getHashcode(); |
482 | 482 | } |
483 | - return md5( |
|
484 | - $this->getLeft()->getHashCode() |
|
485 | - . $this->getRight()->getHashCode() |
|
486 | - . $this->getTop()->getHashCode() |
|
487 | - . $this->getBottom()->getHashCode() |
|
488 | - . $this->getDiagonal()->getHashCode() |
|
489 | - . $this->getDiagonalDirection() |
|
490 | - . __CLASS__ |
|
491 | - ); |
|
492 | - } |
|
483 | + return md5( |
|
484 | + $this->getLeft()->getHashCode() |
|
485 | + . $this->getRight()->getHashCode() |
|
486 | + . $this->getTop()->getHashCode() |
|
487 | + . $this->getBottom()->getHashCode() |
|
488 | + . $this->getDiagonal()->getHashCode() |
|
489 | + . $this->getDiagonalDirection() |
|
490 | + . __CLASS__ |
|
491 | + ); |
|
492 | + } |
|
493 | 493 | |
494 | 494 | /** |
495 | 495 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | public function getSharedComponent() |
132 | 132 | { |
133 | 133 | switch ($this->_parentPropertyName) { |
134 | - case '_endColor': |
|
135 | - return $this->_parent->getSharedComponent()->getEndColor(); |
|
136 | - break; |
|
134 | + case '_endColor': |
|
135 | + return $this->_parent->getSharedComponent()->getEndColor(); |
|
136 | + break; |
|
137 | 137 | |
138 | - case '_color': |
|
139 | - return $this->_parent->getSharedComponent()->getColor(); |
|
140 | - break; |
|
138 | + case '_color': |
|
139 | + return $this->_parent->getSharedComponent()->getColor(); |
|
140 | + break; |
|
141 | 141 | |
142 | - case '_startColor': |
|
143 | - return $this->_parent->getSharedComponent()->getStartColor(); |
|
144 | - break; |
|
142 | + case '_startColor': |
|
143 | + return $this->_parent->getSharedComponent()->getStartColor(); |
|
144 | + break; |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | public function getStyleArray($array) |
187 | 187 | { |
188 | 188 | switch ($this->_parentPropertyName) { |
189 | - case '_endColor': |
|
190 | - $key = 'endcolor'; |
|
191 | - break; |
|
189 | + case '_endColor': |
|
190 | + $key = 'endcolor'; |
|
191 | + break; |
|
192 | 192 | |
193 | - case '_color': |
|
194 | - $key = 'color'; |
|
195 | - break; |
|
193 | + case '_color': |
|
194 | + $key = 'color'; |
|
195 | + break; |
|
196 | 196 | |
197 | - case '_startColor': |
|
198 | - $key = 'startcolor'; |
|
199 | - break; |
|
197 | + case '_startColor': |
|
198 | + $key = 'startcolor'; |
|
199 | + break; |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | return $this->_parent->getStyleArray(array($key => $array)); |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | const COLOR_DARKRED = 'FF800000'; |
43 | 43 | const COLOR_BLUE = 'FF0000FF'; |
44 | 44 | const COLOR_DARKBLUE = 'FF000080'; |
45 | - const COLOR_GREEN = 'FF00FF00'; |
|
46 | - const COLOR_DARKGREEN = 'FF008000'; |
|
47 | - const COLOR_YELLOW = 'FFFFFF00'; |
|
48 | - const COLOR_DARKYELLOW = 'FF808000'; |
|
45 | + const COLOR_GREEN = 'FF00FF00'; |
|
46 | + const COLOR_DARKGREEN = 'FF008000'; |
|
47 | + const COLOR_YELLOW = 'FFFFFF00'; |
|
48 | + const COLOR_DARKYELLOW = 'FF808000'; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Indexed colors array |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | $pValue = '000000'; |
286 | 286 | } |
287 | 287 | if ($this->_isSupervisor) { |
288 | - $styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue)); |
|
288 | + $styleArray = $this->getStyleArray(array('argb' => 'FF'.$pValue)); |
|
289 | 289 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
290 | 290 | } else { |
291 | - $this->_argb = 'FF' . $pValue; |
|
291 | + $this->_argb = 'FF'.$pValue; |
|
292 | 292 | } |
293 | 293 | return $this; |
294 | 294 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * decimal value |
304 | 304 | * @return string The extracted colour component |
305 | 305 | */ |
306 | - private static function _getColourComponent($RGB,$offset,$hex=true) { |
|
307 | - $colour = substr($RGB,$offset,2); |
|
308 | - if (!$hex) |
|
306 | + private static function _getColourComponent($RGB, $offset, $hex = true) { |
|
307 | + $colour = substr($RGB, $offset, 2); |
|
308 | + if ( ! $hex) |
|
309 | 309 | $colour = hexdec($colour); |
310 | 310 | return $colour; |
311 | 311 | } |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * decimal value |
319 | 319 | * @return string The red colour component |
320 | 320 | */ |
321 | - public static function getRed($RGB,$hex=true) { |
|
321 | + public static function getRed($RGB, $hex = true) { |
|
322 | 322 | if (strlen($RGB) == 8) { |
323 | - return self::_getColourComponent($RGB,2,$hex); |
|
323 | + return self::_getColourComponent($RGB, 2, $hex); |
|
324 | 324 | } elseif (strlen($RGB) == 6) { |
325 | - return self::_getColourComponent($RGB,0,$hex); |
|
325 | + return self::_getColourComponent($RGB, 0, $hex); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | * decimal value |
335 | 335 | * @return string The green colour component |
336 | 336 | */ |
337 | - public static function getGreen($RGB,$hex=true) { |
|
337 | + public static function getGreen($RGB, $hex = true) { |
|
338 | 338 | if (strlen($RGB) == 8) { |
339 | - return self::_getColourComponent($RGB,4,$hex); |
|
339 | + return self::_getColourComponent($RGB, 4, $hex); |
|
340 | 340 | } elseif (strlen($RGB) == 6) { |
341 | - return self::_getColourComponent($RGB,2,$hex); |
|
341 | + return self::_getColourComponent($RGB, 2, $hex); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | * decimal value |
351 | 351 | * @return string The blue colour component |
352 | 352 | */ |
353 | - public static function getBlue($RGB,$hex=true) { |
|
353 | + public static function getBlue($RGB, $hex = true) { |
|
354 | 354 | if (strlen($RGB) == 8) { |
355 | - return self::_getColourComponent($RGB,6,$hex); |
|
355 | + return self::_getColourComponent($RGB, 6, $hex); |
|
356 | 356 | } elseif (strlen($RGB) == 6) { |
357 | - return self::_getColourComponent($RGB,4,$hex); |
|
357 | + return self::_getColourComponent($RGB, 4, $hex); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -366,17 +366,17 @@ discard block |
||
366 | 366 | * @return string The adjusted colour as an RGB value (e.g. FF00CCCC or CCDDEE |
367 | 367 | */ |
368 | 368 | public static function changeBrightness($hex, $adjustPercentage) { |
369 | - $red = self::getRed($hex,false); |
|
370 | - $green = self::getGreen($hex,false); |
|
371 | - $blue = self::getBlue($hex,false); |
|
369 | + $red = self::getRed($hex, false); |
|
370 | + $green = self::getGreen($hex, false); |
|
371 | + $blue = self::getBlue($hex, false); |
|
372 | 372 | if ($adjustPercentage > 0) { |
373 | 373 | $red += (255 - $red) * $adjustPercentage; |
374 | - $green += (255 - $green) * $adjustPercentage; |
|
375 | - $blue += (255 - $blue) * $adjustPercentage; |
|
374 | + $green += (255 - $green) * $adjustPercentage; |
|
375 | + $blue += (255 - $blue) * $adjustPercentage; |
|
376 | 376 | } else { |
377 | - $red += $red * $adjustPercentage; |
|
378 | - $green += $green * $adjustPercentage; |
|
379 | - $blue += $blue * $adjustPercentage; |
|
377 | + $red += $red * $adjustPercentage; |
|
378 | + $green += $green * $adjustPercentage; |
|
379 | + $blue += $blue * $adjustPercentage; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | if ($red < 0) $red = 0; |
@@ -386,8 +386,8 @@ discard block |
||
386 | 386 | if ($blue < 0) $blue = 0; |
387 | 387 | elseif ($blue > 255) $blue = 255; |
388 | 388 | |
389 | - return strtoupper( str_pad(dechex($red), 2, '0', 0) . |
|
390 | - str_pad(dechex($green), 2, '0', 0) . |
|
389 | + return strtoupper(str_pad(dechex($red), 2, '0', 0). |
|
390 | + str_pad(dechex($green), 2, '0', 0). |
|
391 | 391 | str_pad(dechex($blue), 2, '0', 0) |
392 | 392 | ); |
393 | 393 | } |
@@ -400,68 +400,68 @@ discard block |
||
400 | 400 | * should be returned if the indexed colour doesn't exist |
401 | 401 | * @return PHPExcel_Style_Color |
402 | 402 | */ |
403 | - public static function indexedColor($pIndex, $background=false) { |
|
403 | + public static function indexedColor($pIndex, $background = false) { |
|
404 | 404 | // Clean parameter |
405 | 405 | $pIndex = intval($pIndex); |
406 | 406 | |
407 | 407 | // Indexed colors |
408 | 408 | if (is_null(self::$_indexedColors)) { |
409 | 409 | self::$_indexedColors = array( |
410 | - 1 => 'FF000000', // System Colour #1 - Black |
|
411 | - 2 => 'FFFFFFFF', // System Colour #2 - White |
|
412 | - 3 => 'FFFF0000', // System Colour #3 - Red |
|
413 | - 4 => 'FF00FF00', // System Colour #4 - Green |
|
414 | - 5 => 'FF0000FF', // System Colour #5 - Blue |
|
415 | - 6 => 'FFFFFF00', // System Colour #6 - Yellow |
|
416 | - 7 => 'FFFF00FF', // System Colour #7- Magenta |
|
417 | - 8 => 'FF00FFFF', // System Colour #8- Cyan |
|
418 | - 9 => 'FF800000', // Standard Colour #9 |
|
419 | - 10 => 'FF008000', // Standard Colour #10 |
|
420 | - 11 => 'FF000080', // Standard Colour #11 |
|
421 | - 12 => 'FF808000', // Standard Colour #12 |
|
422 | - 13 => 'FF800080', // Standard Colour #13 |
|
423 | - 14 => 'FF008080', // Standard Colour #14 |
|
424 | - 15 => 'FFC0C0C0', // Standard Colour #15 |
|
425 | - 16 => 'FF808080', // Standard Colour #16 |
|
426 | - 17 => 'FF9999FF', // Chart Fill Colour #17 |
|
427 | - 18 => 'FF993366', // Chart Fill Colour #18 |
|
428 | - 19 => 'FFFFFFCC', // Chart Fill Colour #19 |
|
429 | - 20 => 'FFCCFFFF', // Chart Fill Colour #20 |
|
430 | - 21 => 'FF660066', // Chart Fill Colour #21 |
|
431 | - 22 => 'FFFF8080', // Chart Fill Colour #22 |
|
432 | - 23 => 'FF0066CC', // Chart Fill Colour #23 |
|
433 | - 24 => 'FFCCCCFF', // Chart Fill Colour #24 |
|
434 | - 25 => 'FF000080', // Chart Line Colour #25 |
|
435 | - 26 => 'FFFF00FF', // Chart Line Colour #26 |
|
436 | - 27 => 'FFFFFF00', // Chart Line Colour #27 |
|
437 | - 28 => 'FF00FFFF', // Chart Line Colour #28 |
|
438 | - 29 => 'FF800080', // Chart Line Colour #29 |
|
439 | - 30 => 'FF800000', // Chart Line Colour #30 |
|
440 | - 31 => 'FF008080', // Chart Line Colour #31 |
|
441 | - 32 => 'FF0000FF', // Chart Line Colour #32 |
|
442 | - 33 => 'FF00CCFF', // Standard Colour #33 |
|
443 | - 34 => 'FFCCFFFF', // Standard Colour #34 |
|
444 | - 35 => 'FFCCFFCC', // Standard Colour #35 |
|
445 | - 36 => 'FFFFFF99', // Standard Colour #36 |
|
446 | - 37 => 'FF99CCFF', // Standard Colour #37 |
|
447 | - 38 => 'FFFF99CC', // Standard Colour #38 |
|
448 | - 39 => 'FFCC99FF', // Standard Colour #39 |
|
449 | - 40 => 'FFFFCC99', // Standard Colour #40 |
|
450 | - 41 => 'FF3366FF', // Standard Colour #41 |
|
451 | - 42 => 'FF33CCCC', // Standard Colour #42 |
|
452 | - 43 => 'FF99CC00', // Standard Colour #43 |
|
453 | - 44 => 'FFFFCC00', // Standard Colour #44 |
|
454 | - 45 => 'FFFF9900', // Standard Colour #45 |
|
455 | - 46 => 'FFFF6600', // Standard Colour #46 |
|
456 | - 47 => 'FF666699', // Standard Colour #47 |
|
457 | - 48 => 'FF969696', // Standard Colour #48 |
|
458 | - 49 => 'FF003366', // Standard Colour #49 |
|
459 | - 50 => 'FF339966', // Standard Colour #50 |
|
460 | - 51 => 'FF003300', // Standard Colour #51 |
|
461 | - 52 => 'FF333300', // Standard Colour #52 |
|
462 | - 53 => 'FF993300', // Standard Colour #53 |
|
463 | - 54 => 'FF993366', // Standard Colour #54 |
|
464 | - 55 => 'FF333399', // Standard Colour #55 |
|
410 | + 1 => 'FF000000', // System Colour #1 - Black |
|
411 | + 2 => 'FFFFFFFF', // System Colour #2 - White |
|
412 | + 3 => 'FFFF0000', // System Colour #3 - Red |
|
413 | + 4 => 'FF00FF00', // System Colour #4 - Green |
|
414 | + 5 => 'FF0000FF', // System Colour #5 - Blue |
|
415 | + 6 => 'FFFFFF00', // System Colour #6 - Yellow |
|
416 | + 7 => 'FFFF00FF', // System Colour #7- Magenta |
|
417 | + 8 => 'FF00FFFF', // System Colour #8- Cyan |
|
418 | + 9 => 'FF800000', // Standard Colour #9 |
|
419 | + 10 => 'FF008000', // Standard Colour #10 |
|
420 | + 11 => 'FF000080', // Standard Colour #11 |
|
421 | + 12 => 'FF808000', // Standard Colour #12 |
|
422 | + 13 => 'FF800080', // Standard Colour #13 |
|
423 | + 14 => 'FF008080', // Standard Colour #14 |
|
424 | + 15 => 'FFC0C0C0', // Standard Colour #15 |
|
425 | + 16 => 'FF808080', // Standard Colour #16 |
|
426 | + 17 => 'FF9999FF', // Chart Fill Colour #17 |
|
427 | + 18 => 'FF993366', // Chart Fill Colour #18 |
|
428 | + 19 => 'FFFFFFCC', // Chart Fill Colour #19 |
|
429 | + 20 => 'FFCCFFFF', // Chart Fill Colour #20 |
|
430 | + 21 => 'FF660066', // Chart Fill Colour #21 |
|
431 | + 22 => 'FFFF8080', // Chart Fill Colour #22 |
|
432 | + 23 => 'FF0066CC', // Chart Fill Colour #23 |
|
433 | + 24 => 'FFCCCCFF', // Chart Fill Colour #24 |
|
434 | + 25 => 'FF000080', // Chart Line Colour #25 |
|
435 | + 26 => 'FFFF00FF', // Chart Line Colour #26 |
|
436 | + 27 => 'FFFFFF00', // Chart Line Colour #27 |
|
437 | + 28 => 'FF00FFFF', // Chart Line Colour #28 |
|
438 | + 29 => 'FF800080', // Chart Line Colour #29 |
|
439 | + 30 => 'FF800000', // Chart Line Colour #30 |
|
440 | + 31 => 'FF008080', // Chart Line Colour #31 |
|
441 | + 32 => 'FF0000FF', // Chart Line Colour #32 |
|
442 | + 33 => 'FF00CCFF', // Standard Colour #33 |
|
443 | + 34 => 'FFCCFFFF', // Standard Colour #34 |
|
444 | + 35 => 'FFCCFFCC', // Standard Colour #35 |
|
445 | + 36 => 'FFFFFF99', // Standard Colour #36 |
|
446 | + 37 => 'FF99CCFF', // Standard Colour #37 |
|
447 | + 38 => 'FFFF99CC', // Standard Colour #38 |
|
448 | + 39 => 'FFCC99FF', // Standard Colour #39 |
|
449 | + 40 => 'FFFFCC99', // Standard Colour #40 |
|
450 | + 41 => 'FF3366FF', // Standard Colour #41 |
|
451 | + 42 => 'FF33CCCC', // Standard Colour #42 |
|
452 | + 43 => 'FF99CC00', // Standard Colour #43 |
|
453 | + 44 => 'FFFFCC00', // Standard Colour #44 |
|
454 | + 45 => 'FFFF9900', // Standard Colour #45 |
|
455 | + 46 => 'FFFF6600', // Standard Colour #46 |
|
456 | + 47 => 'FF666699', // Standard Colour #47 |
|
457 | + 48 => 'FF969696', // Standard Colour #48 |
|
458 | + 49 => 'FF003366', // Standard Colour #49 |
|
459 | + 50 => 'FF339966', // Standard Colour #50 |
|
460 | + 51 => 'FF003300', // Standard Colour #51 |
|
461 | + 52 => 'FF333300', // Standard Colour #52 |
|
462 | + 53 => 'FF993300', // Standard Colour #53 |
|
463 | + 54 => 'FF993366', // Standard Colour #54 |
|
464 | + 55 => 'FF333399', // Standard Colour #55 |
|
465 | 465 | 56 => 'FF333333' // Standard Colour #56 |
466 | 466 | ); |
467 | 467 | } |
@@ -305,8 +305,9 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private static function _getColourComponent($RGB,$offset,$hex=true) { |
307 | 307 | $colour = substr($RGB,$offset,2); |
308 | - if (!$hex) |
|
309 | - $colour = hexdec($colour); |
|
308 | + if (!$hex) { |
|
309 | + $colour = hexdec($colour); |
|
310 | + } |
|
310 | 311 | return $colour; |
311 | 312 | } |
312 | 313 | |
@@ -379,12 +380,21 @@ discard block |
||
379 | 380 | $blue += $blue * $adjustPercentage; |
380 | 381 | } |
381 | 382 | |
382 | - if ($red < 0) $red = 0; |
|
383 | - elseif ($red > 255) $red = 255; |
|
384 | - if ($green < 0) $green = 0; |
|
385 | - elseif ($green > 255) $green = 255; |
|
386 | - if ($blue < 0) $blue = 0; |
|
387 | - elseif ($blue > 255) $blue = 255; |
|
383 | + if ($red < 0) { |
|
384 | + $red = 0; |
|
385 | + } elseif ($red > 255) { |
|
386 | + $red = 255; |
|
387 | + } |
|
388 | + if ($green < 0) { |
|
389 | + $green = 0; |
|
390 | + } elseif ($green > 255) { |
|
391 | + $green = 255; |
|
392 | + } |
|
393 | + if ($blue < 0) { |
|
394 | + $blue = 0; |
|
395 | + } elseif ($blue > 255) { |
|
396 | + $blue = 255; |
|
397 | + } |
|
388 | 398 | |
389 | 399 | return strtoupper( str_pad(dechex($red), 2, '0', 0) . |
390 | 400 | str_pad(dechex($green), 2, '0', 0) . |
@@ -38,39 +38,39 @@ discard block |
||
38 | 38 | /* Fill types */ |
39 | 39 | const FILL_NONE = 'none'; |
40 | 40 | const FILL_SOLID = 'solid'; |
41 | - const FILL_GRADIENT_LINEAR = 'linear'; |
|
42 | - const FILL_GRADIENT_PATH = 'path'; |
|
41 | + const FILL_GRADIENT_LINEAR = 'linear'; |
|
42 | + const FILL_GRADIENT_PATH = 'path'; |
|
43 | 43 | const FILL_PATTERN_DARKDOWN = 'darkDown'; |
44 | 44 | const FILL_PATTERN_DARKGRAY = 'darkGray'; |
45 | 45 | const FILL_PATTERN_DARKGRID = 'darkGrid'; |
46 | - const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal'; |
|
47 | - const FILL_PATTERN_DARKTRELLIS = 'darkTrellis'; |
|
48 | - const FILL_PATTERN_DARKUP = 'darkUp'; |
|
49 | - const FILL_PATTERN_DARKVERTICAL = 'darkVertical'; |
|
46 | + const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal'; |
|
47 | + const FILL_PATTERN_DARKTRELLIS = 'darkTrellis'; |
|
48 | + const FILL_PATTERN_DARKUP = 'darkUp'; |
|
49 | + const FILL_PATTERN_DARKVERTICAL = 'darkVertical'; |
|
50 | 50 | const FILL_PATTERN_GRAY0625 = 'gray0625'; |
51 | - const FILL_PATTERN_GRAY125 = 'gray125'; |
|
51 | + const FILL_PATTERN_GRAY125 = 'gray125'; |
|
52 | 52 | const FILL_PATTERN_LIGHTDOWN = 'lightDown'; |
53 | 53 | const FILL_PATTERN_LIGHTGRAY = 'lightGray'; |
54 | 54 | const FILL_PATTERN_LIGHTGRID = 'lightGrid'; |
55 | - const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal'; |
|
55 | + const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal'; |
|
56 | 56 | const FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis'; |
57 | - const FILL_PATTERN_LIGHTUP = 'lightUp'; |
|
57 | + const FILL_PATTERN_LIGHTUP = 'lightUp'; |
|
58 | 58 | const FILL_PATTERN_LIGHTVERTICAL = 'lightVertical'; |
59 | - const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'; |
|
59 | + const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Fill type |
63 | 63 | * |
64 | 64 | * @var string |
65 | 65 | */ |
66 | - private $_fillType = PHPExcel_Style_Fill::FILL_NONE; |
|
66 | + private $_fillType = PHPExcel_Style_Fill::FILL_NONE; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Rotation |
70 | 70 | * |
71 | 71 | * @var double |
72 | 72 | */ |
73 | - private $_rotation = 0; |
|
73 | + private $_rotation = 0; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Start color |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // Initialise values |
121 | 121 | $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor); |
122 | - $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); |
|
122 | + $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); |
|
123 | 123 | |
124 | 124 | // bind parent if we are a supervisor |
125 | 125 | if ($isSupervisor) { |
@@ -327,7 +327,7 @@ |
||
327 | 327 | /** |
328 | 328 | * Set Size |
329 | 329 | * |
330 | - * @param double $pValue |
|
330 | + * @param integer $pValue |
|
331 | 331 | * @return PHPExcel_Style_Font |
332 | 332 | */ |
333 | 333 | public function setSize($pValue = 10) { |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable |
37 | 37 | { |
38 | 38 | /* Pre-defined formats */ |
39 | - const FORMAT_GENERAL = 'General'; |
|
39 | + const FORMAT_GENERAL = 'General'; |
|
40 | 40 | |
41 | - const FORMAT_TEXT = '@'; |
|
41 | + const FORMAT_TEXT = '@'; |
|
42 | 42 | |
43 | - const FORMAT_NUMBER = '0'; |
|
44 | - const FORMAT_NUMBER_00 = '0.00'; |
|
43 | + const FORMAT_NUMBER = '0'; |
|
44 | + const FORMAT_NUMBER_00 = '0.00'; |
|
45 | 45 | const FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'; |
46 | 46 | const FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'; |
47 | 47 | |
48 | - const FORMAT_PERCENTAGE = '0%'; |
|
48 | + const FORMAT_PERCENTAGE = '0%'; |
|
49 | 49 | const FORMAT_PERCENTAGE_00 = '0.00%'; |
50 | 50 | |
51 | - const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; |
|
51 | + const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; |
|
52 | 52 | const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd'; |
53 | 53 | const FORMAT_DATE_DDMMYYYY = 'dd/mm/yy'; |
54 | 54 | const FORMAT_DATE_DMYSLASH = 'd/m/y'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | const FORMAT_DATE_XLSX16 = 'd-mmm'; |
61 | 61 | const FORMAT_DATE_XLSX17 = 'mmm-yy'; |
62 | 62 | const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'; |
63 | - const FORMAT_DATE_DATETIME = 'd/m/y h:mm'; |
|
63 | + const FORMAT_DATE_DATETIME = 'd/m/y h:mm'; |
|
64 | 64 | const FORMAT_DATE_TIME1 = 'h:mm AM/PM'; |
65 | 65 | const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'; |
66 | 66 | const FORMAT_DATE_TIME3 = 'h:mm'; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | const FORMAT_DATE_YYYYMMDDSLASH = 'yy/mm/dd;@'; |
73 | 73 | |
74 | 74 | const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'; |
75 | - const FORMAT_CURRENCY_USD = '$#,##0_-'; |
|
75 | + const FORMAT_CURRENCY_USD = '$#,##0_-'; |
|
76 | 76 | const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'; |
77 | 77 | |
78 | 78 | /** |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @var string |
96 | 96 | */ |
97 | - private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; |
|
97 | + private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Built-in format Code |
101 | 101 | * |
102 | 102 | * @var string |
103 | 103 | */ |
104 | - private $_builtInFormatCode = 0; |
|
104 | + private $_builtInFormatCode = 0; |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Parent Borders |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | public static function toFormattedString($value = '', $format = '', $callBack = null) |
519 | 519 | { |
520 | 520 | // For now we do not treat strings although section 4 of a format code affects strings |
521 | - if (!is_numeric($value)) return $value; |
|
521 | + if ( ! is_numeric($value)) return $value; |
|
522 | 522 | |
523 | 523 | // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, |
524 | 524 | // it seems to round numbers to a total of 10 digits. |
@@ -548,14 +548,14 @@ discard block |
||
548 | 548 | |
549 | 549 | case 3: |
550 | 550 | $format = ($value > 0) ? |
551 | - $sections[0] : ( ($value < 0) ? |
|
551 | + $sections[0] : (($value < 0) ? |
|
552 | 552 | $sections[1] : $sections[2]); |
553 | 553 | $value = abs($value); // Use the absolute value |
554 | 554 | break; |
555 | 555 | |
556 | 556 | case 4: |
557 | 557 | $format = ($value > 0) ? |
558 | - $sections[0] : ( ($value < 0) ? |
|
558 | + $sections[0] : (($value < 0) ? |
|
559 | 559 | $sections[1] : $sections[2]); |
560 | 560 | $value = abs($value); // Use the absolute value |
561 | 561 | break; |
@@ -585,11 +585,11 @@ discard block |
||
585 | 585 | // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case |
586 | 586 | $format = strtolower($format); |
587 | 587 | |
588 | - $format = strtr($format,self::$_dateFormatReplacements); |
|
589 | - if (!strpos($format,'A')) { // 24-hour time format |
|
590 | - $format = strtr($format,self::$_dateFormatReplacements24); |
|
588 | + $format = strtr($format, self::$_dateFormatReplacements); |
|
589 | + if ( ! strpos($format, 'A')) { // 24-hour time format |
|
590 | + $format = strtr($format, self::$_dateFormatReplacements24); |
|
591 | 591 | } else { // 12-hour time format |
592 | - $format = strtr($format,self::$_dateFormatReplacements12); |
|
592 | + $format = strtr($format, self::$_dateFormatReplacements12); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | $dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value); |
@@ -597,23 +597,23 @@ discard block |
||
597 | 597 | |
598 | 598 | } else if (preg_match('/%$/', $format)) { // % number format |
599 | 599 | if ($format === self::FORMAT_PERCENTAGE) { |
600 | - $value = round( (100 * $value), 0) . '%'; |
|
600 | + $value = round((100 * $value), 0).'%'; |
|
601 | 601 | } else { |
602 | 602 | if (preg_match('/\.[#0]+/i', $format, $m)) { |
603 | - $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1); |
|
603 | + $s = substr($m[0], 0, 1).(strlen($m[0]) - 1); |
|
604 | 604 | $format = str_replace($m[0], $s, $format); |
605 | 605 | } |
606 | 606 | if (preg_match('/^[#0]+/', $format, $m)) { |
607 | 607 | $format = str_replace($m[0], strlen($m[0]), $format); |
608 | 608 | } |
609 | - $format = '%' . str_replace('%', 'f%%', $format); |
|
609 | + $format = '%'.str_replace('%', 'f%%', $format); |
|
610 | 610 | |
611 | 611 | $value = sprintf($format, 100 * $value); |
612 | 612 | } |
613 | 613 | |
614 | 614 | } else { |
615 | 615 | if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) { |
616 | - $value = 'EUR ' . sprintf('%1.2f', $value); |
|
616 | + $value = 'EUR '.sprintf('%1.2f', $value); |
|
617 | 617 | |
618 | 618 | } else { |
619 | 619 | // In Excel formats, "_" is used to add spacing, which we can't do in HTML |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $format = preg_replace("/\\\\/", '', $format); |
624 | 624 | |
625 | 625 | // Some non-number strings are quoted, so we'll get rid of the quotes, likewise any positional * symbols |
626 | - $format = str_replace(array('"','*'), '', $format); |
|
626 | + $format = str_replace(array('"', '*'), '', $format); |
|
627 | 627 | |
628 | 628 | // Find out if we need thousands separator |
629 | 629 | // This is indicated by a comma enclosed by a digit placeholder: |
@@ -649,20 +649,20 @@ discard block |
||
649 | 649 | |
650 | 650 | if (preg_match('/#?.*\?\/\?/', $format, $m)) { |
651 | 651 | //echo 'Format mask is fractional '.$format.' <br />'; |
652 | - if ($value != (int)$value) { |
|
652 | + if ($value != (int) $value) { |
|
653 | 653 | $sign = ($value < 0) ? '-' : ''; |
654 | 654 | |
655 | 655 | $integerPart = floor(abs($value)); |
656 | - $decimalPart = trim(fmod(abs($value),1),'0.'); |
|
656 | + $decimalPart = trim(fmod(abs($value), 1), '0.'); |
|
657 | 657 | $decimalLength = strlen($decimalPart); |
658 | - $decimalDivisor = pow(10,$decimalLength); |
|
658 | + $decimalDivisor = pow(10, $decimalLength); |
|
659 | 659 | |
660 | - $GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart,$decimalDivisor); |
|
660 | + $GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart, $decimalDivisor); |
|
661 | 661 | |
662 | - $adjustedDecimalPart = $decimalPart/$GCD; |
|
663 | - $adjustedDecimalDivisor = $decimalDivisor/$GCD; |
|
662 | + $adjustedDecimalPart = $decimalPart / $GCD; |
|
663 | + $adjustedDecimalDivisor = $decimalDivisor / $GCD; |
|
664 | 664 | |
665 | - if ((strpos($format,'0') !== false) || (strpos($format,'#') !== false) || (substr($format,0,3) == '? ?')) { |
|
665 | + if ((strpos($format, '0') !== false) || (strpos($format, '#') !== false) || (substr($format, 0, 3) == '? ?')) { |
|
666 | 666 | if ($integerPart == 0) { $integerPart = ''; } |
667 | 667 | $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor"; |
668 | 668 | } else { |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | , PHPExcel_Shared_String::getThousandsSeparator() |
700 | 700 | ); |
701 | 701 | } else { |
702 | - $sprintf_pattern = "%0$minWidth." . strlen($right) . "f"; |
|
702 | + $sprintf_pattern = "%0$minWidth.".strlen($right)."f"; |
|
703 | 703 | $value = sprintf($sprintf_pattern, $value); |
704 | 704 | } |
705 | 705 | |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | // Currency or Accounting |
711 | 711 | $currencyFormat = $m[0]; |
712 | 712 | $currencyCode = $m[1]; |
713 | - list($currencyCode) = explode('-',$currencyCode); |
|
713 | + list($currencyCode) = explode('-', $currencyCode); |
|
714 | 714 | if ($currencyCode == '') { |
715 | 715 | $currencyCode = PHPExcel_Shared_String::getCurrencyCode(); |
716 | 716 | } |
717 | - $value = preg_replace('/\[\$([^\]]*)\]/u',$currencyCode,$value); |
|
717 | + $value = preg_replace('/\[\$([^\]]*)\]/u', $currencyCode, $value); |
|
718 | 718 | } |
719 | 719 | } |
720 | 720 | } |
@@ -518,7 +518,9 @@ |
||
518 | 518 | public static function toFormattedString($value = '', $format = '', $callBack = null) |
519 | 519 | { |
520 | 520 | // For now we do not treat strings although section 4 of a format code affects strings |
521 | - if (!is_numeric($value)) return $value; |
|
521 | + if (!is_numeric($value)) { |
|
522 | + return $value; |
|
523 | + } |
|
522 | 524 | |
523 | 525 | // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, |
524 | 526 | // it seems to round numbers to a total of 10 digits. |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private $_parent; |
77 | 77 | |
78 | - /** |
|
79 | - * Create a new PHPExcel_Style_Protection |
|
78 | + /** |
|
79 | + * Create a new PHPExcel_Style_Protection |
|
80 | 80 | * |
81 | 81 | * @param boolean $isSupervisor Flag indicating if this is a supervisor or not |
82 | - */ |
|
83 | - public function __construct($isSupervisor = false) |
|
84 | - { |
|
85 | - // Supervisor? |
|
82 | + */ |
|
83 | + public function __construct($isSupervisor = false) |
|
84 | + { |
|
85 | + // Supervisor? |
|
86 | 86 | $this->_isSupervisor = $isSupervisor; |
87 | 87 | |
88 | - // Initialise values |
|
89 | - $this->_locked = self::PROTECTION_INHERIT; |
|
90 | - $this->_hidden = self::PROTECTION_INHERIT; |
|
91 | - } |
|
88 | + // Initialise values |
|
89 | + $this->_locked = self::PROTECTION_INHERIT; |
|
90 | + $this->_hidden = self::PROTECTION_INHERIT; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Bind parent. Only used for supervisor |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | return array('protection' => $array); |
167 | 167 | } |
168 | 168 | |
169 | - /** |
|
170 | - * Apply styles from array |
|
171 | - * |
|
172 | - * <code> |
|
173 | - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) ); |
|
174 | - * </code> |
|
175 | - * |
|
176 | - * @param array $pStyles Array containing style information |
|
177 | - * @throws Exception |
|
178 | - * @return PHPExcel_Style_Protection |
|
179 | - */ |
|
169 | + /** |
|
170 | + * Apply styles from array |
|
171 | + * |
|
172 | + * <code> |
|
173 | + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) ); |
|
174 | + * </code> |
|
175 | + * |
|
176 | + * @param array $pStyles Array containing style information |
|
177 | + * @throws Exception |
|
178 | + * @return PHPExcel_Style_Protection |
|
179 | + */ |
|
180 | 180 | public function applyFromArray($pStyles = null) { |
181 | 181 | if (is_array($pStyles)) { |
182 | 182 | if ($this->_isSupervisor) { |
@@ -195,25 +195,25 @@ discard block |
||
195 | 195 | return $this; |
196 | 196 | } |
197 | 197 | |
198 | - /** |
|
199 | - * Get locked |
|
200 | - * |
|
201 | - * @return string |
|
202 | - */ |
|
203 | - public function getLocked() { |
|
198 | + /** |
|
199 | + * Get locked |
|
200 | + * |
|
201 | + * @return string |
|
202 | + */ |
|
203 | + public function getLocked() { |
|
204 | 204 | if ($this->_isSupervisor) { |
205 | 205 | return $this->getSharedComponent()->getLocked(); |
206 | 206 | } |
207 | - return $this->_locked; |
|
208 | - } |
|
207 | + return $this->_locked; |
|
208 | + } |
|
209 | 209 | |
210 | - /** |
|
211 | - * Set locked |
|
212 | - * |
|
213 | - * @param string $pValue |
|
214 | - * @return PHPExcel_Style_Protection |
|
215 | - */ |
|
216 | - public function setLocked($pValue = self::PROTECTION_INHERIT) { |
|
210 | + /** |
|
211 | + * Set locked |
|
212 | + * |
|
213 | + * @param string $pValue |
|
214 | + * @return PHPExcel_Style_Protection |
|
215 | + */ |
|
216 | + public function setLocked($pValue = self::PROTECTION_INHERIT) { |
|
217 | 217 | if ($this->_isSupervisor) { |
218 | 218 | $styleArray = $this->getStyleArray(array('locked' => $pValue)); |
219 | 219 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
@@ -221,27 +221,27 @@ discard block |
||
221 | 221 | $this->_locked = $pValue; |
222 | 222 | } |
223 | 223 | return $this; |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * Get hidden |
|
228 | - * |
|
229 | - * @return string |
|
230 | - */ |
|
231 | - public function getHidden() { |
|
226 | + /** |
|
227 | + * Get hidden |
|
228 | + * |
|
229 | + * @return string |
|
230 | + */ |
|
231 | + public function getHidden() { |
|
232 | 232 | if ($this->_isSupervisor) { |
233 | 233 | return $this->getSharedComponent()->getHidden(); |
234 | 234 | } |
235 | - return $this->_hidden; |
|
236 | - } |
|
235 | + return $this->_hidden; |
|
236 | + } |
|
237 | 237 | |
238 | - /** |
|
239 | - * Set hidden |
|
240 | - * |
|
241 | - * @param string $pValue |
|
242 | - * @return PHPExcel_Style_Protection |
|
243 | - */ |
|
244 | - public function setHidden($pValue = self::PROTECTION_INHERIT) { |
|
238 | + /** |
|
239 | + * Set hidden |
|
240 | + * |
|
241 | + * @param string $pValue |
|
242 | + * @return PHPExcel_Style_Protection |
|
243 | + */ |
|
244 | + public function setHidden($pValue = self::PROTECTION_INHERIT) { |
|
245 | 245 | if ($this->_isSupervisor) { |
246 | 246 | $styleArray = $this->getStyleArray(array('hidden' => $pValue)); |
247 | 247 | $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $this->_hidden = $pValue; |
250 | 250 | } |
251 | 251 | return $this; |
252 | - } |
|
252 | + } |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Get hash code |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | if ($this->_isSupervisor) { |
261 | 261 | return $this->getSharedComponent()->getHashCode(); |
262 | 262 | } |
263 | - return md5( |
|
264 | - $this->_locked |
|
265 | - . $this->_hidden |
|
266 | - . __CLASS__ |
|
267 | - ); |
|
268 | - } |
|
263 | + return md5( |
|
264 | + $this->_locked |
|
265 | + . $this->_hidden |
|
266 | + . __CLASS__ |
|
267 | + ); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -36,9 +36,9 @@ |
||
36 | 36 | class PHPExcel_Style_Protection implements PHPExcel_IComparable |
37 | 37 | { |
38 | 38 | /** Protection styles */ |
39 | - const PROTECTION_INHERIT = 'inherit'; |
|
40 | - const PROTECTION_PROTECTED = 'protected'; |
|
41 | - const PROTECTION_UNPROTECTED = 'unprotected'; |
|
39 | + const PROTECTION_INHERIT = 'inherit'; |
|
40 | + const PROTECTION_PROTECTED = 'protected'; |
|
41 | + const PROTECTION_UNPROTECTED = 'unprotected'; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Locked |
@@ -132,21 +132,21 @@ discard block |
||
132 | 132 | public function __construct() |
133 | 133 | { |
134 | 134 | // Initialise values |
135 | - $this->_name = ''; |
|
135 | + $this->_name = ''; |
|
136 | 136 | $this->_description = ''; |
137 | - $this->_worksheet = null; |
|
137 | + $this->_worksheet = null; |
|
138 | 138 | $this->_coordinates = 'A1'; |
139 | 139 | $this->_offsetX = 0; |
140 | 140 | $this->_offsetY = 0; |
141 | - $this->_width = 0; |
|
141 | + $this->_width = 0; |
|
142 | 142 | $this->_height = 0; |
143 | - $this->_resizeProportional = true; |
|
144 | - $this->_rotation = 0; |
|
143 | + $this->_resizeProportional = true; |
|
144 | + $this->_rotation = 0; |
|
145 | 145 | $this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow(); |
146 | 146 | |
147 | 147 | // Set image index |
148 | 148 | self::$_imageCounter++; |
149 | - $this->_imageIndex = self::$_imageCounter; |
|
149 | + $this->_imageIndex = self::$_imageCounter; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | while ($iterator->valid()) { |
230 | 230 | if ($iterator->current()->getHashCode() == $this->getHashCode()) { |
231 | - $this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() ); |
|
231 | + $this->_worksheet->getDrawingCollection()->offsetUnset($iterator->key()); |
|
232 | 232 | $this->_worksheet = null; |
233 | 233 | break; |
234 | 234 | } |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | public function setWidthAndHeight($width = 0, $height = 0) { |
376 | 376 | $xratio = $width / $this->_width; |
377 | 377 | $yratio = $height / $this->_height; |
378 | - if ($this->_resizeProportional && !($width == 0 || $height == 0)) { |
|
378 | + if ($this->_resizeProportional && ! ($width == 0 || $height == 0)) { |
|
379 | 379 | if (($xratio * $this->_height) < $height) { |
380 | 380 | $this->_height = ceil($xratio * $this->_height); |
381 | 381 | $this->_width = $width; |
382 | 382 | } else { |
383 | - $this->_width = ceil($yratio * $this->_width); |
|
383 | + $this->_width = ceil($yratio * $this->_width); |
|
384 | 384 | $this->_height = $height; |
385 | 385 | } |
386 | 386 | } |
@@ -126,252 +126,252 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected $_shadow; |
128 | 128 | |
129 | - /** |
|
130 | - * Create a new PHPExcel_Worksheet_BaseDrawing |
|
131 | - */ |
|
132 | - public function __construct() |
|
133 | - { |
|
134 | - // Initialise values |
|
135 | - $this->_name = ''; |
|
136 | - $this->_description = ''; |
|
137 | - $this->_worksheet = null; |
|
138 | - $this->_coordinates = 'A1'; |
|
139 | - $this->_offsetX = 0; |
|
140 | - $this->_offsetY = 0; |
|
141 | - $this->_width = 0; |
|
142 | - $this->_height = 0; |
|
143 | - $this->_resizeProportional = true; |
|
144 | - $this->_rotation = 0; |
|
145 | - $this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow(); |
|
129 | + /** |
|
130 | + * Create a new PHPExcel_Worksheet_BaseDrawing |
|
131 | + */ |
|
132 | + public function __construct() |
|
133 | + { |
|
134 | + // Initialise values |
|
135 | + $this->_name = ''; |
|
136 | + $this->_description = ''; |
|
137 | + $this->_worksheet = null; |
|
138 | + $this->_coordinates = 'A1'; |
|
139 | + $this->_offsetX = 0; |
|
140 | + $this->_offsetY = 0; |
|
141 | + $this->_width = 0; |
|
142 | + $this->_height = 0; |
|
143 | + $this->_resizeProportional = true; |
|
144 | + $this->_rotation = 0; |
|
145 | + $this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow(); |
|
146 | 146 | |
147 | 147 | // Set image index |
148 | 148 | self::$_imageCounter++; |
149 | 149 | $this->_imageIndex = self::$_imageCounter; |
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Get image index |
|
154 | - * |
|
155 | - * @return int |
|
156 | - */ |
|
157 | - public function getImageIndex() { |
|
158 | - return $this->_imageIndex; |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * Get Name |
|
163 | - * |
|
164 | - * @return string |
|
165 | - */ |
|
166 | - public function getName() { |
|
167 | - return $this->_name; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Set Name |
|
172 | - * |
|
173 | - * @param string $pValue |
|
174 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
175 | - */ |
|
176 | - public function setName($pValue = '') { |
|
177 | - $this->_name = $pValue; |
|
178 | - return $this; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * Get Description |
|
183 | - * |
|
184 | - * @return string |
|
185 | - */ |
|
186 | - public function getDescription() { |
|
187 | - return $this->_description; |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Set Description |
|
192 | - * |
|
193 | - * @param string $pValue |
|
194 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
195 | - */ |
|
196 | - public function setDescription($pValue = '') { |
|
197 | - $this->_description = $pValue; |
|
198 | - return $this; |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * Get Worksheet |
|
203 | - * |
|
204 | - * @return PHPExcel_Worksheet |
|
205 | - */ |
|
206 | - public function getWorksheet() { |
|
207 | - return $this->_worksheet; |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * Set Worksheet |
|
212 | - * |
|
213 | - * @param PHPExcel_Worksheet $pValue |
|
214 | - * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? |
|
215 | - * @throws Exception |
|
216 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
217 | - */ |
|
218 | - public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) { |
|
219 | - if (is_null($this->_worksheet)) { |
|
220 | - // Add drawing to PHPExcel_Worksheet |
|
221 | - $this->_worksheet = $pValue; |
|
222 | - $this->_worksheet->getCell($this->_coordinates); |
|
223 | - $this->_worksheet->getDrawingCollection()->append($this); |
|
224 | - } else { |
|
225 | - if ($pOverrideOld) { |
|
226 | - // Remove drawing from old PHPExcel_Worksheet |
|
227 | - $iterator = $this->_worksheet->getDrawingCollection()->getIterator(); |
|
228 | - |
|
229 | - while ($iterator->valid()) { |
|
230 | - if ($iterator->current()->getHashCode() == $this->getHashCode()) { |
|
231 | - $this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() ); |
|
232 | - $this->_worksheet = null; |
|
233 | - break; |
|
234 | - } |
|
235 | - } |
|
236 | - |
|
237 | - // Set new PHPExcel_Worksheet |
|
238 | - $this->setWorksheet($pValue); |
|
239 | - } else { |
|
240 | - throw new Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); |
|
241 | - } |
|
242 | - } |
|
243 | - return $this; |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * Get Coordinates |
|
248 | - * |
|
249 | - * @return string |
|
250 | - */ |
|
251 | - public function getCoordinates() { |
|
252 | - return $this->_coordinates; |
|
253 | - } |
|
254 | - |
|
255 | - /** |
|
256 | - * Set Coordinates |
|
257 | - * |
|
258 | - * @param string $pValue |
|
259 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
260 | - */ |
|
261 | - public function setCoordinates($pValue = 'A1') { |
|
262 | - $this->_coordinates = $pValue; |
|
263 | - return $this; |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * Get OffsetX |
|
268 | - * |
|
269 | - * @return int |
|
270 | - */ |
|
271 | - public function getOffsetX() { |
|
272 | - return $this->_offsetX; |
|
273 | - } |
|
274 | - |
|
275 | - /** |
|
276 | - * Set OffsetX |
|
277 | - * |
|
278 | - * @param int $pValue |
|
279 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
280 | - */ |
|
281 | - public function setOffsetX($pValue = 0) { |
|
282 | - $this->_offsetX = $pValue; |
|
283 | - return $this; |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Get OffsetY |
|
288 | - * |
|
289 | - * @return int |
|
290 | - */ |
|
291 | - public function getOffsetY() { |
|
292 | - return $this->_offsetY; |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * Set OffsetY |
|
297 | - * |
|
298 | - * @param int $pValue |
|
299 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
300 | - */ |
|
301 | - public function setOffsetY($pValue = 0) { |
|
302 | - $this->_offsetY = $pValue; |
|
303 | - return $this; |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Get Width |
|
308 | - * |
|
309 | - * @return int |
|
310 | - */ |
|
311 | - public function getWidth() { |
|
312 | - return $this->_width; |
|
313 | - } |
|
314 | - |
|
315 | - /** |
|
316 | - * Set Width |
|
317 | - * |
|
318 | - * @param int $pValue |
|
319 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
320 | - */ |
|
321 | - public function setWidth($pValue = 0) { |
|
322 | - // Resize proportional? |
|
323 | - if ($this->_resizeProportional && $pValue != 0) { |
|
324 | - $ratio = $this->_height / $this->_width; |
|
325 | - $this->_height = round($ratio * $pValue); |
|
326 | - } |
|
327 | - |
|
328 | - // Set width |
|
329 | - $this->_width = $pValue; |
|
330 | - |
|
331 | - return $this; |
|
332 | - } |
|
333 | - |
|
334 | - /** |
|
335 | - * Get Height |
|
336 | - * |
|
337 | - * @return int |
|
338 | - */ |
|
339 | - public function getHeight() { |
|
340 | - return $this->_height; |
|
341 | - } |
|
342 | - |
|
343 | - /** |
|
344 | - * Set Height |
|
345 | - * |
|
346 | - * @param int $pValue |
|
347 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
348 | - */ |
|
349 | - public function setHeight($pValue = 0) { |
|
350 | - // Resize proportional? |
|
351 | - if ($this->_resizeProportional && $pValue != 0) { |
|
352 | - $ratio = $this->_width / $this->_height; |
|
353 | - $this->_width = round($ratio * $pValue); |
|
354 | - } |
|
355 | - |
|
356 | - // Set height |
|
357 | - $this->_height = $pValue; |
|
358 | - |
|
359 | - return $this; |
|
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Set width and height with proportional resize |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Get image index |
|
154 | + * |
|
155 | + * @return int |
|
156 | + */ |
|
157 | + public function getImageIndex() { |
|
158 | + return $this->_imageIndex; |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * Get Name |
|
163 | + * |
|
164 | + * @return string |
|
165 | + */ |
|
166 | + public function getName() { |
|
167 | + return $this->_name; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Set Name |
|
172 | + * |
|
173 | + * @param string $pValue |
|
174 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
175 | + */ |
|
176 | + public function setName($pValue = '') { |
|
177 | + $this->_name = $pValue; |
|
178 | + return $this; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * Get Description |
|
183 | + * |
|
184 | + * @return string |
|
185 | + */ |
|
186 | + public function getDescription() { |
|
187 | + return $this->_description; |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Set Description |
|
192 | + * |
|
193 | + * @param string $pValue |
|
194 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
195 | + */ |
|
196 | + public function setDescription($pValue = '') { |
|
197 | + $this->_description = $pValue; |
|
198 | + return $this; |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * Get Worksheet |
|
203 | + * |
|
204 | + * @return PHPExcel_Worksheet |
|
205 | + */ |
|
206 | + public function getWorksheet() { |
|
207 | + return $this->_worksheet; |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * Set Worksheet |
|
212 | + * |
|
213 | + * @param PHPExcel_Worksheet $pValue |
|
214 | + * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? |
|
215 | + * @throws Exception |
|
216 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
217 | + */ |
|
218 | + public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) { |
|
219 | + if (is_null($this->_worksheet)) { |
|
220 | + // Add drawing to PHPExcel_Worksheet |
|
221 | + $this->_worksheet = $pValue; |
|
222 | + $this->_worksheet->getCell($this->_coordinates); |
|
223 | + $this->_worksheet->getDrawingCollection()->append($this); |
|
224 | + } else { |
|
225 | + if ($pOverrideOld) { |
|
226 | + // Remove drawing from old PHPExcel_Worksheet |
|
227 | + $iterator = $this->_worksheet->getDrawingCollection()->getIterator(); |
|
228 | + |
|
229 | + while ($iterator->valid()) { |
|
230 | + if ($iterator->current()->getHashCode() == $this->getHashCode()) { |
|
231 | + $this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() ); |
|
232 | + $this->_worksheet = null; |
|
233 | + break; |
|
234 | + } |
|
235 | + } |
|
236 | + |
|
237 | + // Set new PHPExcel_Worksheet |
|
238 | + $this->setWorksheet($pValue); |
|
239 | + } else { |
|
240 | + throw new Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); |
|
241 | + } |
|
242 | + } |
|
243 | + return $this; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * Get Coordinates |
|
248 | + * |
|
249 | + * @return string |
|
250 | + */ |
|
251 | + public function getCoordinates() { |
|
252 | + return $this->_coordinates; |
|
253 | + } |
|
254 | + |
|
255 | + /** |
|
256 | + * Set Coordinates |
|
257 | + * |
|
258 | + * @param string $pValue |
|
259 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
260 | + */ |
|
261 | + public function setCoordinates($pValue = 'A1') { |
|
262 | + $this->_coordinates = $pValue; |
|
263 | + return $this; |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * Get OffsetX |
|
268 | + * |
|
269 | + * @return int |
|
270 | + */ |
|
271 | + public function getOffsetX() { |
|
272 | + return $this->_offsetX; |
|
273 | + } |
|
274 | + |
|
275 | + /** |
|
276 | + * Set OffsetX |
|
277 | + * |
|
278 | + * @param int $pValue |
|
279 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
280 | + */ |
|
281 | + public function setOffsetX($pValue = 0) { |
|
282 | + $this->_offsetX = $pValue; |
|
283 | + return $this; |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Get OffsetY |
|
288 | + * |
|
289 | + * @return int |
|
290 | + */ |
|
291 | + public function getOffsetY() { |
|
292 | + return $this->_offsetY; |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * Set OffsetY |
|
297 | + * |
|
298 | + * @param int $pValue |
|
299 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
300 | + */ |
|
301 | + public function setOffsetY($pValue = 0) { |
|
302 | + $this->_offsetY = $pValue; |
|
303 | + return $this; |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Get Width |
|
308 | + * |
|
309 | + * @return int |
|
310 | + */ |
|
311 | + public function getWidth() { |
|
312 | + return $this->_width; |
|
313 | + } |
|
314 | + |
|
315 | + /** |
|
316 | + * Set Width |
|
317 | + * |
|
318 | + * @param int $pValue |
|
319 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
320 | + */ |
|
321 | + public function setWidth($pValue = 0) { |
|
322 | + // Resize proportional? |
|
323 | + if ($this->_resizeProportional && $pValue != 0) { |
|
324 | + $ratio = $this->_height / $this->_width; |
|
325 | + $this->_height = round($ratio * $pValue); |
|
326 | + } |
|
327 | + |
|
328 | + // Set width |
|
329 | + $this->_width = $pValue; |
|
330 | + |
|
331 | + return $this; |
|
332 | + } |
|
333 | + |
|
334 | + /** |
|
335 | + * Get Height |
|
336 | + * |
|
337 | + * @return int |
|
338 | + */ |
|
339 | + public function getHeight() { |
|
340 | + return $this->_height; |
|
341 | + } |
|
342 | + |
|
343 | + /** |
|
344 | + * Set Height |
|
345 | + * |
|
346 | + * @param int $pValue |
|
347 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
348 | + */ |
|
349 | + public function setHeight($pValue = 0) { |
|
350 | + // Resize proportional? |
|
351 | + if ($this->_resizeProportional && $pValue != 0) { |
|
352 | + $ratio = $this->_width / $this->_height; |
|
353 | + $this->_width = round($ratio * $pValue); |
|
354 | + } |
|
355 | + |
|
356 | + // Set height |
|
357 | + $this->_height = $pValue; |
|
358 | + |
|
359 | + return $this; |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Set width and height with proportional resize |
|
364 | 364 | * Example: |
365 | 365 | * <code> |
366 | 366 | * $objDrawing->setResizeProportional(true); |
367 | 367 | * $objDrawing->setWidthAndHeight(160,120); |
368 | 368 | * </code> |
369 | 369 | * |
370 | - * @author Vincent@luo MSN:[email protected] |
|
371 | - * @param int $width |
|
372 | - * @param int $height |
|
373 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
374 | - */ |
|
370 | + * @author Vincent@luo MSN:[email protected] |
|
371 | + * @param int $width |
|
372 | + * @param int $height |
|
373 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
374 | + */ |
|
375 | 375 | public function setWidthAndHeight($width = 0, $height = 0) { |
376 | 376 | $xratio = $width / $this->_width; |
377 | 377 | $yratio = $height / $this->_height; |
@@ -387,66 +387,66 @@ discard block |
||
387 | 387 | return $this; |
388 | 388 | } |
389 | 389 | |
390 | - /** |
|
391 | - * Get ResizeProportional |
|
392 | - * |
|
393 | - * @return boolean |
|
394 | - */ |
|
395 | - public function getResizeProportional() { |
|
396 | - return $this->_resizeProportional; |
|
397 | - } |
|
398 | - |
|
399 | - /** |
|
400 | - * Set ResizeProportional |
|
401 | - * |
|
402 | - * @param boolean $pValue |
|
403 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
404 | - */ |
|
405 | - public function setResizeProportional($pValue = true) { |
|
406 | - $this->_resizeProportional = $pValue; |
|
407 | - return $this; |
|
408 | - } |
|
409 | - |
|
410 | - /** |
|
411 | - * Get Rotation |
|
412 | - * |
|
413 | - * @return int |
|
414 | - */ |
|
415 | - public function getRotation() { |
|
416 | - return $this->_rotation; |
|
417 | - } |
|
418 | - |
|
419 | - /** |
|
420 | - * Set Rotation |
|
421 | - * |
|
422 | - * @param int $pValue |
|
423 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
424 | - */ |
|
425 | - public function setRotation($pValue = 0) { |
|
426 | - $this->_rotation = $pValue; |
|
427 | - return $this; |
|
428 | - } |
|
429 | - |
|
430 | - /** |
|
431 | - * Get Shadow |
|
432 | - * |
|
433 | - * @return PHPExcel_Worksheet_Drawing_Shadow |
|
434 | - */ |
|
435 | - public function getShadow() { |
|
436 | - return $this->_shadow; |
|
437 | - } |
|
438 | - |
|
439 | - /** |
|
440 | - * Set Shadow |
|
441 | - * |
|
442 | - * @param PHPExcel_Worksheet_Drawing_Shadow $pValue |
|
443 | - * @throws Exception |
|
444 | - * @return PHPExcel_Worksheet_BaseDrawing |
|
445 | - */ |
|
446 | - public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) { |
|
390 | + /** |
|
391 | + * Get ResizeProportional |
|
392 | + * |
|
393 | + * @return boolean |
|
394 | + */ |
|
395 | + public function getResizeProportional() { |
|
396 | + return $this->_resizeProportional; |
|
397 | + } |
|
398 | + |
|
399 | + /** |
|
400 | + * Set ResizeProportional |
|
401 | + * |
|
402 | + * @param boolean $pValue |
|
403 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
404 | + */ |
|
405 | + public function setResizeProportional($pValue = true) { |
|
406 | + $this->_resizeProportional = $pValue; |
|
407 | + return $this; |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * Get Rotation |
|
412 | + * |
|
413 | + * @return int |
|
414 | + */ |
|
415 | + public function getRotation() { |
|
416 | + return $this->_rotation; |
|
417 | + } |
|
418 | + |
|
419 | + /** |
|
420 | + * Set Rotation |
|
421 | + * |
|
422 | + * @param int $pValue |
|
423 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
424 | + */ |
|
425 | + public function setRotation($pValue = 0) { |
|
426 | + $this->_rotation = $pValue; |
|
427 | + return $this; |
|
428 | + } |
|
429 | + |
|
430 | + /** |
|
431 | + * Get Shadow |
|
432 | + * |
|
433 | + * @return PHPExcel_Worksheet_Drawing_Shadow |
|
434 | + */ |
|
435 | + public function getShadow() { |
|
436 | + return $this->_shadow; |
|
437 | + } |
|
438 | + |
|
439 | + /** |
|
440 | + * Set Shadow |
|
441 | + * |
|
442 | + * @param PHPExcel_Worksheet_Drawing_Shadow $pValue |
|
443 | + * @throws Exception |
|
444 | + * @return PHPExcel_Worksheet_BaseDrawing |
|
445 | + */ |
|
446 | + public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) { |
|
447 | 447 | $this->_shadow = $pValue; |
448 | 448 | return $this; |
449 | - } |
|
449 | + } |
|
450 | 450 | |
451 | 451 | /** |
452 | 452 | * Get hash code |
@@ -454,20 +454,20 @@ discard block |
||
454 | 454 | * @return string Hash code |
455 | 455 | */ |
456 | 456 | public function getHashCode() { |
457 | - return md5( |
|
458 | - $this->_name |
|
459 | - . $this->_description |
|
460 | - . $this->_worksheet->getHashCode() |
|
461 | - . $this->_coordinates |
|
462 | - . $this->_offsetX |
|
463 | - . $this->_offsetY |
|
464 | - . $this->_width |
|
465 | - . $this->_height |
|
466 | - . $this->_rotation |
|
467 | - . $this->_shadow->getHashCode() |
|
468 | - . __CLASS__ |
|
469 | - ); |
|
470 | - } |
|
457 | + return md5( |
|
458 | + $this->_name |
|
459 | + . $this->_description |
|
460 | + . $this->_worksheet->getHashCode() |
|
461 | + . $this->_coordinates |
|
462 | + . $this->_offsetX |
|
463 | + . $this->_offsetY |
|
464 | + . $this->_width |
|
465 | + . $this->_height |
|
466 | + . $this->_rotation |
|
467 | + . $this->_shadow->getHashCode() |
|
468 | + . __CLASS__ |
|
469 | + ); |
|
470 | + } |
|
471 | 471 | |
472 | 472 | /** |
473 | 473 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |