chart2/source/controller/accessibility/AccessibleTextHelper.cxx | 16 +++++----- chart2/source/controller/inc/AccessibleTextHelper.hxx | 8 +---- 2 files changed, 10 insertions(+), 14 deletions(-)
New commits: commit bc640ec91106fa55886af84f48eb58b7fa8610b5 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 15 21:44:43 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Dec 16 10:44:35 2023 +0100 no need to allocate this on the heap Change-Id: I9a63c534a12ec2cf11d8820a5bbba8bca9a7c0e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160841 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx index ed98cd296706..6fc26b1c82ad 100644 --- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx +++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx @@ -65,7 +65,7 @@ void AccessibleTextHelper::initialize( const OUString& aCID, SolarMutexGuard aSolarGuard; - m_pTextHelper.reset(); + m_oTextHelper.reset(); VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( xWindow )); if( pWindow ) @@ -76,32 +76,32 @@ void AccessibleTextHelper::initialize( const OUString& aCID, SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID ); if( pTextObj ) { - m_pTextHelper.reset( new ::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow->GetOutDev())) ); - m_pTextHelper->SetEventSource( xEventSource ); + m_oTextHelper.emplace( std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow->GetOutDev()) ); + m_oTextHelper->SetEventSource( xEventSource ); } } } - OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" ); + OSL_ENSURE( m_oTextHelper, "Couldn't create text helper" ); } // ____ XAccessibleContext ____ sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleChildCount() { - if( m_pTextHelper ) + if( m_oTextHelper ) { SolarMutexGuard aSolarGuard; - return m_pTextHelper->GetChildCount(); + return m_oTextHelper->GetChildCount(); } return 0; } Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( sal_Int64 i ) { - if( m_pTextHelper ) + if( m_oTextHelper ) { SolarMutexGuard aSolarGuard; - return m_pTextHelper->GetChild( i ); + return m_oTextHelper->GetChild( i ); } return Reference< XAccessible >(); } diff --git a/chart2/source/controller/inc/AccessibleTextHelper.hxx b/chart2/source/controller/inc/AccessibleTextHelper.hxx index 937af7da05cc..9002a81fb75c 100644 --- a/chart2/source/controller/inc/AccessibleTextHelper.hxx +++ b/chart2/source/controller/inc/AccessibleTextHelper.hxx @@ -20,14 +20,10 @@ #include <memory> #include <comphelper/compbase.hxx> +#include <svx/AccessibleTextHelper.hxx> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/awt/XWindow.hpp> -// forward declaration of helper class from svx -namespace accessibility -{ -class AccessibleTextHelper; -} namespace chart { @@ -78,7 +74,7 @@ public: virtual css::lang::Locale SAL_CALL getLocale() override; private: - std::unique_ptr<::accessibility::AccessibleTextHelper> m_pTextHelper; + std::optional<::accessibility::AccessibleTextHelper> m_oTextHelper; DrawViewWrapper * m_pDrawViewWrapper; };