android: Update app-specific/MIME type icons
[LibreOffice.git] / winaccessibility / inc / AccObjectWinManager.hxx
blob86a75c80fad78c956235d347dd94b773de476967
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <map>
23 #include <mutex>
25 #if !defined WIN32_LEAN_AND_MEAN
26 # define WIN32_LEAN_AND_MEAN
27 #endif
28 #include <windows.h>
29 #include <rtl/ref.hxx>
30 #include "ResIDGenerator.hxx"
31 #include <UAccCOM.h>
33 namespace com::sun::star::accessibility {
34 class XAccessible;
36 class ResIDGenerator;
37 class AccObjectManagerAgent;
38 class AccEventListener;
39 class AccObject;
40 enum class UnoMSAAEvent;
42 /*******************************************************************
43 AccObjectWinManager complete the functions:
44 1. Insert, delete,query,update Acc objects
45 2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as
46 Acc Object
47 3.Return COM interface for AT,by the call back in salframe
48 4.Pass accessible information to Acc objects
49 *******************************************************************/
50 class AccObjectWinManager
52 friend class AccObjectManagerAgent;
54 private:
55 typedef std::map<com::sun::star::accessibility::XAccessible*, AccObject> XIdToAccObjHash;
56 typedef std::map<HWND, com::sun::star::accessibility::XAccessible*> XHWNDToXAccHash;
57 typedef std::map<const long, AccObject*> XResIdToAccObjHash;
59 typedef std::map<const HWND, css::accessibility::XAccessible* >
60 XHWNDToDocumentHash;
62 // guard any access to XIdAccList and HwndXAcc
63 std::recursive_mutex m_Mutex;
65 //XAccessible to AccObject
66 XIdToAccObjHash XIdAccList;
68 //HWND to All XAccessible pointer
69 XHWNDToXAccHash HwndXAcc;
71 //id_Child to AccObject
72 XResIdToAccObjHash XResIdAccList;
74 //for file name support
75 XHWNDToDocumentHash XHWNDDocList;
77 css::accessibility::XAccessible* oldFocus;
79 AccObjectManagerAgent* pAgent;
80 ResIDGenerator ResIdGen;
82 AccObjectWinManager(AccObjectManagerAgent* Agent=nullptr);
84 private:
85 long ImpleGenerateResID();
86 AccObject* GetAccObjByXAcc( css::accessibility::XAccessible* pXAcc);
88 IMAccessible* GetTopWindowIMAccessible(HWND hWnd);
90 css::accessibility::XAccessible* GetAccDocByHWND(HWND hWnd);
92 static rtl::Reference<AccEventListener> DeleteAccListener(AccObject* pAccObj);
93 static void InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd);
94 static void DeleteAccChildNode(AccObject* pChild);
95 void DeleteFromHwndXAcc(css::accessibility::XAccessible const * pXAcc );
97 ::rtl::Reference<AccEventListener> CreateAccEventListener(
98 css::accessibility::XAccessible* pXAcc);
99 public:
100 virtual ~AccObjectWinManager();
101 bool InsertAccObj( css::accessibility::XAccessible* pXAcc,css::accessibility::XAccessible* pParentXAcc,HWND pWnd);
102 bool InsertChildrenAccObj( css::accessibility::XAccessible* pXAcc,HWND pWnd=nullptr);
103 void DeleteAccObj( css::accessibility::XAccessible* pXAcc );
104 void DeleteChildrenAccObj(css::accessibility::XAccessible* pAccObj);
106 bool NotifyAccEvent(css::accessibility::XAccessible* pXAcc, UnoMSAAEvent eEvent);
108 LRESULT Get_ToATInterface(HWND hWnd, long lParam, WPARAM wParam);
110 void DecreaseState(css::accessibility::XAccessible* pXAcc, sal_Int64 nState);
111 void IncreaseState(css::accessibility::XAccessible* pXAcc, sal_Int64 nState);
112 void UpdateState( css::accessibility::XAccessible* pXAcc );
114 void SetValue( css::accessibility::XAccessible* pXAcc, css::uno::Any pAny );
115 void UpdateValue( css::accessibility::XAccessible* pXAcc );
117 void SetAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any newName);
118 void UpdateAccName( css::accessibility::XAccessible* pXAcc );
120 void UpdateAccFocus( css::accessibility::XAccessible* newFocus );
121 void UpdateAction( css::accessibility::XAccessible* pXAcc );
123 static bool IsContainer( css::accessibility::XAccessible* pAccessible );
125 IMAccessible* GetIMAccByXAcc( css::accessibility::XAccessible* pXAcc );
126 IMAccessible* GetIAccessibleFromResID(long resID);
128 void NotifyDestroy( css::accessibility::XAccessible* pXAcc );
129 css::accessibility::XAccessible* GetParentXAccessible( css::accessibility::XAccessible* pXAcc );
130 short GetParentRole( css::accessibility::XAccessible* pXAcc );
132 void SaveTopWindowHandle(HWND hWnd, css::accessibility::XAccessible* pXAcc);
134 void UpdateChildState(css::accessibility::XAccessible* pXAcc);
136 bool IsSpecialToolbarItem(css::accessibility::XAccessible* pXAcc);
138 static short GetRole(css::accessibility::XAccessible* pXAcc);
140 css::accessibility::XAccessible* GetAccDocByAccTopWin( css::accessibility::XAccessible* pXAcc );
141 bool IsTopWinAcc( css::accessibility::XAccessible* pXAcc );
143 static bool IsStateManageDescendant(css::accessibility::XAccessible* pAccessible);
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */