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