1 | <?php |
||
11 | class Style |
||
12 | { |
||
13 | /** Default font values */ |
||
14 | const DEFAULT_FONT_SIZE = 11; |
||
15 | const DEFAULT_FONT_COLOR = Color::BLACK; |
||
16 | const DEFAULT_FONT_NAME = 'Arial'; |
||
17 | |||
18 | /** @var int|null Style ID */ |
||
19 | private $id = null; |
||
20 | |||
21 | /** @var bool Whether the font should be bold */ |
||
22 | private $fontBold = false; |
||
23 | /** @var bool Whether the bold property was set */ |
||
24 | private $hasSetFontBold = false; |
||
25 | |||
26 | /** @var bool Whether the font should be italic */ |
||
27 | private $fontItalic = false; |
||
28 | /** @var bool Whether the italic property was set */ |
||
29 | private $hasSetFontItalic = false; |
||
30 | |||
31 | /** @var bool Whether the font should be underlined */ |
||
32 | private $fontUnderline = false; |
||
33 | /** @var bool Whether the underline property was set */ |
||
34 | private $hasSetFontUnderline = false; |
||
35 | |||
36 | /** @var bool Whether the font should be struck through */ |
||
37 | private $fontStrikethrough = false; |
||
38 | /** @var bool Whether the strikethrough property was set */ |
||
39 | private $hasSetFontStrikethrough = false; |
||
40 | |||
41 | /** @var int Font size */ |
||
42 | private $fontSize = self::DEFAULT_FONT_SIZE; |
||
43 | /** @var bool Whether the font size property was set */ |
||
44 | private $hasSetFontSize = false; |
||
45 | |||
46 | /** @var string Font color */ |
||
47 | private $fontColor = self::DEFAULT_FONT_COLOR; |
||
48 | /** @var bool Whether the font color property was set */ |
||
49 | private $hasSetFontColor = false; |
||
50 | |||
51 | /** @var string Font name */ |
||
52 | private $fontName = self::DEFAULT_FONT_NAME; |
||
53 | /** @var bool Whether the font name property was set */ |
||
54 | private $hasSetFontName = false; |
||
55 | |||
56 | /** @var bool Whether specific font properties should be applied */ |
||
57 | private $shouldApplyFont = false; |
||
58 | |||
59 | /** @var bool Whether the text should wrap in the cell (useful for long or multi-lines text) */ |
||
60 | private $shouldWrapText = false; |
||
61 | /** @var bool Whether the wrap text property was set */ |
||
62 | private $hasSetWrapText = false; |
||
63 | |||
64 | /** @var Border */ |
||
65 | private $border = null; |
||
66 | |||
67 | /** @var bool Whether border properties should be applied */ |
||
68 | private $shouldApplyBorder = false; |
||
69 | |||
70 | /** @var string Background color */ |
||
71 | private $backgroundColor = null; |
||
72 | |||
73 | /** @var bool */ |
||
74 | private $hasSetBackgroundColor = false; |
||
75 | |||
76 | |||
77 | /** |
||
78 | * @return int|null |
||
79 | */ |
||
80 | 101 | public function getId() |
|
84 | |||
85 | /** |
||
86 | * @param int $id |
||
87 | * @return Style |
||
88 | */ |
||
89 | 101 | public function setId($id) |
|
94 | |||
95 | /** |
||
96 | * @return Border |
||
97 | */ |
||
98 | 32 | public function getBorder() |
|
102 | |||
103 | /** |
||
104 | * @param Border $border |
||
105 | * @return Style |
||
106 | */ |
||
107 | 8 | public function setBorder(Border $border) |
|
113 | |||
114 | /** |
||
115 | * @return bool |
||
116 | */ |
||
117 | 98 | public function shouldApplyBorder() |
|
121 | |||
122 | /** |
||
123 | * @return bool |
||
124 | */ |
||
125 | 57 | public function isFontBold() |
|
129 | |||
130 | /** |
||
131 | * @return Style |
||
132 | */ |
||
133 | 16 | public function setFontBold() |
|
140 | |||
141 | /** |
||
142 | * @return bool |
||
143 | */ |
||
144 | 31 | public function hasSetFontBold() |
|
148 | |||
149 | /** |
||
150 | * @return bool |
||
151 | */ |
||
152 | 57 | public function isFontItalic() |
|
156 | |||
157 | /** |
||
158 | * @return Style |
||
159 | */ |
||
160 | 4 | public function setFontItalic() |
|
167 | |||
168 | /** |
||
169 | * @return bool |
||
170 | */ |
||
171 | 31 | public function hasSetFontItalic() |
|
175 | |||
176 | /** |
||
177 | * @return bool |
||
178 | */ |
||
179 | 57 | public function isFontUnderline() |
|
183 | |||
184 | /** |
||
185 | * @return Style |
||
186 | */ |
||
187 | 6 | public function setFontUnderline() |
|
194 | |||
195 | /** |
||
196 | * @return bool |
||
197 | */ |
||
198 | 31 | public function hasSetFontUnderline() |
|
202 | |||
203 | /** |
||
204 | * @return bool |
||
205 | */ |
||
206 | 57 | public function isFontStrikethrough() |
|
210 | |||
211 | /** |
||
212 | * @return Style |
||
213 | */ |
||
214 | 4 | public function setFontStrikethrough() |
|
221 | |||
222 | /** |
||
223 | * @return bool |
||
224 | */ |
||
225 | 31 | public function hasSetFontStrikethrough() |
|
229 | |||
230 | /** |
||
231 | * @return int |
||
232 | */ |
||
233 | 82 | public function getFontSize() |
|
237 | |||
238 | /** |
||
239 | * @param int $fontSize Font size, in pixels |
||
240 | * @return Style |
||
241 | */ |
||
242 | 57 | public function setFontSize($fontSize) |
|
249 | |||
250 | /** |
||
251 | * @return bool |
||
252 | */ |
||
253 | 31 | public function hasSetFontSize() |
|
257 | |||
258 | /** |
||
259 | * @return string |
||
260 | */ |
||
261 | 82 | public function getFontColor() |
|
265 | |||
266 | /** |
||
267 | * Sets the font color. |
||
268 | * |
||
269 | * @param string $fontColor ARGB color (@see Color) |
||
270 | * @return Style |
||
271 | */ |
||
272 | 2 | public function setFontColor($fontColor) |
|
279 | |||
280 | /** |
||
281 | * @return bool |
||
282 | */ |
||
283 | 31 | public function hasSetFontColor() |
|
287 | |||
288 | /** |
||
289 | * @return string |
||
290 | */ |
||
291 | 95 | public function getFontName() |
|
295 | |||
296 | /** |
||
297 | * @param string $fontName Name of the font to use |
||
298 | * @return Style |
||
299 | */ |
||
300 | 54 | public function setFontName($fontName) |
|
307 | |||
308 | /** |
||
309 | * @return bool |
||
310 | */ |
||
311 | 31 | public function hasSetFontName() |
|
315 | |||
316 | /** |
||
317 | * @return bool |
||
318 | */ |
||
319 | 86 | public function shouldWrapText() |
|
323 | |||
324 | /** |
||
325 | * @param bool|void $shouldWrap Should the text be wrapped |
||
326 | * @return Style |
||
327 | */ |
||
328 | 10 | public function setShouldWrapText($shouldWrap = true) |
|
334 | |||
335 | /** |
||
336 | * @return bool |
||
337 | */ |
||
338 | 80 | public function hasSetWrapText() |
|
342 | |||
343 | /** |
||
344 | * @return bool Whether specific font properties should be applied |
||
345 | */ |
||
346 | 70 | public function shouldApplyFont() |
|
350 | |||
351 | /** |
||
352 | * Sets the background color |
||
353 | * @param string $color ARGB color (@see Color) |
||
354 | * @return Style |
||
355 | */ |
||
356 | 6 | public function setBackgroundColor($color) |
|
362 | |||
363 | /** |
||
364 | * @return string |
||
365 | */ |
||
366 | 53 | public function getBackgroundColor() |
|
370 | |||
371 | /** |
||
372 | * |
||
373 | * @return bool Whether the background color should be applied |
||
374 | */ |
||
375 | 57 | public function shouldApplyBackgroundColor() |
|
379 | } |
||
380 |