summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-03-20 09:29:30 +0200
committerNoel Grandin <noel@peralex.com>2013-04-08 13:53:03 +0200
commit86fdce60115014ddfae05993ef43686c9dbd6004 (patch)
treed50705d5f93fec079e4d676cd2a5a9c50783c6f3 /svtools/source
parent34da7fbcc643ad209290c6da456dbfb17aeb9ac0 (diff)
fdo#46808, Convert svt::ToolboxController to XComponentContext
.. and all of it's friends Change-Id: I408d9308d1d1a4f8ed0055ac5f4042d729c44d1e
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/uno/generictoolboxcontroller.cxx16
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx4
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx45
3 files changed, 35 insertions, 30 deletions
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index 73bbeb0f2083..1f43c1b918fb 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -49,12 +49,12 @@ struct ExecuteInfo
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
};
-GenericToolboxController::GenericToolboxController( const Reference< XMultiServiceFactory >& rServiceManager,
- const Reference< XFrame >& rFrame,
- ToolBox* pToolbox,
- sal_uInt16 nID,
- const OUString& aCommand ) :
- svt::ToolboxController( rServiceManager, rFrame, aCommand )
+GenericToolboxController::GenericToolboxController( const Reference< XComponentContext >& rxContext,
+ const Reference< XFrame >& rFrame,
+ ToolBox* pToolbox,
+ sal_uInt16 nID,
+ const OUString& aCommand ) :
+ svt::ToolboxController( rxContext, rFrame, aCommand )
, m_pToolbox( pToolbox )
, m_nID( nID )
{
@@ -96,10 +96,10 @@ throw ( RuntimeException )
if ( m_bInitialized &&
m_xFrame.is() &&
- m_xServiceManager.is() &&
+ m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
- xURLTransformer = com::sun::star::util::URLTransformer::create( ::comphelper::getComponentContext(m_xServiceManager) );
+ xURLTransformer = URLTransformer::create( m_xContext );
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index c5ae27a27b40..87846819092a 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -133,10 +133,10 @@ IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window*, pWin
// class PopupWindowController
//========================================================================
-PopupWindowController::PopupWindowController( const Reference< lang::XMultiServiceFactory >& rServiceManager,
+PopupWindowController::PopupWindowController( const Reference< uno::XComponentContext >& rxContext,
const Reference< frame::XFrame >& xFrame,
const OUString& aCommandURL )
-: svt::ToolboxController( rServiceManager, xFrame, aCommandURL )
+: svt::ToolboxController( rxContext, xFrame, aCommandURL )
, mpImpl( new PopupWindowControllerImpl() )
{
}
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index 4992c16c8c1e..25e519b7e8d5 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <osl/mutex.hxx>
@@ -73,8 +74,7 @@ struct ToolboxController_Impl
};
ToolboxController::ToolboxController(
-
- const Reference< XMultiServiceFactory >& rServiceManager,
+ const Reference< XComponentContext >& rxContext,
const Reference< XFrame >& xFrame,
const OUString& aCommandURL ) :
OPropertyContainer(GetBroadcastHelper())
@@ -83,20 +83,21 @@ ToolboxController::ToolboxController(
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
, m_xFrame(xFrame)
- , m_xServiceManager( rServiceManager )
+ , m_xContext( rxContext )
, m_aCommandURL( aCommandURL )
, m_aListenerContainer( m_aMutex )
{
- registerProperty(OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE), TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ OSL_ASSERT( m_xContext.is() );
+ registerProperty( OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE),
+ TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE,
+ css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY,
&m_bSupportVisible, getCppuType(&m_bSupportVisible));
m_pImpl = new ToolboxController_Impl;
try
{
- m_pImpl->m_xUrlTransformer.set(
- ::com::sun::star::util::URLTransformer::create(
- ::comphelper::getComponentContext(m_xServiceManager) ) );
+ m_pImpl->m_xUrlTransformer = URLTransformer::create( rxContext );
}
catch(const Exception&)
{
@@ -111,7 +112,9 @@ ToolboxController::ToolboxController() :
, m_bDisposed( sal_False )
, m_aListenerContainer( m_aMutex )
{
- registerProperty(OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE), TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ registerProperty( OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE),
+ TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE,
+ css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY,
&m_bSupportVisible, getCppuType(&m_bSupportVisible));
m_pImpl = new ToolboxController_Impl;
@@ -128,10 +131,10 @@ Reference< XFrame > ToolboxController::getFrameInterface() const
return m_xFrame;
}
-Reference< XMultiServiceFactory > ToolboxController::getServiceManager() const
+const Reference< XComponentContext > & ToolboxController::getContext() const
{
SolarMutexGuard aSolarMutexGuard;
- return m_xServiceManager;
+ return m_xContext;
}
Reference< XLayoutManager > ToolboxController::getLayoutManager() const
@@ -221,7 +224,11 @@ throw ( Exception, RuntimeException )
else if ( aPropValue.Name == "CommandURL" )
aPropValue.Value >>= m_aCommandURL;
else if ( aPropValue.Name == "ServiceManager" )
- m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
+ {
+ Reference<XMultiServiceFactory> xMSF(aPropValue.Value, UNO_QUERY);
+ if (xMSF.is())
+ m_xContext = comphelper::getComponentContext(xMSF);
+ }
else if ( aPropValue.Name == "ParentWindow" )
m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
else if ( aPropValue.Name == "ModuleName" )
@@ -231,10 +238,8 @@ throw ( Exception, RuntimeException )
try
{
- if ( !m_pImpl->m_xUrlTransformer.is() && m_xServiceManager.is() )
- m_pImpl->m_xUrlTransformer.set(
- ::com::sun::star::util::URLTransformer::create(
- ::comphelper::getComponentContext(m_xServiceManager) ) );
+ if ( !m_pImpl->m_xUrlTransformer.is() && m_xContext.is() )
+ m_pImpl->m_xUrlTransformer = URLTransformer::create( m_xContext );
}
catch(const Exception&)
{
@@ -360,7 +365,7 @@ throw (::com::sun::star::uno::RuntimeException)
if ( m_bInitialized &&
m_xFrame.is() &&
- m_xServiceManager.is() &&
+ m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
@@ -441,7 +446,7 @@ void ToolboxController::addStatusListener( const 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() )
{
aTargetURL.Complete = aCommandURL;
if ( m_pImpl->m_xUrlTransformer.is() )
@@ -521,7 +526,7 @@ void ToolboxController::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();
@@ -610,7 +615,7 @@ void ToolboxController::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();
@@ -679,7 +684,7 @@ void ToolboxController::updateStatus( const OUString aCommandURL )
// Try to find a dispatch object for the requested command URL
Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( m_xServiceManager.is() && xDispatchProvider.is() )
+ if ( m_xContext.is() && xDispatchProvider.is() )
{
aTargetURL.Complete = aCommandURL;
if ( m_pImpl->m_xUrlTransformer.is() )