Complex classes like Content often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Content, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 29 | class Content extends AbstractDecoratorWriter |
||
| 30 | { |
||
| 31 | /** |
||
| 32 | * Stores bullet styles for text shapes that include lists. |
||
| 33 | * |
||
| 34 | * @var [] |
||
| 35 | */ |
||
| 36 | protected $arrStyleBullet = array(); |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Stores paragraph information for text shapes. |
||
| 40 | * |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | protected $arrStyleParagraph = array(); |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Stores font styles for text shapes that include lists. |
||
| 47 | * |
||
| 48 | * @var Run[] |
||
| 49 | */ |
||
| 50 | protected $arrStyleTextFont = array(); |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Used to track the current shape ID. |
||
| 54 | * |
||
| 55 | * @var integer |
||
| 56 | */ |
||
| 57 | protected $shapeId; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return ZipInterface |
||
| 61 | * @throws \Exception |
||
| 62 | */ |
||
| 63 | 41 | public function render() |
|
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | /** |
||
| 72 | * Write content file to XML format |
||
| 73 | * |
||
| 74 | * @return string XML Output |
||
| 75 | * @throws \Exception |
||
| 76 | */ |
||
| 77 | 41 | public function writeContent() |
|
| 78 | { |
||
| 79 | // Create XML writer |
||
| 80 | 41 | $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
|
| 81 | 41 | $objWriter->startDocument('1.0', 'UTF-8'); |
|
| 82 | |||
| 83 | // office:document-content |
||
| 84 | 41 | $objWriter->startElement('office:document-content'); |
|
| 85 | 41 | $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|
| 86 | 41 | $objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); |
|
| 87 | 41 | $objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); |
|
| 88 | 41 | $objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); |
|
| 89 | 41 | $objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); |
|
| 90 | 41 | $objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); |
|
| 91 | 41 | $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|
| 92 | 41 | $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
| 93 | 41 | $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|
| 94 | 41 | $objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); |
|
| 95 | 41 | $objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); |
|
| 96 | 41 | $objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); |
|
| 97 | 41 | $objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); |
|
| 98 | 41 | $objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); |
|
| 99 | 41 | $objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); |
|
| 100 | 41 | $objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); |
|
| 101 | 41 | $objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); |
|
| 102 | 41 | $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|
| 103 | 41 | $objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); |
|
| 104 | 41 | $objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); |
|
| 105 | 41 | $objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); |
|
| 106 | 41 | $objWriter->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms'); |
|
| 107 | 41 | $objWriter->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); |
|
| 108 | 41 | $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 109 | 41 | $objWriter->writeAttribute('xmlns:smil', 'urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0'); |
|
| 110 | 41 | $objWriter->writeAttribute('xmlns:anim', 'urn:oasis:names:tc:opendocument:xmlns:animation:1.0'); |
|
| 111 | 41 | $objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); |
|
| 112 | 41 | $objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); |
|
| 113 | 41 | $objWriter->writeAttribute('xmlns:rdfa', 'http://docs.oasis-open.org/opendocument/meta/rdfa#'); |
|
| 114 | 41 | $objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0'); |
|
| 115 | 41 | $objWriter->writeAttribute('xmlns:officeooo', 'http://openoffice.org/2009/office'); |
|
| 116 | 41 | $objWriter->writeAttribute('office:version', '1.2'); |
|
| 117 | |||
| 118 | // office:automatic-styles |
||
| 119 | 41 | $objWriter->startElement('office:automatic-styles'); |
|
| 120 | |||
| 121 | 41 | $this->shapeId = 0; |
|
| 122 | 41 | $incSlide = 0; |
|
| 123 | 41 | foreach ($this->getPresentation()->getAllSlides() as $pSlide) { |
|
| 124 | // Slides |
||
| 125 | 41 | $this->writeStyleSlide($objWriter, $pSlide, $incSlide); |
|
| 126 | |||
| 127 | // Images |
||
| 128 | 41 | $shapes = $pSlide->getShapeCollection(); |
|
| 129 | 41 | foreach ($shapes as $shape) { |
|
| 130 | // Increment $this->shapeId |
||
| 131 | 33 | ++$this->shapeId; |
|
| 132 | |||
| 133 | // Check type |
||
| 134 | 33 | if ($shape instanceof RichText) { |
|
| 135 | 13 | $this->writeTxtStyle($objWriter, $shape); |
|
| 136 | } |
||
| 137 | 33 | if ($shape instanceof AbstractDrawingAdapter) { |
|
| 138 | 9 | $this->writeDrawingStyle($objWriter, $shape); |
|
| 139 | } |
||
| 140 | 33 | if ($shape instanceof Line) { |
|
| 141 | $this->writeLineStyle($objWriter, $shape); |
||
| 142 | } |
||
| 143 | 33 | if ($shape instanceof Table) { |
|
| 144 | 7 | $this->writeTableStyle($objWriter, $shape); |
|
| 145 | } |
||
| 146 | 33 | if ($shape instanceof Group) { |
|
| 147 | 33 | $this->writeGroupStyle($objWriter, $shape); |
|
| 148 | } |
||
| 149 | } |
||
| 150 | |||
| 151 | 41 | $incSlide++; |
|
| 152 | } |
||
| 153 | // Style : Bullet |
||
| 154 | 41 | if (!empty($this->arrStyleBullet)) { |
|
| 155 | 13 | foreach ($this->arrStyleBullet as $key => $item) { |
|
| 156 | 13 | $oStyle = $item['oStyle']; |
|
| 157 | 13 | $arrLevel = explode(';', $item['level']); |
|
| 158 | // style:style |
||
| 159 | 13 | $objWriter->startElement('text:list-style'); |
|
| 160 | 13 | $objWriter->writeAttribute('style:name', 'L_' . $key); |
|
| 161 | 13 | foreach ($arrLevel as $level) { |
|
| 162 | 13 | if ($level != '') { |
|
| 163 | 13 | $oAlign = $item['oAlign_' . $level]; |
|
| 164 | // text:list-level-style-bullet |
||
| 165 | 13 | $objWriter->startElement('text:list-level-style-bullet'); |
|
| 166 | 13 | $objWriter->writeAttribute('text:level', $level + 1); |
|
| 167 | 13 | $objWriter->writeAttribute('text:bullet-char', $oStyle->getBulletChar()); |
|
| 168 | // style:list-level-properties |
||
| 169 | 13 | $objWriter->startElement('style:list-level-properties'); |
|
| 170 | 13 | if ($oAlign->getIndent() < 0) { |
|
| 171 | 1 | $objWriter->writeAttribute('text:space-before', CommonDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - (-1 * $oAlign->getIndent())) . 'cm'); |
|
| 172 | 1 | $objWriter->writeAttribute('text:min-label-width', CommonDrawing::pixelsToCentimeters(-1 * $oAlign->getIndent()) . 'cm'); |
|
| 173 | } else { |
||
| 174 | 12 | $objWriter->writeAttribute('text:space-before', (CommonDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - $oAlign->getIndent())) . 'cm'); |
|
| 175 | 12 | $objWriter->writeAttribute('text:min-label-width', CommonDrawing::pixelsToCentimeters($oAlign->getIndent()) . 'cm'); |
|
| 176 | } |
||
| 177 | |||
| 178 | 13 | $objWriter->endElement(); |
|
| 179 | // style:text-properties |
||
| 180 | 13 | $objWriter->startElement('style:text-properties'); |
|
| 181 | 13 | $objWriter->writeAttribute('fo:font-family', $oStyle->getBulletFont()); |
|
| 182 | 13 | $objWriter->writeAttribute('style:font-family-generic', 'swiss'); |
|
| 183 | 13 | $objWriter->writeAttribute('style:use-window-font-color', 'true'); |
|
| 184 | 13 | $objWriter->writeAttribute('fo:font-size', '100%'); |
|
| 185 | 13 | $objWriter->endElement(); |
|
| 186 | 13 | $objWriter->endElement(); |
|
| 187 | } |
||
| 188 | } |
||
| 189 | 13 | $objWriter->endElement(); |
|
| 190 | } |
||
| 191 | } |
||
| 192 | // Style : Paragraph |
||
| 193 | 41 | if (!empty($this->arrStyleParagraph)) { |
|
| 194 | 13 | foreach ($this->arrStyleParagraph as $key => $item) { |
|
| 195 | // style:style |
||
| 196 | 13 | $objWriter->startElement('style:style'); |
|
| 197 | 13 | $objWriter->writeAttribute('style:name', 'P_' . $key); |
|
| 198 | 13 | $objWriter->writeAttribute('style:family', 'paragraph'); |
|
| 199 | // style:paragraph-properties |
||
| 200 | 13 | $objWriter->startElement('style:paragraph-properties'); |
|
| 201 | 13 | switch ($item->getAlignment()->getHorizontal()) { |
|
| 202 | 13 | case Alignment::HORIZONTAL_LEFT: |
|
| 203 | 13 | $objWriter->writeAttribute('fo:text-align', 'left'); |
|
| 204 | 13 | break; |
|
| 205 | 1 | case Alignment::HORIZONTAL_RIGHT: |
|
| 206 | 1 | $objWriter->writeAttribute('fo:text-align', 'right'); |
|
| 207 | 1 | break; |
|
| 208 | 1 | case Alignment::HORIZONTAL_CENTER: |
|
| 209 | 1 | $objWriter->writeAttribute('fo:text-align', 'center'); |
|
| 210 | 1 | break; |
|
| 211 | 1 | case Alignment::HORIZONTAL_JUSTIFY: |
|
| 212 | 1 | $objWriter->writeAttribute('fo:text-align', 'justify'); |
|
| 213 | 1 | break; |
|
| 214 | 1 | case Alignment::HORIZONTAL_DISTRIBUTED: |
|
| 215 | 1 | $objWriter->writeAttribute('fo:text-align', 'justify'); |
|
| 216 | 1 | break; |
|
| 217 | default: |
||
| 218 | 1 | $objWriter->writeAttribute('fo:text-align', 'left'); |
|
| 219 | 1 | break; |
|
| 220 | } |
||
| 221 | 13 | $objWriter->endElement(); |
|
| 222 | 13 | $objWriter->endElement(); |
|
| 223 | } |
||
| 224 | } |
||
| 225 | // Style : Text : Font |
||
| 226 | 41 | if (!empty($this->arrStyleTextFont)) { |
|
| 227 | 10 | foreach ($this->arrStyleTextFont as $key => $item) { |
|
| 228 | // style:style |
||
| 229 | 10 | $objWriter->startElement('style:style'); |
|
| 230 | 10 | $objWriter->writeAttribute('style:name', 'T_' . $key); |
|
| 231 | 10 | $objWriter->writeAttribute('style:family', 'text'); |
|
| 232 | // style:text-properties |
||
| 233 | 10 | $objWriter->startElement('style:text-properties'); |
|
| 234 | 10 | $objWriter->writeAttribute('fo:color', '#' . $item->getFont()->getColor()->getRGB()); |
|
| 235 | 10 | $objWriter->writeAttribute('fo:font-family', $item->getFont()->getName()); |
|
| 236 | 10 | $objWriter->writeAttribute('fo:font-size', $item->getFont()->getSize() . 'pt'); |
|
| 237 | // @todo : fo:font-style |
||
| 238 | 10 | if ($item->getFont()->isBold()) { |
|
| 239 | 1 | $objWriter->writeAttribute('fo:font-weight', 'bold'); |
|
| 240 | } |
||
| 241 | 10 | $objWriter->writeAttribute('fo:language', ($item->getLanguage() ? $item->getLanguage() : 'en')); |
|
| 242 | |||
| 243 | // @todo : style:text-underline-style |
||
| 244 | 10 | $objWriter->endElement(); |
|
| 245 | 10 | $objWriter->endElement(); |
|
| 246 | } |
||
| 247 | } |
||
| 248 | 41 | $objWriter->endElement(); |
|
| 249 | |||
| 250 | //=============================================== |
||
| 251 | // Body |
||
| 252 | //=============================================== |
||
| 253 | // office:body |
||
| 254 | 41 | $objWriter->startElement('office:body'); |
|
| 255 | // office:presentation |
||
| 256 | 41 | $objWriter->startElement('office:presentation'); |
|
| 257 | |||
| 258 | // Write slides |
||
| 259 | 41 | $slideCount = $this->getPresentation()->getSlideCount(); |
|
| 260 | 41 | $this->shapeId = 0; |
|
| 261 | 41 | for ($i = 0; $i < $slideCount; ++$i) { |
|
| 262 | 41 | $pSlide = $this->getPresentation()->getSlide($i); |
|
| 263 | 41 | $objWriter->startElement('draw:page'); |
|
| 264 | 41 | $name = $pSlide->getName(); |
|
| 265 | 41 | if (!is_null($name)) { |
|
| 266 | 1 | $objWriter->writeAttribute('draw:name', $name); |
|
| 267 | } |
||
| 268 | 41 | $objWriter->writeAttribute('draw:master-page-name', 'Standard'); |
|
| 269 | 41 | $objWriter->writeAttribute('draw:style-name', 'stylePage' . $i); |
|
| 270 | // Images |
||
| 271 | 41 | $shapes = $pSlide->getShapeCollection(); |
|
| 272 | 41 | foreach ($shapes as $shape) { |
|
| 273 | // Increment $this->shapeId |
||
| 274 | 33 | ++$this->shapeId; |
|
| 275 | |||
| 276 | // Check type |
||
| 277 | 33 | if ($shape instanceof RichText) { |
|
| 278 | 13 | $this->writeShapeTxt($objWriter, $shape); |
|
| 279 | 20 | } elseif ($shape instanceof Table) { |
|
| 280 | 7 | $this->writeShapeTable($objWriter, $shape); |
|
| 281 | 13 | } elseif ($shape instanceof Line) { |
|
| 282 | $this->writeShapeLine($objWriter, $shape); |
||
| 283 | 13 | } elseif ($shape instanceof Chart) { |
|
| 284 | 1 | $this->writeShapeChart($objWriter, $shape); |
|
| 285 | 12 | } elseif ($shape instanceof Media) { |
|
| 286 | 1 | $this->writeShapeMedia($objWriter, $shape); |
|
| 287 | 11 | } elseif ($shape instanceof AbstractDrawingAdapter) { |
|
| 288 | 8 | $this->writeShapeDrawing($objWriter, $shape); |
|
| 289 | 3 | } elseif ($shape instanceof Group) { |
|
| 290 | 1 | $this->writeShapeGroup($objWriter, $shape); |
|
| 291 | 2 | } elseif ($shape instanceof Comment) { |
|
| 292 | 33 | $this->writeShapeComment($objWriter, $shape); |
|
| 293 | } |
||
| 294 | } |
||
| 295 | // Slide Note |
||
| 296 | 41 | if ($pSlide->getNote() instanceof Note) { |
|
| 297 | 41 | $this->writeSlideNote($objWriter, $pSlide->getNote()); |
|
| 298 | } |
||
| 299 | |||
| 300 | 41 | $objWriter->endElement(); |
|
| 301 | } |
||
| 302 | |||
| 303 | 41 | if ($this->getPresentation()->getPresentationProperties()->isLoopContinuouslyUntilEsc()) { |
|
| 304 | $objWriter->startElement('presentation:settings'); |
||
| 305 | $objWriter->writeAttribute('presentation:endless', 'true'); |
||
| 306 | $objWriter->writeAttribute('presentation:pause', 'P0s'); |
||
| 307 | $objWriter->writeAttribute('presentation:mouse-visible', 'false'); |
||
| 308 | $objWriter->endElement(); |
||
| 309 | } |
||
| 310 | // > office:presentation |
||
| 311 | 41 | $objWriter->endElement(); |
|
| 312 | // > office:body |
||
| 313 | 41 | $objWriter->endElement(); |
|
| 314 | // > office:document-content |
||
| 315 | 41 | $objWriter->endElement(); |
|
| 316 | |||
| 317 | // Return |
||
| 318 | 41 | return $objWriter->getData(); |
|
| 319 | } |
||
| 320 | |||
| 321 | /** |
||
| 322 | * Write picture |
||
| 323 | * |
||
| 324 | * @param \PhpOffice\Common\XMLWriter $objWriter |
||
| 325 | * @param \PhpOffice\PhpPresentation\Shape\Media $shape |
||
| 326 | */ |
||
| 327 | 1 | public function writeShapeMedia(XMLWriter $objWriter, Media $shape) |
|
| 368 | |||
| 369 | /** |
||
| 370 | * Write picture |
||
| 371 | * |
||
| 372 | * @param \PhpOffice\Common\XMLWriter $objWriter |
||
| 373 | * @param AbstractDrawingAdapter $shape |
||
| 374 | * @throws \Exception |
||
| 375 | */ |
||
| 376 | 9 | public function writeShapeDrawing(XMLWriter $objWriter, ShapeDrawing\AbstractDrawingAdapter $shape) |
|
| 416 | |||
| 417 | /** |
||
| 418 | * Write text |
||
| 419 | * |
||
| 420 | * @param \PhpOffice\Common\XMLWriter $objWriter |
||
| 421 | * @param \PhpOffice\PhpPresentation\Shape\RichText $shape |
||
| 422 | * @throws \Exception |
||
| 423 | */ |
||
| 424 | 14 | public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) |
|
| 577 | /** |
||
| 578 | * Write Comment |
||
| 579 | * @param XMLWriter $objWriter |
||
| 580 | * @param Comment $oShape |
||
| 581 | */ |
||
| 582 | 2 | public function writeShapeComment(XMLWriter $objWriter, Comment $oShape) |
|
| 601 | |||
| 602 | /** |
||
| 603 | * @param XMLWriter $objWriter |
||
| 604 | * @param Line $shape |
||
| 605 | */ |
||
| 606 | public function writeShapeLine(XMLWriter $objWriter, Line $shape) |
||
| 607 | { |
||
| 608 | // draw:line |
||
| 609 | $objWriter->startElement('draw:line'); |
||
| 610 | $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); |
||
| 611 | $objWriter->writeAttribute('svg:x1', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); |
||
| 612 | $objWriter->writeAttribute('svg:y1', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); |
||
| 613 | $objWriter->writeAttribute('svg:x2', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()+$shape->getWidth()), 3) . 'cm'); |
||
| 614 | $objWriter->writeAttribute('svg:y2', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()+$shape->getHeight()), 3) . 'cm'); |
||
| 615 | |||
| 616 | // text:p |
||
| 617 | $objWriter->writeElement('text:p'); |
||
| 618 | |||
| 619 | $objWriter->endElement(); |
||
| 620 | } |
||
| 621 | |||
| 622 | /** |
||
| 623 | * Write table Shape |
||
| 624 | * @param XMLWriter $objWriter |
||
| 625 | * @param Table $shape |
||
| 626 | * @throws \Exception |
||
| 627 | */ |
||
| 628 | 7 | public function writeShapeTable(XMLWriter $objWriter, Table $shape) |
|
| 718 | |||
| 719 | /** |
||
| 720 | * Write table Chart |
||
| 721 | * @param XMLWriter $objWriter |
||
| 722 | * @param Chart $shape |
||
| 723 | * @throws \Exception |
||
| 724 | */ |
||
| 725 | 1 | public function writeShapeChart(XMLWriter $objWriter, Chart $shape) |
|
| 750 | |||
| 751 | /** |
||
| 752 | * Writes a group of shapes |
||
| 753 | * |
||
| 754 | * @param XMLWriter $objWriter |
||
| 755 | * @param Group $group |
||
| 756 | * @throws \Exception |
||
| 757 | */ |
||
| 758 | 1 | public function writeShapeGroup(XMLWriter $objWriter, Group $group) |
|
| 786 | |||
| 787 | /** |
||
| 788 | * Writes the style information for a group of shapes |
||
| 789 | * |
||
| 790 | * @param XMLWriter $objWriter |
||
| 791 | * @param Group $group |
||
| 792 | */ |
||
| 793 | 1 | public function writeGroupStyle(XMLWriter $objWriter, Group $group) |
|
| 815 | |||
| 816 | /** |
||
| 817 | * Write the default style information for a RichText shape |
||
| 818 | * |
||
| 819 | * @param \PhpOffice\Common\XMLWriter $objWriter |
||
| 820 | * @param \PhpOffice\PhpPresentation\Shape\RichText $shape |
||
| 821 | */ |
||
| 822 | 13 | public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) |
|
| 823 | { |
||
| 824 | // style:style |
||
| 825 | 13 | $objWriter->startElement('style:style'); |
|
| 826 | 13 | $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); |
|
| 827 | 13 | $objWriter->writeAttribute('style:family', 'graphic'); |
|
| 828 | 13 | $objWriter->writeAttribute('style:parent-style-name', 'standard'); |
|
| 829 | // style:graphic-properties |
||
| 830 | 13 | $objWriter->startElement('style:graphic-properties'); |
|
| 831 | 13 | $objWriter->writeAttribute('style:mirror', 'none'); |
|
| 832 | 13 | $this->writeStylePartShadow($objWriter, $shape->getShadow()); |
|
| 833 | 13 | if (is_bool($shape->hasAutoShrinkVertical())) { |
|
| 834 | 1 | $objWriter->writeAttribute('draw:auto-grow-height', var_export($shape->hasAutoShrinkVertical(), true)); |
|
| 835 | } |
||
| 836 | 13 | if (is_bool($shape->hasAutoShrinkHorizontal())) { |
|
| 837 | 1 | $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); |
|
| 838 | } |
||
| 839 | // Fill |
||
| 840 | 13 | switch ($shape->getFill()->getFillType()) { |
|
| 841 | 13 | case Fill::FILL_GRADIENT_LINEAR: |
|
| 842 | 12 | case Fill::FILL_GRADIENT_PATH: |
|
| 843 | 1 | $objWriter->writeAttribute('draw:fill', 'gradient'); |
|
| 844 | 1 | $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_'.$shape->getFill()->getHashCode()); |
|
| 845 | 1 | break; |
|
| 846 | 12 | case Fill::FILL_SOLID: |
|
| 847 | 1 | $objWriter->writeAttribute('draw:fill', 'solid'); |
|
| 848 | 1 | $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); |
|
| 849 | 1 | break; |
|
| 850 | 11 | case Fill::FILL_NONE: |
|
| 851 | default: |
||
| 852 | 11 | $objWriter->writeAttribute('draw:fill', 'none'); |
|
| 853 | 11 | $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); |
|
| 854 | 11 | break; |
|
| 855 | } |
||
| 856 | // Border |
||
| 857 | 13 | if ($shape->getBorder()->getLineStyle() == Border::LINE_NONE) { |
|
| 858 | 12 | $objWriter->writeAttribute('draw:stroke', 'none'); |
|
| 859 | } else { |
||
| 860 | 2 | $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); |
|
| 861 | 2 | $objWriter->writeAttribute('svg:stroke-width', number_format(CommonDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '').'cm'); |
|
| 862 | 2 | switch ($shape->getBorder()->getDashStyle()) { |
|
| 863 | 2 | case Border::DASH_SOLID: |
|
| 864 | 1 | $objWriter->writeAttribute('draw:stroke', 'solid'); |
|
| 865 | 1 | break; |
|
| 866 | 2 | case Border::DASH_DASH: |
|
| 867 | 1 | case Border::DASH_DASHDOT: |
|
| 868 | 1 | case Border::DASH_DOT: |
|
| 869 | 1 | case Border::DASH_LARGEDASH: |
|
| 870 | 1 | case Border::DASH_LARGEDASHDOT: |
|
| 871 | 1 | case Border::DASH_LARGEDASHDOTDOT: |
|
| 872 | 1 | case Border::DASH_SYSDASH: |
|
| 873 | 1 | case Border::DASH_SYSDASHDOT: |
|
| 874 | 1 | case Border::DASH_SYSDASHDOTDOT: |
|
| 875 | 1 | case Border::DASH_SYSDOT: |
|
| 876 | 2 | $objWriter->writeAttribute('draw:stroke', 'dash'); |
|
| 877 | 2 | $objWriter->writeAttribute('draw:stroke-dash', 'strokeDash_'.$shape->getBorder()->getDashStyle()); |
|
| 878 | 2 | break; |
|
| 879 | default: |
||
| 880 | $objWriter->writeAttribute('draw:stroke', 'none'); |
||
| 881 | break; |
||
| 882 | } |
||
| 883 | } |
||
| 884 | |||
| 885 | 13 | $objWriter->writeAttribute('fo:wrap-option', 'wrap'); |
|
| 886 | // > style:graphic-properties |
||
| 887 | 13 | $objWriter->endElement(); |
|
| 888 | // > style:style |
||
| 889 | 13 | $objWriter->endElement(); |
|
| 890 | |||
| 891 | 13 | $paragraphs = $shape->getParagraphs(); |
|
| 892 | 13 | $paragraphId = 0; |
|
| 893 | 13 | foreach ($paragraphs as $paragraph) { |
|
| 894 | 13 | ++$paragraphId; |
|
| 895 | |||
| 896 | // Style des paragraphes |
||
| 897 | 13 | if (!isset($this->arrStyleParagraph[$paragraph->getHashCode()])) { |
|
| 898 | 13 | $this->arrStyleParagraph[$paragraph->getHashCode()] = $paragraph; |
|
| 899 | } |
||
| 900 | |||
| 901 | // Style des listes |
||
| 902 | 13 | $bulletStyleHashCode = $paragraph->getBulletStyle()->getHashCode(); |
|
| 903 | 13 | if (!isset($this->arrStyleBullet[$bulletStyleHashCode])) { |
|
| 904 | 13 | $this->arrStyleBullet[$bulletStyleHashCode]['oStyle'] = $paragraph->getBulletStyle(); |
|
| 905 | 13 | $this->arrStyleBullet[$bulletStyleHashCode]['level'] = ''; |
|
| 906 | } |
||
| 907 | 13 | if (strpos($this->arrStyleBullet[$bulletStyleHashCode]['level'], ';' . $paragraph->getAlignment()->getLevel()) === false) { |
|
| 908 | 13 | $this->arrStyleBullet[$bulletStyleHashCode]['level'] .= ';' . $paragraph->getAlignment()->getLevel(); |
|
| 909 | 13 | $this->arrStyleBullet[$bulletStyleHashCode]['oAlign_' . $paragraph->getAlignment()->getLevel()] = $paragraph->getAlignment(); |
|
| 910 | } |
||
| 911 | |||
| 912 | 13 | $richtexts = $paragraph->getRichTextElements(); |
|
| 913 | 13 | $richtextId = 0; |
|
| 914 | 13 | foreach ($richtexts as $richtext) { |
|
| 915 | 8 | ++$richtextId; |
|
| 916 | // Not a line break |
||
| 917 | 8 | if ($richtext instanceof Run) { |
|
| 918 | // Style des font text |
||
| 919 | 8 | if (!isset($this->arrStyleTextFont[$richtext->getHashCode()])) { |
|
| 920 | 13 | $this->arrStyleTextFont[$richtext->getHashCode()] = $richtext; |
|
| 921 | } |
||
| 922 | } |
||
| 923 | } |
||
| 924 | } |
||
| 925 | 13 | } |
|
| 926 | |||
| 927 | /** |
||
| 928 | * Write the default style information for an AbstractDrawingAdapter |
||
| 929 | * |
||
| 930 | * @param \PhpOffice\Common\XMLWriter $objWriter |
||
| 931 | * @param AbstractDrawingAdapter $shape |
||
| 932 | */ |
||
| 933 | 10 | public function writeDrawingStyle(XMLWriter $objWriter, AbstractDrawingAdapter $shape) |
|
| 951 | |||
| 952 | /** |
||
| 953 | * Write the default style information for a Line shape. |
||
| 954 | * |
||
| 955 | * @param XMLWriter $objWriter |
||
| 956 | * @param Line $shape |
||
| 957 | */ |
||
| 958 | public function writeLineStyle(XMLWriter $objWriter, Line $shape) |
||
| 959 | { |
||
| 960 | // style:style |
||
| 961 | $objWriter->startElement('style:style'); |
||
| 962 | $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); |
||
| 963 | $objWriter->writeAttribute('style:family', 'graphic'); |
||
| 964 | $objWriter->writeAttribute('style:parent-style-name', 'standard'); |
||
| 965 | |||
| 966 | // style:graphic-properties |
||
| 967 | $objWriter->startElement('style:graphic-properties'); |
||
| 968 | $objWriter->writeAttribute('draw:fill', 'none'); |
||
| 969 | switch ($shape->getBorder()->getLineStyle()) { |
||
| 970 | case Border::LINE_NONE: |
||
| 971 | $objWriter->writeAttribute('draw:stroke', 'none'); |
||
| 972 | break; |
||
| 973 | case Border::LINE_SINGLE: |
||
| 974 | $objWriter->writeAttribute('draw:stroke', 'solid'); |
||
| 975 | break; |
||
| 976 | default: |
||
| 977 | $objWriter->writeAttribute('draw:stroke', 'none'); |
||
| 978 | break; |
||
| 979 | } |
||
| 980 | $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); |
||
| 981 | $objWriter->writeAttribute('svg:stroke-width', Text::numberFormat(CommonDrawing::pixelsToCentimeters((CommonDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); |
||
| 982 | $objWriter->endElement(); |
||
| 983 | |||
| 984 | $objWriter->endElement(); |
||
| 985 | } |
||
| 986 | |||
| 987 | /** |
||
| 988 | * Write the default style information for a Table shape |
||
| 989 | * |
||
| 990 | * @param XMLWriter $objWriter |
||
| 991 | * @param Table $shape |
||
| 992 | */ |
||
| 993 | 7 | public function writeTableStyle(XMLWriter $objWriter, Table $shape) |
|
| 1102 | |||
| 1103 | /** |
||
| 1104 | * Write the slide note |
||
| 1105 | * @param XMLWriter $objWriter |
||
| 1106 | * @param \PhpOffice\PhpPresentation\Slide\Note $note |
||
| 1107 | * @throws \Exception |
||
| 1108 | */ |
||
| 1109 | 41 | public function writeSlideNote(XMLWriter $objWriter, Note $note) |
|
| 1127 | |||
| 1128 | /** |
||
| 1129 | * Write style of a slide |
||
| 1130 | * @param XMLWriter $objWriter |
||
| 1131 | * @param Slide $slide |
||
| 1132 | * @param int $incPage |
||
| 1133 | */ |
||
| 1134 | 41 | public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) |
|
| 1135 | { |
||
| 1136 | // style:style |
||
| 1137 | 41 | $objWriter->startElement('style:style'); |
|
| 1138 | 41 | $objWriter->writeAttribute('style:family', 'drawing-page'); |
|
| 1139 | 41 | $objWriter->writeAttribute('style:name', 'stylePage'.$incPage); |
|
| 1140 | // style:style/style:drawing-page-properties |
||
| 1141 | 41 | $objWriter->startElement('style:drawing-page-properties'); |
|
| 1142 | 41 | $objWriter->writeAttributeIf(!$slide->isVisible(), 'presentation:visibility', 'hidden'); |
|
| 1143 | 41 | if (!is_null($oTransition = $slide->getTransition())) { |
|
| 1144 | 1 | $objWriter->writeAttribute('presentation:duration', 'PT'.number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '').'S'); |
|
| 1145 | 1 | $objWriter->writeAttributeIf($oTransition->hasManualTrigger(), 'presentation:transition-type', 'manual'); |
|
| 1146 | 1 | $objWriter->writeAttributeIf($oTransition->hasTimeTrigger(), 'presentation:transition-type', 'automatic'); |
|
| 1147 | 1 | switch ($oTransition->getSpeed()) { |
|
| 1148 | 1 | case Transition::SPEED_FAST: |
|
| 1149 | 1 | $objWriter->writeAttribute('presentation:transition-speed', 'fast'); |
|
| 1150 | 1 | break; |
|
| 1151 | 1 | case Transition::SPEED_MEDIUM: |
|
| 1152 | 1 | $objWriter->writeAttribute('presentation:transition-speed', 'medium'); |
|
| 1153 | 1 | break; |
|
| 1154 | 1 | case Transition::SPEED_SLOW: |
|
| 1155 | 1 | $objWriter->writeAttribute('presentation:transition-speed', 'slow'); |
|
| 1156 | 1 | break; |
|
| 1157 | } |
||
| 1158 | |||
| 1159 | /** |
||
| 1160 | * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style |
||
| 1161 | */ |
||
| 1162 | 1 | switch ($oTransition->getTransitionType()) { |
|
| 1163 | 1 | case Transition::TRANSITION_BLINDS_HORIZONTAL: |
|
| 1164 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); |
|
| 1165 | 1 | break; |
|
| 1166 | 1 | case Transition::TRANSITION_BLINDS_VERTICAL: |
|
| 1167 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); |
|
| 1168 | 1 | break; |
|
| 1169 | 1 | case Transition::TRANSITION_CHECKER_HORIZONTAL: |
|
| 1170 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); |
|
| 1171 | 1 | break; |
|
| 1172 | 1 | case Transition::TRANSITION_CHECKER_VERTICAL: |
|
| 1173 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); |
|
| 1174 | 1 | break; |
|
| 1175 | 1 | case Transition::TRANSITION_CIRCLE: |
|
| 1176 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
||
| 1177 | break; |
||
| 1178 | 1 | case Transition::TRANSITION_COMB_HORIZONTAL: |
|
| 1179 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1180 | 1 | break; |
|
| 1181 | 1 | case Transition::TRANSITION_COMB_VERTICAL: |
|
| 1182 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1183 | 1 | break; |
|
| 1184 | 1 | case Transition::TRANSITION_COVER_DOWN: |
|
| 1185 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); |
|
| 1186 | 1 | break; |
|
| 1187 | 1 | case Transition::TRANSITION_COVER_LEFT: |
|
| 1188 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); |
|
| 1189 | 1 | break; |
|
| 1190 | 1 | case Transition::TRANSITION_COVER_LEFT_DOWN: |
|
| 1191 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); |
|
| 1192 | 1 | break; |
|
| 1193 | 1 | case Transition::TRANSITION_COVER_LEFT_UP: |
|
| 1194 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); |
|
| 1195 | 1 | break; |
|
| 1196 | 1 | case Transition::TRANSITION_COVER_RIGHT: |
|
| 1197 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); |
|
| 1198 | 1 | break; |
|
| 1199 | 1 | case Transition::TRANSITION_COVER_RIGHT_DOWN: |
|
| 1200 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); |
|
| 1201 | 1 | break; |
|
| 1202 | 1 | case Transition::TRANSITION_COVER_RIGHT_UP: |
|
| 1203 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); |
|
| 1204 | 1 | break; |
|
| 1205 | 1 | case Transition::TRANSITION_COVER_UP: |
|
| 1206 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); |
|
| 1207 | 1 | break; |
|
| 1208 | 1 | case Transition::TRANSITION_CUT: |
|
| 1209 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1210 | 1 | break; |
|
| 1211 | 1 | case Transition::TRANSITION_DIAMOND: |
|
| 1212 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1213 | 1 | break; |
|
| 1214 | 1 | case Transition::TRANSITION_DISSOLVE: |
|
| 1215 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); |
|
| 1216 | 1 | break; |
|
| 1217 | 1 | case Transition::TRANSITION_FADE: |
|
| 1218 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); |
|
| 1219 | 1 | break; |
|
| 1220 | 1 | case Transition::TRANSITION_NEWSFLASH: |
|
| 1221 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1222 | 1 | break; |
|
| 1223 | 1 | case Transition::TRANSITION_PLUS: |
|
| 1224 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'close'); |
|
| 1225 | 1 | break; |
|
| 1226 | 1 | case Transition::TRANSITION_PULL_DOWN: |
|
| 1227 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); |
|
| 1228 | 1 | break; |
|
| 1229 | 1 | case Transition::TRANSITION_PULL_LEFT: |
|
| 1230 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); |
|
| 1231 | 1 | break; |
|
| 1232 | 1 | case Transition::TRANSITION_PULL_RIGHT: |
|
| 1233 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); |
|
| 1234 | 1 | break; |
|
| 1235 | 1 | case Transition::TRANSITION_PULL_UP: |
|
| 1236 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); |
|
| 1237 | 1 | break; |
|
| 1238 | 1 | case Transition::TRANSITION_PUSH_DOWN: |
|
| 1239 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); |
|
| 1240 | 1 | break; |
|
| 1241 | 1 | case Transition::TRANSITION_PUSH_LEFT: |
|
| 1242 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); |
|
| 1243 | 1 | break; |
|
| 1244 | 1 | case Transition::TRANSITION_PUSH_RIGHT: |
|
| 1245 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); |
|
| 1246 | 1 | break; |
|
| 1247 | 1 | case Transition::TRANSITION_PUSH_UP: |
|
| 1248 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); |
|
| 1249 | 1 | break; |
|
| 1250 | 1 | case Transition::TRANSITION_RANDOM: |
|
| 1251 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'random'); |
|
| 1252 | 1 | break; |
|
| 1253 | 1 | case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: |
|
| 1254 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); |
|
| 1255 | 1 | break; |
|
| 1256 | 1 | case Transition::TRANSITION_RANDOMBAR_VERTICAL: |
|
| 1257 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); |
|
| 1258 | 1 | break; |
|
| 1259 | 1 | case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: |
|
| 1260 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); |
|
| 1261 | 1 | break; |
|
| 1262 | 1 | case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: |
|
| 1263 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); |
|
| 1264 | 1 | break; |
|
| 1265 | 1 | case Transition::TRANSITION_SPLIT_IN_VERTICAL: |
|
| 1266 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); |
|
| 1267 | 1 | break; |
|
| 1268 | 1 | case Transition::TRANSITION_SPLIT_OUT_VERTICAL: |
|
| 1269 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); |
|
| 1270 | 1 | break; |
|
| 1271 | 1 | case Transition::TRANSITION_STRIPS_LEFT_DOWN: |
|
| 1272 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1273 | 1 | break; |
|
| 1274 | 1 | case Transition::TRANSITION_STRIPS_LEFT_UP: |
|
| 1275 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1276 | 1 | break; |
|
| 1277 | 1 | case Transition::TRANSITION_STRIPS_RIGHT_DOWN: |
|
| 1278 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1279 | 1 | break; |
|
| 1280 | 1 | case Transition::TRANSITION_STRIPS_RIGHT_UP: |
|
| 1281 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1282 | 1 | break; |
|
| 1283 | 1 | case Transition::TRANSITION_WEDGE: |
|
| 1284 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1285 | 1 | break; |
|
| 1286 | 1 | case Transition::TRANSITION_WIPE_DOWN: |
|
| 1287 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); |
|
| 1288 | 1 | break; |
|
| 1289 | 1 | case Transition::TRANSITION_WIPE_LEFT: |
|
| 1290 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); |
|
| 1291 | 1 | break; |
|
| 1292 | 1 | case Transition::TRANSITION_WIPE_RIGHT: |
|
| 1293 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); |
|
| 1294 | 1 | break; |
|
| 1295 | 1 | case Transition::TRANSITION_WIPE_UP: |
|
| 1296 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); |
|
| 1297 | 1 | break; |
|
| 1298 | 1 | case Transition::TRANSITION_ZOOM_IN: |
|
| 1299 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1300 | 1 | break; |
|
| 1301 | 1 | case Transition::TRANSITION_ZOOM_OUT: |
|
| 1302 | 1 | $objWriter->writeAttribute('presentation:transition-style', 'none'); |
|
| 1303 | 1 | break; |
|
| 1304 | } |
||
| 1305 | } |
||
| 1306 | 41 | $oBackground = $slide->getBackground(); |
|
| 1307 | 41 | if ($oBackground instanceof Slide\AbstractBackground) { |
|
| 1308 | 1 | $objWriter->writeAttribute('presentation:background-visible', 'true'); |
|
| 1309 | 1 | if ($oBackground instanceof Slide\Background\Color) { |
|
| 1310 | $objWriter->writeAttribute('draw:fill', 'solid'); |
||
| 1311 | $objWriter->writeAttribute('draw:fill-color', '#' . $oBackground->getColor()->getRGB()); |
||
| 1312 | } |
||
| 1313 | 1 | if ($oBackground instanceof Slide\Background\Image) { |
|
| 1314 | 1 | $objWriter->writeAttribute('draw:fill', 'bitmap'); |
|
| 1315 | 1 | $objWriter->writeAttribute('draw:fill-image-name', 'background_'.$incPage); |
|
| 1316 | 1 | $objWriter->writeAttribute('style:repeat', 'stretch'); |
|
| 1317 | } |
||
| 1318 | } |
||
| 1319 | 41 | $objWriter->endElement(); |
|
| 1320 | // > style:style |
||
| 1321 | 41 | $objWriter->endElement(); |
|
| 1322 | 41 | } |
|
| 1323 | |||
| 1324 | |||
| 1325 | /** |
||
| 1326 | * @param XMLWriter $objWriter |
||
| 1327 | * @param Fill $oFill |
||
| 1328 | */ |
||
| 1329 | 10 | protected function writeStylePartFill(XMLWriter $objWriter, Fill $oFill) |
|
| 1345 | |||
| 1346 | |||
| 1347 | /** |
||
| 1348 | * @param XMLWriter $objWriter |
||
| 1349 | * @param Shadow $oShadow |
||
| 1350 | * @todo Improve for supporting any direction (https://sinepost.wordpress.com/2012/02/16/theyve-got-atan-you-want-atan2/) |
||
| 1351 | */ |
||
| 1352 | 23 | protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow) |
|
| 1388 | } |
||
| 1389 |