1
This commit is contained in:
64
vendor/phpoffice/phpword/src/PhpWord/Metadata/Compatibility.php
vendored
Normal file
64
vendor/phpoffice/phpword/src/PhpWord/Metadata/Compatibility.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Metadata;
|
||||
|
||||
/**
|
||||
* Compatibility setting class.
|
||||
*
|
||||
* @since 0.12.0
|
||||
* @see http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html
|
||||
*/
|
||||
class Compatibility
|
||||
{
|
||||
/**
|
||||
* OOXML version.
|
||||
*
|
||||
* 12 = 2007
|
||||
* 14 = 2010
|
||||
* 15 = 2013
|
||||
*
|
||||
* @var int
|
||||
*
|
||||
* @see http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx
|
||||
*/
|
||||
private $ooxmlVersion = 12;
|
||||
|
||||
/**
|
||||
* Get OOXML version.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOoxmlVersion()
|
||||
{
|
||||
return $this->ooxmlVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OOXML version.
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOoxmlVersion($value)
|
||||
{
|
||||
$this->ooxmlVersion = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
602
vendor/phpoffice/phpword/src/PhpWord/Metadata/DocInfo.php
vendored
Normal file
602
vendor/phpoffice/phpword/src/PhpWord/Metadata/DocInfo.php
vendored
Normal file
@@ -0,0 +1,602 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Metadata;
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Document information.
|
||||
*/
|
||||
class DocInfo
|
||||
{
|
||||
/** @const string Property type constants */
|
||||
const PROPERTY_TYPE_BOOLEAN = 'b';
|
||||
const PROPERTY_TYPE_INTEGER = 'i';
|
||||
const PROPERTY_TYPE_FLOAT = 'f';
|
||||
const PROPERTY_TYPE_DATE = 'd';
|
||||
const PROPERTY_TYPE_STRING = 's';
|
||||
const PROPERTY_TYPE_UNKNOWN = 'u';
|
||||
|
||||
/**
|
||||
* Creator.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $creator;
|
||||
|
||||
/**
|
||||
* LastModifiedBy.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $lastModifiedBy;
|
||||
|
||||
/**
|
||||
* Created.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $created;
|
||||
|
||||
/**
|
||||
* Modified.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $modified;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* Subject.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $subject;
|
||||
|
||||
/**
|
||||
* Keywords.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $keywords;
|
||||
|
||||
/**
|
||||
* Category.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* Company.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $company;
|
||||
|
||||
/**
|
||||
* Manager.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $manager;
|
||||
|
||||
/**
|
||||
* Custom Properties.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $customProperties = [];
|
||||
|
||||
/**
|
||||
* Create new instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->creator = '';
|
||||
$this->lastModifiedBy = $this->creator;
|
||||
$this->created = time();
|
||||
$this->modified = time();
|
||||
$this->title = '';
|
||||
$this->subject = '';
|
||||
$this->description = '';
|
||||
$this->keywords = '';
|
||||
$this->category = '';
|
||||
$this->company = '';
|
||||
$this->manager = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Creator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreator()
|
||||
{
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Creator.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCreator($value = '')
|
||||
{
|
||||
$this->creator = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Modified By.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastModifiedBy()
|
||||
{
|
||||
return $this->lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Modified By.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setLastModifiedBy($value = '')
|
||||
{
|
||||
$this->lastModifiedBy = $this->setValue($value, $this->creator);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Created.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Created.
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCreated($value = null)
|
||||
{
|
||||
$this->created = $this->setValue($value, time());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Modified.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getModified()
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Modified.
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setModified($value = null)
|
||||
{
|
||||
$this->modified = $this->setValue($value, time());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Title.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($value = '')
|
||||
{
|
||||
$this->title = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDescription($value = '')
|
||||
{
|
||||
$this->description = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Subject.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubject()
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Subject.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSubject($value = '')
|
||||
{
|
||||
$this->subject = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Keywords.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Keywords.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setKeywords($value = '')
|
||||
{
|
||||
$this->keywords = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Category.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Category.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCategory($value = '')
|
||||
{
|
||||
$this->category = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Company.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Company.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCompany($value = '')
|
||||
{
|
||||
$this->company = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Manager.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getManager()
|
||||
{
|
||||
return $this->manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Manager.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setManager($value = '')
|
||||
{
|
||||
$this->manager = $this->setValue($value, '');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a List of Custom Property Names.
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCustomProperties()
|
||||
{
|
||||
return array_keys($this->customProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Custom Property is defined.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCustomPropertySet($propertyName)
|
||||
{
|
||||
return isset($this->customProperties[$propertyName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Value.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCustomPropertyValue($propertyName)
|
||||
{
|
||||
if ($this->isCustomPropertySet($propertyName)) {
|
||||
return $this->customProperties[$propertyName]['value'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Type.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyType($propertyName)
|
||||
{
|
||||
if ($this->isCustomPropertySet($propertyName)) {
|
||||
return $this->customProperties[$propertyName]['type'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a Custom Property.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param mixed $propertyValue
|
||||
* @param string $propertyType
|
||||
* 'i': Integer
|
||||
* 'f': Floating Point
|
||||
* 's': String
|
||||
* 'd': Date/Time
|
||||
* 'b': Boolean
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
|
||||
{
|
||||
$propertyTypes = [
|
||||
self::PROPERTY_TYPE_INTEGER,
|
||||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN,
|
||||
];
|
||||
if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) {
|
||||
if ($propertyValue === null) {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_FLOAT;
|
||||
} elseif (is_int($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_INTEGER;
|
||||
} elseif (is_bool($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
|
||||
} elseif ($propertyValue instanceof DateTime) {
|
||||
$propertyType = self::PROPERTY_TYPE_DATE;
|
||||
} else {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
$this->customProperties[$propertyName] = [
|
||||
'value' => $propertyValue,
|
||||
'type' => $propertyType,
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert document property based on type.
|
||||
*
|
||||
* @param string $propertyValue
|
||||
* @param string $propertyType
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function convertProperty($propertyValue, $propertyType)
|
||||
{
|
||||
$conversion = self::getConversion($propertyType);
|
||||
|
||||
switch ($conversion) {
|
||||
case 'empty': // Empty
|
||||
return '';
|
||||
case 'null': // Null
|
||||
return null;
|
||||
case 'int': // Signed integer
|
||||
return (int) $propertyValue;
|
||||
case 'uint': // Unsigned integer
|
||||
return abs((int) $propertyValue);
|
||||
case 'float': // Float
|
||||
return (float) $propertyValue;
|
||||
case 'date': // Date
|
||||
return strtotime($propertyValue);
|
||||
case 'bool': // Boolean
|
||||
return $propertyValue == 'true';
|
||||
}
|
||||
|
||||
return $propertyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert document property type.
|
||||
*
|
||||
* @param string $propertyType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function convertPropertyType($propertyType)
|
||||
{
|
||||
$typeGroups = [
|
||||
self::PROPERTY_TYPE_INTEGER => ['i1', 'i2', 'i4', 'i8', 'int', 'ui1', 'ui2', 'ui4', 'ui8', 'uint'],
|
||||
self::PROPERTY_TYPE_FLOAT => ['r4', 'r8', 'decimal'],
|
||||
self::PROPERTY_TYPE_STRING => ['empty', 'null', 'lpstr', 'lpwstr', 'bstr'],
|
||||
self::PROPERTY_TYPE_DATE => ['date', 'filetime'],
|
||||
self::PROPERTY_TYPE_BOOLEAN => ['bool'],
|
||||
];
|
||||
foreach ($typeGroups as $groupId => $groupMembers) {
|
||||
if (in_array($propertyType, $groupMembers)) {
|
||||
return $groupId;
|
||||
}
|
||||
}
|
||||
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default for null and empty value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function setValue($value, $default)
|
||||
{
|
||||
if ($value === null || $value == '') {
|
||||
$value = $default;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversion model depending on property type.
|
||||
*
|
||||
* @param string $propertyType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getConversion($propertyType)
|
||||
{
|
||||
$conversions = [
|
||||
'empty' => ['empty'],
|
||||
'null' => ['null'],
|
||||
'int' => ['i1', 'i2', 'i4', 'i8', 'int'],
|
||||
'uint' => ['ui1', 'ui2', 'ui4', 'ui8', 'uint'],
|
||||
'float' => ['r4', 'r8', 'decimal'],
|
||||
'bool' => ['bool'],
|
||||
'date' => ['date', 'filetime'],
|
||||
];
|
||||
foreach ($conversions as $conversion => $types) {
|
||||
if (in_array($propertyType, $types)) {
|
||||
return $conversion;
|
||||
}
|
||||
}
|
||||
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
205
vendor/phpoffice/phpword/src/PhpWord/Metadata/Protection.php
vendored
Normal file
205
vendor/phpoffice/phpword/src/PhpWord/Metadata/Protection.php
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Metadata;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder;
|
||||
use PhpOffice\PhpWord\SimpleType\DocProtect;
|
||||
|
||||
/**
|
||||
* Document protection class.
|
||||
*
|
||||
* @since 0.12.0
|
||||
* @see http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html
|
||||
*/
|
||||
class Protection
|
||||
{
|
||||
/**
|
||||
* Editing restriction none|readOnly|comments|trackedChanges|forms.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @see http://www.datypic.com/sc/ooxml/a-w_edit-1.html
|
||||
*/
|
||||
private $editing;
|
||||
|
||||
/**
|
||||
* password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* Iterations to Run Hashing Algorithm.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $spinCount = 100000;
|
||||
|
||||
/**
|
||||
* Cryptographic Hashing Algorithm (see constants defined in \PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $algorithm = PasswordEncoder::ALGORITHM_SHA_1;
|
||||
|
||||
/**
|
||||
* Salt for Password Verifier.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $salt;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param string $editing
|
||||
*/
|
||||
public function __construct($editing = null)
|
||||
{
|
||||
if ($editing != null) {
|
||||
$this->setEditing($editing);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get editing protection.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEditing()
|
||||
{
|
||||
return $this->editing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set editing protection.
|
||||
*
|
||||
* @param string $editing Any value of \PhpOffice\PhpWord\SimpleType\DocProtect
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEditing($editing = null)
|
||||
{
|
||||
DocProtect::validate($editing);
|
||||
$this->editing = $editing;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set password.
|
||||
*
|
||||
* @param string $password
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count for hash iterations.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSpinCount()
|
||||
{
|
||||
return $this->spinCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set count for hash iterations.
|
||||
*
|
||||
* @param int $spinCount
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSpinCount($spinCount)
|
||||
{
|
||||
$this->spinCount = $spinCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get algorithm.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAlgorithm()
|
||||
{
|
||||
return $this->algorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set algorithm.
|
||||
*
|
||||
* @param string $algorithm
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAlgorithm($algorithm)
|
||||
{
|
||||
$this->algorithm = $algorithm;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get salt.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set salt. Salt HAS to be 16 characters, or an exception will be thrown.
|
||||
*
|
||||
* @param string $salt
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSalt($salt)
|
||||
{
|
||||
if ($salt !== null && strlen($salt) !== 16) {
|
||||
throw new InvalidArgumentException('salt has to be of exactly 16 bytes length');
|
||||
}
|
||||
|
||||
$this->salt = $salt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
484
vendor/phpoffice/phpword/src/PhpWord/Metadata/Settings.php
vendored
Normal file
484
vendor/phpoffice/phpword/src/PhpWord/Metadata/Settings.php
vendored
Normal file
@@ -0,0 +1,484 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Metadata;
|
||||
|
||||
use PhpOffice\PhpWord\ComplexType\ProofState;
|
||||
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
|
||||
use PhpOffice\PhpWord\SimpleType\Zoom;
|
||||
use PhpOffice\PhpWord\Style\Language;
|
||||
|
||||
/**
|
||||
* Setting class.
|
||||
*
|
||||
* @since 0.14.0
|
||||
* @see http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html
|
||||
*/
|
||||
class Settings
|
||||
{
|
||||
/**
|
||||
* Magnification Setting.
|
||||
*
|
||||
* @see http://www.datypic.com/sc/ooxml/e-w_zoom-1.html
|
||||
*
|
||||
* @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom
|
||||
*/
|
||||
private $zoom = 100;
|
||||
|
||||
/**
|
||||
* Mirror Page Margins.
|
||||
*
|
||||
* @see http://www.datypic.com/sc/ooxml/e-w_mirrorMargins-1.html
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $mirrorMargins;
|
||||
|
||||
/**
|
||||
* Hide spelling errors.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $hideSpellingErrors = false;
|
||||
|
||||
/**
|
||||
* Hide grammatical errors.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $hideGrammaticalErrors = false;
|
||||
|
||||
/**
|
||||
* Visibility of Annotation Types.
|
||||
*
|
||||
* @var TrackChangesView
|
||||
*/
|
||||
private $revisionView;
|
||||
|
||||
/**
|
||||
* Track Revisions to Document.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $trackRevisions = false;
|
||||
|
||||
/**
|
||||
* Do Not Use Move Syntax When Tracking Revisions.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $doNotTrackMoves = false;
|
||||
|
||||
/**
|
||||
* Do Not Track Formatting Revisions When Tracking Revisions.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $doNotTrackFormatting = false;
|
||||
|
||||
/**
|
||||
* Spelling and Grammatical Checking State.
|
||||
*
|
||||
* @var \PhpOffice\PhpWord\ComplexType\ProofState
|
||||
*/
|
||||
private $proofState;
|
||||
|
||||
/**
|
||||
* Document Editing Restrictions.
|
||||
*
|
||||
* @var \PhpOffice\PhpWord\Metadata\Protection
|
||||
*/
|
||||
private $documentProtection;
|
||||
|
||||
/**
|
||||
* Enables different header for odd and even pages.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $evenAndOddHeaders = false;
|
||||
|
||||
/**
|
||||
* Theme Font Languages.
|
||||
*
|
||||
* @var Language
|
||||
*/
|
||||
private $themeFontLang;
|
||||
|
||||
/**
|
||||
* Automatically Recalculate Fields on Open.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $updateFields = false;
|
||||
|
||||
/**
|
||||
* Radix Point for Field Code Evaluation.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $decimalSymbol = '.';
|
||||
|
||||
/**
|
||||
* Automatically hyphenate document contents when displayed.
|
||||
*
|
||||
* @var null|bool
|
||||
*/
|
||||
private $autoHyphenation;
|
||||
|
||||
/**
|
||||
* Maximum number of consecutively hyphenated lines.
|
||||
*
|
||||
* @var null|int
|
||||
*/
|
||||
private $consecutiveHyphenLimit;
|
||||
|
||||
/**
|
||||
* The allowed amount of whitespace before hyphenation is applied.
|
||||
*
|
||||
* @var null|float
|
||||
*/
|
||||
private $hyphenationZone;
|
||||
|
||||
/**
|
||||
* Do not hyphenate words in all capital letters.
|
||||
*
|
||||
* @var null|bool
|
||||
*/
|
||||
private $doNotHyphenateCaps;
|
||||
|
||||
/**
|
||||
* @return Protection
|
||||
*/
|
||||
public function getDocumentProtection()
|
||||
{
|
||||
if ($this->documentProtection == null) {
|
||||
$this->documentProtection = new Protection();
|
||||
}
|
||||
|
||||
return $this->documentProtection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Protection $documentProtection
|
||||
*/
|
||||
public function setDocumentProtection($documentProtection): void
|
||||
{
|
||||
$this->documentProtection = $documentProtection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProofState
|
||||
*/
|
||||
public function getProofState()
|
||||
{
|
||||
if ($this->proofState == null) {
|
||||
$this->proofState = new ProofState();
|
||||
}
|
||||
|
||||
return $this->proofState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProofState $proofState
|
||||
*/
|
||||
public function setProofState($proofState): void
|
||||
{
|
||||
$this->proofState = $proofState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Are spelling errors hidden.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHideSpellingErrors()
|
||||
{
|
||||
return $this->hideSpellingErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide spelling errors.
|
||||
*
|
||||
* @param bool $hideSpellingErrors
|
||||
*/
|
||||
public function setHideSpellingErrors($hideSpellingErrors): void
|
||||
{
|
||||
$this->hideSpellingErrors = $hideSpellingErrors === null ? true : $hideSpellingErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Are grammatical errors hidden.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHideGrammaticalErrors()
|
||||
{
|
||||
return $this->hideGrammaticalErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide grammatical errors.
|
||||
*
|
||||
* @param bool $hideGrammaticalErrors
|
||||
*/
|
||||
public function setHideGrammaticalErrors($hideGrammaticalErrors): void
|
||||
{
|
||||
$this->hideGrammaticalErrors = $hideGrammaticalErrors === null ? true : $hideGrammaticalErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEvenAndOddHeaders()
|
||||
{
|
||||
return $this->evenAndOddHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $evenAndOddHeaders
|
||||
*/
|
||||
public function setEvenAndOddHeaders($evenAndOddHeaders): void
|
||||
{
|
||||
$this->evenAndOddHeaders = $evenAndOddHeaders === null ? true : $evenAndOddHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Visibility of Annotation Types.
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\ComplexType\TrackChangesView
|
||||
*/
|
||||
public function getRevisionView()
|
||||
{
|
||||
return $this->revisionView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Visibility of Annotation Types.
|
||||
*
|
||||
* @param TrackChangesView $trackChangesView
|
||||
*/
|
||||
public function setRevisionView(?TrackChangesView $trackChangesView = null): void
|
||||
{
|
||||
$this->revisionView = $trackChangesView;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTrackRevisions()
|
||||
{
|
||||
return $this->trackRevisions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $trackRevisions
|
||||
*/
|
||||
public function setTrackRevisions($trackRevisions): void
|
||||
{
|
||||
$this->trackRevisions = $trackRevisions === null ? true : $trackRevisions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDoNotTrackMoves()
|
||||
{
|
||||
return $this->doNotTrackMoves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $doNotTrackMoves
|
||||
*/
|
||||
public function setDoNotTrackMoves($doNotTrackMoves): void
|
||||
{
|
||||
$this->doNotTrackMoves = $doNotTrackMoves === null ? true : $doNotTrackMoves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDoNotTrackFormatting()
|
||||
{
|
||||
return $this->doNotTrackFormatting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $doNotTrackFormatting
|
||||
*/
|
||||
public function setDoNotTrackFormatting($doNotTrackFormatting): void
|
||||
{
|
||||
$this->doNotTrackFormatting = $doNotTrackFormatting === null ? true : $doNotTrackFormatting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getZoom()
|
||||
{
|
||||
return $this->zoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $zoom
|
||||
*/
|
||||
public function setZoom($zoom): void
|
||||
{
|
||||
if (is_numeric($zoom)) {
|
||||
// zoom is a percentage
|
||||
$this->zoom = $zoom;
|
||||
} else {
|
||||
Zoom::validate($zoom);
|
||||
$this->zoom = $zoom;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMirrorMargins()
|
||||
{
|
||||
return $this->mirrorMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $mirrorMargins
|
||||
*/
|
||||
public function setMirrorMargins($mirrorMargins): void
|
||||
{
|
||||
$this->mirrorMargins = $mirrorMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Language.
|
||||
*
|
||||
* @return Language
|
||||
*/
|
||||
public function getThemeFontLang()
|
||||
{
|
||||
return $this->themeFontLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the Language for this document.
|
||||
*
|
||||
* @param Language $themeFontLang
|
||||
*/
|
||||
public function setThemeFontLang($themeFontLang): void
|
||||
{
|
||||
$this->themeFontLang = $themeFontLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasUpdateFields()
|
||||
{
|
||||
return $this->updateFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $updateFields
|
||||
*/
|
||||
public function setUpdateFields($updateFields): void
|
||||
{
|
||||
$this->updateFields = $updateFields === null ? false : $updateFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Radix Point for Field Code Evaluation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDecimalSymbol()
|
||||
{
|
||||
return $this->decimalSymbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the Radix Point for Field Code Evaluation.
|
||||
*
|
||||
* @param string $decimalSymbol
|
||||
*/
|
||||
public function setDecimalSymbol($decimalSymbol): void
|
||||
{
|
||||
$this->decimalSymbol = $decimalSymbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|bool
|
||||
*/
|
||||
public function hasAutoHyphenation()
|
||||
{
|
||||
return $this->autoHyphenation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $autoHyphenation
|
||||
*/
|
||||
public function setAutoHyphenation($autoHyphenation): void
|
||||
{
|
||||
$this->autoHyphenation = (bool) $autoHyphenation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getConsecutiveHyphenLimit()
|
||||
{
|
||||
return $this->consecutiveHyphenLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $consecutiveHyphenLimit
|
||||
*/
|
||||
public function setConsecutiveHyphenLimit($consecutiveHyphenLimit): void
|
||||
{
|
||||
$this->consecutiveHyphenLimit = (int) $consecutiveHyphenLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|float
|
||||
*/
|
||||
public function getHyphenationZone()
|
||||
{
|
||||
return $this->hyphenationZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $hyphenationZone Measurement unit is twip
|
||||
*/
|
||||
public function setHyphenationZone($hyphenationZone): void
|
||||
{
|
||||
$this->hyphenationZone = $hyphenationZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|bool
|
||||
*/
|
||||
public function hasDoNotHyphenateCaps()
|
||||
{
|
||||
return $this->doNotHyphenateCaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $doNotHyphenateCaps
|
||||
*/
|
||||
public function setDoNotHyphenateCaps($doNotHyphenateCaps): void
|
||||
{
|
||||
$this->doNotHyphenateCaps = (bool) $doNotHyphenateCaps;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user