LibreOffice Module comphelper (master) 1
accessibleselectionhelper.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
22
23
24namespace comphelper
25{
26
27
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::awt;
30 using namespace ::com::sun::star::lang;
31 using namespace ::com::sun::star::accessibility;
32
34 {
35 }
36
38
39
41 {
42 implSelect( nChildIndex, true );
43 }
44
45
47 {
48 return implIsSelected( nChildIndex );
49 }
50
51
53 {
55 }
56
57
59 {
61 }
62
63
65 {
66 sal_Int64 nRet = 0;
67 Reference< XAccessibleContext > xParentContext( implGetAccessibleContext() );
68
69 OSL_ENSURE( xParentContext.is(), "OCommonAccessibleSelection::getSelectedAccessibleChildCount: no parent context!" );
70
71 if( xParentContext.is() )
72 {
73 for( sal_Int64 i = 0, nChildCount = xParentContext->getAccessibleChildCount(); i < nChildCount; i++ )
74 if( implIsSelected( i ) )
75 ++nRet;
76 }
77
78 return nRet;
79 }
80
81
82 Reference< XAccessible > OCommonAccessibleSelection::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
83 {
84 Reference< XAccessible > xRet;
85 Reference< XAccessibleContext > xParentContext( implGetAccessibleContext() );
86
87 OSL_ENSURE( xParentContext.is(), "OCommonAccessibleSelection::getSelectedAccessibleChildCount: no parent context!" );
88
89 if( xParentContext.is() )
90 {
91 for( sal_Int64 i = 0, nChildCount = xParentContext->getAccessibleChildCount(), nPos = 0; ( i < nChildCount ) && !xRet.is(); i++ )
92 if( implIsSelected( i ) && ( nPos++ == nSelectedChildIndex ) )
93 xRet = xParentContext->getAccessibleChild( i );
94 }
95
96 return xRet;
97 }
98
99
100 void OCommonAccessibleSelection::deselectAccessibleChild( sal_Int64 nSelectedChildIndex )
101 {
102 implSelect( nSelectedChildIndex, false );
103 }
104
105 OAccessibleSelectionHelper::OAccessibleSelectionHelper()
106 {
107 }
108
109
110 Reference< XAccessibleContext > OAccessibleSelectionHelper::implGetAccessibleContext()
111 {
112 return this;
113 }
114
115
116 void SAL_CALL OAccessibleSelectionHelper::selectAccessibleChild( sal_Int64 nChildIndex )
117 {
118 OExternalLockGuard aGuard( this );
120 }
121
122
123 sal_Bool SAL_CALL OAccessibleSelectionHelper::isAccessibleChildSelected( sal_Int64 nChildIndex )
124 {
125 OExternalLockGuard aGuard( this );
127 }
128
129
130 void SAL_CALL OAccessibleSelectionHelper::clearAccessibleSelection( )
131 {
132 OExternalLockGuard aGuard( this );
134 }
135
136
137 void SAL_CALL OAccessibleSelectionHelper::selectAllAccessibleChildren( )
138 {
139 OExternalLockGuard aGuard( this );
141 }
142
143
144 sal_Int64 SAL_CALL OAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
145 {
146 OExternalLockGuard aGuard( this );
148 }
149
150
151 Reference< XAccessible > SAL_CALL OAccessibleSelectionHelper::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
152 {
153 OExternalLockGuard aGuard( this );
154 return OCommonAccessibleSelection::getSelectedAccessibleChild( nSelectedChildIndex );
155 }
156
157
158 void SAL_CALL OAccessibleSelectionHelper::deselectAccessibleChild( sal_Int64 nSelectedChildIndex )
159 {
160 OExternalLockGuard aGuard( this );
162 }
163
164
165} // namespace comphelper
166
167
168/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define ACCESSIBLE_SELECTION_CHILD_ALL
virtual void implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect)=0
css::uno::Reference< css::accessibility::XAccessible > getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex)
bool isAccessibleChildSelected(sal_Int64 nChildIndex)
void deselectAccessibleChild(sal_Int64 nSelectedChildIndex)
virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex)=0
virtual css::uno::Reference< css::accessibility::XAccessibleContext > implGetAccessibleContext()=0
void selectAccessibleChild(sal_Int64 nChildIndex)
non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> an...
sal_uInt16 nPos
int i
unsigned char sal_Bool