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 - 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.7.0, 2009-08-10
  26.  */
  27.  
  28.  
  29. /** PHPExcel root directory */
  30. if (!defined('PHPEXCEL_ROOT')) {
  31.     /**
  32.      * @ignore
  33.      */
  34.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../../../');
  35. }
  36.  
  37. /** PHPExcel_IComparable */
  38. require_once PHPEXCEL_ROOT 'PHPExcel/IComparable.php';
  39.  
  40. /** PHPExcel_Worksheet */
  41. require_once PHPEXCEL_ROOT 'PHPExcel/Worksheet.php';
  42.  
  43. /** PHPExcel_Style_Color */
  44. require_once PHPEXCEL_ROOT 'PHPExcel/Style/Color.php';
  45.  
  46. /**
  47.  * PHPExcel_Worksheet_Drawing_Shadow
  48.  *
  49.  * @category   PHPExcel
  50.  * @package    PHPExcel_Worksheet_Drawing
  51.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  52.  */
  53. class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
  54. {        
  55.     /* Shadow alignment */
  56.     const SHADOW_BOTTOM                            'b';
  57.     const SHADOW_BOTTOM_LEFT                    'bl';
  58.     const SHADOW_BOTTOM_RIGHT                    'br';
  59.     const SHADOW_CENTER                            'ctr';
  60.     const SHADOW_LEFT                            'l';
  61.     const SHADOW_TOP                            't';
  62.     const SHADOW_TOP_LEFT                        'tl';
  63.     const SHADOW_TOP_RIGHT                        'tr';                            
  64.  
  65.     /**
  66.      * Visible
  67.      *
  68.      * @var boolean 
  69.      */
  70.     private $_visible;
  71.     
  72.     /**
  73.      * Blur radius
  74.      *
  75.      * Defaults to 6
  76.      *
  77.      * @var int 
  78.      */
  79.     private $_blurRadius;
  80.     
  81.     /**
  82.      * Shadow distance
  83.      *
  84.      * Defaults to 2
  85.      *
  86.      * @var int 
  87.      */
  88.     private $_distance;
  89.     
  90.     /**
  91.      * Shadow direction (in degrees)
  92.      *
  93.      * @var int 
  94.      */
  95.     private $_direction;
  96.     
  97.     /**
  98.      * Shadow alignment
  99.      *
  100.      * @var int 
  101.      */
  102.     private $_alignment;
  103.     
  104.     /**
  105.      * Color
  106.      * 
  107.      * @var PHPExcel_Style_Color 
  108.      */
  109.     private $_color;
  110.     
  111.     /**
  112.      * Alpha
  113.      *
  114.      * @var int 
  115.      */
  116.     private $_alpha;
  117.         
  118.     /**
  119.      * Create a new PHPExcel_Worksheet_Drawing_Shadow
  120.      */
  121.     public function __construct()
  122.     {
  123.         // Initialise values
  124.         $this->_visible                = false;
  125.         $this->_blurRadius            = 6;
  126.         $this->_distance            = 2;
  127.         $this->_direction            = 0;
  128.         $this->_alignment            = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
  129.         $this->_color                = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
  130.         $this->_alpha                = 50;
  131.     }
  132.     
  133.     /**
  134.      * Get Visible
  135.      *
  136.      * @return boolean 
  137.      */
  138.     public function getVisible({
  139.         return $this->_visible;
  140.     }
  141.     
  142.     /**
  143.      * Set Visible
  144.      *
  145.      * @param boolean $pValue 
  146.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  147.      */
  148.     public function setVisible($pValue false{
  149.         $this->_visible = $pValue;
  150.         return $this;
  151.     }
  152.     
  153.     /**
  154.      * Get Blur radius
  155.      *
  156.      * @return int 
  157.      */
  158.     public function getBlurRadius({
  159.         return $this->_blurRadius;
  160.     }
  161.     
  162.     /**
  163.      * Set Blur radius
  164.      *
  165.      * @param int $pValue 
  166.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  167.      */
  168.     public function setBlurRadius($pValue 6{
  169.         $this->_blurRadius = $pValue;
  170.         return $this;
  171.     }
  172.     
  173.     /**
  174.      * Get Shadow distance
  175.      *
  176.      * @return int 
  177.      */
  178.     public function getDistance({
  179.         return $this->_distance;
  180.     }
  181.     
  182.     /**
  183.      * Set Shadow distance
  184.      *
  185.      * @param int $pValue 
  186.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  187.      */
  188.     public function setDistance($pValue 2{
  189.         $this->_distance = $pValue;
  190.         return $this;
  191.     }
  192.     
  193.     /**
  194.      * Get Shadow direction (in degrees)
  195.      *
  196.      * @return int 
  197.      */
  198.     public function getDirection({
  199.         return $this->_direction;
  200.     }
  201.     
  202.     /**
  203.      * Set Shadow direction (in degrees)
  204.      *
  205.      * @param int $pValue 
  206.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  207.      */
  208.     public function setDirection($pValue 0{
  209.         $this->_direction = $pValue;
  210.         return $this;
  211.     }
  212.     
  213.    /**
  214.      * Get Shadow alignment
  215.      *
  216.      * @return int 
  217.      */
  218.     public function getAlignment({
  219.         return $this->_alignment;
  220.     }
  221.     
  222.     /**
  223.      * Set Shadow alignment
  224.      *
  225.      * @param int $pValue 
  226.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  227.      */
  228.     public function setAlignment($pValue 0{
  229.         $this->_alignment = $pValue;
  230.         return $this;
  231.     }
  232.     
  233.    /**
  234.      * Get Color
  235.      *
  236.      * @return PHPExcel_Style_Color 
  237.      */
  238.     public function getColor({
  239.         return $this->_color;
  240.     }
  241.     
  242.     /**
  243.      * Set Color
  244.      *
  245.      * @param     PHPExcel_Style_Color $pValue 
  246.      * @throws     Exception
  247.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  248.      */
  249.     public function setColor(PHPExcel_Style_Color $pValue null{
  250.            $this->_color = $pValue;
  251.            return $this;
  252.     }
  253.     
  254.    /**
  255.      * Get Alpha
  256.      *
  257.      * @return int 
  258.      */
  259.     public function getAlpha({
  260.         return $this->_alpha;
  261.     }
  262.     
  263.     /**
  264.      * Set Alpha
  265.      *
  266.      * @param int $pValue 
  267.      * @return PHPExcel_Worksheet_Drawing_Shadow 
  268.      */
  269.     public function setAlpha($pValue 0{
  270.         $this->_alpha = $pValue;
  271.         return $this;
  272.     }
  273.  
  274.     /**
  275.      * Get hash code
  276.      *
  277.      * @return string    Hash code
  278.      */    
  279.     public function getHashCode({
  280.         return md5(
  281.               ($this->_visible ? 't' 'f')
  282.             . $this->_blurRadius
  283.             . $this->_distance
  284.             . $this->_direction
  285.             . $this->_alignment
  286.             . $this->_color->getHashCode()
  287.             . $this->_alpha
  288.             . __CLASS__
  289.         );
  290.     }
  291.     
  292.     /**
  293.      * Hash index
  294.      *
  295.      * @var string 
  296.      */
  297.     private $_hashIndex;
  298.     
  299.     /**
  300.      * Get hash index
  301.      * 
  302.      * Note that this index may vary during script execution! Only reliable moment is
  303.      * while doing a write of a workbook and when changes are not allowed.
  304.      *
  305.      * @return string    Hash index
  306.      */
  307.     public function getHashIndex({
  308.         return $this->_hashIndex;
  309.     }
  310.     
  311.     /**
  312.      * Set hash index
  313.      * 
  314.      * Note that this index may vary during script execution! Only reliable moment is
  315.      * while doing a write of a workbook and when changes are not allowed.
  316.      *
  317.      * @param string    $value    Hash index
  318.      */
  319.     public function setHashIndex($value{
  320.         $this->_hashIndex = $value;
  321.     }
  322.         
  323.     /**
  324.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  325.      */
  326.     public function __clone({
  327.         $vars get_object_vars($this);
  328.         foreach ($vars as $key => $value{
  329.             if (is_object($value)) {
  330.                 $this->$key clone $value;
  331.             else {
  332.                 $this->$key $value;
  333.             }
  334.         }
  335.     }
  336. }

Documentation generated on Mon, 10 Aug 2009 08:07:47 +0200 by phpDocumentor 1.4.1