37b72ba454
`AccObjectManagerAgent` was holding an `AccObjectWinManager` object and forwarding everything to that one and the event listeners were holding a pointer to the `AccObjectManagerAgent` object. Drop this `AccObjectManagerAgent` indirection and let all of the classes that were interacting with the `AccObjectManagerAgent` directly interact with the `AccObjectWinManager` instead. The idea of having the agent seems to have been to have an abstraction layer and implement different accessible object managers for all platforms, but the agent already has quite some Windows-/IAccessible-specific code/interface and by now, the Linux VCL plugins and macOS have their own a11y bridges, so the TODO do implement this here for Linux as well seems outdated to me. Even if implementing this for Linux and/or macOS in a similar way, I don't see the need for the agent layer, but one way might be to just have an abstract base class (e.g. `AccObjectManager`) that `AccObjectWinManager` and implementations for other platforms derive from, and have the SalInstance return the platform-specific implementation that the `AccTopWindowListener` would then retrieve and pass on. Given that `AccObjectManagerAgent` was forwarding all calls to `AccObjectWinManager` and the methods and params are mostly the same by now (s.a. the preparatory commits), this change is mostly straightforward. A few notes: * `AccObjectManagerAgent::InsertAccObj` had a default nullptr value for the HWND that `AccObjectWinManager:InsertAccObj` didn't have yet, so add that. * `AccObjectManagerAgent::GetIAccessibleFromResID` had an out param instead of a return value; call sites were adapted to fit `AccObjectWinManager:GetIAccessibleFromResID`. * The `UpdateValue` and `UpdateAccName` methods taking 2 params are called `SetValue` and `SetAccName` in `AccObjectWinManager` instead, so adapt call sites accordingly. * prewin.h and postwin.h includes had to be added around the windows.h include in AccObjectWinManager.hxx (build would otherwise fail) * A few `AccObjectWinManager` methods had to be made virtual to make linking work. Change-Id: I88741bf416d4db25d78e973c0db060a828f27926 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155440 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
66 lines
2.9 KiB
C++
66 lines
2.9 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <com/sun/star/awt/XTopWindowListener.hpp>
|
|
#include <com/sun/star/awt/XExtendedToolkit.hpp>
|
|
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
|
|
|
|
#include <cppuhelper/implbase.hxx>
|
|
|
|
#include "AccObjectWinManager.hxx"
|
|
|
|
/**
|
|
* AccEventListener is the general event listener for all top windows. The top windows defined
|
|
* in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP.
|
|
* It implements the methods of XTopWindowListener and the most important method is windowOpened().
|
|
* In this method, all the accessible objects (including COM object and Uno objects) are created and
|
|
* cached into bridge managers, and they are monitored by listeners for later accessible event handling.
|
|
*/
|
|
class AccTopWindowListener : public ::cppu::WeakImplHelper<css::awt::XTopWindowListener>
|
|
{
|
|
private:
|
|
AccObjectWinManager m_aAccObjectManager;
|
|
|
|
public:
|
|
AccTopWindowListener();
|
|
virtual ~AccTopWindowListener() override;
|
|
|
|
// XTopWindowListener
|
|
virtual void SAL_CALL windowOpened(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowClosing(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowClosed(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowMinimized(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowNormalized(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowActivated(const css::lang::EventObject& e) override;
|
|
virtual void SAL_CALL windowDeactivated(const css::lang::EventObject& e) override;
|
|
|
|
// XEventListener
|
|
virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
|
|
|
|
virtual void AddAllListeners(css::accessibility::XAccessible* pAccessible,
|
|
css::accessibility::XAccessible* pParentXAcc, HWND pWND);
|
|
//for On-Demand load.
|
|
virtual void HandleWindowOpened(css::accessibility::XAccessible* pAccessible);
|
|
|
|
sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam);
|
|
};
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|