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

Source for file Comment.php

Documentation is available at Comment.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2010 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel
  23.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.3c, 2010-06-01
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Comment
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel
  34.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. class PHPExcel_Comment implements PHPExcel_IComparable
  37. {
  38.     /**
  39.      * Author
  40.      *
  41.      * @var string 
  42.      */
  43.     private $_author;
  44.  
  45.     /**
  46.      * Rich text comment
  47.      *
  48.      * @var PHPExcel_RichText 
  49.      */
  50.     private $_text;
  51.  
  52.     /**
  53.      * Comment width (CSS style, i.e. XXpx or YYpt)
  54.      *
  55.      * @var string 
  56.      */
  57.     private $_width '96pt';
  58.  
  59.     /**
  60.      * Left margin (CSS style, i.e. XXpx or YYpt)
  61.      *
  62.      * @var string 
  63.      */
  64.     private $_marginLeft '59.25pt';
  65.  
  66.     /**
  67.      * Top margin (CSS style, i.e. XXpx or YYpt)
  68.      *
  69.      * @var string 
  70.      */
  71.     private $_marginTop '1.5pt';
  72.  
  73.     /**
  74.      * Visible
  75.      *
  76.      * @var boolean 
  77.      */
  78.     private $_visible false;
  79.  
  80.     /**
  81.      * Comment height (CSS style, i.e. XXpx or YYpt)
  82.      *
  83.      * @var string 
  84.      */
  85.     private $_height '55.5pt';
  86.  
  87.     /**
  88.      * Comment fill color
  89.      *
  90.      * @var PHPExcel_Style_Color 
  91.      */
  92.     private $_fillColor;
  93.  
  94.     /**
  95.      * Create a new PHPExcel_Comment
  96.      *
  97.      * @throws    Exception
  98.      */
  99.     public function __construct()
  100.     {
  101.         // Initialise variables
  102.         $this->_author          'Author';
  103.         $this->_text          new PHPExcel_RichText();
  104.         $this->_fillColor     new PHPExcel_Style_Color('FFFFFFE1');
  105.     }
  106.  
  107.     /**
  108.      * Get Author
  109.      *
  110.      * @return string 
  111.      */
  112.     public function getAuthor({
  113.         return $this->_author;
  114.     }
  115.  
  116.     /**
  117.      * Set Author
  118.      *
  119.      * @param string $pValue 
  120.      * @return PHPExcel_Comment 
  121.      */
  122.     public function setAuthor($pValue ''{
  123.         $this->_author $pValue;
  124.         return $this;
  125.     }
  126.  
  127.     /**
  128.      * Get Rich text comment
  129.      *
  130.      * @return PHPExcel_RichText 
  131.      */
  132.     public function getText({
  133.         return $this->_text;
  134.     }
  135.  
  136.     /**
  137.      * Set Rich text comment
  138.      *
  139.      * @param PHPExcel_RichText $pValue 
  140.      * @return PHPExcel_Comment 
  141.      */
  142.     public function setText(PHPExcel_RichText $pValue{
  143.         $this->_text $pValue;
  144.         return $this;
  145.     }
  146.  
  147.     /**
  148.      * Get comment width (CSS style, i.e. XXpx or YYpt)
  149.      *
  150.      * @return string 
  151.      */
  152.     public function getWidth({
  153.         return $this->_width;
  154.     }
  155.  
  156.     /**
  157.      * Set comment width (CSS style, i.e. XXpx or YYpt)
  158.      *
  159.      * @param string $value 
  160.      * @return PHPExcel_Comment 
  161.      */
  162.     public function setWidth($value '96pt'{
  163.         $this->_width $value;
  164.         return $this;
  165.     }
  166.  
  167.     /**
  168.      * Get comment height (CSS style, i.e. XXpx or YYpt)
  169.      *
  170.      * @return string 
  171.      */
  172.     public function getHeight({
  173.         return $this->_height;
  174.     }
  175.  
  176.     /**
  177.      * Set comment height (CSS style, i.e. XXpx or YYpt)
  178.      *
  179.      * @param string $value 
  180.      * @return PHPExcel_Comment 
  181.      */
  182.     public function setHeight($value '55.5pt'{
  183.         $this->_height $value;
  184.         return $this;
  185.     }
  186.  
  187.     /**
  188.      * Get left margin (CSS style, i.e. XXpx or YYpt)
  189.      *
  190.      * @return string 
  191.      */
  192.     public function getMarginLeft({
  193.         return $this->_marginLeft;
  194.     }
  195.  
  196.     /**
  197.      * Set left margin (CSS style, i.e. XXpx or YYpt)
  198.      *
  199.      * @param string $value 
  200.      * @return PHPExcel_Comment 
  201.      */
  202.     public function setMarginLeft($value '59.25pt'{
  203.         $this->_marginLeft $value;
  204.         return $this;
  205.     }
  206.  
  207.     /**
  208.      * Get top margin (CSS style, i.e. XXpx or YYpt)
  209.      *
  210.      * @return string 
  211.      */
  212.     public function getMarginTop({
  213.         return $this->_marginTop;
  214.     }
  215.  
  216.     /**
  217.      * Set top margin (CSS style, i.e. XXpx or YYpt)
  218.      *
  219.      * @param string $value 
  220.      * @return PHPExcel_Comment 
  221.      */
  222.     public function setMarginTop($value '1.5pt'{
  223.         $this->_marginTop $value;
  224.         return $this;
  225.     }
  226.  
  227.     /**
  228.      * Is the comment visible by default?
  229.      *
  230.      * @return boolean 
  231.      */
  232.     public function getVisible({
  233.         return $this->_visible;
  234.     }
  235.  
  236.     /**
  237.      * Set comment default visibility
  238.      *
  239.      * @param boolean $value 
  240.      * @return PHPExcel_Comment 
  241.      */
  242.     public function setVisible($value false{
  243.         $this->_visible $value;
  244.         return $this;
  245.     }
  246.  
  247.     /**
  248.      * Get fill color
  249.      *
  250.      * @return PHPExcel_Style_Color 
  251.      */
  252.     public function getFillColor({
  253.         return $this->_fillColor;
  254.     }
  255.  
  256.     /**
  257.      * Get hash code
  258.      *
  259.      * @return string    Hash code
  260.      */
  261.     public function getHashCode({
  262.         return md5(
  263.               $this->_author
  264.             . $this->_text->getHashCode()
  265.             . $this->_width
  266.             . $this->_height
  267.             . $this->_marginLeft
  268.             . $this->_marginTop
  269.             . ($this->_visible 0)
  270.             . $this->_fillColor->getHashCode()
  271.             . __CLASS__
  272.         );
  273.     }
  274.  
  275.     /**
  276.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  277.      */
  278.     public function __clone({
  279.         $vars get_object_vars($this);
  280.         foreach ($vars as $key => $value{
  281.             if (is_object($value)) {
  282.                 $this->$key clone $value;
  283.             else {
  284.                 $this->$key $value;
  285.             }
  286.         }
  287.     }
  288. }

Documentation generated on Tue, 01 Jun 2010 17:02:35 +0200 by phpDocumentor 1.4.3