diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-08 18:13:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-08 21:12:50 +0200 |
commit | 1a90b1aa64866950cf9ad7032a8240b0c072e671 (patch) | |
tree | d631076faab6a50ca801c5bb39145a2a6b0705da /framework/source | |
parent | 224160656d549b5b1891edd1b3cee251b754e69b (diff) |
framework: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I6237016000dc05eacb14e59815b53cd44fbfce0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98384
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/dispatch/mailtodispatcher.cxx | 36 | ||||
-rw-r--r-- | framework/source/recording/dispatchrecordersupplier.cxx | 45 | ||||
-rw-r--r-- | framework/source/register/registertemp.cxx | 8 | ||||
-rw-r--r-- | framework/source/services/mediatypedetectionhelper.cxx | 35 | ||||
-rw-r--r-- | framework/source/uielement/fontmenucontroller.cxx | 28 | ||||
-rw-r--r-- | framework/source/uielement/fontsizemenucontroller.cxx | 26 | ||||
-rw-r--r-- | framework/source/uielement/footermenucontroller.cxx | 28 | ||||
-rw-r--r-- | framework/source/uielement/headermenucontroller.cxx | 28 | ||||
-rw-r--r-- | framework/source/uielement/macrosmenucontroller.cxx | 30 |
9 files changed, 180 insertions, 84 deletions
diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx index a29a8a1413dd..2425fdce5dab 100644 --- a/framework/source/dispatch/mailtodispatcher.cxx +++ b/framework/source/dispatch/mailtodispatcher.cxx @@ -30,20 +30,21 @@ namespace framework{ // XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE_2(MailToDispatcher , - ::cppu::OWeakObject , - SERVICENAME_PROTOCOLHANDLER , - IMPLEMENTATIONNAME_MAILTODISPATCHER) - -DEFINE_INIT_SERVICE(MailToDispatcher, - { - /*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 MailToDispatcher::getImplementationName() +{ + return "com.sun.star.comp.framework.MailToDispatcher"; +} + +sal_Bool SAL_CALL MailToDispatcher::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL MailToDispatcher::getSupportedServiceNames() +{ + return { SERVICENAME_PROTOCOLHANDLER }; +} + /** @short standard ctor @@ -219,4 +220,11 @@ void SAL_CALL MailToDispatcher::removeStatusListener( const css::uno::Reference< } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_MailToDispatcher_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::MailToDispatcher(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/recording/dispatchrecordersupplier.cxx b/framework/source/recording/dispatchrecordersupplier.cxx index 1abbb05350b8..1d31fdd1c57d 100644 --- a/framework/source/recording/dispatchrecordersupplier.cxx +++ b/framework/source/recording/dispatchrecordersupplier.cxx @@ -26,31 +26,25 @@ namespace framework{ -// XInterface, XTypeProvider +// XInterface, XTypeProvider, XServiceInfo -DEFINE_XSERVICEINFO_MULTISERVICE( - DispatchRecorderSupplier, - ::cppu::OWeakObject, - "com.sun.star.frame.DispatchRecorderSupplier", - IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER) +OUString SAL_CALL DispatchRecorderSupplier::getImplementationName() +{ + return "com.sun.star.comp.framework.DispatchRecorderSupplier"; +} -DEFINE_INIT_SERVICE( - DispatchRecorderSupplier, - { - /*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! - */ - } -) +sal_Bool SAL_CALL DispatchRecorderSupplier::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} -/** - @short standard constructor to create instance - @descr Because an instance will be initialized by her interface methods - it's not necessary to do anything here. - */ -DispatchRecorderSupplier::DispatchRecorderSupplier( const css::uno::Reference< css::lang::XMultiServiceFactory >& ) +css::uno::Sequence< OUString > SAL_CALL DispatchRecorderSupplier::getSupportedServiceNames() +{ + return { "com.sun.star.frame.DispatchRecorderSupplier" }; +} + + +DispatchRecorderSupplier::DispatchRecorderSupplier() { } @@ -157,4 +151,11 @@ void SAL_CALL DispatchRecorderSupplier::dispatchAndRecord( const css::util::URL& } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_DispatchRecorderSupplier_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::DispatchRecorderSupplier()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index 642898fcdea0..3f848f474cc6 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -56,15 +56,7 @@ #include <jobs/shelljob.hxx> COMPONENTGETFACTORY ( fwk, - IFFACTORY( ::framework::MediaTypeDetectionHelper ) - IFFACTORY( ::framework::MailToDispatcher ) else IFFACTORY( ::framework::DispatchRecorder ) else - IFFACTORY( ::framework::DispatchRecorderSupplier ) else - IFFACTORY( ::framework::FontMenuController ) else - IFFACTORY( ::framework::MacrosMenuController ) else - IFFACTORY( ::framework::FontSizeMenuController ) else - IFFACTORY( ::framework::FooterMenuController ) else - IFFACTORY( ::framework::HeaderMenuController ) else IFFACTORY( ::framework::LanguageSelectionMenuController ) ) diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx index ac8a1f2ea52d..d936b36a4004 100644 --- a/framework/source/services/mediatypedetectionhelper.cxx +++ b/framework/source/services/mediatypedetectionhelper.cxx @@ -28,7 +28,7 @@ using namespace ::com::sun::star; // constructor -MediaTypeDetectionHelper::MediaTypeDetectionHelper( const uno::Reference< lang::XMultiServiceFactory >& ) +MediaTypeDetectionHelper::MediaTypeDetectionHelper() { } @@ -38,16 +38,23 @@ MediaTypeDetectionHelper::~MediaTypeDetectionHelper() { } -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper - , ::cppu::OWeakObject - , "com.sun.star.frame.MediaTypeDetectionHelper" - , IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER - ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL MediaTypeDetectionHelper::getImplementationName() +{ + return "com.sun.star.comp.framework.MediaTypeDetectionHelper"; +} + +sal_Bool SAL_CALL MediaTypeDetectionHelper::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL MediaTypeDetectionHelper::getSupportedServiceNames() +{ + return { "com.sun.star.frame.MediaTypeDetectionHelper" }; +} -DEFINE_INIT_SERVICE ( MediaTypeDetectionHelper, - { - } - ) // XStringMapping @@ -72,4 +79,12 @@ sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(uno::Sequence< OUString > } // namespace framework + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_MediaTypeDetectionHelper_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::MediaTypeDetectionHelper()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 70c0043aede5..d72932ebe7ad 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -55,13 +55,22 @@ static bool lcl_I18nCompareString(const OUString& rStr1, const OUString& rStr2) namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( FontMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_FONTMENUCONTROLLER - ) +// XInterface, XTypeProvider, XServiceInfo -DEFINE_INIT_SERVICE ( FontMenuController, {} ) +OUString SAL_CALL FontMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.FontMenuController"; +} + +sal_Bool SAL_CALL FontMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL FontMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} FontMenuController::FontMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : svt::PopupMenuControllerBase( xContext ) @@ -214,4 +223,11 @@ void SAL_CALL FontMenuController::updatePopupMenu() } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_FontMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::FontMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 79259c2e5e98..b50dedaef24d 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -48,13 +48,20 @@ using namespace com::sun::star::view; namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( FontSizeMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_FONTSIZEMENUCONTROLLER - ) +OUString SAL_CALL FontSizeMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.FontSizeMenuController"; +} + +sal_Bool SAL_CALL FontSizeMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} -DEFINE_INIT_SERVICE ( FontSizeMenuController, {} ) +css::uno::Sequence< OUString > SAL_CALL FontSizeMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} FontSizeMenuController::FontSizeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : svt::PopupMenuControllerBase( xContext ) @@ -307,4 +314,11 @@ void SAL_CALL FontSizeMenuController::updatePopupMenu() } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_FontSizeMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::FontSizeMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/footermenucontroller.cxx b/framework/source/uielement/footermenucontroller.cxx index aef746a434ec..cf88443deb65 100644 --- a/framework/source/uielement/footermenucontroller.cxx +++ b/framework/source/uielement/footermenucontroller.cxx @@ -35,11 +35,22 @@ using namespace com::sun::star::container; namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( FooterMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_FOOTERMENUCONTROLLER - ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL FooterMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.FooterMenuController"; +} + +sal_Bool SAL_CALL FooterMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL FooterMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} FooterMenuController::FooterMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : HeaderMenuController( xContext,true ) @@ -51,4 +62,11 @@ FooterMenuController::~FooterMenuController() } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_FooterMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::FooterMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 7e74ef99f506..aeaea78dc099 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -49,13 +49,22 @@ const sal_uInt16 ALL_MENUITEM_ID = 1; namespace framework { -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( HeaderMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_HEADERMENUCONTROLLER - ) +// XInterface, XTypeProvider, XServiceInfo -DEFINE_INIT_SERVICE ( HeaderMenuController, {} ) +OUString SAL_CALL HeaderMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.HeaderMenuController"; +} + +sal_Bool SAL_CALL HeaderMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL HeaderMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} HeaderMenuController::HeaderMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext, bool _bFooter ) : svt::PopupMenuControllerBase( xContext ) @@ -225,4 +234,11 @@ void SAL_CALL HeaderMenuController::updatePopupMenu() } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_HeaderMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::HeaderMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index f776a0b06bb0..73b78340fb59 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -37,14 +37,23 @@ using namespace com::sun::star::container; namespace framework { -class -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( MacrosMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_MACROSMENUCONTROLLER - ) -DEFINE_INIT_SERVICE ( MacrosMenuController, {} ) +// XInterface, XTypeProvider, XServiceInfo + +OUString SAL_CALL MacrosMenuController::getImplementationName() +{ + return "com.sun.star.comp.framework.MacrosMenuController"; +} + +sal_Bool SAL_CALL MacrosMenuController::supportsService( const OUString& sServiceName ) +{ + return cppu::supportsService(this, sServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL MacrosMenuController::getSupportedServiceNames() +{ + return { SERVICENAME_POPUPMENUCONTROLLER }; +} MacrosMenuController::MacrosMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : svt::PopupMenuControllerBase( xContext ), @@ -155,4 +164,11 @@ void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 sta } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +framework_MacrosMenuController_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(new framework::MacrosMenuController(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |