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

Source for file Color.php

Documentation is available at Color.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_Style
  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.  
  33. /**
  34.  * PHPPowerPoint_Style_Color
  35.  *
  36.  * @category   PHPPowerPoint
  37.  * @package    PHPPowerPoint_Style
  38.  * @copyright  Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
  39.  */
  40. class PHPPowerPoint_Style_Color implements PHPPowerPoint_IComparable
  41. {
  42.     /* Colors */
  43.     const COLOR_BLACK                        'FF000000';
  44.     const COLOR_WHITE                        'FFFFFFFF';
  45.     const COLOR_RED                            'FFFF0000';
  46.     const COLOR_DARKRED                        'FF800000';
  47.     const COLOR_BLUE                        'FF0000FF';
  48.     const COLOR_DARKBLUE                    'FF000080';
  49.     const COLOR_GREEN                        'FF00FF00';
  50.     const COLOR_DARKGREEN                    'FF008000';
  51.     const COLOR_YELLOW                        'FFFFFF00';
  52.     const COLOR_DARKYELLOW                    'FF808000';
  53.     
  54.     /**
  55.      * ARGB - Alpha RGB
  56.      *
  57.      * @var string 
  58.      */
  59.     private $_argb;
  60.         
  61.     /**
  62.      * Create a new PHPPowerPoint_Style_Color
  63.      * 
  64.      * @param string $pARGB 
  65.      */
  66.     public function __construct($pARGB PHPPowerPoint_Style_Color::COLOR_BLACK)
  67.     {
  68.         // Initialise values
  69.         $this->_argb            = $pARGB;
  70.     }
  71.     
  72.     /**
  73.      * Get ARGB
  74.      *
  75.      * @return string 
  76.      */
  77.     public function getARGB({
  78.         return $this->_argb;
  79.     }
  80.     
  81.     /**
  82.      * Set ARGB
  83.      *
  84.      * @param string $pValue 
  85.      */
  86.     public function setARGB($pValue PHPPowerPoint_Style_Color::COLOR_BLACK{
  87.         if ($pValue == ''{
  88.             $pValue PHPPowerPoint_Style_Color::COLOR_BLACK;
  89.         }
  90.         $this->_argb = $pValue;
  91.     }
  92.     
  93.     /**
  94.      * Get RGB
  95.      *
  96.      * @return string 
  97.      */
  98.     public function getRGB({
  99.         return substr($this->_argb2);
  100.     }
  101.     
  102.     /**
  103.      * Set RGB
  104.      *
  105.      * @param string $pValue 
  106.      */
  107.     public function setRGB($pValue '000000'{
  108.         if ($pValue == ''{
  109.             $pValue '000000';
  110.         }
  111.         $this->_argb = 'FF' $pValue;
  112.     }
  113.  
  114.     /**
  115.      * Get hash code
  116.      *
  117.      * @return string    Hash code
  118.      */    
  119.     public function getHashCode({
  120.         return md5(
  121.               $this->_argb
  122.             . __CLASS__
  123.         );
  124.     }
  125.     
  126.     /**
  127.      * Hash index
  128.      *
  129.      * @var string 
  130.      */
  131.     private $_hashIndex;
  132.     
  133.     /**
  134.      * Get hash index
  135.      * 
  136.      * Note that this index may vary during script execution! Only reliable moment is
  137.      * while doing a write of a workbook and when changes are not allowed.
  138.      *
  139.      * @return string    Hash index
  140.      */
  141.     public function getHashIndex({
  142.         return $this->_hashIndex;
  143.     }
  144.     
  145.     /**
  146.      * Set hash index
  147.      * 
  148.      * Note that this index may vary during script execution! Only reliable moment is
  149.      * while doing a write of a workbook and when changes are not allowed.
  150.      *
  151.      * @param string    $value    Hash index
  152.      */
  153.     public function setHashIndex($value{
  154.         $this->_hashIndex = $value;
  155.     }
  156.         
  157.     /**
  158.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  159.      */
  160.     public function __clone({
  161.         $vars get_object_vars($this);
  162.         foreach ($vars as $key => $value{
  163.             if (is_object($value)) {
  164.                 $this->$key clone $value;
  165.             else {
  166.                 $this->$key $value;
  167.             }
  168.         }
  169.     }
  170. }

Documentation generated on Sat, 25 Apr 2009 11:36:50 +0200 by phpDocumentor 1.4.1