f61a0944efc21a4a4156284223810018cceb1456.svn-base 2.3 KB

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