Nav apraksta

TextBox.php 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. * TextBox style
  20. *
  21. * @since 0.11.0
  22. */
  23. class TextBox extends Image
  24. {
  25. /**
  26. * margin top
  27. *
  28. * @var int
  29. */
  30. private $innerMarginTop = null;
  31. /**
  32. * margin left
  33. *
  34. * @var int
  35. */
  36. private $innerMarginLeft = null;
  37. /**
  38. * margin right
  39. *
  40. * @var int
  41. */
  42. private $innerMarginRight = null;
  43. /**
  44. * Cell margin bottom
  45. *
  46. * @var int
  47. */
  48. private $innerMarginBottom = null;
  49. /**
  50. * border size
  51. *
  52. * @var int
  53. */
  54. private $borderSize = null;
  55. /**
  56. * border color
  57. *
  58. * @var string
  59. */
  60. private $borderColor;
  61. /**
  62. * Set margin top.
  63. *
  64. * @param int $value
  65. * @return void
  66. */
  67. public function setInnerMarginTop($value = null)
  68. {
  69. $this->innerMarginTop = $value;
  70. }
  71. /**
  72. * Get margin top
  73. *
  74. * @return int
  75. */
  76. public function getInnerMarginTop()
  77. {
  78. return $this->innerMarginTop;
  79. }
  80. /**
  81. * Set margin left.
  82. *
  83. * @param int $value
  84. * @return void
  85. */
  86. public function setInnerMarginLeft($value = null)
  87. {
  88. $this->innerMarginLeft = $value;
  89. }
  90. /**
  91. * Get margin left
  92. *
  93. * @return int
  94. */
  95. public function getInnerMarginLeft()
  96. {
  97. return $this->innerMarginLeft;
  98. }
  99. /**
  100. * Set margin right.
  101. *
  102. * @param int $value
  103. * @return void
  104. */
  105. public function setInnerMarginRight($value = null)
  106. {
  107. $this->innerMarginRight = $value;
  108. }
  109. /**
  110. * Get margin right
  111. *
  112. * @return int
  113. */
  114. public function getInnerMarginRight()
  115. {
  116. return $this->innerMarginRight;
  117. }
  118. /**
  119. * Set margin bottom.
  120. *
  121. * @param int $value
  122. * @return void
  123. */
  124. public function setInnerMarginBottom($value = null)
  125. {
  126. $this->innerMarginBottom = $value;
  127. }
  128. /**
  129. * Get margin bottom
  130. *
  131. * @return int
  132. */
  133. public function getInnerMarginBottom()
  134. {
  135. return $this->innerMarginBottom;
  136. }
  137. /**
  138. * Set TLRB cell margin.
  139. *
  140. * @param int $value Margin in twips
  141. * @return void
  142. */
  143. public function setInnerMargin($value = null)
  144. {
  145. $this->setInnerMarginTop($value);
  146. $this->setInnerMarginLeft($value);
  147. $this->setInnerMarginRight($value);
  148. $this->setInnerMarginBottom($value);
  149. }
  150. /**
  151. * Get cell margin
  152. *
  153. * @return integer[]
  154. */
  155. public function getInnerMargin()
  156. {
  157. return array($this->innerMarginLeft, $this->innerMarginTop, $this->innerMarginRight, $this->innerMarginBottom);
  158. }
  159. /**
  160. * Has inner margin?
  161. *
  162. * @return bool
  163. */
  164. public function hasInnerMargins()
  165. {
  166. $hasInnerMargins = false;
  167. $margins = $this->getInnerMargin();
  168. for ($i = 0; $i < count($margins); $i++) {
  169. if ($margins[$i] !== null) {
  170. $hasInnerMargins = true;
  171. }
  172. }
  173. return $hasInnerMargins;
  174. }
  175. /**
  176. * Set border size.
  177. *
  178. * @param int $value Size in points
  179. * @return void
  180. */
  181. public function setBorderSize($value = null)
  182. {
  183. $this->borderSize = $value;
  184. }
  185. /**
  186. * Get border size
  187. *
  188. * @return int
  189. */
  190. public function getBorderSize()
  191. {
  192. return $this->borderSize;
  193. }
  194. /**
  195. * Set border color.
  196. *
  197. * @param string $value
  198. * @return void
  199. */
  200. public function setBorderColor($value = null)
  201. {
  202. $this->borderColor = $value;
  203. }
  204. /**
  205. * Get border color
  206. *
  207. * @return string
  208. */
  209. public function getBorderColor()
  210. {
  211. return $this->borderColor;
  212. }
  213. }