d39cc7894862967dbd688ecb25d8e67ecdcceca4.svn-base 7.5 KB

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