diff options
Diffstat (limited to 'chart2/source/controller/accessibility/AccessibleTextHelper.cxx')
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleTextHelper.cxx | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx index 620897210db1..b58cb1c62294 100644 --- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx +++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx @@ -33,18 +33,18 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <osl/diagnose.h> + using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; namespace chart { AccessibleTextHelper::AccessibleTextHelper( DrawViewWrapper * pDrawViewWrapper ) : - impl::AccessibleTextHelper_Base( m_aMutex ), m_pDrawViewWrapper( pDrawViewWrapper ) {} @@ -52,64 +52,52 @@ AccessibleTextHelper::~AccessibleTextHelper() { } -// ____ XInitialization ____ -void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments ) +void AccessibleTextHelper::initialize(const OUString& aCID, + const rtl::Reference<comphelper::OAccessible>& rEventSource, + vcl::Window* pWindow) { - OUString aCID; - Reference< XAccessible > xEventSource; - Reference< awt::XWindow > xWindow; - - if( aArguments.getLength() >= 3 ) - { - aArguments[0] >>= aCID; - aArguments[1] >>= xEventSource; - aArguments[2] >>= xWindow; - } OSL_ENSURE( !aCID.isEmpty(), "Empty CID" ); - OSL_ENSURE( xEventSource.is(), "Empty Event Source" ); - OSL_ENSURE( xWindow.is(), "Empty Window" ); - if( !xEventSource.is() || aCID.isEmpty() ) + assert(rEventSource.is() && "Empty Event Source"); + if (aCID.isEmpty()) return; SolarMutexGuard aSolarGuard; - m_pTextHelper.reset(); + m_oTextHelper.reset(); - VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( xWindow )); if( pWindow ) { - SdrView * pView = m_pDrawViewWrapper; - if( pView ) + if (m_pDrawViewWrapper) { SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID ); if( pTextObj ) { - m_pTextHelper.reset( new ::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow)) ); - m_pTextHelper->SetEventSource( xEventSource ); + m_oTextHelper.emplace(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *m_pDrawViewWrapper, *pWindow->GetOutDev())); + m_oTextHelper->SetEventSource(rEventSource); } } } - OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" ); + OSL_ENSURE( m_oTextHelper, "Couldn't create text helper" ); } // ____ XAccessibleContext ____ -::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleChildCount() +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_Int32 i ) +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 >(); } @@ -120,7 +108,7 @@ Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent() return Reference< XAccessible >(); } -::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent() +sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent() { OSL_FAIL( "Not implemented in this helper" ); return -1; @@ -150,10 +138,10 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessible return Reference< XAccessibleRelationSet >(); } -Reference< XAccessibleStateSet > SAL_CALL AccessibleTextHelper::getAccessibleStateSet() +sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleStateSet() { OSL_FAIL( "Not implemented in this helper" ); - return Reference< XAccessibleStateSet >(); + return 0; } lang::Locale SAL_CALL AccessibleTextHelper::getLocale() |