Kaydet (Commit) 1dec1f2f authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, convert framework::AddonsToolBarWrapper to XComponentContext

üst dbb4d4dd
......@@ -24,7 +24,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
namespace framework
{
......@@ -33,7 +33,7 @@ class AddonsToolBarManager;
class AddonsToolBarWrapper : public UIElementWrapperBase
{
public:
AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
virtual ~AddonsToolBarWrapper();
// XComponent
......@@ -49,7 +49,7 @@ class AddonsToolBarWrapper : public UIElementWrapperBase
// protected methods
//-------------------------------------------------------------------------------------------------------------
private:
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager;
com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aConfigData;
};
......
......@@ -30,7 +30,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
......@@ -48,7 +47,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase
com::sun::star::ui::XUIElementFactory >
{
public:
AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
virtual ~AddonsToolBoxFactory();
// XInterface, XTypeProvider, XServiceInfo
......@@ -61,7 +60,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
};
......
......@@ -53,9 +53,9 @@ using namespace ::com::sun::star::ui;
namespace framework
{
AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XMultiServiceFactory >& xServiceManager ) :
AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XComponentContext >& xContext ) :
UIElementWrapperBase( UIElementType::TOOLBAR ),
m_xServiceManager( xServiceManager )
m_xContext( xContext )
{
}
......@@ -116,7 +116,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
pToolBar = new ToolBox( pWindow, nStyles );
pToolBarManager = new AddonsToolBarManager( comphelper::getComponentContext(m_xServiceManager), xFrame, m_aResourceURL, pToolBar );
pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
}
}
......
......@@ -51,19 +51,19 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( AddonsToolBoxFactory ,
::cppu::OWeakObject ,
SERVICENAME_TOOLBARFACTORY ,
IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY
)
PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( AddonsToolBoxFactory,
::cppu::OWeakObject,
SERVICENAME_TOOLBARFACTORY,
IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY )
PRIVATE_DEFINE_ONEINSTANCEFACTORY( AddonsToolBoxFactory )
DEFINE_INIT_SERVICE ( AddonsToolBoxFactory, {} )
AddonsToolBoxFactory::AddonsToolBoxFactory(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
ThreadHelpBase( &Application::GetSolarMutex() )
, m_xServiceManager( xServiceManager )
, m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) )
, m_xContext( xContext )
, m_xModuleManager( ModuleManager::create( xContext ) )
{
}
......@@ -186,7 +186,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
aPropSeq[2] <<= aPropValue;
SolarMutexGuard aGuard;
AddonsToolBarWrapper* pToolBarWrapper = new AddonsToolBarWrapper( m_xServiceManager );
AddonsToolBarWrapper* pToolBarWrapper = new AddonsToolBarWrapper( m_xContext );
xToolBar = Reference< ::com::sun::star::ui::XUIElement >( (OWeakObject *)pToolBarWrapper, UNO_QUERY );
Reference< XInitialization > xInit( xToolBar, UNO_QUERY );
xInit->initialize( aPropSeq );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment