Skip to content

Commit

Permalink
PowerPoint2007 Writer : Fixed broken animation for first shape
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Dec 12, 2023
1 parent 9071151 commit 66a4a85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changes/1.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- PowerPoint2007 Writer : Fixed issue when first element in series is null - [@ksmeeks0001](https://github.com/ksmeeks0001) in [#778](https://github.com/PHPOffice/PHPPresentation/pull/778)
- PowerPoint2007 & ODPresentation Writer : Use of the disk caching directory for temporary files - [@nhalle](https://github.com/nhalle) in [#781](https://github.com/PHPOffice/PHPPresentation/pull/781)
- PowerPoint2007 Reader : Fixed reading of RichText shape in Note - [@aelliott1485](https://github.com/aelliott1485) in [#782](https://github.com/PHPOffice/PHPPresentation/pull/782)
- PowerPoint2007 Writer : Fixed broken animation for first shape - [@shannan1989](https://github.com/shannan1989) in [#783](https://github.com/PHPOffice/PHPPresentation/pull/783)

## Miscellaneous

Expand Down
5 changes: 4 additions & 1 deletion src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ protected function writeDrawingRelations(AbstractSlideAlias $pSlideMaster, XMLWr
}

/**
* Note : $shapeId needs to start to 1
* The animation is applied to the shape which is next to the target shape.
*
* @param array<int, AbstractShape>|ArrayObject<int, AbstractShape> $shapes
* @param int $shapeId
*/
protected function writeShapeCollection(XMLWriter $objWriter, $shapes = [], &$shapeId = 0): void
protected function writeShapeCollection(XMLWriter $objWriter, $shapes = [], &$shapeId = 1): void
{
if (0 == count($shapes)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testAnimation(): void
{
$oSlide = $this->oPresentation->getActiveSlide();
$oShape1 = $oSlide->createRichTextShape();
$oShape2 = $oSlide->createRichTextShape();
$oShape2 = $oSlide->createLineShape(10, 10, 10, 10);
$oAnimation = new Animation();
$oAnimation->addShape($oShape1);
$oAnimation->addShape($oShape2);
Expand All @@ -142,6 +142,12 @@ public function testAnimation(): void
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$element = '/p:sld/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/p:par';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$element = '/p:sld/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/p:par[1]/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'spid', 2);
$element = '/p:sld/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/p:par[2]/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'spid', 3);
$this->assertIsSchemaECMA376Valid();
}

Expand Down

0 comments on commit 66a4a85

Please sign in to comment.