| 
									
										
										
										
											2012-10-24 16:07:55 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-12-31 18:36:33 +00:00
										 |  |  |  * Copyright (c) 2006 - 2014 PHPExcel | 
					
						
							| 
									
										
										
										
											2012-10-24 16:07:55 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License as published by the Free Software Foundation; either | 
					
						
							|  |  |  |  * version 2.1 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |  * Lesser General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License along with this library; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category   PHPExcel | 
					
						
							|  |  |  |  * @package	PHPExcel_Style | 
					
						
							| 
									
										
										
										
											2013-12-31 18:36:33 +00:00
										 |  |  |  * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2012-10-24 16:07:55 +00:00
										 |  |  |  * @license	http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL | 
					
						
							|  |  |  |  * @version	##VERSION##, ##DATE##
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel_Style_Supervisor | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category   PHPExcel | 
					
						
							|  |  |  |  * @package	PHPExcel_Style | 
					
						
							| 
									
										
										
										
											2013-12-31 18:36:33 +00:00
										 |  |  |  * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2012-10-24 16:07:55 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | abstract class PHPExcel_Style_Supervisor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Supervisor? | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @var boolean | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	protected $_isSupervisor; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Parent. Only used for supervisor | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @var PHPExcel_Style | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	protected $_parent; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Create a new PHPExcel_Style_Alignment | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @param	boolean	$isSupervisor	Flag indicating if this is a supervisor or not | 
					
						
							|  |  |  | 	 *									Leave this value at default unless you understand exactly what | 
					
						
							|  |  |  | 	 *										its ramifications are | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function __construct($isSupervisor = FALSE) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		// Supervisor?
 | 
					
						
							|  |  |  | 		$this->_isSupervisor = $isSupervisor; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Bind parent. Only used for supervisor | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @param PHPExcel $parent | 
					
						
							|  |  |  | 	 * @return PHPExcel_Style_Supervisor | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-10-26 13:56:58 +00:00
										 |  |  | 	public function bindParent($parent, $parentPropertyName=NULL) | 
					
						
							| 
									
										
										
										
											2012-10-24 16:07:55 +00:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		$this->_parent = $parent; | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Is this a supervisor or a cell style component? | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @return boolean | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getIsSupervisor() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return $this->_isSupervisor; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Get the currently active sheet. Only used for supervisor | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @return PHPExcel_Worksheet | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getActiveSheet() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return $this->_parent->getActiveSheet(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Get the currently active cell coordinate in currently active sheet. | 
					
						
							|  |  |  | 	 * Only used for supervisor | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @return string E.g. 'A1' | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getSelectedCells() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return $this->getActiveSheet()->getSelectedCells(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Get the currently active cell coordinate in currently active sheet. | 
					
						
							|  |  |  | 	 * Only used for supervisor | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @return string E.g. 'A1' | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getActiveCell() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return $this->getActiveSheet()->getActiveCell(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Implement PHP __clone to create a deep clone, not just a shallow copy. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function __clone() { | 
					
						
							|  |  |  | 		$vars = get_object_vars($this); | 
					
						
							|  |  |  | 		foreach ($vars as $key => $value) { | 
					
						
							|  |  |  | 			if ((is_object($value)) && ($key != '_parent')) { | 
					
						
							|  |  |  | 				$this->$key = clone $value; | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				$this->$key = $value; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |