LibreOffice Module accessibility (master) 1
AccessibleBrowseBoxHeaderBar.cxx
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
23#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
24
25using ::com::sun::star::uno::Reference;
26using ::com::sun::star::uno::Sequence;
27using ::com::sun::star::uno::Any;
28
29using namespace ::com::sun::star;
30using namespace ::com::sun::star::accessibility;
31
32
33namespace accessibility {
34
35
36// Ctor/Dtor/disposing --------------------------------------------------------
37
39 const Reference< XAccessible >& rxParent,
42 AccessibleBrowseBoxTableBase( rxParent, rBrowseBox,eObjType )
43{
44 OSL_ENSURE( isRowBar() || isColumnBar(),
45 "extended/AccessibleBrowseBoxHeaderBar - invalid object type" );
46}
47
49{
50}
51
52// XAccessibleContext ---------------------------------------------------------
53
56{
57 SolarMethodGuard aGuard(getMutex());
59
60 ensureIsValidHeaderIndex( nChildIndex );
61 return implGetChild( nChildIndex, implToVCLColumnPos( nChildIndex ) );
62}
63
65{
67}
68
69// XAccessibleComponent -------------------------------------------------------
70
73{
74 SolarMethodGuard aGuard(getMutex());
76
77 sal_Int32 nRow = 0;
78 sal_uInt16 nColumnPos = 0;
79 bool bConverted = isRowBar() ?
80 mpBrowseBox->ConvertPointToRowHeader( nRow, VCLPoint( rPoint ) ) :
81 mpBrowseBox->ConvertPointToColumnHeader( nColumnPos, VCLPoint( rPoint ) );
82
83 return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
84}
85
87{
88 SolarMethodGuard aGuard(getMutex());
89
91 // focus on header not supported
92}
93
94// XAccessibleTable -----------------------------------------------------------
95
97{
98 SolarMethodGuard aGuard(getMutex());
99
101 ensureIsValidRow( nRow );
102 return OUString(); // no headers in headers
103}
104
106{
107 SolarMethodGuard aGuard(getMutex());
108
110 ensureIsValidColumn( nColumn );
111 return OUString(); // no headers in headers
112}
113
115{
116 SolarMethodGuard aGuard(getMutex());
117
119 return nullptr; // no headers in headers
120}
121
123{
124 SolarMethodGuard aGuard(getMutex());
125
127 return nullptr; // no headers in headers
128}
129
131{
132 SolarMethodGuard aGuard(getMutex());
134
135 Sequence< sal_Int32 > aSelSeq;
136 // row of column header bar not selectable
137 if( isRowBar() )
138 implGetSelectedRows( aSelSeq );
139 return aSelSeq;
140}
141
143{
144 SolarMethodGuard aGuard(getMutex());
146
147 Sequence< sal_Int32 > aSelSeq;
148 // column of row header bar ("handle column") not selectable
149 if( isColumnBar() )
150 implGetSelectedColumns( aSelSeq );
151 return aSelSeq;
152}
153
155{
156 SolarMethodGuard aGuard(getMutex());
157
159 ensureIsValidRow( nRow );
160 return isRowBar() && implIsRowSelected( nRow );
161}
162
164{
165 SolarMethodGuard aGuard(getMutex());
166
168 ensureIsValidColumn( nColumn );
169 return isColumnBar() && implIsColumnSelected( nColumn );
170}
171
173 sal_Int32 nRow, sal_Int32 nColumn )
174{
175 SolarMethodGuard aGuard(getMutex());
176
178 ensureIsValidAddress( nRow, nColumn );
179
180 return implGetChild( nRow, implToVCLColumnPos( nColumn ) );
181}
182
184 sal_Int32 nRow, sal_Int32 nColumn )
185{
186 SolarMethodGuard aGuard(getMutex());
188
189 ensureIsValidAddress( nRow, nColumn );
190 return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn );
191}
192
193// XAccessibleSelection -------------------------------------------------------
194
195void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAccessibleChild( sal_Int64 nChildIndex )
196{
197 SolarMethodGuard aGuard(getMutex());
199
200 ensureIsValidHeaderIndex( nChildIndex );
201 if( isRowBar() )
202 implSelectRow( nChildIndex, true );
203 else
204 implSelectColumn( implToVCLColumnPos( nChildIndex ), true );
205}
206
208{
209 // using interface methods - no mutex
210 return isRowBar() ?
211 isAccessibleRowSelected( nChildIndex ) :
212 isAccessibleColumnSelected( nChildIndex );
213}
214
216{
217 SolarMethodGuard aGuard(getMutex());
219
221}
222
224{
225 SolarMethodGuard aGuard(getMutex());
227
228 // no multiselection of columns possible
229 if( isRowBar() )
231 else
233}
234
236{
237 SolarMethodGuard aGuard(getMutex());
239
241}
242
245{
246 SolarMethodGuard aGuard(getMutex());
248
249 // method may throw lang::IndexOutOfBoundsException
250 sal_Int64 nIndex = implGetChildIndexFromSelectedIndex( nSelectedChildIndex );
251 assert(nIndex < std::numeric_limits<sal_Int32>::max());
253}
254
256 sal_Int64 nSelectedChildIndex )
257{
258 SolarMethodGuard aGuard(getMutex());
260
261 // method may throw lang::IndexOutOfBoundsException
262 if ( isAccessibleChildSelected(nSelectedChildIndex) )
263 {
264 if( isRowBar() )
265 implSelectRow( nSelectedChildIndex, false );
266 else
267 implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), false );
268 }
269}
270
271// XInterface -----------------------------------------------------------------
272
274{
276 return aAny.hasValue() ?
278}
279
281{
283}
284
286{
288}
289
290// XServiceInfo ---------------------------------------------------------------
291
293{
294 return "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderBar";
295}
296
298{
299 return css::uno::Sequence<sal_Int8>();
300}
301
302// internal virtual methods ---------------------------------------------------
303
305{
306 return mpBrowseBox->calcHeaderRect(isColumnBar(), false);
307}
308
310{
312}
313
315{
316 // column header bar: only 1 row
318}
319
321{
322 // row header bar ("handle column"): only 1 column
324}
325
326// internal helper methods ----------------------------------------------------
327
329 sal_Int32 nRow, sal_uInt16 nColumnPos )
330{
331 return isRowBar() ?
334}
335
337 sal_Int64 nSelectedChildIndex )
338{
339 Sequence< sal_Int32 > aSelSeq;
340 if( isRowBar() )
341 implGetSelectedRows( aSelSeq );
342 else
343 implGetSelectedColumns( aSelSeq );
344
345 if( (nSelectedChildIndex < 0) || (nSelectedChildIndex >= aSelSeq.getLength()) )
346 throw lang::IndexOutOfBoundsException();
347
348 return aSelSeq.getConstArray()[ nSelectedChildIndex ];
349}
350
352{
353 if( isRowBar() )
355 else
357}
358
359
360} // namespace accessibility
361
362
363/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AccessibleBrowseBoxObjType
::vcl::IAccessibleTableProvider * mpBrowseBox
The VCL BrowseBox control.
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
sal_Int64 implGetChildIndexFromSelectedIndex(sal_Int64 nSelectedChildIndex)
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
virtual void SAL_CALL grabFocus() override
Grabs the focus to (the current cell of) the data table.
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
Selects the specified child (row or column of the table).
AccessibleBrowseBoxHeaderBar(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ::vcl::IAccessibleTableProvider &rBrowseBox, AccessibleBrowseBoxObjType eObjType)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual void SAL_CALL acquire() noexcept override
Acquires the object (calls acquire() on base class).
virtual void SAL_CALL selectAllAccessibleChildren() override
Selects all children or first, if multiselection is not supported.
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Queries for a new interface.
virtual tools::Rectangle implGetBoundingBox() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
virtual void SAL_CALL clearAccessibleSelection() override
Clears the complete selection.
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nSelectedChildIndex) override
Removes the specified row/column from the selection.
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nChildIndex) override
virtual tools::Rectangle implGetBoundingBoxOnScreen() override
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
virtual void SAL_CALL release() noexcept override
Releases the object (calls release() on base class).
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
css::uno::Reference< css::accessibility::XAccessible > implGetChild(sal_Int32 nRow, sal_uInt16 nColumnPos)
Returns the specified row or column.
The BrowseBox accessible table objects inherit from this base class.
void implGetSelectedRows(css::uno::Sequence< sal_Int32 > &rSeq)
Fills a sequence with sorted indexes of completely selected rows.
void implGetSelectedColumns(css::uno::Sequence< sal_Int32 > &rSeq)
Fills a sequence with sorted indexes of completely selected columns.
virtual void SAL_CALL release() noexcept override
Releases the object (calls release() on base class).
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Queries for a new interface.
virtual void SAL_CALL acquire() noexcept override
Acquires the object (calls acquire() on base class).
sal_uInt16 implToVCLColumnPos(sal_Int32 nColumn) const
void implSelectRow(sal_Int32 nRow, bool bSelect)
Selects/deselects a row (tries to expand selection).
void implSelectColumn(sal_Int32 nColumnPos, bool bSelect)
Selects/deselects a column (tries to expand selection).
void ensureIsValidAddress(sal_Int32 nRow, sal_Int32 nColumn)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual bool ConvertPointToColumnHeader(sal_uInt16 &_rnColPos, const Point &_rPoint)=0
virtual bool ConvertPointToRowHeader(sal_Int32 &_rnRow, const Point &_rPoint)=0
virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen=true)=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader(sal_Int32 _nRow)=0
virtual void SetNoSelection()=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader(sal_uInt16 _nColumnPos)=0
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
sal_Int32 nIndex
BBINDEX_COLUMNHEADERBAR
BBINDEX_ROWHEADERBAR
unsigned char sal_Bool