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_Worksheet |
---|
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_Worksheet_RowDimension |
---|
31 | * |
---|
32 | * @category PHPExcel |
---|
33 | * @package PHPExcel_Worksheet |
---|
34 | * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
---|
35 | */ |
---|
36 | class PHPExcel_Worksheet_RowDimension |
---|
37 | { |
---|
38 | /** |
---|
39 | * Row index |
---|
40 | * |
---|
41 | * @var int |
---|
42 | */ |
---|
43 | private $_rowIndex; |
---|
44 | |
---|
45 | /** |
---|
46 | * Row height (in pt) |
---|
47 | * |
---|
48 | * When this is set to a negative value, the row height should be ignored by IWriter |
---|
49 | * |
---|
50 | * @var double |
---|
51 | */ |
---|
52 | private $_rowHeight = -1; |
---|
53 | |
---|
54 | /** |
---|
55 | * ZeroHeight for Row? |
---|
56 | * |
---|
57 | * @var bool |
---|
58 | */ |
---|
59 | private $_zeroHeight = false; |
---|
60 | |
---|
61 | /** |
---|
62 | * Visible? |
---|
63 | * |
---|
64 | * @var bool |
---|
65 | */ |
---|
66 | private $_visible = true; |
---|
67 | |
---|
68 | /** |
---|
69 | * Outline level |
---|
70 | * |
---|
71 | * @var int |
---|
72 | */ |
---|
73 | private $_outlineLevel = 0; |
---|
74 | |
---|
75 | /** |
---|
76 | * Collapsed |
---|
77 | * |
---|
78 | * @var bool |
---|
79 | */ |
---|
80 | private $_collapsed = false; |
---|
81 | |
---|
82 | /** |
---|
83 | * Index to cellXf. Null value means row has no explicit cellXf format. |
---|
84 | * |
---|
85 | * @var int|null |
---|
86 | */ |
---|
87 | private $_xfIndex; |
---|
88 | |
---|
89 | /** |
---|
90 | * Create a new PHPExcel_Worksheet_RowDimension |
---|
91 | * |
---|
92 | * @param int $pIndex Numeric row index |
---|
93 | */ |
---|
94 | public function __construct($pIndex = 0) |
---|
95 | { |
---|
96 | // Initialise values |
---|
97 | $this->_rowIndex = $pIndex; |
---|
98 | |
---|
99 | // set row dimension as unformatted by default |
---|
100 | $this->_xfIndex = null; |
---|
101 | } |
---|
102 | |
---|
103 | /** |
---|
104 | * Get Row Index |
---|
105 | * |
---|
106 | * @return int |
---|
107 | */ |
---|
108 | public function getRowIndex() { |
---|
109 | return $this->_rowIndex; |
---|
110 | } |
---|
111 | |
---|
112 | /** |
---|
113 | * Set Row Index |
---|
114 | * |
---|
115 | * @param int $pValue |
---|
116 | * @return PHPExcel_Worksheet_RowDimension |
---|
117 | */ |
---|
118 | public function setRowIndex($pValue) { |
---|
119 | $this->_rowIndex = $pValue; |
---|
120 | return $this; |
---|
121 | } |
---|
122 | |
---|
123 | /** |
---|
124 | * Get Row Height |
---|
125 | * |
---|
126 | * @return double |
---|
127 | */ |
---|
128 | public function getRowHeight() { |
---|
129 | return $this->_rowHeight; |
---|
130 | } |
---|
131 | |
---|
132 | /** |
---|
133 | * Set Row Height |
---|
134 | * |
---|
135 | * @param double $pValue |
---|
136 | * @return PHPExcel_Worksheet_RowDimension |
---|
137 | */ |
---|
138 | public function setRowHeight($pValue = -1) { |
---|
139 | $this->_rowHeight = $pValue; |
---|
140 | return $this; |
---|
141 | } |
---|
142 | |
---|
143 | /** |
---|
144 | * Get ZeroHeight |
---|
145 | * |
---|
146 | * @return bool |
---|
147 | */ |
---|
148 | public function getzeroHeight() { |
---|
149 | return $this->_zeroHeight; |
---|
150 | } |
---|
151 | |
---|
152 | /** |
---|
153 | * Set ZeroHeight |
---|
154 | * |
---|
155 | * @param bool $pValue |
---|
156 | * @return PHPExcel_Worksheet_RowDimension |
---|
157 | */ |
---|
158 | public function setzeroHeight($pValue = false) { |
---|
159 | $this->_zeroHeight = $pValue; |
---|
160 | return $this; |
---|
161 | } |
---|
162 | |
---|
163 | /** |
---|
164 | * Get Visible |
---|
165 | * |
---|
166 | * @return bool |
---|
167 | */ |
---|
168 | public function getVisible() { |
---|
169 | return $this->_visible; |
---|
170 | } |
---|
171 | |
---|
172 | /** |
---|
173 | * Set Visible |
---|
174 | * |
---|
175 | * @param bool $pValue |
---|
176 | * @return PHPExcel_Worksheet_RowDimension |
---|
177 | */ |
---|
178 | public function setVisible($pValue = true) { |
---|
179 | $this->_visible = $pValue; |
---|
180 | return $this; |
---|
181 | } |
---|
182 | |
---|
183 | /** |
---|
184 | * Get Outline Level |
---|
185 | * |
---|
186 | * @return int |
---|
187 | */ |
---|
188 | public function getOutlineLevel() { |
---|
189 | return $this->_outlineLevel; |
---|
190 | } |
---|
191 | |
---|
192 | /** |
---|
193 | * Set Outline Level |
---|
194 | * |
---|
195 | * Value must be between 0 and 7 |
---|
196 | * |
---|
197 | * @param int $pValue |
---|
198 | * @throws PHPExcel_Exception |
---|
199 | * @return PHPExcel_Worksheet_RowDimension |
---|
200 | */ |
---|
201 | public function setOutlineLevel($pValue) { |
---|
202 | if ($pValue < 0 || $pValue > 7) { |
---|
203 | throw new PHPExcel_Exception("Outline level must range between 0 and 7."); |
---|
204 | } |
---|
205 | |
---|
206 | $this->_outlineLevel = $pValue; |
---|
207 | return $this; |
---|
208 | } |
---|
209 | |
---|
210 | /** |
---|
211 | * Get Collapsed |
---|
212 | * |
---|
213 | * @return bool |
---|
214 | */ |
---|
215 | public function getCollapsed() { |
---|
216 | return $this->_collapsed; |
---|
217 | } |
---|
218 | |
---|
219 | /** |
---|
220 | * Set Collapsed |
---|
221 | * |
---|
222 | * @param bool $pValue |
---|
223 | * @return PHPExcel_Worksheet_RowDimension |
---|
224 | */ |
---|
225 | public function setCollapsed($pValue = true) { |
---|
226 | $this->_collapsed = $pValue; |
---|
227 | return $this; |
---|
228 | } |
---|
229 | |
---|
230 | /** |
---|
231 | * Get index to cellXf |
---|
232 | * |
---|
233 | * @return int |
---|
234 | */ |
---|
235 | public function getXfIndex() |
---|
236 | { |
---|
237 | return $this->_xfIndex; |
---|
238 | } |
---|
239 | |
---|
240 | /** |
---|
241 | * Set index to cellXf |
---|
242 | * |
---|
243 | * @param int $pValue |
---|
244 | * @return PHPExcel_Worksheet_RowDimension |
---|
245 | */ |
---|
246 | public function setXfIndex($pValue = 0) |
---|
247 | { |
---|
248 | $this->_xfIndex = $pValue; |
---|
249 | return $this; |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
---|
254 | */ |
---|
255 | public function __clone() { |
---|
256 | $vars = get_object_vars($this); |
---|
257 | foreach ($vars as $key => $value) { |
---|
258 | if (is_object($value)) { |
---|
259 | $this->$key = clone $value; |
---|
260 | } else { |
---|
261 | $this->$key = $value; |
---|
262 | } |
---|
263 | } |
---|
264 | } |
---|
265 | } |
---|