| 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_CellIterator |
| 31 |
* |
| 32 |
* Used to iterate rows in a PHPExcel_Worksheet |
| 33 |
* |
| 34 |
* @category PHPExcel |
| 35 |
* @package PHPExcel_Worksheet |
| 36 |
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
| 37 |
*/ |
| 38 |
abstract class PHPExcel_Worksheet_CellIterator |
| 39 |
{ |
| 40 |
/** |
| 41 |
* PHPExcel_Worksheet to iterate |
| 42 |
* |
| 43 |
* @var PHPExcel_Worksheet |
| 44 |
*/ |
| 45 |
protected $_subject; |
| 46 |
|
| 47 |
/** |
| 48 |
* Current iterator position |
| 49 |
* |
| 50 |
* @var mixed |
| 51 |
*/ |
| 52 |
protected $_position = null; |
| 53 |
|
| 54 |
/** |
| 55 |
* Iterate only existing cells |
| 56 |
* |
| 57 |
* @var boolean |
| 58 |
*/ |
| 59 |
protected $_onlyExistingCells = false; |
| 60 |
|
| 61 |
/** |
| 62 |
* Destructor |
| 63 |
*/ |
| 64 |
public function __destruct() { |
| 65 |
unset($this->_subject); |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Get loop only existing cells |
| 70 |
* |
| 71 |
* @return boolean |
| 72 |
*/ |
| 73 |
public function getIterateOnlyExistingCells() { |
| 74 |
return $this->_onlyExistingCells; |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary |
| 79 |
* |
| 80 |
* @throws PHPExcel_Exception |
| 81 |
*/ |
| 82 |
abstract protected function adjustForExistingOnlyRange(); |
| 83 |
|
| 84 |
/** |
| 85 |
* Set the iterator to loop only existing cells |
| 86 |
* |
| 87 |
* @param boolean $value |
| 88 |
* @throws PHPExcel_Exception |
| 89 |
*/ |
| 90 |
public function setIterateOnlyExistingCells($value = true) { |
| 91 |
$this->_onlyExistingCells = (boolean) $value; |
| 92 |
|
| 93 |
$this->adjustForExistingOnlyRange(); |
| 94 |
} |
| 95 |
} |
| 96 |
|