diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-30 13:55:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-30 21:36:17 +0200 |
commit | b58aeda083b245bd12b31f53c0fb1717af188cc4 (patch) | |
tree | e1b8480eaf9028936088b2de8f659f2b0f53b57b /basctl | |
parent | dbe8597ce4f8c503ac10836570a76a607b2ebb9c (diff) |
use concrete type for ChildDescriptor::mxAccessible
avoid some unnecessary casting
Change-Id: I23e0257d1831c1c43d2d646d4ff8e1d654c0b528
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156289
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/accessibility/accessibledialogwindow.cxx | 50 | ||||
-rw-r--r-- | basctl/source/inc/accessibledialogwindow.hxx | 6 |
2 files changed, 19 insertions, 37 deletions
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 71a41aa6848a..9b17f3cf4caa 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -120,13 +120,8 @@ void AccessibleDialogWindow::UpdateFocused() { for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetFocused( pShape->IsFocused() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetFocused( i.mxAccessible->IsFocused() ); } } @@ -137,13 +132,8 @@ void AccessibleDialogWindow::UpdateSelected() for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetSelected( pShape->IsSelected() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetSelected( i.mxAccessible->IsSelected() ); } } @@ -152,13 +142,8 @@ void AccessibleDialogWindow::UpdateBounds() { for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetBounds( pShape->GetBounds() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetBounds( i.mxAccessible->GetBounds() ); } } @@ -244,7 +229,7 @@ void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc ) return; // get the accessible of the removed child - Reference< XAccessible > xChild( aIter->rxAccessible ); + rtl::Reference< AccessibleDialogControlShape > xChild( aIter->mxAccessible ); // remove entry from child list m_aAccessibleChildren.erase( aIter ); @@ -253,12 +238,11 @@ void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc ) if ( xChild.is() ) { Any aOldValue, aNewValue; - aOldValue <<= xChild; + aOldValue <<= uno::Reference<XAccessible>(xChild); NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( xChild ) + xChild->dispose(); } } @@ -380,9 +364,8 @@ void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindo // dispose all children for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( i.mxAccessible ) + i.mxAccessible->dispose(); } m_aAccessibleChildren.clear(); } @@ -514,9 +497,8 @@ void AccessibleDialogWindow::disposing() // dispose all children for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( i.mxAccessible ) + i.mxAccessible->dispose(); } m_aAccessibleChildren.clear(); } @@ -559,7 +541,7 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int64 i if ( i < 0 || i >= getAccessibleChildCount() ) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild = m_aAccessibleChildren[i].rxAccessible; + rtl::Reference< AccessibleDialogControlShape > xChild = m_aAccessibleChildren[i].mxAccessible; if ( !xChild.is() ) { if ( m_pDialogWindow ) @@ -570,7 +552,7 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int64 i xChild = new AccessibleDialogControlShape( m_pDialogWindow, pDlgEdObj ); // insert into child list - m_aAccessibleChildren[i].rxAccessible = xChild; + m_aAccessibleChildren[i].mxAccessible = xChild; } } } diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx index 0ef2bf1e5034..0332b98a4175 100644 --- a/basctl/source/inc/accessibledialogwindow.hxx +++ b/basctl/source/inc/accessibledialogwindow.hxx @@ -37,7 +37,7 @@ class DialogWindow; class DlgEditor; class DlgEdModel; class DlgEdObj; - +class AccessibleDialogControlShape; class AccessibleDialogWindow final : public cppu::ImplInheritanceHelper< @@ -52,8 +52,8 @@ private: class ChildDescriptor { public: - DlgEdObj* pDlgEdObj; - css::uno::Reference< css::accessibility::XAccessible > rxAccessible; + DlgEdObj* pDlgEdObj; + rtl::Reference< AccessibleDialogControlShape > mxAccessible; ChildDescriptor( DlgEdObj* _pDlgEdObj ); |