diff options
author | nd101 <Fong@nd.com.cn> | 2020-09-21 14:07:44 +0800 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-26 17:52:51 +0100 |
commit | f516c0bd3bb69bf9f18160c03bd7309774f88057 (patch) | |
tree | 0e8298e597b74edd0bd307b7b901a4a1f0748df7 /sd | |
parent | 8336c1b579b6dff361e5422ebcdd225056752ed4 (diff) |
tdf#136911 fix ppt hyperlink import
If the hyperlink list is not found, try the secondary approach
by searching through the record list.
Change-Id: I5b3516e1005b102fb3b79f55c2485a7c41b56057
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103081
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/ppt/tdf136911.ppt | bin | 0 -> 56832 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 28 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 25 |
3 files changed, 53 insertions, 0 deletions
diff --git a/sd/qa/unit/data/ppt/tdf136911.ppt b/sd/qa/unit/data/ppt/tdf136911.ppt Binary files differnew file mode 100644 index 000000000000..550dc5c3a4ba --- /dev/null +++ b/sd/qa/unit/data/ppt/tdf136911.ppt diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 861ca9517044..75222f267a58 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -99,6 +99,7 @@ public: void testTdf128345GradientRadial(); void testTdf128345GradientAxial(); void testTdf134969TransparencyOnColorGradient(); + void testTdf136911(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -147,6 +148,7 @@ public: CPPUNIT_TEST(testTdf128345GradientRadial); CPPUNIT_TEST(testTdf128345GradientAxial); CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient); + CPPUNIT_TEST(testTdf136911); CPPUNIT_TEST_SUITE_END(); @@ -646,6 +648,32 @@ void SdOOXMLExportTest1::testTextboxWithHyperlink() xDocShRef->DoClose(); } +void SdOOXMLExportTest1::testTdf136911() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf136911.ppt"), PPT); + + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + // Get second 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("Where is the text field?", xField.is() ); + + xPropSet.set(xField, uno::UNO_QUERY); + OUString aURL; + xPropSet->getPropertyValue("URL") >>= aURL; + CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", OUString("http://google.com"), aURL); + + xDocShRef->DoClose(); +} + void SdOOXMLExportTest1::testBulletColor() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX ); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index d648cb4aa1ac..3883f9d50cfe 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -531,6 +531,31 @@ bool ImplSdPPTImport::Import() if (!aHyperE.SeekToEndOfRecord(rStCtrl)) break; } + + if (m_aHyperList.size() == 0) + { + while(true) + { + + DffRecordHeader aHyperE; + if (!SeekToRec(rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE)) + break; + if (!SeekToRec(rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen)) + continue; + + SdHyperlinkEntry aHyperlink; + + OUString aURLText; + OUString aURLLink; + rStCtrl.SeekRel(8); + rStCtrl.ReadUInt32(aHyperlink.nIndex); + + ReadString(aURLText); + ReadString(aURLLink); + aHyperlink.aTarget = aURLLink; + m_aHyperList.push_back(aHyperlink); + } + } } } |