| 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 ##VERSION##, ##DATE## |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
/** |
| 30 |
* PHPExcel_Worksheet_ColumnDimension |
| 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_ColumnDimension |
| 37 |
{ |
| 38 |
/** |
| 39 |
* Column index |
| 40 |
* |
| 41 |
* @var int |
| 42 |
*/ |
| 43 |
private $_columnIndex; |
| 44 |
|
| 45 |
/** |
| 46 |
* Column width |
| 47 |
* |
| 48 |
* When this is set to a negative value, the column width should be ignored by IWriter |
| 49 |
* |
| 50 |
* @var double |
| 51 |
*/ |
| 52 |
private $_width = -1; |
| 53 |
|
| 54 |
/** |
| 55 |
* Auto size? |
| 56 |
* |
| 57 |
* @var bool |
| 58 |
*/ |
| 59 |
private $_autoSize = 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 |
| 84 |
* |
| 85 |
* @var int |
| 86 |
*/ |
| 87 |
private $_xfIndex; |
| 88 |
|
| 89 |
/** |
| 90 |
* Create a new PHPExcel_Worksheet_ColumnDimension |
| 91 |
* |
| 92 |
* @param string $pIndex Character column index |
| 93 |
*/ |
| 94 |
public function __construct($pIndex = 'A') |
| 95 |
{ |
| 96 |
// Initialise values |
| 97 |
$this->_columnIndex = $pIndex; |
| 98 |
|
| 99 |
// set default index to cellXf |
| 100 |
$this->_xfIndex = 0; |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Get ColumnIndex |
| 105 |
* |
| 106 |
* @return string |
| 107 |
*/ |
| 108 |
public function getColumnIndex() { |
| 109 |
return $this->_columnIndex; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Set ColumnIndex |
| 114 |
* |
| 115 |
* @param string $pValue |
| 116 |
* @return PHPExcel_Worksheet_ColumnDimension |
| 117 |
*/ |
| 118 |
public function setColumnIndex($pValue) { |
| 119 |
$this->_columnIndex = $pValue; |
| 120 |
return $this; |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* Get Width |
| 125 |
* |
| 126 |
* @return double |
| 127 |
*/ |
| 128 |
public function getWidth() { |
| 129 |
return $this->_width; |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* Set Width |
| 134 |
* |
| 135 |
* @param double $pValue |
| 136 |
* @return PHPExcel_Worksheet_ColumnDimension |
| 137 |
*/ |
| 138 |
public function setWidth($pValue = -1) { |
| 139 |
$this->_width = $pValue; |
| 140 |
return $this; |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* Get Auto Size |
| 145 |
* |
| 146 |
* @return bool |
| 147 |
*/ |
| 148 |
public function getAutoSize() { |
| 149 |
return $this->_autoSize; |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Set Auto Size |
| 154 |
* |
| 155 |
* @param bool $pValue |
| 156 |
* @return PHPExcel_Worksheet_ColumnDimension |
| 157 |
*/ |
| 158 |
public function setAutoSize($pValue = false) { |
| 159 |
$this->_autoSize = $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_ColumnDimension |
| 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_ColumnDimension |
| 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_ColumnDimension |
| 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_ColumnDimension |
| 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 |
|
| 266 |
} |
| 267 |
|