summaryrefslogtreecommitdiff
path: root/svtools
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
parent34da7fbcc643ad209290c6da456dbfb17aeb9ac0 (diff)
fdo#46808, Convert svt::ToolboxController to XComponentContext
.. and all of it's friends Change-Id: I408d9308d1d1a4f8ed0055ac5f4042d729c44d1e
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/generictoolboxcontroller.hxx2
-rw-r--r--svtools/inc/svtools/popupwindowcontroller.hxx2
-rw-r--r--svtools/inc/svtools/toolboxcontroller.hxx16
-rw-r--r--svtools/source/uno/generictoolboxcontroller.cxx16
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx4
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx45
6 files changed, 45 insertions, 40 deletions
diff --git a/svtools/inc/svtools/generictoolboxcontroller.hxx b/svtools/inc/svtools/generictoolboxcontroller.hxx
index 50a374729b73..f01d5428a44f 100644
--- a/svtools/inc/svtools/generictoolboxcontroller.hxx
+++ b/svtools/inc/svtools/generictoolboxcontroller.hxx
@@ -31,7 +31,7 @@ struct ExecuteInfo;
class SVT_DLLPUBLIC GenericToolboxController : public svt::ToolboxController
{
public:
- GenericToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ GenericToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
ToolBox* pToolBox,
sal_uInt16 nID,
diff --git a/svtools/inc/svtools/popupwindowcontroller.hxx b/svtools/inc/svtools/popupwindowcontroller.hxx
index a02281e17d4a..ec2719cebd5c 100644
--- a/svtools/inc/svtools/popupwindowcontroller.hxx
+++ b/svtools/inc/svtools/popupwindowcontroller.hxx
@@ -36,7 +36,7 @@ class PopupWindowControllerImpl;
class SVT_DLLPUBLIC PopupWindowController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo
{
public:
- PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
const OUString& aCommandURL );
~PopupWindowController();
diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx
index 4cc240729df7..6bccf935be9c 100644
--- a/svtools/inc/svtools/toolboxcontroller.hxx
+++ b/svtools/inc/svtools/toolboxcontroller.hxx
@@ -21,15 +21,15 @@
#define _SVTOOLS_TOOLBOXCONTROLLER_HXX
#include "svtools/svtdllapi.h"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/broadcasthelper.hxx>
@@ -59,14 +59,14 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
private:
sal_Bool m_bSupportVisible; //shizhoubo
public:
- ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ ToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
const OUString& aCommandURL );
ToolboxController();
virtual ~ToolboxController();
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceManager() const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > getLayoutManager() const;
void updateStatus( const OUString aCommandURL );
@@ -149,8 +149,8 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
m_bDisposed : 1;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
ToolboxController_Impl* m_pImpl;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- OUString m_aCommandURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ OUString m_aCommandURL;
URLToDispatchMap m_aListenerMap;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
};
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() )