public function testTransition() { $object = new Slide(); $oTransition = new Transition(); $this->assertNull($object->getTransition()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setTransition()); $this->assertNull($object->getTransition()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setTransition($oTransition)); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->getTransition()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setTransition(null)); $this->assertNull($object->getTransition()); }
/** * @param Slide $oSlide * @return string */ protected function writeSlideComments(Slide $oSlide) { /** * @var Comment[] */ $arrayComment = array(); foreach ($oSlide->getShapeCollection() as $oShape) { if ($oShape instanceof Comment) { $arrayComment[] = $oShape; } } if (empty($arrayComment)) { return ''; } $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); $objWriter->startDocument('1.0', 'UTF-8', 'yes'); // p:cmLst $objWriter->startElement('p:cmLst'); $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); foreach ($arrayComment as $idxComment => $oComment) { $oAuthor = $oComment->getAuthor(); // p:cmLst > p:cm $objWriter->startElement('p:cm'); $objWriter->writeAttribute('authorId', $oAuthor instanceof Comment\Author ? $oAuthor->getIndex() : 0); $objWriter->writeAttribute('dt', date('Y-m-d\\TH:i:s.000000000', $oComment->getDate())); $objWriter->writeAttribute('idx', $idxComment); // p:cmLst > p:cm > p:pos // Uses 1/8pt for positionning // @link : https://social.msdn.microsoft.com/Forums/fr-FR/ebdc12f2-0cff-4fa8-b901-fa6e3198364e/comment-position-units $objWriter->startElement('p:pos'); $objWriter->writeAttribute('x', (int) CommonDrawing::pixelsToPoints($oComment->getOffsetX() * 8)); $objWriter->writeAttribute('y', (int) CommonDrawing::pixelsToPoints($oComment->getOffsetY() * 8)); $objWriter->endElement(); // p:cmLst > p:cm > p:text $objWriter->writeElement('p:text', $oComment->getText()); // p:cmLst > ## p:cm $objWriter->endElement(); } // ## p:cmLst $objWriter->endElement(); return $objWriter->getData(); }
/** * Add external slide * * @param \PhpOffice\PhpPresentation\Slide $slide External slide to add * @throws \Exception * @return \PhpOffice\PhpPresentation\Slide */ public function addExternalSlide(Slide $slide) { $slide->rebindParent($this); return $this->addSlide($slide); }
/** * Write slide to XML format * * @param \PhpOffice\PhpPresentation\Slide $pSlide * @return string XML Output * @throws \Exception */ public function writeSlide(Slide $pSlide) { // Create XML writer $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); // p:sld $objWriter->startElement('p:sld'); $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); // p:cSld $objWriter->startElement('p:cSld'); // Background if ($pSlide->getBackground() instanceof Slide\AbstractBackground) { $oBackground = $pSlide->getBackground(); // p:bg $objWriter->startElement('p:bg'); // p:bgPr $objWriter->startElement('p:bgPr'); if ($oBackground instanceof Slide\Background\Color) { // a:solidFill $objWriter->startElement('a:solidFill'); // a:srgbClr $objWriter->startElement('a:srgbClr'); $objWriter->writeAttribute('val', $oBackground->getColor()->getRGB()); $objWriter->endElement(); // > a:solidFill $objWriter->endElement(); } if ($oBackground instanceof Slide\Background\Image) { // a:blipFill $objWriter->startElement('a:blipFill'); // a:blip $objWriter->startElement('a:blip'); $objWriter->writeAttribute('r:embed', $oBackground->relationId); // > a:blipFill $objWriter->endElement(); // a:stretch $objWriter->startElement('a:stretch'); // a:fillRect $objWriter->writeElement('a:fillRect'); // > a:stretch $objWriter->endElement(); // > a:blipFill $objWriter->endElement(); } // > p:bgPr $objWriter->endElement(); // > p:bg $objWriter->endElement(); } // p:spTree $objWriter->startElement('p:spTree'); // p:nvGrpSpPr $objWriter->startElement('p:nvGrpSpPr'); // p:cNvPr $objWriter->startElement('p:cNvPr'); $objWriter->writeAttribute('id', '1'); $objWriter->writeAttribute('name', ''); $objWriter->endElement(); // p:cNvGrpSpPr $objWriter->writeElement('p:cNvGrpSpPr', null); // p:nvPr $objWriter->writeElement('p:nvPr', null); $objWriter->endElement(); // p:grpSpPr $objWriter->startElement('p:grpSpPr'); // a:xfrm $objWriter->startElement('a:xfrm'); // a:off $objWriter->startElement('a:off'); $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); $objWriter->endElement(); // a:off // a:ext $objWriter->startElement('a:ext'); $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); $objWriter->endElement(); // a:ext // a:chOff $objWriter->startElement('a:chOff'); $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); $objWriter->endElement(); // a:chOff // a:chExt $objWriter->startElement('a:chExt'); $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); $objWriter->endElement(); // a:chExt $objWriter->endElement(); $objWriter->endElement(); // Loop shapes $shapeId = 0; $shapes = $pSlide->getShapeCollection(); foreach ($shapes as $shape) { // Increment $shapeId ++$shapeId; // Check type if ($shape instanceof RichText) { $this->writeShapeText($objWriter, $shape, $shapeId); } elseif ($shape instanceof ShapeTable) { $this->writeShapeTable($objWriter, $shape, $shapeId); } elseif ($shape instanceof Line) { $this->writeShapeLine($objWriter, $shape, $shapeId); } elseif ($shape instanceof ShapeChart) { $this->writeShapeChart($objWriter, $shape, $shapeId); } elseif ($shape instanceof AbstractDrawing) { $this->writeShapePic($objWriter, $shape, $shapeId); } elseif ($shape instanceof Group) { $this->writeShapeGroup($objWriter, $shape, $shapeId); } } // TODO $objWriter->endElement(); $objWriter->endElement(); // p:clrMapOvr $objWriter->startElement('p:clrMapOvr'); // a:masterClrMapping $objWriter->writeElement('a:masterClrMapping', null); $objWriter->endElement(); if (!is_null($pSlide->getTransition())) { $this->writeTransition($objWriter, $pSlide->getTransition()); } $objWriter->endElement(); // Return return $objWriter->getData(); }
/** * Write style of a slide * @param XMLWriter $objWriter * @param Slide $slide * @param int $incPage */ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) { // style:style $objWriter->startElement('style:style'); $objWriter->writeAttribute('style:family', 'drawing-page'); $objWriter->writeAttribute('style:name', 'stylePage' . $incPage); // style:style/style:drawing-page-properties $objWriter->startElement('style:drawing-page-properties'); if (!is_null($oTransition = $slide->getTransition())) { $objWriter->writeAttribute('presentation:duration', 'PT' . number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '') . 'S'); if ($oTransition->hasManualTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'manual'); } elseif ($oTransition->hasTimeTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'automatic'); } switch ($oTransition->getSpeed()) { case Transition::SPEED_FAST: $objWriter->writeAttribute('presentation:transition-speed', 'fast'); break; case Transition::SPEED_MEDIUM: $objWriter->writeAttribute('presentation:transition-speed', 'medium'); break; case Transition::SPEED_SLOW: $objWriter->writeAttribute('presentation:transition-speed', 'slow'); break; } /** * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style */ switch ($oTransition->getTransitionType()) { case Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); break; case Transition::TRANSITION_BLINDS_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); break; case Transition::TRANSITION_CHECKER_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); break; case Transition::TRANSITION_CHECKER_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); break; case Transition::TRANSITION_CIRCLE_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_CIRCLE_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_COMB_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_COMB_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_COVER_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); break; case Transition::TRANSITION_COVER_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); break; case Transition::TRANSITION_COVER_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); break; case Transition::TRANSITION_COVER_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); break; case Transition::TRANSITION_COVER_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); break; case Transition::TRANSITION_COVER_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); break; case Transition::TRANSITION_COVER_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); break; case Transition::TRANSITION_COVER_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); break; case Transition::TRANSITION_CUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_DIAMOND: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_DISSOLVE: $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); break; case Transition::TRANSITION_FADE: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); break; case Transition::TRANSITION_NEWSFLASH: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_PLUS: $objWriter->writeAttribute('presentation:transition-style', 'close'); break; case Transition::TRANSITION_PULL_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); break; case Transition::TRANSITION_PULL_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); break; case Transition::TRANSITION_PULL_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); break; case Transition::TRANSITION_PULL_UP: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); break; case Transition::TRANSITION_PUSH_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); break; case Transition::TRANSITION_PUSH_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); break; case Transition::TRANSITION_PUSH_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); break; case Transition::TRANSITION_PUSH_UP: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); break; case Transition::TRANSITION_RANDOM: $objWriter->writeAttribute('presentation:transition-style', 'random'); break; case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); break; case Transition::TRANSITION_RANDOMBAR_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); break; case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); break; case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); break; case Transition::TRANSITION_SPLIT_IN_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); break; case Transition::TRANSITION_SPLIT_OUT_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); break; case Transition::TRANSITION_STRIPS_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_STRIPS_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_STRIPS_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_STRIPS_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_WEDGE: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_WIPE_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); break; case Transition::TRANSITION_WIPE_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); break; case Transition::TRANSITION_WIPE_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); break; case Transition::TRANSITION_WIPE_UP: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); break; case Transition::TRANSITION_ZOOM_IN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; case Transition::TRANSITION_ZOOM_OUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; } } $oBackground = $slide->getBackground(); if ($oBackground instanceof Slide\AbstractBackground) { $objWriter->writeAttribute('presentation:background-visible', 'true'); if ($oBackground instanceof Slide\Background\Color) { $objWriter->writeAttribute('draw:fill', 'solid'); $objWriter->writeAttribute('draw:fill-color', '#' . $oBackground->getColor()->getRGB()); } if ($oBackground instanceof Slide\Background\Image) { $objWriter->writeAttribute('draw:fill', 'bitmap'); $objWriter->writeAttribute('draw:fill-image-name', 'background_' . $incPage); $objWriter->writeAttribute('style:repeat', 'stretch'); } } $objWriter->endElement(); // > style:style $objWriter->endElement(); }
/** * @param XMLWriter $objWriter * @param Slide $oSlide */ protected function writeSlideAnimations(XMLWriter $objWriter, Slide $oSlide) { $arrayAnimations = $oSlide->getAnimations(); if (empty($arrayAnimations)) { return; } // Variables $shapeId = 1; $idCount = 1; $hashToIdMap = array(); $arrayAnimationIds = array(); foreach ($oSlide->getShapeCollection() as $shape) { $hashToIdMap[$shape->getHashCode()] = ++$shapeId; } foreach ($arrayAnimations as $oAnimation) { foreach ($oAnimation->getShapeCollection() as $oShape) { $arrayAnimationIds[] = $hashToIdMap[$oShape->getHashCode()]; } } // p:timing $objWriter->startElement('p:timing'); // p:timing/p:tnLst $objWriter->startElement('p:tnLst'); // p:timing/p:tnLst/p:par $objWriter->startElement('p:par'); // p:timing/p:tnLst/p:par/p:cTn $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('dur', 'indefinite'); $objWriter->writeAttribute('restart', 'never'); $objWriter->writeAttribute('nodeType', 'tmRoot'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst $objWriter->startElement('p:childTnLst'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq $objWriter->startElement('p:seq'); $objWriter->writeAttribute('concurrent', '1'); $objWriter->writeAttribute('nextAc', 'seek'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('dur', 'indefinite'); $objWriter->writeAttribute('nodeType', 'mainSeq'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst $objWriter->startElement('p:childTnLst'); // Each animation has multiple shapes foreach ($arrayAnimations as $oAnimation) { // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par $objWriter->startElement('p:par'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('fill', 'hold'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst $objWriter->startElement('p:stCondLst'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond $objWriter->startElement('p:cond'); $objWriter->writeAttribute('delay', 'indefinite'); $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn\##p:stCondLst $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst $objWriter->startElement('p:childTnLst'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par $objWriter->startElement('p:par'); // 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 $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('fill', 'hold'); // 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 $objWriter->startElement('p:stCondLst'); // 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 $objWriter->startElement('p:cond'); $objWriter->writeAttribute('delay', '0'); $objWriter->endElement(); // 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 $objWriter->endElement(); // 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 $objWriter->startElement('p:childTnLst'); $firstAnimation = true; foreach ($oAnimation->getShapeCollection() as $oShape) { $nodeType = $firstAnimation ? 'clickEffect' : 'withEffect'; $shapeId = $hashToIdMap[$oShape->getHashCode()]; // p:par $objWriter->startElement('p:par'); // p:par/p:cTn $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('presetID', '1'); $objWriter->writeAttribute('presetClass', 'entr'); $objWriter->writeAttribute('fill', 'hold'); $objWriter->writeAttribute('presetSubtype', '0'); $objWriter->writeAttribute('grpId', '0'); $objWriter->writeAttribute('nodeType', $nodeType); // p:par/p:cTn/p:stCondLst $objWriter->startElement('p:stCondLst'); // p:par/p:cTn/p:stCondLst/p:cond $objWriter->startElement('p:cond'); $objWriter->writeAttribute('delay', '0'); $objWriter->endElement(); // p:par/p:cTn\##p:stCondLst $objWriter->endElement(); // p:par/p:cTn/p:childTnLst $objWriter->startElement('p:childTnLst'); // p:par/p:cTn/p:childTnLst/p:set $objWriter->startElement('p:set'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr $objWriter->startElement('p:cBhvr'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn $objWriter->startElement('p:cTn'); $objWriter->writeAttribute('id', $idCount++); $objWriter->writeAttribute('dur', '1'); $objWriter->writeAttribute('fill', 'hold'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn/p:stCondLst $objWriter->startElement('p:stCondLst'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn/p:stCondLst/p:cond $objWriter->startElement('p:cond'); $objWriter->writeAttribute('delay', '0'); $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:cTn\##p:stCondLst $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:cTn $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl $objWriter->startElement('p:tgtEl'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt $objWriter->startElement('p:spTgt'); $objWriter->writeAttribute('spid', $shapeId); $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:tgtEl $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst $objWriter->startElement('p:attrNameLst'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName $objWriter->writeElement('p:attrName', 'style.visibility'); // p:par/p:cTn/p:childTnLst/p:set/p:cBhvr\##p:attrNameLst $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set\##p:cBhvr $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set/p:to $objWriter->startElement('p:to'); // p:par/p:cTn/p:childTnLst/p:set/p:to/p:strVal $objWriter->startElement('p:strVal'); $objWriter->writeAttribute('val', 'visible'); $objWriter->endElement(); // p:par/p:cTn/p:childTnLst/p:set\##p:to $objWriter->endElement(); // p:par/p:cTn/p:childTnLst\##p:set $objWriter->endElement(); // p:par/p:cTn\##p:childTnLst $objWriter->endElement(); // p:par\##p:cTn $objWriter->endElement(); // ##p:par $objWriter->endElement(); $firstAnimation = false; } // 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 $objWriter->endElement(); // 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 $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst\##p:par $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn\##p:childTnLst $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par\##p:cTn $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst\##p:par $objWriter->endElement(); } // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn\##p:childTnLst $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:cTn $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst $objWriter->startElement('p:prevCondLst'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond $objWriter->startElement('p:cond'); $objWriter->writeAttribute('evt', 'onPrev'); $objWriter->writeAttribute('delay', '0'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond/p:tgtEl $objWriter->startElement('p:tgtEl'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond/p:tgtEl/p:sldTgt $objWriter->writeElement('p:sldTgt', null); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst/p:cond\##p:tgtEl $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:prevCondLst\##p:cond $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:prevCondLst $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst $objWriter->startElement('p:nextCondLst'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond $objWriter->startElement('p:cond'); $objWriter->writeAttribute('evt', 'onNext'); $objWriter->writeAttribute('delay', '0'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl $objWriter->startElement('p:tgtEl'); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl/p:sldTgt $objWriter->writeElement('p:sldTgt', null); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond\##p:tgtEl $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst\##p:cond $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq\##p:nextCondLst $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn/p:childTnLst\##p:seq $objWriter->endElement(); // p:timing/p:tnLst/p:par/p:cTn\##p:childTnLst $objWriter->endElement(); // p:timing/p:tnLst/p:par\##p:cTn $objWriter->endElement(); // p:timing/p:tnLst\##p:par $objWriter->endElement(); // p:timing\##p:tnLst $objWriter->endElement(); // p:timing/p:bldLst $objWriter->startElement('p:bldLst'); // Add in ids of all shapes in this slides animations foreach ($arrayAnimationIds as $id) { // p:timing/p:bldLst/p:bldP $objWriter->startElement('p:bldP'); $objWriter->writeAttribute('spid', $id); $objWriter->writeAttribute('grpId', 0); $objWriter->endELement(); } // p:timing\##p:bldLst $objWriter->endElement(); // ##p:timing $objWriter->endElement(); }
public function testVisible() { $object = new Slide(); $this->assertTrue($object->isVisible()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setIsVisible(false)); $this->assertFalse($object->isVisible()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setIsVisible()); $this->assertTrue($object->isVisible()); }