1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
#include <map>
#include <accessibility/standard/vclxaccessibleedit.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
#include <cppuhelper/implbase3.hxx>
typedef ::cppu::ImplHelper3<
::com::sun::star::accessibility::XAccessible,
::com::sun::star::accessibility::XAccessibleValue,
::com::sun::star::accessibility::XAccessibleAction
> VCLXAccessibleBox_BASE;
/** Base class for list- and combo boxes. This class manages the box'
children. The classed derived from this one have only to implement the
<member>IsValid</member> method and return the corrent implementation name.
*/
class VCLXAccessibleBox
: public VCLXAccessibleComponent,
public VCLXAccessibleBox_BASE
{
public:
enum BoxType {COMBOBOX, LISTBOX};
/** The constructor is initialized with the box type whitch may be
either <const>COMBOBOX</const> or <const>LISTBOX</const> and a flag
indicating whether the box is a drop down box.
*/
VCLXAccessibleBox (VCLXWindow* pVCLXindow, BoxType aType, bool bIsDropDownBox);
// XTypeProvider
DECLARE_XTYPEPROVIDER()
// XInterface
DECLARE_XINTERFACE()
// XAccessible
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XAccessibleContext
/** Each object has one or two children: an optional text field and the
actual list. The text field is not provided for non drop down list
boxes.
*/
sal_Int32 SAL_CALL getAccessibleChildCount()
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/** For drop down list boxes the text field is a not editable
<type>VCLXAccessibleTextField</type>, for combo boxes it is an
editable <type>VLCAccessibleEdit</type>.
*/
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
getAccessibleChild (sal_Int32 i)
throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/** The role is always <const
scope="com::sun::star::accessibility">AccessibleRole::COMBO_BOX</const>.
*/
sal_Int16 SAL_CALL getAccessibleRole()
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
sal_Int32 SAL_CALL getAccessibleIndexInParent()
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XAccessibleAction
/** There is one action for drop down boxes and none for others.
*/
virtual sal_Int32 SAL_CALL getAccessibleActionCount()
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/** The action for drop down boxes lets the user toggle the visibility of the
popup menu.
*/
virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex)
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/** The returned string is associated with resource
<const>RID_STR_ACC_ACTION_TOGGLEPOPUP</const>.
*/
virtual OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex)
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/** No keybinding returned so far.
*/
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
getAccessibleActionKeyBinding( sal_Int32 nIndex )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XComponent
/** This method is called from the implementation helper during an
XComponent::dispose() call.
*/
virtual void SAL_CALL disposing() SAL_OVERRIDE;
//===== XAccessibleValue ================================================
virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL setCurrentValue(
const ::com::sun::star::uno::Any& aNumber )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
bool IsDropDownBox() {return m_bIsDropDownBox;};
BoxType GetBoxType() { return m_aBoxType;};
protected:
/** Specifies whether the box is a combo box or a list box. List boxes
have multi selection.
*/
BoxType m_aBoxType;
/// Specifies whether the box is a drop down box and thus has an action.
bool m_bIsDropDownBox;
/// The child that represents the text field if there is one.
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>
m_xText;
/// The child that contains the items of this box.
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>
m_xList;
/** This flag specifies whether an object has a text field as child
regardless of whether that child being currently instantiated or
not.
*/
bool m_bHasTextChild;
/** This flag specifies whether an object has a list as child regardless
of whether that child being currently instantiated or not. This
flag is always true in the current implementation because the list
child is just another wrapper around this object and thus has the
same life time.
*/
bool m_bHasListChild;
virtual ~VCLXAccessibleBox();
/** Returns </true> when the object is valid.
*/
virtual bool IsValid() const = 0;
virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent) SAL_OVERRIDE;
virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) SAL_OVERRIDE;
virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
private:
/// Index in parent. This is settable from the outside.
sal_Int32 m_nIndexInParent;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|