/protected/library/PHPExcel/Worksheet/RowDimension.php

https://github.com/chrishubber/storytlr · PHP · 200 lines · 60 code · 19 blank · 121 comment · 4 complexity · 5922fe6d74ef9322a0b06c19d0a0b04b MD5 · raw file

  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2008 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 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.6.3, 2008-08-25
  26. */
  27. /**
  28. * PHPExcel_Worksheet_RowDimension
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Worksheet
  32. * @copyright Copyright (c) 2006 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Worksheet_RowDimension
  35. {
  36. /**
  37. * Row index
  38. *
  39. * @var int
  40. */
  41. private $_rowIndex;
  42. /**
  43. * Row height (in pt)
  44. *
  45. * When this is set to a negative value, the row height should be ignored by IWriter
  46. *
  47. * @var double
  48. */
  49. private $_rowHeight;
  50. /**
  51. * Visible?
  52. *
  53. * @var bool
  54. */
  55. private $_visible;
  56. /**
  57. * Outline level
  58. *
  59. * @var int
  60. */
  61. private $_outlineLevel = 0;
  62. /**
  63. * Collapsed
  64. *
  65. * @var bool
  66. */
  67. private $_collapsed;
  68. /**
  69. * Create a new PHPExcel_Worksheet_RowDimension
  70. *
  71. * @param int $pIndex Numeric row index
  72. */
  73. public function __construct($pIndex = 0)
  74. {
  75. // Initialise values
  76. $this->_rowIndex = $pIndex;
  77. $this->_rowHeight = -1;
  78. $this->_visible = true;
  79. $this->_outlineLevel = 0;
  80. $this->_collapsed = false;
  81. }
  82. /**
  83. * Get Row Index
  84. *
  85. * @return int
  86. */
  87. public function getRowIndex() {
  88. return $this->_rowIndex;
  89. }
  90. /**
  91. * Set Row Index
  92. *
  93. * @param int $pValue
  94. */
  95. public function setRowIndex($pValue) {
  96. $this->_rowIndex = $pValue;
  97. }
  98. /**
  99. * Get Row Height
  100. *
  101. * @return double
  102. */
  103. public function getRowHeight() {
  104. return $this->_rowHeight;
  105. }
  106. /**
  107. * Set Row Height
  108. *
  109. * @param double $pValue
  110. */
  111. public function setRowHeight($pValue = -1) {
  112. $this->_rowHeight = $pValue;
  113. }
  114. /**
  115. * Get Visible
  116. *
  117. * @return bool
  118. */
  119. public function getVisible() {
  120. return $this->_visible;
  121. }
  122. /**
  123. * Set Visible
  124. *
  125. * @param bool $pValue
  126. */
  127. public function setVisible($pValue = true) {
  128. $this->_visible = $pValue;
  129. }
  130. /**
  131. * Get Outline Level
  132. *
  133. * @return int
  134. */
  135. public function getOutlineLevel() {
  136. return $this->_outlineLevel;
  137. }
  138. /**
  139. * Set Outline Level
  140. *
  141. * Value must be between 0 and 7
  142. *
  143. * @param int $pValue
  144. * @throws Exception
  145. */
  146. public function setOutlineLevel($pValue) {
  147. if ($pValue < 0 || $pValue > 7) {
  148. throw new Exception("Outline level must range between 0 and 7.");
  149. }
  150. $this->_outlineLevel = $pValue;
  151. }
  152. /**
  153. * Get Collapsed
  154. *
  155. * @return bool
  156. */
  157. public function getCollapsed() {
  158. return $this->_collapsed;
  159. }
  160. /**
  161. * Set Collapsed
  162. *
  163. * @param bool $pValue
  164. */
  165. public function setCollapsed($pValue = true) {
  166. $this->_collapsed = $pValue;
  167. }
  168. /**
  169. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  170. */
  171. public function __clone() {
  172. $vars = get_object_vars($this);
  173. foreach ($vars as $key => $value) {
  174. if (is_object($value)) {
  175. $this->$key = clone $value;
  176. } else {
  177. $this->$key = $value;
  178. }
  179. }
  180. }
  181. }