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
);
101 * When a new UNO XAccessible object is found by listener, we create a corresponding
102 * com object and insert it to our manager list.
103 * @param pXAcc Uno XAccessible interface of control.
104 * @param pWnd The top window handle containing control.
105 * @return If the method is correctly processed.
107 bool AccObjectManagerAgent::InsertAccObj(
108 XAccessible
* pXAcc
, XAccessible
* pParentXAcc
, HWND hWnd
)
111 return pWinManager
->InsertAccObj(pXAcc
, pParentXAcc
, hWnd
);
117 * save the pair <topwindowhandle, XAccessible>
118 * @param hWnd, top window handle
119 * @param pXAcc XAccessible interface for top window
123 AccObjectManagerAgent::SaveTopWindowHandle(HWND hWnd
, XAccessible
* pXAcc
)
126 pWinManager
->SaveTopWindowHandle(hWnd
, pXAcc
);
131 * When a UNO XAccessible object's new children are found by listener, we create
132 * corresponding com objects and insert them 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.
138 AccObjectManagerAgent::InsertChildrenAccObj(XAccessible
* pXAcc
, HWND hWnd
)
141 return pWinManager
->InsertChildrenAccObj(pXAcc
, hWnd
);
147 * When a new UNO XAccessible object is destroyed, we delete its corresponding
148 * com object and remove it from our manager list.
149 * @param pXAcc Uno XAccessible interface of control.
152 void AccObjectManagerAgent::DeleteAccObj( XAccessible
* pXAcc
)
155 pWinManager
->DeleteAccObj( pXAcc
);
159 * When new UNO children XAccessible objects are destroyed, we delete their
160 * corresponding com objects and remove them from our manager list.
161 * @param pXAcc Uno XAccessible interface of control.
164 void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible
* pXAcc
)
167 pWinManager
->DeleteChildrenAccObj( pXAcc
);
171 * Interface of decreasing MSAA state when some UNO state is decreased.
172 * @param pXAcc Uno XAccessible interface of control.
173 * @param pState The lost state of control.
176 void AccObjectManagerAgent::DecreaseState( XAccessible
* pXAcc
, sal_Int64 pState
)
180 pWinManager
->DecreaseState( pXAcc
, pState
);
185 * Interface of increasing MSAA name when some UNO state is increased.
186 * @param pXAcc Uno XAccessible interface of control.
187 * @param pState The new state of control.
190 void AccObjectManagerAgent::IncreaseState( XAccessible
* pXAcc
, sal_Int64 pState
)
194 pWinManager
->IncreaseState( pXAcc
, pState
);
198 void AccObjectManagerAgent::UpdateState( css::accessibility::XAccessible
* pXAcc
)
201 pWinManager
->UpdateState(pXAcc
);
205 * Interface of notify MSAA event when some UNO event occurred.
206 * @param pXAcc Uno XAccessible interface of control.
207 * @param eEvent event type.
208 * @return If the method is correctly processed.
210 bool AccObjectManagerAgent::NotifyAccEvent(UnoMSAAEvent eEvent
, XAccessible
* pXAcc
)
213 return pWinManager
->NotifyAccEvent(pXAcc
, eEvent
);
219 * Judge whether a XAccessible object is a container object.
220 * @param pXAcc Uno XAccessible interface of control.
221 * @return If the method is correctly processed.
223 bool AccObjectManagerAgent::IsContainer( XAccessible
* pXAcc
)
226 return AccObjectWinManager::IsContainer(pXAcc
);
232 * Return com object interface by querying XAccessible interface.
233 * @param pXAcc Uno XAccessible interface of control.
234 * @return Com interface.
236 IMAccessible
* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible
* pXAcc
)
239 return pWinManager
->GetIMAccByXAcc(pXAcc
);
245 * Notify manager when a XAccessible object is destroying.
246 * @param pXAcc Uno XAccessible interface of control.
249 void AccObjectManagerAgent::NotifyDestroy(XAccessible
* pXAcc
)
252 pWinManager
->NotifyDestroy(pXAcc
);
256 * Return com object interface by querying child id.
257 * @param pXAcc Uno XAccessible interface of control.
258 * @return Com interface.
260 void AccObjectManagerAgent::GetIAccessibleFromResID(long childID
,IMAccessible
** pIMAcc
)
263 *pIMAcc
= pWinManager
->GetIAccessibleFromResID(childID
);
267 * Return object interface by querying interface.
268 * @param pXAcc Uno XAccessible interface of control.
269 * @return Com interface.
271 bool AccObjectManagerAgent::GetIAccessibleFromXAccessible(
272 XAccessible
* pXAcc
, IAccessible
** ppXI
)
276 *ppXI
= pWinManager
->GetIMAccByXAcc(pXAcc
);
283 XAccessible
* AccObjectManagerAgent::GetParentXAccessible( XAccessible
* pXAcc
)
286 return pWinManager
->GetParentXAccessible( pXAcc
);
291 short AccObjectManagerAgent::GetParentRole( XAccessible
* pXAcc
)
294 return pWinManager
->GetParentRole( pXAcc
);
299 void AccObjectManagerAgent::UpdateChildState(XAccessible
* pXAcc
)
302 pWinManager
->UpdateChildState( pXAcc
);
306 bool AccObjectManagerAgent::IsSpecialToolbarItem(XAccessible
* pXAcc
)
309 return pWinManager
->IsSpecialToolbarItem(pXAcc
);
314 short AccObjectManagerAgent::GetRole(XAccessible
* pXAcc
)
317 return AccObjectWinManager::GetRole( pXAcc
);
322 XAccessible
* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible
* pXAcc
)
326 return pWinManager
->GetAccDocByAccTopWin( pXAcc
);
330 bool AccObjectManagerAgent::IsTopWinAcc(XAccessible
* pXAcc
)
334 return pWinManager
->IsTopWinAcc( pXAcc
);
339 bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible
* pXAcc
)
342 return AccObjectWinManager::IsStateManageDescendant( pXAcc
);
348 * Implementation of interface XMSAAService's method getAccObjectPtr()
349 * that returns the corresponding COM interface with the MS event.
350 * @return Com interface.
352 sal_Int64
AccObjectManagerAgent::Get_ToATInterface(
353 sal_Int64 hWnd
, sal_Int64 lParam
, sal_Int64 wParam
)
355 return static_cast<sal_Int64
>(pWinManager
->Get_ToATInterface(
356 static_cast<HWND
>(reinterpret_cast<void*>(hWnd
)), lParam
, wParam
));
359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */