dcc9e7bfb2a9ca5add4471827fb6061fd777f2d8.svn-base 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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_Reader_Excel2007
  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_Reader_Excel2007_Theme
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Reader_Excel2007
  32. * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Reader_Excel2007_Theme
  35. {
  36. /**
  37. * Theme Name
  38. *
  39. * @var string
  40. */
  41. private $_themeName;
  42. /**
  43. * Colour Scheme Name
  44. *
  45. * @var string
  46. */
  47. private $_colourSchemeName;
  48. /**
  49. * Colour Map indexed by position
  50. *
  51. * @var array of string
  52. */
  53. private $_colourMapValues;
  54. /**
  55. * Colour Map
  56. *
  57. * @var array of string
  58. */
  59. private $_colourMap;
  60. /**
  61. * Create a new PHPExcel_Theme
  62. *
  63. */
  64. public function __construct($themeName,$colourSchemeName,$colourMap)
  65. {
  66. // Initialise values
  67. $this->_themeName = $themeName;
  68. $this->_colourSchemeName = $colourSchemeName;
  69. $this->_colourMap = $colourMap;
  70. }
  71. /**
  72. * Get Theme Name
  73. *
  74. * @return string
  75. */
  76. public function getThemeName()
  77. {
  78. return $this->_themeName;
  79. }
  80. /**
  81. * Get colour Scheme Name
  82. *
  83. * @return string
  84. */
  85. public function getColourSchemeName() {
  86. return $this->_colourSchemeName;
  87. }
  88. /**
  89. * Get colour Map Value by Position
  90. *
  91. * @return string
  92. */
  93. public function getColourByIndex($index=0) {
  94. if (isset($this->_colourMap[$index])) {
  95. return $this->_colourMap[$index];
  96. }
  97. return null;
  98. }
  99. /**
  100. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  101. */
  102. public function __clone() {
  103. $vars = get_object_vars($this);
  104. foreach ($vars as $key => $value) {
  105. if ((is_object($value)) && ($key != '_parent')) {
  106. $this->$key = clone $value;
  107. } else {
  108. $this->$key = $value;
  109. }
  110. }
  111. }
  112. }