LibreOffice Module svx (master)  1
svxrectctaccessiblecontext.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #ifndef INCLUDED_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX
22 #define INCLUDED_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX
23 
24 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
27 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <cppuhelper/implbase3.hxx>
31 #include <rtl/ref.hxx>
32 #include <svx/rectenum.hxx>
33 #include <tools/gen.hxx>
34 #include <vector>
35 
36 namespace com::sun::star::awt {
37  struct Point;
38  struct Rectangle;
39  struct Size;
40  class XFocusListener;
41 }
42 namespace tools { class Rectangle; }
43 class SvxRectCtl;
45 namespace vcl { class Window; }
46 
47 typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base;
48 
49 class SvxRectCtlAccessibleContext final : public ::comphelper::OAccessibleSelectionHelper,
51 {
52 public:
53  // internal
54  SvxRectCtlAccessibleContext(SvxRectCtl* pRepresentation);
55 
58 
59  // XAccessibleComponent
60  virtual void SAL_CALL grabFocus() override;
61  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override;
62 
63  // XAccessible
64  // XAccessibleContext
65  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
66  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) override;
67  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
68  virtual sal_Int16 SAL_CALL getAccessibleRole() override;
69  virtual OUString SAL_CALL getAccessibleDescription() override;
70  virtual OUString SAL_CALL getAccessibleName() override;
71  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
72  virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
73 
74  virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
75  virtual sal_Int32 SAL_CALL getForeground() override;
76  virtual sal_Int32 SAL_CALL getBackground() override;
77 
86  void selectChild( RectPoint ePoint );
87  void FireChildFocus( RectPoint eButton );
88 
89 private:
90  virtual ~SvxRectCtlAccessibleContext() override;
91 
92  // OCommonAccessibleSelection
93  // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
94  virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override;
95 
96  // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
97  virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override;
98 
99  // OCommonAccessibleComponent
100  virtual css::awt::Rectangle implGetBounds() override;
101 
102  virtual void SAL_CALL disposing() override;
103 
104  void checkChildIndex(long nIndex);
105 
114  void selectChild( long nIndexOfChild );
115 
119  OUString msDescription;
120 
123  OUString msName;
124 
127 
129  std::vector<rtl::Reference<SvxRectCtlChildAccessibleContext>> mvChildren;
130 
133 };
134 
135 typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible,
136  css::accessibility::XAccessibleValue,
137  css::accessibility::XAccessibleAction
139 
142 {
143 public:
145  const css::uno::Reference< css::accessibility::XAccessible>& rxParent,
146  const OUString& rName, const OUString& rDescription,
147  const tools::Rectangle& rBoundingBox,
148  long nIndexInParent );
149 
152 
153  // XAccessibleComponent
154  virtual void SAL_CALL grabFocus() override;
155  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
156 
157  // XAccessibleContext
158  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
159  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 nIndex ) override;
160  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
161  virtual sal_Int16 SAL_CALL getAccessibleRole() override;
162  virtual OUString SAL_CALL getAccessibleDescription() override;
163  virtual OUString SAL_CALL getAccessibleName() override;
164  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
165  virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
166 
167  virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
168 
169  virtual sal_Int32 SAL_CALL getForeground() override;
170  virtual sal_Int32 SAL_CALL getBackground() override;
171 
172  // XAccessibleValue
173  virtual css::uno::Any SAL_CALL
174  getCurrentValue() override;
175 
176  virtual sal_Bool SAL_CALL
177  setCurrentValue( const css::uno::Any& aNumber ) override;
178 
179  virtual css::uno::Any SAL_CALL
180  getMaximumValue() override;
181 
182  virtual css::uno::Any SAL_CALL
183  getMinimumValue() override;
184 
185  // XAccessibleAction
186  virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
187  virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
188  virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
189  virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
190 
191  // internal
193  void setStateChecked(bool bChecked);
194  void FireFocusEvent();
195 
196 private:
197  virtual ~SvxRectCtlChildAccessibleContext() override;
198 
199  virtual void SAL_CALL disposing() override;
200 
201  // OCommonAccessibleComponent
203  virtual css::awt::Rectangle implGetBounds( ) override;
204 
209  OUString msDescription;
210 
214  OUString msName;
215 
217  css::uno::Reference< css::accessibility::XAccessible >
219 
222 
225 
228 };
229 
230 
231 #endif
232 
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nIndex
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
OUString msName
Name of this object.
OUString msDescription
Description of this object.
virtual OUString SAL_CALL getAccessibleName() override
virtual sal_Bool SAL_CALL setCurrentValue(const css::uno::Any &aNumber) override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
virtual css::uno::Any SAL_CALL getMinimumValue() override
virtual void SAL_CALL disposing() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override
OUString msDescription
Description of this object.
virtual sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override
SvxRectCtlChildAccessibleContext(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, const OUString &rName, const OUString &rDescription, const tools::Rectangle &rBoundingBox, long nIndexInParent)
virtual sal_Int32 SAL_CALL getForeground() override
virtual OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual css::uno::Any SAL_CALL getCurrentValue() override
::cppu::ImplHelper3< css::accessibility::XAccessible, css::accessibility::XAccessibleValue, css::accessibility::XAccessibleAction > OAccessibleHelper_Base_3
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
std::vector< rtl::Reference< SvxRectCtlChildAccessibleContext > > mvChildren
array for all possible children
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
virtual void SAL_CALL grabFocus() override
virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override
long mnSelectedChild
actual selected child
RectPoint
Definition: rectenum.hxx:22
long mnIndexInParent
index of child in parent
virtual void SAL_CALL disposing() override
virtual css::uno::Any SAL_CALL getMaximumValue() override
#define DECLARE_XTYPEPROVIDER()
virtual void SAL_CALL grabFocus() override
unsigned char sal_Bool
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return empty reference to indicate that the relation set is not supported.
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
SvxRectCtlAccessibleContext(SvxRectCtl *pRepresentation)
void selectChild(RectPoint ePoint)
Selects a new child by point.
bool mbIsChecked
Indicates, if object is checked.
virtual css::awt::Rectangle implGetBounds() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
::cppu::ImplHelper1< css::accessibility::XAccessible > OAccessibleHelper_Base
css::uno::Reference< css::accessibility::XAccessible > mxParent
Reference to the parent object.
SvxRectCtl * mpRepr
pointer to internal representation
virtual OUString SAL_CALL getAccessibleName() override
virtual sal_Int32 SAL_CALL getForeground() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual sal_Int32 SAL_CALL getBackground() override
tools::Rectangle maBoundingBox
Bounding box.
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return empty reference to indicate that the relation set is not supported.
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::awt::Rectangle implGetBounds() override
implements the calculation of the bounding rectangle
void setStateChecked(bool bChecked)
Sets the checked status.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
#define DECLARE_XINTERFACE()
virtual sal_Int32 SAL_CALL getAccessibleActionCount() override