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 @@ ...@@ -24,7 +24,7 @@
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
namespace framework namespace framework
{ {
...@@ -33,7 +33,7 @@ class AddonsToolBarManager; ...@@ -33,7 +33,7 @@ class AddonsToolBarManager;
class AddonsToolBarWrapper : public UIElementWrapperBase class AddonsToolBarWrapper : public UIElementWrapperBase
{ {
public: 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(); virtual ~AddonsToolBarWrapper();
// XComponent // XComponent
...@@ -49,7 +49,7 @@ class AddonsToolBarWrapper : public UIElementWrapperBase ...@@ -49,7 +49,7 @@ class AddonsToolBarWrapper : public UIElementWrapperBase
// protected methods // protected methods
//------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------
private: 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::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; com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aConfigData;
}; };
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.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/beans/PropertyValue.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XModuleManager2.hpp>
...@@ -48,7 +47,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase ...@@ -48,7 +47,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase
com::sun::star::ui::XUIElementFactory > com::sun::star::ui::XUIElementFactory >
{ {
public: 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(); virtual ~AddonsToolBoxFactory();
// XInterface, XTypeProvider, XServiceInfo // XInterface, XTypeProvider, XServiceInfo
...@@ -61,7 +60,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase ...@@ -61,7 +60,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
private: 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; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
}; };
......
...@@ -53,9 +53,9 @@ using namespace ::com::sun::star::ui; ...@@ -53,9 +53,9 @@ using namespace ::com::sun::star::ui;
namespace framework namespace framework
{ {
AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XMultiServiceFactory >& xServiceManager ) : AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XComponentContext >& xContext ) :
UIElementWrapperBase( UIElementType::TOOLBAR ), UIElementWrapperBase( UIElementType::TOOLBAR ),
m_xServiceManager( xServiceManager ) m_xContext( xContext )
{ {
} }
...@@ -116,7 +116,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument ...@@ -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; sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
pToolBar = new ToolBox( pWindow, nStyles ); 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 ); m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
} }
} }
......
...@@ -51,19 +51,19 @@ namespace framework ...@@ -51,19 +51,19 @@ namespace framework
//***************************************************************************************************************** //*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo // XInterface, XTypeProvider, XServiceInfo
//***************************************************************************************************************** //*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( AddonsToolBoxFactory , PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( AddonsToolBoxFactory,
::cppu::OWeakObject , ::cppu::OWeakObject,
SERVICENAME_TOOLBARFACTORY , SERVICENAME_TOOLBARFACTORY,
IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY )
) PRIVATE_DEFINE_ONEINSTANCEFACTORY( AddonsToolBoxFactory )
DEFINE_INIT_SERVICE ( AddonsToolBoxFactory, {} ) DEFINE_INIT_SERVICE ( AddonsToolBoxFactory, {} )
AddonsToolBoxFactory::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() ) ThreadHelpBase( &Application::GetSolarMutex() )
, m_xServiceManager( xServiceManager ) , m_xContext( xContext )
, m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) , m_xModuleManager( ModuleManager::create( xContext ) )
{ {
} }
...@@ -186,7 +186,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ...@@ -186,7 +186,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
aPropSeq[2] <<= aPropValue; aPropSeq[2] <<= aPropValue;
SolarMutexGuard aGuard; 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 ); xToolBar = Reference< ::com::sun::star::ui::XUIElement >( (OWeakObject *)pToolBarWrapper, UNO_QUERY );
Reference< XInitialization > xInit( xToolBar, UNO_QUERY ); Reference< XInitialization > xInit( xToolBar, UNO_QUERY );
xInit->initialize( aPropSeq ); 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