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 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  22.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  23.  * @version    1.7.0, 2009-08-10
  24.  */
  25.  
  26.  
  27. /** PHPExcel root directory */
  28. if (!defined('PHPEXCEL_ROOT')) {
  29.     /**
  30.      * @ignore
  31.      */
  32.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../../');
  33. }
  34.  
  35. /** PHPExcel_RichText_ITextElement */
  36. require_once PHPEXCEL_ROOT 'PHPExcel/RichText/ITextElement.php';
  37.  
  38. /** PHPExcel_RichText_TextElement */
  39. require_once PHPEXCEL_ROOT 'PHPExcel/RichText/TextElement.php';
  40.  
  41. /** PHPExcel_Style_Font */
  42. require_once PHPEXCEL_ROOT 'PHPExcel/Style/Font.php';
  43.  
  44.  
  45. /**
  46.  * PHPExcel_RichText_Run
  47.  *
  48.  * @category   PHPExcel
  49.  * @package    PHPExcel_RichText
  50.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  51.  */
  52. {    
  53.     /**
  54.      * Font
  55.      *
  56.      * @var PHPExcel_Style_Font 
  57.      */
  58.     private $_font;
  59.     
  60.     /**
  61.      * Create a new PHPExcel_RichText_Run instance
  62.      *
  63.      * @param     string        $pText        Text
  64.      */
  65.     public function __construct($pText '')
  66.     {
  67.         // Initialise variables
  68.         $this->setText($pText);
  69.         $this->_font = new PHPExcel_Style_Font();
  70.     }
  71.     
  72.     /**
  73.      * Get font
  74.      *
  75.      * @return PHPExcel_Style_Font 
  76.      */    
  77.     public function getFont({
  78.         return $this->_font;
  79.     }
  80.     
  81.     /**
  82.      * Set font
  83.      *
  84.      * @param    PHPExcel_Style_Font        $pFont        Font
  85.      * @throws     Exception
  86.      * @return PHPExcel_RichText_ITextElement 
  87.      */    
  88.     public function setFont(PHPExcel_Style_Font $pFont null{
  89.         $this->_font = $pFont;
  90.         return $this;
  91.     }
  92.     
  93.     /**
  94.      * Get hash code
  95.      *
  96.      * @return string    Hash code
  97.      */    
  98.     public function getHashCode({
  99.         return md5(
  100.               $this->getText()
  101.             . $this->_font->getHashCode()
  102.             . __CLASS__
  103.         );
  104.     }
  105.         
  106.     /**
  107.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  108.      */
  109.     public function __clone({
  110.         $vars get_object_vars($this);
  111.         foreach ($vars as $key => $value{
  112.             if (is_object($value)) {
  113.                 $this->$key clone $value;
  114.             else {
  115.                 $this->$key $value;
  116.             }
  117.         }
  118.     }
  119. }

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