PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/src/PhpWord/Style/NumberingLevel.php

https://github.com/cyrillkalita/PHPWord
PHP | 417 lines | 139 code | 41 blank | 237 comment | 0 complexity | cfdc3dc5e935c2e874950491ab2e2188 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  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-2014 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Style;
  18. /**
  19. * Numbering level definition
  20. *
  21. * @link http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html
  22. * @since 0.10.0
  23. */
  24. class NumberingLevel extends AbstractStyle
  25. {
  26. /**
  27. * Level number, 0 to 8 (total 9 levels)
  28. *
  29. * @var integer
  30. */
  31. private $level = 0;
  32. /**
  33. * Starting value w:start
  34. *
  35. * @var integer
  36. * @link http://www.schemacentral.com/sc/ooxml/e-w_start-1.html
  37. */
  38. private $start = 1;
  39. /**
  40. * Numbering format bullet|decimal|upperRoman|lowerRoman|upperLetter|lowerLetter
  41. *
  42. * @var string
  43. * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html
  44. */
  45. private $format;
  46. /**
  47. * Restart numbering level symbol w:lvlRestart
  48. *
  49. * @var integer
  50. * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html
  51. */
  52. private $restart;
  53. /**
  54. * Related paragraph style
  55. *
  56. * @var string
  57. * @link http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html
  58. */
  59. private $pStyle;
  60. /**
  61. * Content between numbering symbol and paragraph text
  62. *
  63. * @var string tab|space|nothing
  64. * @link http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html
  65. */
  66. private $suffix = 'tab';
  67. /**
  68. * Numbering level text e.g. %1 for nonbullet or bullet character
  69. *
  70. * @var string
  71. * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html
  72. */
  73. private $text;
  74. /**
  75. * Align left|center|right|both
  76. *
  77. * @var string
  78. * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlJc-1.html
  79. */
  80. private $align;
  81. /**
  82. * Left
  83. *
  84. * @var integer
  85. */
  86. private $left;
  87. /**
  88. * Hanging
  89. *
  90. * @var integer
  91. */
  92. private $hanging;
  93. /**
  94. * Tab position
  95. *
  96. * @var integer
  97. */
  98. private $tabPos;
  99. /**
  100. * Font family
  101. *
  102. * @var string
  103. */
  104. private $font;
  105. /**
  106. * Hint default|eastAsia|cs
  107. *
  108. * @var string
  109. * @link http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html
  110. */
  111. private $hint;
  112. /**
  113. * Get level
  114. *
  115. * @return integer
  116. */
  117. public function getLevel()
  118. {
  119. return $this->level;
  120. }
  121. /**
  122. * Set level
  123. *
  124. * @param integer $value
  125. * @return self
  126. */
  127. public function setLevel($value)
  128. {
  129. $this->level = $this->setIntVal($value, $this->level);
  130. return $this;
  131. }
  132. /**
  133. * Get start
  134. *
  135. * @return integer
  136. */
  137. public function getStart()
  138. {
  139. return $this->start;
  140. }
  141. /**
  142. * Set start
  143. *
  144. * @param integer $value
  145. * @return self
  146. */
  147. public function setStart($value)
  148. {
  149. $this->start = $this->setIntVal($value, $this->start);
  150. return $this;
  151. }
  152. /**
  153. * Get format
  154. *
  155. * @return string
  156. */
  157. public function getFormat()
  158. {
  159. return $this->format;
  160. }
  161. /**
  162. * Set format
  163. *
  164. * @param string $value
  165. * @return self
  166. */
  167. public function setFormat($value)
  168. {
  169. $enum = array('bullet', 'decimal', 'upperRoman', 'lowerRoman', 'upperLetter', 'lowerLetter');
  170. $this->format = $this->setEnumVal($value, $enum, $this->format);
  171. return $this;
  172. }
  173. /**
  174. * Get start
  175. *
  176. * @return integer
  177. */
  178. public function getRestart()
  179. {
  180. return $this->restart;
  181. }
  182. /**
  183. * Set start
  184. *
  185. * @param integer $value
  186. * @return self
  187. */
  188. public function setRestart($value)
  189. {
  190. $this->restart = $this->setIntVal($value, $this->restart);
  191. return $this;
  192. }
  193. /**
  194. * Get related paragraph style
  195. *
  196. * @return string
  197. */
  198. public function getPStyle()
  199. {
  200. return $this->pStyle;
  201. }
  202. /**
  203. * Set related paragraph style
  204. *
  205. * @param string $value
  206. * @return self
  207. */
  208. public function setPStyle($value)
  209. {
  210. $this->pStyle = $value;
  211. return $this;
  212. }
  213. /**
  214. * Get suffix
  215. *
  216. * @return string
  217. */
  218. public function getSuffix()
  219. {
  220. return $this->suffix;
  221. }
  222. /**
  223. * Set suffix
  224. *
  225. * @param string $value
  226. * @return self
  227. */
  228. public function setSuffix($value)
  229. {
  230. $enum = array('tab', 'space', 'nothing');
  231. $this->suffix = $this->setEnumVal($value, $enum, $this->suffix);
  232. return $this;
  233. }
  234. /**
  235. * Get text
  236. *
  237. * @return string
  238. */
  239. public function getText()
  240. {
  241. return $this->text;
  242. }
  243. /**
  244. * Set text
  245. *
  246. * @param string $value
  247. * @return self
  248. */
  249. public function setText($value)
  250. {
  251. $this->text = $value;
  252. return $this;
  253. }
  254. /**
  255. * Get align
  256. *
  257. * @return string
  258. */
  259. public function getAlign()
  260. {
  261. return $this->align;
  262. }
  263. /**
  264. * Set align
  265. *
  266. * @param string $value
  267. * @return self
  268. */
  269. public function setAlign($value)
  270. {
  271. $enum = array('left', 'center', 'right', 'both');
  272. $this->align = $this->setEnumVal($value, $enum, $this->align);
  273. return $this;
  274. }
  275. /**
  276. * Get left
  277. *
  278. * @return integer
  279. */
  280. public function getLeft()
  281. {
  282. return $this->left;
  283. }
  284. /**
  285. * Set left
  286. *
  287. * @param integer $value
  288. * @return self
  289. */
  290. public function setLeft($value)
  291. {
  292. $this->left = $this->setIntVal($value, $this->left);
  293. return $this;
  294. }
  295. /**
  296. * Get hanging
  297. *
  298. * @return integer
  299. */
  300. public function getHanging()
  301. {
  302. return $this->hanging;
  303. }
  304. /**
  305. * Set hanging
  306. *
  307. * @param integer $value
  308. * @return self
  309. */
  310. public function setHanging($value)
  311. {
  312. $this->hanging = $this->setIntVal($value, $this->hanging);
  313. return $this;
  314. }
  315. /**
  316. * Get tab
  317. *
  318. * @return integer
  319. */
  320. public function getTabPos()
  321. {
  322. return $this->tabPos;
  323. }
  324. /**
  325. * Set tab
  326. *
  327. * @param integer $value
  328. * @return self
  329. */
  330. public function setTabPos($value)
  331. {
  332. $this->tabPos = $this->setIntVal($value, $this->tabPos);
  333. return $this;
  334. }
  335. /**
  336. * Get font
  337. *
  338. * @return string
  339. */
  340. public function getFont()
  341. {
  342. return $this->font;
  343. }
  344. /**
  345. * Set font
  346. *
  347. * @param string $value
  348. * @return self
  349. */
  350. public function setFont($value)
  351. {
  352. $this->font = $value;
  353. return $this;
  354. }
  355. /**
  356. * Get hint
  357. *
  358. * @return string
  359. */
  360. public function getHint()
  361. {
  362. return $this->hint;
  363. }
  364. /**
  365. * Set hint
  366. *
  367. * @param string $value
  368. * @return self
  369. */
  370. public function setHint($value = null)
  371. {
  372. $enum = array('default', 'eastAsia', 'cs');
  373. $this->hint = $this->setEnumVal($value, $enum, $this->hint);
  374. return $this;
  375. }
  376. }