1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24
25 #ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
26 #define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
27
28 #include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx"
29 #include <cppuhelper/implbase1.hxx>
30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31
32 // ============================================================================
33
34 namespace accessibility {
35
36 // ============================================================================
37
38 typedef ::cppu::ImplHelper1<
39 ::com::sun::star::accessibility::XAccessibleSelection >
40 AccessibleBrowseBoxHeaderBarImplHelper;
41
42 /** This class represents the accessible object of a header bar of a BrowseBox
43 control (row or column header bar). This object supports the
44 XAccessibleSelection interface. Selecting a child of this object selects
45 complete rows or columns of the data table. */
46 class AccessibleBrowseBoxHeaderBar :
47 public AccessibleBrowseBoxTableBase,
48 public AccessibleBrowseBoxHeaderBarImplHelper
49 {
50 public:
51 /** @param eObjType One of the two allowed types BBTYPE_ROWHEADERBAR or
52 BBTYPE_COLUMNHEADERBAR. */
53 AccessibleBrowseBoxHeaderBar(
54 const ::com::sun::star::uno::Reference<
55 ::com::sun::star::accessibility::XAccessible >& rxParent,
56 ::svt::IAccessibleTableProvider& rBrowseBox,
57 ::svt::AccessibleBrowseBoxObjType eObjType );
58
59 protected:
60 virtual ~AccessibleBrowseBoxHeaderBar();
61
62 public:
63 // XAccessibleContext -----------------------------------------------------
64
65 /** @return
66 The XAccessible interface of the specified child.
67 */
68 virtual ::com::sun::star::uno::Reference<
69 ::com::sun::star::accessibility::XAccessible > SAL_CALL
70 getAccessibleChild( sal_Int32 nChildIndex )
71 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
72 ::com::sun::star::uno::RuntimeException );
73
74 /** @return The index of this object among the parent's children. */
75 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
76 throw ( ::com::sun::star::uno::RuntimeException );
77
78 // XAccessibleComponent ---------------------------------------------------
79
80 /** @return The accessible child rendered under the given point. */
81 virtual ::com::sun::star::uno::Reference<
82 ::com::sun::star::accessibility::XAccessible > SAL_CALL
83 getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
84 throw ( ::com::sun::star::uno::RuntimeException );
85
86 /** Grabs the focus to (the current cell of) the data table. */
87 virtual void SAL_CALL grabFocus()
88 throw ( ::com::sun::star::uno::RuntimeException );
89
90 /** @return The key bindings associated with this object. */
91 virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
92 throw ( ::com::sun::star::uno::RuntimeException );
93
94 // XAccessibleTable -------------------------------------------------------
95
96 /** @return The description text of the specified row. */
97 virtual ::rtl::OUString SAL_CALL
98 getAccessibleRowDescription( sal_Int32 nRow )
99 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
100 ::com::sun::star::uno::RuntimeException );
101
102 /** @return The description text of the specified column. */
103 virtual ::rtl::OUString SAL_CALL
104 getAccessibleColumnDescription( sal_Int32 nColumn )
105 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
106 ::com::sun::star::uno::RuntimeException );
107
108 /** @return The XAccessibleTable interface of the row header bar. */
109 virtual ::com::sun::star::uno::Reference<
110 ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
111 getAccessibleRowHeaders()
112 throw ( ::com::sun::star::uno::RuntimeException );
113
114 /** @return The XAccessibleTable interface of the column header bar. */
115 virtual ::com::sun::star::uno::Reference<
116 ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
117 getAccessibleColumnHeaders()
118 throw ( ::com::sun::star::uno::RuntimeException );
119
120 /** @return An index list of completely selected rows. */
121 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
122 getSelectedAccessibleRows()
123 throw ( ::com::sun::star::uno::RuntimeException );
124
125 /** @return An index list of completely selected columns. */
126 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
127 getSelectedAccessibleColumns()
128 throw ( ::com::sun::star::uno::RuntimeException );
129
130 /** @return <TRUE/>, if the specified row is completely selected. */
131 virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
132 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
133 ::com::sun::star::uno::RuntimeException );
134
135 /** @return <TRUE/>, if the specified column is completely selected. */
136 virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
137 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
138 ::com::sun::star::uno::RuntimeException );
139
140 /** @return The XAccessible interface of the cell object at the specified
141 cell position. */
142 virtual ::com::sun::star::uno::Reference<
143 ::com::sun::star::accessibility::XAccessible > SAL_CALL
144 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
145 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
146 ::com::sun::star::uno::RuntimeException );
147
148 /** @return <TRUE/>, if the specified cell is selected. */
149 virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
150 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
151 ::com::sun::star::uno::RuntimeException );
152
153 // XAccessibleSelection ---------------------------------------------------
154
155 /** Selects the specified child (row or column of the table). */
156 virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex )
157 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
158 ::com::sun::star::uno::RuntimeException );
159
160 /** @return <TRUE/>, if the specified child (row/column) is selected. */
161 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex )
162 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
163 ::com::sun::star::uno::RuntimeException );
164
165 /** Clears the complete selection. */
166 virtual void SAL_CALL clearAccessibleSelection()
167 throw ( ::com::sun::star::uno::RuntimeException );
168
169 /** Selects all children or first, if multiselection is not supported. */
170 virtual void SAL_CALL selectAllAccessibleChildren()
171 throw ( ::com::sun::star::uno::RuntimeException );
172
173 /** @return The number of selected rows/columns. */
174 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
175 throw ( ::com::sun::star::uno::RuntimeException );
176
177 /** @return The specified selected row/column. */
178 virtual ::com::sun::star::uno::Reference<
179 ::com::sun::star::accessibility::XAccessible > SAL_CALL
180 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
181 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
182 ::com::sun::star::uno::RuntimeException );
183
184 /** Removes the specified row/column from the selection. */
185 virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
186 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
187 ::com::sun::star::uno::RuntimeException );
188
189 // XInterface -------------------------------------------------------------
190
191 /** Queries for a new interface. */
192 ::com::sun::star::uno::Any SAL_CALL queryInterface(
193 const ::com::sun::star::uno::Type& rType )
194 throw ( ::com::sun::star::uno::RuntimeException );
195
196 /** Aquires the object (calls acquire() on base class). */
197 virtual void SAL_CALL acquire() throw ();
198
199 /** Releases the object (calls release() on base class). */
200 virtual void SAL_CALL release() throw ();
201
202 // XServiceInfo -----------------------------------------------------------
203
204 /** @return The name of this class. */
205 virtual ::rtl::OUString SAL_CALL getImplementationName()
206 throw ( ::com::sun::star::uno::RuntimeException );
207
208 /** @return An unique implementation ID. */
209 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
210 throw ( ::com::sun::star::uno::RuntimeException );
211
212 protected:
213 // internal virtual methods -----------------------------------------------
214
215 /** @attention This method requires locked mutex's and a living object.
216 @return The bounding box (VCL rect.) relative to the parent window. */
217 virtual Rectangle implGetBoundingBox();
218 /** @attention This method requires locked mutex's and a living object.
219 @return The bounding box (VCL rect.) in screen coordinates. */
220 virtual Rectangle implGetBoundingBoxOnScreen();
221
222 /** @attention This method requires locked mutex's and a living object.
223 @return The count of used rows. */
224 virtual sal_Int32 implGetRowCount() const;
225 /** @attention This method requires locked mutex's and a living object.
226 @return The count of used columns. */
227 virtual sal_Int32 implGetColumnCount() const;
228
229 // internal helper methods ------------------------------------------------
230
231 /** @return <TRUE/>, if the objects is a header bar for rows. */
232 inline sal_Bool isRowBar() const;
233 /** @return <TRUE/>, if the objects is a header bar for columns. */
234 inline sal_Bool isColumnBar() const;
235
236 /** Returns the specified row or column. Uses one of the parameters,
237 depending on object type.
238 @attention This method requires locked mutex's and a living object.
239 @return The XAccessible interface of the specified column/row. */
240 ::com::sun::star::uno::Reference<
241 ::com::sun::star::accessibility::XAccessible >
242 implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos );
243
244 /** @attention This method requires locked mutex's and a living object.
245 @return The absolute child index from the index of selected children.
246 @throws <type>IndexOutOfBoundsException</type>
247 If the specified index is invalid. */
248 sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
249 throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
250
251 /** @attention This method requires locked mutex's and a living object.
252 @throws <type>IndexOutOfBoundsException</type>
253 If the specified row/column index (depending on type) is invalid. */
254 void ensureIsValidHeaderIndex( sal_Int32 nIndex )
255 throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
256 };
257
258 // inlines --------------------------------------------------------------------
259
isRowBar() const260 inline sal_Bool AccessibleBrowseBoxHeaderBar::isRowBar() const
261 {
262 return getType() == ::svt::BBTYPE_ROWHEADERBAR;
263 }
264
isColumnBar() const265 inline sal_Bool AccessibleBrowseBoxHeaderBar::isColumnBar() const
266 {
267 return getType() == ::svt::BBTYPE_COLUMNHEADERBAR;
268 }
269
270 // ============================================================================
271
272 } // namespace accessibility
273
274 // ============================================================================
275
276 #endif
277
278