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 
46 typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base;
47 
48 class SvxRectCtlAccessibleContext final : public ::comphelper::OAccessibleSelectionHelper,
50 {
51 public:
52  // internal
53  SvxRectCtlAccessibleContext(SvxRectCtl* pRepresentation);
54 
57 
58  // XAccessibleComponent
59  virtual void SAL_CALL grabFocus() override;
60  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override;
61 
62  // XAccessible
63  // XAccessibleContext
64  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
65  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) override;
66  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
67  virtual sal_Int16 SAL_CALL getAccessibleRole() override;
68  virtual OUString SAL_CALL getAccessibleDescription() override;
69  virtual OUString SAL_CALL getAccessibleName() override;
70  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
71  virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
72 
73  virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
74  virtual sal_Int32 SAL_CALL getForeground() override;
75  virtual sal_Int32 SAL_CALL getBackground() override;
76 
85  void selectChild( RectPoint ePoint );
86  void FireChildFocus( RectPoint eButton );
87 
88 private:
89  virtual ~SvxRectCtlAccessibleContext() override;
90 
91  // OCommonAccessibleSelection
92  // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
93  virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override;
94 
95  // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
96  virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override;
97 
98  // OCommonAccessibleComponent
99  virtual css::awt::Rectangle implGetBounds() override;
100 
101  virtual void SAL_CALL disposing() override;
102 
103  void checkChildIndex(tools::Long nIndex);
104 
113  void selectChild( tools::Long nIndexOfChild );
114 
118  OUString msDescription;
119 
122  OUString msName;
123 
126 
128  std::vector<rtl::Reference<SvxRectCtlChildAccessibleContext>> mvChildren;
129 
132 };
133 
134 typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible,
135  css::accessibility::XAccessibleValue,
136  css::accessibility::XAccessibleAction
138 
141 {
142 public:
144  const css::uno::Reference< css::accessibility::XAccessible>& rxParent,
145  const OUString& rName, const OUString& rDescription,
146  const tools::Rectangle& rBoundingBox,
147  tools::Long nIndexInParent );
148 
151 
152  // XAccessibleComponent
153  virtual void SAL_CALL grabFocus() override;
154  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
155 
156  // XAccessibleContext
157  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
158  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 nIndex ) override;
159  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
160  virtual sal_Int16 SAL_CALL getAccessibleRole() override;
161  virtual OUString SAL_CALL getAccessibleDescription() override;
162  virtual OUString SAL_CALL getAccessibleName() override;
163  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
164  virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
165 
166  virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
167 
168  virtual sal_Int32 SAL_CALL getForeground() override;
169  virtual sal_Int32 SAL_CALL getBackground() override;
170 
171  // XAccessibleValue
172  virtual css::uno::Any SAL_CALL
173  getCurrentValue() override;
174 
175  virtual sal_Bool SAL_CALL
176  setCurrentValue( const css::uno::Any& aNumber ) override;
177 
178  virtual css::uno::Any SAL_CALL
179  getMaximumValue() override;
180 
181  virtual css::uno::Any SAL_CALL
182  getMinimumValue() override;
183 
184  virtual css::uno::Any SAL_CALL
185  getMinimumIncrement() override;
186 
187  // XAccessibleAction
188  virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
189  virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
190  virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
191  virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
192 
193  // internal
195  void setStateChecked(bool bChecked);
196  void FireFocusEvent();
197 
198 private:
199  virtual ~SvxRectCtlChildAccessibleContext() override;
200 
201  virtual void SAL_CALL disposing() override;
202 
203  // OCommonAccessibleComponent
205  virtual css::awt::Rectangle implGetBounds( ) override;
206 
211  OUString msDescription;
212 
216  OUString msName;
217 
219  css::uno::Reference< css::accessibility::XAccessible >
221 
224 
227 
230 };
231 
232 
233 #endif
234 
235 /* 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
long Long
tools::Long mnIndexInParent
index of child in parent
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
virtual css::uno::Any SAL_CALL getMinimumIncrement() 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
void checkChildIndex(tools::Long nIndex)
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
RectPoint
Definition: rectenum.hxx:22
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
tools::Long mnSelectedChild
actual selected child
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
SvxRectCtlChildAccessibleContext(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, const OUString &rName, const OUString &rDescription, const tools::Rectangle &rBoundingBox, tools::Long nIndexInParent)
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
#define DECLARE_XINTERFACE()
virtual sal_Int32 SAL_CALL getAccessibleActionCount() override