~ubuntu-branches/ubuntu/lucid/phpmyadmin/lucid

« back to all changes in this revision

Viewing changes to libraries/PHPExcel/PHPExcel/RichText/Run.php

  • Committer: Bazaar Package Importer
  • Author(s): Michal Čihař
  • Date: 2010-03-08 15:25:00 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100308152500-6e8hmuqc5co39de5
Tags: 4:3.3.0-1
* New upstream version.
* Rediff debian/patches.
* Fix permissions on mediawiki export extension.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
 
53
{       
 
54
        /**
 
55
         * Font
 
56
         *
 
57
         * @var PHPExcel_Style_Font
 
58
         */
 
59
        private $_font;
 
60
        
 
61
    /**
 
62
     * Create a new PHPExcel_RichText_Run instance
 
63
     *
 
64
     * @param   string          $pText          Text
 
65
     */
 
66
    public function __construct($pText = '')
 
67
    {
 
68
        // Initialise variables
 
69
        $this->setText($pText);
 
70
        $this->_font = new PHPExcel_Style_Font();
 
71
    }
 
72
        
 
73
        /**
 
74
         * Get font
 
75
         *
 
76
         * @return PHPExcel_Style_Font
 
77
         */     
 
78
        public function getFont() {
 
79
                return $this->_font;
 
80
        }
 
81
        
 
82
        /**
 
83
         * Set font
 
84
         *
 
85
         * @param       PHPExcel_Style_Font             $pFont          Font
 
86
         * @throws      Exception
 
87
         * @return PHPExcel_RichText_ITextElement
 
88
         */     
 
89
        public function setFont(PHPExcel_Style_Font $pFont = null) {
 
90
                $this->_font = $pFont;
 
91
                return $this;
 
92
        }
 
93
        
 
94
        /**
 
95
         * Get hash code
 
96
         *
 
97
         * @return string       Hash code
 
98
         */     
 
99
        public function getHashCode() {
 
100
        return md5(
 
101
                  $this->getText()
 
102
                . $this->_font->getHashCode()
 
103
                . __CLASS__
 
104
        );
 
105
    }
 
106
            
 
107
        /**
 
108
         * Implement PHP __clone to create a deep clone, not just a shallow copy.
 
109
         */
 
110
        public function __clone() {
 
111
                $vars = get_object_vars($this);
 
112
                foreach ($vars as $key => $value) {
 
113
                        if (is_object($value)) {
 
114
                                $this->$key = clone $value;
 
115
                        } else {
 
116
                                $this->$key = $value;
 
117
                        }
 
118
                }
 
119
        }
 
120
}