|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of PHPWord - A pure PHP library for reading and writing |
| 4 | + * word processing documents. |
| 5 | + * |
| 6 | + * PHPWord is free software distributed under the terms of the GNU Lesser |
| 7 | + * General Public License version 3 as published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * For the full copyright and license information, please read the LICENSE |
| 10 | + * file that was distributed with this source code. For the full list of |
| 11 | + * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
| 12 | + * |
| 13 | + * @link https://github.com/PHPOffice/PHPWord |
| 14 | + * @copyright 2010-2016 PHPWord contributors |
| 15 | + * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 16 | + */ |
| 17 | +namespace PhpOffice\PhpWord\SimpleType; |
| 18 | + |
| 19 | +/** |
| 20 | + * Footnote properties |
| 21 | + * |
| 22 | + * @see http://www.datypic.com/sc/ooxml/e-w_footnotePr-1.html |
| 23 | + */ |
| 24 | +final class FootnoteProperties |
| 25 | +{ |
| 26 | + |
| 27 | + const RESTART_NUMBER_CONTINUOUS = 'continuous'; |
| 28 | + const RESTART_NUMBER_EACH_SECTION = 'eachSect'; |
| 29 | + const RESTART_NUMBER_EACH_PAGE = 'eachPage'; |
| 30 | + |
| 31 | + const NUMBER_FORMAT_DECIMAL = 'decimal'; |
| 32 | + const NUMBER_FORMAT_UPPER_ROMAN = 'upperRoman'; |
| 33 | + const NUMBER_FORMAT_LOWER_ROMAN = 'lowerRoman'; |
| 34 | + const NUMBER_FORMAT_UPPER_LETTER = 'upperLetter'; |
| 35 | + const NUMBER_FORMAT_LOWER_LETTER = 'lowerLetter'; |
| 36 | + const NUMBER_FORMAT_ORDINAL = 'ordinal'; |
| 37 | + const NUMBER_FORMAT_CARDINAL_TEXT = 'cardinalText'; |
| 38 | + const NUMBER_FORMAT_ORDINAL_TEXT = 'ordinalText'; |
| 39 | + const NUMBER_FORMAT_NONE = 'none'; |
| 40 | + const NUMBER_FORMAT_BULLET = 'bullet'; |
| 41 | + |
| 42 | + const POSITION_PAGE_BOTTOM = 'pageBottom'; |
| 43 | + const POSITION_BENEATH_TEXT = 'beneathText'; |
| 44 | + const POSITION_SECTION_END = 'sectEnd'; |
| 45 | + const POSITION_DOC_END = 'docEnd'; |
| 46 | + |
| 47 | + /** |
| 48 | + * Footnote Positioning Location |
| 49 | + * |
| 50 | + * @var string |
| 51 | + */ |
| 52 | + private $pos; |
| 53 | + |
| 54 | + /** |
| 55 | + * Footnote Numbering Format |
| 56 | + * |
| 57 | + * @var string |
| 58 | + */ |
| 59 | + private $numFmt; |
| 60 | + |
| 61 | + /** |
| 62 | + * Footnote and Endnote Numbering Starting Value |
| 63 | + * |
| 64 | + * @var decimal |
| 65 | + */ |
| 66 | + private $numStart; |
| 67 | + |
| 68 | + /** |
| 69 | + * Footnote and Endnote Numbering Restart Location |
| 70 | + * |
| 71 | + * @var string |
| 72 | + */ |
| 73 | + private $numRestart; |
| 74 | + |
| 75 | + public function getPos() |
| 76 | + { |
| 77 | + return $this->pos; |
| 78 | + } |
| 79 | + |
| 80 | + public function setPos($pos) |
| 81 | + { |
| 82 | + $position = array( |
| 83 | + self::POSITION_PAGE_BOTTOM, |
| 84 | + self::POSITION_BENEATH_TEXT, |
| 85 | + self::POSITION_SECTION_END, |
| 86 | + self::POSITION_DOC_END |
| 87 | + ); |
| 88 | + |
| 89 | + if (in_array($pos, $position)) { |
| 90 | + $this->pos = $pos; |
| 91 | + } else { |
| 92 | + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible"); |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | + public function getNumFmt() |
| 97 | + { |
| 98 | + return $this->numFmt; |
| 99 | + } |
| 100 | + |
| 101 | + public function setNumFmt($numFmt) |
| 102 | + { |
| 103 | + $numberFormat = array( |
| 104 | + self::NUMBER_FORMAT_DECIMAL, |
| 105 | + self::NUMBER_FORMAT_UPPER_ROMAN, |
| 106 | + self::NUMBER_FORMAT_LOWER_ROMAN, |
| 107 | + self::NUMBER_FORMAT_UPPER_LETTER, |
| 108 | + self::NUMBER_FORMAT_LOWER_LETTER, |
| 109 | + self::NUMBER_FORMAT_ORDINAL, |
| 110 | + self::NUMBER_FORMAT_CARDINAL_TEXT, |
| 111 | + self::NUMBER_FORMAT_ORDINAL_TEXT, |
| 112 | + self::NUMBER_FORMAT_NONE, |
| 113 | + self::NUMBER_FORMAT_BULLET |
| 114 | + ); |
| 115 | + |
| 116 | + if (in_array($numFmt, $numberFormat)) { |
| 117 | + $this->numFmt = $numFmt; |
| 118 | + } else { |
| 119 | + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $numberFormat) . " possible"); |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + public function getNumStart() |
| 124 | + { |
| 125 | + return $this->numStart; |
| 126 | + } |
| 127 | + |
| 128 | + public function setNumStart($numStart) |
| 129 | + { |
| 130 | + $this->numStart = $numStart; |
| 131 | + } |
| 132 | + |
| 133 | + public function getNumRestart() |
| 134 | + { |
| 135 | + return $this->numRestart; |
| 136 | + } |
| 137 | + |
| 138 | + public function setNumRestart($numRestart) |
| 139 | + { |
| 140 | + $restartNumbers = array( |
| 141 | + self::RESTART_NUMBER_CONTINUOUS, |
| 142 | + self::RESTART_NUMBER_EACH_SECTION, |
| 143 | + self::RESTART_NUMBER_EACH_PAGE |
| 144 | + ); |
| 145 | + |
| 146 | + if (in_array($numRestart, $restartNumbers)) { |
| 147 | + $this->numRestart= $numRestart; |
| 148 | + } else { |
| 149 | + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible"); |
| 150 | + } |
| 151 | + } |
| 152 | +} |
0 commit comments