From a02ea004c35edeb4e93b1cdcaa087e8bdcf1ee47 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 22 Jan 2021 09:19:00 +0100 Subject: [PATCH] PPTX export: fix size of shape for slide narrations This was invisible in PowerPoint without explicit stretching. Change-Id: I29b9f23eba6d59436cb1b6d15c9840794f932e69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109778 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- oox/source/export/shapes.cxx | 8 ++++++++ sd/qa/unit/export-tests-ooxml1.cxx | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 9033e1d40d88..13c52d22c56e 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1238,6 +1238,14 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape if ( pGraphic || bStretch ) pFS->singleElementNS(XML_a, XML_stretch); + if (bHasMediaURL) + { + // Graphic of media shapes is always stretched. + pFS->startElementNS(XML_a, XML_stretch); + pFS->singleElementNS(XML_a, XML_fillRect); + pFS->endElementNS(XML_a, XML_stretch); + } + pFS->endElementNS( mnXmlNamespace, XML_blipFill ); // visual shape properties diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 91ce68e20a50..e6b32ff357ca 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -1336,6 +1336,12 @@ void SdOOXMLExportTest1::testNarrationMimeType() // i.e. the bitmap of the narration was lost, some default placeholder was exported instead. CPPUNIT_ASSERT_EQUAL(static_cast(256), aBitmapEx.GetSizePixel().Height()); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // i.e. p:blipFill was missing its a:stretch child element, so the shape was invisible. + assertXPath(pSlideDoc, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:stretch/a:fillRect", 1); + xDocShRef->DoClose(); }