Supervisor.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. abstract class PHPExcel_Style_Supervisor
  8. {
  9. /**
  10. * Supervisor?
  11. *
  12. * @var boolean
  13. */
  14. protected $isSupervisor;
  15. /**
  16. * Parent. Only used for supervisor
  17. *
  18. * @var PHPExcel_Style
  19. */
  20. protected $parent;
  21. /**
  22. * Create a new PHPExcel_Style_Alignment
  23. *
  24. * @param boolean $isSupervisor Flag indicating if this is a supervisor or not
  25. * Leave this value at default unless you understand exactly what
  26. * its ramifications are
  27. */
  28. public function __construct($isSupervisor = false)
  29. {
  30. // Supervisor?
  31. $this->isSupervisor = $isSupervisor;
  32. }
  33. /**
  34. * Bind parent. Only used for supervisor
  35. *
  36. * @param PHPExcel $parent
  37. * @return PHPExcel_Style_Supervisor
  38. */
  39. public function bindParent($parent, $parentPropertyName = null)
  40. {
  41. $this->parent = $parent;
  42. return $this;
  43. }
  44. /**
  45. * Is this a supervisor or a cell style component?
  46. *
  47. * @return boolean
  48. */
  49. public function getIsSupervisor()
  50. {
  51. return $this->isSupervisor;
  52. }
  53. /**
  54. * Get the currently active sheet. Only used for supervisor
  55. *
  56. * @return PHPExcel_Worksheet
  57. */
  58. public function getActiveSheet()
  59. {
  60. return $this->parent->getActiveSheet();
  61. }
  62. /**
  63. * Get the currently active cell coordinate in currently active sheet.
  64. * Only used for supervisor
  65. *
  66. * @return string E.g. 'A1'
  67. */
  68. public function getSelectedCells()
  69. {
  70. return $this->getActiveSheet()->getSelectedCells();
  71. }
  72. /**
  73. * Get the currently active cell coordinate in currently active sheet.
  74. * Only used for supervisor
  75. *
  76. * @return string E.g. 'A1'
  77. */
  78. public function getActiveCell()
  79. {
  80. return $this->getActiveSheet()->getActiveCell();
  81. }
  82. /**
  83. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  84. */
  85. public function __clone()
  86. {
  87. $vars = get_object_vars($this);
  88. foreach ($vars as $key => $value) {
  89. if ((is_object($value)) && ($key != 'parent')) {
  90. $this->$key = clone $value;
  91. } else {
  92. $this->$key = $value;
  93. }
  94. }
  95. }
  96. }