wina11y: Don't rely on win accessible being VCLXWindow

While at the moment, the XAccessible for many vcl::Window
subclasses is a VCLXWindow, this is an implementation
detail that is subject to change.
Switch away from relying on that implementation detail,
and instead rely on the XAccessibleContext being a
VCLXAccessibleComponent, which will remain true even
if that one will be created without VCLXWindow being
involved in the future.

See also

	commit b1f3e41f10
	Author: Michael Weghorn <m.weghorn@posteo.de>
	Date:   Wed May 21 11:03:56 2025 +0200

	    sw a11y test: Don't rely on XWindow being XAccessible

for more background (which ports away from an assumption
"the other way around").

Change-Id: Ia2e2fe9d88c05afcde2c8a6d31c20c60cfbd5c49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185645
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-05-22 13:45:34 +02:00
parent add53405a0
commit ed03c63f00
@@ -28,8 +28,8 @@
#include <AccObjectWinManager.hxx>
#include <unomsaaevent.hxx>
#include <vcl/accessibility/vclxaccessiblecomponent.hxx>
#include <vcl/window.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/sysdata.hxx>
using namespace com::sun::star::uno;
@@ -78,10 +78,10 @@ void AccFrameEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
if(xChild.is())
{
VCLXWindow* pvclwindow = dynamic_cast<VCLXWindow*>(m_xAccessible.get());
assert(pvclwindow);
const SystemEnvData* systemdata
= pvclwindow->GetWindow()->GetSystemData();
VCLXAccessibleComponent* pVCLAccComponent = dynamic_cast<VCLXAccessibleComponent*>(
m_xAccessible->getAccessibleContext().get());
assert(pVCLAccComponent);
const SystemEnvData* systemdata = pVCLAccComponent->GetWindow()->GetSystemData();
m_rObjManager.InsertAccObj(xChild.get(), m_xAccessible.get(), systemdata->hWnd);
m_rObjManager.InsertChildrenAccObj(xChild.get());