Нема описа

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. * @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. * Spacing between lines and above/below paragraph style
  20. *
  21. * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html
  22. * @since 0.10.0
  23. */
  24. class Spacing extends AbstractStyle
  25. {
  26. /**
  27. * Spacing above paragraph (twip)
  28. *
  29. * @var int|float
  30. */
  31. private $before;
  32. /**
  33. * Spacing below paragraph (twip)
  34. *
  35. * @var int|float
  36. */
  37. private $after;
  38. /**
  39. * Spacing between lines in paragraph (twip)
  40. *
  41. * @var int|float
  42. */
  43. private $line;
  44. /**
  45. * Type of spacing between lines
  46. *
  47. * @var string
  48. */
  49. private $rule = 'auto';
  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 before
  61. *
  62. * @return int|float
  63. */
  64. public function getBefore()
  65. {
  66. return $this->before;
  67. }
  68. /**
  69. * Set before
  70. *
  71. * @param int|float $value
  72. * @return self
  73. */
  74. public function setBefore($value = null)
  75. {
  76. $this->before = $this->setNumericVal($value, $this->before);
  77. return $this;
  78. }
  79. /**
  80. * Get after
  81. *
  82. * @return int|float
  83. */
  84. public function getAfter()
  85. {
  86. return $this->after;
  87. }
  88. /**
  89. * Set after
  90. *
  91. * @param int|float $value
  92. * @return self
  93. */
  94. public function setAfter($value = null)
  95. {
  96. $this->after = $this->setNumericVal($value, $this->after);
  97. return $this;
  98. }
  99. /**
  100. * Get line
  101. *
  102. * @return int|float
  103. */
  104. public function getLine()
  105. {
  106. return $this->line;
  107. }
  108. /**
  109. * Set distance
  110. *
  111. * @param int|float $value
  112. * @return self
  113. */
  114. public function setLine($value = null)
  115. {
  116. $this->line = $this->setNumericVal($value, $this->line);
  117. return $this;
  118. }
  119. /**
  120. * Get line rule
  121. *
  122. * @return string
  123. */
  124. public function getRule()
  125. {
  126. return $this->rule;
  127. }
  128. /**
  129. * Set line rule
  130. *
  131. * @param string $value
  132. * @return self
  133. */
  134. public function setRule($value = null)
  135. {
  136. $this->rule = $value;
  137. return $this;
  138. }
  139. }