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>
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
29 #pragma clang diagnostic pop
32 using namespace com::sun::star::uno
;
33 using namespace com::sun::star::accessibility
;
36 * Construction/Destruction.
40 AccObjectManagerAgent::AccObjectManagerAgent()
41 : pWinManager(new AccObjectWinManager(this))
45 AccObjectManagerAgent::~AccObjectManagerAgent()
50 * Interface of updating MSAA name when UNO name_changed event occurs.
51 * @param pXAcc Uno XAccessible interface of control.
54 void AccObjectManagerAgent::UpdateAccName( XAccessible
* pXAcc
)
57 pWinManager
->UpdateAccName( pXAcc
);
61 * Interface of updating MSAA name when UNO action changed event occurs.
62 * @param pXAcc Uno XAccessible interface of control.
65 void AccObjectManagerAgent::UpdateAction( XAccessible
* pXAcc
)
68 pWinManager
->UpdateAction( pXAcc
);
72 * Interface of updating MSAA value when UNO value_changed event occurs.
73 * @param pXAcc Uno XAccessible interface of control.
74 * @param pAny New value.
77 void AccObjectManagerAgent::UpdateValue( XAccessible
* pXAcc
, Any pAny
)
80 pWinManager
->SetValue( pXAcc
, pAny
);
84 * Interface of updating MSAA value when UNO value_changed event occurs. If we can not
85 * find new value, we'll get new value from pXAcc to update com value.
86 * @param pXAcc Uno XAccessible interface of control.
89 void AccObjectManagerAgent::UpdateValue( XAccessible
* pXAcc
)
92 pWinManager
->UpdateValue( pXAcc
);
96 * Interface of updating MSAA name when UNO name_changed event occurs.
97 * @param pXAcc Uno XAccessible interface of control.
98 * @param newName New UNO accessible name.
101 void AccObjectManagerAgent::UpdateAccName( XAccessible
* pXAcc
, Any newName
)
104 pWinManager
->SetAccName( pXAcc
, newName
);
109 * Interface of updating MSAA location when UNO location_changed event occurs.
110 * @param pXAcc Uno XAccessible interface of control.
111 * @param pXAcc Uno The top position of new location.
112 * @param pXAcc Uno The left position of new location.
113 * @param pXAcc Uno The width of new location.
114 * @param pXAcc Uno The width of new location.
117 void AccObjectManagerAgent::UpdateLocation( XAccessible
* /* pXAcc */, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
121 pWinManager
->SetLocation( pXAcc
, top
, left
, width
, height
);
126 * Interface of updating MSAA name when UNO description_changed event occurs.
127 * @param pXAcc Uno XAccessible interface of control.
128 * @param newDesc New UNO accessible description.
131 void AccObjectManagerAgent::UpdateDescription( XAccessible
* pXAcc
, Any newDesc
)
134 pWinManager
->SetDescription( pXAcc
, newDesc
);
138 * When a new UNO XAccessible object is found by listener, we create a corresponding
139 * com object and insert it to our manager list.
140 * @param pXAcc Uno XAccessible interface of control.
141 * @param pWnd The top window handle containing control.
142 * @return If the method is correctly processed.
144 bool AccObjectManagerAgent::InsertAccObj(
145 XAccessible
* pXAcc
, XAccessible
* pParentXAcc
, sal_Int64 nWnd
)
148 return pWinManager
->InsertAccObj(pXAcc
, pParentXAcc
,
149 static_cast<HWND
>(reinterpret_cast<void*>(nWnd
)));
155 * save the pair <topwindowhandle, XAccessible>
156 * @param hWnd, top window handle
157 * @param pXAcc XAccessible interface for top window
161 AccObjectManagerAgent::SaveTopWindowHandle(sal_Int64 hWnd
, XAccessible
* pXAcc
)
164 pWinManager
->SaveTopWindowHandle(
165 static_cast<HWND
>(reinterpret_cast<void*>(hWnd
)), pXAcc
);
170 * When a UNO XAccessible object's new children are found by listener, we create
171 * corresponding com objects and insert them to our manager list.
172 * @param pXAcc Uno XAccessible interface of control.
173 * @param pWnd The top window handle containing control.
174 * @return If the method is correctly processed.
177 AccObjectManagerAgent::InsertChildrenAccObj(XAccessible
* pXAcc
, sal_Int64 pWnd
)
180 return pWinManager
->InsertChildrenAccObj( pXAcc
, HWND(reinterpret_cast<void*>(pWnd
)) );
186 * When a new UNO XAccessible object is destroyed, we delete its corresponding
187 * com object and remove it from our manager list.
188 * @param pXAcc Uno XAccessible interface of control.
191 void AccObjectManagerAgent::DeleteAccObj( XAccessible
* pXAcc
)
194 pWinManager
->DeleteAccObj( pXAcc
);
198 * When new UNO children XAccessible objects are destroyed, we delete their
199 * corresponding com objects and remove them from our manager list.
200 * @param pXAcc Uno XAccessible interface of control.
203 void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible
* pXAcc
)
206 pWinManager
->DeleteChildrenAccObj( pXAcc
);
210 * Interface of decreasing MSAA state when some UNO state is decreased.
211 * @param pXAcc Uno XAccessible interface of control.
212 * @param pState The lost state of control.
215 void AccObjectManagerAgent::DecreaseState( XAccessible
* pXAcc
,unsigned short pState
)
219 pWinManager
->DecreaseState( pXAcc
, pState
);
224 * Interface of increasing MSAA name when some UNO state is increased.
225 * @param pXAcc Uno XAccessible interface of control.
226 * @param pState The new state of control.
229 void AccObjectManagerAgent::IncreaseState( XAccessible
* pXAcc
,unsigned short pState
)
233 pWinManager
->IncreaseState( pXAcc
, pState
);
237 void AccObjectManagerAgent::UpdateState( css::accessibility::XAccessible
* pXAcc
)
240 pWinManager
->UpdateState(pXAcc
);
244 * Interface of notify MSAA event when some UNO event occurred.
245 * @param pXAcc Uno XAccessible interface of control.
246 * @param pEvent UNO event ID.
247 * @return If the method is correctly processed.
249 bool AccObjectManagerAgent::NotifyAccEvent(short pEvent
, XAccessible
* pXAcc
)
252 return pWinManager
->NotifyAccEvent(pXAcc
,pEvent
);
258 * Judge whether a XAccessible object is a container object.
259 * @param pXAcc Uno XAccessible interface of control.
260 * @return If the method is correctly processed.
262 bool AccObjectManagerAgent::IsContainer( XAccessible
* pXAcc
)
265 return AccObjectWinManager::IsContainer(pXAcc
);
271 * Return com object interface by querying XAccessible interface.
272 * @param pXAcc Uno XAccessible interface of control.
273 * @return Com interface.
275 IMAccessible
* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible
* pXAcc
)
278 return pWinManager
->GetIMAccByXAcc(pXAcc
);
284 * Notify manager when a XAccessible object is destroying.
285 * @param pXAcc Uno XAccessible interface of control.
288 void AccObjectManagerAgent::NotifyDestroy(XAccessible
* pXAcc
)
291 pWinManager
->NotifyDestroy(pXAcc
);
295 * Return com object interface by querying child id.
296 * @param pXAcc Uno XAccessible interface of control.
297 * @return Com interface.
299 void AccObjectManagerAgent::GetIAccessibleFromResID(long childID
,IMAccessible
** pIMAcc
)
302 *pIMAcc
= pWinManager
->GetIAccessibleFromResID(childID
);
306 * Return object interface by querying interface.
307 * @param pXAcc Uno XAccessible interface of control.
308 * @return Com interface.
310 bool AccObjectManagerAgent::GetIAccessibleFromXAccessible(
311 XAccessible
* pXAcc
, IAccessible
** ppXI
)
315 *ppXI
= reinterpret_cast<IAccessible
*>(pWinManager
->GetIMAccByXAcc(pXAcc
));
322 XAccessible
* AccObjectManagerAgent::GetParentXAccessible( XAccessible
* pXAcc
)
325 return pWinManager
->GetParentXAccessible( pXAcc
);
330 short AccObjectManagerAgent::GetParentRole( XAccessible
* pXAcc
)
333 return pWinManager
->GetParentRole( pXAcc
);
338 void AccObjectManagerAgent::UpdateDescription( XAccessible
* pXAcc
)
341 pWinManager
->UpdateDescription( pXAcc
);
344 void AccObjectManagerAgent::UpdateChildState(XAccessible
* pXAcc
)
347 pWinManager
->UpdateChildState( pXAcc
);
351 bool AccObjectManagerAgent::IsSpecialToolboItem(XAccessible
* pXAcc
)
354 return pWinManager
->IsSpecialToolboItem( pXAcc
);
359 short AccObjectManagerAgent::GetRole(XAccessible
* pXAcc
)
362 return AccObjectWinManager::GetRole( pXAcc
);
367 XAccessible
* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible
* pXAcc
)
371 return pWinManager
->GetAccDocByAccTopWin( pXAcc
);
375 bool AccObjectManagerAgent::IsTopWinAcc(XAccessible
* pXAcc
)
379 return pWinManager
->IsTopWinAcc( pXAcc
);
384 bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible
* pXAcc
)
387 return AccObjectWinManager::IsStateManageDescendant( pXAcc
);
393 * Implementation of interface XMSAAService's method getAccObjectPtr()
394 * that returns the corresponding COM interface with the MS event.
395 * @return Com interface.
397 sal_Int64
AccObjectManagerAgent::Get_ToATInterface(
398 sal_Int64 hWnd
, sal_Int64 lParam
, sal_Int64 wParam
)
400 return static_cast<sal_Int64
>(pWinManager
->Get_ToATInterface(
401 static_cast<HWND
>(reinterpret_cast<void*>(hWnd
)), lParam
, wParam
));
404 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */