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 | * Horizontal |
||
56 | * @var string |
||
57 | */ |
||
58 | private $horizontal; |
||
59 | |||
60 | /** |
||
61 | * Vertical |
||
62 | * @var string |
||
63 | */ |
||
64 | private $vertical; |
||
65 | |||
66 | /** |
||
67 | * Text Direction |
||
68 | * @var string |
||
69 | */ |
||
70 | private $textDirection = self::TEXT_DIRECTION_HORIZONTAL; |
||
71 | |||
72 | /** |
||
73 | * Level |
||
74 | * @var int |
||
75 | */ |
||
76 | private $level = 0; |
||
77 | |||
78 | /** |
||
79 | * Indent - only possible with horizontal alignment left and right |
||
80 | * @var int |
||
81 | */ |
||
82 | private $indent = 0; |
||
83 | |||
84 | /** |
||
85 | * Margin left - only possible with horizontal alignment left and right |
||
86 | * @var int |
||
87 | */ |
||
88 | private $marginLeft = 0; |
||
89 | |||
90 | /** |
||
91 | * Margin right - only possible with horizontal alignment left and right |
||
92 | * @var int |
||
93 | */ |
||
94 | private $marginRight = 0; |
||
95 | |||
96 | /** |
||
97 | * Margin top |
||
98 | * @var int |
||
99 | */ |
||
100 | private $marginTop = 0; |
||
101 | |||
102 | /** |
||
103 | * Margin bottom |
||
104 | * @var int |
||
105 | */ |
||
106 | private $marginBottom = 0; |
||
107 | |||
108 | /** |
||
109 | * Hash index |
||
110 | * @var string |
||
111 | */ |
||
112 | private $hashIndex; |
||
113 | |||
114 | /** |
||
115 | * Create a new \PhpOffice\PhpPresentation\Style\Alignment |
||
116 | */ |
||
117 | 337 | public function __construct() |
|
123 | |||
124 | /** |
||
125 | * Get Horizontal |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | 236 | public function getHorizontal() |
|
133 | |||
134 | /** |
||
135 | * Set Horizontal |
||
136 | * |
||
137 | * @param string $pValue |
||
138 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
139 | */ |
||
140 | 235 | public function setHorizontal($pValue = self::HORIZONTAL_LEFT) |
|
149 | |||
150 | /** |
||
151 | * Get Vertical |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | 72 | public function getVertical() |
|
159 | |||
160 | /** |
||
161 | * Set Vertical |
||
162 | * |
||
163 | * @param string $pValue |
||
164 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
165 | */ |
||
166 | 10 | public function setVertical($pValue = self::VERTICAL_BASE) |
|
175 | |||
176 | /** |
||
177 | * Get Level |
||
178 | * |
||
179 | * @return int |
||
180 | */ |
||
181 | 90 | public function getLevel() |
|
185 | |||
186 | /** |
||
187 | * Set Level |
||
188 | * |
||
189 | * @param int $pValue Ranging 0 - 8 |
||
190 | * @throws \Exception |
||
191 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
192 | */ |
||
193 | 10 | public function setLevel($pValue = 0) |
|
202 | |||
203 | /** |
||
204 | * Get indent |
||
205 | * |
||
206 | * @return int |
||
207 | */ |
||
208 | 133 | public function getIndent() |
|
212 | |||
213 | /** |
||
214 | * Set indent |
||
215 | * |
||
216 | * @param int $pValue |
||
217 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
218 | */ |
||
219 | 232 | public function setIndent($pValue = 0) |
|
229 | |||
230 | /** |
||
231 | * Get margin left |
||
232 | * |
||
233 | * @return int |
||
234 | */ |
||
235 | 131 | public function getMarginLeft() |
|
239 | |||
240 | /** |
||
241 | * Set margin left |
||
242 | * |
||
243 | * @param int $pValue |
||
244 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
245 | */ |
||
246 | 232 | public function setMarginLeft($pValue = 0) |
|
256 | |||
257 | /** |
||
258 | * Get margin right |
||
259 | * |
||
260 | * @return int |
||
261 | */ |
||
262 | 115 | public function getMarginRight() |
|
266 | |||
267 | /** |
||
268 | * Set margin ight |
||
269 | * |
||
270 | * @param int $pValue |
||
271 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
272 | */ |
||
273 | 5 | public function setMarginRight($pValue = 0) |
|
283 | |||
284 | /** |
||
285 | * Get margin top |
||
286 | * |
||
287 | * @return int |
||
288 | */ |
||
289 | 12 | public function getMarginTop() |
|
293 | |||
294 | /** |
||
295 | * Set margin top |
||
296 | * |
||
297 | * @param int $pValue |
||
298 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
299 | */ |
||
300 | 2 | public function setMarginTop($pValue = 0) |
|
306 | |||
307 | /** |
||
308 | * Get margin bottom |
||
309 | * |
||
310 | * @return int |
||
311 | */ |
||
312 | 12 | public function getMarginBottom() |
|
316 | |||
317 | /** |
||
318 | * Set margin bottom |
||
319 | * |
||
320 | * @param int $pValue |
||
321 | * @return \PhpOffice\PhpPresentation\Style\Alignment |
||
322 | */ |
||
323 | 2 | public function setMarginBottom($pValue = 0) |
|
329 | |||
330 | /** |
||
331 | * @return string |
||
332 | */ |
||
333 | 12 | public function getTextDirection() |
|
337 | |||
338 | /** |
||
339 | * @param string $pValue |
||
340 | * @return Alignment |
||
341 | */ |
||
342 | 2 | public function setTextDirection($pValue = self::TEXT_DIRECTION_HORIZONTAL) |
|
350 | |||
351 | /** |
||
352 | * Get hash code |
||
353 | * |
||
354 | * @return string Hash code |
||
355 | */ |
||
356 | 59 | public function getHashCode() |
|
368 | |||
369 | /** |
||
370 | * Get hash index |
||
371 | * |
||
372 | * Note that this index may vary during script execution! Only reliable moment is |
||
373 | * while doing a write of a workbook and when changes are not allowed. |
||
374 | * |
||
375 | * @return string Hash index |
||
376 | */ |
||
377 | 1 | public function getHashIndex() |
|
381 | |||
382 | /** |
||
383 | * Set hash index |
||
384 | * |
||
385 | * Note that this index may vary during script execution! Only reliable moment is |
||
386 | * while doing a write of a workbook and when changes are not allowed. |
||
387 | * |
||
388 | * @param string $value Hash index |
||
389 | */ |
||
390 | 1 | public function setHashIndex($value) |
|
394 | } |
||
395 |