SpContainer.php 7.7 KB

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