[Libreoffice-commits] core.git: sd/qa svx/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 28 08:22:17 UTC 2016


 sd/qa/unit/data/odp/embedded-pdf.odp |binary
 sd/qa/unit/export-tests.cxx          |   14 ++++++++++++++
 svx/source/svdraw/svdograf.cxx       |    3 +++
 3 files changed, 17 insertions(+)

New commits:
commit 1632d6380cb905c3d3c022079e703abf7ce14f5e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 28 09:08:51 2016 +0200

    ODP export: add embedded pdf support
    
    This is basically the draw shape equivalent of
    SwGrfNode::GetReplacementGrfObj(), that already had explicit code for
    PDF purposes.
    
    Change-Id: I00a619082f59a3e377d45c3a59615cadae295586
    Reviewed-on: https://gerrit.libreoffice.org/26724
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sd/qa/unit/data/odp/embedded-pdf.odp b/sd/qa/unit/data/odp/embedded-pdf.odp
new file mode 100644
index 0000000..87aec5a
Binary files /dev/null and b/sd/qa/unit/data/odp/embedded-pdf.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 0dd47e5..a2c3be2 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -157,6 +157,7 @@ public:
     void testTdf80224();
     void testTdf92527();
     void testTdf99224();
+    void testEmbeddedPdf();
 
     CPPUNIT_TEST_SUITE(SdExportTest);
     CPPUNIT_TEST(testFdo90607);
@@ -212,6 +213,7 @@ public:
     CPPUNIT_TEST(testExtFileField);
     CPPUNIT_TEST(testAuthorField);
     CPPUNIT_TEST(testTdf99224);
+    CPPUNIT_TEST(testEmbeddedPdf);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1722,6 +1724,18 @@ void SdExportTest::testTdf99224()
     xShell->DoClose();
 }
 
+void SdExportTest::testEmbeddedPdf()
+{
+    sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/embedded-pdf.odp"), ODP);
+    xShell = saveAndReload(xShell, ODP);
+    uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
+    uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY);
+    OUString aReplacementGraphicURL;
+    xShape->getPropertyValue("ReplacementGraphicURL") >>= aReplacementGraphicURL;
+    CPPUNIT_ASSERT(!aReplacementGraphicURL.isEmpty());
+    xShell->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 93a662b..2dc6371 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -443,6 +443,9 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
         {
             const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
         }
+        else if (pGraphic->GetGraphic().getPdfData().hasElements())
+            // Replacement graphic for metafile + PDF is just the metafile.
+            const_cast<SdrGrafObj*>(this)->mpReplacementGraphic = new GraphicObject(pGraphic->GetGraphic().GetGDIMetaFile());
     }
 
     return mpReplacementGraphic;


More information about the Libreoffice-commits mailing list