1: <?php
2: /**
3: * PHPExcel
4: *
5: * Copyright (c) 2006 - 2014 PHPExcel
6: *
7: * This library is free software; you can redistribute it and/or
8: * modify it under the terms of the GNU Lesser General Public
9: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20: *
21: * @category PHPExcel
22: * @package PHPExcel_Style
23: * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
24: * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25: * @version 1.8.0, 2014-03-02
26: */
27:
28:
29: /**
30: * PHPExcel_Style_Supervisor
31: *
32: * @category PHPExcel
33: * @package PHPExcel_Style
34: * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
35: */
36: abstract class PHPExcel_Style_Supervisor
37: {
38: /**
39: * Supervisor?
40: *
41: * @var boolean
42: */
43: protected $_isSupervisor;
44:
45: /**
46: * Parent. Only used for supervisor
47: *
48: * @var PHPExcel_Style
49: */
50: protected $_parent;
51:
52: /**
53: * Create a new PHPExcel_Style_Alignment
54: *
55: * @param boolean $isSupervisor Flag indicating if this is a supervisor or not
56: * Leave this value at default unless you understand exactly what
57: * its ramifications are
58: */
59: public function __construct($isSupervisor = FALSE)
60: {
61: // Supervisor?
62: $this->_isSupervisor = $isSupervisor;
63: }
64:
65: /**
66: * Bind parent. Only used for supervisor
67: *
68: * @param PHPExcel $parent
69: * @return PHPExcel_Style_Supervisor
70: */
71: public function bindParent($parent, $parentPropertyName=NULL)
72: {
73: $this->_parent = $parent;
74: return $this;
75: }
76:
77: /**
78: * Is this a supervisor or a cell style component?
79: *
80: * @return boolean
81: */
82: public function getIsSupervisor()
83: {
84: return $this->_isSupervisor;
85: }
86:
87: /**
88: * Get the currently active sheet. Only used for supervisor
89: *
90: * @return PHPExcel_Worksheet
91: */
92: public function getActiveSheet()
93: {
94: return $this->_parent->getActiveSheet();
95: }
96:
97: /**
98: * Get the currently active cell coordinate in currently active sheet.
99: * Only used for supervisor
100: *
101: * @return string E.g. 'A1'
102: */
103: public function getSelectedCells()
104: {
105: return $this->getActiveSheet()->getSelectedCells();
106: }
107:
108: /**
109: * Get the currently active cell coordinate in currently active sheet.
110: * Only used for supervisor
111: *
112: * @return string E.g. 'A1'
113: */
114: public function getActiveCell()
115: {
116: return $this->getActiveSheet()->getActiveCell();
117: }
118:
119: /**
120: * Implement PHP __clone to create a deep clone, not just a shallow copy.
121: */
122: public function __clone() {
123: $vars = get_object_vars($this);
124: foreach ($vars as $key => $value) {
125: if ((is_object($value)) && ($key != '_parent')) {
126: $this->$key = clone $value;
127: } else {
128: $this->$key = $value;
129: }
130: }
131: }
132: }
133: