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

Source for file TextElement.php

Documentation is available at TextElement.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 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  22.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  23.  * @version    1.7.2, 2010-01-11
  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_Style_Font */
  39. require_once PHPEXCEL_ROOT 'PHPExcel/Style/Font.php';
  40.  
  41.  
  42. /**
  43.  * PHPExcel_RichText_TextElement
  44.  *
  45.  * @category   PHPExcel
  46.  * @package    PHPExcel_RichText
  47.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  48.  */
  49. class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
  50. {
  51.     /**
  52.      * Text
  53.      *
  54.      * @var string 
  55.      */
  56.     private $_text;
  57.     
  58.     /**
  59.      * Create a new PHPExcel_RichText_TextElement instance
  60.      *
  61.      * @param     string        $pText        Text
  62.      */
  63.     public function __construct($pText '')
  64.     {
  65.         // Initialise variables
  66.         $this->_text = $pText;
  67.     }
  68.     
  69.     /**
  70.      * Get text
  71.      *
  72.      * @return string    Text
  73.      */    
  74.     public function getText({
  75.         return $this->_text;
  76.     }
  77.     
  78.     /**
  79.      * Set text
  80.      *
  81.      * @param     $pText string    Text
  82.      * @return PHPExcel_RichText_ITextElement 
  83.      */    
  84.     public function setText($pText ''{
  85.         $this->_text = $pText;
  86.         return $this;
  87.     }
  88.     
  89.     /**
  90.      * Get font
  91.      *
  92.      * @return PHPExcel_Style_Font 
  93.      */    
  94.     public function getFont({
  95.         return null;
  96.     }
  97.     
  98.     /**
  99.      * Get hash code
  100.      *
  101.      * @return string    Hash code
  102.      */    
  103.     public function getHashCode({
  104.         return md5(
  105.               $this->_text
  106.             . __CLASS__
  107.         );
  108.     }
  109.         
  110.     /**
  111.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  112.      */
  113.     public function __clone({
  114.         $vars get_object_vars($this);
  115.         foreach ($vars as $key => $value{
  116.             if (is_object($value)) {
  117.                 $this->$key clone $value;
  118.             else {
  119.                 $this->$key $value;
  120.             }
  121.         }
  122.     }
  123. }

Documentation generated on Mon, 11 Jan 2010 08:15:53 +0100 by phpDocumentor 1.4.1