TOC.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. * @see https://github.com/PHPOffice/PHPWord
  14. * @copyright 2010-2018 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Style;
  18. /**
  19. * TOC style
  20. */
  21. class TOC extends Tab
  22. {
  23. /**
  24. * Tab leader types for backward compatibility
  25. *
  26. * @deprecated 0.11.0
  27. *
  28. * @const string
  29. */
  30. const TABLEADER_DOT = self::TAB_LEADER_DOT;
  31. const TABLEADER_UNDERSCORE = self::TAB_LEADER_UNDERSCORE;
  32. const TABLEADER_LINE = self::TAB_LEADER_HYPHEN;
  33. const TABLEADER_NONE = self::TAB_LEADER_NONE;
  34. /**
  35. * Indent
  36. *
  37. * @var int|float (twip)
  38. */
  39. private $indent = 200;
  40. /**
  41. * Create a new TOC Style
  42. */
  43. public function __construct()
  44. {
  45. parent::__construct(self::TAB_STOP_RIGHT, 9062, self::TAB_LEADER_DOT);
  46. }
  47. /**
  48. * Get Tab Position
  49. *
  50. * @return int|float
  51. */
  52. public function getTabPos()
  53. {
  54. return $this->getPosition();
  55. }
  56. /**
  57. * Set Tab Position
  58. *
  59. * @param int|float $value
  60. * @return self
  61. */
  62. public function setTabPos($value)
  63. {
  64. return $this->setPosition($value);
  65. }
  66. /**
  67. * Get Tab Leader
  68. *
  69. * @return string
  70. */
  71. public function getTabLeader()
  72. {
  73. return $this->getLeader();
  74. }
  75. /**
  76. * Set Tab Leader
  77. *
  78. * @param string $value
  79. * @return self
  80. */
  81. public function setTabLeader($value = self::TAB_LEADER_DOT)
  82. {
  83. return $this->setLeader($value);
  84. }
  85. /**
  86. * Get Indent
  87. *
  88. * @return int|float
  89. */
  90. public function getIndent()
  91. {
  92. return $this->indent;
  93. }
  94. /**
  95. * Set Indent
  96. *
  97. * @param int|float $value
  98. * @return self
  99. */
  100. public function setIndent($value)
  101. {
  102. $this->indent = $this->setNumericVal($value, $this->indent);
  103. return $this;
  104. }
  105. }