LibreOffice Module accessibility (master) 1
AccessibleBrowseBoxTable.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
25
26using ::com::sun::star::uno::Reference;
27using ::com::sun::star::uno::Sequence;
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,
40 vcl::IAccessibleTableProvider& rBrowseBox ) :
42{
43}
44
46{
47}
48
49// XAccessibleContext ---------------------------------------------------------
50
53{
54 SolarMethodGuard aGuard(getMutex());
56
57 ensureIsValidIndex( nChildIndex );
59 implGetRow( nChildIndex ), static_cast<sal_Int16>(implGetColumn( nChildIndex )) );
60}
61
63{
64 osl::MutexGuard aGuard( getMutex() );
66 return vcl::BBINDEX_TABLE;
67}
68
69// XAccessibleComponent -------------------------------------------------------
70
73{
74 SolarMethodGuard aGuard(getMutex());
76
78 sal_Int32 nRow = 0;
79 sal_uInt16 nColumnPos = 0;
80 if( mpBrowseBox->ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
81 xChild = mpBrowseBox->CreateAccessibleCell( nRow, nColumnPos );
82
83 return xChild;
84}
85
87{
88 SolarMethodGuard aGuard(getMutex());
91}
92
93// XAccessibleTable -----------------------------------------------------------
94
96{
97 SolarMethodGuard aGuard(getMutex());
99 ensureIsValidRow( nRow );
100 return mpBrowseBox->GetRowDescription( nRow );
101}
102
104{
105 SolarMethodGuard aGuard(getMutex());
107
108 ensureIsValidColumn( nColumn );
109 return mpBrowseBox->GetColumnDescription( static_cast<sal_uInt16>(nColumn) );
110}
111
113{
114 ::osl::MutexGuard aGuard( getMutex() );
117}
118
120{
121 ::osl::MutexGuard aGuard( getMutex() );
124}
125
127{
128 SolarMethodGuard aGuard(getMutex());
130
131 Sequence< sal_Int32 > aSelSeq;
132 implGetSelectedRows( aSelSeq );
133 return aSelSeq;
134}
135
137{
138 SolarMethodGuard aGuard(getMutex());
140
141 Sequence< sal_Int32 > aSelSeq;
142 implGetSelectedColumns( aSelSeq );
143 return aSelSeq;
144}
145
147{
148 SolarMethodGuard aGuard(getMutex());
150
151 ensureIsValidRow( nRow );
152 return implIsRowSelected( nRow );
153}
154
156{
157 SolarMethodGuard aGuard(getMutex());
159
160 ensureIsValidColumn( nColumn );
161 return implIsColumnSelected( nColumn );
162}
163
165 sal_Int32 nRow, sal_Int32 nColumn )
166{
167 SolarMethodGuard aGuard(getMutex());
169
170 ensureIsValidAddress( nRow, nColumn );
171 return mpBrowseBox->CreateAccessibleCell( nRow, static_cast<sal_Int16>(nColumn) );
172}
173
175 sal_Int32 nRow, sal_Int32 nColumn )
176{
177 SolarMethodGuard aGuard(getMutex());
179
180 ensureIsValidAddress( nRow, nColumn );
181 return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );
182}
183
184// XServiceInfo ---------------------------------------------------------------
185
187{
188 return "com.sun.star.comp.svtools.AccessibleBrowseBoxTable";
189}
190
191// internal virtual methods ---------------------------------------------------
192
194{
195 return mpBrowseBox->calcTableRect(false);
196}
197
199{
200 return mpBrowseBox->calcTableRect();
201}
202
203// internal helper methods ----------------------------------------------------
204
206 sal_Int32 nChildIndex )
207{
209 Reference< XAccessibleContext > xContext( mxParent, uno::UNO_QUERY );
210 if( xContext.is() )
211 {
212 try
213 {
214 xRet = xContext->getAccessibleChild( nChildIndex );
215 }
216 catch (const lang::IndexOutOfBoundsException&)
217 {
218 OSL_FAIL( "implGetHeaderBar - wrong child index" );
219 }
220 // RuntimeException goes to caller
221 }
222 return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
223}
224
225
226} // namespace accessibility
227
228
229/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AccessibleBrowseBoxObjType
::vcl::IAccessibleTableProvider * mpBrowseBox
The VCL BrowseBox control.
css::uno::Reference< css::accessibility::XAccessible > mxParent
The parent accessible object.
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.
sal_Int32 implGetColumn(sal_Int64 nChildIndex) const
sal_Int32 implGetRow(sal_Int64 nChildIndex) const
void ensureIsValidAddress(sal_Int32 nRow, sal_Int32 nColumn)
css::uno::Reference< css::accessibility::XAccessibleTable > implGetHeaderBar(sal_Int32 nChildIndex)
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual void SAL_CALL grabFocus() override
Grabs the focus to (the current cell of) the data table.
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual tools::Rectangle implGetBoundingBoxOnScreen() override
virtual OUString SAL_CALL getImplementationName() override
virtual tools::Rectangle implGetBoundingBox() override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
AccessibleBrowseBoxTable(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ::vcl::IAccessibleTableProvider &rBrowseBox)
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
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 css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
virtual OUString GetRowDescription(sal_Int32 _nRow) const=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos)=0
virtual void GrabTableFocus()=0
virtual bool ConvertPointToCellAddress(sal_Int32 &_rnRow, sal_uInt16 &_rnColPos, const Point &_rPoint)=0
virtual tools::Rectangle calcTableRect(bool _bOnScreen=true)=0
virtual OUString GetColumnDescription(sal_uInt16 _nColumnPos) const=0
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
BBINDEX_TABLE
BBINDEX_COLUMNHEADERBAR
BBINDEX_ROWHEADERBAR
unsigned char sal_Bool