Complex classes like PptSlides 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 PptSlides, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 28 | class PptSlides extends AbstractSlide |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * Add slides (drawings, ...) and slide relationships (drawings, ...) |
||
| 32 | * @return \PhpOffice\Common\Adapter\Zip\ZipInterface |
||
| 33 | */ |
||
| 34 | 103 | public function render() |
|
| 35 | { |
||
| 36 | 103 | foreach ($this->oPresentation->getAllSlides() as $idx => $oSlide) { |
|
| 37 | 103 | $this->oZip->addFromString('ppt/slides/_rels/slide' . ($idx + 1) . '.xml.rels', $this->writeSlideRelationships($oSlide)); |
|
| 38 | 103 | $this->oZip->addFromString('ppt/slides/slide' . ($idx + 1) . '.xml', $this->writeSlide($oSlide)); |
|
| 39 | |||
| 40 | // Add note slide |
||
| 41 | 103 | if ($oSlide->getNote() instanceof Note) { |
|
| 42 | 103 | if ($oSlide->getNote()->getShapeCollection()->count() > 0) { |
|
| 43 | 1 | $this->oZip->addFromString('ppt/notesSlides/notesSlide' . ($idx + 1) . '.xml', $this->writeNote($oSlide->getNote())); |
|
| 44 | 1 | } |
|
| 45 | 103 | } |
|
| 46 | |||
| 47 | // Add background image slide |
||
| 48 | 103 | $oBkgImage = $oSlide->getBackground(); |
|
| 49 | 103 | if ($oBkgImage instanceof Image) { |
|
| 50 | $this->oZip->addFromString('ppt/media/'.$oBkgImage->getIndexedFilename($idx), file_get_contents($oBkgImage->getPath())); |
||
| 51 | } |
||
| 52 | 103 | } |
|
| 53 | |||
| 54 | 103 | return $this->oZip; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Write slide relationships to XML format |
||
| 59 | * |
||
| 60 | * @param \PhpOffice\PhpPresentation\Slide $pSlide |
||
| 61 | * @return string XML Output |
||
| 62 | * @throws \Exception |
||
| 63 | */ |
||
| 64 | 103 | protected function writeSlideRelationships(Slide $pSlide) |
|
| 65 | { |
||
| 66 | //@todo Group all getShapeCollection()->getIterator |
||
| 67 | |||
| 68 | // Create XML writer |
||
| 69 | 103 | $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
|
| 70 | |||
| 71 | // XML header |
||
| 72 | 103 | $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
| 73 | |||
| 74 | // Relationships |
||
| 75 | 103 | $objWriter->startElement('Relationships'); |
|
| 76 | 103 | $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|
| 77 | |||
| 78 | // Starting relation id |
||
| 79 | 103 | $relId = 1; |
|
| 80 | 103 | $idxSlide = $pSlide->getParent()->getIndex($pSlide); |
|
| 81 | |||
| 82 | // Write slideLayout relationship |
||
| 83 | 103 | $layoutId = 1; |
|
| 84 | 103 | if ($pSlide->getSlideLayout()) { |
|
| 85 | 103 | $layoutId = $pSlide->getSlideLayout()->layoutNr; |
|
| 86 | 103 | } |
|
| 87 | 103 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $layoutId . '.xml'); |
|
| 88 | 103 | ++$relId; |
|
| 89 | |||
| 90 | // Write drawing relationships? |
||
| 91 | 103 | if ($pSlide->getShapeCollection()->count() > 0) { |
|
| 92 | // Loop trough images and write relationships |
||
| 93 | 76 | $iterator = $pSlide->getShapeCollection()->getIterator(); |
|
| 94 | 76 | while ($iterator->valid()) { |
|
| 95 | 76 | if ($iterator->current() instanceof Media) { |
|
| 96 | // Write relationship for image drawing |
||
| 97 | 1 | $iterator->current()->relationId = 'rId' . $relId; |
|
| 98 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/video', '../media/' . $iterator->current()->getIndexedFilename()); |
|
| 99 | 1 | ++$relId; |
|
| 100 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current()->getIndexedFilename()); |
|
| 101 | 1 | ++$relId; |
|
| 102 | 76 | } elseif ($iterator->current() instanceof ShapeDrawing\AbstractDrawingAdapter) { |
|
| 103 | // Write relationship for image drawing |
||
| 104 | 7 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $iterator->current()->getIndexedFilename()); |
|
| 105 | 7 | $iterator->current()->relationId = 'rId' . $relId; |
|
| 106 | 7 | ++$relId; |
|
| 107 | 75 | } elseif ($iterator->current() instanceof ShapeChart) { |
|
| 108 | // Write relationship for chart drawing |
||
| 109 | 26 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator->current()->getIndexedFilename()); |
|
| 110 | |||
| 111 | 26 | $iterator->current()->relationId = 'rId' . $relId; |
|
| 112 | |||
| 113 | 26 | ++$relId; |
|
| 114 | 68 | } elseif ($iterator->current() instanceof Group) { |
|
| 115 | 1 | $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); |
|
| 116 | 1 | while ($iterator2->valid()) { |
|
| 117 | 1 | if ($iterator2->current() instanceof Media) { |
|
| 118 | // Write relationship for image drawing |
||
| 119 | $iterator2->current()->relationId = 'rId' . $relId; |
||
| 120 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/video', '../media/' . $iterator->current()->getIndexedFilename()); |
||
| 121 | ++$relId; |
||
| 122 | $this->writeRelationship($objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current()->getIndexedFilename()); |
||
| 123 | ++$relId; |
||
| 124 | 1 | } elseif ($iterator2->current() instanceof ShapeDrawing\AbstractDrawingAdapter) { |
|
| 125 | // Write relationship for image drawing |
||
| 126 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $iterator2->current()->getIndexedFilename()); |
||
| 127 | $iterator2->current()->relationId = 'rId' . $relId; |
||
| 128 | |||
| 129 | ++$relId; |
||
| 130 | 1 | } elseif ($iterator2->current() instanceof ShapeChart) { |
|
| 131 | // Write relationship for chart drawing |
||
| 132 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator2->current()->getIndexedFilename()); |
||
| 133 | $iterator2->current()->relationId = 'rId' . $relId; |
||
| 134 | |||
| 135 | ++$relId; |
||
| 136 | } |
||
| 137 | 1 | $iterator2->next(); |
|
| 138 | 1 | } |
|
| 139 | 1 | } |
|
| 140 | |||
| 141 | 76 | $iterator->next(); |
|
| 142 | 76 | } |
|
| 143 | 76 | } |
|
| 144 | |||
| 145 | // Write background relationships? |
||
| 146 | 103 | $oBackground = $pSlide->getBackground(); |
|
| 147 | 103 | if ($oBackground instanceof Image) { |
|
| 148 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $oBackground->getIndexedFilename($idxSlide)); |
||
| 149 | $oBackground->relationId = 'rId' . $relId; |
||
| 150 | ++$relId; |
||
| 151 | } |
||
| 152 | |||
| 153 | // Write hyperlink relationships? |
||
| 154 | 103 | if ($pSlide->getShapeCollection()->count() > 0) { |
|
| 155 | // Loop trough hyperlinks and write relationships |
||
| 156 | 76 | $iterator = $pSlide->getShapeCollection()->getIterator(); |
|
| 157 | 76 | while ($iterator->valid()) { |
|
| 158 | // Hyperlink on shape |
||
| 159 | 76 | if ($iterator->current()->hasHyperlink()) { |
|
| 160 | // Write relationship for hyperlink |
||
| 161 | 2 | $hyperlink = $iterator->current()->getHyperlink(); |
|
| 162 | 2 | $hyperlink->relationId = 'rId' . $relId; |
|
| 163 | |||
| 164 | 2 | if (!$hyperlink->isInternal()) { |
|
| 165 | 2 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
|
| 166 | 2 | } else { |
|
| 167 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
||
| 168 | } |
||
| 169 | |||
| 170 | 2 | ++$relId; |
|
| 171 | 2 | } |
|
| 172 | |||
| 173 | // Hyperlink on rich text run |
||
| 174 | 76 | if ($iterator->current() instanceof RichText) { |
|
| 175 | 24 | foreach ($iterator->current()->getParagraphs() as $paragraph) { |
|
| 176 | 24 | foreach ($paragraph->getRichTextElements() as $element) { |
|
| 177 | 19 | if ($element instanceof Run || $element instanceof TextElement) { |
|
| 178 | 18 | if ($element->hasHyperlink()) { |
|
| 179 | // Write relationship for hyperlink |
||
| 180 | 2 | $hyperlink = $element->getHyperlink(); |
|
| 181 | 2 | $hyperlink->relationId = 'rId' . $relId; |
|
| 182 | |||
| 183 | 2 | if (!$hyperlink->isInternal()) { |
|
| 184 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
|
| 185 | 1 | } else { |
|
| 186 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
|
| 187 | } |
||
| 188 | |||
| 189 | 2 | ++$relId; |
|
| 190 | 2 | } |
|
| 191 | 18 | } |
|
| 192 | 24 | } |
|
| 193 | 24 | } |
|
| 194 | 24 | } |
|
| 195 | |||
| 196 | // Hyperlink in table |
||
| 197 | 76 | if ($iterator->current() instanceof ShapeTable) { |
|
| 198 | // Rows |
||
| 199 | 10 | $countRows = count($iterator->current()->getRows()); |
|
| 200 | 10 | for ($row = 0; $row < $countRows; $row++) { |
|
| 201 | // Cells in rows |
||
| 202 | 10 | $countCells = count($iterator->current()->getRow($row)->getCells()); |
|
| 203 | 10 | for ($cell = 0; $cell < $countCells; $cell++) { |
|
| 204 | 10 | $currentCell = $iterator->current()->getRow($row)->getCell($cell); |
|
| 205 | // Paragraphs in cell |
||
| 206 | 10 | foreach ($currentCell->getParagraphs() as $paragraph) { |
|
| 207 | // RichText in paragraph |
||
| 208 | 10 | foreach ($paragraph->getRichTextElements() as $element) { |
|
| 209 | // Run or Text in RichText |
||
| 210 | 10 | if ($element instanceof Run || $element instanceof TextElement) { |
|
| 211 | 10 | if ($element->hasHyperlink()) { |
|
| 212 | // Write relationship for hyperlink |
||
| 213 | 1 | $hyperlink = $element->getHyperlink(); |
|
| 214 | 1 | $hyperlink->relationId = 'rId' . $relId; |
|
| 215 | |||
| 216 | 1 | if (!$hyperlink->isInternal()) { |
|
| 217 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
|
| 218 | 1 | } else { |
|
| 219 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
||
| 220 | } |
||
| 221 | |||
| 222 | 1 | ++$relId; |
|
| 223 | 1 | } |
|
| 224 | 10 | } |
|
| 225 | 10 | } |
|
| 226 | 10 | } |
|
| 227 | 10 | } |
|
| 228 | 10 | } |
|
| 229 | 10 | } |
|
| 230 | |||
| 231 | 76 | if ($iterator->current() instanceof Group) { |
|
| 232 | 1 | $iterator2 = $pSlide->getShapeCollection()->getIterator(); |
|
| 233 | 1 | while ($iterator2->valid()) { |
|
| 234 | // Hyperlink on shape |
||
| 235 | 1 | if ($iterator2->current()->hasHyperlink()) { |
|
| 236 | // Write relationship for hyperlink |
||
| 237 | $hyperlink = $iterator2->current()->getHyperlink(); |
||
| 238 | $hyperlink->relationId = 'rId' . $relId; |
||
| 239 | |||
| 240 | if (!$hyperlink->isInternal()) { |
||
| 241 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
||
| 242 | } else { |
||
| 243 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
||
| 244 | } |
||
| 245 | |||
| 246 | ++$relId; |
||
| 247 | } |
||
| 248 | |||
| 249 | // Hyperlink on rich text run |
||
| 250 | 1 | if ($iterator2->current() instanceof RichText) { |
|
| 251 | foreach ($iterator2->current()->getParagraphs() as $paragraph) { |
||
| 252 | foreach ($paragraph->getRichTextElements() as $element) { |
||
| 253 | if ($element instanceof Run || $element instanceof TextElement) { |
||
| 254 | if ($element->hasHyperlink()) { |
||
| 255 | // Write relationship for hyperlink |
||
| 256 | $hyperlink = $element->getHyperlink(); |
||
| 257 | $hyperlink->relationId = 'rId' . $relId; |
||
| 258 | |||
| 259 | if (!$hyperlink->isInternal()) { |
||
| 260 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
||
| 261 | } else { |
||
| 262 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
||
| 263 | } |
||
| 264 | |||
| 265 | ++$relId; |
||
| 266 | } |
||
| 267 | } |
||
| 268 | } |
||
| 269 | } |
||
| 270 | } |
||
| 271 | |||
| 272 | // Hyperlink in table |
||
| 273 | 1 | if ($iterator2->current() instanceof ShapeTable) { |
|
| 274 | // Rows |
||
| 275 | $countRows = count($iterator2->current()->getRows()); |
||
| 276 | for ($row = 0; $row < $countRows; $row++) { |
||
| 277 | // Cells in rows |
||
| 278 | $countCells = count($iterator2->current()->getRow($row)->getCells()); |
||
| 279 | for ($cell = 0; $cell < $countCells; $cell++) { |
||
| 280 | $currentCell = $iterator2->current()->getRow($row)->getCell($cell); |
||
| 281 | // Paragraphs in cell |
||
| 282 | foreach ($currentCell->getParagraphs() as $paragraph) { |
||
| 283 | // RichText in paragraph |
||
| 284 | foreach ($paragraph->getRichTextElements() as $element) { |
||
| 285 | // Run or Text in RichText |
||
| 286 | if ($element instanceof Run || $element instanceof TextElement) { |
||
| 287 | if ($element->hasHyperlink()) { |
||
| 288 | // Write relationship for hyperlink |
||
| 289 | $hyperlink = $element->getHyperlink(); |
||
| 290 | $hyperlink->relationId = 'rId' . $relId; |
||
| 291 | |||
| 292 | if (!$hyperlink->isInternal()) { |
||
| 293 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); |
||
| 294 | } else { |
||
| 295 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); |
||
| 296 | } |
||
| 297 | |||
| 298 | ++$relId; |
||
| 299 | } |
||
| 300 | } |
||
| 301 | } |
||
| 302 | } |
||
| 303 | } |
||
| 304 | } |
||
| 305 | } |
||
| 306 | |||
| 307 | 1 | $iterator2->next(); |
|
| 308 | 1 | } |
|
| 309 | 1 | } |
|
| 310 | |||
| 311 | 76 | $iterator->next(); |
|
| 312 | 76 | } |
|
| 313 | 76 | } |
|
| 314 | |||
| 315 | // Write comment relationships |
||
| 316 | 103 | if ($pSlide->getShapeCollection()->count() > 0) { |
|
| 317 | 76 | $hasSlideComment = false; |
|
| 318 | |||
| 319 | // Loop trough images and write relationships |
||
| 320 | 76 | $iterator = $pSlide->getShapeCollection()->getIterator(); |
|
| 321 | 76 | while ($iterator->valid()) { |
|
| 322 | 76 | if ($iterator->current() instanceof Comment) { |
|
| 323 | 6 | $hasSlideComment = true; |
|
| 324 | 6 | break; |
|
| 325 | 70 | } elseif ($iterator->current() instanceof Group) { |
|
| 326 | 1 | $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); |
|
| 327 | 1 | while ($iterator2->valid()) { |
|
| 328 | 1 | if ($iterator2->current() instanceof Comment) { |
|
| 329 | 1 | $hasSlideComment = true; |
|
| 330 | 1 | break 2; |
|
| 331 | } |
||
| 332 | $iterator2->next(); |
||
| 333 | } |
||
| 334 | } |
||
| 335 | |||
| 336 | 69 | $iterator->next(); |
|
| 337 | 69 | } |
|
| 338 | |||
| 339 | 76 | if ($hasSlideComment) { |
|
| 340 | 7 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', '../comments/comment'.($idxSlide + 1).'.xml'); |
|
| 341 | 7 | ++$relId; |
|
| 342 | 7 | } |
|
| 343 | 76 | } |
|
| 344 | |||
| 345 | 103 | if ($pSlide->getNote()->getShapeCollection()->count() > 0) { |
|
| 346 | 1 | $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide', '../notesSlides/notesSlide'.($idxSlide + 1).'.xml'); |
|
| 347 | 1 | } |
|
| 348 | |||
| 349 | 103 | $objWriter->endElement(); |
|
| 350 | |||
| 351 | // Return |
||
| 352 | 103 | return $objWriter->getData(); |
|
| 353 | } |
||
| 354 | |||
| 355 | /** |
||
| 356 | * Write slide to XML format |
||
| 357 | * |
||
| 358 | * @param \PhpOffice\PhpPresentation\Slide $pSlide |
||
| 359 | * @return string XML Output |
||
| 360 | * @throws \Exception |
||
| 361 | */ |
||
| 362 | 103 | public function writeSlide(Slide $pSlide) |
|
| 363 | { |
||
| 364 | // Create XML writer |
||
| 365 | 103 | $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
|
| 366 | |||
| 367 | // XML header |
||
| 368 | 103 | $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
| 369 | |||
| 370 | // p:sld |
||
| 371 | 103 | $objWriter->startElement('p:sld'); |
|
| 372 | 103 | $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); |
|
| 373 | 103 | $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
|
| 374 | 103 | $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); |
|
| 375 | 103 | $objWriter->writeAttributeIf(!$pSlide->isVisible(), 'show', 0); |
|
| 376 | |||
| 377 | // p:sld/p:cSld |
||
| 378 | 103 | $objWriter->startElement('p:cSld'); |
|
| 379 | |||
| 380 | // Background |
||
| 381 | 103 | if ($pSlide->getBackground() instanceof Slide\AbstractBackground) { |
|
| 382 | $oBackground = $pSlide->getBackground(); |
||
| 383 | // p:bg |
||
| 384 | $objWriter->startElement('p:bg'); |
||
| 385 | |||
| 386 | // p:bgPr |
||
| 387 | $objWriter->startElement('p:bgPr'); |
||
| 388 | |||
| 389 | if ($oBackground instanceof Slide\Background\Color) { |
||
| 390 | // a:solidFill |
||
| 391 | $objWriter->startElement('a:solidFill'); |
||
| 392 | |||
| 393 | $this->writeColor($objWriter, $oBackground->getColor()); |
||
| 394 | |||
| 395 | // > a:solidFill |
||
| 396 | $objWriter->endElement(); |
||
| 397 | } |
||
| 398 | |||
| 399 | if ($oBackground instanceof Slide\Background\Image) { |
||
| 400 | // a:blipFill |
||
| 401 | $objWriter->startElement('a:blipFill'); |
||
| 402 | |||
| 403 | // a:blip |
||
| 404 | $objWriter->startElement('a:blip'); |
||
| 405 | $objWriter->writeAttribute('r:embed', $oBackground->relationId); |
||
| 406 | |||
| 407 | // > a:blipFill |
||
| 408 | $objWriter->endElement(); |
||
| 409 | |||
| 410 | // a:stretch |
||
| 411 | $objWriter->startElement('a:stretch'); |
||
| 412 | |||
| 413 | // a:fillRect |
||
| 414 | $objWriter->writeElement('a:fillRect'); |
||
| 415 | |||
| 416 | // > a:stretch |
||
| 417 | $objWriter->endElement(); |
||
| 418 | |||
| 419 | // > a:blipFill |
||
| 420 | $objWriter->endElement(); |
||
| 421 | } |
||
| 422 | |||
| 423 | // > p:bgPr |
||
| 424 | $objWriter->endElement(); |
||
| 425 | |||
| 426 | // > p:bg |
||
| 427 | $objWriter->endElement(); |
||
| 428 | } |
||
| 429 | |||
| 430 | // p:spTree |
||
| 431 | 103 | $objWriter->startElement('p:spTree'); |
|
| 432 | |||
| 433 | // p:nvGrpSpPr |
||
| 434 | 103 | $objWriter->startElement('p:nvGrpSpPr'); |
|
| 435 | |||
| 436 | // p:cNvPr |
||
| 437 | 103 | $objWriter->startElement('p:cNvPr'); |
|
| 438 | 103 | $objWriter->writeAttribute('id', '1'); |
|
| 439 | 103 | $objWriter->writeAttribute('name', ''); |
|
| 440 | 103 | $objWriter->endElement(); |
|
| 441 | |||
| 442 | // p:cNvGrpSpPr |
||
| 443 | 103 | $objWriter->writeElement('p:cNvGrpSpPr', null); |
|
| 444 | |||
| 445 | // p:nvPr |
||
| 446 | 103 | $objWriter->writeElement('p:nvPr', null); |
|
| 447 | |||
| 448 | 103 | $objWriter->endElement(); |
|
| 449 | |||
| 450 | // p:grpSpPr |
||
| 451 | 103 | $objWriter->startElement('p:grpSpPr'); |
|
| 452 | |||
| 453 | // a:xfrm |
||
| 454 | 103 | $objWriter->startElement('a:xfrm'); |
|
| 455 | |||
| 456 | // a:off |
||
| 457 | 103 | $objWriter->startElement('a:off'); |
|
| 458 | 103 | $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); |
|
| 459 | 103 | $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); |
|
| 460 | 103 | $objWriter->endElement(); // a:off |
|
| 461 | |||
| 462 | // a:ext |
||
| 463 | 103 | $objWriter->startElement('a:ext'); |
|
| 464 | 103 | $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); |
|
| 465 | 103 | $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); |
|
| 466 | 103 | $objWriter->endElement(); // a:ext |
|
| 467 | |||
| 468 | // a:chOff |
||
| 469 | 103 | $objWriter->startElement('a:chOff'); |
|
| 470 | 103 | $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); |
|
| 471 | 103 | $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); |
|
| 472 | 103 | $objWriter->endElement(); // a:chOff |
|
| 473 | |||
| 474 | // a:chExt |
||
| 475 | 103 | $objWriter->startElement('a:chExt'); |
|
| 476 | 103 | $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); |
|
| 477 | 103 | $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); |
|
| 478 | 103 | $objWriter->endElement(); // a:chExt |
|
| 479 | |||
| 480 | 103 | $objWriter->endElement(); |
|
| 481 | |||
| 482 | 103 | $objWriter->endElement(); |
|
| 483 | |||
| 484 | // Loop shapes |
||
| 485 | 103 | $this->writeShapeCollection($objWriter, $pSlide->getShapeCollection()); |
|
| 486 | |||
| 487 | // TODO |
||
| 488 | 103 | $objWriter->endElement(); |
|
| 489 | |||
| 490 | 103 | $objWriter->endElement(); |
|
| 491 | |||
| 492 | // p:clrMapOvr |
||
| 493 | 103 | $objWriter->startElement('p:clrMapOvr'); |
|
| 494 | // p:clrMapOvr\a:masterClrMapping |
||
| 495 | 103 | $objWriter->writeElement('a:masterClrMapping', null); |
|
| 496 | // ##p:clrMapOvr |
||
| 497 | 103 | $objWriter->endElement(); |
|
| 498 | |||
| 499 | 103 | $this->writeSlideTransition($objWriter, $pSlide->getTransition()); |
|
| 500 | |||
| 501 | 103 | $this->writeSlideAnimations($objWriter, $pSlide); |
|
| 502 | |||
| 503 | 103 | $objWriter->endElement(); |
|
| 504 | |||
| 505 | // Return |
||
| 506 | 103 | return $objWriter->getData(); |
|
| 507 | } |
||
| 508 | |||
| 509 | /** |
||
| 510 | * @param XMLWriter $objWriter |
||
| 511 | * @param Slide $oSlide |
||
| 512 | */ |
||
| 513 | 103 | protected function writeSlideAnimations(XMLWriter $objWriter, Slide $oSlide) |
|
| 514 | { |
||
| 515 | 103 | $arrayAnimations = $oSlide->getAnimations(); |
|
| 516 | 103 | if (empty($arrayAnimations)) { |
|
| 517 | 102 | return; |
|
| 518 | } |
||
| 519 | |||
| 520 | // Variables |
||
| 521 | 1 | $shapeId = 1; |
|
| 522 | 1 | $idCount = 1; |
|
| 523 | 1 | $hashToIdMap = array(); |
|
| 524 | 1 | $arrayAnimationIds = array(); |
|
| 525 | |||
| 526 | 1 | foreach ($oSlide->getShapeCollection() as $shape) { |
|
| 527 | 1 | $hashToIdMap[$shape->getHashCode()] = ++$shapeId; |
|
| 528 | 1 | } |
|
| 529 | 1 | foreach ($arrayAnimations as $oAnimation) { |
|
| 530 | 1 | foreach ($oAnimation->getShapeCollection() as $oShape) { |
|
| 531 | 1 | $arrayAnimationIds[] = $hashToIdMap[$oShape->getHashCode()]; |
|
| 532 | 1 | } |
|
| 533 | 1 | } |
|
| 534 | |||
| 535 | // p:timing |
||
| 536 | 1 | $objWriter->startElement('p:timing'); |
|
| 537 | // p:timing/p:tnLst |
||
| 538 | 1 | $objWriter->startElement('p:tnLst'); |
|
| 539 | // p:timing/p:tnLst/p:par |
||
| 540 | 1 | $objWriter->startElement('p:par'); |
|
| 541 | // p:timing/p:tnLst/p:par/p:cTn |
||
| 542 | 1 | $objWriter->startElement('p:cTn'); |
|
| 543 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 544 | 1 | $objWriter->writeAttribute('dur', 'indefinite'); |
|
| 545 | 1 | $objWriter->writeAttribute('restart', 'never'); |
|
| 546 | 1 | $objWriter->writeAttribute('nodeType', 'tmRoot'); |
|
| 547 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst |
||
| 548 | 1 | $objWriter->startElement('p:childTnLst'); |
|
| 549 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq |
||
| 550 | 1 | $objWriter->startElement('p:seq'); |
|
| 551 | 1 | $objWriter->writeAttribute('concurrent', '1'); |
|
| 552 | 1 | $objWriter->writeAttribute('nextAc', 'seek'); |
|
| 553 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn |
||
| 554 | 1 | $objWriter->startElement('p:cTn'); |
|
| 555 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 556 | 1 | $objWriter->writeAttribute('dur', 'indefinite'); |
|
| 557 | 1 | $objWriter->writeAttribute('nodeType', 'mainSeq'); |
|
| 558 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst |
||
| 559 | 1 | $objWriter->startElement('p:childTnLst'); |
|
| 560 | |||
| 561 | // Each animation has multiple shapes |
||
| 562 | 1 | foreach ($arrayAnimations as $oAnimation) { |
|
| 563 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par |
||
| 564 | 1 | $objWriter->startElement('p:par'); |
|
| 565 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn |
||
| 566 | 1 | $objWriter->startElement('p:cTn'); |
|
| 567 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 568 | 1 | $objWriter->writeAttribute('fill', 'hold'); |
|
| 569 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst |
||
| 570 | 1 | $objWriter->startElement('p:stCondLst'); |
|
| 571 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond |
||
| 572 | 1 | $objWriter->startElement('p:cond'); |
|
| 573 | 1 | $objWriter->writeAttribute('delay', 'indefinite'); |
|
| 574 | 1 | $objWriter->endElement(); |
|
| 575 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn\##p:stCondLst |
||
| 576 | 1 | $objWriter->endElement(); |
|
| 577 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst |
||
| 578 | 1 | $objWriter->startElement('p:childTnLst'); |
|
| 579 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par |
||
| 580 | 1 | $objWriter->startElement('p:par'); |
|
| 581 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn |
||
| 582 | 1 | $objWriter->startElement('p:cTn'); |
|
| 583 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 584 | 1 | $objWriter->writeAttribute('fill', 'hold'); |
|
| 585 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst |
||
| 586 | 1 | $objWriter->startElement('p:stCondLst'); |
|
| 587 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond |
||
| 588 | 1 | $objWriter->startElement('p:cond'); |
|
| 589 | 1 | $objWriter->writeAttribute('delay', '0'); |
|
| 590 | 1 | $objWriter->endElement(); |
|
| 591 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn\##p:stCondLst |
||
| 592 | 1 | $objWriter->endElement(); |
|
| 593 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst |
||
| 594 | 1 | $objWriter->startElement('p:childTnLst'); |
|
| 595 | |||
| 596 | 1 | $firstAnimation = true; |
|
| 597 | 1 | foreach ($oAnimation->getShapeCollection() as $oShape) { |
|
| 598 | 1 | $nodeType = $firstAnimation ? 'clickEffect' : 'withEffect'; |
|
| 599 | 1 | $shapeId = $hashToIdMap[$oShape->getHashCode()]; |
|
| 600 | |||
| 601 | // p:par |
||
| 602 | 1 | $objWriter->startElement('p:par'); |
|
| 603 | // p:par/p:cTn |
||
| 604 | 1 | $objWriter->startElement('p:cTn'); |
|
| 605 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 606 | 1 | $objWriter->writeAttribute('presetID', '1'); |
|
| 607 | 1 | $objWriter->writeAttribute('presetClass', 'entr'); |
|
| 608 | 1 | $objWriter->writeAttribute('fill', 'hold'); |
|
| 609 | 1 | $objWriter->writeAttribute('presetSubtype', '0'); |
|
| 610 | 1 | $objWriter->writeAttribute('grpId', '0'); |
|
| 611 | 1 | $objWriter->writeAttribute('nodeType', $nodeType); |
|
| 612 | // p:par/p:cTn/p:stCondLst |
||
| 613 | 1 | $objWriter->startElement('p:stCondLst'); |
|
| 614 | // p:par/p:cTn/p:stCondLst/p:cond |
||
| 615 | 1 | $objWriter->startElement('p:cond'); |
|
| 616 | 1 | $objWriter->writeAttribute('delay', '0'); |
|
| 617 | 1 | $objWriter->endElement(); |
|
| 618 | // p:par/p:cTn\##p:stCondLst |
||
| 619 | 1 | $objWriter->endElement(); |
|
| 620 | // p:par/p:cTn/p:childTnLst |
||
| 621 | 1 | $objWriter->startElement('p:childTnLst'); |
|
| 622 | // p:par/p:cTn/p:childTnLst/p:set |
||
| 623 | 1 | $objWriter->startElement('p:set'); |
|
| 624 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr |
||
| 625 | 1 | $objWriter->startElement('p:cBhvr'); |
|
| 626 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn |
||
| 627 | 1 | $objWriter->startElement('p:cTn'); |
|
| 628 | 1 | $objWriter->writeAttribute('id', $idCount++); |
|
| 629 | 1 | $objWriter->writeAttribute('dur', '1'); |
|
| 630 | 1 | $objWriter->writeAttribute('fill', 'hold'); |
|
| 631 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn/p:stCondLst |
||
| 632 | 1 | $objWriter->startElement('p:stCondLst'); |
|
| 633 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn/p:stCondLst/p:cond |
||
| 634 | 1 | $objWriter->startElement('p:cond'); |
|
| 635 | 1 | $objWriter->writeAttribute('delay', '0'); |
|
| 636 | 1 | $objWriter->endElement(); |
|
| 637 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn\##p:stCondLst |
||
| 638 | 1 | $objWriter->endElement(); |
|
| 639 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:cTn |
||
| 640 | 1 | $objWriter->endElement(); |
|
| 641 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl |
||
| 642 | 1 | $objWriter->startElement('p:tgtEl'); |
|
| 643 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt |
||
| 644 | 1 | $objWriter->startElement('p:spTgt'); |
|
| 645 | 1 | $objWriter->writeAttribute('spid', $shapeId); |
|
| 646 | 1 | $objWriter->endElement(); |
|
| 647 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:tgtEl |
||
| 648 | 1 | $objWriter->endElement(); |
|
| 649 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst |
||
| 650 | 1 | $objWriter->startElement('p:attrNameLst'); |
|
| 651 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName |
||
| 652 | 1 | $objWriter->writeElement('p:attrName', 'style.visibility'); |
|
| 653 | // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:attrNameLst |
||
| 654 | 1 | $objWriter->endElement(); |
|
| 655 | // p:par/p:cTn/p:childTnLst/p:set\##p:cBhvr |
||
| 656 | 1 | $objWriter->endElement(); |
|
| 657 | // p:par/p:cTn/p:childTnLst/p:set/p:to |
||
| 658 | 1 | $objWriter->startElement('p:to'); |
|
| 659 | // p:par/p:cTn/p:childTnLst/p:set/p:to/p:strVal |
||
| 660 | 1 | $objWriter->startElement('p:strVal'); |
|
| 661 | 1 | $objWriter->writeAttribute('val', 'visible'); |
|
| 662 | 1 | $objWriter->endElement(); |
|
| 663 | // p:par/p:cTn/p:childTnLst/p:set\##p:to |
||
| 664 | 1 | $objWriter->endElement(); |
|
| 665 | // p:par/p:cTn/p:childTnLst\##p:set |
||
| 666 | 1 | $objWriter->endElement(); |
|
| 667 | // p:par/p:cTn\##p:childTnLst |
||
| 668 | 1 | $objWriter->endElement(); |
|
| 669 | // p:par\##p:cTn |
||
| 670 | 1 | $objWriter->endElement(); |
|
| 671 | // ##p:par |
||
| 672 | 1 | $objWriter->endElement(); |
|
| 673 | |||
| 674 | 1 | $firstAnimation = false; |
|
| 675 | 1 | } |
|
| 676 | |||
| 677 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn\##p:childTnLst |
||
| 678 | 1 | $objWriter->endElement(); |
|
| 679 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par\##p:cTn |
||
| 680 | 1 | $objWriter->endElement(); |
|
| 681 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst\##p:par |
||
| 682 | 1 | $objWriter->endElement(); |
|
| 683 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn\##p:childTnLst |
||
| 684 | 1 | $objWriter->endElement(); |
|
| 685 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par\##p:cTn |
||
| 686 | 1 | $objWriter->endElement(); |
|
| 687 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst\##p:par |
||
| 688 | 1 | $objWriter->endElement(); |
|
| 689 | 1 | } |
|
| 690 | |||
| 691 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn\##p:childTnLst |
||
| 692 | 1 | $objWriter->endElement(); |
|
| 693 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:cTn |
||
| 694 | 1 | $objWriter->endElement(); |
|
| 695 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst |
||
| 696 | 1 | $objWriter->startElement('p:prevCondLst'); |
|
| 697 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond |
||
| 698 | 1 | $objWriter->startElement('p:cond'); |
|
| 699 | 1 | $objWriter->writeAttribute('evt', 'onPrev'); |
|
| 700 | 1 | $objWriter->writeAttribute('delay', '0'); |
|
| 701 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond/p:tgtEl |
||
| 702 | 1 | $objWriter->startElement('p:tgtEl'); |
|
| 703 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond/p:tgtEl/p:sldTgt |
||
| 704 | 1 | $objWriter->writeElement('p:sldTgt', null); |
|
| 705 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond\##p:tgtEl |
||
| 706 | 1 | $objWriter->endElement(); |
|
| 707 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst\##p:cond |
||
| 708 | 1 | $objWriter->endElement(); |
|
| 709 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:prevCondLst |
||
| 710 | 1 | $objWriter->endElement(); |
|
| 711 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst |
||
| 712 | 1 | $objWriter->startElement('p:nextCondLst'); |
|
| 713 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond |
||
| 714 | 1 | $objWriter->startElement('p:cond'); |
|
| 715 | 1 | $objWriter->writeAttribute('evt', 'onNext'); |
|
| 716 | 1 | $objWriter->writeAttribute('delay', '0'); |
|
| 717 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl |
||
| 718 | 1 | $objWriter->startElement('p:tgtEl'); |
|
| 719 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl/p:sldTgt |
||
| 720 | 1 | $objWriter->writeElement('p:sldTgt', null); |
|
| 721 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond\##p:tgtEl |
||
| 722 | 1 | $objWriter->endElement(); |
|
| 723 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst\##p:cond |
||
| 724 | 1 | $objWriter->endElement(); |
|
| 725 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:nextCondLst |
||
| 726 | 1 | $objWriter->endElement(); |
|
| 727 | // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst\##p:seq |
||
| 728 | 1 | $objWriter->endElement(); |
|
| 729 | // p:timing/p:tnLst/p:par/p:cTn\##p:childTnLst |
||
| 730 | 1 | $objWriter->endElement(); |
|
| 731 | // p:timing/p:tnLst/p:par\##p:cTn |
||
| 732 | 1 | $objWriter->endElement(); |
|
| 733 | // p:timing/p:tnLst\##p:par |
||
| 734 | 1 | $objWriter->endElement(); |
|
| 735 | // p:timing\##p:tnLst |
||
| 736 | 1 | $objWriter->endElement(); |
|
| 737 | |||
| 738 | // p:timing/p:bldLst |
||
| 739 | 1 | $objWriter->startElement('p:bldLst'); |
|
| 740 | |||
| 741 | // Add in ids of all shapes in this slides animations |
||
| 742 | 1 | foreach ($arrayAnimationIds as $id) { |
|
| 743 | // p:timing/p:bldLst/p:bldP |
||
| 744 | 1 | $objWriter->startElement('p:bldP'); |
|
| 745 | 1 | $objWriter->writeAttribute('spid', $id); |
|
| 746 | 1 | $objWriter->writeAttribute('grpId', 0); |
|
| 747 | 1 | $objWriter->endELement(); |
|
| 748 | 1 | } |
|
| 749 | |||
| 750 | // p:timing\##p:bldLst |
||
| 751 | 1 | $objWriter->endElement(); |
|
| 752 | |||
| 753 | // ##p:timing |
||
| 754 | 1 | $objWriter->endElement(); |
|
| 755 | 1 | } |
|
| 756 | |||
| 757 | /** |
||
| 758 | * Write group |
||
| 759 | * |
||
| 760 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 761 | * @param \PhpOffice\PhpPresentation\Shape\Group $group |
||
| 762 | * @param int $shapeId |
||
| 763 | */ |
||
| 764 | 1 | protected function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) |
|
| 824 | |||
| 825 | /** |
||
| 826 | * Write chart |
||
| 827 | * |
||
| 828 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 829 | * @param \PhpOffice\PhpPresentation\Shape\Chart $shape |
||
| 830 | * @param int $shapeId |
||
| 831 | */ |
||
| 832 | 26 | protected function writeShapeChart(XMLWriter $objWriter, ShapeChart $shape, $shapeId) |
|
| 899 | |||
| 900 | /** |
||
| 901 | * Write pic |
||
| 902 | * |
||
| 903 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 904 | * @param \PhpOffice\PhpPresentation\Shape\Drawing\AbstractDrawingAdapter $shape |
||
| 905 | * @param int $shapeId |
||
| 906 | * @throws \Exception |
||
| 907 | */ |
||
| 908 | protected function writeShapeDrawing(XMLWriter $objWriter, ShapeDrawing\AbstractDrawingAdapter $shape, $shapeId) |
||
| 1027 | |||
| 1028 | /** |
||
| 1029 | * Write txt |
||
| 1030 | * |
||
| 1031 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 1032 | * @param \PhpOffice\PhpPresentation\Shape\RichText $shape |
||
| 1033 | * @param int $shapeId |
||
| 1034 | * @throws \Exception |
||
| 1035 | */ |
||
| 1036 | 24 | protected function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) |
|
| 1173 | |||
| 1174 | /** |
||
| 1175 | * Write table |
||
| 1176 | * |
||
| 1177 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 1178 | * @param \PhpOffice\PhpPresentation\Shape\Table $shape |
||
| 1179 | * @param int $shapeId |
||
| 1180 | * @throws \Exception |
||
| 1181 | */ |
||
| 1182 | 10 | protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, $shapeId) |
|
| 1406 | |||
| 1407 | /** |
||
| 1408 | * Write paragraphs |
||
| 1409 | * |
||
| 1410 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 1411 | * @param \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] $paragraphs |
||
| 1412 | * @param bool $bIsPlaceholder |
||
| 1413 | * @throws \Exception |
||
| 1414 | */ |
||
| 1415 | 35 | protected function writeParagraphs(XMLWriter $objWriter, $paragraphs, $bIsPlaceholder = false) |
|
| 1535 | |||
| 1536 | /** |
||
| 1537 | * Write Line Shape |
||
| 1538 | * |
||
| 1539 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 1540 | * @param \PhpOffice\PhpPresentation\Shape\Line $shape |
||
| 1541 | * @param int $shapeId |
||
| 1542 | */ |
||
| 1543 | 1 | protected function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) |
|
| 1647 | |||
| 1648 | /** |
||
| 1649 | * Write hyperlink |
||
| 1650 | * |
||
| 1651 | * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer |
||
| 1652 | * @param \PhpOffice\PhpPresentation\AbstractShape|\PhpOffice\PhpPresentation\Shape\RichText\TextElement $shape |
||
| 1653 | */ |
||
| 1654 | 31 | protected function writeHyperlink(XMLWriter $objWriter, $shape) |
|
| 1668 | |||
| 1669 | /** |
||
| 1670 | * Write Note Slide |
||
| 1671 | * @param Note $pNote |
||
| 1672 | * @throws \Exception |
||
| 1673 | * @return string |
||
| 1674 | */ |
||
| 1675 | 1 | protected function writeNote(Note $pNote) |
|
| 1955 | } |
||
| 1956 |