Line.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. * Line style
  20. */
  21. class Line extends Image
  22. {
  23. /**
  24. * Connector types
  25. *
  26. * @const string
  27. */
  28. const CONNECTOR_TYPE_STRAIGHT = 'straight';
  29. /**
  30. * Arrow styles
  31. *
  32. * @const string
  33. */
  34. const ARROW_STYLE_BLOCK = 'block';
  35. const ARROW_STYLE_OPEN = 'open';
  36. const ARROW_STYLE_CLASSIC = 'classic';
  37. const ARROW_STYLE_DIAMOND = 'diamond';
  38. const ARROW_STYLE_OVAL = 'oval';
  39. /**
  40. * Dash styles
  41. *
  42. * @const string
  43. */
  44. const DASH_STYLE_DASH = 'dash';
  45. const DASH_STYLE_ROUND_DOT = 'rounddot';
  46. const DASH_STYLE_SQUARE_DOT = 'squaredot';
  47. const DASH_STYLE_DASH_DOT = 'dashdot';
  48. const DASH_STYLE_LONG_DASH = 'longdash';
  49. const DASH_STYLE_LONG_DASH_DOT = 'longdashdot';
  50. const DASH_STYLE_LONG_DASH_DOT_DOT = 'longdashdotdot';
  51. /**
  52. * flip Line
  53. *
  54. * @var bool
  55. */
  56. private $flip = false;
  57. /**
  58. * connectorType
  59. *
  60. * @var string
  61. */
  62. private $connectorType = self::CONNECTOR_TYPE_STRAIGHT;
  63. /**
  64. * Line Weight
  65. *
  66. * @var int
  67. */
  68. private $weight;
  69. /**
  70. * Line color
  71. *
  72. * @var string
  73. */
  74. private $color;
  75. /**
  76. * Dash style
  77. *
  78. * @var string
  79. */
  80. private $dash;
  81. /**
  82. * Begin arrow
  83. *
  84. * @var string
  85. */
  86. private $beginArrow;
  87. /**
  88. * End arrow
  89. *
  90. * @var string
  91. */
  92. private $endArrow;
  93. /**
  94. * Get flip
  95. *
  96. * @return bool
  97. */
  98. public function isFlip()
  99. {
  100. return $this->flip;
  101. }
  102. /**
  103. * Set flip
  104. *
  105. * @param bool $value
  106. * @return self
  107. */
  108. public function setFlip($value = false)
  109. {
  110. $this->flip = $this->setBoolVal($value, $this->flip);
  111. return $this;
  112. }
  113. /**
  114. * Get connectorType
  115. *
  116. * @return string
  117. */
  118. public function getConnectorType()
  119. {
  120. return $this->connectorType;
  121. }
  122. /**
  123. * Set connectorType
  124. *
  125. * @param string $value
  126. * @return self
  127. */
  128. public function setConnectorType($value = null)
  129. {
  130. $enum = array(
  131. self::CONNECTOR_TYPE_STRAIGHT,
  132. );
  133. $this->connectorType = $this->setEnumVal($value, $enum, $this->connectorType);
  134. return $this;
  135. }
  136. /**
  137. * Get weight
  138. *
  139. * @return int
  140. */
  141. public function getWeight()
  142. {
  143. return $this->weight;
  144. }
  145. /**
  146. * Set weight
  147. *
  148. * @param int $value Weight in points
  149. * @return self
  150. */
  151. public function setWeight($value = null)
  152. {
  153. $this->weight = $this->setNumericVal($value, $this->weight);
  154. return $this;
  155. }
  156. /**
  157. * Get color
  158. *
  159. * @return string
  160. */
  161. public function getColor()
  162. {
  163. return $this->color;
  164. }
  165. /**
  166. * Set color
  167. *
  168. * @param string $value
  169. * @return self
  170. */
  171. public function setColor($value = null)
  172. {
  173. $this->color = $value;
  174. return $this;
  175. }
  176. /**
  177. * Get beginArrow
  178. *
  179. * @return string
  180. */
  181. public function getBeginArrow()
  182. {
  183. return $this->beginArrow;
  184. }
  185. /**
  186. * Set beginArrow
  187. *
  188. * @param string $value
  189. * @return self
  190. */
  191. public function setBeginArrow($value = null)
  192. {
  193. $enum = array(
  194. self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND,
  195. self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL,
  196. );
  197. $this->beginArrow = $this->setEnumVal($value, $enum, $this->beginArrow);
  198. return $this;
  199. }
  200. /**
  201. * Get endArrow
  202. *
  203. * @return string
  204. */
  205. public function getEndArrow()
  206. {
  207. return $this->endArrow;
  208. }
  209. /**
  210. * Set endArrow
  211. *
  212. * @param string $value
  213. * @return self
  214. */
  215. public function setEndArrow($value = null)
  216. {
  217. $enum = array(
  218. self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND,
  219. self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL,
  220. );
  221. $this->endArrow = $this->setEnumVal($value, $enum, $this->endArrow);
  222. return $this;
  223. }
  224. /**
  225. * Get Dash
  226. *
  227. * @return string
  228. */
  229. public function getDash()
  230. {
  231. return $this->dash;
  232. }
  233. /**
  234. * Set Dash
  235. *
  236. * @param string $value
  237. * @return self
  238. */
  239. public function setDash($value = null)
  240. {
  241. $enum = array(
  242. self::DASH_STYLE_DASH, self::DASH_STYLE_DASH_DOT, self::DASH_STYLE_LONG_DASH,
  243. self::DASH_STYLE_LONG_DASH_DOT, self::DASH_STYLE_LONG_DASH_DOT_DOT, self::DASH_STYLE_ROUND_DOT,
  244. self::DASH_STYLE_SQUARE_DOT,
  245. );
  246. $this->dash = $this->setEnumVal($value, $enum, $this->dash);
  247. return $this;
  248. }
  249. }