diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-07 20:02:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-07 22:13:02 +0200 |
commit | 71227e2306987cb8aa5fbda2943e73237674e9ba (patch) | |
tree | 9491ef57b3b1192e0f35b69bc8c368d42624ad31 /framework | |
parent | 9ff8a1173a72b9ebea54ef3b00b1d632bf953e37 (diff) |
framework: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I8679b50395d11cb2d807d52526d803df9b0606b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98294
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
26 files changed, 354 insertions, 289 deletions
diff --git a/framework/inc/dispatch/oxt_handler.hxx b/framework/inc/dispatch/oxt_handler.hxx index 69bc07074c3e..bc9c24070cde 100644 --- a/framework/inc/dispatch/oxt_handler.hxx +++ b/framework/inc/dispatch/oxt_handler.hxx @@ -52,16 +52,13 @@ class Oxt_Handler final : public ::cppu::WeakImplHelper< public: - Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + Oxt_Handler( const css::uno::Reference< css::uno::XComponentContext >& ); virtual ~Oxt_Handler( ) override; - // XInterface, XTypeProvider, XServiceInfo - - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XNotifyingDispatch @@ -85,7 +82,7 @@ class Oxt_Handler final : public ::cppu::WeakImplHelper< private: osl::Mutex m_mutex; - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; /// global uno service factory to create new services + css::uno::Reference< css::uno::XComponentContext > m_xContext; /// global uno service factory to create new services }; diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx index 869ee956e4a4..845e5c92592d 100644 --- a/framework/inc/dispatch/popupmenudispatcher.hxx +++ b/framework/inc/dispatch/popupmenudispatcher.hxx @@ -68,12 +68,10 @@ class PopupMenuDispatcher final : public ::cppu::WeakImplHelper< // constructor / destructor PopupMenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) override; diff --git a/framework/inc/dispatch/servicehandler.hxx b/framework/inc/dispatch/servicehandler.hxx index 41d3343daae4..47fcd7e44ba8 100644 --- a/framework/inc/dispatch/servicehandler.hxx +++ b/framework/inc/dispatch/servicehandler.hxx @@ -56,21 +56,19 @@ class ServiceHandler final : public ::cppu::WeakImplHelper< private: /// reference to global uno service manager which had created us - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /* interface */ public: // ctor/dtor - ServiceHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + ServiceHandler( const css::uno::Reference< css::uno::XComponentContext >& ); virtual ~ServiceHandler( ) override; - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XDispatchProvider virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , diff --git a/framework/inc/dispatch/systemexec.hxx b/framework/inc/dispatch/systemexec.hxx index e1be82672f05..238b15192996 100644 --- a/framework/inc/dispatch/systemexec.hxx +++ b/framework/inc/dispatch/systemexec.hxx @@ -63,12 +63,10 @@ class SystemExec final : public ::cppu::WeakImplHelper< SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); virtual ~SystemExec( ) override; - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XDispatchProvider virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx index 723526f92ec0..d17de03304a6 100644 --- a/framework/inc/jobs/helponstartup.hxx +++ b/framework/inc/jobs/helponstartup.hxx @@ -87,12 +87,10 @@ class HelpOnStartup final : public ::cppu::WeakImplHelper< css::lang::XServiceIn // uno interface public: - // css.lang.XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // css.task.XJob virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) override; diff --git a/framework/inc/jobs/shelljob.hxx b/framework/inc/jobs/shelljob.hxx index 387e3d142702..0c345069853f 100644 --- a/framework/inc/jobs/shelljob.hxx +++ b/framework/inc/jobs/shelljob.hxx @@ -68,12 +68,10 @@ class ShellJob final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,cs // uno interface public: - // css.lang.XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // css.task.XJob virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) override; diff --git a/framework/inc/services.h b/framework/inc/services.h index 7b46271543bc..78c2e6899332 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -36,27 +36,15 @@ namespace framework{ // used implementationnames by framework #define IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER "com.sun.star.comp.framework.MediaTypeDetectionHelper" -#define IMPLEMENTATIONNAME_OXT_HANDLER "com.sun.star.comp.framework.OXTFileHandler" #define IMPLEMENTATIONNAME_QUICKLAUNCHER "com.sun.star.comp.desktop.QuickstartWrapper" #define IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER "com.sun.star.comp.framework.DispatchRecorderSupplier" #define IMPLEMENTATIONNAME_MAILTODISPATCHER "com.sun.star.comp.framework.MailToDispatcher" -#define IMPLEMENTATIONNAME_SERVICEHANDLER "com.sun.star.comp.framework.ServiceHandler" -#define IMPLEMENTATIONNAME_DISPATCHHELPER "com.sun.star.comp.framework.services.DispatchHelper" -#define IMPLEMENTATIONNAME_DISPATCHDISABLER "com.sun.star.comp.framework.services.DispatchDisabler" #define IMPLEMENTATIONNAME_MACROSMENUCONTROLLER "com.sun.star.comp.framework.MacrosMenuController" #define IMPLEMENTATIONNAME_FONTMENUCONTROLLER "com.sun.star.comp.framework.FontMenuController" #define IMPLEMENTATIONNAME_FONTSIZEMENUCONTROLLER "com.sun.star.comp.framework.FontSizeMenuController" #define IMPLEMENTATIONNAME_HEADERMENUCONTROLLER "com.sun.star.comp.framework.HeaderMenuController" #define IMPLEMENTATIONNAME_FOOTERMENUCONTROLLER "com.sun.star.comp.framework.FooterMenuController" -#define IMPLEMENTATIONNAME_NEWMENUCONTROLLER "com.sun.star.comp.framework.NewMenuController" -#define IMPLEMENTATIONNAME_TOOLBARMODEMENUCONTROLLER "com.sun.star.comp.framework.ToolbarModeMenuController" -#define IMPLEMENTATIONNAME_TOOLBARSMENUCONTROLLER "com.sun.star.comp.framework.ToolBarsMenuController" -#define IMPLEMENTATIONNAME_HELPONSTARTUP "com.sun.star.comp.framework.HelpOnStartup" -#define IMPLEMENTATIONNAME_SHELLJOB "com.sun.star.comp.framework.ShellJob" #define IMPLEMENTATIONNAME_FWK_TASKCREATOR "com.sun.star.comp.framework.TaskCreator" -#define IMPLEMENTATIONNAME_SYSTEMEXEC "com.sun.star.comp.framework.SystemExecute" -#define IMPLEMENTATIONNAME_URIABBREVIATION "com.sun.star.comp.framework.UriAbbreviation" -#define IMPLEMENTATIONNAME_POPUPMENUDISPATCHER "com.sun.star.comp.framework.PopupMenuControllerDispatcher" #define IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER "com.sun.star.comp.framework.LanguageSelectionMenuController" } // namespace framework diff --git a/framework/inc/services/uriabbreviation.hxx b/framework/inc/services/uriabbreviation.hxx index a3794b63ac96..caa7c2f56815 100644 --- a/framework/inc/services/uriabbreviation.hxx +++ b/framework/inc/services/uriabbreviation.hxx @@ -36,11 +36,10 @@ class UriAbbreviation final : public ::cppu::WeakImplHelper< css::util::XStringA public: explicit UriAbbreviation(css::uno::Reference< css::uno::XComponentContext > const & context); - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // css::util::XStringAbbreviation: virtual OUString SAL_CALL abbreviateString(const css::uno::Reference< css::util::XStringWidth > & xStringWidth, ::sal_Int32 nWidth, const OUString & aString) override; diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index 96060e07f68b..2e126e923aee 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -39,12 +39,10 @@ namespace framework NewMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~NewMenuController() override; - // XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; diff --git a/framework/inc/uielement/toolbarmodemenucontroller.hxx b/framework/inc/uielement/toolbarmodemenucontroller.hxx index 28ec1de1c1a0..238b4d5ea2ff 100644 --- a/framework/inc/uielement/toolbarmodemenucontroller.hxx +++ b/framework/inc/uielement/toolbarmodemenucontroller.hxx @@ -37,12 +37,10 @@ namespace framework ToolbarModeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~ToolbarModeMenuController() override; - // XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XPopupMenuController virtual void SAL_CALL setPopupMenu( const css::uno::Reference< css::awt::XPopupMenu >& PopupMenu ) override; diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx index 3d128f52ef1b..77bcc392ae46 100644 --- a/framework/inc/uielement/toolbarsmenucontroller.hxx +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -44,12 +44,10 @@ namespace framework ToolbarsMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~ToolbarsMenuController() override; - // XServiceInfo - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XPopupMenuController virtual void SAL_CALL setPopupMenu( const css::uno::Reference< css::awt::XPopupMenu >& PopupMenu ) override; diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx index 098942c4b5a8..b2148f89e8e5 100644 --- a/framework/source/dispatch/dispatchdisabler.cxx +++ b/framework/source/dispatch/dispatchdisabler.cxx @@ -140,12 +140,28 @@ void DispatchDisabler::removeByName( const OUString& rName ) maDisabledURLs.erase(it); } -DEFINE_INIT_SERVICE(DispatchDisabler, {}) +// XInterface, XTypeProvider, XServiceInfo -// XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchDisabler, - ::cppu::OWeakObject, - "com.sun.star.frame.DispatchDisabler", - IMPLEMENTATIONNAME_DISPATCHDISABLER) +OUString SAL_CALL DispatchDisabler::getImplementationName() +{ + return "com.sun.star.comp.framework.services.DispatchDisabler"; +} + +sal_Bool SAL_CALL DispatchDisabler::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL DispatchDisabler::getSupportedServiceNames() +{ + return { "com.sun.star.frame.DispatchDisabler" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_DispatchDisabler_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::DispatchDisabler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/oxt_handler.cxx b/framework/source/dispatch/oxt_handler.cxx index 5d6540e01a28..c50d9e5b3316 100644 --- a/framework/source/dispatch/oxt_handler.cxx +++ b/framework/source/dispatch/oxt_handler.cxx @@ -26,18 +26,23 @@ namespace framework{ -// XInterface, XTypeProvider, XServiceInfo +// XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE ( Oxt_Handler , - ::cppu::OWeakObject , - SERVICENAME_CONTENTHANDLER , - IMPLEMENTATIONNAME_OXT_HANDLER - ) +OUString SAL_CALL Oxt_Handler::getImplementationName() +{ + return "com.sun.star.comp.framework.OXTFileHandler"; +} + +sal_Bool SAL_CALL Oxt_Handler::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL Oxt_Handler::getSupportedServiceNames() +{ + return { SERVICENAME_CONTENTHANDLER }; +} -DEFINE_INIT_SERVICE ( Oxt_Handler, - { - } - ) /*-************************************************************************************************************ @short standard ctor @@ -49,8 +54,8 @@ DEFINE_INIT_SERVICE ( Oxt_Handler, @onerror Show an assertion and do nothing else. @threadsafe yes *//*-*************************************************************************************************************/ -Oxt_Handler::Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory ( xFactory ) +Oxt_Handler::Oxt_Handler( const css::uno::Reference< css::uno::XComponentContext >& xContext ) + : m_xContext ( xContext ) { } @@ -90,7 +95,7 @@ void SAL_CALL Oxt_Handler::dispatchWithNotification( const css::util::URL& aURL, css::uno::Sequence< css::uno::Any > lParams(1); lParams[0] <<= aURL.Main; - css::uno::Reference< css::uno::XInterface > xService = m_xFactory->createInstanceWithArguments( "com.sun.star.deployment.ui.PackageManagerDialog", lParams ); + css::uno::Reference< css::uno::XInterface > xService = m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.deployment.ui.PackageManagerDialog", lParams, m_xContext ); css::uno::Reference< css::task::XJobExecutor > xExecuteable( xService, css::uno::UNO_QUERY ); if ( xExecuteable.is() ) xExecuteable->trigger( OUString() ); @@ -158,4 +163,12 @@ OUString SAL_CALL Oxt_Handler::detect( css::uno::Sequence< css::beans::PropertyV } // namespace framework + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_Oxt_Handler_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::Oxt_Handler(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 24ce67dc70d2..264c74a4f034 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -61,7 +61,7 @@ PopupMenuDispatcher::~PopupMenuDispatcher() OUString SAL_CALL PopupMenuDispatcher::getImplementationName() { - return impl_getStaticImplementationName(); + return "com.sun.star.comp.framework.PopupMenuControllerDispatcher"; } sal_Bool SAL_CALL PopupMenuDispatcher::supportsService( const OUString& sServiceName ) @@ -71,55 +71,9 @@ sal_Bool SAL_CALL PopupMenuDispatcher::supportsService( const OUString& sService css::uno::Sequence< OUString > SAL_CALL PopupMenuDispatcher::getSupportedServiceNames() { - return impl_getStaticSupportedServiceNames(); + return { SERVICENAME_PROTOCOLHANDLER }; } -css::uno::Sequence< OUString > PopupMenuDispatcher::impl_getStaticSupportedServiceNames() -{ - css::uno::Sequence<OUString> seqServiceNames { SERVICENAME_PROTOCOLHANDLER }; - return seqServiceNames; -} - -OUString PopupMenuDispatcher::impl_getStaticImplementationName() -{ - return IMPLEMENTATIONNAME_POPUPMENUDISPATCHER; -} - -css::uno::Reference< css::uno::XInterface > -SAL_CALL PopupMenuDispatcher::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) -{ - /* create new instance of service */ - PopupMenuDispatcher* pClass = new PopupMenuDispatcher( comphelper::getComponentContext(xServiceManager) ); - /* hold it alive by increasing his ref count!!! */ - css::uno::Reference< css::uno::XInterface > xService( static_cast< ::cppu::OWeakObject* >(pClass), css::uno::UNO_QUERY ); - /* initialize new service instance ... he can use his own refcount ... we hold it! */ - pClass->impl_initService(); - /* return new created service as reference */ - return xService; -} - -css::uno::Reference< css::lang::XSingleServiceFactory > -PopupMenuDispatcher::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) -{ - css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( - cppu::createSingleFactory ( xServiceManager, - PopupMenuDispatcher::impl_getStaticImplementationName() , - PopupMenuDispatcher::impl_createInstance , - PopupMenuDispatcher::impl_getStaticSupportedServiceNames() ) - ); - return xReturn; -} - -DEFINE_INIT_SERVICE(PopupMenuDispatcher, -{ - /*Attention - I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() - to create a new instance of this class by our own supported service factory. - see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information! - */ -} -) - void SAL_CALL PopupMenuDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) { css::uno::Reference< css::frame::XFrame > xFrame; @@ -306,4 +260,12 @@ void PopupMenuDispatcher::impl_RetrievePopupControllerQuery() } // namespace framework + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_PopupMenuDispatcher_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::PopupMenuDispatcher(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx index c0d97245d480..c0f6b9d441ca 100644 --- a/framework/source/dispatch/servicehandler.cxx +++ b/framework/source/dispatch/servicehandler.cxx @@ -33,20 +33,21 @@ namespace framework{ // XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE(ServiceHandler , - ::cppu::OWeakObject , - SERVICENAME_PROTOCOLHANDLER , - IMPLEMENTATIONNAME_SERVICEHANDLER) - -DEFINE_INIT_SERVICE(ServiceHandler, - { - /*Attention - I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() - to create a new instance of this class by our own supported service factory. - see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information! - */ - } - ) +OUString SAL_CALL ServiceHandler::getImplementationName() +{ + return "com.sun.star.comp.framework.ServiceHandler"; +} + +sal_Bool SAL_CALL ServiceHandler::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL ServiceHandler::getSupportedServiceNames() +{ + return { SERVICENAME_PROTOCOLHANDLER }; +} + /** @short standard ctor @@ -55,8 +56,8 @@ DEFINE_INIT_SERVICE(ServiceHandler, @param xFactory reference to uno servicemanager for creation of new services */ -ServiceHandler::ServiceHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory ( xFactory ) +ServiceHandler::ServiceHandler( const css::uno::Reference< css::uno::XComponentContext >& xContext ) + : m_xContext ( xContext ) { } @@ -174,9 +175,6 @@ void SAL_CALL ServiceHandler::dispatchWithNotification( const css::util::URL& */ css::uno::Reference< css::uno::XInterface > ServiceHandler::implts_dispatch( const css::util::URL& aURL ) { - if (!m_xFactory.is()) - return css::uno::Reference< css::uno::XInterface >(); - // extract service name and may optional given parameters from given URL // and use it to create and start the component OUString sServiceAndArguments = aURL.Complete.copy(PROTOCOL_LENGTH); @@ -206,7 +204,7 @@ css::uno::Reference< css::uno::XInterface > ServiceHandler::implts_dispatch( con try { // => a) a service starts running inside his own ctor and we create it only - xService = m_xFactory->createInstance(sServiceName); + xService = m_xContext->getServiceManager()->createInstanceWithContext(sServiceName, m_xContext); // or b) he implements the right interface and starts there (may with optional parameters) css::uno::Reference< css::task::XJobExecutor > xExecuteable(xService, css::uno::UNO_QUERY); if (xExecuteable.is()) @@ -249,4 +247,12 @@ void SAL_CALL ServiceHandler::removeStatusListener( const css::uno::Reference< c } // namespace framework + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_ServiceHandler_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::ServiceHandler(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx index 61e526acf72f..5c1b65ecb9dd 100644 --- a/framework/source/dispatch/systemexec.cxx +++ b/framework/source/dispatch/systemexec.cxx @@ -33,20 +33,20 @@ namespace framework{ // XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE_2(SystemExec , - ::cppu::OWeakObject , - SERVICENAME_PROTOCOLHANDLER , - IMPLEMENTATIONNAME_SYSTEMEXEC) - -DEFINE_INIT_SERVICE(SystemExec, - { - /*Attention - I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() - to create a new instance of this class by our own supported service factory. - see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information! - */ - } - ) +OUString SAL_CALL SystemExec::getImplementationName() +{ + return "com.sun.star.comp.framework.SystemExecute"; +} + +sal_Bool SAL_CALL SystemExec::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL SystemExec::getSupportedServiceNames() +{ + return { SERVICENAME_PROTOCOLHANDLER }; +} SystemExec::SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : m_xContext ( rxContext ) @@ -144,4 +144,11 @@ void SystemExec::impl_notifyResultListener(const css::uno::Reference< css::frame } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_SystemExecute_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::SystemExec(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/inc/dispatch/dispatchdisabler.hxx b/framework/source/inc/dispatch/dispatchdisabler.hxx index ed64a656ea7a..4741c4152b51 100644 --- a/framework/source/inc/dispatch/dispatchdisabler.hxx +++ b/framework/source/inc/dispatch/dispatchdisabler.hxx @@ -87,11 +87,10 @@ public: virtual void SAL_CALL insertByName( const OUString& aName, const ::css::uno::Any& aElement ) override; virtual void SAL_CALL removeByName( const OUString& Name ) override; - DECLARE_XSERVICEINFO_NOFACTORY - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + /* interface XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; } // namespace framework diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index 60dfa421fddc..6927b4e9dcc0 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -38,46 +38,48 @@ namespace framework{ -DEFINE_XSERVICEINFO_MULTISERVICE_2(HelpOnStartup , - ::cppu::OWeakObject , - SERVICENAME_JOB , - IMPLEMENTATIONNAME_HELPONSTARTUP) - -DEFINE_INIT_SERVICE(HelpOnStartup, - { - /* Attention - I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() - to create a new instance of this class by our own supported service factory. - see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information! - */ - // create some needed uno services and cache it - m_xModuleManager = css::frame::ModuleManager::create( m_xContext ); - - m_xDesktop = css::frame::Desktop::create(m_xContext); - - // ask for office locale - m_sLocale = officecfg::Setup::L10N::ooLocale::get(m_xContext); - - // detect system - m_sSystem = officecfg::Office::Common::Help::System::get(m_xContext); - - // Start listening for disposing events of these services, - // so we can react e.g. for an office shutdown - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent.set(m_xModuleManager, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener(static_cast< css::lang::XEventListener* >(this)); - if (m_xDesktop.is()) - m_xDesktop->addEventListener(static_cast< css::lang::XEventListener* >(this)); - xComponent.set(m_xConfig, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener(static_cast< css::lang::XEventListener* >(this)); - } - ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL HelpOnStartup::getImplementationName() +{ + return "com.sun.star.comp.framework.HelpOnStartup"; +} + +sal_Bool SAL_CALL HelpOnStartup::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL HelpOnStartup::getSupportedServiceNames() +{ + return { SERVICENAME_JOB }; +} HelpOnStartup::HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext (xContext) { + // create some needed uno services and cache it + m_xModuleManager = css::frame::ModuleManager::create( m_xContext ); + + m_xDesktop = css::frame::Desktop::create(m_xContext); + + // ask for office locale + m_sLocale = officecfg::Setup::L10N::ooLocale::get(m_xContext); + + // detect system + m_sSystem = officecfg::Office::Common::Help::System::get(m_xContext); + + // Start listening for disposing events of these services, + // so we can react e.g. for an office shutdown + css::uno::Reference< css::lang::XComponent > xComponent; + xComponent.set(m_xModuleManager, css::uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(static_cast< css::lang::XEventListener* >(this)); + if (m_xDesktop.is()) + m_xDesktop->addEventListener(static_cast< css::lang::XEventListener* >(this)); + xComponent.set(m_xConfig, css::uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(static_cast< css::lang::XEventListener* >(this)); } HelpOnStartup::~HelpOnStartup() @@ -322,4 +324,11 @@ OUString HelpOnStartup::ist_createHelpURL(const OUString& sBaseURL, } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_HelpOnStartup_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::HelpOnStartup(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/jobs/shelljob.cxx b/framework/source/jobs/shelljob.cxx index b248274b9c16..dd4fed5407b5 100644 --- a/framework/source/jobs/shelljob.cxx +++ b/framework/source/jobs/shelljob.cxx @@ -36,20 +36,23 @@ namespace framework{ -DEFINE_XSERVICEINFO_MULTISERVICE_2(ShellJob , - ::cppu::OWeakObject , - SERVICENAME_JOB , - IMPLEMENTATIONNAME_SHELLJOB) - -DEFINE_INIT_SERVICE(ShellJob, - { - /* Attention - I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() - to create a new instance of this class by our own supported service factory. - see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information! - */ - } - ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL ShellJob::getImplementationName() +{ + return "com.sun.star.comp.framework.ShellJob"; +} + +sal_Bool SAL_CALL ShellJob::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL ShellJob::getSupportedServiceNames() +{ + return { SERVICENAME_JOB }; +} + ShellJob::ShellJob(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext (xContext) @@ -153,4 +156,11 @@ bool ShellJob::impl_execute(const OUString& sCommand } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_ShellJob_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::ShellJob(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index 5e0e767818b7..642898fcdea0 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -58,26 +58,14 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::MediaTypeDetectionHelper ) IFFACTORY( ::framework::MailToDispatcher ) else - IFFACTORY( ::framework::ServiceHandler ) else - IFFACTORY( ::framework::PopupMenuDispatcher ) else - IFFACTORY( ::framework::DispatchHelper ) else - IFFACTORY( ::framework::DispatchDisabler ) else IFFACTORY( ::framework::DispatchRecorder ) else IFFACTORY( ::framework::DispatchRecorderSupplier ) else - IFFACTORY( ::framework::ToolbarModeMenuController ) else - IFFACTORY( ::framework::ToolbarsMenuController ) else IFFACTORY( ::framework::FontMenuController ) else IFFACTORY( ::framework::MacrosMenuController ) else - IFFACTORY( ::framework::NewMenuController ) else IFFACTORY( ::framework::FontSizeMenuController ) else - IFFACTORY( ::framework::UriAbbreviation ) else IFFACTORY( ::framework::FooterMenuController ) else IFFACTORY( ::framework::HeaderMenuController ) else - IFFACTORY( ::framework::LanguageSelectionMenuController ) else - IFFACTORY( ::framework::Oxt_Handler ) else - IFFACTORY( ::framework::HelpOnStartup ) else - IFFACTORY( ::framework::SystemExec ) else - IFFACTORY( ::framework::ShellJob ) + IFFACTORY( ::framework::LanguageSelectionMenuController ) ) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index 2a28d9cebdae..b0c6e7e9b4a5 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -33,11 +33,20 @@ namespace framework { // XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchHelper, ::cppu::OWeakObject, - "com.sun.star.frame.DispatchHelper", - IMPLEMENTATIONNAME_DISPATCHHELPER) +OUString SAL_CALL DispatchHelper::getImplementationName() +{ + return "com.sun.star.comp.framework.services.DispatchHelper"; +} + +sal_Bool SAL_CALL DispatchHelper::supportsService(const OUString& sServiceName) +{ + return cppu::supportsService(this, sServiceName); +} -DEFINE_INIT_SERVICE(DispatchHelper, {}) +css::uno::Sequence<OUString> SAL_CALL DispatchHelper::getSupportedServiceNames() +{ + return { "com.sun.star.frame.DispatchHelper" }; +} /** ctor. @@ -192,4 +201,11 @@ void SAL_CALL DispatchHelper::disposing(const css::lang::EventObject&) } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_DispatchHelper_get_implementation(css::uno::XComponentContext* context, + css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new framework::DispatchHelper(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/uriabbreviation.cxx b/framework/source/services/uriabbreviation.cxx index 6762afcf0f61..ae27f5a9e1c4 100644 --- a/framework/source/services/uriabbreviation.cxx +++ b/framework/source/services/uriabbreviation.cxx @@ -28,18 +28,22 @@ namespace framework { -// XInterface, XTypeProvider, XServiceInfo +// XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( UriAbbreviation , - ::cppu::OWeakObject , - SERVICENAME_STRINGABBREVIATION , - IMPLEMENTATIONNAME_URIABBREVIATION - ) +OUString SAL_CALL UriAbbreviation::getImplementationName() +{ + return "com.sun.star.comp.framework.UriAbbreviation"; +} + +sal_Bool SAL_CALL UriAbbreviation::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} -DEFINE_INIT_SERVICE ( UriAbbreviation, - { - } - ) +css::uno::Sequence< OUString > SAL_CALL UriAbbreviation::getSupportedServiceNames() +{ + return { SERVICENAME_STRINGABBREVIATION }; +} UriAbbreviation::UriAbbreviation(css::uno::Reference< css::uno::XComponentContext > const & ) { @@ -61,4 +65,11 @@ OUString SAL_CALL UriAbbreviation::abbreviateString(const css::uno::Reference< c } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_UriAbbreviation_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::UriAbbreviation(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index a6d5310c20ed..c0b4d28601fb 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -56,13 +56,20 @@ using namespace com::sun::star::ui; namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( NewMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_NEWMENUCONTROLLER - ) +OUString SAL_CALL NewMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.NewMenuController"; +} -DEFINE_INIT_SERVICE ( NewMenuController, {} ) +sal_Bool SAL_CALL NewMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL NewMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) { @@ -509,4 +516,12 @@ void SAL_CALL NewMenuController::initialize( const Sequence< Any >& aArguments ) } + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_NewMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::NewMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx index 8c28cd64858f..0ffd20340b9c 100644 --- a/framework/source/uielement/toolbarmodemenucontroller.cxx +++ b/framework/source/uielement/toolbarmodemenucontroller.cxx @@ -53,13 +53,23 @@ using namespace ::com::sun::star::ui; namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ToolbarModeMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_TOOLBARMODEMENUCONTROLLER - ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL ToolbarModeMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.ToolbarModeMenuController"; +} + +sal_Bool SAL_CALL ToolbarModeMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL ToolbarModeMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} -DEFINE_INIT_SERVICE ( ToolbarModeMenuController, {} ) ToolbarModeMenuController::ToolbarModeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : svt::PopupMenuControllerBase( xContext ), @@ -358,4 +368,11 @@ IMPL_STATIC_LINK( ToolbarModeMenuController, ExecuteHdl_Impl, void*, p, void ) } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_ToolbarModeMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::ToolbarModeMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 19a2e25965e5..c1432ab5a3a3 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -123,13 +123,22 @@ struct ToolBarInfo } -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ToolbarsMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_TOOLBARSMENUCONTROLLER - ) +// XInterface, XTypeProvider, XServiceInfo -DEFINE_INIT_SERVICE ( ToolbarsMenuController, {} ) +OUString SAL_CALL ToolbarsMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.ToolBarsMenuController"; +} + +sal_Bool SAL_CALL ToolbarsMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL ToolbarsMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} constexpr OUStringLiteral g_aPropUIName( "UIName" ); constexpr OUStringLiteral g_aPropResourceURL( "ResourceURL" ); @@ -806,4 +815,11 @@ IMPL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, void*, p, void ) } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_ToolbarsMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::ToolbarsMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 5ea3ee56d500..166bc9aaee8c 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -242,40 +242,52 @@ <implementation name="com.sun.star.comp.framework.MediaTypeDetectionHelper"> <service name="com.sun.star.frame.MediaTypeDetectionHelper"/> </implementation> - <implementation name="com.sun.star.comp.framework.NewMenuController"> + <implementation name="com.sun.star.comp.framework.NewMenuController" + constructor="framework_NewMenuController_get_implementation"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> - <implementation name="com.sun.star.comp.framework.OXTFileHandler"> + <implementation name="com.sun.star.comp.framework.OXTFileHandler" + constructor="framework_Oxt_Handler_get_implementation"> <service name="com.sun.star.frame.ContentHandler"/> </implementation> - <implementation name="com.sun.star.comp.framework.PopupMenuControllerDispatcher"> + <implementation name="com.sun.star.comp.framework.PopupMenuControllerDispatcher" + constructor="framework_PopupMenuDispatcher_get_implementation"> <service name="com.sun.star.frame.ProtocolHandler"/> </implementation> - <implementation name="com.sun.star.comp.framework.ServiceHandler"> + <implementation name="com.sun.star.comp.framework.ServiceHandler" + constructor="framework_ServiceHandler_get_implementation"> <service name="com.sun.star.frame.ProtocolHandler"/> </implementation> - <implementation name="com.sun.star.comp.framework.ToolbarModeMenuController"> + <implementation name="com.sun.star.comp.framework.ToolbarModeMenuController" + constructor="framework_ToolbarModeMenuController_get_implementation"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> - <implementation name="com.sun.star.comp.framework.ToolBarsMenuController"> + <implementation name="com.sun.star.comp.framework.ToolBarsMenuController" + constructor="framework_ToolbarsMenuController_get_implementation"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> - <implementation name="com.sun.star.comp.framework.UriAbbreviation"> + <implementation name="com.sun.star.comp.framework.UriAbbreviation" + constructor="framework_UriAbbreviation_get_implementation"> <service name="com.sun.star.util.UriAbbreviation"/> </implementation> - <implementation name="com.sun.star.comp.framework.services.DispatchHelper"> + <implementation name="com.sun.star.comp.framework.services.DispatchHelper" + constructor="framework_DispatchHelper_get_implementation"> <service name="com.sun.star.frame.DispatchHelper"/> </implementation> - <implementation name="com.sun.star.comp.framework.services.DispatchDisabler"> + <implementation name="com.sun.star.comp.framework.services.DispatchDisabler" + constructor="framework_DispatchDisabler_get_implementation"> <service name="com.sun.star.frame.DispatchDisabler"/> </implementation> - <implementation name="com.sun.star.comp.framework.HelpOnStartup"> + <implementation name="com.sun.star.comp.framework.HelpOnStartup" + constructor="framework_HelpOnStartup_get_implementation"> <service name="com.sun.star.task.Job"/> </implementation> - <implementation name="com.sun.star.comp.framework.ShellJob"> + <implementation name="com.sun.star.comp.framework.ShellJob" + constructor="framework_ShellJob_get_implementation"> <service name="com.sun.star.task.Job"/> </implementation> - <implementation name="com.sun.star.comp.framework.SystemExecute"> + <implementation name="com.sun.star.comp.framework.SystemExecute" + constructor="framework_SystemExecute_get_implementation"> <service name="com.sun.star.frame.ProtocolHandler"/> </implementation> </component> |