[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/Worksheet/Drawing/ -> Shadow.php (source)

   1  <?php
   2  
   3  /**
   4   * PHPExcel_Worksheet_Drawing_Shadow
   5   *
   6   * Copyright (c) 2006 - 2015 PHPExcel
   7   *
   8   * This library is free software; you can redistribute it and/or
   9   * modify it under the terms of the GNU Lesser General Public
  10   * License as published by the Free Software Foundation; either
  11   * version 2.1 of the License, or (at your option) any later version.
  12   *
  13   * This library is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16   * Lesser General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU Lesser General Public
  19   * License along with this library; if not, write to the Free Software
  20   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  21   *
  22   * @category   PHPExcel
  23   * @package    PHPExcel_Worksheet_Drawing
  24   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  25   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  26   * @version    ##VERSION##, ##DATE##
  27   */
  28  class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
  29  {
  30      /* Shadow alignment */
  31      const SHADOW_BOTTOM       = 'b';
  32      const SHADOW_BOTTOM_LEFT  = 'bl';
  33      const SHADOW_BOTTOM_RIGHT = 'br';
  34      const SHADOW_CENTER       = 'ctr';
  35      const SHADOW_LEFT         = 'l';
  36      const SHADOW_TOP          = 't';
  37      const SHADOW_TOP_LEFT     = 'tl';
  38      const SHADOW_TOP_RIGHT    = 'tr';
  39  
  40      /**
  41       * Visible
  42       *
  43       * @var boolean
  44       */
  45      private $visible;
  46  
  47      /**
  48       * Blur radius
  49       *
  50       * Defaults to 6
  51       *
  52       * @var int
  53       */
  54      private $blurRadius;
  55  
  56      /**
  57       * Shadow distance
  58       *
  59       * Defaults to 2
  60       *
  61       * @var int
  62       */
  63      private $distance;
  64  
  65      /**
  66       * Shadow direction (in degrees)
  67       *
  68       * @var int
  69       */
  70      private $direction;
  71  
  72      /**
  73       * Shadow alignment
  74       *
  75       * @var int
  76       */
  77      private $alignment;
  78  
  79      /**
  80       * Color
  81       *
  82       * @var PHPExcel_Style_Color
  83       */
  84      private $color;
  85  
  86      /**
  87       * Alpha
  88       *
  89       * @var int
  90       */
  91      private $alpha;
  92  
  93      /**
  94       * Create a new PHPExcel_Worksheet_Drawing_Shadow
  95       */
  96      public function __construct()
  97      {
  98          // Initialise values
  99          $this->visible     = false;
 100          $this->blurRadius  = 6;
 101          $this->distance    = 2;
 102          $this->direction   = 0;
 103          $this->alignment   = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
 104          $this->color       = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
 105          $this->alpha       = 50;
 106      }
 107  
 108      /**
 109       * Get Visible
 110       *
 111       * @return boolean
 112       */
 113      public function getVisible()
 114      {
 115          return $this->visible;
 116      }
 117  
 118      /**
 119       * Set Visible
 120       *
 121       * @param boolean $pValue
 122       * @return PHPExcel_Worksheet_Drawing_Shadow
 123       */
 124      public function setVisible($pValue = false)
 125      {
 126          $this->visible = $pValue;
 127          return $this;
 128      }
 129  
 130      /**
 131       * Get Blur radius
 132       *
 133       * @return int
 134       */
 135      public function getBlurRadius()
 136      {
 137          return $this->blurRadius;
 138      }
 139  
 140      /**
 141       * Set Blur radius
 142       *
 143       * @param int $pValue
 144       * @return PHPExcel_Worksheet_Drawing_Shadow
 145       */
 146      public function setBlurRadius($pValue = 6)
 147      {
 148          $this->blurRadius = $pValue;
 149          return $this;
 150      }
 151  
 152      /**
 153       * Get Shadow distance
 154       *
 155       * @return int
 156       */
 157      public function getDistance()
 158      {
 159          return $this->distance;
 160      }
 161  
 162      /**
 163       * Set Shadow distance
 164       *
 165       * @param int $pValue
 166       * @return PHPExcel_Worksheet_Drawing_Shadow
 167       */
 168      public function setDistance($pValue = 2)
 169      {
 170          $this->distance = $pValue;
 171          return $this;
 172      }
 173  
 174      /**
 175       * Get Shadow direction (in degrees)
 176       *
 177       * @return int
 178       */
 179      public function getDirection()
 180      {
 181          return $this->direction;
 182      }
 183  
 184      /**
 185       * Set Shadow direction (in degrees)
 186       *
 187       * @param int $pValue
 188       * @return PHPExcel_Worksheet_Drawing_Shadow
 189       */
 190      public function setDirection($pValue = 0)
 191      {
 192          $this->direction = $pValue;
 193          return $this;
 194      }
 195  
 196     /**
 197       * Get Shadow alignment
 198       *
 199       * @return int
 200       */
 201      public function getAlignment()
 202      {
 203          return $this->alignment;
 204      }
 205  
 206      /**
 207       * Set Shadow alignment
 208       *
 209       * @param int $pValue
 210       * @return PHPExcel_Worksheet_Drawing_Shadow
 211       */
 212      public function setAlignment($pValue = 0)
 213      {
 214          $this->alignment = $pValue;
 215          return $this;
 216      }
 217  
 218     /**
 219       * Get Color
 220       *
 221       * @return PHPExcel_Style_Color
 222       */
 223      public function getColor()
 224      {
 225          return $this->color;
 226      }
 227  
 228      /**
 229       * Set Color
 230       *
 231       * @param     PHPExcel_Style_Color $pValue
 232       * @throws     PHPExcel_Exception
 233       * @return PHPExcel_Worksheet_Drawing_Shadow
 234       */
 235      public function setColor(PHPExcel_Style_Color $pValue = null)
 236      {
 237             $this->color = $pValue;
 238             return $this;
 239      }
 240  
 241     /**
 242       * Get Alpha
 243       *
 244       * @return int
 245       */
 246      public function getAlpha()
 247      {
 248          return $this->alpha;
 249      }
 250  
 251      /**
 252       * Set Alpha
 253       *
 254       * @param int $pValue
 255       * @return PHPExcel_Worksheet_Drawing_Shadow
 256       */
 257      public function setAlpha($pValue = 0)
 258      {
 259          $this->alpha = $pValue;
 260          return $this;
 261      }
 262  
 263      /**
 264       * Get hash code
 265       *
 266       * @return string    Hash code
 267       */
 268      public function getHashCode()
 269      {
 270          return md5(
 271              ($this->visible ? 't' : 'f') .
 272              $this->blurRadius .
 273              $this->distance .
 274              $this->direction .
 275              $this->alignment .
 276              $this->color->getHashCode() .
 277              $this->alpha .
 278              __CLASS__
 279          );
 280      }
 281  
 282      /**
 283       * Implement PHP __clone to create a deep clone, not just a shallow copy.
 284       */
 285      public function __clone()
 286      {
 287          $vars = get_object_vars($this);
 288          foreach ($vars as $key => $value) {
 289              if (is_object($value)) {
 290                  $this->$key = clone $value;
 291              } else {
 292                  $this->$key = $value;
 293              }
 294          }
 295      }
 296  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1