[Libreoffice-commits] .: sdext/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 02:47:52 PDT 2012


 sdext/source/pdfimport/wrapper/wrapper.cxx |   33 +++++++++++++----------------
 1 file changed, 15 insertions(+), 18 deletions(-)

New commits:
commit a900a4d70bb465e24c49a0183c60087328860e83
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 1 11:46:24 2012 +0200

    Fail early if getPackageLocation fails; plus clean-up
    
    Change-Id: Ifa7d589e7854fed9cd9ca2a3f3c987179b60199f

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 2d76fff..77ce15b 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -44,7 +44,7 @@
 #include "com/sun/star/io/XInputStream.hpp"
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/awt/FontDescriptor.hpp"
-#include "com/sun/star/deployment/XPackageInformationProvider.hpp"
+#include "com/sun/star/deployment/PackageInformationProvider.hpp"
 #include "com/sun/star/beans/XMaterialHolder.hpp"
 #include "com/sun/star/rendering/PathCapType.hpp"
 #include "com/sun/star/rendering/PathJoinType.hpp"
@@ -999,24 +999,21 @@ bool xpdf_ImportFromFile( const ::rtl::OUString&                             rUR
     if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted, aDocName ) == false )
         return false;
 
-    rtl::OUStringBuffer converterURL = rtl::OUString("xpdfimport");
-
-    // retrieve package location url (xpdfimport executable is located there)
-    // ---------------------------------------------------
-    uno::Reference<deployment::XPackageInformationProvider> xProvider(
-        xContext->getValueByName(
-            rtl::OUString("/singletons/com.sun.star.deployment.PackageInformationProvider")),
-        uno::UNO_QUERY);
-    if( xProvider.is() )
-    {
-        converterURL.insert(
-            0,
-            rtl::OUString("/"));
-        converterURL.insert(
-            0,
-            xProvider->getPackageLocation(
-                rtl::OUString::createFromAscii(PDFI_IMPL_IDENTIFIER)));
+    // Retrieve package location URL, xpdfimport executable is located there:
+    OUString location(
+        deployment::PackageInformationProvider::get(xContext)->
+        getPackageLocation(PDFI_IMPL_IDENTIFIER));
+    if (location.isEmpty()) {
+        SAL_WARN(
+            "sdext.pdfimport",
+            "getPackageLocation(" PDFI_IMPL_IDENTIFIER ") failed");
+        return false;
+    }
+    rtl::OUStringBuffer converterURL(location);
+    if (!location.endsWith("/")) {
+        converterURL.append('/');
     }
+    converterURL.append("xpdfimport");
 
     // spawn separate process to keep LGPL/GPL code apart.
     // ---------------------------------------------------


More information about the Libreoffice-commits mailing list