ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Style_Protection Class Reference
+ Inheritance diagram for PHPExcel_Style_Protection:
+ Collaboration diagram for PHPExcel_Style_Protection:

Public Member Functions

 __construct ($isSupervisor=false)
 Create a new PHPExcel_Style_Protection.
 bindParent ($parent)
 Bind parent.
 getIsSupervisor ()
 Is this a supervisor or a real style component?
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet.
 getActiveSheet ()
 Get the currently active sheet.
 getXSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 getXActiveCell ()
 Get the currently active cell coordinate in currently active sheet.
 getStyleArray ($array)
 Build style array from subcomponents.
 applyFromArray ($pStyles=null)
 Apply styles from array.
 getLocked ()
 Get locked.
 setLocked ($pValue=self::PROTECTION_INHERIT)
 Set locked.
 getHidden ()
 Get hidden.
 setHidden ($pValue=self::PROTECTION_INHERIT)
 Set hidden.
 getHashCode ()
 Get hash code.
 getHashIndex ()
 Get hash index.
 setHashIndex ($value)
 Set hash index.
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.

Data Fields

const PROTECTION_INHERIT = 'inherit'
 Protection styles.
const PROTECTION_PROTECTED = 'protected'
const PROTECTION_UNPROTECTED = 'unprotected'

Private Attributes

 $_locked
 $_hidden
 $_parentPropertyName
 $_isSupervisor
 $_parent
 $_hashIndex

Detailed Description

Definition at line 48 of file Protection.php.

Constructor & Destructor Documentation

PHPExcel_Style_Protection::__construct (   $isSupervisor = false)

Create a new PHPExcel_Style_Protection.

Definition at line 93 of file Protection.php.

References PROTECTION_INHERIT.

{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_locked = self::PROTECTION_INHERIT;
$this->_hidden = self::PROTECTION_INHERIT;
}

Member Function Documentation

PHPExcel_Style_Protection::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 314 of file Protection.php.

References $key.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
PHPExcel_Style_Protection::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) );

Parameters
array$pStylesArray containing style information
Exceptions
Exception
Returns
PHPExcel_Style_Protection

Definition at line 190 of file Protection.php.

References getActiveSheet(), getStyleArray(), getXSelectedCells(), setHidden(), and setLocked().

{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('locked', $pStyles)) {
$this->setLocked($pStyles['locked']);
}
if (array_key_exists('hidden', $pStyles)) {
$this->setHidden($pStyles['hidden']);
}
}
} else {
throw new Exception("Invalid style array passed.");
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::bindParent (   $parent)

Bind parent.

Only used for supervisor

Parameters
PHPExcel_Style$parent
Returns
PHPExcel_Style_Protection

Definition at line 109 of file Protection.php.

{
$this->_parent = $parent;
return $this;
}
PHPExcel_Style_Protection::getActiveSheet ( )

Get the currently active sheet.

Only used for supervisor

Returns
PHPExcel_Worksheet

Definition at line 141 of file Protection.php.

Referenced by applyFromArray(), getXActiveCell(), getXSelectedCells(), setHidden(), and setLocked().

{
return $this->_parent->getActiveSheet();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 269 of file Protection.php.

References getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_locked
. $this->_hidden
. __CLASS__
);
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getHashIndex ( )

Get hash index.

Note that this index may vary during script execution! Only reliable moment is while doing a write of a workbook and when changes are not allowed.

Returns
string Hash index

Implements PHPExcel_IComparable.

Definition at line 295 of file Protection.php.

References $_hashIndex.

{
}
PHPExcel_Style_Protection::getHidden ( )

Get hidden.

Returns
string

Definition at line 241 of file Protection.php.

References $_hidden, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHidden();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getIsSupervisor ( )

Is this a supervisor or a real style component?

Returns
boolean

Definition at line 120 of file Protection.php.

References $_isSupervisor.

{
}
PHPExcel_Style_Protection::getLocked ( )

Get locked.

Returns
string

Definition at line 213 of file Protection.php.

References $_locked, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getLocked();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns
PHPExcel_Style_Protection

Definition at line 131 of file Protection.php.

Referenced by getHashCode(), getHidden(), and getLocked().

{
return $this->_parent->getSharedComponent()->getProtection();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 174 of file Protection.php.

Referenced by applyFromArray(), setHidden(), and setLocked().

{
return array('protection' => $array);
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getXActiveCell ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 163 of file Protection.php.

References getActiveSheet().

{
return $this->getActiveSheet()->getXActiveCell();
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getXSelectedCells ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 152 of file Protection.php.

References getActiveSheet().

Referenced by applyFromArray(), setHidden(), and setLocked().

{
return $this->getActiveSheet()->getXSelectedCells();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::setHashIndex (   $value)

Set hash index.

Note that this index may vary during script execution! Only reliable moment is while doing a write of a workbook and when changes are not allowed.

Parameters
string$valueHash index

Implements PHPExcel_IComparable.

Definition at line 307 of file Protection.php.

{
$this->_hashIndex = $value;
}
PHPExcel_Style_Protection::setHidden (   $pValue = self::PROTECTION_INHERIT)

Set hidden.

Parameters
string$pValue
Returns
PHPExcel_Style_Protection

Definition at line 254 of file Protection.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_hidden = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::setLocked (   $pValue = self::PROTECTION_INHERIT)

Set locked.

Parameters
string$pValue
Returns
PHPExcel_Style_Protection

Definition at line 226 of file Protection.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('locked' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_locked = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Style_Protection::$_hashIndex
private

Definition at line 285 of file Protection.php.

Referenced by getHashIndex().

PHPExcel_Style_Protection::$_hidden
private

Definition at line 67 of file Protection.php.

Referenced by getHidden().

PHPExcel_Style_Protection::$_isSupervisor
private

Definition at line 81 of file Protection.php.

Referenced by getIsSupervisor().

PHPExcel_Style_Protection::$_locked
private

Definition at line 60 of file Protection.php.

Referenced by getLocked().

PHPExcel_Style_Protection::$_parent
private

Definition at line 88 of file Protection.php.

PHPExcel_Style_Protection::$_parentPropertyName
private

Definition at line 74 of file Protection.php.

const PHPExcel_Style_Protection::PROTECTION_UNPROTECTED = 'unprotected'

The documentation for this class was generated from the following file: