PageRenderTime 59ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php

https://bitbucket.org/riqriq/myapp
PHP | 368 lines | 120 code | 37 blank | 211 comment | 2 complexity | b20b02d13517e0fc9c0f5f0c65a1df3c MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, LGPL-3.0, GPL-3.0
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2011 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_Shared_Escher
  23. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.7.6, 2011-02-27
  26. */
  27. /**
  28. * PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Shared_Escher
  32. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
  35. {
  36. /**
  37. * Parent Shape Group Container
  38. *
  39. * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  40. */
  41. private $_parent;
  42. /**
  43. * Is this a group shape?
  44. *
  45. * @var boolean
  46. */
  47. private $_spgr = false;
  48. /**
  49. * Shape type
  50. *
  51. * @var int
  52. */
  53. private $_spType;
  54. /**
  55. * Shape index (usually group shape has index 0, and the rest: 1,2,3...)
  56. *
  57. * @var boolean
  58. */
  59. private $_spId;
  60. /**
  61. * Array of options
  62. *
  63. * @var array
  64. */
  65. private $_OPT;
  66. /**
  67. * Cell coordinates of upper-left corner of shape, e.g. 'A1'
  68. *
  69. * @var string
  70. */
  71. private $_startCoordinates;
  72. /**
  73. * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
  74. *
  75. * @var int
  76. */
  77. private $_startOffsetX;
  78. /**
  79. * Vertical offset of upper-left corner of shape measured in 1/256 of row height
  80. *
  81. * @var int
  82. */
  83. private $_startOffsetY;
  84. /**
  85. * Cell coordinates of bottom-right corner of shape, e.g. 'B2'
  86. *
  87. * @var string
  88. */
  89. private $_endCoordinates;
  90. /**
  91. * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
  92. *
  93. * @var int
  94. */
  95. private $_endOffsetX;
  96. /**
  97. * Vertical offset of bottom-right corner of shape measured in 1/256 of row height
  98. *
  99. * @var int
  100. */
  101. private $_endOffsetY;
  102. /**
  103. * Set parent Shape Group Container
  104. *
  105. * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
  106. */
  107. public function setParent($parent)
  108. {
  109. $this->_parent = $parent;
  110. }
  111. /**
  112. * Get the parent Shape Group Container
  113. *
  114. * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  115. */
  116. public function getParent()
  117. {
  118. return $this->_parent;
  119. }
  120. /**
  121. * Set whether this is a group shape
  122. *
  123. * @param boolean $value
  124. */
  125. public function setSpgr($value = false)
  126. {
  127. $this->_spgr = $value;
  128. }
  129. /**
  130. * Get whether this is a group shape
  131. *
  132. * @return boolean
  133. */
  134. public function getSpgr()
  135. {
  136. return $this->_spgr;
  137. }
  138. /**
  139. * Set the shape type
  140. *
  141. * @param int $value
  142. */
  143. public function setSpType($value)
  144. {
  145. $this->_spType = $value;
  146. }
  147. /**
  148. * Get the shape type
  149. *
  150. * @return int
  151. */
  152. public function getSpType()
  153. {
  154. return $this->_spType;
  155. }
  156. /**
  157. * Set the shape index
  158. *
  159. * @param int $value
  160. */
  161. public function setSpId($value)
  162. {
  163. $this->_spId = $value;
  164. }
  165. /**
  166. * Get the shape index
  167. *
  168. * @return int
  169. */
  170. public function getSpId()
  171. {
  172. return $this->_spId;
  173. }
  174. /**
  175. * Set an option for the Shape Group Container
  176. *
  177. * @param int $property The number specifies the option
  178. * @param mixed $value
  179. */
  180. public function setOPT($property, $value)
  181. {
  182. $this->_OPT[$property] = $value;
  183. }
  184. /**
  185. * Get an option for the Shape Group Container
  186. *
  187. * @param int $property The number specifies the option
  188. * @return mixed
  189. */
  190. public function getOPT($property)
  191. {
  192. if (isset($this->_OPT[$property])) {
  193. return $this->_OPT[$property];
  194. }
  195. return null;
  196. }
  197. /**
  198. * Get the collection of options
  199. *
  200. * @return array
  201. */
  202. public function getOPTCollection()
  203. {
  204. return $this->_OPT;
  205. }
  206. /**
  207. * Set cell coordinates of upper-left corner of shape
  208. *
  209. * @param string $value
  210. */
  211. public function setStartCoordinates($value = 'A1')
  212. {
  213. $this->_startCoordinates = $value;
  214. }
  215. /**
  216. * Get cell coordinates of upper-left corner of shape
  217. *
  218. * @return string
  219. */
  220. public function getStartCoordinates()
  221. {
  222. return $this->_startCoordinates;
  223. }
  224. /**
  225. * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
  226. *
  227. * @param int $startOffsetX
  228. */
  229. public function setStartOffsetX($startOffsetX = 0)
  230. {
  231. $this->_startOffsetX = $startOffsetX;
  232. }
  233. /**
  234. * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
  235. *
  236. * @return int
  237. */
  238. public function getStartOffsetX()
  239. {
  240. return $this->_startOffsetX;
  241. }
  242. /**
  243. * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
  244. *
  245. * @param int $startOffsetY
  246. */
  247. public function setStartOffsetY($startOffsetY = 0)
  248. {
  249. $this->_startOffsetY = $startOffsetY;
  250. }
  251. /**
  252. * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
  253. *
  254. * @return int
  255. */
  256. public function getStartOffsetY()
  257. {
  258. return $this->_startOffsetY;
  259. }
  260. /**
  261. * Set cell coordinates of bottom-right corner of shape
  262. *
  263. * @param string $value
  264. */
  265. public function setEndCoordinates($value = 'A1')
  266. {
  267. $this->_endCoordinates = $value;
  268. }
  269. /**
  270. * Get cell coordinates of bottom-right corner of shape
  271. *
  272. * @return string
  273. */
  274. public function getEndCoordinates()
  275. {
  276. return $this->_endCoordinates;
  277. }
  278. /**
  279. * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
  280. *
  281. * @param int $startOffsetX
  282. */
  283. public function setEndOffsetX($endOffsetX = 0)
  284. {
  285. $this->_endOffsetX = $endOffsetX;
  286. }
  287. /**
  288. * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
  289. *
  290. * @return int
  291. */
  292. public function getEndOffsetX()
  293. {
  294. return $this->_endOffsetX;
  295. }
  296. /**
  297. * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
  298. *
  299. * @param int $endOffsetY
  300. */
  301. public function setEndOffsetY($endOffsetY = 0)
  302. {
  303. $this->_endOffsetY = $endOffsetY;
  304. }
  305. /**
  306. * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
  307. *
  308. * @return int
  309. */
  310. public function getEndOffsetY()
  311. {
  312. return $this->_endOffsetY;
  313. }
  314. /**
  315. * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
  316. * the dgContainer. A value of 1 = immediately within first spgrContainer
  317. * Higher nesting level occurs if and only if spContainer is part of a shape group
  318. *
  319. * @return int Nesting level
  320. */
  321. public function getNestingLevel()
  322. {
  323. $nestingLevel = 0;
  324. $parent = $this->getParent();
  325. while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
  326. ++$nestingLevel;
  327. $parent = $parent->getParent();
  328. }
  329. return $nestingLevel;
  330. }
  331. }