diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 17:20:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 18:18:28 +0200 |
commit | c2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch) | |
tree | 350741d6d19564bcaf00506bd7d22b4c644e0fdc /connectivity/source/drivers/postgresql/pq_driver.cxx | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_driver.cxx')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_driver.cxx | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index ed8480c318c4..5a8dd9c15bf3 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -57,13 +57,12 @@ #include <stdio.h> +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/compbase1.hxx> #include <cppuhelper/compbase2.hxx> #include <cppuhelper/implementationentry.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> - #include "pq_driver.hxx" using rtl::OUString; @@ -86,7 +85,6 @@ using com::sun::star::uno::XComponentContext; using com::sun::star::uno::Any; using com::sun::star::beans::PropertyValue; -using com::sun::star::beans::XPropertySet; using com::sun::star::sdbc::XConnection; using com::sun::star::sdbc::SQLException; @@ -352,26 +350,17 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( // XSingleComponentFactory interface ... void * pRet = 0; Reference< XSingleComponentFactory > xFactory; - Reference< XInterface > xSmgr( (XInterface * ) pServiceManager ); + Reference< com::sun::star::lang::XMultiServiceFactory > xSmgr( + static_cast< XInterface * >(pServiceManager), + com::sun::star::uno::UNO_QUERY_THROW ); for( sal_Int32 i = 0 ; g_entries[i].create ; i ++ ) { OUString implName = g_entries[i].getImplementationName(); if( 0 == implName.compareToAscii( pImplName ) ) { - Reference< XComponentContext > defaultContext; - Reference< XPropertySet > propSet( xSmgr, UNO_QUERY ); - if( propSet.is() ) - { - try - { - propSet->getPropertyValue( ASCII_STR( "DefaultContext" ) ) >>= defaultContext; - } - catch( com::sun::star::uno::Exception & ) - { - // if there is no default context, ignore it - } - } + Reference< XComponentContext > defaultContext( + comphelper::getComponentContext( xSmgr ) ); xFactory = new pq_sdbc_driver::OOneInstanceComponentFactory( implName, g_entries[i].create, |