oox/source/export/drawingml.cxx | 8 +++++++- sd/qa/unit/data/odp/tdf149311.odp |binary sd/qa/unit/export-tests-ooxml1.cxx | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-)
New commits: commit c49d427170752b6e5a559000c5a0766f0e3da81b Author: Tibor Nagy <[email protected]> AuthorDate: Wed Jun 1 18:05:03 2022 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Jun 27 09:46:19 2022 +0200 tdf#149311 PPTX export: fix internal hyperlink on texts by converting "Slide [digits]" URLs to slide[digits].xml See also commit 4142d728f003166ebe520bfdaf672505e585b807 "tdf#149314 PPTX import: fix internal hyperlink on texts". Change-Id: I39e095c960b04e728b3e28fa0a657d37d9c71ba1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135250 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> (cherry picked from commit e18ef7e14b5f9628f3009c5aadda12bc6b2d7758) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136384 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index dad1ce7a5c44..77363ab4b201 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1984,7 +1984,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation + nCameraRotation), IsGroupShape( rXShape )); } -static OUString lcl_GetTarget(const css::uno::Reference<css::frame::XModel>& xModel, std::u16string_view rURL) +static OUString lcl_GetTarget(const css::uno::Reference<css::frame::XModel>& xModel, OUString& rURL) { Reference<drawing::XDrawPagesSupplier> xDPS(xModel, uno::UNO_QUERY_THROW); Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW); @@ -2005,6 +2005,12 @@ static OUString lcl_GetTarget(const css::uno::Reference<css::frame::XModel>& xMo break; } } + if (sTarget.isEmpty()) + { + sal_Int32 nSplit = rURL.lastIndexOf(' '); + if (nSplit > -1) + sTarget = OUString::Concat("slide") + rURL.subView(nSplit + 1) + ".xml"; + } return sTarget; } diff --git a/sd/qa/unit/data/odp/tdf149311.odp b/sd/qa/unit/data/odp/tdf149311.odp new file mode 100644 index 000000000000..2500ed5e7a51 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149311.odp differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 01d0e9b3336f..c5a2c2ebc7e8 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 testTdf149311(); void testTdf149128(); void testTdf66228(); void testTdf147919(); @@ -120,6 +121,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); + CPPUNIT_TEST(testTdf149311); CPPUNIT_TEST(testTdf149128); CPPUNIT_TEST(testTdf66228); CPPUNIT_TEST(testTdf147919); @@ -219,6 +221,20 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId } +void SdOOXMLExportTest1::testTdf149311() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149311.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocUniquePtr pRelsDoc = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + + assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + "slide2.xml"); +} + void SdOOXMLExportTest1::testTdf149128() { sd::DrawDocShellRef xDocShRef
