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 | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/Library_postgresql-sdbc.mk | 1 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_driver.cxx | 23 | ||||
-rw-r--r-- | connectivity/source/resource/sharedresources.cxx | 9 |
3 files changed, 8 insertions, 25 deletions
diff --git a/connectivity/Library_postgresql-sdbc.mk b/connectivity/Library_postgresql-sdbc.mk index 1a9f8eb1dd6c..4ce53d8eada0 100644 --- a/connectivity/Library_postgresql-sdbc.mk +++ b/connectivity/Library_postgresql-sdbc.mk @@ -36,6 +36,7 @@ $(eval $(call gb_Library_add_defs,postgresql-sdbc,\ $(eval $(call gb_Library_use_sdk_api,postgresql-sdbc)) $(eval $(call gb_Library_use_libraries,postgresql-sdbc,\ + comphelper \ cppu \ cppuhelper \ sal \ 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, diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx index 246591063547..902807829cb5 100644 --- a/connectivity/source/resource/sharedresources.cxx +++ b/connectivity/source/resource/sharedresources.cxx @@ -22,7 +22,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/officeresourcebundle.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <tools/diagnose_ex.h> @@ -35,8 +34,6 @@ namespace connectivity /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Exception; /** === end UNO using === **/ @@ -82,12 +79,8 @@ namespace connectivity { try { - Reference< XPropertySet > xFactoryProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); Reference< XComponentContext > xContext( - xFactoryProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), - UNO_QUERY_THROW - ); + comphelper::getProcessComponentContext() ); m_pResourceBundle.reset( new ::comphelper::OfficeResourceBundle( xContext, "cnr" ) ); } catch( const Exception& ) |