diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-06 15:08:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:45 +0200 |
commit | 36d0933b6689c31abe65c1fdfa10d18e22d1e958 (patch) | |
tree | efb57749b81492ffd45e508e2cc87b7d9a148f7c /svtools | |
parent | a74854cb9aaeb260175d3174185631fc5d37bf9b (diff) |
fdo#46808, convert some svtools code to XComponentContext
Change-Id: Icf939095f130e684db88a8563c56f4eb1e6079bc
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/framestatuslistener.hxx | 6 | ||||
-rw-r--r-- | svtools/source/control/toolbarmenu.cxx | 9 | ||||
-rw-r--r-- | svtools/source/control/toolbarmenuimp.hxx | 1 | ||||
-rw-r--r-- | svtools/source/uno/framestatuslistener.cxx | 18 |
4 files changed, 15 insertions, 19 deletions
diff --git a/svtools/inc/svtools/framestatuslistener.hxx b/svtools/inc/svtools/framestatuslistener.hxx index 3ef523a5e5e9..cc04fbaf7039 100644 --- a/svtools/inc/svtools/framestatuslistener.hxx +++ b/svtools/inc/svtools/framestatuslistener.hxx @@ -21,7 +21,7 @@ #define _SVTOOLS_FRAMESTATUSLISTENER_HXX #include "svtools/svtdllapi.h" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> @@ -43,7 +43,7 @@ class SVT_DLLPUBLIC FrameStatusListener : public ::com::sun::star::frame::XStatu public ::cppu::OWeakObject { public: - FrameStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + FrameStatusListener( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); virtual ~FrameStatusListener(); @@ -90,7 +90,7 @@ class SVT_DLLPUBLIC FrameStatusListener : public ::com::sun::star::frame::XStatu sal_Bool m_bInitialized : 1, m_bDisposed : 1; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; URLToDispatchMap m_aListenerMap; }; diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index e68cffd2c0f9..4b817c110da6 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -193,7 +193,6 @@ Reference< XAccessible > ToolbarMenuEntry::getAccessibleChild( sal_Int32 index ) ToolbarMenu_Impl::ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ) : mrMenu( rMenu ) , mxFrame( xFrame ) -, mxServiceManager( ::comphelper::getProcessServiceFactory() ) , mnCheckPos(0) , mnImagePos(0) , mnTextPos(0) @@ -1585,8 +1584,7 @@ void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::Feature class ToolbarMenuStatusListener : public svt::FrameStatusListener { public: - ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolbarMenuStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, ToolbarMenu& rToolbarMenu ); virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); @@ -1598,10 +1596,9 @@ public: // -------------------------------------------------------------------- ToolbarMenuStatusListener::ToolbarMenuStatusListener( - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, ToolbarMenu& rToolbarMenu ) -: svt::FrameStatusListener( xServiceManager, xFrame ) +: svt::FrameStatusListener( ::comphelper::getProcessComponentContext(), xFrame ) , mpMenu( &rToolbarMenu ) { } @@ -1627,7 +1624,7 @@ void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star:: void ToolbarMenu::initStatusListener() { if( !mpImpl->mxStatusListener.is() ) - mpImpl->mxStatusListener.set( new ToolbarMenuStatusListener( mpImpl->mxServiceManager, mpImpl->mxFrame, *this ) ); + mpImpl->mxStatusListener.set( new ToolbarMenuStatusListener( mpImpl->mxFrame, *this ) ); } // -------------------------------------------------------------------- diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index 163e4cc91436..81c71a3955aa 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -270,7 +270,6 @@ struct ToolbarMenu_Impl ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; rtl::Reference< svt::FrameStatusListener > mxStatusListener; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; rtl::Reference< ToolbarMenuAcc > mxAccessible; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxOldSelection; diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx index 008321eb0f57..5e42e7150d34 100644 --- a/svtools/source/uno/framestatuslistener.cxx +++ b/svtools/source/uno/framestatuslistener.cxx @@ -37,13 +37,13 @@ namespace svt { FrameStatusListener::FrameStatusListener( - const Reference< XMultiServiceFactory >& rServiceManager, + const Reference< XComponentContext >& rxContext, const Reference< XFrame >& xFrame ) : OWeakObject() , m_bInitialized( sal_True ) , m_bDisposed( sal_False ) , m_xFrame( xFrame ) - , m_xServiceManager( rServiceManager ) + , m_xContext( rxContext ) { } @@ -96,7 +96,7 @@ throw (::com::sun::star::uno::RuntimeException) try { Reference< XDispatch > xDispatch( pIter->second ); - Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::getComponentContext(m_xServiceManager) ) ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( m_xContext ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); @@ -181,9 +181,9 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL ) { // Add status listener directly as intialize has already been called. Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - if ( m_xServiceManager.is() && xDispatchProvider.is() ) + if ( m_xContext.is() && xDispatchProvider.is() ) { - Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::getComponentContext(m_xServiceManager) ) ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( m_xContext ) ); aTargetURL.Complete = aCommandURL; xURLTransformer->parseStrict( aTargetURL ); xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); @@ -235,13 +235,13 @@ void FrameStatusListener::bindListener() // Collect all registered command URL's and store them temporary Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - if ( m_xServiceManager.is() && xDispatchProvider.is() ) + if ( m_xContext.is() && xDispatchProvider.is() ) { xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ); URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) { - Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::getComponentContext(m_xServiceManager) ) ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( m_xContext ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); @@ -304,13 +304,13 @@ void FrameStatusListener::unbindListener() // Collect all registered command URL's and store them temporary Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - if ( m_xServiceManager.is() && xDispatchProvider.is() ) + if ( m_xContext.is() && xDispatchProvider.is() ) { Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) { - Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::getComponentContext(m_xServiceManager) ) ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( m_xContext ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); |