summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-04-15 12:12:47 +0200
committerLászló Németh <nemeth@numbertext.org>2021-04-29 11:03:09 +0200
commitd0550d1c5d0e27b8fe9d93e2c7a6dc7ffc4f8c21 (patch)
treefe6d359c2ad9ae0b062cdbb5f78faf1af6ce5bfe
parent225ee785520bbbee5b2d9bd63915db7197ee7ccc (diff)
tdf#65724 PPTX import: fix internal hyperlink to slide
Internal hyperlinks were lost, if they refer slides using their names. Change-Id: Ic464300adb1e6e50bd4d61d957306592b7b22b14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114139 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--oox/source/drawingml/hyperlinkcontext.cxx2
-rw-r--r--sd/qa/unit/data/pptx/tdf65724.pptxbin0 -> 34421 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx28
3 files changed, 29 insertions, 1 deletions
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index 7ea5d5d10b53..0221e3875d31 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -96,7 +96,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
}
else if ( aPPAction.match( "hlinksldjump" ) )
{
- sURL.clear();
+ sHref = sURL;
sal_Int32 nIndex2 = 0;
while ( nIndex2 < sHref.getLength() )
diff --git a/sd/qa/unit/data/pptx/tdf65724.pptx b/sd/qa/unit/data/pptx/tdf65724.pptx
new file mode 100644
index 000000000000..fef2d9f2dde7
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf65724.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index cbe6c061d90e..bbdc8b5a19cd 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -119,6 +119,7 @@ public:
virtual void setUp() override;
void testDocumentLayout();
+ void testInternalHyperlink();
void testHyperlinkColor();
void testSmoketest();
void testTdf131269();
@@ -236,6 +237,7 @@ public:
CPPUNIT_TEST_SUITE(SdImportTest);
CPPUNIT_TEST(testDocumentLayout);
+ CPPUNIT_TEST(testInternalHyperlink);
CPPUNIT_TEST(testHyperlinkColor);
CPPUNIT_TEST(testSmoketest);
CPPUNIT_TEST(testTdf131269);
@@ -429,6 +431,32 @@ void SdImportTest::testDocumentLayout()
}
}
+void SdImportTest::testInternalHyperlink()
+{
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf65724.pptx"), PPTX);
+
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 0, xDocShRef ) );
+
+ // Get first paragraph
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
+
+ // first chunk of text
+ uno::Reference<text::XTextRange> xRun( getRunFromParagraph( 0, xParagraph ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
+
+ uno::Reference<text::XTextField> xField;
+ xPropSet->getPropertyValue("TextField") >>= xField;
+ CPPUNIT_ASSERT_MESSAGE("The text field is missing!", xField.is() );
+
+ xPropSet.set(xField, uno::UNO_QUERY);
+ OUString aURL;
+ xPropSet->getPropertyValue("URL") >>= aURL;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", OUString("#Slide2"), aURL);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testHyperlinkColor()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf137367.pptx"), PPTX);