summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-21 15:11:02 +0200
committerNoel Grandin <noel@peralex.com>2013-05-22 15:19:52 +0200
commit1a2ab98ab809a13cb01a33de15fb288c76103e5e (patch)
treebb4798ba89b70941113c91ada671b391509450d1
parent122e4bc598e2d7d1a3e5cef4c45cda94ca7cfd9b (diff)
fdo#46808, Convert XMultiServiceFactory to XComponentContext
Change-Id: I4325e553d010bb93794f897b41a602a5f849d4a6
-rw-r--r--framework/inc/uielement/statusbarmanager.hxx8
-rw-r--r--framework/source/uielement/statusbarmanager.cxx22
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx2
3 files changed, 15 insertions, 17 deletions
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index c855b129e680..71bfc34df9ef 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -32,7 +32,7 @@
#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <com/sun/star/ui/XUIConfiguration.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <rtl/ustring.hxx>
@@ -55,7 +55,7 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener
friend class FrameworkStatusBar;
public:
- StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager,
+ StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
const OUString& rResourceName,
StatusBar* pStatusBar );
@@ -117,8 +117,8 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener
com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels;
StatusBarControllerMap m_aControllerMap;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
- ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xStatusbarControllerFactory;
+ ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xStatusbarControllerFactory;
};
}
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index fb8ce454c3f3..b6ba2462350a 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -156,7 +156,7 @@ DEFINE_XTYPEPROVIDER_5 ( StatusBarManager
)
StatusBarManager::StatusBarManager(
- const uno::Reference< lang::XMultiServiceFactory >& rServiceManager,
+ const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Reference< frame::XFrame >& rFrame,
const OUString& rResourceName,
StatusBar* pStatusBar ) :
@@ -170,7 +170,7 @@ StatusBarManager::StatusBarManager(
m_aResourceName( rResourceName ),
m_xFrame( rFrame ),
m_aListenerContainer( m_aLock.getShareableOslMutex() ),
- m_xServiceManager( rServiceManager )
+ m_xContext( rxContext )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" );
@@ -217,7 +217,7 @@ void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source ) thr
if ( Source.Source == uno::Reference< uno::XInterface >( m_xFrame, uno::UNO_QUERY ))
m_xFrame.clear();
- m_xServiceManager.clear();
+ m_xContext.clear();
}
}
@@ -263,7 +263,7 @@ void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException )
}
m_xFrame.clear();
- m_xServiceManager.clear();
+ m_xContext.clear();
m_bDisposed = sal_True;
}
@@ -347,14 +347,12 @@ void StatusBarManager::RemoveControllers()
OUString StatusBarManager::RetrieveLabelFromCommand( const OUString& aCmdURL )
{
- return framework::RetrieveLabelFromCommand(aCmdURL, comphelper::getComponentContext(m_xServiceManager), m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name");
+ return framework::RetrieveLabelFromCommand(aCmdURL, m_xContext, m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name");
}
void StatusBarManager::CreateControllers()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" );
- uno::Reference< uno::XComponentContext > xComponentContext(
- comphelper::getComponentContext( m_xServiceManager ) );
uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar );
for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ )
@@ -390,7 +388,7 @@ void StatusBarManager::CreateControllers()
// TODO remove this
aPropValue.Name = OUString( "ServiceManager" );
- aPropValue.Value = uno::makeAny( m_xServiceManager );
+ aPropValue.Value = uno::makeAny( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW) );
aPropVector.push_back( uno::makeAny( aPropValue ) );
aPropValue.Name = OUString( "ParentWindow" );
@@ -409,7 +407,7 @@ void StatusBarManager::CreateControllers()
uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) );
xController = uno::Reference< frame::XStatusListener >(
m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
- aCommandURL, aArgs, xComponentContext ),
+ aCommandURL, aArgs, m_xContext ),
uno::UNO_QUERY );
bInit = sal_False; // Initialization is done through the factory service
}
@@ -423,7 +421,7 @@ void StatusBarManager::CreateControllers()
// 3º) Is Add-on? Generic statusbar controller
if ( pItemData )
{
- pController = new GenericStatusbarController( m_xServiceManager,
+ pController = new GenericStatusbarController( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW),
m_xFrame,
xStatusbarItem,
pItemData );
@@ -431,7 +429,7 @@ void StatusBarManager::CreateControllers()
else
{
// 4º) Default Statusbar controller
- pController = new svt::StatusbarController( m_xServiceManager, m_xFrame, aCommandURL, nId );
+ pController = new svt::StatusbarController( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), m_xFrame, aCommandURL, nId );
}
}
@@ -457,7 +455,7 @@ void StatusBarManager::CreateControllers()
aPropValue.Value = uno::makeAny( aCommandURL );
aArgs[1] = uno::makeAny( aPropValue );
aPropValue.Name = OUString( "ServiceManager" );
- aPropValue.Value = uno::makeAny( m_xServiceManager );
+ aPropValue.Value = uno::makeAny( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW) );
aArgs[2] = uno::makeAny( aPropValue );
aPropValue.Name = OUString( "ParentWindow" );
aPropValue.Value = uno::makeAny( xStatusbarWindow );
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 8714c454a043..f89b2e957420 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -114,7 +114,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments )
sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
pStatusBar = new FrameworkStatusBar( pWindow, nStyles );
- pStatusBarManager = new StatusBarManager( Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW), xFrame, m_aResourceURL, pStatusBar );
+ pStatusBarManager = new StatusBarManager( m_xContext, xFrame, m_aResourceURL, pStatusBar );
((FrameworkStatusBar*)pStatusBar)->SetStatusBarManager( pStatusBarManager );
m_xStatusBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY );
pStatusBar->SetUniqueId( HID_STATUSBAR );