1 | <?php |
||
25 | class Alignment implements ComparableInterface |
||
26 | { |
||
27 | /* Horizontal alignment */ |
||
28 | const HORIZONTAL_GENERAL = 'l'; |
||
29 | const HORIZONTAL_LEFT = 'l'; |
||
30 | const HORIZONTAL_RIGHT = 'r'; |
||
31 | const HORIZONTAL_CENTER = 'ctr'; |
||
32 | const HORIZONTAL_JUSTIFY = 'just'; |
||
33 | const HORIZONTAL_DISTRIBUTED = 'dist'; |
||
34 | |||
35 | /* Vertical alignment */ |
||
36 | const VERTICAL_BASE = 'base'; |
||
37 | const VERTICAL_AUTO = 'auto'; |
||
38 | const VERTICAL_BOTTOM = 'b'; |
||
39 | const VERTICAL_TOP = 't'; |
||
40 | const VERTICAL_CENTER = 'ctr'; |
||
41 | |||
42 | /* Text direction */ |
||
43 | const TEXT_DIRECTION_HORIZONTAL = 'horz'; |
||
44 | const TEXT_DIRECTION_VERTICAL_90 = 'vert'; |
||
45 | const TEXT_DIRECTION_VERTICAL_270 = 'vert270'; |
||
46 | const TEXT_DIRECTION_STACKED = 'wordArtVert'; |
||
47 | |||
48 | private $supportedStyles = array( |
||
49 | self::HORIZONTAL_GENERAL, |
||
50 | self::HORIZONTAL_LEFT, |
||
51 | self::HORIZONTAL_RIGHT, |
||
52 | ); |
||
53 | |||
54 | /** |
||
55 | * RTL Direction Support |
||
56 | * @var boolean |
||
57 | */ |
||
58 | private $RTL; |
||
59 | |||
60 | /** |
||
61 | * Horizontal |
||
62 | * @var string |
||
63 | */ |
||
64 | private $horizontal; |
||
65 | |||
66 | /** |
||
67 | * Vertical |
||
68 | * @var string |
||
69 | */ |
||
70 | private $vertical; |
||
71 | |||
72 | /** |
||
73 | * Text Direction |
||
74 | * @var string |
||
75 | */ |
||
76 | private $textDirection = self::TEXT_DIRECTION_HORIZONTAL; |
||
77 | |||
78 | /** |
||
79 | * Level |
||
80 | * @var int |
||
81 | */ |
||
82 | private $level = 0; |
||
83 | |||
84 | /** |
||
85 | * Indent - only possible with horizontal alignment left and right |
||
86 | * @var int |
||
87 | */ |
||
88 | private $indent = 0; |
||
89 | |||
90 | /** |
||
91 | * Margin left - only possible with horizontal alignment left and right |
||
92 | * @var int |
||
93 | */ |
||
94 | private $marginLeft = 0; |
||
95 | |||
96 | /** |
||
97 | * Margin right - only possible with horizontal alignment left and right |
||
98 | * @var int |
||
99 | */ |
||
100 | private $marginRight = 0; |
||
101 | |||
102 | /** |
||
103 | * Margin top |
||
104 | * @var int |
||
105 | */ |
||
106 | private $marginTop = 0; |
||
107 | |||
108 | /** |
||
109 | * Margin bottom |
||
110 | * @var int |
||
111 | */ |
||
112 | private $marginBottom = 0; |
||
113 | |||
114 | /** |
||
115 | * Hash index |
||
116 | * @var string |
||
117 | */ |
||
118 | private $hashIndex; |
||
119 | |||
120 | /** |
||
121 | * Create a new \PhpOffice\PhpPresentation\Style\Alignment |
||
122 | */ |
||
123 | 337 | public function __construct() |
|
130 | |||
131 | /** |
||
132 | * Get RTL |
||
133 | * |
||
134 | * @return boolean |
||
135 | */ |
||
136 | 35 | public function isRTL() |
|
140 | |||
141 | /** |
||
142 | * Set RTL |
||
143 | * |
||
144 | * @param boolean $pValue |
||
145 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
146 | */ |
||
147 | public function setRTL($pValue = false) |
||
156 | |||
157 | /** |
||
158 | * Get Horizontal |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | 236 | public function getHorizontal() |
|
166 | |||
167 | /** |
||
168 | * Set Horizontal |
||
169 | * |
||
170 | * @param string $pValue |
||
171 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
172 | */ |
||
173 | 235 | public function setHorizontal($pValue = self::HORIZONTAL_LEFT) |
|
182 | |||
183 | /** |
||
184 | * Get Vertical |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | 72 | public function getVertical() |
|
192 | |||
193 | /** |
||
194 | * Set Vertical |
||
195 | * |
||
196 | * @param string $pValue |
||
197 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
198 | */ |
||
199 | 10 | public function setVertical($pValue = self::VERTICAL_BASE) |
|
208 | |||
209 | /** |
||
210 | * Get Level |
||
211 | * |
||
212 | * @return int |
||
213 | */ |
||
214 | 90 | public function getLevel() |
|
218 | |||
219 | /** |
||
220 | * Set Level |
||
221 | * |
||
222 | * @param int $pValue Ranging 0 - 8 |
||
223 | * @throws \Exception |
||
224 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
225 | */ |
||
226 | 10 | public function setLevel($pValue = 0) |
|
235 | |||
236 | /** |
||
237 | * Get indent |
||
238 | * |
||
239 | * @return int |
||
240 | */ |
||
241 | 133 | public function getIndent() |
|
245 | |||
246 | /** |
||
247 | * Set indent |
||
248 | * |
||
249 | * @param int $pValue |
||
250 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
251 | */ |
||
252 | 232 | public function setIndent($pValue = 0) |
|
262 | |||
263 | /** |
||
264 | * Get margin left |
||
265 | * |
||
266 | * @return int |
||
267 | */ |
||
268 | 131 | public function getMarginLeft() |
|
272 | |||
273 | /** |
||
274 | * Set margin left |
||
275 | * |
||
276 | * @param int $pValue |
||
277 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
278 | */ |
||
279 | 232 | public function setMarginLeft($pValue = 0) |
|
289 | |||
290 | /** |
||
291 | * Get margin right |
||
292 | * |
||
293 | * @return int |
||
294 | */ |
||
295 | 115 | public function getMarginRight() |
|
299 | |||
300 | /** |
||
301 | * Set margin ight |
||
302 | * |
||
303 | * @param int $pValue |
||
304 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
305 | */ |
||
306 | 5 | public function setMarginRight($pValue = 0) |
|
316 | |||
317 | /** |
||
318 | * Get margin top |
||
319 | * |
||
320 | * @return int |
||
321 | */ |
||
322 | 12 | public function getMarginTop() |
|
326 | |||
327 | /** |
||
328 | * Set margin top |
||
329 | * |
||
330 | * @param int $pValue |
||
331 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
332 | */ |
||
333 | 2 | public function setMarginTop($pValue = 0) |
|
339 | |||
340 | /** |
||
341 | * Get margin bottom |
||
342 | * |
||
343 | * @return int |
||
344 | */ |
||
345 | 12 | public function getMarginBottom() |
|
349 | |||
350 | /** |
||
351 | * Set margin bottom |
||
352 | * |
||
353 | * @param int $pValue |
||
354 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
355 | */ |
||
356 | 2 | public function setMarginBottom($pValue = 0) |
|
362 | |||
363 | /** |
||
364 | * @return string |
||
365 | */ |
||
366 | 12 | public function getTextDirection() |
|
370 | |||
371 | /** |
||
372 | * @param string $pValue |
||
373 | * @return Alignment |
||
374 | */ |
||
375 | 2 | public function setTextDirection($pValue = self::TEXT_DIRECTION_HORIZONTAL) |
|
383 | |||
384 | /** |
||
385 | * Get hash code |
||
386 | * |
||
387 | * @return string Hash code |
||
388 | */ |
||
389 | 59 | public function getHashCode() |
|
402 | |||
403 | /** |
||
404 | * Get hash index |
||
405 | * |
||
406 | * Note that this index may vary during script execution! Only reliable moment is |
||
407 | * while doing a write of a workbook and when changes are not allowed. |
||
408 | * |
||
409 | * @return string Hash index |
||
410 | */ |
||
411 | 1 | public function getHashIndex() |
|
415 | |||
416 | /** |
||
417 | * Set hash index |
||
418 | * |
||
419 | * Note that this index may vary during script execution! Only reliable moment is |
||
420 | * while doing a write of a workbook and when changes are not allowed. |
||
421 | * |
||
422 | * @param string $value Hash index |
||
423 | */ |
||
424 | 1 | public function setHashIndex($value) |
|
428 | } |
||
429 |