Indentation.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. * Paragraph indentation style
  20. *
  21. * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html
  22. * @since 0.10.0
  23. */
  24. class Indentation extends AbstractStyle
  25. {
  26. /**
  27. * Left indentation (twip)
  28. *
  29. * @var int|float
  30. */
  31. private $left = 0;
  32. /**
  33. * Right indentation (twip)
  34. *
  35. * @var int|float
  36. */
  37. private $right = 0;
  38. /**
  39. * Additional first line indentation (twip)
  40. *
  41. * @var int|float
  42. */
  43. private $firstLine;
  44. /**
  45. * Indentation removed from first line (twip)
  46. *
  47. * @var int|float
  48. */
  49. private $hanging;
  50. /**
  51. * Create a new instance
  52. *
  53. * @param array $style
  54. */
  55. public function __construct($style = array())
  56. {
  57. $this->setStyleByArray($style);
  58. }
  59. /**
  60. * Get left
  61. *
  62. * @return int|float
  63. */
  64. public function getLeft()
  65. {
  66. return $this->left;
  67. }
  68. /**
  69. * Set left
  70. *
  71. * @param int|float $value
  72. * @return self
  73. */
  74. public function setLeft($value = null)
  75. {
  76. $this->left = $this->setNumericVal($value, $this->left);
  77. return $this;
  78. }
  79. /**
  80. * Get right
  81. *
  82. * @return int|float
  83. */
  84. public function getRight()
  85. {
  86. return $this->right;
  87. }
  88. /**
  89. * Set right
  90. *
  91. * @param int|float $value
  92. * @return self
  93. */
  94. public function setRight($value = null)
  95. {
  96. $this->right = $this->setNumericVal($value, $this->right);
  97. return $this;
  98. }
  99. /**
  100. * Get first line
  101. *
  102. * @return int|float
  103. */
  104. public function getFirstLine()
  105. {
  106. return $this->firstLine;
  107. }
  108. /**
  109. * Set first line
  110. *
  111. * @param int|float $value
  112. * @return self
  113. */
  114. public function setFirstLine($value = null)
  115. {
  116. $this->firstLine = $this->setNumericVal($value, $this->firstLine);
  117. return $this;
  118. }
  119. /**
  120. * Get hanging
  121. *
  122. * @return int|float
  123. */
  124. public function getHanging()
  125. {
  126. return $this->hanging;
  127. }
  128. /**
  129. * Set hanging
  130. *
  131. * @param int|float $value
  132. * @return self
  133. */
  134. public function setHanging($value = null)
  135. {
  136. $this->hanging = $this->setNumericVal($value, $this->hanging);
  137. return $this;
  138. }
  139. }