summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2025-01-28 09:08:59 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2025-01-29 08:25:21 +0100
commitabd9bb06912daac0568fd47c87886c519a37bad8 (patch)
tree27bedaa3dd23b8360cac2e147b294bf71f92c723
parent2f574de08b5c4c009c1e3880f548e79d380bcc4f (diff)
uno grid a11y: Let impl handle alive check
Make TableControl_Impl::isAccessibleAlive private and drop all uses in TableControl. They are unnecessary there, because the TableControl_Impl methods that get called already call TableControl_Impl::isAccessibleAlive themselves to check whether the accessible is still alive, and that is in my opinion actually an implementation detail only the impl should have to care about. Drop "IfAccessibleAlive" from the method names for TableControl::commitCellEventIfAccessibleAlive and TableControl::commitTableEventIfAccessibleAlive. Change-Id: I5589289de0ca96ce5fc5993df5cef3877dce881a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180819 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--toolkit/inc/controls/table/tablecontrol.hxx4
-rw-r--r--toolkit/source/controls/svtxgridcontrol.cxx10
-rw-r--r--toolkit/source/controls/table/tablecontrol.cxx55
-rw-r--r--toolkit/source/controls/table/tablecontrol_impl.hxx3
4 files changed, 31 insertions, 41 deletions
diff --git a/toolkit/inc/controls/table/tablecontrol.hxx b/toolkit/inc/controls/table/tablecontrol.hxx
index a4ed69f4a60b..af5b1e2d9d1f 100644
--- a/toolkit/inc/controls/table/tablecontrol.hxx
+++ b/toolkit/inc/controls/table/tablecontrol.hxx
@@ -130,8 +130,8 @@ namespace svt::table
// Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
// firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
// instead of something triggered externally.
- void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
- void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
+ void commitCellEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue);
+ void commitTableEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue);
sal_Int32 GetAccessibleControlCount() const;
sal_Int32 GetRowCount() const;
diff --git a/toolkit/source/controls/svtxgridcontrol.cxx b/toolkit/source/controls/svtxgridcontrol.cxx
index 74036177d8ab..33468dd3c3f2 100644
--- a/toolkit/source/controls/svtxgridcontrol.cxx
+++ b/toolkit/source/controls/svtxgridcontrol.cxx
@@ -792,12 +792,12 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
// works when the control is used outside the UNO context
if (pTable->GetCurrentRow() != ROW_INVALID && pTable->GetCurrentColumn() != COL_INVALID)
{
- pTable->commitCellEventIfAccessibleAlive(
+ pTable->commitCellEvent(
AccessibleEventId::STATE_CHANGED,
Any( AccessibleStateType::FOCUSED ),
Any()
);
- pTable->commitTableEventIfAccessibleAlive(
+ pTable->commitTableEvent(
AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
Any(),
Any()
@@ -805,7 +805,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
}
else
{
- pTable->commitTableEventIfAccessibleAlive(
+ pTable->commitTableEvent(
AccessibleEventId::STATE_CHANGED,
Any( AccessibleStateType::FOCUSED ),
Any()
@@ -820,7 +820,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
// works when the control is used outside the UNO context
if (pTable->GetCurrentRow() != ROW_INVALID && pTable->GetCurrentColumn() != COL_INVALID)
{
- pTable->commitCellEventIfAccessibleAlive(
+ pTable->commitCellEvent(
AccessibleEventId::STATE_CHANGED,
Any(),
Any( AccessibleStateType::FOCUSED )
@@ -828,7 +828,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
}
else
{
- pTable->commitTableEventIfAccessibleAlive(
+ pTable->commitTableEvent(
AccessibleEventId::STATE_CHANGED,
Any(),
Any( AccessibleStateType::FOCUSED )
diff --git a/toolkit/source/controls/table/tablecontrol.cxx b/toolkit/source/controls/table/tablecontrol.cxx
index 555ad34a69b8..9ea268764edf 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -141,24 +141,21 @@ namespace svt::table
Control::KeyInput( rKEvt );
else
{
- if ( m_pImpl->isAccessibleAlive() )
- {
- m_pImpl->commitCellEvent( AccessibleEventId::STATE_CHANGED,
- Any( AccessibleStateType::FOCUSED ),
- Any()
- );
- // Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every
- // (handled) key stroke?
-
- m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- Any(),
- Any()
- );
- // ditto: Why do we notify this unconditionally? We should find the right place to notify the
- // ACTIVE_DESCENDANT_CHANGED event.
- // Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are
- // transient, aren't they?
- }
+ m_pImpl->commitCellEvent( AccessibleEventId::STATE_CHANGED,
+ Any( AccessibleStateType::FOCUSED ),
+ Any()
+ );
+ // Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every
+ // (handled) key stroke?
+
+ m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ Any(),
+ Any()
+ );
+ // ditto: Why do we notify this unconditionally? We should find the right place to notify the
+ // ACTIVE_DESCENDANT_CHANGED event.
+ // Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are
+ // transient, aren't they?
}
}
@@ -496,16 +493,14 @@ namespace svt::table
}
}
- void TableControl::commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
+ void TableControl::commitCellEvent(sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue)
{
- if ( m_pImpl->isAccessibleAlive() )
- m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
+ m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
}
- void TableControl::commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
+ void TableControl::commitTableEvent(sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue)
{
- if ( m_pImpl->isAccessibleAlive() )
- m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
+ m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
}
bool TableControl::HasRowHeader()
@@ -601,15 +596,11 @@ namespace svt::table
void TableControl::Select()
{
ImplCallEventListenersAndHandler( VclEventId::TableRowSelect, nullptr );
+ m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED );
- if ( m_pImpl->isAccessibleAlive() )
- {
- m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED );
-
- m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() );
- // TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
- // actually, when the active descendant, i.e. the current cell, *really* changed?
- }
+ m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() );
+ // TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
+ // actually, when the active descendant, i.e. the current cell, *really* changed?
}
TableCell TableControl::hitTest(const Point& rPoint) const
diff --git a/toolkit/source/controls/table/tablecontrol_impl.hxx b/toolkit/source/controls/table/tablecontrol_impl.hxx
index cc53602671ac..bef89eb6c747 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.hxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.hxx
@@ -293,8 +293,6 @@ namespace svt::table
getAccessible(vcl::Window& i_parentWindow);
void disposeAccessible();
- bool isAccessibleAlive() const;
-
// ITableModelListener
virtual void rowsInserted( RowPos first, RowPos last ) override;
virtual void rowsRemoved( RowPos first, RowPos last ) override;
@@ -306,6 +304,7 @@ namespace svt::table
virtual void tableMetricsChanged() override;
private:
+ bool isAccessibleAlive() const;
void impl_commitAccessibleEvent(
sal_Int16 const i_eventID,
css::uno::Any const & i_newValue