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