| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |  * PHPExcel_Worksheet_BaseDrawing | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * Copyright (c) 2006 - 2015 PHPExcel | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +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_Worksheet | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |  * @version    ##VERSION##, ##DATE##
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Image counter | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |     private static $imageCounter = 0; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Image index | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |     private $imageIndex = 0; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $name; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Description | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $description; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Worksheet | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var PHPExcel_Worksheet | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $worksheet; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Coordinates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $coordinates; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Offset X | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $offsetX; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Offset Y | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $offsetY; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Width | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $width; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Height | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $height; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Proportional resize | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var boolean | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $resizeProportional; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Rotation | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $rotation; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Shadow | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var PHPExcel_Worksheet_Drawing_Shadow | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |     protected $shadow; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Create a new PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __construct() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // Initialise values
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->name                = ''; | 
					
						
							|  |  |  |         $this->description        = ''; | 
					
						
							|  |  |  |         $this->worksheet          = null; | 
					
						
							|  |  |  |         $this->coordinates        = 'A1'; | 
					
						
							|  |  |  |         $this->offsetX            = 0; | 
					
						
							|  |  |  |         $this->offsetY            = 0; | 
					
						
							|  |  |  |         $this->width              = 0; | 
					
						
							|  |  |  |         $this->height             = 0; | 
					
						
							|  |  |  |         $this->resizeProportional = true; | 
					
						
							|  |  |  |         $this->rotation           = 0; | 
					
						
							|  |  |  |         $this->shadow             = new PHPExcel_Worksheet_Drawing_Shadow(); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // Set image index
 | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |         self::$imageCounter++; | 
					
						
							|  |  |  |         $this->imageIndex             = self::$imageCounter; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get image index | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getImageIndex() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |         return $this->imageIndex; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getName() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->name; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setName($pValue = '') | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->name = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Description | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getDescription() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->description; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Description | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setDescription($pValue = '') | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->description = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Worksheet | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getWorksheet() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->worksheet; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Worksheet | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |      * @param     PHPExcel_Worksheet     $pValue | 
					
						
							|  |  |  |      * @param     bool                $pOverrideOld    If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? | 
					
						
							|  |  |  |      * @throws     PHPExcel_Exception | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         if (is_null($this->worksheet)) { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // Add drawing to PHPExcel_Worksheet
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |             $this->worksheet = $pValue; | 
					
						
							|  |  |  |             $this->worksheet->getCell($this->coordinates); | 
					
						
							|  |  |  |             $this->worksheet->getDrawingCollection()->append($this); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             if ($pOverrideOld) { | 
					
						
							|  |  |  |                 // Remove drawing from old PHPExcel_Worksheet
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |                 $iterator = $this->worksheet->getDrawingCollection()->getIterator(); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 while ($iterator->valid()) { | 
					
						
							|  |  |  |                     if ($iterator->current()->getHashCode() == $this->getHashCode()) { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |                         $this->worksheet->getDrawingCollection()->offsetUnset($iterator->key()); | 
					
						
							|  |  |  |                         $this->worksheet = null; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |                         break; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Set new PHPExcel_Worksheet
 | 
					
						
							|  |  |  |                 $this->setWorksheet($pValue); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Coordinates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getCoordinates() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->coordinates; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Coordinates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setCoordinates($pValue = 'A1') | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->coordinates = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get OffsetX | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getOffsetX() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->offsetX; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set OffsetX | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param int $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setOffsetX($pValue = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->offsetX = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get OffsetY | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getOffsetY() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->offsetY; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set OffsetY | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param int $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setOffsetY($pValue = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->offsetY = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Width | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getWidth() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->width; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Width | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param int $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setWidth($pValue = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // Resize proportional?
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         if ($this->resizeProportional && $pValue != 0) { | 
					
						
							|  |  |  |             $ratio = $this->height / ($this->width != 0 ? $this->width : 1); | 
					
						
							|  |  |  |             $this->height = round($ratio * $pValue); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // Set width
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->width = $pValue; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Height | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getHeight() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->height; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Height | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param int $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setHeight($pValue = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // Resize proportional?
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         if ($this->resizeProportional && $pValue != 0) { | 
					
						
							|  |  |  |             $ratio = $this->width / ($this->height != 0 ? $this->height : 1); | 
					
						
							|  |  |  |             $this->width = round($ratio * $pValue); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // Set height
 | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->height = $pValue; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set width and height with proportional resize | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |      * Example: | 
					
						
							|  |  |  |      * <code> | 
					
						
							|  |  |  |      * $objDrawing->setResizeProportional(true); | 
					
						
							|  |  |  |      * $objDrawing->setWidthAndHeight(160,120); | 
					
						
							|  |  |  |      * </code> | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |      * @author Vincent@luo MSN:kele_100@hotmail.com | 
					
						
							|  |  |  |      * @param int $width | 
					
						
							|  |  |  |      * @param int $height | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setWidthAndHeight($width = 0, $height = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $xratio = $width / ($this->width != 0 ? $this->width : 1); | 
					
						
							|  |  |  |         $yratio = $height / ($this->height != 0 ? $this->height : 1); | 
					
						
							|  |  |  |         if ($this->resizeProportional && !($width == 0 || $height == 0)) { | 
					
						
							|  |  |  |             if (($xratio * $this->height) < $height) { | 
					
						
							|  |  |  |                 $this->height = ceil($xratio * $this->height); | 
					
						
							|  |  |  |                 $this->width  = $width; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |                 $this->width    = ceil($yratio * $this->width); | 
					
						
							|  |  |  |                 $this->height    = $height; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |             $this->width = $width; | 
					
						
							|  |  |  |             $this->height = $height; | 
					
						
							| 
									
										
										
										
											2014-07-14 22:45:46 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get ResizeProportional | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return boolean | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getResizeProportional() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->resizeProportional; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set ResizeProportional | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param boolean $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setResizeProportional($pValue = true) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->resizeProportional = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Rotation | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getRotation() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->rotation; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Rotation | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param int $pValue | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setRotation($pValue = 0) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         $this->rotation = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get Shadow | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return PHPExcel_Worksheet_Drawing_Shadow | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getShadow() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |         return $this->shadow; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Set Shadow | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |      * @param     PHPExcel_Worksheet_Drawing_Shadow $pValue | 
					
						
							|  |  |  |      * @throws     PHPExcel_Exception | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |      * @return PHPExcel_Worksheet_BaseDrawing | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |            $this->shadow = $pValue; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |            return $this; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Get hash code | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string    Hash code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function getHashCode() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |         return md5( | 
					
						
							| 
									
										
										
										
											2015-05-20 22:55:01 +00:00
										 |  |  |             $this->name . | 
					
						
							|  |  |  |             $this->description . | 
					
						
							|  |  |  |             $this->worksheet->getHashCode() . | 
					
						
							|  |  |  |             $this->coordinates . | 
					
						
							|  |  |  |             $this->offsetX . | 
					
						
							|  |  |  |             $this->offsetY . | 
					
						
							|  |  |  |             $this->width . | 
					
						
							|  |  |  |             $this->height . | 
					
						
							|  |  |  |             $this->rotation . | 
					
						
							|  |  |  |             $this->shadow->getHashCode() . | 
					
						
							| 
									
										
										
										
											2015-05-20 18:17:17 +00:00
										 |  |  |             __CLASS__ | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Implement PHP __clone to create a deep clone, not just a shallow copy. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-13 11:36:53 +00:00
										 |  |  |     public function __clone() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $vars = get_object_vars($this); | 
					
						
							|  |  |  |         foreach ($vars as $key => $value) { | 
					
						
							|  |  |  |             if (is_object($value)) { | 
					
						
							|  |  |  |                 $this->$key = clone $value; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $this->$key = $value; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | } |