Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPoint2007 Writer : Fixed broken animation for first shape #783

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading