Bump version to 6.4-15
[LibreOffice.git] / svx / source / inc / svxrectctaccessiblecontext.hxx
blob7dbbd48327e78fee54ce4391678eeb36b261fe03
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 .
21 #ifndef INCLUDED_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX
22 #define INCLUDED_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX
24 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
26 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
27 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
28 #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
29 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
30 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
31 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
32 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <cppuhelper/weak.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XTypeProvider.hpp>
37 #include <com/sun/star/lang/XServiceName.hpp>
38 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
39 #include <com/sun/star/lang/DisposedException.hpp>
40 #include <osl/mutex.hxx>
41 #include <cppuhelper/interfacecontainer.h>
42 #include <cppuhelper/compbase6.hxx>
43 #include <cppuhelper/compbase7.hxx>
44 #include <cppuhelper/compbase3.hxx>
45 #include <cppuhelper/basemutex.hxx>
46 #include <comphelper/accessibleselectionhelper.hxx>
47 #include <svx/rectenum.hxx>
48 #include <vcl/vclptr.hxx>
49 #include <tools/gen.hxx>
50 #include <vector>
52 namespace com { namespace sun { namespace star { namespace awt {
53 struct Point;
54 struct Rectangle;
55 struct Size;
56 class XFocusListener;
57 } } } }
59 namespace tools { class Rectangle; }
60 class SvxRectCtl;
61 class SvxRectCtlChildAccessibleContext;
62 namespace vcl { class Window; }
64 typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base;
66 class SvxRectCtlAccessibleContext final : public ::comphelper::OAccessibleSelectionHelper,
67 public OAccessibleHelper_Base
69 public:
70 // internal
71 SvxRectCtlAccessibleContext(SvxRectCtl* pRepresentation);
73 DECLARE_XINTERFACE( )
74 DECLARE_XTYPEPROVIDER( )
76 // XAccessibleComponent
77 virtual void SAL_CALL grabFocus() override;
78 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override;
80 // XAccessible
81 // XAccessibleContext
82 virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
83 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) override;
84 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
85 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
86 virtual OUString SAL_CALL getAccessibleDescription() override;
87 virtual OUString SAL_CALL getAccessibleName() override;
88 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
89 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
91 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
92 virtual sal_Int32 SAL_CALL getForeground() override;
93 virtual sal_Int32 SAL_CALL getBackground() override;
95 /** Selects a new child by point.
97 <p>If the child was not selected before, the state of the child will
98 be updated. If the point is not invalid, the index will internally set to NOCHILDSELECTED</p>
100 @param eButton
101 Button which belongs to the child which should be selected.
103 void selectChild( RectPoint ePoint );
104 void FireChildFocus( RectPoint eButton );
106 private:
107 virtual ~SvxRectCtlAccessibleContext() override;
109 // OCommonAccessibleSelection
110 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
111 virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override;
113 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
114 virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override;
116 // OCommonAccessibleComponent
117 virtual css::awt::Rectangle implGetBounds() override;
119 virtual void SAL_CALL disposing() override;
121 void checkChildIndex(long nIndex);
123 /** Selects a new child by index.
125 <p>If the child was not selected before, the state of the child will
126 be updated. If the index is invalid, the index will internally set to NOCHILDSELECTED</p>
128 @param nIndexOfChild
129 Index of the new child which should be selected.
131 void selectChild( long nIndexOfChild );
133 /** Description of this object. This is not a constant because it can
134 be set from the outside.
136 OUString msDescription;
138 /** Name of this object.
140 OUString msName;
142 /// pointer to internal representation
143 SvxRectCtl* mpRepr;
145 /// array for all possible children
146 std::vector<rtl::Reference<SvxRectCtlChildAccessibleContext>> mvChildren;
148 /// actual selected child
149 long mnSelectedChild;
152 typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible,
153 css::accessibility::XAccessibleValue,
154 css::accessibility::XAccessibleAction
155 > OAccessibleHelper_Base_3;
157 class SvxRectCtlChildAccessibleContext final : public ::comphelper::OAccessibleComponentHelper,
158 public OAccessibleHelper_Base_3
160 public:
161 SvxRectCtlChildAccessibleContext(
162 const css::uno::Reference< css::accessibility::XAccessible>& rxParent,
163 const OUString& rName, const OUString& rDescription,
164 const tools::Rectangle& rBoundingBox,
165 long nIndexInParent );
167 DECLARE_XINTERFACE( )
168 DECLARE_XTYPEPROVIDER( )
170 // XAccessibleComponent
171 virtual void SAL_CALL grabFocus() override;
172 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
174 // XAccessibleContext
175 virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
176 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 nIndex ) override;
177 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
178 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
179 virtual OUString SAL_CALL getAccessibleDescription() override;
180 virtual OUString SAL_CALL getAccessibleName() override;
181 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
182 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
184 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
186 virtual sal_Int32 SAL_CALL getForeground() override;
187 virtual sal_Int32 SAL_CALL getBackground() override;
189 // XAccessibleValue
190 virtual css::uno::Any SAL_CALL
191 getCurrentValue() override;
193 virtual sal_Bool SAL_CALL
194 setCurrentValue( const css::uno::Any& aNumber ) override;
196 virtual css::uno::Any SAL_CALL
197 getMaximumValue() override;
199 virtual css::uno::Any SAL_CALL
200 getMinimumValue() override;
202 // XAccessibleAction
203 virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
204 virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
205 virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
206 virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
208 // internal
209 /// Sets the checked status
210 void setStateChecked(bool bChecked);
211 void FireFocusEvent();
213 private:
214 virtual ~SvxRectCtlChildAccessibleContext() override;
216 virtual void SAL_CALL disposing() override;
218 // OCommonAccessibleComponent
219 /// implements the calculation of the bounding rectangle
220 virtual css::awt::Rectangle implGetBounds( ) override;
222 /** Description of this object. This is not a constant because it can
223 be set from the outside. Furthermore, it changes according to the
224 draw page's display mode.
226 OUString const msDescription;
228 /** Name of this object. It changes according the draw page's
229 display mode.
231 OUString const msName;
233 /// Reference to the parent object.
234 css::uno::Reference< css::accessibility::XAccessible >
235 mxParent;
237 /// Bounding box
238 tools::Rectangle const maBoundingBox;
240 /// index of child in parent
241 long const mnIndexInParent;
243 /// Indicates, if object is checked
244 bool mbIsChecked;
248 #endif
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */