oox/source/ppt/pptshapecontext.cxx | 2 - sd/qa/unit/data/pptx/tdf144616.pptx |binary sd/qa/unit/import-tests.cxx | 59 ++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-)
New commits: commit 83d92437e05a9ec872d9303953fa408dd4dcbcde Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Sat Sep 25 20:12:27 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Oct 1 17:29:14 2021 +0200 tdf#144616 PPTX import: fix hyperlinks on shapes Follow-up to commit 6e200689eb309cdbe1e4f08311a400835de19bfb "tdf#141704 PPTX import: fix hyperlinks on images" Change-Id: Ie9f1ba56d03462bb8d7ab376e23c89c921a8bcd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122610 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 62351c913567..d7f3d90f2d0f 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -187,7 +187,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con } } - return this; + return ShapeContext::onCreateContext(aElementToken, rAttribs); } } diff --git a/sd/qa/unit/data/pptx/tdf144616.pptx b/sd/qa/unit/data/pptx/tdf144616.pptx new file mode 100644 index 000000000000..bb153dcff904 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf144616.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index edf69608092a..9bae1492fbca 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -243,6 +243,7 @@ public: void testTdf113198(); void testTdf49856(); void testTdf103347(); + void testHyperlinksOnShapes(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -366,6 +367,7 @@ public: CPPUNIT_TEST(testGreysScaleGraphic); CPPUNIT_TEST(testTdf134210CropPosition); CPPUNIT_TEST(testTdf103347); + CPPUNIT_TEST(testHyperlinksOnShapes); CPPUNIT_TEST_SUITE_END(); }; @@ -3601,6 +3603,63 @@ void SdImportTest::testTdf103347() xDocShRef->DoClose(); } +void SdImportTest::testHyperlinksOnShapes() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf144616.pptx"), PPTX); + + for (sal_Int32 i = 0; i < 7; i++) + { + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(i, 0, xDocShRef)); + uno::Reference<document::XEventsSupplier> xEventsSupplier(xShape, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xEvents(xEventsSupplier->getEvents()); + + uno::Sequence<beans::PropertyValue> props; + xEvents->getByName("OnClick") >>= props; + comphelper::SequenceAsHashMap map(props); + auto iter(map.find("ClickAction")); + switch (i) + { + case 0: + CPPUNIT_ASSERT_EQUAL(css::presentation::ClickAction_FIRSTPAGE, + iter->second.get<css::presentation::ClickAction>()); + break; + case 1: + CPPUNIT_ASSERT_EQUAL(css::presentation::ClickAction_LASTPAGE, + iter->second.get<css::presentation::ClickAction>()); + break; + case 2: + CPPUNIT_ASSERT_EQUAL(css::presentation::ClickAction_NEXTPAGE, + iter->second.get<css::presentation::ClickAction>()); + break; + case 3: + CPPUNIT_ASSERT_EQUAL(css::presentation::ClickAction_PREVPAGE, + iter->second.get<css::presentation::ClickAction>()); + break; + case 4: + { + auto iter2(map.find("Bookmark")); + CPPUNIT_ASSERT_EQUAL(OUString("Second slide"), iter2->second.get<OUString>()); + } + break; + case 5: + CPPUNIT_ASSERT_EQUAL(css::presentation::ClickAction_STOPPRESENTATION, + iter->second.get<css::presentation::ClickAction>()); + break; + case 6: + { + auto iter1(map.find("Bookmark")); + CPPUNIT_ASSERT_EQUAL(OUString("http://www.example.com/"), iter1->second.get<OUString>()); + } + break; + default: + break; + } + } + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT();