PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/common/libraries/plugin/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php

https://bitbucket.org/renaatdemuynck/chamilo
PHP | 370 lines | 122 code | 37 blank | 211 comment | 2 complexity | 3628152acaa17e0e6a6aad80a4625bab MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, LGPL-3.0, GPL-3.0, MIT, GPL-2.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. {
  194. return $this->_OPT[$property];
  195. }
  196. return null;
  197. }
  198. /**
  199. * Get the collection of options
  200. *
  201. * @return array
  202. */
  203. public function getOPTCollection()
  204. {
  205. return $this->_OPT;
  206. }
  207. /**
  208. * Set cell coordinates of upper-left corner of shape
  209. *
  210. * @param string $value
  211. */
  212. public function setStartCoordinates($value = 'A1')
  213. {
  214. $this->_startCoordinates = $value;
  215. }
  216. /**
  217. * Get cell coordinates of upper-left corner of shape
  218. *
  219. * @return string
  220. */
  221. public function getStartCoordinates()
  222. {
  223. return $this->_startCoordinates;
  224. }
  225. /**
  226. * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
  227. *
  228. * @param int $startOffsetX
  229. */
  230. public function setStartOffsetX($startOffsetX = 0)
  231. {
  232. $this->_startOffsetX = $startOffsetX;
  233. }
  234. /**
  235. * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
  236. *
  237. * @return int
  238. */
  239. public function getStartOffsetX()
  240. {
  241. return $this->_startOffsetX;
  242. }
  243. /**
  244. * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
  245. *
  246. * @param int $startOffsetY
  247. */
  248. public function setStartOffsetY($startOffsetY = 0)
  249. {
  250. $this->_startOffsetY = $startOffsetY;
  251. }
  252. /**
  253. * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
  254. *
  255. * @return int
  256. */
  257. public function getStartOffsetY()
  258. {
  259. return $this->_startOffsetY;
  260. }
  261. /**
  262. * Set cell coordinates of bottom-right corner of shape
  263. *
  264. * @param string $value
  265. */
  266. public function setEndCoordinates($value = 'A1')
  267. {
  268. $this->_endCoordinates = $value;
  269. }
  270. /**
  271. * Get cell coordinates of bottom-right corner of shape
  272. *
  273. * @return string
  274. */
  275. public function getEndCoordinates()
  276. {
  277. return $this->_endCoordinates;
  278. }
  279. /**
  280. * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
  281. *
  282. * @param int $startOffsetX
  283. */
  284. public function setEndOffsetX($endOffsetX = 0)
  285. {
  286. $this->_endOffsetX = $endOffsetX;
  287. }
  288. /**
  289. * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
  290. *
  291. * @return int
  292. */
  293. public function getEndOffsetX()
  294. {
  295. return $this->_endOffsetX;
  296. }
  297. /**
  298. * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
  299. *
  300. * @param int $endOffsetY
  301. */
  302. public function setEndOffsetY($endOffsetY = 0)
  303. {
  304. $this->_endOffsetY = $endOffsetY;
  305. }
  306. /**
  307. * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
  308. *
  309. * @return int
  310. */
  311. public function getEndOffsetY()
  312. {
  313. return $this->_endOffsetY;
  314. }
  315. /**
  316. * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
  317. * the dgContainer. A value of 1 = immediately within first spgrContainer
  318. * Higher nesting level occurs if and only if spContainer is part of a shape group
  319. *
  320. * @return int Nesting level
  321. */
  322. public function getNestingLevel()
  323. {
  324. $nestingLevel = 0;
  325. $parent = $this->getParent();
  326. while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer)
  327. {
  328. ++ $nestingLevel;
  329. $parent = $parent->getParent();
  330. }
  331. return $nestingLevel;
  332. }
  333. }