summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authornd101 <Fong@nd.com.cn>2020-09-21 14:07:44 +0800
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-30 14:18:19 +0100
commit965e0c147a31b25967a29449d8d7d6c40fc9b50a (patch)
treeca7305927c575ffe02d56eb64bf5cfdefc82ea71 /sd
parent48ad658a7aacf849e773aa5d3400540d81f988f2 (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> (cherry picked from commit f516c0bd3bb69bf9f18160c03bd7309774f88057) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106821 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/ppt/tdf136911.pptbin0 -> 56832 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx28
-rw-r--r--sd/source/filter/ppt/pptin.cxx25
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
new file mode 100644
index 000000000000..550dc5c3a4ba
--- /dev/null
+++ b/sd/qa/unit/data/ppt/tdf136911.ppt
Binary files differ
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);
+ }
+ }
}
}