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

Source for file Drawing.php

Documentation is available at Drawing.php

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

Documentation generated on Sat, 25 Apr 2009 11:37:09 +0200 by phpDocumentor 1.4.1