Shape.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. * Shape style
  20. *
  21. * @since 0.12.0
  22. * @todo Skew http://www.schemacentral.com/sc/ooxml/t-o_CT_Skew.html
  23. */
  24. class Shape extends AbstractStyle
  25. {
  26. /**
  27. * Points
  28. *
  29. * - Arc: startAngle endAngle; 0 = top center, moving clockwise
  30. * - Curve: from-x1,from-y1 to-x2,to-y2 control1-x,control1-y control2-x,control2-y
  31. * - Line: from-x1,from-y1 to-x2,to-y2
  32. * - Polyline: x1,y1 x2,y2 ...
  33. * - Rect and oval: Not applicable
  34. *
  35. * @var string
  36. */
  37. private $points;
  38. /**
  39. * Roundness measure of corners; 0 = straightest (rectangular); 1 = roundest (circle/oval)
  40. *
  41. * Only for rect
  42. *
  43. * @var int|float
  44. */
  45. private $roundness;
  46. /**
  47. * Frame
  48. *
  49. * @var \PhpOffice\PhpWord\Style\Frame
  50. */
  51. private $frame;
  52. /**
  53. * Fill
  54. *
  55. * @var \PhpOffice\PhpWord\Style\Fill
  56. */
  57. private $fill;
  58. /**
  59. * Outline
  60. *
  61. * @var \PhpOffice\PhpWord\Style\Outline
  62. */
  63. private $outline;
  64. /**
  65. * Shadow
  66. *
  67. * @var \PhpOffice\PhpWord\Style\Shadow
  68. */
  69. private $shadow;
  70. /**
  71. * 3D extrusion
  72. *
  73. * @var \PhpOffice\PhpWord\Style\Extrusion
  74. */
  75. private $extrusion;
  76. /**
  77. * Create a new instance
  78. *
  79. * @param array $style
  80. */
  81. public function __construct($style = array())
  82. {
  83. $this->setStyleByArray($style);
  84. }
  85. /**
  86. * Get points
  87. *
  88. * @return string
  89. */
  90. public function getPoints()
  91. {
  92. return $this->points;
  93. }
  94. /**
  95. * Set points
  96. *
  97. * @param string $value
  98. * @return self
  99. */
  100. public function setPoints($value = null)
  101. {
  102. $this->points = $value;
  103. return $this;
  104. }
  105. /**
  106. * Get roundness
  107. *
  108. * @return int|float
  109. */
  110. public function getRoundness()
  111. {
  112. return $this->roundness;
  113. }
  114. /**
  115. * Set roundness
  116. *
  117. * @param int|float $value
  118. * @return self
  119. */
  120. public function setRoundness($value = null)
  121. {
  122. $this->roundness = $this->setNumericVal($value, null);
  123. return $this;
  124. }
  125. /**
  126. * Get frame
  127. *
  128. * @return \PhpOffice\PhpWord\Style\Frame
  129. */
  130. public function getFrame()
  131. {
  132. return $this->frame;
  133. }
  134. /**
  135. * Set frame
  136. *
  137. * @param mixed $value
  138. * @return self
  139. */
  140. public function setFrame($value = null)
  141. {
  142. $this->setObjectVal($value, 'Frame', $this->frame);
  143. return $this;
  144. }
  145. /**
  146. * Get fill
  147. *
  148. * @return \PhpOffice\PhpWord\Style\Fill
  149. */
  150. public function getFill()
  151. {
  152. return $this->fill;
  153. }
  154. /**
  155. * Set fill
  156. *
  157. * @param mixed $value
  158. * @return self
  159. */
  160. public function setFill($value = null)
  161. {
  162. $this->setObjectVal($value, 'Fill', $this->fill);
  163. return $this;
  164. }
  165. /**
  166. * Get outline
  167. *
  168. * @return \PhpOffice\PhpWord\Style\Outline
  169. */
  170. public function getOutline()
  171. {
  172. return $this->outline;
  173. }
  174. /**
  175. * Set outline
  176. *
  177. * @param mixed $value
  178. * @return self
  179. */
  180. public function setOutline($value = null)
  181. {
  182. $this->setObjectVal($value, 'Outline', $this->outline);
  183. return $this;
  184. }
  185. /**
  186. * Get shadow
  187. *
  188. * @return \PhpOffice\PhpWord\Style\Shadow
  189. */
  190. public function getShadow()
  191. {
  192. return $this->shadow;
  193. }
  194. /**
  195. * Set shadow
  196. *
  197. * @param mixed $value
  198. * @return self
  199. */
  200. public function setShadow($value = null)
  201. {
  202. $this->setObjectVal($value, 'Shadow', $this->shadow);
  203. return $this;
  204. }
  205. /**
  206. * Get 3D extrusion
  207. *
  208. * @return \PhpOffice\PhpWord\Style\Extrusion
  209. */
  210. public function getExtrusion()
  211. {
  212. return $this->extrusion;
  213. }
  214. /**
  215. * Set 3D extrusion
  216. *
  217. * @param mixed $value
  218. * @return self
  219. */
  220. public function setExtrusion($value = null)
  221. {
  222. $this->setObjectVal($value, 'Extrusion', $this->extrusion);
  223. return $this;
  224. }
  225. }