LibreOffice Module accessibility (master) 1
vclxaccessibleheaderbaritem.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 */
20
21#include <vcl/headbar.hxx>
22
23#include <com/sun/star/accessibility/AccessibleRole.hpp>
24#include <com/sun/star/accessibility/AccessibleStateType.hpp>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28
30#include <vcl/svapp.hxx>
31#include <vcl/settings.hxx>
34
35using namespace ::com::sun::star;
36using namespace ::com::sun::star::uno;
37using namespace ::com::sun::star::lang;
38using namespace ::com::sun::star::accessibility;
39using namespace ::comphelper;
40
41
42
43
45 :m_pHeadBar( pHeadBar )
46 ,m_nIndexInParent(_nIndexInParent + 1)
47
48{
49}
50
52{
53}
54
56{
57 if ( m_pHeadBar )
58 {
59 if ( m_pHeadBar->IsEnabled() )
60 rStateSet |= AccessibleStateType::ENABLED;
61
62 if ( m_pHeadBar->IsVisible() )
63 {
64 rStateSet |= AccessibleStateType::VISIBLE;
65 }
66 rStateSet |= AccessibleStateType::SELECTABLE;
67 rStateSet |= AccessibleStateType::RESIZABLE;
68 }
69}
70
71// OCommonAccessibleComponent
73{
74 awt::Rectangle aBounds;
75 OExternalLockGuard aGuard( this );
76
77 if ( m_pHeadBar )
78 aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) );
79
80 return aBounds;
81}
82
83
84// XServiceInfo
86{
87 return "com.sun.star.comp.svtools.AccessibleHeaderBarItem";
88}
89
91{
92 return cppu::supportsService( this, rServiceName );
93}
94
96{
97 return { "com.sun.star.awt.AccessibleHeaderBarItem" };
98}
99
100// XAccessible
102{
103 return this;
104}
105
106
107// XAccessibleContext
108
109
111{
112 return 0;
113}
114
115
117{
118 OExternalLockGuard aGuard( this );
119
120 if ( i < 0 || i >= getAccessibleChildCount() )
121 throw IndexOutOfBoundsException();
122
124}
125
126
128{
129 OExternalLockGuard aGuard( this );
130
132 if ( m_pHeadBar )
133 {
134 xParent = m_pHeadBar->GetAccessible();
135 }
136
137 return xParent;
138}
139
140
142{
143 OExternalLockGuard aGuard( this );
144 return m_nIndexInParent - 1;
145}
146
147
149{
150 return AccessibleRole::COLUMN_HEADER;
151}
152
153
155{
156 return OUString();
157}
158
159
161{
162 OExternalLockGuard aGuard( this );
163
164 OUString sName;
165 if(m_pHeadBar)
166 sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) );
167 return sName;
168}
169
170
171Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet( )
172{
173 OExternalLockGuard aGuard( this );
174
176}
177
178
180{
181 OExternalLockGuard aGuard( this );
182
183 sal_Int64 nStateSet = 0;
184
185 if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
186 {
187 FillAccessibleStateSet( nStateSet );
188 }
189 else
190 {
191 nStateSet |= AccessibleStateType::DEFUNC;
192 }
193
194 return nStateSet;
195}
196
197
199{
200 OExternalLockGuard aGuard( this );
201
203}
204
205
206// XAccessibleComponent
207
208
210{
212}
213
214
216{
217 return 0;
218}
219
220
222{
223 return 0;
224}
225
226
227// XAccessibleExtendedComponent
228
229
231{
232 return Reference< awt::XFont >();
233}
234
235
237{
238 return OUString();
239}
240
241
243{
244 OExternalLockGuard aGuard( this );
245
246 OUString sText;
247 if ( m_pHeadBar )
248 sText = m_pHeadBar->GetQuickHelpText();
249
250 return sText;
251}
252
253/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual OUString SAL_CALL getTitledBorderText() override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::lang::Locale SAL_CALL getLocale() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual OUString SAL_CALL getToolTipText() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual sal_Int32 SAL_CALL getForeground() override
virtual OUString SAL_CALL getImplementationName() override
void FillAccessibleStateSet(sal_Int64 &rStateSet)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
VCLXAccessibleHeaderBarItem(HeaderBar *pHeadBar, sal_Int32 _nIndexInParent)
virtual css::awt::Rectangle implGetBounds() override
virtual OUString SAL_CALL getAccessibleName() override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual OUString SAL_CALL getAccessibleDescription() override
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
OUString sName
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool