oox/source/export/shapes.cxx | 13 +++++++++++-- sd/qa/unit/data/pptx/tdf149803.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-)
New commits: commit 869e9e0dfe1cf7f263994468d5c3604b9c9c86c6 Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Wed Nov 9 14:08:02 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Nov 25 10:04:46 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> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143029 Tested-by: Jenkins diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index f7b3480fd972..d8717acb9c06 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -809,11 +809,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)) { @@ -901,7 +907,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 c5a2c2ebc7e8..965ffe7c1387 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -48,6 +48,7 @@ using namespace css; class SdOOXMLExportTest1 : public SdModelTestBaseXML { public: + void testTdf149803(); void testTdf149311(); void testTdf149128(); void testTdf66228(); @@ -121,6 +122,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); + CPPUNIT_TEST(testTdf149803); CPPUNIT_TEST(testTdf149311); CPPUNIT_TEST(testTdf149128); CPPUNIT_TEST(testTdf66228); @@ -221,6 +223,18 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId } +void SdOOXMLExportTest1::testTdf149803() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149803.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp", "useBgFill", "1"); +} + void SdOOXMLExportTest1::testTdf149311() { sd::DrawDocShellRef xDocShRef