LibreOffice Module winaccessibility (master) 1
AccObject.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <vector>
23#include <map>
24#if !defined WIN32_LEAN_AND_MEAN
25# define WIN32_LEAN_AND_MEAN
26#endif
27#include <windows.h>
28#include <oleacc.h>
29
30#include <rtl/ref.hxx>
31
32#include <com/sun/star/accessibility/XAccessible.hpp>
33#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
34#include <com/sun/star/accessibility/XAccessibleAction.hpp>
35
36#include "accHelper.hxx"
37#include <UAccCOM.h>
38
41class AccObject;
42
43typedef std::vector<AccObject *> IAccChildList;
44
45
47{
48private:
49
50 short m_accRole;
51 long m_resID;
53 IMAccessible* const m_pIMAcc; // AccObjectManager::GetTopWindowIMAccessible relies on this being const
57
58 css::uno::Reference < css::accessibility::XAccessible > m_xAccRef;
59 css::uno::Reference < css::accessibility::XAccessibleAction > m_xAccActionRef;
60 css::uno::Reference < css::accessibility::XAccessibleContext > m_xAccContextRef;
61
62 void ImplInitializeCreateObj();//create COM object
63
64 void UpdateActionDesc();
65 void UpdateRole();
66
67 DWORD GetMSAAStateFromUNO(sal_Int64 xState);//translate state from UNO to MSAA value
68 css::accessibility::XAccessibleSelection* GetXAccessibleSelection();
69 void GetExpandedState(sal_Bool* isExpandable, sal_Bool* isExpanded);
70 OUString GetMAccessibleValueFromAny(css::uno::Any pAny);
71
72public:
73
74 AccObject ( css::accessibility::XAccessible* pXAcc = nullptr,AccObjectManagerAgent* pAgent = nullptr ,AccEventListener* accListener=nullptr);
75 virtual ~AccObject();
76
77 bool UpdateAccessibleInfoFromUnoToMSAA( ); //implement accessible information mapping
79
80 IMAccessible* GetIMAccessible(); //return COM interface in acc object
81 css::uno::Reference<css::accessibility::XAccessible> const& GetXAccessible();
82
83 void SetResID(long id);//ResID means ChildID in MSAA
84 long GetResID();
85
86
87 void SetParentHWND(HWND hWnd);//need to set top window handle when send event to AT
88 HWND GetParentHWND();
89
92
93 void SetParentObj(AccObject* pParentAccObj);
95
96 void InsertChild( AccObject* pChild,short pos = LAST_CHILD);
97 void DeleteChild( AccObject* pChild );
99
100 void NotifyDestroy();
101
102 void DecreaseState( sal_Int64 xState );//call COM interface DecreaseState method
103 void IncreaseState( sal_Int64 xState );//call COM interface IncreaseState method
104
105 void SetName( css::uno::Any newName);
106 void SetValue( css::uno::Any pAny );
107
108 short GetRole() const;
109
110 void UpdateState();
111 void UpdateName();
112 void UpdateValue();
113 void UpdateAction();
114 void UpdateValidWindow();
115
116 void setFocus();
117 void unsetFocus();
118
120};
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< AccObject * > IAccChildList
Definition: AccObject.hxx:41
@ LAST_CHILD
Definition: accHelper.hxx:27
AccEventListener is the general event listener for all controls.
void UpdateRole()
update role information from uno to com
Definition: AccObject.cxx:737
HWND GetParentHWND()
Definition: AccObject.cxx:1065
void UpdateActionDesc()
update action description desc
Definition: AccObject.cxx:699
void UpdateName()
Update name property to com object.
Definition: AccObject.cxx:266
void unsetFocus()
Unset self from focus object in parent child list.
Definition: AccObject.cxx:977
void DecreaseState(sal_Int64 xState)
Decrease state of com object.
Definition: AccObject.cxx:615
void NotifyDestroy()
Definition: AccObject.cxx:1003
void UpdateAction()
Update default action property to com object.
Definition: AccObject.cxx:292
void IncreaseState(sal_Int64 xState)
Increase state of com object.
Definition: AccObject.cxx:658
DWORD GetMSAAStateFromUNO(sal_Int64 xState)
Get MSAA state from UNO state @Role nState UNO state.
Definition: AccObject.cxx:495
::rtl::Reference< AccEventListener > m_pListener
Definition: AccObject.hxx:56
void DeleteChild(AccObject *pChild)
Delete a child element.
Definition: AccObject.cxx:227
void UpdateDefaultAction()
Set special default action description string via UNO role.
Definition: AccObject.cxx:335
HWND m_pParantID
Definition: AccObject.hxx:52
void SetParentObj(AccObject *pParentAccObj)
Definition: AccObject.cxx:1009
long m_resID
Definition: AccObject.hxx:51
void UpdateState()
update state information from uno to com
Definition: AccObject.cxx:759
virtual ~AccObject()
Destructor.
Definition: AccObject.cxx:187
AccEventListener * getListener()
Definition: AccObject.cxx:1055
void SetParentHWND(HWND hWnd)
Definition: AccObject.cxx:1043
OUString GetMAccessibleValueFromAny(css::uno::Any pAny)
Definition: AccObject.cxx:406
css::uno::Reference< css::accessibility::XAccessible > m_xAccRef
Definition: AccObject.hxx:58
void UpdateValue()
Update value property to com object.
Definition: AccObject.cxx:312
short GetRole() const
Get role property via pAny.
Definition: AccObject.cxx:485
void setFocus()
Set self to focus object in parent child list.
Definition: AccObject.cxx:961
short m_accRole
Definition: AccObject.hxx:50
bool UpdateAccessibleInfoFromUnoToMSAA()
Public method to mapping information between MSAA and UNO.
Definition: AccObject.cxx:934
AccObject * m_pParentObj
Definition: AccObject.hxx:54
IAccChildList m_childrenList
Definition: AccObject.hxx:55
AccObject(css::accessibility::XAccessible *pXAcc=nullptr, AccObjectManagerAgent *pAgent=nullptr, AccEventListener *accListener=nullptr)
Constructor.
Definition: AccObject.cxx:161
long GetResID()
Definition: AccObject.cxx:1060
void InsertChild(AccObject *pChild, short pos=LAST_CHILD)
Insert a child element.
Definition: AccObject.cxx:201
void SetValue(css::uno::Any pAny)
Set value property via pAny.
Definition: AccObject.cxx:362
AccObject * GetParentObj()
Definition: AccObject.cxx:1070
css::uno::Reference< css::accessibility::XAccessible > const & GetXAccessible()
Definition: AccObject.cxx:1038
css::uno::Reference< css::accessibility::XAccessibleAction > m_xAccActionRef
Definition: AccObject.hxx:59
css::uno::Reference< css::accessibility::XAccessibleContext > m_xAccContextRef
Definition: AccObject.hxx:60
void ImplInitializeCreateObj()
Translate all UNO basic information into MSAA com information.
Definition: AccObject.cxx:256
::rtl::Reference< AccEventListener > SetListener(::rtl::Reference< AccEventListener > const &pListener)
Definition: AccObject.cxx:1048
IMAccessible *const m_pIMAcc
Definition: AccObject.hxx:53
void setLocalizedResourceString()
void SetName(css::uno::Any newName)
Set name property via pAny.
Definition: AccObject.cxx:471
IMAccessible * GetIMAccessible()
Definition: AccObject.cxx:1033
AccObject * NextChild()
Get next child element.
Definition: AccObject.cxx:687
css::accessibility::XAccessibleSelection * GetXAccessibleSelection()
void GetExpandedState(sal_Bool *isExpandable, sal_Bool *isExpanded)
Definition: AccObject.cxx:986
void SetResID(long id)
Definition: AccObject.cxx:1026
void UpdateValidWindow()
In order to windows API WindowFromAccessibleObject, we sometimes to set a pure top window accessible ...
Definition: AccObject.cxx:245
unsigned char sal_Bool