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

Source for file Hyperlink.php

Documentation is available at Hyperlink.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 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_Cell
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.0, 2009-08-10
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Cell_Hyperlink
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Cell
  34.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /**
  38.      * Cell representing the hyperlink
  39.      *
  40.      * @var PHPExcel_Cell 
  41.      */
  42.     private $_cell;
  43.     
  44.     /**
  45.      * URL to link the cell to
  46.      *
  47.      * @var string 
  48.      */
  49.     private $_url;
  50.     
  51.     /**
  52.      * Tooltip to display on the hyperlink
  53.      *
  54.      * @var string 
  55.      */
  56.     private $_tooltip;    
  57.     
  58.     /**
  59.      * Create a new PHPExcel_Cell_Hyperlink
  60.      *
  61.      * @param     PHPExcel_Cell        $pCell        Parent cell
  62.      * @param     string                $pUrl        Url to link the cell to
  63.      * @param    string                $pTooltip    Tooltip to display on the hyperlink
  64.      * @throws    Exception
  65.      */
  66.     public function __construct(PHPExcel_Cell $pCell null$pUrl ''$pTooltip '')
  67.     {
  68.         // Initialise member variables
  69.         $this->_url         = $pUrl;
  70.         $this->_tooltip     = $pTooltip;
  71.      
  72.         // Set cell
  73.         $this->_parent         $pCell;
  74.     }
  75.     
  76.     /**
  77.      * Get URL
  78.      *
  79.      * @return string 
  80.      */
  81.     public function getUrl({
  82.         return $this->_url;
  83.     }
  84.  
  85.     /**
  86.      * Set URL
  87.      *
  88.      * @param    string    $value 
  89.      * @return PHPExcel_Cell_Hyperlink 
  90.      */
  91.     public function setUrl($value ''{
  92.         $this->_url = $value;
  93.         return $this;
  94.     }
  95.     
  96.     /**
  97.      * Get tooltip
  98.      *
  99.      * @return string 
  100.      */
  101.     public function getTooltip({
  102.         return $this->_tooltip;
  103.     }
  104.  
  105.     /**
  106.      * Set tooltip
  107.      *
  108.      * @param    string    $value 
  109.      * @return PHPExcel_Cell_Hyperlink 
  110.      */
  111.     public function setTooltip($value ''{
  112.         $this->_tooltip = $value;
  113.         return $this;
  114.     }
  115.     
  116.     /**
  117.      * Is this hyperlink internal? (to another sheet)
  118.      *
  119.      * @return boolean 
  120.      */
  121.     public function isInternal({
  122.         return strpos($this->_url'sheet://'!== false;
  123.     }
  124.     
  125.     /**
  126.      * Get parent
  127.      *
  128.      * @return PHPExcel_Cell 
  129.      */
  130.     public function getParent({
  131.         return $this->_parent;
  132.     }
  133.     
  134.     /**
  135.      * Set Parent
  136.      *
  137.      * @param    PHPExcel_Cell    $value 
  138.      * @return PHPExcel_Cell_Hyperlink 
  139.      */
  140.     public function setParent($value null{
  141.         $this->_parent $value;
  142.         return $this;
  143.     }
  144.     
  145.     /**
  146.      * Get hash code
  147.      *
  148.      * @return string    Hash code
  149.      */    
  150.     public function getHashCode({
  151.         return md5(
  152.               $this->_url
  153.             . $this->_tooltip
  154.             . $this->_parent->getCoordinate()
  155.             . __CLASS__
  156.         );
  157.     }
  158. }

Documentation generated on Mon, 10 Aug 2009 08:06:04 +0200 by phpDocumentor 1.4.1