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 | /** |
||
75 | * @return int|null |
||
76 | */ |
||
77 | 87 | public function getId() |
|
81 | |||
82 | /** |
||
83 | * @param int $id |
||
84 | * @return Style |
||
85 | */ |
||
86 | 87 | public function setId($id) |
|
92 | |||
93 | /** |
||
94 | * @return Border |
||
95 | */ |
||
96 | 73 | public function getBorder() |
|
100 | |||
101 | /** |
||
102 | * @param Border $border |
||
103 | * @return Style |
||
104 | */ |
||
105 | 8 | public function setBorder(Border $border) |
|
112 | |||
113 | /** |
||
114 | * @return bool |
||
115 | */ |
||
116 | 86 | public function shouldApplyBorder() |
|
120 | |||
121 | /** |
||
122 | * @return bool |
||
123 | */ |
||
124 | 76 | public function isFontBold() |
|
128 | |||
129 | /** |
||
130 | * @return Style |
||
131 | */ |
||
132 | 18 | public function setFontBold() |
|
140 | |||
141 | /** |
||
142 | * @return bool |
||
143 | */ |
||
144 | 72 | public function hasSetFontBold() |
|
148 | |||
149 | /** |
||
150 | * @return bool |
||
151 | */ |
||
152 | 76 | public function isFontItalic() |
|
156 | |||
157 | /** |
||
158 | * @return Style |
||
159 | */ |
||
160 | 6 | public function setFontItalic() |
|
168 | |||
169 | /** |
||
170 | * @return bool |
||
171 | */ |
||
172 | 72 | public function hasSetFontItalic() |
|
176 | |||
177 | /** |
||
178 | * @return bool |
||
179 | */ |
||
180 | 76 | public function isFontUnderline() |
|
184 | |||
185 | /** |
||
186 | * @return Style |
||
187 | */ |
||
188 | 7 | public function setFontUnderline() |
|
196 | |||
197 | /** |
||
198 | * @return bool |
||
199 | */ |
||
200 | 72 | public function hasSetFontUnderline() |
|
204 | |||
205 | /** |
||
206 | * @return bool |
||
207 | */ |
||
208 | 76 | public function isFontStrikethrough() |
|
212 | |||
213 | /** |
||
214 | * @return Style |
||
215 | */ |
||
216 | 4 | public function setFontStrikethrough() |
|
224 | |||
225 | /** |
||
226 | * @return bool |
||
227 | */ |
||
228 | 72 | public function hasSetFontStrikethrough() |
|
232 | |||
233 | /** |
||
234 | * @return int |
||
235 | */ |
||
236 | 79 | public function getFontSize() |
|
240 | |||
241 | /** |
||
242 | * @param int $fontSize Font size, in pixels |
||
243 | * @return Style |
||
244 | */ |
||
245 | 51 | public function setFontSize($fontSize) |
|
253 | |||
254 | /** |
||
255 | * @return bool |
||
256 | */ |
||
257 | 72 | public function hasSetFontSize() |
|
261 | |||
262 | /** |
||
263 | * @return string |
||
264 | */ |
||
265 | 79 | public function getFontColor() |
|
269 | |||
270 | /** |
||
271 | * Sets the font color. |
||
272 | * |
||
273 | * @param string $fontColor ARGB color (@see Color) |
||
274 | * @return Style |
||
275 | */ |
||
276 | 3 | public function setFontColor($fontColor) |
|
284 | |||
285 | /** |
||
286 | * @return bool |
||
287 | */ |
||
288 | 72 | public function hasSetFontColor() |
|
292 | |||
293 | /** |
||
294 | * @return string |
||
295 | */ |
||
296 | 83 | public function getFontName() |
|
300 | |||
301 | /** |
||
302 | * @param string $fontName Name of the font to use |
||
303 | * @return Style |
||
304 | */ |
||
305 | 49 | public function setFontName($fontName) |
|
313 | |||
314 | /** |
||
315 | * @return bool |
||
316 | */ |
||
317 | 72 | public function hasSetFontName() |
|
321 | |||
322 | /** |
||
323 | * @return bool |
||
324 | */ |
||
325 | 81 | public function shouldWrapText() |
|
329 | |||
330 | /** |
||
331 | * @param bool $shouldWrap Should the text be wrapped |
||
332 | * @return Style |
||
333 | */ |
||
334 | 8 | public function setShouldWrapText($shouldWrap = true) |
|
341 | |||
342 | /** |
||
343 | * @return bool |
||
344 | */ |
||
345 | 74 | public function hasSetWrapText() |
|
349 | |||
350 | /** |
||
351 | * @return bool Whether specific font properties should be applied |
||
352 | */ |
||
353 | 70 | public function shouldApplyFont() |
|
357 | |||
358 | /** |
||
359 | * Sets the background color |
||
360 | * @param string $color ARGB color (@see Color) |
||
361 | * @return Style |
||
362 | */ |
||
363 | 7 | public function setBackgroundColor($color) |
|
370 | |||
371 | /** |
||
372 | * @return string |
||
373 | */ |
||
374 | 45 | public function getBackgroundColor() |
|
378 | |||
379 | /** |
||
380 | * @return bool Whether the background color should be applied |
||
381 | */ |
||
382 | 75 | public function shouldApplyBackgroundColor() |
|
386 | } |
||
387 |