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

Source for file Shadow.php

Documentation is available at Shadow.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2008 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 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.4, 2008-10-27
  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_Style_Color */
  36. require_once 'PHPExcel/Style/Color.php';
  37.  
  38. /**
  39.  * PHPExcel_Worksheet_Drawing_Shadow
  40.  *
  41.  * @category   PHPExcel
  42.  * @package    PHPExcel_Worksheet_Drawing
  43.  * @copyright  Copyright (c) 2006 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  44.  */
  45. class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
  46. {        
  47.     /* Shadow alignment */
  48.     const SHADOW_BOTTOM                            'b';
  49.     const SHADOW_BOTTOM_LEFT                    'bl';
  50.     const SHADOW_BOTTOM_RIGHT                    'br';
  51.     const SHADOW_CENTER                            'ctr';
  52.     const SHADOW_LEFT                            'l';
  53.     const SHADOW_TOP                            't';
  54.     const SHADOW_TOP_LEFT                        'tl';
  55.     const SHADOW_TOP_RIGHT                        'tr';                            
  56.  
  57.     /**
  58.      * Visible
  59.      *
  60.      * @var boolean 
  61.      */
  62.     private $_visible;
  63.     
  64.     /**
  65.      * Blur radius
  66.      *
  67.      * Defaults to 6
  68.      *
  69.      * @var int 
  70.      */
  71.     private $_blurRadius;
  72.     
  73.     /**
  74.      * Shadow distance
  75.      *
  76.      * Defaults to 2
  77.      *
  78.      * @var int 
  79.      */
  80.     private $_distance;
  81.     
  82.     /**
  83.      * Shadow direction (in degrees)
  84.      *
  85.      * @var int 
  86.      */
  87.     private $_direction;
  88.     
  89.     /**
  90.      * Shadow alignment
  91.      *
  92.      * @var int 
  93.      */
  94.     private $_alignment;
  95.     
  96.     /**
  97.      * Color
  98.      * 
  99.      * @var PHPExcel_Style_Color 
  100.      */
  101.     private $_color;
  102.     
  103.     /**
  104.      * Alpha
  105.      *
  106.      * @var int 
  107.      */
  108.     private $_alpha;
  109.         
  110.     /**
  111.      * Create a new PHPExcel_Worksheet_Drawing_Shadow
  112.      */
  113.     public function __construct()
  114.     {
  115.         // Initialise values
  116.         $this->_visible                = false;
  117.         $this->_blurRadius            = 6;
  118.         $this->_distance            = 2;
  119.         $this->_direction            = 0;
  120.         $this->_alignment            = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
  121.         $this->_color                = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
  122.         $this->_alpha                = 50;
  123.     }
  124.     
  125.     /**
  126.      * Get Visible
  127.      *
  128.      * @return boolean 
  129.      */
  130.     public function getVisible({
  131.         return $this->_visible;
  132.     }
  133.     
  134.     /**
  135.      * Set Visible
  136.      *
  137.      * @param boolean $pValue 
  138.      */
  139.     public function setVisible($pValue false{
  140.         $this->_visible = $pValue;
  141.     }
  142.     
  143.     /**
  144.      * Get Blur radius
  145.      *
  146.      * @return int 
  147.      */
  148.     public function getBlurRadius({
  149.         return $this->_blurRadius;
  150.     }
  151.     
  152.     /**
  153.      * Set Blur radius
  154.      *
  155.      * @param int $pValue 
  156.      */
  157.     public function setBlurRadius($pValue 6{
  158.         $this->_blurRadius = $pValue;
  159.     }
  160.     
  161.     /**
  162.      * Get Shadow distance
  163.      *
  164.      * @return int 
  165.      */
  166.     public function getDistance({
  167.         return $this->_distance;
  168.     }
  169.     
  170.     /**
  171.      * Set Shadow distance
  172.      *
  173.      * @param int $pValue 
  174.      */
  175.     public function setDistance($pValue 2{
  176.         $this->_distance = $pValue;
  177.     }
  178.     
  179.     /**
  180.      * Get Shadow direction (in degrees)
  181.      *
  182.      * @return int 
  183.      */
  184.     public function getDirection({
  185.         return $this->_direction;
  186.     }
  187.     
  188.     /**
  189.      * Set Shadow direction (in degrees)
  190.      *
  191.      * @param int $pValue 
  192.      */
  193.     public function setDirection($pValue 0{
  194.         $this->_direction = $pValue;
  195.     }
  196.     
  197.    /**
  198.      * Get Shadow alignment
  199.      *
  200.      * @return int 
  201.      */
  202.     public function getAlignment({
  203.         return $this->_alignment;
  204.     }
  205.     
  206.     /**
  207.      * Set Shadow alignment
  208.      *
  209.      * @param int $pValue 
  210.      */
  211.     public function setAlignment($pValue 0{
  212.         $this->_alignment = $pValue;
  213.     }
  214.     
  215.    /**
  216.      * Get Color
  217.      *
  218.      * @return PHPExcel_Style_Color 
  219.      */
  220.     public function getColor({
  221.         return $this->_color;
  222.     }
  223.     
  224.     /**
  225.      * Set Color
  226.      *
  227.      * @param     PHPExcel_Style_Color $pValue 
  228.      * @throws     Exception
  229.      */
  230.     public function setColor(PHPExcel_Style_Color $pValue null{
  231.            $this->_color = $pValue;
  232.     }
  233.     
  234.    /**
  235.      * Get Alpha
  236.      *
  237.      * @return int 
  238.      */
  239.     public function getAlpha({
  240.         return $this->_alpha;
  241.     }
  242.     
  243.     /**
  244.      * Set Alpha
  245.      *
  246.      * @param int $pValue 
  247.      */
  248.     public function setAlpha($pValue 0{
  249.         $this->_alpha = $pValue;
  250.     }
  251.  
  252.     /**
  253.      * Get hash code
  254.      *
  255.      * @return string    Hash code
  256.      */    
  257.     public function getHashCode({
  258.         return md5(
  259.               ($this->_visible ? 't' 'f')
  260.             . $this->_blurRadius
  261.             . $this->_distance
  262.             . $this->_direction
  263.             . $this->_alignment
  264.             . $this->_color->getHashCode()
  265.             . $this->_alpha
  266.             . __CLASS__
  267.         );
  268.     }
  269.         
  270.     /**
  271.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  272.      */
  273.     public function __clone({
  274.         $vars get_object_vars($this);
  275.         foreach ($vars as $key => $value{
  276.             if (is_object($value)) {
  277.                 $this->$key clone $value;
  278.             else {
  279.                 $this->$key $value;
  280.             }
  281.         }
  282.     }
  283. }

Documentation generated on Mon, 27 Oct 2008 08:41:18 +0100 by phpDocumentor 1.4.1