LibreOffice Module accessibility (master) 1
AccessibleGridControlHeader.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
20#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
25#include <vcl/svapp.hxx>
26
27using ::com::sun::star::uno::Reference;
28using ::com::sun::star::uno::Sequence;
29
30using namespace ::com::sun::star::uno;
31using namespace ::com::sun::star;
32using namespace ::com::sun::star::lang;
33using namespace ::com::sun::star::accessibility;
34using namespace ::vcl;
35using namespace ::vcl::table;
36
37
38namespace accessibility {
39
40
42 const Reference< XAccessible >& rxParent,
45 AccessibleGridControlTableBase( rxParent, rTable, eObjType )
46{
47 OSL_ENSURE( isRowBar() || isColumnBar(),
48 "extended/AccessibleGridControlHeaderBar - invalid object type" );
49}
50
51// XAccessibleContext ---------------------------------------------------------
52
55{
56 SolarMutexGuard aSolarGuard;
57
58 if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
59 throw IndexOutOfBoundsException();
63 {
65 xChild = pColHeaderCell;
66 }
68 {
70 xChild = pRowHeaderCell;
71 }
72 return xChild;
73}
74
76{
77 SolarMutexGuard aSolarGuard;
78
81 return 1;
82 else
83 return 0;
84}
85
86// XAccessibleComponent -------------------------------------------------------
87
90{
91 SolarMutexGuard aSolarGuard;
92
94
95 sal_Int32 nRow = 0;
96 sal_Int32 nColumnPos = 0;
97 bool bConverted = m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, VCLPoint(rPoint));
98 return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
99}
100
102{
104 // focus on header not supported
105}
106
107// XAccessibleTable -----------------------------------------------------------
108
110{
111 SolarMutexGuard aSolarGuard;
112
114 ensureIsValidRow( nRow );
115 return OUString(); // no headers in headers
116}
117
119{
120 SolarMutexGuard aSolarGuard;
121
123 ensureIsValidColumn( nColumn );
124 return OUString(); // no headers in headers
125}
126
128{
130
132 return nullptr; // no headers in headers
133}
134
136{
138
140 return nullptr; // no headers in headers
141}
142//not selectable
144{
145 return {};
146}
147//columns aren't selectable
149{
150 return {};
151}
152//row headers not selectable
154{
155 return false;
156}
157//columns aren't selectable
159{
160 return false;
161}
162//not implemented
164 sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
165{
166 return nullptr;
167}
168// not selectable
170 sal_Int32 /*nRow*/, sal_Int32 /*nColumn */)
171{
172 return false;
173}
174
175// XServiceInfo ---------------------------------------------------------------
176
178{
179 return "com.sun.star.accessibility.AccessibleGridControlHeader";
180}
181
183{
184 return css::uno::Sequence<sal_Int8>();
185}
186
187// internal virtual methods ---------------------------------------------------
188
190{
192 tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( *pParent ) );
194 if(isColumnBar())
195 return tools::Rectangle(aGridRect.TopLeft(), Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
196 else
197 return tools::Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight()));
198
199}
200
202{
205 if(isColumnBar())
206 return tools::Rectangle(aGridRect.TopLeft(), Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
207 else
208 return tools::Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight()));
209}
210
211// internal helper methods ----------------------------------------------------
213 sal_Int32 nRow, sal_uInt32 nColumnPos )
214{
217 {
219 xChild = pColHeaderCell;
220 }
222 {
224 xChild = pRowHeaderCell;
225 }
226 return xChild;
227}
228
229} // namespace accessibility
230
231/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::vcl::table::IAccessibleTable & m_aTable
The SVT Table control.
::vcl::table::AccessibleTableControlObjType m_eObjType
The type of this object (for names, descriptions, state sets, ...).
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual tools::Rectangle implGetBoundingBox() override
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
AccessibleGridControlHeader(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ::vcl::table::IAccessibleTable &rTable, ::vcl::table::AccessibleTableControlObjType eObjType)
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
css::uno::Reference< css::accessibility::XAccessible > implGetChild(sal_Int32 nRow, sal_uInt32 nColumnPos)
Returns the specified row or column.
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
virtual void SAL_CALL grabFocus() override
Grabs the focus to (the current cell of) the data table.
virtual OUString SAL_CALL getImplementationName() override
virtual tools::Rectangle implGetBoundingBoxOnScreen() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nChildIndex) override
The Grid Control accessible table objects inherit from this base class.
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
constexpr Point TopLeft() const
tools::Long getOpenHeight() const
tools::Long getOpenWidth() const
virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar)=0
virtual bool ConvertPointToCellAddress(sal_Int32 &_rnRow, sal_Int32 &_rnColPos, const Point &_rPoint)=0
virtual vcl::Window * GetAccessibleParentWindow() const=0
virtual bool HasColHeader()=0
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const=0
virtual tools::Rectangle GetWindowExtentsAbsolute() const=0
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
AccessibleTableControlObjType
unsigned char sal_Bool