1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_WINACCESSIBILITY_INC_ACCOBJECTWINMANAGER_HXX
21 #define INCLUDED_WINACCESSIBILITY_INC_ACCOBJECTWINMANAGER_HXX
23 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #if !defined WIN32_LEAN_AND_MEAN
26 # define WIN32_LEAN_AND_MEAN
29 #include <rtl/ref.hxx>
30 #include "ResIDGenerator.hxx"
33 #pragma clang diagnostic push
34 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
38 #pragma clang diagnostic pop
42 class AccObjectManagerAgent
;
43 class AccEventListener
;
46 /*******************************************************************
47 AccObjectWinManager complete the functions:
48 1. Insert, delete,query,update Acc objects
49 2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as
51 3.Return COM interface for AT,by the call back in salframe
52 4.Pass accessible information to Acc objects
53 *******************************************************************/
54 class AccObjectWinManager
56 friend class AccObjectManagerAgent
;
59 typedef std::map
<void*, AccObject
> XIdToAccObjHash
;
60 typedef std::map
<HWND
, void*> XHWNDToXAccHash
;
61 typedef std::map
<const long, AccObject
*> XResIdToAccObjHash
;
63 typedef std::map
<const HWND
, css::accessibility::XAccessible
* >
66 //XAccessible to AccObject
67 XIdToAccObjHash XIdAccList
;
69 //HWND to All XAccessible pointer
70 XHWNDToXAccHash HwndXAcc
;
72 //id_Child to AccObject
73 XResIdToAccObjHash XResIdAccList
;
75 //for file name support
76 XHWNDToDocumentHash XHWNDDocList
;
78 css::accessibility::XAccessible
* oldFocus
;
80 AccObjectManagerAgent
* pAgent
;
81 ResIDGenerator ResIdGen
;
83 AccObjectWinManager(AccObjectManagerAgent
* Agent
=nullptr);
86 long ImpleGenerateResID();
87 AccObject
* GetAccObjByXAcc( css::accessibility::XAccessible
* pXAcc
);
89 AccObject
* GetTopWindowAccObj(HWND hWnd
);
91 css::accessibility::XAccessible
* GetAccDocByHWND(HWND hWnd
);
93 static void DeleteAccListener( AccObject
* pAccObj
);
94 static void InsertAccChildNode(AccObject
* pCurObj
,AccObject
* pParentObj
,HWND pWnd
);
95 static void DeleteAccChildNode(AccObject
* pChild
);
96 void DeleteFromHwndXAcc(css::accessibility::XAccessible
const * pXAcc
);
97 int UpdateAccSelection(css::accessibility::XAccessible
* pXAcc
);
99 ::rtl::Reference
<AccEventListener
> CreateAccEventListener(
100 css::accessibility::XAccessible
* pXAcc
);
102 virtual ~AccObjectWinManager();
103 bool InsertAccObj( css::accessibility::XAccessible
* pXAcc
,css::accessibility::XAccessible
* pParentXAcc
,HWND pWnd
);
104 bool InsertChildrenAccObj( css::accessibility::XAccessible
* pXAcc
,HWND pWnd
=nullptr);
105 void DeleteAccObj( css::accessibility::XAccessible
* pXAcc
);
106 void DeleteChildrenAccObj(css::accessibility::XAccessible
* pAccObj
);
108 bool NotifyAccEvent( css::accessibility::XAccessible
* pXAcc
,short state
= 0 );
110 LRESULT
Get_ToATInterface(HWND hWnd
, long lParam
, WPARAM wParam
);
112 void DecreaseState( css::accessibility::XAccessible
* pXAcc
,unsigned short pState
);
113 void IncreaseState( css::accessibility::XAccessible
* pXAcc
,unsigned short pState
);
114 void UpdateState( css::accessibility::XAccessible
* pXAcc
);
115 void SetLocation( css::accessibility::XAccessible
* pXAcc
,
116 long Top
= 0,long left
= 0,long width
= 0,long height
= 0);
118 void SetValue( css::accessibility::XAccessible
* pXAcc
, css::uno::Any pAny
);
119 void UpdateValue( css::accessibility::XAccessible
* pXAcc
);
121 void SetAccName( css::accessibility::XAccessible
* pXAcc
, css::uno::Any newName
);
122 void UpdateAccName( css::accessibility::XAccessible
* pXAcc
);
124 void SetDescription( css::accessibility::XAccessible
* pXAcc
, css::uno::Any newDesc
);
125 void UpdateDescription( css::accessibility::XAccessible
* pXAcc
);
127 void SetRole( css::accessibility::XAccessible
* pXAcc
, long Role
);
129 void UpdateAccFocus( css::accessibility::XAccessible
* newFocus
);
130 void UpdateAction( css::accessibility::XAccessible
* pXAcc
);
132 static bool IsContainer( css::accessibility::XAccessible
* pAccessible
);
134 IMAccessible
* GetIMAccByXAcc( css::accessibility::XAccessible
* pXAcc
);
135 IMAccessible
* GetIAccessibleFromResID(long resID
);
137 void NotifyDestroy( css::accessibility::XAccessible
* pXAcc
);
138 css::accessibility::XAccessible
* GetParentXAccessible( css::accessibility::XAccessible
* pXAcc
);
139 short GetParentRole( css::accessibility::XAccessible
* pXAcc
);
141 void SaveTopWindowHandle(HWND hWnd
, css::accessibility::XAccessible
* pXAcc
);
143 void UpdateChildState(css::accessibility::XAccessible
* pXAcc
);
145 bool IsSpecialToolboItem(css::accessibility::XAccessible
* pXAcc
);
147 static short GetRole(css::accessibility::XAccessible
* pXAcc
);
149 css::accessibility::XAccessible
* GetAccDocByAccTopWin( css::accessibility::XAccessible
* pXAcc
);
150 bool IsTopWinAcc( css::accessibility::XAccessible
* pXAcc
);
152 static bool IsStateManageDescendant(css::accessibility::XAccessible
* pAccessible
);
155 #endif // INCLUDED_WINACCESSIBILITY_INC_ACCOBJECTWINMANAGER_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */