From 28756e84e48330b12087f6fc7d043c2fc5d67f28 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 Nov 2023 15:18:22 +0200 Subject: [PATCH] loplugin:fieldcast in framework::AddonsToolBarWrapper Change-Id: I1fc692581acc805d6c84156d6df57093cf9dff93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159281 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../inc/uielement/addonstoolbarwrapper.hxx | 5 +++-- .../source/uielement/addonstoolbarwrapper.cxx | 20 ++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx index 68cfc0ff31d0..fc09465eea5a 100644 --- a/framework/inc/uielement/addonstoolbarwrapper.hxx +++ b/framework/inc/uielement/addonstoolbarwrapper.hxx @@ -20,12 +20,13 @@ #pragma once #include - +#include #include #include namespace framework { +class ToolBarManager; class AddonsToolBarWrapper final : public UIElementWrapperBase { @@ -47,7 +48,7 @@ class AddonsToolBarWrapper final : public UIElementWrapperBase private: css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::lang::XComponent > m_xToolBarManager; + rtl::Reference< ToolBarManager > m_xToolBarManager; css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > m_aConfigData; bool m_bCreatedImages; }; diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 6547d1c6bcde..f0bb99549fcf 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -134,14 +134,10 @@ Reference< XInterface > SAL_CALL AddonsToolBarWrapper::getRealInterface() { SolarMutexGuard g; - if ( m_xToolBarManager.is() ) + if ( m_xToolBarManager ) { - ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() ); - if ( pToolBarManager ) - { - vcl::Window* pWindow = pToolBarManager->GetToolBar(); - return Reference< XInterface >( VCLUnoHelper::GetInterface( pWindow ), UNO_QUERY ); - } + vcl::Window* pWindow = m_xToolBarManager->GetToolBar(); + return Reference< XInterface >( VCLUnoHelper::GetInterface( pWindow ), UNO_QUERY ); } return Reference< XInterface >(); @@ -155,14 +151,10 @@ void AddonsToolBarWrapper::populateImages() if (m_bCreatedImages) return; - if ( m_xToolBarManager.is() ) + if (m_xToolBarManager) { - ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() ); - if (pToolBarManager) - { - pToolBarManager->RequestImages(); - m_bCreatedImages = true; - } + m_xToolBarManager->RequestImages(); + m_bCreatedImages = true; } }