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/inc | |
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/inc')
-rw-r--r-- | framework/inc/dispatch/oxt_handler.hxx | 15 | ||||
-rw-r--r-- | framework/inc/dispatch/popupmenudispatcher.hxx | 10 | ||||
-rw-r--r-- | framework/inc/dispatch/servicehandler.hxx | 14 | ||||
-rw-r--r-- | framework/inc/dispatch/systemexec.hxx | 10 | ||||
-rw-r--r-- | framework/inc/jobs/helponstartup.hxx | 10 | ||||
-rw-r--r-- | framework/inc/jobs/shelljob.hxx | 10 | ||||
-rw-r--r-- | framework/inc/services.h | 12 | ||||
-rw-r--r-- | framework/inc/services/uriabbreviation.hxx | 9 | ||||
-rw-r--r-- | framework/inc/uielement/newmenucontroller.hxx | 10 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarmodemenucontroller.hxx | 10 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarsmenucontroller.hxx | 10 |
11 files changed, 44 insertions, 76 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; |