accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx | 1 accessibility/source/standard/vclxaccessiblebox.cxx | 35 ++---- svtools/source/brwbox/brwbox1.cxx | 58 +++++----- svtools/source/brwbox/editbrowsebox.cxx | 7 - 4 files changed, 50 insertions(+), 51 deletions(-)
New commits: commit 9572354fedf3d521c8fe123c402ccab20b824815 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Feb 15 09:41:55 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 16 09:10:01 2024 +0100 a11y: Drop extra nesting level These checks can all be done in a single if condition rather than having two nested ones. (Use `git show -w` to ignore whitespace change.) Change-Id: Icbaaf45914f4dead9fc27d6e5e69d4cd03ee7393 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163426 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index cbc68fb2d19a..84855ca096cf 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -70,26 +70,25 @@ void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindo if (m_aBoxType==COMBOBOX) { VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); - if ( ( pComboBox != nullptr ) && ( pChildWindow != nullptr ) ) - if (pChildWindow == pComboBox->GetSubEdit()) + if (pComboBox && pChildWindow && pChildWindow == pComboBox->GetSubEdit()) + { + if (rVclWindowEvent.GetId() == VclEventId::WindowShow) + { + // Instantiate text field. + getAccessibleChild (0); + aNewValue <<= m_xText; + } + else { - if (rVclWindowEvent.GetId() == VclEventId::WindowShow) - { - // Instantiate text field. - getAccessibleChild (0); - aNewValue <<= m_xText; - } - else - { - // Release text field. - aOldValue <<= m_xText; - m_xText = nullptr; - } - // Tell the listeners about the new/removed child. - NotifyAccessibleEvent ( - AccessibleEventId::CHILD, - aOldValue, aNewValue); + // Release text field. + aOldValue <<= m_xText; + m_xText = nullptr; } + // Tell the listeners about the new/removed child. + NotifyAccessibleEvent ( + AccessibleEventId::CHILD, + aOldValue, aNewValue); + } } } commit 9b3b747e164c4eab056f65bb29baa04ab1770bb2 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Feb 15 09:29:56 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 16 09:09:52 2024 +0100 a11y: Drop 'using namespace com::sun::star::accessibility::AccessibleEventId" This e.g. makes it easier to grep where a certain kind of event is sent. Change-Id: I50bbdf4413e720188c9e4bbce9c02187183f3858 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163425 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx index f5d47b0a30f8..fa91719e78d5 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx @@ -27,7 +27,6 @@ namespace accessibility { using namespace com::sun::star::accessibility; using namespace com::sun::star::uno; - using namespace com::sun::star::accessibility::AccessibleEventId; AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox, diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index cc78b514f7a6..ce32f324bd42 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -40,9 +40,9 @@ #define SCROLL_FLAGS (ScrollFlags::Clip | ScrollFlags::NoChildren) -using namespace com::sun::star::accessibility::AccessibleEventId; using namespace com::sun::star::accessibility::AccessibleTableModelChangeType; using com::sun::star::accessibility::AccessibleTableModelChange; +using namespace com::sun::star::accessibility; using namespace ::com::sun::star::uno; using namespace svt; @@ -499,7 +499,7 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) return; commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange( COLUMNS_REMOVED, -1, @@ -512,7 +512,7 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) ); commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange( COLUMNS_INSERTED, -1, @@ -562,7 +562,7 @@ void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const OUString& rTitle ) if ( isAccessibleAlive() ) { - commitTableEvent( TABLE_COLUMN_DESCRIPTION_CHANGED, + commitTableEvent(AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED, Any( rTitle ), Any( sOld ) ); @@ -745,7 +745,7 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId ) return; commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange(COLUMNS_REMOVED, -1, -1, @@ -757,7 +757,7 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId ) ); commitHeaderBarEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any( CreateAccessibleColumnHeader( nPos ) ), true @@ -805,21 +805,21 @@ void BrowseBox::RemoveColumns() // all columns should be removed, so we remove the column header bar and append it again // to avoid to notify every column remove commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)) ); // and now append it again commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)), Any() ); // notify a table model change commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any ( AccessibleTableModelChange( COLUMNS_REMOVED, -1, -1, @@ -1125,21 +1125,21 @@ void BrowseBox::Clear() return; commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) ); // and now append it again commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ), Any() ); // notify a table model change commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange(ROWS_REMOVED, 0, nOldRowCount, @@ -1225,7 +1225,7 @@ void BrowseBox::RowInserted( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint, if ( isAccessibleAlive() ) { commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange( ROWS_INSERTED, nRow, @@ -1240,7 +1240,7 @@ void BrowseBox::RowInserted( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint, for (tools::Long i = nRow+1 ; i <= nRowCount ; ++i) { commitHeaderBarEvent( - CHILD, + AccessibleEventId::CHILD, Any( CreateAccessibleRowHeader( i ) ), Any(), false @@ -1368,26 +1368,26 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) // all columns should be removed, so we remove the column header bar and append it again // to avoid to notify every column remove commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) ); // and now append it again commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), Any() ); commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any( m_pImpl->getAccessibleTable() ) ); // and now append it again commitBrowseBoxEvent( - CHILD, + AccessibleEventId::CHILD, Any( m_pImpl->getAccessibleTable() ), Any() ); @@ -1395,7 +1395,7 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) else { commitTableEvent( - TABLE_MODEL_CHANGED, + AccessibleEventId::TABLE_MODEL_CHANGED, Any( AccessibleTableModelChange( ROWS_REMOVED, nRow, @@ -1410,7 +1410,7 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) for (tools::Long i = nRow+1 ; i <= (nRow+nNumRows) ; ++i) { commitHeaderBarEvent( - CHILD, + AccessibleEventId::CHILD, Any(), Any( CreateAccessibleRowHeader( i ) ), false @@ -1642,7 +1642,7 @@ void BrowseBox::SetNoSelection() if ( isAccessibleAlive() ) { commitTableEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); @@ -1695,19 +1695,19 @@ void BrowseBox::SelectAll() return; commitTableEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); commitHeaderBarEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any(), true ); // column header event commitHeaderBarEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any(), false @@ -1774,12 +1774,12 @@ void BrowseBox::SelectRow( sal_Int32 nRow, bool _bSelect, bool bExpand ) return; commitTableEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); commitHeaderBarEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any(), false @@ -1841,12 +1841,12 @@ void BrowseBox::SelectColumnPos( sal_uInt16 nNewColPos, bool _bSelect, bool bMak if ( isAccessibleAlive() ) { commitTableEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); commitHeaderBarEvent( - SELECTION_CHANGED, + AccessibleEventId::SELECTION_CHANGED, Any(), Any(), true @@ -2340,7 +2340,7 @@ void BrowseBox::CursorMoved() if ( isAccessibleAlive() && HasFocus() ) commitTableEvent( - ACTIVE_DESCENDANT_CHANGED, + AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any( CreateAccessibleCell( GetCurRow(),GetColumnPos( GetCurColumnId() ) ) ), Any() ); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 515c102379b3..a86fe61c22b8 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -50,8 +50,9 @@ namespace svt } } + using namespace com::sun::star::accessibility; using namespace ::com::sun::star::uno; - using namespace com::sun::star::accessibility::AccessibleEventId; + IEditImplementation::~IEditImplementation() @@ -953,7 +954,7 @@ namespace svt if ( isAccessibleAlive() && HasFocus() ) { commitTableEvent( - ACTIVE_DESCENDANT_CHANGED, + AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any( CreateAccessibleCell( nRow, GetColumnPos( nCol -1) ) ), Any() ); @@ -969,7 +970,7 @@ namespace svt if ( isAccessibleAlive() && m_aImpl->m_xActiveCell) { - commitBrowseBoxEvent( CHILD, Any(), Any( m_aImpl->m_xActiveCell ) ); + commitBrowseBoxEvent(AccessibleEventId::CHILD, Any(), Any(m_aImpl->m_xActiveCell)); m_aImpl->clearActiveCell(); }