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

Source for file Run.php

Documentation is available at Run.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Lesser General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2.1 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Lesser General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Lesser General Public
  16.  * License along with this library; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  18.  *
  19.  * @category   PHPExcel
  20.  * @package    PHPExcel_RichText
  21.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  22.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  23.  * @version    1.7.6, 2011-02-27
  24.  */
  25.  
  26.  
  27. /**
  28.  * PHPExcel_RichText_Run
  29.  *
  30.  * @category   PHPExcel
  31.  * @package    PHPExcel_RichText
  32.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  33.  */
  34. {
  35.     /**
  36.      * Font
  37.      *
  38.      * @var PHPExcel_Style_Font 
  39.      */
  40.     private $_font;
  41.  
  42.     /**
  43.      * Create a new PHPExcel_RichText_Run instance
  44.      *
  45.      * @param     string        $pText        Text
  46.      */
  47.     public function __construct($pText '')
  48.     {
  49.         // Initialise variables
  50.         $this->setText($pText);
  51.         $this->_font new PHPExcel_Style_Font();
  52.     }
  53.  
  54.     /**
  55.      * Get font
  56.      *
  57.      * @return PHPExcel_Style_Font 
  58.      */
  59.     public function getFont({
  60.         return $this->_font;
  61.     }
  62.  
  63.     /**
  64.      * Set font
  65.      *
  66.      * @param    PHPExcel_Style_Font        $pFont        Font
  67.      * @throws     Exception
  68.      * @return PHPExcel_RichText_ITextElement 
  69.      */
  70.     public function setFont(PHPExcel_Style_Font $pFont null{
  71.         $this->_font $pFont;
  72.         return $this;
  73.     }
  74.  
  75.     /**
  76.      * Get hash code
  77.      *
  78.      * @return string    Hash code
  79.      */
  80.     public function getHashCode({
  81.         return md5(
  82.               $this->getText()
  83.             . $this->_font->getHashCode()
  84.             . __CLASS__
  85.         );
  86.     }
  87.  
  88.     /**
  89.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  90.      */
  91.     public function __clone({
  92.         $vars get_object_vars($this);
  93.         foreach ($vars as $key => $value{
  94.             if (is_object($value)) {
  95.                 $this->$key clone $value;
  96.             else {
  97.                 $this->$key $value;
  98.             }
  99.         }
  100.     }
  101. }

Documentation generated on Sun, 27 Feb 2011 16:33:48 -0800 by phpDocumentor 1.4.3