SpgrContainer.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  8. {
  9. /**
  10. * Parent Shape Group Container
  11. *
  12. * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  13. */
  14. private $parent;
  15. /**
  16. * Shape Container collection
  17. *
  18. * @var array
  19. */
  20. private $children = array();
  21. /**
  22. * Set parent Shape Group Container
  23. *
  24. * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
  25. */
  26. public function setParent($parent)
  27. {
  28. $this->parent = $parent;
  29. }
  30. /**
  31. * Get the parent Shape Group Container if any
  32. *
  33. * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
  34. */
  35. public function getParent()
  36. {
  37. return $this->parent;
  38. }
  39. /**
  40. * Add a child. This will be either spgrContainer or spContainer
  41. *
  42. * @param mixed $child
  43. */
  44. public function addChild($child)
  45. {
  46. $this->children[] = $child;
  47. $child->setParent($this);
  48. }
  49. /**
  50. * Get collection of Shape Containers
  51. */
  52. public function getChildren()
  53. {
  54. return $this->children;
  55. }
  56. /**
  57. * Recursively get all spContainers within this spgrContainer
  58. *
  59. * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[]
  60. */
  61. public function getAllSpContainers()
  62. {
  63. $allSpContainers = array();
  64. foreach ($this->children as $child) {
  65. if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
  66. $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
  67. } else {
  68. $allSpContainers[] = $child;
  69. }
  70. }
  71. return $allSpContainers;
  72. }
  73. }