No Description

TOC.php 2.4KB

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