No Description

Supervisor.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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_Style
  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_Style_Supervisor
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Style
  32. * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. abstract class PHPExcel_Style_Supervisor
  35. {
  36. /**
  37. * Supervisor?
  38. *
  39. * @var boolean
  40. */
  41. protected $_isSupervisor;
  42. /**
  43. * Parent. Only used for supervisor
  44. *
  45. * @var PHPExcel_Style
  46. */
  47. protected $_parent;
  48. /**
  49. * Create a new PHPExcel_Style_Alignment
  50. *
  51. * @param boolean $isSupervisor Flag indicating if this is a supervisor or not
  52. * Leave this value at default unless you understand exactly what
  53. * its ramifications are
  54. */
  55. public function __construct($isSupervisor = FALSE)
  56. {
  57. // Supervisor?
  58. $this->_isSupervisor = $isSupervisor;
  59. }
  60. /**
  61. * Bind parent. Only used for supervisor
  62. *
  63. * @param PHPExcel $parent
  64. * @return PHPExcel_Style_Supervisor
  65. */
  66. public function bindParent($parent, $parentPropertyName=NULL)
  67. {
  68. $this->_parent = $parent;
  69. return $this;
  70. }
  71. /**
  72. * Is this a supervisor or a cell style component?
  73. *
  74. * @return boolean
  75. */
  76. public function getIsSupervisor()
  77. {
  78. return $this->_isSupervisor;
  79. }
  80. /**
  81. * Get the currently active sheet. Only used for supervisor
  82. *
  83. * @return PHPExcel_Worksheet
  84. */
  85. public function getActiveSheet()
  86. {
  87. return $this->_parent->getActiveSheet();
  88. }
  89. /**
  90. * Get the currently active cell coordinate in currently active sheet.
  91. * Only used for supervisor
  92. *
  93. * @return string E.g. 'A1'
  94. */
  95. public function getSelectedCells()
  96. {
  97. return $this->getActiveSheet()->getSelectedCells();
  98. }
  99. /**
  100. * Get the currently active cell coordinate in currently active sheet.
  101. * Only used for supervisor
  102. *
  103. * @return string E.g. 'A1'
  104. */
  105. public function getActiveCell()
  106. {
  107. return $this->getActiveSheet()->getActiveCell();
  108. }
  109. /**
  110. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  111. */
  112. public function __clone() {
  113. $vars = get_object_vars($this);
  114. foreach ($vars as $key => $value) {
  115. if ((is_object($value)) && ($key != '_parent')) {
  116. $this->$key = clone $value;
  117. } else {
  118. $this->$key = $value;
  119. }
  120. }
  121. }
  122. }