tdf#154285 Check correct number of arguments to SbRtl_Now function
[LibreOffice.git] / vcl / inc / accessibility / vclxaccessiblebox.hxx
blobe5b360ecc9aeb1b57a3c9ef24cc9e88fa7340705
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
24 #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
25 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <vcl/accessibility/vclxaccessiblecomponent.hxx>
28 #include <vcl/toolkit/lstbox.hxx>
30 class VCLXAccessibleList;
32 /** Base class for list- and combo boxes. This class manages the box'
33 children. The classed derived from this one have only to implement the
34 IsValid method and return the correct implementation name.
36 class VCLXAccessibleBox
37 : public cppu::ImplInheritanceHelper<
38 VCLXAccessibleComponent,
39 css::accessibility::XAccessible,
40 css::accessibility::XAccessibleValue,
41 css::accessibility::XAccessibleAction>
43 public:
44 enum BoxType {COMBOBOX, LISTBOX};
46 /** The constructor is initialized with the box type which may be
47 either COMBOBOX or LISTBOX and a flag
48 indicating whether the box is a drop down box.
50 VCLXAccessibleBox(vcl::Window* pBox, BoxType aType, bool bIsDropDownBox);
53 // XAccessible
55 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL
56 getAccessibleContext( ) override;
58 // XAccessibleContext
60 /** Each object has one or two children: an optional text field and the
61 actual list. The text field is not provided for non drop down list
62 boxes.
64 sal_Int64 SAL_CALL getAccessibleChildCount() final override;
65 /** For drop down list boxes the text field is a not editable
66 VCLXAccessibleTextField, for combo boxes it is an
67 editable VCLXAccessibleEdit.
69 css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
70 getAccessibleChild (sal_Int64 i) override;
72 sal_Int16 SAL_CALL getAccessibleRole() override;
74 // XAccessibleAction
76 /** There is one action for drop down boxes and none for others.
78 virtual sal_Int32 SAL_CALL getAccessibleActionCount() final override;
79 /** The action for drop down boxes lets the user toggle the visibility of the
80 popup menu.
82 virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex) override;
83 /** The returned string is associated with resource
84 RID_STR_ACC_ACTION_TOGGLEPOPUP.
86 virtual OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex) override;
87 /** No keybinding returned so far.
89 virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL
90 getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
92 // XAccessibleValue
94 virtual css::uno::Any SAL_CALL getCurrentValue( ) override;
96 virtual sal_Bool SAL_CALL setCurrentValue(
97 const css::uno::Any& aNumber ) override;
99 virtual css::uno::Any SAL_CALL getMaximumValue( ) override;
101 virtual css::uno::Any SAL_CALL getMinimumValue( ) override;
103 virtual css::uno::Any SAL_CALL getMinimumIncrement( ) override;
105 protected:
106 virtual ~VCLXAccessibleBox() override;
108 /** Returns true when the object is valid.
110 bool IsValid() const;
112 virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent) override;
113 virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) override;
115 virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override;
117 sal_Int64 implGetAccessibleChildCount();
119 private:
120 /** Specifies whether the box is a combo box or a list box. List boxes
121 have multi selection.
123 BoxType m_aBoxType;
125 /// Specifies whether the box is a drop down box and thus has an action.
126 bool m_bIsDropDownBox;
128 /// The child that represents the text field if there is one.
129 css::uno::Reference< css::accessibility::XAccessible>
130 m_xText;
132 /// The child that contains the items of this box.
133 rtl::Reference<VCLXAccessibleList> m_xList;
135 /** This flag specifies whether an object has a text field as child
136 regardless of whether that child being currently instantiated or
137 not.
139 bool m_bHasTextChild;
141 /** This flag specifies whether an object has a list as child regardless
142 of whether that child being currently instantiated or not. This
143 flag is always true in the current implementation because the list
144 child is just another wrapper around this object and thus has the
145 same life time.
147 bool m_bHasListChild;
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */