oox/source/export/shapes.cxx | 13 +++++++++---- sd/qa/unit/data/odp/tdf149128.odp |binary sd/qa/unit/export-tests-ooxml1.cxx | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-)
New commits: commit c3f73f75772d076dfb2ed0538e7d515503edc038 Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Wed May 25 12:29:10 2022 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon May 30 12:48:03 2022 +0200 tdf#149128 PPTX export: fix <stCxn> and <endCxn> connector properties to avoid of detaching connections between shapes, when these connections were created in Impress. Change-Id: I1bc90bb8a408546b303b70bcfb27d3549d5e72d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134940 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 284daea2db21..9854c98a584e 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -818,10 +818,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) mAny >>= isVisible; } pFS->startElementNS( mnXmlNamespace, XML_nvSpPr ); - pFS->startElementNS( mnXmlNamespace, XML_cNvPr, - XML_id, OString::number(GetNewShapeID(xShape)), - XML_name, GetShapeName(xShape), - XML_hidden, sax_fastparser::UseIf("1", !isVisible)); + pFS->startElementNS( + mnXmlNamespace, XML_cNvPr, XML_id, + OString::number(GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) : GetShapeID(xShape)), + XML_name, GetShapeName(xShape), XML_hidden, sax_fastparser::UseIf("1", !isVisible)); if( GETA( URL ) ) { @@ -1745,6 +1745,11 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape XML_name, GetShapeName(xShape)); // non visual connector shape drawing properties pFS->startElementNS(mnXmlNamespace, XML_cNvCxnSpPr); + + if (GetShapeID(rXShapeA) == -1) + GetNewShapeID(rXShapeA); + if (GetShapeID(rXShapeB) == -1) + GetNewShapeID(rXShapeB); WriteConnectorConnections(aConnectorEntry, GetShapeID(rXShapeA), GetShapeID(rXShapeB)); pFS->endElementNS(mnXmlNamespace, XML_cNvCxnSpPr); if (GetDocumentType() == DOCUMENT_PPTX) diff --git a/sd/qa/unit/data/odp/tdf149128.odp b/sd/qa/unit/data/odp/tdf149128.odp new file mode 100644 index 000000000000..0c26fdd6b3a7 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149128.odp differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 70c64d793084..01d0e9b3336f 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 testTdf149128(); void testTdf66228(); void testTdf147919(); void testTdf130165(); @@ -119,6 +120,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); + CPPUNIT_TEST(testTdf149128); CPPUNIT_TEST(testTdf66228); CPPUNIT_TEST(testTdf147919); CPPUNIT_TEST(testTdf130165); @@ -217,6 +219,21 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId } +void SdOOXMLExportTest1::testTdf149128() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149128.odp"), ODP); + 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:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id", "42"); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", "0"); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "id", "43"); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", "2"); +} + void SdOOXMLExportTest1::testTdf66228() { sd::DrawDocShellRef xDocShRef