diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-14 16:13:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-14 16:25:04 +0000 |
commit | 6fd64a87add9958b603b6851e0d477c4f596c22f (patch) | |
tree | d406dd27d0ab2844236ce880041f8423c95de0ba | |
parent | c43a4b0ffd96caaba64b228b059ee5c26049f399 (diff) |
loplugin:implinheritancehelper in framework
use more ImplInheritanceHelper to reduce boilerplate
Change-Id: I47eefb8edc2041fa89e64f930b1997566562d51a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144162
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | framework/inc/uielement/menubarwrapper.hxx | 11 | ||||
-rw-r--r-- | framework/source/uielement/menubarwrapper.cxx | 64 |
2 files changed, 3 insertions, 72 deletions
diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx index d696ec6c3f38..c764ecdf14b8 100644 --- a/framework/inc/uielement/menubarwrapper.hxx +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -28,21 +28,14 @@ namespace framework { -class MenuBarWrapper final : public UIConfigElementWrapperBase, - public css::container::XNameAccess +typedef cppu::ImplInheritanceHelper< UIConfigElementWrapperBase, css::container::XNameAccess> MenuBarWrapper_Base; +class MenuBarWrapper final : public MenuBarWrapper_Base { public: MenuBarWrapper( css::uno::Reference< css::uno::XComponentContext > xContext ); virtual ~MenuBarWrapper() override; - // XInterface, XTypeProvider - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); } // XComponent diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 3bbd71ed785e..c1ac0025d55e 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -45,72 +45,10 @@ using namespace ::com::sun::star::ui; namespace framework { -void SAL_CALL MenuBarWrapper::acquire() noexcept \ -{ \ - /* Don't use mutex in methods of XInterface! */ \ - UIConfigElementWrapperBase::acquire(); \ -} \ - \ -void SAL_CALL MenuBarWrapper::release() noexcept \ -{ \ - /* Don't use mutex in methods of XInterface! */ \ - UIConfigElementWrapperBase::release(); \ -} - -css::uno::Any SAL_CALL MenuBarWrapper::queryInterface( const css::uno::Type& aType ) -{ - /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ - /* Ask for my own supported interfaces ... */ - css::uno::Any aReturn = ::cppu::queryInterface( aType, - static_cast< css::lang::XTypeProvider* >( this ), - static_cast< css::ui::XUIElement* >( this ), - static_cast< css::ui::XUIElementSettings* >( this ), - static_cast< css::beans::XMultiPropertySet* >( this ), - static_cast< css::beans::XFastPropertySet* >( this ), - static_cast< css::beans::XPropertySet* >( this ), - static_cast< css::lang::XInitialization* >( this ), - static_cast< css::lang::XComponent* >( this ), - static_cast< css::util::XUpdatable* >( this ), - static_cast< css::ui::XUIConfigurationListener* >( this ), - static_cast< css::container::XNameAccess* >( static_cast< css::container::XElementAccess* >( this ) ) - ); - /* If searched interface not supported by this class ... */ - if ( !aReturn.hasValue() ) - { - /* ... ask baseclass for interfaces! */ - aReturn = UIConfigElementWrapperBase::queryInterface( aType ); - } - /* Return result of this search. */ - return aReturn; -} - -css::uno::Sequence< sal_Int8 > SAL_CALL MenuBarWrapper::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - -css::uno::Sequence< css::uno::Type > SAL_CALL MenuBarWrapper::getTypes() -{ - /* Attention: "TYPES" will expand to "(...)"! */ - static cppu::OTypeCollection ourTypeCollection { - cppu::UnoType<css::lang::XTypeProvider>::get() , - cppu::UnoType<css::ui::XUIElement>::get() , - cppu::UnoType<css::ui::XUIElementSettings>::get() , - cppu::UnoType<css::beans::XMultiPropertySet>::get() , - cppu::UnoType<css::beans::XFastPropertySet>::get() , - cppu::UnoType<css::beans::XPropertySet>::get() , - cppu::UnoType<css::lang::XInitialization>::get() , - cppu::UnoType<css::lang::XComponent>::get() , - cppu::UnoType<css::util::XUpdatable>::get() , - cppu::UnoType<css::ui::XUIConfigurationListener>::get() , - cppu::UnoType<css::container::XNameAccess>::get() }; - return ourTypeCollection.getTypes(); -} - MenuBarWrapper::MenuBarWrapper( css::uno::Reference< css::uno::XComponentContext > xContext ) -: UIConfigElementWrapperBase( UIElementType::MENUBAR ), +: MenuBarWrapper_Base( UIElementType::MENUBAR ), m_bRefreshPopupControllerCache( true ), m_xContext(std::move( xContext )) { |