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

Source for file DocumentSecurity.php

Documentation is available at DocumentSecurity.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2011 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 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.6, 2011-02-27
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_DocumentSecurity
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel
  34.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /**
  38.      * LockRevision
  39.      *
  40.      * @var boolean 
  41.      */
  42.     private $_lockRevision;
  43.  
  44.     /**
  45.      * LockStructure
  46.      *
  47.      * @var boolean 
  48.      */
  49.     private $_lockStructure;
  50.  
  51.     /**
  52.      * LockWindows
  53.      *
  54.      * @var boolean 
  55.      */
  56.     private $_lockWindows;
  57.  
  58.     /**
  59.      * RevisionsPassword
  60.      *
  61.      * @var string 
  62.      */
  63.     private $_revisionsPassword;
  64.  
  65.     /**
  66.      * WorkbookPassword
  67.      *
  68.      * @var string 
  69.      */
  70.     private $_workbookPassword;
  71.  
  72.     /**
  73.      * Create a new PHPExcel_DocumentSecurity
  74.      */
  75.     public function __construct()
  76.     {
  77.         // Initialise values
  78.         $this->_lockRevision        false;
  79.         $this->_lockStructure        false;
  80.         $this->_lockWindows            false;
  81.         $this->_revisionsPassword    '';
  82.         $this->_workbookPassword    '';
  83.     }
  84.  
  85.     /**
  86.      * Is some sort of dcument security enabled?
  87.      *
  88.      * @return boolean 
  89.      */
  90.     function isSecurityEnabled({
  91.         return     $this->_lockRevision ||
  92.                 $this->_lockStructure ||
  93.                 $this->_lockWindows;
  94.     }
  95.  
  96.     /**
  97.      * Get LockRevision
  98.      *
  99.      * @return boolean 
  100.      */
  101.     function getLockRevision({
  102.         return $this->_lockRevision;
  103.     }
  104.  
  105.     /**
  106.      * Set LockRevision
  107.      *
  108.      * @param boolean $pValue 
  109.      * @return PHPExcel_DocumentSecurity 
  110.      */
  111.     function setLockRevision($pValue false{
  112.         $this->_lockRevision $pValue;
  113.         return $this;
  114.     }
  115.  
  116.     /**
  117.      * Get LockStructure
  118.      *
  119.      * @return boolean 
  120.      */
  121.     function getLockStructure({
  122.         return $this->_lockStructure;
  123.     }
  124.  
  125.     /**
  126.      * Set LockStructure
  127.      *
  128.      * @param boolean $pValue 
  129.      * @return PHPExcel_DocumentSecurity 
  130.      */
  131.     function setLockStructure($pValue false{
  132.         $this->_lockStructure $pValue;
  133.         return $this;
  134.     }
  135.  
  136.     /**
  137.      * Get LockWindows
  138.      *
  139.      * @return boolean 
  140.      */
  141.     function getLockWindows({
  142.         return $this->_lockWindows;
  143.     }
  144.  
  145.     /**
  146.      * Set LockWindows
  147.      *
  148.      * @param boolean $pValue 
  149.      * @return PHPExcel_DocumentSecurity 
  150.      */
  151.     function setLockWindows($pValue false{
  152.         $this->_lockWindows $pValue;
  153.         return $this;
  154.     }
  155.  
  156.     /**
  157.      * Get RevisionsPassword (hashed)
  158.      *
  159.      * @return string 
  160.      */
  161.     function getRevisionsPassword({
  162.         return $this->_revisionsPassword;
  163.     }
  164.  
  165.     /**
  166.      * Set RevisionsPassword
  167.      *
  168.      * @param string     $pValue 
  169.      * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
  170.      * @return PHPExcel_DocumentSecurity 
  171.      */
  172.     function setRevisionsPassword($pValue ''$pAlreadyHashed false{
  173.         if (!$pAlreadyHashed{
  174.             $pValue PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
  175.         }
  176.         $this->_revisionsPassword $pValue;
  177.         return $this;
  178.     }
  179.  
  180.     /**
  181.      * Get WorkbookPassword (hashed)
  182.      *
  183.      * @return string 
  184.      */
  185.     function getWorkbookPassword({
  186.         return $this->_workbookPassword;
  187.     }
  188.  
  189.     /**
  190.      * Set WorkbookPassword
  191.      *
  192.      * @param string     $pValue 
  193.      * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
  194.      * @return PHPExcel_DocumentSecurity 
  195.      */
  196.     function setWorkbookPassword($pValue ''$pAlreadyHashed false{
  197.         if (!$pAlreadyHashed{
  198.             $pValue PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
  199.         }
  200.         $this->_workbookPassword $pValue;
  201.         return $this;
  202.     }
  203.  
  204.     /**
  205.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  206.      */
  207.     public function __clone({
  208.         $vars get_object_vars($this);
  209.         foreach ($vars as $key => $value{
  210.             if (is_object($value)) {
  211.                 $this->$key clone $value;
  212.             else {
  213.                 $this->$key $value;
  214.             }
  215.         }
  216.     }
  217. }

Documentation generated on Sun, 27 Feb 2011 16:30:14 -0800 by phpDocumentor 1.4.3