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

Source for file Conditional.php

Documentation is available at Conditional.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_Style
  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_Style */
  30. require_once 'PHPExcel/Style.php';
  31.  
  32. /** PHPExcel_IComparable */
  33. require_once 'PHPExcel/IComparable.php';
  34.  
  35.  
  36. /**
  37.  * PHPExcel_Style_Conditional
  38.  *
  39.  * @category   PHPExcel
  40.  * @package    PHPExcel_Style
  41.  * @copyright  Copyright (c) 2006 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  42.  */
  43. class PHPExcel_Style_Conditional implements PHPExcel_IComparable
  44. {
  45.     /* Condition types */
  46.     const CONDITION_NONE                    'none';
  47.     const CONDITION_CELLIS                    'cellIs';
  48.     const CONDITION_CONTAINSTEXT            'containsText';
  49.     const CONDITION_EXPRESSION                 'expression';
  50.     
  51.     /* Operator types */
  52.     const OPERATOR_NONE                        '';
  53.     const OPERATOR_BEGINSWITH                'beginsWith';
  54.     const OPERATOR_ENDSWITH                    'endsWith';
  55.     const OPERATOR_EQUAL                    'equal';
  56.     const OPERATOR_GREATERTHAN                'greaterThan';
  57.     const OPERATOR_GREATERTHANOREQUAL        'greaterThanOrEqual';
  58.     const OPERATOR_LESSTHAN                    'lessThan';
  59.     const OPERATOR_LESSTHANOREQUAL            'lessThanOrEqual';
  60.     const OPERATOR_NOTEQUAL                    'notEqual';
  61.     const OPERATOR_CONTAINSTEXT                'containsText';
  62.     const OPERATOR_NOTCONTAINS                'notContains';
  63.     
  64.     /**
  65.      * Condition type
  66.      *
  67.      * @var int 
  68.      */
  69.     private $_conditionType;
  70.     
  71.     /**
  72.      * Operator type
  73.      *
  74.      * @var int 
  75.      */
  76.     private $_operatorType;
  77.     
  78.     /**
  79.      * Condition
  80.      *
  81.      * @var string 
  82.      */
  83.     private $_condition;
  84.     
  85.     /**
  86.      * Style
  87.      * 
  88.      * @var PHPExcel_Style 
  89.      */
  90.     private $_style;
  91.         
  92.     /**
  93.      * Create a new PHPExcel_Style_Conditional
  94.      */
  95.     public function __construct()
  96.     {
  97.         // Initialise values
  98.         $this->_conditionType        = PHPExcel_Style_Conditional::CONDITION_NONE;
  99.         $this->_operatorType        = PHPExcel_Style_Conditional::OPERATOR_NONE;
  100.         $this->_condition            = '';
  101.         $this->_style                = new PHPExcel_Style();
  102.     }
  103.     
  104.     /**
  105.      * Get Condition type
  106.      *
  107.      * @return string 
  108.      */
  109.     public function getConditionType({
  110.         return $this->_conditionType;
  111.     }
  112.     
  113.     /**
  114.      * Set Condition type
  115.      *
  116.      * @param string $pValue    PHPExcel_Style_Conditional condition type
  117.      */
  118.     public function setConditionType($pValue PHPExcel_Style_Conditional::CONDITION_NONE{
  119.         $this->_conditionType = $pValue;
  120.     }
  121.     
  122.     /**
  123.      * Get Operator type
  124.      *
  125.      * @return string 
  126.      */
  127.     public function getOperatorType({
  128.         return $this->_operatorType;
  129.     }
  130.     
  131.     /**
  132.      * Set Operator type
  133.      *
  134.      * @param string $pValue    PHPExcel_Style_Conditional operator type
  135.      */
  136.     public function setOperatorType($pValue PHPExcel_Style_Conditional::OPERATOR_NONE{
  137.         $this->_operatorType = $pValue;
  138.     }
  139.     
  140.     /**
  141.      * Get Condition
  142.      *
  143.      * @return string 
  144.      */
  145.     public function getCondition({
  146.         return $this->_condition;
  147.     }
  148.     
  149.     /**
  150.      * Set Condition
  151.      *
  152.      * @param string $pValue    Condition
  153.      */
  154.     public function setCondition($pValue ''{
  155.         $this->_condition = $pValue;
  156.     }
  157.     
  158.     /**
  159.      * Get Style
  160.      *
  161.      * @return PHPExcel_Style 
  162.      */
  163.     public function getStyle({
  164.         return $this->_style;
  165.     }
  166.     
  167.     /**
  168.      * Set Style
  169.      *
  170.      * @param     PHPExcel_Style $pValue 
  171.      * @throws     Exception
  172.      */
  173.     public function setStyle(PHPExcel_Style $pValue null{
  174.            $this->_style = $pValue;
  175.     }
  176.  
  177.     /**
  178.      * Get hash code
  179.      *
  180.      * @return string    Hash code
  181.      */    
  182.     public function getHashCode({
  183.         return md5(
  184.               $this->_conditionType
  185.             . $this->_operatorType
  186.             . $this->_condition
  187.             . $this->_style->getHashCode()
  188.             . __CLASS__
  189.         );
  190.     }
  191.         
  192.     /**
  193.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  194.      */
  195.     public function __clone({
  196.         $vars get_object_vars($this);
  197.         foreach ($vars as $key => $value{
  198.             if (is_object($value)) {
  199.                 $this->$key clone $value;
  200.             else {
  201.                 $this->$key $value;
  202.             }
  203.         }
  204.     }
  205. }

Documentation generated on Mon, 27 Oct 2008 08:37:52 +0100 by phpDocumentor 1.4.1