wina11y: Drop/Clean up CHILD event handling in subclasses

Now that Change-Id I62ab32342ef67c770ced9f0d2be867dc9355bd4a
("tdf#156561 wina11y: Handle CHILD event") has implemented
handling for the CHILD event in `AccEventListener`,
drop the overrides in child classes that effectively
do the same.

For the case that a new child gets added,
`AccFrameEventListener::HandleChildChangedEvent`
also passes the HWND, so leave that and only
forward to the base class for the other case.

Change-Id: I68d836abedbf3563df84187d56851820c043866f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155127
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2023-08-01 13:14:46 +02:00
parent 1d92445fca
commit f9631765c9
11 changed files with 1 additions and 238 deletions
@@ -45,10 +45,6 @@ public:
//AccessibleEventListener
virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
//for child changed event
virtual void HandleChildChangedEvent(
css::uno::Any oldValue, css::uno::Any newValue) override;
//for selection changed event
virtual void HandleSelectionChangedEvent(
const css::uno::Any &oldValue, const css::uno::Any &newValue);
@@ -49,10 +49,6 @@ public:
virtual void HandleSelectionChangedEvent(
css::uno::Any oldValue, css::uno::Any newValue);
//for child changed event
virtual void HandleChildChangedEvent(
css::uno::Any oldValue, css::uno::Any newValue) override;
virtual void HandleChildChangedNoFocusEvent(
css::uno::Any oldValue, css::uno::Any newValue);
@@ -40,9 +40,6 @@ public:
virtual void SAL_CALL
notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override;
//for child changed event
virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue) override;
//state changed
virtual void SetComponentState(sal_Int64 state, bool enable) override;
};
@@ -40,9 +40,6 @@ public:
virtual void SAL_CALL
notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override;
//for child changed event
virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue) override;
//for selection changed event
virtual void HandleSelectionChangedEventNoArgs();
@@ -40,9 +40,6 @@ public:
virtual void SAL_CALL
notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override;
//for child changed event
virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue) override;
//state changed
virtual void SetComponentState(sal_Int64 state, bool enable) override;
};
@@ -52,9 +52,6 @@ void AccContainerEventListener::notifyEvent( const css::accessibility::Accessib
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::SELECTION_CHANGED:
HandleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
@@ -114,47 +111,6 @@ void AccContainerEventListener::HandleStateChangedEvent(Any oldValue, Any newVal
}
/**
* handle the CHILD event
* @param oldValue the child to be deleted
* @param newValue the child to be added
*/
void AccContainerEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
//add this child
if (pAgent->InsertAccObj(pAcc, m_xAccessible.get()))
{
//add all oldValue's existing children
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
}
else if (oldValue >>= xChild)
{
//delete an existing child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
//delete all oldValue's existing children
pAgent->DeleteChildrenAccObj( pAcc );
//delete this child
pAgent->DeleteAccObj( pAcc );
}
}
}
/**
* handle the SELECTION_CHANGED event
* @param oldValue the old value of the source of event
@@ -54,9 +54,6 @@ void AccDescendantManagerEventListener::notifyEvent( const css::accessibility::
case AccessibleEventId::SELECTION_CHANGED:
HandleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS:
HandleChildChangedNoFocusEvent(aEvent.OldValue, aEvent.NewValue);
break;
@@ -75,43 +72,6 @@ void AccDescendantManagerEventListener::notifyEvent( const css::accessibility::
}
}
/**
* handle the CHILD event
* @param oldValue the child to be deleted
* @param newValue the child to be added
*/
void AccDescendantManagerEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->InsertAccObj(pAcc, m_xAccessible.get());
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
if (oldValue >>= xChild)
{
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
pAgent->DeleteChildrenAccObj( pAcc );
pAgent->DeleteAccObj( pAcc );
}
}
}
/**
* handle the SELECTION_CHANGED event
*/
@@ -49,9 +49,6 @@ void AccDialogEventListener::notifyEvent( const css::accessibility::AccessibleE
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::VISIBLE_DATA_CHANGED:
HandleVisibleDataChangedEvent();
break;
@@ -64,43 +61,6 @@ void AccDialogEventListener::notifyEvent( const css::accessibility::AccessibleE
}
}
/**
* handle the CHILD event
* @param oldValue the child to be deleted
* @param newValue the child to be added
*/
void AccDialogEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
//add this child
pAgent->InsertAccObj(pAcc, m_xAccessible.get());
//add all oldValue's existing children
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
else if (oldValue >>= xChild)
{
//delete an existing child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
//delete all oldValue's existing children
pAgent->DeleteChildrenAccObj( pAcc );
//delete this child
pAgent->DeleteAccObj( pAcc );
}
}
}
/**
* set the new state and fire the MSAA event
* @param state new state id
@@ -55,9 +55,6 @@ void AccFrameEventListener::notifyEvent( const css::accessibility::AccessibleEv
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::VISIBLE_DATA_CHANGED:
HandleVisibleDataChangedEvent();
break;
@@ -80,37 +77,23 @@ void AccFrameEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
VCLXWindow* pvclwindow = dynamic_cast<VCLXWindow*>(m_xAccessible.get());
assert(pvclwindow);
const SystemEnvData* systemdata
= pvclwindow->GetWindow()->GetSystemData();
//add this child
pAgent->InsertAccObj(pAcc, m_xAccessible.get(), systemdata->hWnd);
//add all oldValue's existing children
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
else if (oldValue >>= xChild)
{
//delete an existing child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
//delete all oldValue's existing children
pAgent->DeleteChildrenAccObj( pAcc );
//delete this child
pAgent->DeleteAccObj( pAcc );
}
AccEventListener::HandleChildChangedEvent(oldValue, newValue);
}
}
/**
@@ -49,9 +49,6 @@ void AccMenuEventListener::notifyEvent( const css::accessibility::AccessibleEve
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::SELECTION_CHANGED:
//don't need to process anything,just same as word behavior
//handleSelectionChangedEvent();
@@ -62,44 +59,6 @@ void AccMenuEventListener::notifyEvent( const css::accessibility::AccessibleEve
}
}
/**
* handle the CHILD event
* @param oldValue the child to be deleted
* @param newValue the child to be added
*/
void AccMenuEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
//add this child
pAgent->InsertAccObj(pAcc, m_xAccessible.get());
//add all oldValue's existing children
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
else if (oldValue >>= xChild)
{
//delete an existing child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
//delete all oldValue's existing children
pAgent->DeleteChildrenAccObj( pAcc );
//delete this child
pAgent->DeleteAccObj( pAcc );
}
}
}
/**
* handle the SELECTION_CHANGED event
*/
@@ -49,9 +49,6 @@ void AccWindowEventListener::notifyEvent( const css::accessibility::AccessibleE
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
break;
case AccessibleEventId::VISIBLE_DATA_CHANGED:
HandleVisibleDataChangedEvent();
break;
@@ -64,41 +61,6 @@ void AccWindowEventListener::notifyEvent( const css::accessibility::AccessibleE
}
}
/**
* handle the CHILD event
* @param oldValue the child to be deleted
* @param newValue the child to be added
*/
void AccWindowEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
Reference< XAccessible > xChild;
if( newValue >>= xChild)
{
//create a new child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
//add this child
pAgent->InsertAccObj(pAcc, m_xAccessible.get());
//add all oldValue's existing children
pAgent->InsertChildrenAccObj(pAcc);
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_ADDED, pAcc);
}
}
else if (oldValue >>= xChild)
{
//delete an existing child
if(xChild.is())
{
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(UnoMSAAEvent::CHILD_REMOVED, pAcc);
pAgent->DeleteChildrenAccObj( pAcc );
//delete this child
pAgent->DeleteAccObj( pAcc );
}
}
}
/**
* set the new state and fire the MSAA event
* @param state new state id