From b3c76dee6d44d07eae404b8d7341e6c88e6c4429 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 26 May 2012 13:53:19 +0200 Subject: fdo#46808, Adapt UNO services to new style, Part 7, updating ::create Update calls to factories to use new ::create methods Change-Id: I01d4417820f52718836c92faf3c2fae0dc96b30d Signed-off-by: Stephan Bergmann , added some tweaks. --- extensions/source/plugin/base/xplugin.cxx | 23 ++++++++++------------- extensions/source/propctrlr/browserline.cxx | 8 ++++++-- extensions/source/update/ui/updatecheckui.cxx | 27 +++++++++++---------------- 3 files changed, 27 insertions(+), 31 deletions(-) (limited to 'extensions') diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index 897be135a541..4d2b0420ea24 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -42,7 +42,9 @@ #include #include #include +#include +#include #include #include #include @@ -137,8 +139,8 @@ XPlugin_Impl::XPlugin_Impl( const uno::Reference< com::sun::star::lang::XMultiSe uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); xPS->addPropertyChangeListener( OUString(), this ); - Guard< Mutex > aGuard( PluginManager::get().getPluginMutex() ); - PluginManager::get().getPlugins().push_back( this ); + Guard< Mutex > aGuard( ::PluginManager::get().getPluginMutex() ); + ::PluginManager::get().getPlugins().push_back( this ); } void XPlugin_Impl::destroyInstance() @@ -198,11 +200,11 @@ IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, /*pThis*/ ) // may have become undisposable between PostUserEvent and here // or may have disposed and receive a second UserEvent - std::list& rList = PluginManager::get().getPlugins(); + std::list& rList = ::PluginManager::get().getPlugins(); std::list::iterator iter; { - Guard< Mutex > aPluginGuard( PluginManager::get().getPluginMutex() ); + Guard< Mutex > aPluginGuard( ::PluginManager::get().getPluginMutex() ); for( iter = rList.begin(); iter != rList.end(); ++iter ) { if( *iter == this ) @@ -222,7 +224,7 @@ IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, /*pThis*/ ) uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); xPS->removePropertyChangeListener( OUString(), this ); { - Guard< Mutex > aPluginGuard( PluginManager::get().getPluginMutex() ); + Guard< Mutex > aPluginGuard( ::PluginManager::get().getPluginMutex() ); rList.remove( this ); } m_aNPWindow.window = NULL; @@ -512,8 +514,8 @@ void XPlugin_Impl::loadPlugin() Guard< Mutex > aGuard( m_aMutex ); std::list::iterator iter; - for( iter = PluginManager::get().getPluginComms().begin(); - iter != PluginManager::get().getPluginComms().end(); ++iter ) + for( iter = ::PluginManager::get().getPluginComms().begin(); + iter != ::PluginManager::get().getPluginComms().end(); ++iter ) { if( OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName ) { @@ -893,12 +895,7 @@ void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, PluginDescription XPlugin_Impl::fitDescription( const OUString& rURL ) { - uno::Reference< XPluginManager > xPMgr( m_xSMgr->createInstance( OUString("com.sun.star.plugin.PluginManager") ), UNO_QUERY ); - if( !xPMgr.is() ) - { - m_nProvidingState = PROVIDING_NONE; - return PluginDescription(); - } + uno::Reference< XPluginManager > xPMgr( plugin::PluginManager::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()) ); Sequence< PluginDescription > aDescrs = xPMgr->getPluginDescriptions(); const PluginDescription* pDescrs = aDescrs.getConstArray(); diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index 480ac6badacd..816612344e5e 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -28,7 +28,9 @@ #include "browserline.hxx" +#include #include +#include #include #include @@ -46,10 +48,12 @@ namespace pcr /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::inspection::XPropertyControl; using ::com::sun::star::inspection::XPropertyControlContext; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; + using ::com::sun::star::graphic::GraphicProvider; using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::PropertyValue; @@ -412,8 +416,8 @@ namespace pcr { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) ); Sequence< PropertyValue > aMediaProperties(1); aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 2c974dcf508f..53d41c40efd2 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -323,30 +324,24 @@ Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL ) if ( !maBubbleImageURL.isEmpty() ) { - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - if( !xServiceManager.is() ) + if( !xContext.is() ) throw uno::RuntimeException( UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ), uno::Reference< uno::XInterface >() ); try { - uno::Reference< graphic::XGraphicProvider > xGraphProvider( - xServiceManager->createInstance( - ::rtl::OUString("com.sun.star.graphic.GraphicProvider") ), - uno::UNO_QUERY ); - if ( xGraphProvider.is() ) - { - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString("URL"); - aMediaProps[0].Value <<= rURL; + uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext)); + uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); + aMediaProps[0].Name = ::rtl::OUString("URL"); + aMediaProps[0].Value <<= rURL; - uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); - if ( xGraphic.is() ) - { - aImage = Image( xGraphic ); - } + uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); + if ( xGraphic.is() ) + { + aImage = Image( xGraphic ); } } catch( const uno::Exception& ) -- cgit