PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.1
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Worksheet / Protection.php

Protection.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.7.1, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php

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