/src/libreoffice/vcl/source/accessibility/accessibleiconchoicectrlentry.cxx
Line | Count | Source |
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 <accessibility/accessibleiconchoicectrlentry.hxx> |
21 | | #include <ivctrl.hxx> |
22 | | |
23 | | #include <com/sun/star/awt/Rectangle.hpp> |
24 | | #include <com/sun/star/accessibility/AccessibleRole.hpp> |
25 | | #include <com/sun/star/accessibility/AccessibleStateType.hpp> |
26 | | #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> |
27 | | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> |
28 | | #include <vcl/svapp.hxx> |
29 | | #include <vcl/settings.hxx> |
30 | | #include <vcl/unohelp.hxx> |
31 | | #include <vcl/unohelp2.hxx> |
32 | | #include <unotools/accessiblerelationsethelper.hxx> |
33 | | #include <cppuhelper/supportsservice.hxx> |
34 | | #include <i18nlangtag/languagetag.hxx> |
35 | | |
36 | | constexpr sal_Int32 ACCESSIBLE_ACTION_COUNT = 1; |
37 | | |
38 | | namespace |
39 | | { |
40 | | /// @throws css::lang::IndexOutOfBoundsException |
41 | | void checkActionIndex_Impl( sal_Int32 _nIndex ) |
42 | 0 | { |
43 | 0 | if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT ) |
44 | 0 | throw css::lang::IndexOutOfBoundsException(); |
45 | 0 | } |
46 | | } |
47 | | |
48 | | using namespace ::com::sun::star::accessibility; |
49 | | using namespace ::com::sun::star::uno; |
50 | | using namespace ::com::sun::star::lang; |
51 | | using namespace ::com::sun::star; |
52 | | |
53 | | |
54 | | // Ctor() and Dtor() |
55 | | |
56 | | AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, |
57 | | sal_Int32 _nPos, |
58 | | const Reference< XAccessible >& _xParent ) : |
59 | 0 | m_pIconCtrl ( &_rIconCtrl ), |
60 | 0 | m_nIndex ( _nPos ), |
61 | 0 | m_xParent ( _xParent ) |
62 | | |
63 | 0 | { |
64 | 0 | osl_atomic_increment( &m_refCount ); |
65 | 0 | { |
66 | 0 | Reference< XComponent > xComp( m_xParent, UNO_QUERY ); |
67 | 0 | if ( xComp.is() ) |
68 | 0 | xComp->addEventListener( this ); |
69 | 0 | } |
70 | 0 | osl_atomic_decrement( &m_refCount ); |
71 | 0 | } |
72 | | |
73 | | void AccessibleIconChoiceCtrlEntry::disposing( const css::lang::EventObject& _rSource ) |
74 | 0 | { |
75 | 0 | if ( _rSource.Source == m_xParent ) |
76 | 0 | { |
77 | 0 | dispose(); |
78 | 0 | OSL_ENSURE( !m_xParent.is() && ( m_pIconCtrl == nullptr ), "" ); |
79 | 0 | } |
80 | 0 | } |
81 | | |
82 | | AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry() |
83 | 0 | { |
84 | 0 | if ( IsAlive_Impl() ) |
85 | 0 | { |
86 | | // increment ref count to prevent double call of Dtor |
87 | 0 | osl_atomic_increment( &m_refCount ); |
88 | 0 | dispose(); |
89 | 0 | } |
90 | 0 | } |
91 | | |
92 | | tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const |
93 | 0 | { |
94 | 0 | tools::Rectangle aRect; |
95 | 0 | SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); |
96 | 0 | if ( pEntry ) |
97 | 0 | aRect = m_pIconCtrl->GetBoundingBox( pEntry ); |
98 | |
|
99 | 0 | return aRect; |
100 | 0 | } |
101 | | |
102 | | bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const |
103 | 0 | { |
104 | 0 | return isAlive() && m_pIconCtrl; |
105 | 0 | } |
106 | | |
107 | | bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const |
108 | 0 | { |
109 | 0 | bool bShowing = false; |
110 | 0 | Reference< XAccessibleContext > xParentContext = |
111 | 0 | m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >(); |
112 | 0 | if( xParentContext.is() ) |
113 | 0 | { |
114 | 0 | Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); |
115 | 0 | if( xParentComp.is() ) |
116 | 0 | bShowing = GetBoundingBox_Impl().Overlaps( |
117 | 0 | vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); |
118 | 0 | } |
119 | |
|
120 | 0 | return bShowing; |
121 | 0 | } |
122 | | |
123 | | AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() |
124 | 0 | { |
125 | 0 | SolarMutexGuard aSolarGuard; |
126 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
127 | |
|
128 | 0 | EnsureIsAlive(); |
129 | |
|
130 | 0 | SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry(m_nIndex); |
131 | 0 | if (!pEntry) |
132 | 0 | return AbsoluteScreenPixelRectangle(); |
133 | 0 | tools::Rectangle aRect = m_pIconCtrl->GetBoundingBox(pEntry); |
134 | 0 | AbsoluteScreenPixelPoint aTopLeft = m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); |
135 | 0 | aTopLeft += AbsoluteScreenPixelPoint(aRect.TopLeft()); |
136 | 0 | return AbsoluteScreenPixelRectangle(aTopLeft, aRect.GetSize()); |
137 | 0 | } |
138 | | |
139 | | void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const |
140 | 0 | { |
141 | 0 | if ( !IsAlive_Impl() ) |
142 | 0 | throw lang::DisposedException(); |
143 | 0 | } |
144 | | |
145 | | css::awt::Rectangle AccessibleIconChoiceCtrlEntry::implGetBounds() |
146 | 0 | { |
147 | 0 | return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); |
148 | 0 | } |
149 | | |
150 | | OUString AccessibleIconChoiceCtrlEntry::implGetText() |
151 | 0 | { |
152 | 0 | SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); |
153 | 0 | if (pEntry) |
154 | 0 | return pEntry->GetDisplayText(); |
155 | 0 | return OUString(); |
156 | 0 | } |
157 | | |
158 | | Locale AccessibleIconChoiceCtrlEntry::implGetLocale() |
159 | 0 | { |
160 | 0 | return Application::GetSettings().GetUILanguageTag().getLocale(); |
161 | 0 | } |
162 | | void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) |
163 | 0 | { |
164 | 0 | nStartIndex = 0; |
165 | 0 | nEndIndex = 0; |
166 | 0 | } |
167 | | |
168 | | // XComponent |
169 | | |
170 | | void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing() |
171 | 0 | { |
172 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
173 | |
|
174 | 0 | comphelper::OAccessible::disposing(); |
175 | |
|
176 | 0 | Reference< XComponent > xComp( m_xParent, UNO_QUERY ); |
177 | 0 | if ( xComp.is() ) |
178 | 0 | xComp->removeEventListener( this ); |
179 | |
|
180 | 0 | m_pIconCtrl = nullptr; |
181 | 0 | m_xParent = nullptr; |
182 | 0 | } |
183 | | |
184 | | // XServiceInfo |
185 | | |
186 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() |
187 | 0 | { |
188 | 0 | return u"com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry"_ustr; |
189 | 0 | } |
190 | | |
191 | | Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() |
192 | 0 | { |
193 | 0 | return {u"com.sun.star.accessibility.AccessibleContext"_ustr}; |
194 | 0 | } |
195 | | |
196 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const OUString& _rServiceName ) |
197 | 0 | { |
198 | 0 | return cppu::supportsService(this, _rServiceName); |
199 | 0 | } |
200 | | |
201 | | // XAccessibleContext |
202 | | |
203 | | sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) |
204 | 0 | { |
205 | 0 | return 0; // no children |
206 | 0 | } |
207 | | |
208 | | Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int64 ) |
209 | 0 | { |
210 | 0 | throw IndexOutOfBoundsException(); |
211 | 0 | } |
212 | | |
213 | | Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) |
214 | 0 | { |
215 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
216 | |
|
217 | 0 | EnsureIsAlive(); |
218 | 0 | return m_xParent; |
219 | 0 | } |
220 | | |
221 | | sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) |
222 | 0 | { |
223 | 0 | return m_nIndex; |
224 | 0 | } |
225 | | |
226 | | sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) |
227 | 0 | { |
228 | 0 | return AccessibleRole::LIST_ITEM; |
229 | 0 | } |
230 | | |
231 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) |
232 | 0 | { |
233 | | // no description for every item |
234 | 0 | return OUString(); |
235 | 0 | } |
236 | | |
237 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) |
238 | 0 | { |
239 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
240 | |
|
241 | 0 | EnsureIsAlive(); |
242 | 0 | return implGetText(); |
243 | 0 | } |
244 | | |
245 | | Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) |
246 | 0 | { |
247 | 0 | return new utl::AccessibleRelationSetHelper; |
248 | 0 | } |
249 | | |
250 | | sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) |
251 | 0 | { |
252 | 0 | SolarMutexGuard aSolarGuard; |
253 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
254 | |
|
255 | 0 | sal_Int64 nStateSet = 0; |
256 | |
|
257 | 0 | if ( IsAlive_Impl() ) |
258 | 0 | { |
259 | 0 | nStateSet |= AccessibleStateType::FOCUSABLE; |
260 | 0 | nStateSet |= AccessibleStateType::TRANSIENT; |
261 | 0 | nStateSet |= AccessibleStateType::SELECTABLE; |
262 | 0 | nStateSet |= AccessibleStateType::ENABLED; |
263 | 0 | nStateSet |= AccessibleStateType::SENSITIVE; |
264 | 0 | if ( IsShowing_Impl() ) |
265 | 0 | { |
266 | 0 | nStateSet |= AccessibleStateType::SHOWING; |
267 | 0 | nStateSet |= AccessibleStateType::VISIBLE; |
268 | 0 | } |
269 | |
|
270 | 0 | if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) ) |
271 | 0 | { |
272 | 0 | nStateSet |= AccessibleStateType::SELECTED; |
273 | 0 | if (m_pIconCtrl->HasChildPathFocus()) |
274 | 0 | nStateSet |= AccessibleStateType::FOCUSED; |
275 | 0 | } |
276 | 0 | } |
277 | 0 | else |
278 | 0 | nStateSet |= AccessibleStateType::DEFUNC; |
279 | |
|
280 | 0 | return nStateSet; |
281 | 0 | } |
282 | | |
283 | | Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) |
284 | 0 | { |
285 | 0 | SolarMutexGuard aSolarGuard; |
286 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
287 | |
|
288 | 0 | return implGetLocale(); |
289 | 0 | } |
290 | | |
291 | | // XAccessibleComponent |
292 | | |
293 | | Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) |
294 | 0 | { |
295 | 0 | return Reference< XAccessible >(); |
296 | 0 | } |
297 | | |
298 | | awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) |
299 | 0 | { |
300 | 0 | return vcl::unohelper::ConvertToAWTPoint( GetBoundingBoxOnScreen().TopLeft() ); |
301 | 0 | } |
302 | | |
303 | | void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) |
304 | 0 | { |
305 | | // do nothing, because no focus for each item |
306 | 0 | } |
307 | | |
308 | | sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) |
309 | 0 | { |
310 | 0 | SolarMutexGuard aSolarGuard; |
311 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
312 | |
|
313 | 0 | sal_Int32 nColor = 0; |
314 | 0 | Reference< XAccessible > xParent = getAccessibleParent(); |
315 | 0 | if ( xParent.is() ) |
316 | 0 | { |
317 | 0 | Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); |
318 | 0 | if ( xParentComp.is() ) |
319 | 0 | nColor = xParentComp->getForeground(); |
320 | 0 | } |
321 | |
|
322 | 0 | return nColor; |
323 | 0 | } |
324 | | |
325 | | sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) |
326 | 0 | { |
327 | 0 | SolarMutexGuard aSolarGuard; |
328 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
329 | |
|
330 | 0 | sal_Int32 nColor = 0; |
331 | 0 | Reference< XAccessible > xParent = getAccessibleParent(); |
332 | 0 | if ( xParent.is() ) |
333 | 0 | { |
334 | 0 | Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); |
335 | 0 | if ( xParentComp.is() ) |
336 | 0 | nColor = xParentComp->getBackground(); |
337 | 0 | } |
338 | |
|
339 | 0 | return nColor; |
340 | 0 | } |
341 | | |
342 | | // XAccessibleText |
343 | | |
344 | | |
345 | | awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) |
346 | 0 | { |
347 | 0 | SolarMutexGuard aSolarGuard; |
348 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
349 | |
|
350 | 0 | if ( ( 0 > _nIndex ) || ( implGetText().getLength() <= _nIndex ) ) |
351 | 0 | throw IndexOutOfBoundsException(); |
352 | | |
353 | 0 | awt::Rectangle aBounds( 0, 0, 0, 0 ); |
354 | 0 | if ( m_pIconCtrl ) |
355 | 0 | { |
356 | 0 | tools::Rectangle aItemRect = GetBoundingBox_Impl(); |
357 | 0 | tools::Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); |
358 | 0 | aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); |
359 | 0 | aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); |
360 | 0 | } |
361 | |
|
362 | 0 | return aBounds; |
363 | 0 | } |
364 | | |
365 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) |
366 | 0 | { |
367 | 0 | SolarMutexGuard aSolarGuard; |
368 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
369 | |
|
370 | 0 | sal_Int32 nIndex = -1; |
371 | 0 | if ( m_pIconCtrl ) |
372 | 0 | { |
373 | 0 | vcl::ControlLayoutData aLayoutData; |
374 | 0 | tools::Rectangle aItemRect = GetBoundingBox_Impl(); |
375 | 0 | m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); |
376 | 0 | Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); |
377 | 0 | aPnt += aItemRect.TopLeft(); |
378 | 0 | nIndex = aLayoutData.GetIndexForPoint( aPnt ); |
379 | |
|
380 | 0 | tools::Long nLen = aLayoutData.m_aUnicodeBoundRects.size(); |
381 | 0 | for ( tools::Long i = 0; i < nLen; ++i ) |
382 | 0 | { |
383 | 0 | tools::Rectangle aRect = aLayoutData.GetCharacterBounds(i); |
384 | 0 | bool bInside = aRect.Contains( aPnt ); |
385 | |
|
386 | 0 | if ( bInside ) |
387 | 0 | break; |
388 | 0 | } |
389 | 0 | } |
390 | |
|
391 | 0 | return nIndex; |
392 | 0 | } |
393 | | |
394 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) |
395 | 0 | { |
396 | 0 | SolarMutexGuard aSolarGuard; |
397 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
398 | 0 | EnsureIsAlive(); |
399 | |
|
400 | 0 | OUString sText = implGetText(); |
401 | 0 | if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex ) |
402 | 0 | || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) ) |
403 | 0 | throw IndexOutOfBoundsException(); |
404 | | |
405 | 0 | if (!m_pIconCtrl) |
406 | 0 | return false; |
407 | | |
408 | 0 | sal_Int32 nLen = nEndIndex - nStartIndex + 1; |
409 | 0 | css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipBoard = m_pIconCtrl->GetClipboard(); |
410 | 0 | vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, nLen), xClipBoard); |
411 | |
|
412 | 0 | return true; |
413 | 0 | } |
414 | | |
415 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) |
416 | 0 | { |
417 | 0 | return false; |
418 | 0 | } |
419 | | |
420 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) |
421 | 0 | { |
422 | 0 | return -1; |
423 | 0 | } |
424 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) |
425 | 0 | { |
426 | 0 | SolarMutexGuard aSolarGuard; |
427 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
428 | 0 | EnsureIsAlive(); |
429 | |
|
430 | 0 | if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) |
431 | 0 | throw IndexOutOfBoundsException(); |
432 | | |
433 | 0 | return false; |
434 | 0 | } |
435 | | sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) |
436 | 0 | { |
437 | 0 | SolarMutexGuard aSolarGuard; |
438 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
439 | 0 | EnsureIsAlive(); |
440 | 0 | return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); |
441 | 0 | } |
442 | | css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) |
443 | 0 | { |
444 | 0 | SolarMutexGuard aSolarGuard; |
445 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
446 | 0 | EnsureIsAlive(); |
447 | |
|
448 | 0 | OUString sText( implGetText() ); |
449 | |
|
450 | 0 | if ( !implIsValidIndex( nIndex, sText.getLength() ) ) |
451 | 0 | throw IndexOutOfBoundsException(); |
452 | | |
453 | 0 | return css::uno::Sequence< css::beans::PropertyValue >(); |
454 | 0 | } |
455 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) |
456 | 0 | { |
457 | 0 | SolarMutexGuard aSolarGuard; |
458 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
459 | 0 | EnsureIsAlive(); |
460 | 0 | return implGetText().getLength(); |
461 | 0 | } |
462 | | |
463 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) |
464 | 0 | { |
465 | 0 | SolarMutexGuard aSolarGuard; |
466 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
467 | 0 | EnsureIsAlive(); |
468 | 0 | return OUString(); |
469 | 0 | } |
470 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) |
471 | 0 | { |
472 | 0 | SolarMutexGuard aSolarGuard; |
473 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
474 | 0 | EnsureIsAlive(); |
475 | 0 | return 0; |
476 | 0 | } |
477 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) |
478 | 0 | { |
479 | 0 | SolarMutexGuard aSolarGuard; |
480 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
481 | 0 | EnsureIsAlive(); |
482 | 0 | return 0; |
483 | 0 | } |
484 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) |
485 | 0 | { |
486 | 0 | SolarMutexGuard aSolarGuard; |
487 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
488 | 0 | EnsureIsAlive(); |
489 | |
|
490 | 0 | if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) |
491 | 0 | throw IndexOutOfBoundsException(); |
492 | | |
493 | 0 | return false; |
494 | 0 | } |
495 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) |
496 | 0 | { |
497 | 0 | SolarMutexGuard aSolarGuard; |
498 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
499 | 0 | EnsureIsAlive(); |
500 | 0 | return implGetText( ); |
501 | 0 | } |
502 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) |
503 | 0 | { |
504 | 0 | SolarMutexGuard aSolarGuard; |
505 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
506 | 0 | EnsureIsAlive(); |
507 | 0 | return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); |
508 | 0 | } |
509 | | css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) |
510 | 0 | { |
511 | 0 | SolarMutexGuard aSolarGuard; |
512 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
513 | 0 | EnsureIsAlive(); |
514 | 0 | return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); |
515 | 0 | } |
516 | | css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) |
517 | 0 | { |
518 | 0 | SolarMutexGuard aSolarGuard; |
519 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
520 | 0 | EnsureIsAlive(); |
521 | 0 | return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); |
522 | 0 | } |
523 | | css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) |
524 | 0 | { |
525 | 0 | SolarMutexGuard aSolarGuard; |
526 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
527 | 0 | EnsureIsAlive(); |
528 | |
|
529 | 0 | return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); |
530 | 0 | } |
531 | | |
532 | | |
533 | | // XAccessibleAction |
534 | | |
535 | | sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) |
536 | 0 | { |
537 | | // three actions supported |
538 | 0 | return ACCESSIBLE_ACTION_COUNT; |
539 | 0 | } |
540 | | |
541 | | sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) |
542 | 0 | { |
543 | 0 | SolarMutexGuard aSolarGuard; |
544 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
545 | |
|
546 | 0 | bool bRet = false; |
547 | 0 | checkActionIndex_Impl( nIndex ); |
548 | 0 | EnsureIsAlive(); |
549 | |
|
550 | 0 | SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); |
551 | 0 | if ( pEntry && !pEntry->IsSelected() ) |
552 | 0 | { |
553 | 0 | m_pIconCtrl->SetCursor( pEntry ); |
554 | 0 | bRet = true; |
555 | 0 | } |
556 | |
|
557 | 0 | return bRet; |
558 | 0 | } |
559 | | |
560 | | OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) |
561 | 0 | { |
562 | 0 | SolarMutexGuard aSolarGuard; |
563 | 0 | ::osl::MutexGuard aGuard( m_aMutex ); |
564 | |
|
565 | 0 | checkActionIndex_Impl( nIndex ); |
566 | 0 | EnsureIsAlive(); |
567 | |
|
568 | 0 | return u"Select"_ustr; |
569 | 0 | } |
570 | | |
571 | | Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) |
572 | 0 | { |
573 | 0 | Reference< XAccessibleKeyBinding > xRet; |
574 | 0 | checkActionIndex_Impl( nIndex ); |
575 | | // ... which key? |
576 | 0 | return xRet; |
577 | 0 | } |
578 | | |
579 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |