Source for file Protection.php
Documentation is available at Protection.php
* Copyright (c) 2006 - 2011 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.4.5, 2007-08-23
* PHPExcel_Style_Protection
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
const PROTECTION_INHERIT = 'inherit';
const PROTECTION_PROTECTED = 'protected';
const PROTECTION_UNPROTECTED = 'unprotected';
* @var _parentPropertyName string
private $_parentPropertyName;
* Parent. Only used for supervisor
* Create a new PHPExcel_Style_Protection
$this->_isSupervisor = $isSupervisor;
$this->_locked = self::PROTECTION_INHERIT;
$this->_hidden = self::PROTECTION_INHERIT;
* Bind parent. Only used for supervisor
* @param PHPExcel_Style $parent
* @return PHPExcel_Style_Protection
$this->_parent = $parent;
* Is this a supervisor or a real style component?
return $this->_isSupervisor;
* Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor
* @return PHPExcel_Style_Protection
* Get the currently active sheet. Only used for supervisor
* @return PHPExcel_Worksheet
* Get the currently active cell coordinate in currently active sheet.
* Only used for supervisor
* @return string E.g. 'A1'
* Get the currently active cell coordinate in currently active sheet.
* Only used for supervisor
* @return string E.g. 'A1'
* Build style array from subcomponents
return array('protection' => $array);
* Apply styles from array
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) );
* @param array $pStyles Array containing style information
* @return PHPExcel_Style_Protection
if ($this->_isSupervisor) {
throw new Exception("Invalid style array passed.");
if ($this->_isSupervisor) {
* @return PHPExcel_Style_Protection
public function setLocked($pValue = self::PROTECTION_INHERIT) {
if ($this->_isSupervisor) {
$this->_locked = $pValue;
if ($this->_isSupervisor) {
* @return PHPExcel_Style_Protection
public function setHidden($pValue = self::PROTECTION_INHERIT) {
if ($this->_isSupervisor) {
$this->_hidden = $pValue;
* @return string Hash code
if ($this->_isSupervisor) {
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$this->$key = clone $value;
|