summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-10-01 11:46:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-01 11:47:12 +0200
commita900a4d70bb465e24c49a0183c60087328860e83 (patch)
tree31fd9f396880fcdb2acd3f159d1fd38cea0b45e2 /sdext
parent585ad1cde03c395c056ff7aa4a8c814242150679 (diff)
Fail early if getPackageLocation fails; plus clean-up
Change-Id: Ifa7d589e7854fed9cd9ca2a3f3c987179b60199f
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx33
1 files changed, 15 insertions, 18 deletions
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 2d76fff27419..77ce15bf531e 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.
// ---------------------------------------------------