1 | <?php |
||
14 | class StyleManager extends \Box\Spout\Writer\Common\Manager\Style\StyleManager |
||
15 | { |
||
16 | /** @var StyleRegistry */ |
||
17 | protected $styleRegistry; |
||
18 | |||
19 | /** |
||
20 | * Returns the content of the "styles.xml" file, given a list of styles. |
||
21 | * |
||
22 | * @param int $numWorksheets Number of worksheets created |
||
23 | * @return string |
||
24 | */ |
||
25 | 36 | public function getStylesXMLFileContent($numWorksheets) |
|
43 | |||
44 | /** |
||
45 | * Returns the content of the "<office:font-face-decls>" section, inside "styles.xml" file. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 36 | protected function getFontFaceSectionContent() |
|
59 | |||
60 | /** |
||
61 | * Returns the content of the "<office:styles>" section, inside "styles.xml" file. |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 36 | protected function getStylesSectionContent() |
|
83 | |||
84 | /** |
||
85 | * Returns the content of the "<office:automatic-styles>" section, inside "styles.xml" file. |
||
86 | * |
||
87 | * @param int $numWorksheets Number of worksheets created |
||
88 | * @return string |
||
89 | */ |
||
90 | 36 | protected function getAutomaticStylesSectionContent($numWorksheets) |
|
108 | |||
109 | /** |
||
110 | * Returns the content of the "<office:master-styles>" section, inside "styles.xml" file. |
||
111 | * |
||
112 | * @param int $numWorksheets Number of worksheets created |
||
113 | * @return string |
||
114 | */ |
||
115 | 36 | protected function getMasterStylesSectionContent($numWorksheets) |
|
134 | |||
135 | /** |
||
136 | * Returns the contents of the "<office:font-face-decls>" section, inside "content.xml" file. |
||
137 | * |
||
138 | * @return string |
||
139 | */ |
||
140 | 36 | public function getContentXmlFontFaceSectionContent() |
|
150 | |||
151 | /** |
||
152 | * Returns the contents of the "<office:automatic-styles>" section, inside "content.xml" file. |
||
153 | * |
||
154 | * @param Worksheet[] $worksheets |
||
155 | * @return string |
||
156 | */ |
||
157 | 36 | public function getContentXmlAutomaticStylesSectionContent($worksheets) |
|
189 | |||
190 | /** |
||
191 | * Returns the contents of the "<style:style>" section, inside "<office:automatic-styles>" section |
||
192 | * |
||
193 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
194 | * @return string |
||
195 | */ |
||
196 | 36 | protected function getStyleSectionContent($style) |
|
210 | |||
211 | /** |
||
212 | * Returns the contents of the "<style:text-properties>" section, inside "<style:style>" section |
||
213 | * |
||
214 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
215 | * @return string |
||
216 | */ |
||
217 | 36 | private function getTextPropertiesSectionContent($style) |
|
227 | |||
228 | /** |
||
229 | * Returns the contents of the fonts definition section, inside "<style:text-properties>" section |
||
230 | * |
||
231 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | 5 | private function getFontSectionContent($style) |
|
270 | |||
271 | /** |
||
272 | * Returns the contents of the "<style:paragraph-properties>" section, inside "<style:style>" section |
||
273 | * |
||
274 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
275 | * |
||
276 | * @return string |
||
277 | */ |
||
278 | 36 | private function getParagraphPropertiesSectionContent($style) |
|
288 | |||
289 | /** |
||
290 | * Returns the contents of the cell alignment definition for the "<style:paragraph-properties>" section |
||
291 | * |
||
292 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
293 | * |
||
294 | * @return string |
||
295 | */ |
||
296 | 1 | private function getCellAlignmentSectionContent($style) |
|
303 | |||
304 | /** |
||
305 | * Even though "left" and "right" alignments are part of the spec, and interpreted |
||
306 | * respectively as "start" and "end", using the recommended values increase compatibility |
||
307 | * with software that will read the created ODS file. |
||
308 | * |
||
309 | * @param string $cellAlignment |
||
310 | * |
||
311 | * @return string |
||
312 | */ |
||
313 | 1 | private function transformCellAlignment($cellAlignment) |
|
314 | { |
||
315 | 1 | switch ($cellAlignment) { |
|
316 | case CellAlignment::LEFT: return 'start'; |
||
317 | 1 | case CellAlignment::RIGHT: return 'end'; |
|
318 | default: return $cellAlignment; |
||
319 | } |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * Returns the contents of the "<style:table-cell-properties>" section, inside "<style:style>" section |
||
324 | * |
||
325 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
326 | * @return string |
||
327 | */ |
||
328 | 36 | private function getTableCellPropertiesSectionContent($style) |
|
348 | |||
349 | /** |
||
350 | * Returns the contents of the wrap text definition for the "<style:table-cell-properties>" section |
||
351 | * |
||
352 | * @return string |
||
353 | */ |
||
354 | 3 | private function getWrapTextXMLContent() |
|
358 | |||
359 | /** |
||
360 | * Returns the contents of the borders definition for the "<style:table-cell-properties>" section |
||
361 | * |
||
362 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
363 | * @return string |
||
364 | */ |
||
365 | 1 | private function getBorderXMLContent($style) |
|
373 | |||
374 | /** |
||
375 | * Returns the contents of the background color definition for the "<style:table-cell-properties>" section |
||
376 | * |
||
377 | * @param \Box\Spout\Common\Entity\Style\Style $style |
||
378 | * @return string |
||
379 | */ |
||
380 | 2 | private function getBackgroundColorXMLContent($style) |
|
384 | } |
||
385 |