From c2ca6fabd1afc3fc07001721c2069d3c8db7000a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 29 Sep 2012 17:20:22 +0200 Subject: Use comphelper::getComponentContext ...and some further clean up. Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9 --- .../source/drivers/postgresql/pq_driver.cxx | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'connectivity/source/drivers/postgresql') 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 +#include #include #include #include #include -#include - #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, -- cgit v1.2.3