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 #include "AccObjectManagerAgent.hxx"
21 #include "AccObjectWinManager.hxx"
25 using namespace com::sun::star::uno
;
26 using namespace com::sun::star::accessibility
;
29 * Construction/Destruction.
33 AccObjectManagerAgent::AccObjectManagerAgent()
34 : pWinManager(new AccObjectWinManager(this))
38 AccObjectManagerAgent::~AccObjectManagerAgent()
43 * Interface of updating MSAA name when UNO name_changed event occurs.
44 * @param pXAcc Uno XAccessible interface of control.
47 void AccObjectManagerAgent::UpdateAccName( XAccessible
* pXAcc
)
50 pWinManager
->UpdateAccName( pXAcc
);
54 * Interface of updating MSAA name when UNO action changed event occurs.
55 * @param pXAcc Uno XAccessible interface of control.
58 void AccObjectManagerAgent::UpdateAction( XAccessible
* pXAcc
)
61 pWinManager
->UpdateAction( pXAcc
);
65 * Interface of updating MSAA value when UNO value_changed event occurs.
66 * @param pXAcc Uno XAccessible interface of control.
67 * @param pAny New value.
70 void AccObjectManagerAgent::UpdateValue( XAccessible
* pXAcc
, Any pAny
)
73 pWinManager
->SetValue( pXAcc
, pAny
);
77 * Interface of updating MSAA value when UNO value_changed event occurs.If we can not
78 * find new value,we'll get new value from pXAcc to update com value.
79 * @param pXAcc Uno XAccessible interface of control.
82 void AccObjectManagerAgent::UpdateValue( XAccessible
* pXAcc
)
85 pWinManager
->UpdateValue( pXAcc
);
89 * Interface of updating MSAA name when UNO name_changed event occurs.
90 * @param pXAcc Uno XAccessible interface of control.
91 * @param newName New UNO accessible name.
94 void AccObjectManagerAgent::UpdateAccName( XAccessible
* pXAcc
, Any newName
)
97 pWinManager
->SetAccName( pXAcc
, newName
);
102 * Interface of updating MSAA location when UNO location_changed event occurs.
103 * @param pXAcc Uno XAccessible interface of control.
104 * @param pXAcc Uno The top position of new location.
105 * @param pXAcc Uno The left position of new location.
106 * @param pXAcc Uno The width of new location.
107 * @param pXAcc Uno The width of new location.
110 void AccObjectManagerAgent::UpdateLocation( XAccessible
* /* pXAcc */, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
114 pWinManager
->SetLocation( pXAcc
, top
, left
, width
, height
);
119 * Interface of updating MSAA name when UNO description_changed event occurs.
120 * @param pXAcc Uno XAccessible interface of control.
121 * @param newDesc New UNO accessible description.
124 void AccObjectManagerAgent::UpdateDescription( XAccessible
* pXAcc
, Any newDesc
)
127 pWinManager
->SetDescription( pXAcc
, newDesc
);
131 * When a new UNO XAccessible object is found by listener,we'll create a corresponding
132 * com object and insert it to our manager list.
133 * @param pXAcc Uno XAccessible interface of control.
134 * @param pWnd The top window handle containing control.
135 * @return If the method is correctly processed.
137 bool AccObjectManagerAgent::InsertAccObj(
138 XAccessible
* pXAcc
, XAccessible
* pParentXAcc
, sal_Int64 nWnd
)
141 return pWinManager
->InsertAccObj(pXAcc
, pParentXAcc
,
142 static_cast<HWND
>(reinterpret_cast<void*>(nWnd
)));
148 * save the pair <topwindowhandle, XAccessible>
149 * @param hWnd, top window handle
150 * @param pXAcc XAccessible interface for top window
154 AccObjectManagerAgent::SaveTopWindowHandle(sal_Int64 hWnd
, XAccessible
* pXAcc
)
157 pWinManager
->SaveTopWindowHandle(
158 static_cast<HWND
>(reinterpret_cast<void*>(hWnd
)), pXAcc
);
163 * When a UNO XAccessible object's new children are found by listener,we'll create
164 * corresponding com objects and insert them to our manager list.
165 * @param pXAcc Uno XAccessible interface of control.
166 * @param pWnd The top window handle containing control.
167 * @return If the method is correctly processed.
170 AccObjectManagerAgent::InsertChildrenAccObj(XAccessible
* pXAcc
, sal_Int64 pWnd
)
173 return pWinManager
->InsertChildrenAccObj( pXAcc
, HWND((void*)pWnd
) );
179 * When a new UNO XAccessible object is destroied,we'll delete its corresponding
180 * com object and remove it from our manager list.
181 * @param pXAcc Uno XAccessible interface of control.
184 void AccObjectManagerAgent::DeleteAccObj( XAccessible
* pXAcc
)
187 pWinManager
->DeleteAccObj( pXAcc
);
191 * When new UNO children XAccessible objects are destroyed,we'll delete their
192 * corresponding com objects and remove them from our manager list.
193 * @param pXAcc Uno XAccessible interface of control.
196 void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible
* pXAcc
)
199 pWinManager
->DeleteChildrenAccObj( pXAcc
);
203 * Interface of decreasing MSAA state when some UNO state is decreased.
204 * @param pXAcc Uno XAccessible interface of control.
205 * @param pState The lost state of control.
208 void AccObjectManagerAgent::DecreaseState( XAccessible
* pXAcc
,unsigned short pState
)
212 pWinManager
->DecreaseState( pXAcc
, pState
);
217 * Interface of increasing MSAA name when some UNO state is increased.
218 * @param pXAcc Uno XAccessible interface of control.
219 * @param pState The new state of control.
222 void AccObjectManagerAgent::IncreaseState( XAccessible
* pXAcc
,unsigned short pState
)
226 pWinManager
->IncreaseState( pXAcc
, pState
);
230 void AccObjectManagerAgent::UpdateState( com::sun::star::accessibility::XAccessible
* pXAcc
)
233 pWinManager
->UpdateState(pXAcc
);
237 * Interface of notify MSAA event when some UNO event occurred.
238 * @param pXAcc Uno XAccessible interface of control.
239 * @param pEvent UNO event ID.
240 * @return If the method is correctly processed.
242 bool AccObjectManagerAgent::NotifyAccEvent(short pEvent
, XAccessible
* pXAcc
)
245 return pWinManager
->NotifyAccEvent(pXAcc
,pEvent
);
251 * Judge whether a XAccessible object is a container object.
252 * @param pXAcc Uno XAccessible interface of control.
253 * @return If the method is correctly processed.
255 bool AccObjectManagerAgent::IsContainer( XAccessible
* pXAcc
)
258 return pWinManager
->IsContainer(pXAcc
);
264 * Return com object interface by querying XAccessible interface.
265 * @param pXAcc Uno XAccessible interface of control.
266 * @return Com interface.
268 IMAccessible
* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible
* pXAcc
)
271 return pWinManager
->GetIMAccByXAcc(pXAcc
);
277 * Notify manger when a XAccessible object is destroying.
278 * @param pXAcc Uno XAccessible interface of control.
281 void AccObjectManagerAgent::NotifyDestroy(XAccessible
* pXAcc
)
284 pWinManager
->NotifyDestroy(pXAcc
);
288 * Return com object interface by querying child id.
289 * @param pXAcc Uno XAccessible interface of control.
290 * @return Com interface.
292 void AccObjectManagerAgent::GetIAccessibleFromResID(long childID
,IMAccessible
** pIMAcc
)
295 *pIMAcc
= pWinManager
->GetIAccessibleFromResID(childID
);
299 * Return object interface by querying interface.
300 * @param pXAcc Uno XAccessible interface of control.
301 * @return Com interface.
303 bool AccObjectManagerAgent::GetIAccessibleFromXAccessible(
304 XAccessible
* pXAcc
, IAccessible
** ppXI
)
308 *ppXI
= (IAccessible
*)pWinManager
->GetIMAccByXAcc(pXAcc
);
315 XAccessible
* AccObjectManagerAgent::GetParentXAccessible( XAccessible
* pXAcc
)
318 return pWinManager
->GetParentXAccessible( pXAcc
);
323 short AccObjectManagerAgent::GetParentRole( XAccessible
* pXAcc
)
326 return pWinManager
->GetParentRole( pXAcc
);
331 void AccObjectManagerAgent::UpdateDescription( XAccessible
* pXAcc
)
334 pWinManager
->UpdateDescription( pXAcc
);
337 void AccObjectManagerAgent::UpdateChildState(XAccessible
* pXAcc
)
340 pWinManager
->UpdateChildState( pXAcc
);
344 bool AccObjectManagerAgent::IsSpecialToolboItem(XAccessible
* pXAcc
)
347 return pWinManager
->IsSpecialToolboItem( pXAcc
);
352 short AccObjectManagerAgent::GetRole(XAccessible
* pXAcc
)
355 return pWinManager
->GetRole( pXAcc
);
360 XAccessible
* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible
* pXAcc
)
364 return pWinManager
->GetAccDocByAccTopWin( pXAcc
);
368 bool AccObjectManagerAgent::IsTopWinAcc(XAccessible
* pXAcc
)
372 return pWinManager
->IsTopWinAcc( pXAcc
);
377 bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible
* pXAcc
)
380 return pWinManager
->IsStateManageDescendant( pXAcc
);
386 * Implementation of interface XMSAAService's method getAccObjectPtr()
387 * that returns the corresponding COM interface with the MS event.
388 * @return Com interface.
390 sal_Int64
AccObjectManagerAgent::Get_ToATInterface(
391 sal_Int64 hWnd
, sal_Int64 lParam
, sal_Int64 wParam
)
393 return static_cast<sal_Int64
>(pWinManager
->Get_ToATInterface(
394 static_cast<HWND
>(reinterpret_cast<void*>(hWnd
)), lParam
, wParam
));
397 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */