loplugin:expandablemethods in accessibility

Change-Id: I51d13c12274d99623b97f611e30204bea624cbfc
This commit is contained in:
Noel Grandin
2016-11-01 14:53:41 +02:00
parent 53949256dd
commit 49c7bc5af2
20 changed files with 29 additions and 154 deletions

View File

@@ -211,9 +211,6 @@ public:
::svt::IAccessibleTableProvider& _rBrowseBox
);
/// checks whether the accessible context is still alive
bool isContextAlive() const;
/// returns the AccessibleContext belonging to this Accessible
inline AccessibleBrowseBox* getContext() { return m_pContext; }
@@ -233,7 +230,7 @@ protected:
void dispose() override;
virtual bool isAlive() const override
{
return isContextAlive();
return m_pContext && m_pContext->isAlive();
}
virtual css::uno::Reference< css::accessibility::XAccessible >
getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) override

View File

@@ -198,9 +198,6 @@ protected:
/** @attention This method requires locked mutex's and a living object.
@return The column index of the specified cell index. */
sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const;
/** @attention This method requires locked mutex's and a living object.
@return The child index of the specified cell address. */
sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const;
/** @attention This method requires locked mutex's and a living object.
@return TRUE, if the specified row is selected. */

View File

@@ -179,9 +179,6 @@ public:
::svt::table::IAccessibleTable& _rTable
);
/// checks whether the accessible context is still alive
bool isContextAlive() const;
/// returns the AccessibleContext belonging to this Accessible
inline AccessibleGridControl* getContext() { return m_pContext; }
@@ -201,7 +198,7 @@ protected:
void DisposeAccessImpl() override;
virtual bool isAlive() const override
{
return isContextAlive();
return m_pContext && m_pContext->isAlive();
}
virtual void commitCellEvent( sal_Int16 nEventId,
const css::uno::Any& rNewValue, const css::uno::Any& rOldValue ) override

View File

@@ -157,19 +157,12 @@ public:
protected:
// internal helper methods
/** @attention This method requires locked mutex's and a living object.
@return The number of cells of the table. */
sal_Int32 implGetChildCount() const;
/** @attention This method requires locked mutex's and a living object.
@return The row index of the specified cell index. */
sal_Int32 implGetRow( sal_Int32 nChildIndex ) const;
/** @attention This method requires locked mutex's and a living object.
@return The column index of the specified cell index. */
sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const;
/** @attention This method requires locked mutex's and a living object.
@return The child index of the specified cell address. */
sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const;
/** Fills a sequence with sorted indexes of completely selected rows.
@attention This method requires locked mutex's and a living object.

View File

@@ -75,10 +75,6 @@ namespace accessibility
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
// XServiceInfo - static methods
static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(css::uno::RuntimeException);
static OUString getImplementationName_Static() throw(css::uno::RuntimeException);
// XAccessible
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (css::uno::RuntimeException, std::exception) override;

View File

@@ -118,10 +118,6 @@ namespace accessibility
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
// XServiceInfo - static methods
static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(css::uno::RuntimeException);
static OUString getImplementationName_Static() throw(css::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException, std::exception) override;

View File

@@ -88,10 +88,6 @@ namespace accessibility
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
// XServiceInfo - static methods
static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(css::uno::RuntimeException);
static OUString getImplementationName_Static() throw(css::uno::RuntimeException);
// XAccessible
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (css::uno::RuntimeException, std::exception) override;

View File

@@ -143,10 +143,6 @@ namespace accessibility
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
// XServiceInfo - static methods
static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(css::uno::RuntimeException);
static OUString getImplementationName_Static() throw(css::uno::RuntimeException);
// XAccessible
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (css::uno::RuntimeException, std::exception) override;

View File

@@ -48,8 +48,6 @@ private:
/** Throws an exception, if nIndex is not a valid child index. */
void ensureValidIndex( sal_Int32 _nIndex ) const;
/** Returns true, if the specified row is selected. */
bool implIsRowSelected( sal_Int32 _nRow ) const;
/** Selects the specified row. */
void implSelectRow( sal_Int32 _nRow, bool _bSelect );
@@ -59,8 +57,6 @@ private:
sal_Int32 implGetColumnCount() const override;
/** Returns the count of selected rows in the table. */
sal_Int32 implGetSelRowCount() const;
/** Returns the total cell count in the table (including header). */
inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
/** Returns the row index from cell index. */
inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); }

View File

@@ -53,10 +53,6 @@ namespace accessibility
protected:
virtual ~ListBoxAccessibleBase( );
// own overridables
/// will be called for any VclWindowEvent events broadcasted by our VCL window
void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
/** will be called when our window broadcasts the VCLEVENT_OBJECT_DYING event
<p>Usually, you derive your class from both ListBoxAccessibleBase and XComponent,

View File

@@ -347,11 +347,6 @@ css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL Accessibl
}
bool AccessibleBrowseBoxAccess::isContextAlive() const
{
return ( nullptr != m_pContext ) && m_pContext->isAlive();
}
} // namespace accessibility

View File

@@ -132,7 +132,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleIndex(
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidAddress( nRow, nColumn );
return implGetChildIndex( nRow, nColumn );
return nRow * implGetColumnCount() + nColumn;
}
sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRow( sal_Int32 nChildIndex )
@@ -244,12 +244,6 @@ sal_Int32 AccessibleBrowseBoxTableBase::implGetColumn( sal_Int32 nChildIndex ) c
return nColumns ? (nChildIndex % nColumns) : 0;
}
sal_Int32 AccessibleBrowseBoxTableBase::implGetChildIndex(
sal_Int32 nRow, sal_Int32 nColumn ) const
{
return nRow * implGetColumnCount() + nColumn;
}
bool AccessibleBrowseBoxTableBase::implIsRowSelected( sal_Int32 nRow ) const
{
return mpBrowseBox->IsRowSelected( nRow );

View File

@@ -440,12 +440,6 @@ css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL Accessibl
}
bool AccessibleGridControlAccess::isContextAlive() const
{
return ( nullptr != m_pContext ) && m_pContext->isAlive();
}
} // namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -144,7 +144,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex(
ensureIsAlive();
ensureIsValidAddress( nRow, nColumn );
return implGetChildIndex( nRow, nColumn );
return nRow * m_aTable.GetColumnCount() + nColumn;
}
sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex )
@@ -205,11 +205,6 @@ Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationI
// internal helper methods ----------------------------------------------------
sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const
{
return m_aTable.GetRowCount()*m_aTable.GetColumnCount();
}
sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const
{
sal_Int32 nColumns = m_aTable.GetColumnCount();
@@ -222,12 +217,6 @@ sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex )
return nColumns ? (nChildIndex % nColumns) : 0;
}
sal_Int32 AccessibleGridControlTableBase::implGetChildIndex(
sal_Int32 nRow, sal_Int32 nColumn ) const
{
return nRow * m_aTable.GetColumnCount() + nColumn;
}
void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
{
sal_Int32 const selectionCount( m_aTable.GetSelectedRowCount() );
@@ -263,7 +252,7 @@ void AccessibleGridControlTableBase::ensureIsValidAddress(
void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException )
{
if( nChildIndex >= implGetChildCount() )
if( nChildIndex >= m_aTable.GetRowCount()*m_aTable.GetColumnCount() )
throw lang::IndexOutOfBoundsException(
OUString( "child index is invalid" ), *this );
}

View File

@@ -129,31 +129,19 @@ namespace accessibility
OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() throw (RuntimeException, std::exception)
{
return getImplementationName_Static();
return OUString( "com.sun.star.comp.svtools.AccessibleIconChoiceControl" );
}
Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() throw (RuntimeException, std::exception)
{
return getSupportedServiceNames_Static();
}
sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
// XServiceInfo - static methods
Sequence< OUString > AccessibleIconChoiceCtrl::getSupportedServiceNames_Static() throw (RuntimeException)
{
return {"com.sun.star.accessibility.AccessibleContext",
"com.sun.star.accessibility.AccessibleComponent",
"com.sun.star.awt.AccessibleIconChoiceControl"};
}
OUString AccessibleIconChoiceCtrl::getImplementationName_Static() throw (RuntimeException)
sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return OUString( "com.sun.star.comp.svtools.AccessibleIconChoiceControl" );
return cppu::supportsService(this, _rServiceName);
}
// XAccessible

View File

@@ -232,31 +232,19 @@ throw(RuntimeException, std::exception)
OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException, std::exception)
{
return getImplementationName_Static();
return OUString( "com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry" );
}
Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
return getSupportedServiceNames_Static();
}
sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
// XServiceInfo - static methods
Sequence< OUString > AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static() throw( RuntimeException )
{
return {"com.sun.star.accessibility.AccessibleContext",
"com.sun.star.accessibility.AccessibleComponent",
"com.sun.star.awt.AccessibleIconChoiceControlEntry"};
}
OUString AccessibleIconChoiceCtrlEntry::getImplementationName_Static() throw( RuntimeException )
sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return OUString( "com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry" );
return cppu::supportsService(this, _rServiceName);
}
// XAccessible

View File

@@ -319,31 +319,19 @@ namespace accessibility
OUString SAL_CALL AccessibleListBox::getImplementationName() throw(RuntimeException, std::exception)
{
return getImplementationName_Static();
return OUString( "com.sun.star.comp.svtools.AccessibleTreeListBox" );
}
Sequence< OUString > SAL_CALL AccessibleListBox::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
return getSupportedServiceNames_Static();
}
sal_Bool SAL_CALL AccessibleListBox::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
// XServiceInfo - static methods
Sequence< OUString > AccessibleListBox::getSupportedServiceNames_Static() throw( RuntimeException )
{
return {"com.sun.star.accessibility.AccessibleContext",
"com.sun.star.accessibility.AccessibleComponent",
"com.sun.star.awt.AccessibleTreeListBox"};
}
OUString AccessibleListBox::getImplementationName_Static() throw( RuntimeException )
sal_Bool SAL_CALL AccessibleListBox::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return OUString( "com.sun.star.comp.svtools.AccessibleTreeListBox" );
return cppu::supportsService(this, _rServiceName);
}
// XAccessible

View File

@@ -257,31 +257,19 @@ namespace accessibility
OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() throw(RuntimeException, std::exception)
{
return getImplementationName_Static();
return OUString( "com.sun.star.comp.svtools.AccessibleTreeListBoxEntry" );
}
Sequence< OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
return getSupportedServiceNames_Static();
}
sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
// XServiceInfo - static methods
Sequence< OUString > AccessibleListBoxEntry::getSupportedServiceNames_Static() throw( RuntimeException )
{
return {"com.sun.star.accessibility.AccessibleContext",
"com.sun.star.accessibility.AccessibleComponent",
"com.sun.star.awt.AccessibleTreeListBoxEntry"};
}
OUString AccessibleListBoxEntry::getImplementationName_Static() throw( RuntimeException )
sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return OUString( "com.sun.star.comp.svtools.AccessibleTreeListBoxEntry" );
return cppu::supportsService(this, _rServiceName);
}
// XAccessible

View File

@@ -260,15 +260,10 @@ namespace accessibility
void AccessibleTabListBoxTable::ensureValidIndex( sal_Int32 _nIndex ) const
{
if ( ( _nIndex < 0 ) || ( _nIndex >= implGetCellCount() ) )
if ( ( _nIndex < 0 ) || ( _nIndex >= (implGetRowCount() * implGetColumnCount()) ) )
throw IndexOutOfBoundsException();
}
bool AccessibleTabListBoxTable::implIsRowSelected( sal_Int32 _nRow ) const
{
return m_pTabListBox && m_pTabListBox->IsSelected( m_pTabListBox->GetEntry( _nRow ) );
}
void AccessibleTabListBoxTable::implSelectRow( sal_Int32 _nRow, bool _bSelect )
{
if ( m_pTabListBox )
@@ -341,7 +336,7 @@ namespace accessibility
ensureIsAlive();
ensureValidIndex( nChildIndex );
return implIsRowSelected( implGetRow( nChildIndex ) );
return m_pTabListBox && m_pTabListBox->IsSelected( m_pTabListBox->GetEntry( implGetRow( nChildIndex ) ) );
}
void SAL_CALL AccessibleTabListBoxTable::clearAccessibleSelection( ) throw (RuntimeException, std::exception)

View File

@@ -46,22 +46,9 @@ namespace accessibility
OSL_ENSURE( rEvent.GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
OSL_ENSURE( rEvent.GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
ProcessWindowEvent( rEvent );
}
void ListBoxAccessibleBase::disposing()
{
SolarMutexGuard g;
if ( m_pWindow )
m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
m_pWindow = nullptr;
}
void ListBoxAccessibleBase::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
{
if ( isAlive() )
{
switch ( _rVclWindowEvent.GetId() )
switch ( rEvent.GetId() )
{
case VCLEVENT_OBJECT_DYING :
{
@@ -74,6 +61,15 @@ namespace accessibility
}
}
}
void ListBoxAccessibleBase::disposing()
{
SolarMutexGuard g;
if ( m_pWindow )
m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
m_pWindow = nullptr;
}
} // namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */