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>
26 #include <osl/mutex.hxx>
27 #include <rtl/ref.hxx>
28 #include "ResIDGenerator.hxx"
32 class AccObjectManagerAgent
;
33 class AccEventListener
;
36 /*******************************************************************
37 AccObjectWinManager complete the functions:
38 1. Insert, delete,query,update Acc objects
39 2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as
41 3.Return COM interface for AT,by the call back in salframe
42 4.Pass accessible information to Acc objects
43 *******************************************************************/
44 class AccObjectWinManager
46 friend class AccObjectManagerAgent
;
49 typedef std::map
<void*, AccObject
> XIdToAccObjHash
;
50 typedef std::map
<HWND
, void*> XHWNDToXAccHash
;
51 typedef std::map
<const long, AccObject
*> XResIdToAccObjHash
;
53 typedef std::map
<const HWND
, com::sun::star::accessibility::XAccessible
* >
56 //XAccessible to AccObject
57 XIdToAccObjHash XIdAccList
;
59 //HWND to All XAccessible pointer
60 XHWNDToXAccHash HwndXAcc
;
62 //id_Child to AccObject
63 XResIdToAccObjHash XResIdAccList
;
65 //for file name support
66 XHWNDToDocumentHash XHWNDDocList
;
68 com::sun::star::accessibility::XAccessible
* oldFocus
;
70 AccObjectManagerAgent
* pAgent
;
71 ResIDGenerator ResIdGen
;
73 AccObjectWinManager(AccObjectManagerAgent
* Agent
=NULL
);
76 long ImpleGenerateResID();
77 AccObject
* GetAccObjByXAcc( com::sun::star::accessibility::XAccessible
* pXAcc
);
79 AccObject
* GetTopWindowAccObj(HWND hWnd
);
81 com::sun::star::accessibility::XAccessible
* GetAccDocByHWND(HWND hWnd
);
83 void DeleteAccListener( AccObject
* pAccObj
);
84 void InsertAccChildNode(AccObject
* pCurObj
,AccObject
* pParentObj
,HWND pWnd
);
85 void DeleteAccChildNode(AccObject
* pChild
);
86 void DeleteFromHwndXAcc(com::sun::star::accessibility::XAccessible
* pXAcc
);
87 int UpdateAccSelection(com::sun::star::accessibility::XAccessible
* pXAcc
);
89 ::rtl::Reference
<AccEventListener
> CreateAccEventListener(
90 com::sun::star::accessibility::XAccessible
* pXAcc
);
92 virtual ~AccObjectWinManager();
93 sal_Bool
InsertAccObj( com::sun::star::accessibility::XAccessible
* pXAcc
,com::sun::star::accessibility::XAccessible
* pParentXAcc
,HWND pWnd
);
94 sal_Bool
InsertChildrenAccObj( com::sun::star::accessibility::XAccessible
* pXAcc
,HWND pWnd
=0);
95 void DeleteAccObj( com::sun::star::accessibility::XAccessible
* pXAcc
);
96 void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible
* pAccObj
);
98 sal_Bool
NotifyAccEvent( com::sun::star::accessibility::XAccessible
* pXAcc
,short state
= 0 );
100 LPARAM
Get_ToATInterface(HWND hWnd
, long lParam
, WPARAM wParam
);
102 void DecreaseState( com::sun::star::accessibility::XAccessible
* pXAcc
,unsigned short pState
);
103 void IncreaseState( com::sun::star::accessibility::XAccessible
* pXAcc
,unsigned short pState
);
104 void UpdateState( com::sun::star::accessibility::XAccessible
* pXAcc
);
105 void SetLocation( com::sun::star::accessibility::XAccessible
* pXAcc
,
106 long Top
= 0,long left
= 0,long width
= 0,long height
= 0);
108 void SetValue( com::sun::star::accessibility::XAccessible
* pXAcc
, com::sun::star::uno::Any pAny
);
109 void UpdateValue( com::sun::star::accessibility::XAccessible
* pXAcc
);
111 void SetAccName( com::sun::star::accessibility::XAccessible
* pXAcc
, com::sun::star::uno::Any newName
);
112 void UpdateAccName( com::sun::star::accessibility::XAccessible
* pXAcc
);
114 void SetDescription( com::sun::star::accessibility::XAccessible
* pXAcc
, com::sun::star::uno::Any newDesc
);
115 void UpdateDescription( com::sun::star::accessibility::XAccessible
* pXAcc
);
117 void SetRole( com::sun::star::accessibility::XAccessible
* pXAcc
, long Role
);
119 void UpdateAccFocus( com::sun::star::accessibility::XAccessible
* newFocus
);
120 void UpdateAction( com::sun::star::accessibility::XAccessible
* pXAcc
);
122 sal_Bool
IsContainer( com::sun::star::accessibility::XAccessible
* pAccessible
);
124 IMAccessible
* GetIMAccByXAcc( com::sun::star::accessibility::XAccessible
* pXAcc
);
125 IMAccessible
* GetIAccessibleFromResID(long resID
);
127 void NotifyDestroy( com::sun::star::accessibility::XAccessible
* pXAcc
);
128 com::sun::star::accessibility::XAccessible
* GetParentXAccessible( com::sun::star::accessibility::XAccessible
* pXAcc
);
129 short GetParentRole( com::sun::star::accessibility::XAccessible
* pXAcc
);
131 void SaveTopWindowHandle(HWND hWnd
, com::sun::star::accessibility::XAccessible
* pXAcc
);
133 void UpdateChildState(com::sun::star::accessibility::XAccessible
* pXAcc
);
135 bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible
* pXAcc
);
137 short GetRole(com::sun::star::accessibility::XAccessible
* pXAcc
);
139 com::sun::star::accessibility::XAccessible
* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible
* pXAcc
);
140 bool IsTopWinAcc( com::sun::star::accessibility::XAccessible
* pXAcc
);
142 bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible
* pAccessible
);
145 #endif // INCLUDED_WINACCESSIBILITY_INC_ACCOBJECTWINMANAGER_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */