PHPExcel_Worksheet_Drawing
[ class tree: PHPExcel_Worksheet_Drawing ] [ index: PHPExcel_Worksheet_Drawing ] [ all elements ]

Source for file Drawing.php

Documentation is available at Drawing.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 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_Worksheet_Drawing
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.5, 2009-01-05
  26.  */
  27.  
  28.  
  29. /** PHPExcel_IComparable */
  30. require_once 'PHPExcel/IComparable.php';
  31.  
  32. /** PHPExcel_Worksheet */
  33. require_once 'PHPExcel/Worksheet.php';
  34.  
  35. /** PHPExcel_Worksheet_BaseDrawing */
  36. require_once 'PHPExcel/Worksheet/BaseDrawing.php';
  37.  
  38. /** PHPExcel_Worksheet_Drawing_Shadow */
  39. require_once 'PHPExcel/Worksheet/Drawing/Shadow.php';
  40.  
  41.  
  42. /**
  43.  * PHPExcel_Worksheet_Drawing
  44.  *
  45.  * @category   PHPExcel
  46.  * @package    PHPExcel_Worksheet_Drawing
  47.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  48.  */
  49. {        
  50.     /**
  51.      * Path
  52.      *
  53.      * @var string 
  54.      */
  55.     private $_path;
  56.     
  57.     /**
  58.      * Create a new PHPExcel_Worksheet_Drawing
  59.      */
  60.     public function __construct()
  61.     {
  62.         // Initialise values
  63.         $this->_path                = '';
  64.         
  65.         // Initialize parent
  66.         parent::__construct();
  67.     }
  68.     
  69.     /**
  70.      * Get Filename
  71.      *
  72.      * @return string 
  73.      */
  74.     public function getFilename({
  75.         return basename($this->_path);
  76.     }
  77.     
  78.     /**
  79.      * Get indexed filename (using image index)
  80.      *
  81.      * @return string 
  82.      */
  83.     public function getIndexedFilename({
  84.         return str_replace('.' $this->getExtension()''$this->getFilename()) $this->getImageIndex('.' $this->getExtension();
  85.     }
  86.     
  87.     /**
  88.      * Get Extension
  89.      *
  90.      * @return string 
  91.      */
  92.     public function getExtension({
  93.         $exploded explode("."basename($this->_path));
  94.         return $exploded[count($exploded1];
  95.     }
  96.     
  97.     /**
  98.      * Get Path
  99.      *
  100.      * @return string 
  101.      */
  102.     public function getPath({
  103.         return $this->_path;
  104.     }
  105.     
  106.     /**
  107.      * Set Path
  108.      *
  109.      * @param     string         $pValue            File path
  110.      * @param     boolean        $pVerifyFile    Verify file
  111.      * @throws     Exception
  112.      */
  113.     public function setPath($pValue ''$pVerifyFile true{
  114.         if ($pVerifyFile{
  115.             if (file_exists($pValue)) {
  116.                 $this->_path = $pValue;
  117.                 
  118.                 if ($this->_width == && $this->_height == 0{
  119.                     // Get width/height
  120.                     list($this->_width$this->_heightgetimagesize($pValue);
  121.                 }
  122.             else {
  123.                 throw new Exception("File $pValue not found!");
  124.             }
  125.         else {
  126.             $this->_path = $pValue;
  127.         }
  128.     }
  129.  
  130.     /**
  131.      * Get hash code
  132.      *
  133.      * @return string    Hash code
  134.      */    
  135.     public function getHashCode({
  136.         return md5(
  137.               $this->_path
  138.             . parent::getHashCode()
  139.             . __CLASS__
  140.         );
  141.     }
  142.     
  143.     /**
  144.      * Hash index
  145.      *
  146.      * @var string 
  147.      */
  148.     private $_hashIndex;
  149.     
  150.     /**
  151.      * Get hash index
  152.      * 
  153.      * Note that this index may vary during script execution! Only reliable moment is
  154.      * while doing a write of a workbook and when changes are not allowed.
  155.      *
  156.      * @return string    Hash index
  157.      */
  158.     public function getHashIndex({
  159.         return $this->_hashIndex;
  160.     }
  161.     
  162.     /**
  163.      * Set hash index
  164.      * 
  165.      * Note that this index may vary during script execution! Only reliable moment is
  166.      * while doing a write of a workbook and when changes are not allowed.
  167.      *
  168.      * @param string    $value    Hash index
  169.      */
  170.     public function setHashIndex($value{
  171.         $this->_hashIndex = $value;
  172.     }
  173.         
  174.     /**
  175.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  176.      */
  177.     public function __clone({
  178.         $vars get_object_vars($this);
  179.         foreach ($vars as $key => $value{
  180.             if (is_object($value)) {
  181.                 $this->$key clone $value;
  182.             else {
  183.                 $this->$key $value;
  184.             }
  185.         }
  186.     }
  187. }

Documentation generated on Mon, 05 Jan 2009 20:36:50 +0100 by phpDocumentor 1.4.1