[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sd/qa sd/source

nd101 (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 30 13:18:52 UTC 2020


 sd/qa/unit/data/ppt/tdf136911.ppt  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   28 ++++++++++++++++++++++++++++
 sd/source/filter/ppt/pptin.cxx     |   25 +++++++++++++++++++++++++
 3 files changed, 53 insertions(+)

New commits:
commit 965e0c147a31b25967a29449d8d7d6c40fc9b50a
Author:     nd101 <Fong at nd.com.cn>
AuthorDate: Mon Sep 21 14:07:44 2020 +0800
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Nov 30 14:18:19 2020 +0100

    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 at collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.grandin at 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 at libreoffice.org>

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
Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf136911.ppt 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);
+                }
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list