Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2388 jpm 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
22
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
23
 * @version    ##VERSION##, ##DATE##
24
 */
25
 
26
 
27
/**
28
 * PHPExcel_RichText_Run
29
 *
30
 * @category   PHPExcel
31
 * @package    PHPExcel_RichText
32
 * @copyright  Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
33
 */
34
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
35
{
36
	/**
37
	 * Font
38
	 *
39
	 * @var PHPExcel_Style_Font
40
	 */
41
	private $_font;
42
 
43
    /**
44
     * Create a new PHPExcel_RichText_Run instance
45
     *
46
     * @param 	string		$pText		Text
47
     */
48
    public function __construct($pText = '')
49
    {
50
    	// Initialise variables
51
    	$this->setText($pText);
52
    	$this->_font = new PHPExcel_Style_Font();
53
    }
54
 
55
	/**
56
	 * Get font
57
	 *
58
	 * @return PHPExcel_Style_Font
59
	 */
60
	public function getFont() {
61
		return $this->_font;
62
	}
63
 
64
	/**
65
	 * Set font
66
	 *
67
	 * @param	PHPExcel_Style_Font		$pFont		Font
68
	 * @throws 	PHPExcel_Exception
69
	 * @return PHPExcel_RichText_ITextElement
70
	 */
71
	public function setFont(PHPExcel_Style_Font $pFont = null) {
72
		$this->_font = $pFont;
73
		return $this;
74
	}
75
 
76
	/**
77
	 * Get hash code
78
	 *
79
	 * @return string	Hash code
80
	 */
81
	public function getHashCode() {
82
    	return md5(
83
    		  $this->getText()
84
    		. $this->_font->getHashCode()
85
    		. __CLASS__
86
    	);
87
    }
88
 
89
	/**
90
	 * Implement PHP __clone to create a deep clone, not just a shallow copy.
91
	 */
92
	public function __clone() {
93
		$vars = get_object_vars($this);
94
		foreach ($vars as $key => $value) {
95
			if (is_object($value)) {
96
				$this->$key = clone $value;
97
			} else {
98
				$this->$key = $value;
99
			}
100
		}
101
	}
102
}