oox/source/export/shapes.cxx | 13 +++++++++++-- sd/qa/unit/data/pptx/tdf149803.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 11 +++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-)
New commits: commit ab10008ecaa33228838115a0b714e4f118c07ac1 Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Wed Nov 9 14:08:02 2022 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Nov 21 10:04:36 2022 +0100 tdf#149803 tdf#128150 PPTX: export UseBgFill of custom shapes Fixing tdf#128150 the UseBgFill property of shapes can be saved to PPTX, but not in the case of custom shapes. Follow-up to commits c4cf2e82e8d0aaef9b1daedc033d6edf647e5284 (tdf#128150 Add OOXML import/export for "use background fill"), commit 50394abcc36a73c0205e6cb69d925c66c25f81f2, (tdf#128150 Implement/add SlideBackgroundFill visualization") and commit 9c2c48f14535e58cad0453fef584400ee703aecc "tdf#128150 xmloff: ODF import/export of fill-use-slide-background". Change-Id: Ib88f236d2533ef71ea66718d380e83d9a0685c3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142489 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 9d00dff8348c..70466d17fdb1 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -812,11 +812,17 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) } FSHelperPtr pFS = GetFS(); - pFS->startElementNS(mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes ? XML_sp : XML_wsp)); - // non visual shape properties if (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes) { + bool bUseBackground = false; + if (GETA(FillUseSlideBackground)) + mAny >>= bUseBackground; + if (bUseBackground) + mpFS->startElementNS(mnXmlNamespace, XML_sp, XML_useBgFill, "1"); + else + mpFS->startElementNS(mnXmlNamespace, XML_sp); + bool isVisible = true ; if( GETA (Visible)) { @@ -904,7 +910,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); } else + { + pFS->startElementNS(mnXmlNamespace, XML_wsp); pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr); + } // visual shape properties pFS->startElementNS(mnXmlNamespace, XML_spPr); diff --git a/sd/qa/unit/data/pptx/tdf149803.pptx b/sd/qa/unit/data/pptx/tdf149803.pptx new file mode 100644 index 000000000000..a3a16cc23fdc Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149803.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 97d2b80902c8..866cd331dc68 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -53,6 +53,7 @@ public: { } + void testTdf149803(); void testTdf149311(); void testTdf149128(); void testTdf66228(); @@ -126,6 +127,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); + CPPUNIT_TEST(testTdf149803); CPPUNIT_TEST(testTdf149311); CPPUNIT_TEST(testTdf149128); CPPUNIT_TEST(testTdf66228); @@ -225,6 +227,15 @@ void checkFontAttributes(const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId) } } +void SdOOXMLExportTest1::testTdf149803() +{ + loadFromURL(u"pptx/tdf149803.pptx"); + save("Impress Office Open XML"); + + xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp", "useBgFill", "1"); +} + void SdOOXMLExportTest1::testTdf149311() { loadFromURL(u"odp/tdf149311.odp");