1 | <?php |
||
9 | class Style |
||
10 | { |
||
11 | /** Default font values */ |
||
12 | const DEFAULT_FONT_SIZE = 11; |
||
13 | const DEFAULT_FONT_COLOR = Color::BLACK; |
||
14 | const DEFAULT_FONT_NAME = 'Arial'; |
||
15 | |||
16 | /** @var int|null Style ID */ |
||
17 | private $id; |
||
18 | |||
19 | /** @var bool Whether the font should be bold */ |
||
20 | private $fontBold = false; |
||
21 | /** @var bool Whether the bold property was set */ |
||
22 | private $hasSetFontBold = false; |
||
23 | |||
24 | /** @var bool Whether the font should be italic */ |
||
25 | private $fontItalic = false; |
||
26 | /** @var bool Whether the italic property was set */ |
||
27 | private $hasSetFontItalic = false; |
||
28 | |||
29 | /** @var bool Whether the font should be underlined */ |
||
30 | private $fontUnderline = false; |
||
31 | /** @var bool Whether the underline property was set */ |
||
32 | private $hasSetFontUnderline = false; |
||
33 | |||
34 | /** @var bool Whether the font should be struck through */ |
||
35 | private $fontStrikethrough = false; |
||
36 | /** @var bool Whether the strikethrough property was set */ |
||
37 | private $hasSetFontStrikethrough = false; |
||
38 | |||
39 | /** @var int Font size */ |
||
40 | private $fontSize = self::DEFAULT_FONT_SIZE; |
||
41 | /** @var bool Whether the font size property was set */ |
||
42 | private $hasSetFontSize = false; |
||
43 | |||
44 | /** @var string Font color */ |
||
45 | private $fontColor = self::DEFAULT_FONT_COLOR; |
||
46 | /** @var bool Whether the font color property was set */ |
||
47 | private $hasSetFontColor = false; |
||
48 | |||
49 | /** @var string Font name */ |
||
50 | private $fontName = self::DEFAULT_FONT_NAME; |
||
51 | /** @var bool Whether the font name property was set */ |
||
52 | private $hasSetFontName = false; |
||
53 | |||
54 | /** @var bool Whether specific font properties should be applied */ |
||
55 | private $shouldApplyFont = false; |
||
56 | |||
57 | /** @var bool Whether the text should wrap in the cell (useful for long or multi-lines text) */ |
||
58 | private $shouldWrapText = false; |
||
59 | /** @var bool Whether the wrap text property was set */ |
||
60 | private $hasSetWrapText = false; |
||
61 | |||
62 | /** @var Border */ |
||
63 | private $border; |
||
64 | |||
65 | /** @var bool Whether border properties should be applied */ |
||
66 | private $shouldApplyBorder = false; |
||
67 | |||
68 | /** @var string Background color */ |
||
69 | private $backgroundColor; |
||
70 | |||
71 | /** @var bool */ |
||
72 | private $hasSetBackgroundColor = false; |
||
73 | |||
74 | /** @var string Format */ |
||
75 | private $format; |
||
76 | |||
77 | /** @var bool */ |
||
78 | private $hasSetFormat = false; |
||
79 | |||
80 | /** |
||
81 | * @return int|null |
||
82 | */ |
||
83 | 87 | public function getId() |
|
87 | |||
88 | /** |
||
89 | * @param int $id |
||
90 | * @return Style |
||
91 | */ |
||
92 | 87 | public function setId($id) |
|
98 | |||
99 | /** |
||
100 | * @return Border |
||
101 | */ |
||
102 | 75 | public function getBorder() |
|
106 | |||
107 | /** |
||
108 | * @param Border $border |
||
109 | * @return Style |
||
110 | */ |
||
111 | 8 | public function setBorder(Border $border) |
|
118 | |||
119 | /** |
||
120 | * @return bool |
||
121 | */ |
||
122 | 87 | public function shouldApplyBorder() |
|
126 | |||
127 | /** |
||
128 | * @return bool |
||
129 | */ |
||
130 | 77 | public function isFontBold() |
|
134 | |||
135 | /** |
||
136 | * @return Style |
||
137 | */ |
||
138 | 21 | public function setFontBold() |
|
146 | |||
147 | /** |
||
148 | * @return bool |
||
149 | */ |
||
150 | 74 | public function hasSetFontBold() |
|
154 | |||
155 | /** |
||
156 | * @return bool |
||
157 | */ |
||
158 | 77 | public function isFontItalic() |
|
162 | |||
163 | /** |
||
164 | * @return Style |
||
165 | */ |
||
166 | 7 | public function setFontItalic() |
|
174 | |||
175 | /** |
||
176 | * @return bool |
||
177 | */ |
||
178 | 74 | public function hasSetFontItalic() |
|
182 | |||
183 | /** |
||
184 | * @return bool |
||
185 | */ |
||
186 | 77 | public function isFontUnderline() |
|
190 | |||
191 | /** |
||
192 | * @return Style |
||
193 | */ |
||
194 | 7 | public function setFontUnderline() |
|
202 | |||
203 | /** |
||
204 | * @return bool |
||
205 | */ |
||
206 | 74 | public function hasSetFontUnderline() |
|
210 | |||
211 | /** |
||
212 | * @return bool |
||
213 | */ |
||
214 | 77 | public function isFontStrikethrough() |
|
218 | |||
219 | /** |
||
220 | * @return Style |
||
221 | */ |
||
222 | 4 | public function setFontStrikethrough() |
|
230 | |||
231 | /** |
||
232 | * @return bool |
||
233 | */ |
||
234 | 74 | public function hasSetFontStrikethrough() |
|
238 | |||
239 | /** |
||
240 | * @return int |
||
241 | */ |
||
242 | 79 | public function getFontSize() |
|
246 | |||
247 | /** |
||
248 | * @param int $fontSize Font size, in pixels |
||
249 | * @return Style |
||
250 | */ |
||
251 | 52 | public function setFontSize($fontSize) |
|
259 | |||
260 | /** |
||
261 | * @return bool |
||
262 | */ |
||
263 | 74 | public function hasSetFontSize() |
|
267 | |||
268 | /** |
||
269 | * @return string |
||
270 | */ |
||
271 | 79 | public function getFontColor() |
|
275 | |||
276 | /** |
||
277 | * Sets the font color. |
||
278 | * |
||
279 | * @param string $fontColor ARGB color (@see Color) |
||
280 | * @return Style |
||
281 | */ |
||
282 | 3 | public function setFontColor($fontColor) |
|
290 | |||
291 | /** |
||
292 | * @return bool |
||
293 | */ |
||
294 | 74 | public function hasSetFontColor() |
|
298 | |||
299 | /** |
||
300 | * @return string |
||
301 | */ |
||
302 | 83 | public function getFontName() |
|
306 | |||
307 | /** |
||
308 | * @param string $fontName Name of the font to use |
||
309 | * @return Style |
||
310 | */ |
||
311 | 50 | public function setFontName($fontName) |
|
319 | |||
320 | /** |
||
321 | * @return bool |
||
322 | */ |
||
323 | 74 | public function hasSetFontName() |
|
327 | |||
328 | /** |
||
329 | * @return bool |
||
330 | */ |
||
331 | 81 | public function shouldWrapText() |
|
335 | |||
336 | /** |
||
337 | * @param bool $shouldWrap Should the text be wrapped |
||
338 | * @return Style |
||
339 | */ |
||
340 | 8 | public function setShouldWrapText($shouldWrap = true) |
|
347 | |||
348 | /** |
||
349 | * @return bool |
||
350 | */ |
||
351 | 76 | public function hasSetWrapText() |
|
355 | |||
356 | /** |
||
357 | * @return bool Whether specific font properties should be applied |
||
358 | */ |
||
359 | 69 | public function shouldApplyFont() |
|
363 | |||
364 | /** |
||
365 | * Sets the background color |
||
366 | * @param string $color ARGB color (@see Color) |
||
367 | * @return Style |
||
368 | */ |
||
369 | 7 | public function setBackgroundColor($color) |
|
376 | |||
377 | /** |
||
378 | * @return string |
||
379 | */ |
||
380 | 46 | public function getBackgroundColor() |
|
384 | |||
385 | /** |
||
386 | * @return bool Whether the background color should be applied |
||
387 | */ |
||
388 | 76 | public function shouldApplyBackgroundColor() |
|
392 | |||
393 | /** |
||
394 | * Sets format |
||
395 | * @param string $format |
||
396 | * @return Style |
||
397 | */ |
||
398 | 3 | public function setFormat($format) |
|
405 | |||
406 | /** |
||
407 | * @return string |
||
408 | */ |
||
409 | 84 | public function getFormat() |
|
413 | |||
414 | /** |
||
415 | * @return bool Whether format should be applied |
||
416 | */ |
||
417 | 74 | public function shouldApplyFormat() |
|
421 | } |
||
422 |