[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/Worksheet/ -> Protection.php (source)

   1  <?php
   2  /**
   3   * PHPExcel
   4   *
   5   * Copyright (c) 2006 - 2015 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_Worksheet
  23   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  24   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25   * @version    ##VERSION##, ##DATE##
  26   */
  27  
  28  
  29  /**
  30   * PHPExcel_Worksheet_Protection
  31   *
  32   * @category   PHPExcel
  33   * @package    PHPExcel_Worksheet
  34   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  35   */
  36  class PHPExcel_Worksheet_Protection
  37  {
  38      /**
  39       * Sheet
  40       *
  41       * @var boolean
  42       */
  43      private $sheet                    = false;
  44  
  45      /**
  46       * Objects
  47       *
  48       * @var boolean
  49       */
  50      private $objects                = false;
  51  
  52      /**
  53       * Scenarios
  54       *
  55       * @var boolean
  56       */
  57      private $scenarios                = false;
  58  
  59      /**
  60       * Format cells
  61       *
  62       * @var boolean
  63       */
  64      private $formatCells            = false;
  65  
  66      /**
  67       * Format columns
  68       *
  69       * @var boolean
  70       */
  71      private $formatColumns            = false;
  72  
  73      /**
  74       * Format rows
  75       *
  76       * @var boolean
  77       */
  78      private $formatRows            = false;
  79  
  80      /**
  81       * Insert columns
  82       *
  83       * @var boolean
  84       */
  85      private $insertColumns            = false;
  86  
  87      /**
  88       * Insert rows
  89       *
  90       * @var boolean
  91       */
  92      private $insertRows            = false;
  93  
  94      /**
  95       * Insert hyperlinks
  96       *
  97       * @var boolean
  98       */
  99      private $insertHyperlinks        = false;
 100  
 101      /**
 102       * Delete columns
 103       *
 104       * @var boolean
 105       */
 106      private $deleteColumns            = false;
 107  
 108      /**
 109       * Delete rows
 110       *
 111       * @var boolean
 112       */
 113      private $deleteRows            = false;
 114  
 115      /**
 116       * Select locked cells
 117       *
 118       * @var boolean
 119       */
 120      private $selectLockedCells        = false;
 121  
 122      /**
 123       * Sort
 124       *
 125       * @var boolean
 126       */
 127      private $sort                    = false;
 128  
 129      /**
 130       * AutoFilter
 131       *
 132       * @var boolean
 133       */
 134      private $autoFilter            = false;
 135  
 136      /**
 137       * Pivot tables
 138       *
 139       * @var boolean
 140       */
 141      private $pivotTables            = false;
 142  
 143      /**
 144       * Select unlocked cells
 145       *
 146       * @var boolean
 147       */
 148      private $selectUnlockedCells    = false;
 149  
 150      /**
 151       * Password
 152       *
 153       * @var string
 154       */
 155      private $password                = '';
 156  
 157      /**
 158       * Create a new PHPExcel_Worksheet_Protection
 159       */
 160      public function __construct()
 161      {
 162      }
 163  
 164      /**
 165       * Is some sort of protection enabled?
 166       *
 167       * @return boolean
 168       */
 169      public function isProtectionEnabled()
 170      {
 171          return $this->sheet ||
 172              $this->objects ||
 173              $this->scenarios ||
 174              $this->formatCells ||
 175              $this->formatColumns ||
 176              $this->formatRows ||
 177              $this->insertColumns ||
 178              $this->insertRows ||
 179              $this->insertHyperlinks ||
 180              $this->deleteColumns ||
 181              $this->deleteRows ||
 182              $this->selectLockedCells ||
 183              $this->sort ||
 184              $this->autoFilter ||
 185              $this->pivotTables ||
 186              $this->selectUnlockedCells;
 187      }
 188  
 189      /**
 190       * Get Sheet
 191       *
 192       * @return boolean
 193       */
 194      public function getSheet()
 195      {
 196          return $this->sheet;
 197      }
 198  
 199      /**
 200       * Set Sheet
 201       *
 202       * @param boolean $pValue
 203       * @return PHPExcel_Worksheet_Protection
 204       */
 205      public function setSheet($pValue = false)
 206      {
 207          $this->sheet = $pValue;
 208          return $this;
 209      }
 210  
 211      /**
 212       * Get Objects
 213       *
 214       * @return boolean
 215       */
 216      public function getObjects()
 217      {
 218          return $this->objects;
 219      }
 220  
 221      /**
 222       * Set Objects
 223       *
 224       * @param boolean $pValue
 225       * @return PHPExcel_Worksheet_Protection
 226       */
 227      public function setObjects($pValue = false)
 228      {
 229          $this->objects = $pValue;
 230          return $this;
 231      }
 232  
 233      /**
 234       * Get Scenarios
 235       *
 236       * @return boolean
 237       */
 238      public function getScenarios()
 239      {
 240          return $this->scenarios;
 241      }
 242  
 243      /**
 244       * Set Scenarios
 245       *
 246       * @param boolean $pValue
 247       * @return PHPExcel_Worksheet_Protection
 248       */
 249      public function setScenarios($pValue = false)
 250      {
 251          $this->scenarios = $pValue;
 252          return $this;
 253      }
 254  
 255      /**
 256       * Get FormatCells
 257       *
 258       * @return boolean
 259       */
 260      public function getFormatCells()
 261      {
 262          return $this->formatCells;
 263      }
 264  
 265      /**
 266       * Set FormatCells
 267       *
 268       * @param boolean $pValue
 269       * @return PHPExcel_Worksheet_Protection
 270       */
 271      public function setFormatCells($pValue = false)
 272      {
 273          $this->formatCells = $pValue;
 274          return $this;
 275      }
 276  
 277      /**
 278       * Get FormatColumns
 279       *
 280       * @return boolean
 281       */
 282      public function getFormatColumns()
 283      {
 284          return $this->formatColumns;
 285      }
 286  
 287      /**
 288       * Set FormatColumns
 289       *
 290       * @param boolean $pValue
 291       * @return PHPExcel_Worksheet_Protection
 292       */
 293      public function setFormatColumns($pValue = false)
 294      {
 295          $this->formatColumns = $pValue;
 296          return $this;
 297      }
 298  
 299      /**
 300       * Get FormatRows
 301       *
 302       * @return boolean
 303       */
 304      public function getFormatRows()
 305      {
 306          return $this->formatRows;
 307      }
 308  
 309      /**
 310       * Set FormatRows
 311       *
 312       * @param boolean $pValue
 313       * @return PHPExcel_Worksheet_Protection
 314       */
 315      public function setFormatRows($pValue = false)
 316      {
 317          $this->formatRows = $pValue;
 318          return $this;
 319      }
 320  
 321      /**
 322       * Get InsertColumns
 323       *
 324       * @return boolean
 325       */
 326      public function getInsertColumns()
 327      {
 328          return $this->insertColumns;
 329      }
 330  
 331      /**
 332       * Set InsertColumns
 333       *
 334       * @param boolean $pValue
 335       * @return PHPExcel_Worksheet_Protection
 336       */
 337      public function setInsertColumns($pValue = false)
 338      {
 339          $this->insertColumns = $pValue;
 340          return $this;
 341      }
 342  
 343      /**
 344       * Get InsertRows
 345       *
 346       * @return boolean
 347       */
 348      public function getInsertRows()
 349      {
 350          return $this->insertRows;
 351      }
 352  
 353      /**
 354       * Set InsertRows
 355       *
 356       * @param boolean $pValue
 357       * @return PHPExcel_Worksheet_Protection
 358       */
 359      public function setInsertRows($pValue = false)
 360      {
 361          $this->insertRows = $pValue;
 362          return $this;
 363      }
 364  
 365      /**
 366       * Get InsertHyperlinks
 367       *
 368       * @return boolean
 369       */
 370      public function getInsertHyperlinks()
 371      {
 372          return $this->insertHyperlinks;
 373      }
 374  
 375      /**
 376       * Set InsertHyperlinks
 377       *
 378       * @param boolean $pValue
 379       * @return PHPExcel_Worksheet_Protection
 380       */
 381      public function setInsertHyperlinks($pValue = false)
 382      {
 383          $this->insertHyperlinks = $pValue;
 384          return $this;
 385      }
 386  
 387      /**
 388       * Get DeleteColumns
 389       *
 390       * @return boolean
 391       */
 392      public function getDeleteColumns()
 393      {
 394          return $this->deleteColumns;
 395      }
 396  
 397      /**
 398       * Set DeleteColumns
 399       *
 400       * @param boolean $pValue
 401       * @return PHPExcel_Worksheet_Protection
 402       */
 403      public function setDeleteColumns($pValue = false)
 404      {
 405          $this->deleteColumns = $pValue;
 406          return $this;
 407      }
 408  
 409      /**
 410       * Get DeleteRows
 411       *
 412       * @return boolean
 413       */
 414      public function getDeleteRows()
 415      {
 416          return $this->deleteRows;
 417      }
 418  
 419      /**
 420       * Set DeleteRows
 421       *
 422       * @param boolean $pValue
 423       * @return PHPExcel_Worksheet_Protection
 424       */
 425      public function setDeleteRows($pValue = false)
 426      {
 427          $this->deleteRows = $pValue;
 428          return $this;
 429      }
 430  
 431      /**
 432       * Get SelectLockedCells
 433       *
 434       * @return boolean
 435       */
 436      public function getSelectLockedCells()
 437      {
 438          return $this->selectLockedCells;
 439      }
 440  
 441      /**
 442       * Set SelectLockedCells
 443       *
 444       * @param boolean $pValue
 445       * @return PHPExcel_Worksheet_Protection
 446       */
 447      public function setSelectLockedCells($pValue = false)
 448      {
 449          $this->selectLockedCells = $pValue;
 450          return $this;
 451      }
 452  
 453      /**
 454       * Get Sort
 455       *
 456       * @return boolean
 457       */
 458      public function getSort()
 459      {
 460          return $this->sort;
 461      }
 462  
 463      /**
 464       * Set Sort
 465       *
 466       * @param boolean $pValue
 467       * @return PHPExcel_Worksheet_Protection
 468       */
 469      public function setSort($pValue = false)
 470      {
 471          $this->sort = $pValue;
 472          return $this;
 473      }
 474  
 475      /**
 476       * Get AutoFilter
 477       *
 478       * @return boolean
 479       */
 480      public function getAutoFilter()
 481      {
 482          return $this->autoFilter;
 483      }
 484  
 485      /**
 486       * Set AutoFilter
 487       *
 488       * @param boolean $pValue
 489       * @return PHPExcel_Worksheet_Protection
 490       */
 491      public function setAutoFilter($pValue = false)
 492      {
 493          $this->autoFilter = $pValue;
 494          return $this;
 495      }
 496  
 497      /**
 498       * Get PivotTables
 499       *
 500       * @return boolean
 501       */
 502      public function getPivotTables()
 503      {
 504          return $this->pivotTables;
 505      }
 506  
 507      /**
 508       * Set PivotTables
 509       *
 510       * @param boolean $pValue
 511       * @return PHPExcel_Worksheet_Protection
 512       */
 513      public function setPivotTables($pValue = false)
 514      {
 515          $this->pivotTables = $pValue;
 516          return $this;
 517      }
 518  
 519      /**
 520       * Get SelectUnlockedCells
 521       *
 522       * @return boolean
 523       */
 524      public function getSelectUnlockedCells()
 525      {
 526          return $this->selectUnlockedCells;
 527      }
 528  
 529      /**
 530       * Set SelectUnlockedCells
 531       *
 532       * @param boolean $pValue
 533       * @return PHPExcel_Worksheet_Protection
 534       */
 535      public function setSelectUnlockedCells($pValue = false)
 536      {
 537          $this->selectUnlockedCells = $pValue;
 538          return $this;
 539      }
 540  
 541      /**
 542       * Get Password (hashed)
 543       *
 544       * @return string
 545       */
 546      public function getPassword()
 547      {
 548          return $this->password;
 549      }
 550  
 551      /**
 552       * Set Password
 553       *
 554       * @param string     $pValue
 555       * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
 556       * @return PHPExcel_Worksheet_Protection
 557       */
 558      public function setPassword($pValue = '', $pAlreadyHashed = false)
 559      {
 560          if (!$pAlreadyHashed) {
 561              $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
 562          }
 563          $this->password = $pValue;
 564          return $this;
 565      }
 566  
 567      /**
 568       * Implement PHP __clone to create a deep clone, not just a shallow copy.
 569       */
 570      public function __clone()
 571      {
 572          $vars = get_object_vars($this);
 573          foreach ($vars as $key => $value) {
 574              if (is_object($value)) {
 575                  $this->$key = clone $value;
 576              } else {
 577                  $this->$key = $value;
 578              }
 579          }
 580      }
 581  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1