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_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLEBOX_HXX
21 #define INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLEBOX_HXX
24 #include <standard/vclxaccessibleedit.hxx>
25 #include <com/sun/star/accessibility/AccessibleRole.hpp>
26 #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
27 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
28 #include <cppuhelper/implbase3.hxx>
31 typedef ::cppu::ImplHelper3
<
32 css::accessibility::XAccessible
,
33 css::accessibility::XAccessibleValue
,
34 css::accessibility::XAccessibleAction
35 > VCLXAccessibleBox_BASE
;
38 /** Base class for list- and combo boxes. This class manages the box'
39 children. The classed derived from this one have only to implement the
40 IsValid method and return the correct implementation name.
42 class VCLXAccessibleBox
43 : public VCLXAccessibleComponent
,
44 public VCLXAccessibleBox_BASE
47 enum BoxType
{COMBOBOX
, LISTBOX
};
49 /** The constructor is initialized with the box type which may be
50 either COMBOBOX or LISTBOX and a flag
51 indicating whether the box is a drop down box.
53 VCLXAccessibleBox (VCLXWindow
* pVCLXindow
, BoxType aType
, bool bIsDropDownBox
);
56 DECLARE_XTYPEPROVIDER()
64 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
65 getAccessibleContext( ) override
;
69 /** Each object has one or two children: an optional text field and the
70 actual list. The text field is not provided for non drop down list
73 sal_Int32 SAL_CALL
getAccessibleChildCount() final override
;
74 /** For drop down list boxes the text field is a not editable
75 VCLXAccessibleTextField, for combo boxes it is an
76 editable VLCAccessibleEdit.
78 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
79 getAccessibleChild (sal_Int32 i
) override
;
80 /** The role is always AccessibleRole::COMBO_BOX.
82 sal_Int16 SAL_CALL
getAccessibleRole() override
;
84 sal_Int32 SAL_CALL
getAccessibleIndexInParent() override
;
88 /** There is one action for drop down boxes and none for others.
90 virtual sal_Int32 SAL_CALL
getAccessibleActionCount() final override
;
91 /** The action for drop down boxes lets the user toggle the visibility of the
94 virtual sal_Bool SAL_CALL
doAccessibleAction (sal_Int32 nIndex
) override
;
95 /** The returned string is associated with resource
96 RID_STR_ACC_ACTION_TOGGLEPOPUP.
98 virtual OUString SAL_CALL
getAccessibleActionDescription (sal_Int32 nIndex
) override
;
99 /** No keybinding returned so far.
101 virtual css::uno::Reference
< css::accessibility::XAccessibleKeyBinding
> SAL_CALL
102 getAccessibleActionKeyBinding( sal_Int32 nIndex
) override
;
106 virtual css::uno::Any SAL_CALL
getCurrentValue( ) override
;
108 virtual sal_Bool SAL_CALL
setCurrentValue(
109 const css::uno::Any
& aNumber
) override
;
111 virtual css::uno::Any SAL_CALL
getMaximumValue( ) override
;
113 virtual css::uno::Any SAL_CALL
getMinimumValue( ) override
;
115 /** Specifies whether the box is a combo box or a list box. List boxes
116 have multi selection.
120 /// Specifies whether the box is a drop down box and thus has an action.
121 bool m_bIsDropDownBox
;
123 /// The child that represents the text field if there is one.
124 css::uno::Reference
< css::accessibility::XAccessible
>
127 /// The child that contains the items of this box.
128 css::uno::Reference
< css::accessibility::XAccessible
>
131 /** This flag specifies whether an object has a text field as child
132 regardless of whether that child being currently instantiated or
135 bool m_bHasTextChild
;
137 /** This flag specifies whether an object has a list as child regardless
138 of whether that child being currently instantiated or not. This
139 flag is always true in the current implementation because the list
140 child is just another wrapper around this object and thus has the
143 bool m_bHasListChild
;
145 virtual ~VCLXAccessibleBox() override
= default;
147 /** Returns true when the object is valid.
149 virtual bool IsValid() const = 0;
151 virtual void ProcessWindowChildEvent (const VclWindowEvent
& rVclWindowEvent
) override
;
152 virtual void ProcessWindowEvent (const VclWindowEvent
& rVclWindowEvent
) override
;
154 virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper
& rStateSet
) override
;
156 sal_Int32
implGetAccessibleChildCount();
159 /// Index in parent. This is settable from the outside.
160 sal_Int32 m_nIndexInParent
;
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */