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_ACCOBJECT_HXX
21 #define INCLUDED_WINACCESSIBILITY_INC_ACCOBJECT_HXX
25 #if !defined WIN32_LEAN_AND_MEAN
26 # define WIN32_LEAN_AND_MEAN
31 #include <rtl/ref.hxx>
33 #include <com/sun/star/accessibility/XAccessible.hpp>
34 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
35 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
37 #include "accHelper.hxx"
40 #pragma clang diagnostic push
41 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
45 #pragma clang diagnostic pop
48 class AccEventListener
;
49 class AccObjectManagerAgent
;
52 typedef std::map
<const long, AccObject
*> IAccSelectionList
;
53 typedef std::vector
<AccObject
*> IAccChildList
;
63 bool m_bShouldDestroy
; //avoid access COM interface when acc object is deleted
64 IMAccessible
* m_pIMAcc
;
65 AccObject
* m_pParentObj
;
66 IAccChildList m_childrenList
;
67 ::rtl::Reference
<AccEventListener
> m_pListener
;
68 IAccSelectionList m_selectionList
;
70 css::uno::Reference
< css::accessibility::XAccessible
> m_xAccRef
;
71 css::uno::Reference
< css::accessibility::XAccessibleAction
> m_xAccActionRef
;
72 css::uno::Reference
< css::accessibility::XAccessibleContext
> m_xAccContextRef
;
74 void ImplInitializeCreateObj();//create COM object
76 void UpdateActionDesc();
79 DWORD
GetMSAAStateFromUNO(short xState
);//translate state from UNO to MSAA value
80 css::accessibility::XAccessibleSelection
* GetXAccessibleSelection();
81 void GetExpandedState(sal_Bool
* isExpandable
, sal_Bool
* isExpanded
);
82 OUString
GetMAccessibleValueFromAny(css::uno::Any pAny
);
86 AccObject ( css::accessibility::XAccessible
* pXAcc
= nullptr,AccObjectManagerAgent
* pAgent
= nullptr ,AccEventListener
* accListener
=nullptr);
89 bool UpdateAccessibleInfoFromUnoToMSAA( ); //implement accessible information mapping
90 void UpdateDefaultAction();
92 IMAccessible
* GetIMAccessible(); //return COM interface in acc object
93 css::uno::Reference
<css::accessibility::XAccessible
> const& GetXAccessible();
95 void SetResID(long id
);//ResID means ChildID in MSAA
99 void SetParentHWND(HWND hWnd
);//need to set top window handle when send event to AT
100 HWND
GetParentHWND();
102 void SetListener(::rtl::Reference
<AccEventListener
> const& pListener
);
103 AccEventListener
* getListener();
105 void SetParentObj(AccObject
* pParentAccObj
);
106 AccObject
* GetParentObj();
108 void InsertChild( AccObject
* pChild
,short pos
= LAST_CHILD
);
109 void DeleteChild( AccObject
* pChild
);
110 AccObject
* NextChild();
112 void NotifyDestroy(bool ifDelete
);
113 bool ifShouldDestroy();
115 void DecreaseState(short xState
);//call COM interface DecreaseState method
116 void IncreaseState( short xState
);//call COM interface IncreaseState method
118 void SetName( css::uno::Any newName
);
119 void SetValue( css::uno::Any pAny
);
120 void SetDescription( css::uno::Any newDesc
);
121 void SetRole( short Role
);
123 short GetRole() const;
129 void UpdateDescription();
130 void UpdateValidWindow();
131 void UpdateLocation();
136 void AddSelect(long index
, AccObject
* accObj
);
137 IAccSelectionList
& GetSelection();
138 void setLocalizedResourceString();
141 #endif // INCLUDED_WINACCESSIBILITY_INC_ACCOBJECT_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */