1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessibleiconchoicectrlentry.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_accessibility.hxx"
33 #include <accessibility/extended/accessibleiconchoicectrlentry.hxx>
34 #include <svtools/ivctrl.hxx>
35 #include <com/sun/star/awt/Point.hpp>
36 #include <com/sun/star/awt/Rectangle.hpp>
37 #include <com/sun/star/awt/Size.hpp>
38 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
39 #include <com/sun/star/accessibility/AccessibleRole.hpp>
40 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
41 #include <tools/debug.hxx>
42 #include <vcl/svapp.hxx>
43 #include <vcl/controllayout.hxx>
44 #include <toolkit/awt/vclxwindow.hxx>
45 #include <toolkit/helper/convert.hxx>
46 #include <unotools/accessiblestatesethelper.hxx>
47 #include <unotools/accessiblerelationsethelper.hxx>
48 #include <cppuhelper/typeprovider.hxx>
49 #include <comphelper/sequence.hxx>
50 #include <svtools/stringtransfer.hxx>
51 #include <comphelper/accessibleeventnotifier.hxx>
53 #define ACCESSIBLE_ACTION_COUNT 1
55 #define AID_COLLAPSE 1
59 void checkActionIndex_Impl( sal_Int32 _nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
)
61 if ( _nIndex
< 0 || _nIndex
>= ACCESSIBLE_ACTION_COUNT
)
63 throw ::com::sun::star::lang::IndexOutOfBoundsException();
67 //........................................................................
68 namespace accessibility
70 //........................................................................
71 // class ALBSolarGuard ---------------------------------------------------------
73 /** Aquire the solar mutex. */
74 class ALBSolarGuard
: public ::vos::OGuard
77 inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
80 // class AccessibleIconChoiceCtrlEntry -----------------------------------------------------
82 using namespace ::com::sun::star::accessibility
;
83 using namespace ::com::sun::star::uno
;
84 using namespace ::com::sun::star::lang
;
85 using namespace ::com::sun::star
;
87 DBG_NAME(AccessibleIconChoiceCtrlEntry
)
89 // -----------------------------------------------------------------------------
91 // -----------------------------------------------------------------------------
92 AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl
& _rIconCtrl
,
94 const Reference
< XAccessible
>& _xParent
) :
96 AccessibleIconChoiceCtrlEntry_BASE ( m_aMutex
),
98 m_pIconCtrl ( &_rIconCtrl
),
101 m_xParent ( _xParent
)
104 osl_incrementInterlockedCount( &m_refCount
);
106 Reference
< XComponent
> xComp( m_xParent
, UNO_QUERY
);
108 xComp
->addEventListener( this );
110 osl_decrementInterlockedCount( &m_refCount
);
112 DBG_CTOR( AccessibleIconChoiceCtrlEntry
, NULL
);
114 // -----------------------------------------------------------------------------
115 void AccessibleIconChoiceCtrlEntry::disposing( const EventObject
& _rSource
)
116 throw(RuntimeException
)
118 if ( _rSource
.Source
== m_xParent
)
121 DBG_ASSERT( !m_xParent
.is() && ( NULL
== m_pIconCtrl
), "" );
124 // -----------------------------------------------------------------------------
125 AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry()
127 DBG_DTOR( AccessibleIconChoiceCtrlEntry
, NULL
);
129 if ( IsAlive_Impl() )
131 // increment ref count to prevent double call of Dtor
132 osl_incrementInterlockedCount( &m_refCount
);
136 #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED
137 // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and
139 // -----------------------------------------------------------------------------
140 void AccessibleIconChoiceCtrlEntry::NotifyAccessibleEvent( sal_Int16 _nEventId
,
141 const ::com::sun::star::uno::Any
& _aOldValue
,
142 const ::com::sun::star::uno::Any
& _aNewValue
)
144 Reference
< uno::XInterface
> xSource( *this );
145 AccessibleEventObject
aEventObj( xSource
, _nEventId
, _aNewValue
, _aOldValue
);
148 comphelper::AccessibleEventNotifier::addEvent( m_nClientId
, aEventObj
);
151 // -----------------------------------------------------------------------------
152 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const
155 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
157 aRect
= m_pIconCtrl
->GetBoundingBox( pEntry
);
161 // -----------------------------------------------------------------------------
162 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const
165 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
168 aRect
= m_pIconCtrl
->GetBoundingBox( pEntry
);
169 Point aTopLeft
= aRect
.TopLeft();
170 aTopLeft
+= m_pIconCtrl
->GetWindowExtentsRelative( NULL
).TopLeft();
171 aRect
= Rectangle( aTopLeft
, aRect
.GetSize() );
176 // -----------------------------------------------------------------------------
177 sal_Bool
AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const
179 return ( !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
&& m_pIconCtrl
);
181 // -----------------------------------------------------------------------------
182 sal_Bool
AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const
184 sal_Bool bShowing
= sal_False
;
185 Reference
< XAccessibleContext
> m_xParentContext
=
186 m_xParent
.is() ? m_xParent
->getAccessibleContext() : Reference
< XAccessibleContext
>();
187 if( m_xParentContext
.is() )
189 Reference
< XAccessibleComponent
> xParentComp( m_xParentContext
, uno::UNO_QUERY
);
190 if( xParentComp
.is() )
191 bShowing
= GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp
->getBounds() ) );
196 // -----------------------------------------------------------------------------
197 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBox() throw ( lang::DisposedException
)
199 ALBSolarGuard aSolarGuard
;
200 ::osl::MutexGuard
aGuard( m_aMutex
);
203 return GetBoundingBox_Impl();
205 // -----------------------------------------------------------------------------
206 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException
)
208 ALBSolarGuard aSolarGuard
;
209 ::osl::MutexGuard
aGuard( m_aMutex
);
212 return GetBoundingBoxOnScreen_Impl();
214 // -----------------------------------------------------------------------------
215 void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const throw ( lang::DisposedException
)
217 if ( !IsAlive_Impl() )
218 throw lang::DisposedException();
220 // -----------------------------------------------------------------------------
221 ::rtl::OUString
AccessibleIconChoiceCtrlEntry::implGetText()
223 ::rtl::OUString sRet
;
224 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
226 sRet
= pEntry
->GetDisplayText();
229 // -----------------------------------------------------------------------------
230 Locale
AccessibleIconChoiceCtrlEntry::implGetLocale()
233 aLocale
= Application::GetSettings().GetUILocale();
237 void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
)
242 // -----------------------------------------------------------------------------
244 // -----------------------------------------------------------------------------
245 // -----------------------------------------------------------------------------
246 Sequence
< sal_Int8
> AccessibleIconChoiceCtrlEntry::getImplementationId() throw (RuntimeException
)
248 static ::cppu::OImplementationId
* pId
= NULL
;
252 ::osl::Guard
< ::osl::Mutex
> aGuard( m_aMutex
);
256 static ::cppu::OImplementationId aId
;
260 return pId
->getImplementationId();
262 // -----------------------------------------------------------------------------
264 // -----------------------------------------------------------------------------
265 void SAL_CALL
AccessibleIconChoiceCtrlEntry::disposing()
267 ::osl::MutexGuard
aGuard( m_aMutex
);
269 // Send a disposing to all listeners.
272 sal_uInt32 nId
= m_nClientId
;
274 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId
, *this );
277 Reference
< XComponent
> xComp( m_xParent
, UNO_QUERY
);
279 xComp
->removeEventListener( this );
284 // -----------------------------------------------------------------------------
286 // -----------------------------------------------------------------------------
287 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException
)
289 return getImplementationName_Static();
291 // -----------------------------------------------------------------------------
292 Sequence
< ::rtl::OUString
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException
)
294 return getSupportedServiceNames_Static();
296 // -----------------------------------------------------------------------------
297 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::supportsService( const ::rtl::OUString
& _rServiceName
) throw (RuntimeException
)
299 Sequence
< ::rtl::OUString
> aSupported( getSupportedServiceNames() );
300 const ::rtl::OUString
* pSupported
= aSupported
.getConstArray();
301 const ::rtl::OUString
* pEnd
= pSupported
+ aSupported
.getLength();
302 for ( ; pSupported
!= pEnd
&& !pSupported
->equals(_rServiceName
); ++pSupported
)
305 return pSupported
!= pEnd
;
307 // -----------------------------------------------------------------------------
308 // XServiceInfo - static methods
309 // -----------------------------------------------------------------------------
310 Sequence
< ::rtl::OUString
> AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static(void) throw( RuntimeException
)
312 Sequence
< ::rtl::OUString
> aSupported(3);
313 aSupported
[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
314 aSupported
[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
315 aSupported
[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControlEntry") );
318 // -----------------------------------------------------------------------------
319 ::rtl::OUString
AccessibleIconChoiceCtrlEntry::getImplementationName_Static(void) throw( RuntimeException
)
321 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry") );
323 // -----------------------------------------------------------------------------
325 // -----------------------------------------------------------------------------
326 Reference
< XAccessibleContext
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) throw (RuntimeException
)
331 // -----------------------------------------------------------------------------
332 // XAccessibleContext
333 // -----------------------------------------------------------------------------
334 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) throw (RuntimeException
)
336 return 0; // no children
338 // -----------------------------------------------------------------------------
339 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int32
) throw (IndexOutOfBoundsException
,RuntimeException
)
341 throw IndexOutOfBoundsException();
343 // -----------------------------------------------------------------------------
344 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) throw (RuntimeException
)
346 ::osl::MutexGuard
aGuard( m_aMutex
);
351 // -----------------------------------------------------------------------------
352 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) throw (RuntimeException
)
354 ::osl::MutexGuard
aGuard( m_aMutex
);
358 // -----------------------------------------------------------------------------
359 sal_Int16 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException
)
361 return AccessibleRole::LABEL
;
363 // -----------------------------------------------------------------------------
364 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException
)
366 // no description for every item
367 return ::rtl::OUString();
369 // -----------------------------------------------------------------------------
370 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleName( ) throw (RuntimeException
)
372 ::osl::MutexGuard
aGuard( m_aMutex
);
375 return implGetText();
377 // -----------------------------------------------------------------------------
378 Reference
< XAccessibleRelationSet
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) throw (RuntimeException
)
380 return new utl::AccessibleRelationSetHelper
;
382 // -----------------------------------------------------------------------------
383 Reference
< XAccessibleStateSet
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) throw (RuntimeException
)
385 ALBSolarGuard aSolarGuard
;
386 ::osl::MutexGuard
aGuard( m_aMutex
);
388 utl::AccessibleStateSetHelper
* pStateSetHelper
= new utl::AccessibleStateSetHelper
;
389 Reference
< XAccessibleStateSet
> xStateSet
= pStateSetHelper
;
391 if ( IsAlive_Impl() )
393 pStateSetHelper
->AddState( AccessibleStateType::TRANSIENT
);
394 pStateSetHelper
->AddState( AccessibleStateType::SELECTABLE
);
395 pStateSetHelper
->AddState( AccessibleStateType::ENABLED
);
396 pStateSetHelper
->AddState( AccessibleStateType::SENSITIVE
);
397 if ( IsShowing_Impl() )
399 pStateSetHelper
->AddState( AccessibleStateType::SHOWING
);
400 pStateSetHelper
->AddState( AccessibleStateType::VISIBLE
);
403 if ( m_pIconCtrl
&& m_pIconCtrl
->GetCursor() == m_pIconCtrl
->GetEntry( m_nIndex
) )
404 pStateSetHelper
->AddState( AccessibleStateType::SELECTED
);
407 pStateSetHelper
->AddState( AccessibleStateType::DEFUNC
);
411 // -----------------------------------------------------------------------------
412 Locale SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocale( ) throw (IllegalAccessibleComponentStateException
, RuntimeException
)
414 ALBSolarGuard aSolarGuard
;
415 ::osl::MutexGuard
aGuard( m_aMutex
);
417 return implGetLocale();
419 // -----------------------------------------------------------------------------
420 // XAccessibleComponent
421 // -----------------------------------------------------------------------------
422 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::containsPoint( const awt::Point
& rPoint
) throw (RuntimeException
)
424 return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint
) );
426 // -----------------------------------------------------------------------------
427 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point
& ) throw (RuntimeException
)
429 return Reference
< XAccessible
>();
431 // -----------------------------------------------------------------------------
432 awt::Rectangle SAL_CALL
AccessibleIconChoiceCtrlEntry::getBounds( ) throw (RuntimeException
)
434 return AWTRectangle( GetBoundingBox() );
436 // -----------------------------------------------------------------------------
437 awt::Point SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocation( ) throw (RuntimeException
)
439 return AWTPoint( GetBoundingBox().TopLeft() );
441 // -----------------------------------------------------------------------------
442 awt::Point SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) throw (RuntimeException
)
444 return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
446 // -----------------------------------------------------------------------------
447 awt::Size SAL_CALL
AccessibleIconChoiceCtrlEntry::getSize( ) throw (RuntimeException
)
449 return AWTSize( GetBoundingBox().GetSize() );
451 // -----------------------------------------------------------------------------
452 void SAL_CALL
AccessibleIconChoiceCtrlEntry::grabFocus( ) throw (RuntimeException
)
454 // do nothing, because no focus for each item
456 // -----------------------------------------------------------------------------
457 sal_Int32
AccessibleIconChoiceCtrlEntry::getForeground( ) throw (RuntimeException
)
459 ALBSolarGuard aSolarGuard
;
460 ::osl::MutexGuard
aGuard( m_aMutex
);
462 sal_Int32 nColor
= 0;
463 Reference
< XAccessible
> xParent
= getAccessibleParent();
466 Reference
< XAccessibleComponent
> xParentComp( xParent
->getAccessibleContext(), UNO_QUERY
);
467 if ( xParentComp
.is() )
468 nColor
= xParentComp
->getForeground();
473 // -----------------------------------------------------------------------------
474 sal_Int32
AccessibleIconChoiceCtrlEntry::getBackground( ) throw (RuntimeException
)
476 ALBSolarGuard aSolarGuard
;
477 ::osl::MutexGuard
aGuard( m_aMutex
);
479 sal_Int32 nColor
= 0;
480 Reference
< XAccessible
> xParent
= getAccessibleParent();
483 Reference
< XAccessibleComponent
> xParentComp( xParent
->getAccessibleContext(), UNO_QUERY
);
484 if ( xParentComp
.is() )
485 nColor
= xParentComp
->getBackground();
490 // -----------------------------------------------------------------------------
492 // -----------------------------------------------------------------------------
493 // -----------------------------------------------------------------------------
494 awt::Rectangle SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
496 ALBSolarGuard aSolarGuard
;
497 ::osl::MutexGuard
aGuard( m_aMutex
);
499 if ( ( 0 > _nIndex
) || ( getCharacterCount() <= _nIndex
) )
500 throw IndexOutOfBoundsException();
502 awt::Rectangle
aBounds( 0, 0, 0, 0 );
505 Rectangle aItemRect
= GetBoundingBox_Impl();
506 Rectangle aCharRect
= m_pIconCtrl
->GetEntryCharacterBounds( m_nIndex
, _nIndex
);
507 aCharRect
.Move( -aItemRect
.Left(), -aItemRect
.Top() );
508 aBounds
= AWTRectangle( aCharRect
);
513 // -----------------------------------------------------------------------------
514 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point
& aPoint
) throw (RuntimeException
)
516 ALBSolarGuard aSolarGuard
;
517 ::osl::MutexGuard
aGuard( m_aMutex
);
519 sal_Int32 nIndex
= -1;
522 ::vcl::ControlLayoutData aLayoutData
;
523 Rectangle aItemRect
= GetBoundingBox_Impl();
524 m_pIconCtrl
->RecordLayoutData( &aLayoutData
, aItemRect
);
525 Point
aPnt( VCLPoint( aPoint
) );
526 aPnt
+= aItemRect
.TopLeft();
527 nIndex
= aLayoutData
.GetIndexForPoint( aPnt
);
529 long nLen
= aLayoutData
.m_aUnicodeBoundRects
.size();
530 for ( long i
= 0; i
< nLen
; ++i
)
532 Rectangle aRect
= aLayoutData
.GetCharacterBounds(i
);
533 BOOL bInside
= aRect
.IsInside( aPnt
);
542 // -----------------------------------------------------------------------------
543 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
545 ALBSolarGuard aSolarGuard
;
546 ::osl::MutexGuard
aGuard( m_aMutex
);
548 String sText
= getText();
549 if ( ( 0 > nStartIndex
) || ( sText
.Len() <= nStartIndex
)
550 || ( 0 > nEndIndex
) || ( sText
.Len() <= nEndIndex
) )
551 throw IndexOutOfBoundsException();
553 sal_Int32 nLen
= nEndIndex
- nStartIndex
+ 1;
554 ::svt::OStringTransfer::CopyString( sText
.Copy( (USHORT
)nStartIndex
, (USHORT
)nLen
), m_pIconCtrl
);
558 // -----------------------------------------------------------------------------
559 // XAccessibleEventBroadcaster
560 // -----------------------------------------------------------------------------
561 void SAL_CALL
AccessibleIconChoiceCtrlEntry::addEventListener( const Reference
< XAccessibleEventListener
>& xListener
) throw (RuntimeException
)
565 ::osl::MutexGuard
aGuard( m_aMutex
);
567 m_nClientId
= comphelper::AccessibleEventNotifier::registerClient( );
568 comphelper::AccessibleEventNotifier::addEventListener( m_nClientId
, xListener
);
571 // -----------------------------------------------------------------------------
572 void SAL_CALL
AccessibleIconChoiceCtrlEntry::removeEventListener( const Reference
< XAccessibleEventListener
>& xListener
) throw (RuntimeException
)
576 ::osl::MutexGuard
aGuard( m_aMutex
);
578 sal_Int32 nListenerCount
= comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId
, xListener
);
579 if ( !nListenerCount
)
581 // no listeners anymore
582 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
583 // and at least to us not firing any events anymore, in case somebody calls
584 // NotifyAccessibleEvent, again
585 sal_Int32 nId
= m_nClientId
;
587 comphelper::AccessibleEventNotifier::revokeClient( nId
);
592 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException
)
596 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
598 ALBSolarGuard aSolarGuard
;
599 ::osl::MutexGuard
aGuard( m_aMutex
);
602 if ( !implIsValidRange( nIndex
, nIndex
, implGetText().getLength() ) )
603 throw IndexOutOfBoundsException();
607 sal_Unicode SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
609 ALBSolarGuard aSolarGuard
;
610 ::osl::MutexGuard
aGuard( m_aMutex
);
612 return OCommonAccessibleText::getCharacter( nIndex
);
614 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& ) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
616 ALBSolarGuard aSolarGuard
;
617 ::osl::MutexGuard
aGuard( m_aMutex
);
620 ::rtl::OUString
sText( implGetText() );
622 if ( !implIsValidIndex( nIndex
, sText
.getLength() ) )
623 throw IndexOutOfBoundsException();
625 return ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>();
627 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException
)
629 ALBSolarGuard aSolarGuard
;
630 ::osl::MutexGuard
aGuard( m_aMutex
);
632 return OCommonAccessibleText::getCharacterCount( );
635 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException
)
637 ALBSolarGuard aSolarGuard
;
638 ::osl::MutexGuard
aGuard( m_aMutex
);
640 return OCommonAccessibleText::getSelectedText( );
642 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException
)
644 ALBSolarGuard aSolarGuard
;
645 ::osl::MutexGuard
aGuard( m_aMutex
);
647 return OCommonAccessibleText::getSelectionStart( );
649 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException
)
651 ALBSolarGuard aSolarGuard
;
652 ::osl::MutexGuard
aGuard( m_aMutex
);
654 return OCommonAccessibleText::getSelectionEnd( );
656 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
658 ALBSolarGuard aSolarGuard
;
659 ::osl::MutexGuard
aGuard( m_aMutex
);
662 if ( !implIsValidRange( nStartIndex
, nEndIndex
, implGetText().getLength() ) )
663 throw IndexOutOfBoundsException();
667 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getText( ) throw (::com::sun::star::uno::RuntimeException
)
669 ALBSolarGuard aSolarGuard
;
670 ::osl::MutexGuard
aGuard( m_aMutex
);
672 return OCommonAccessibleText::getText( );
674 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
676 ALBSolarGuard aSolarGuard
;
677 ::osl::MutexGuard
aGuard( m_aMutex
);
679 return OCommonAccessibleText::getTextRange( nStartIndex
, nEndIndex
);
681 ::com::sun::star::accessibility::TextSegment SAL_CALL
AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
683 ALBSolarGuard aSolarGuard
;
684 ::osl::MutexGuard
aGuard( m_aMutex
);
686 return OCommonAccessibleText::getTextAtIndex( nIndex
,aTextType
);
688 ::com::sun::star::accessibility::TextSegment SAL_CALL
AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
690 ALBSolarGuard aSolarGuard
;
691 ::osl::MutexGuard
aGuard( m_aMutex
);
693 return OCommonAccessibleText::getTextBeforeIndex( nIndex
,aTextType
);
695 ::com::sun::star::accessibility::TextSegment SAL_CALL
AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
697 ALBSolarGuard aSolarGuard
;
698 ::osl::MutexGuard
aGuard( m_aMutex
);
701 return OCommonAccessibleText::getTextBehindIndex( nIndex
,aTextType
);
704 // -----------------------------------------------------------------------------
706 // -----------------------------------------------------------------------------
707 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) throw (RuntimeException
)
709 ::osl::MutexGuard
aGuard( m_aMutex
);
711 // three actions supported
712 return ACCESSIBLE_ACTION_COUNT
;
714 // -----------------------------------------------------------------------------
715 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
717 ALBSolarGuard aSolarGuard
;
718 ::osl::MutexGuard
aGuard( m_aMutex
);
720 sal_Bool bRet
= sal_False
;
721 checkActionIndex_Impl( nIndex
);
724 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
725 if ( pEntry
&& !pEntry
->IsSelected() )
727 m_pIconCtrl
->SetNoSelection();
728 m_pIconCtrl
->SetCursor( pEntry
);
734 // -----------------------------------------------------------------------------
735 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
737 ALBSolarGuard aSolarGuard
;
738 ::osl::MutexGuard
aGuard( m_aMutex
);
740 checkActionIndex_Impl( nIndex
);
743 static const ::rtl::OUString
sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "Select" ) );
746 // -----------------------------------------------------------------------------
747 Reference
< XAccessibleKeyBinding
> AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
749 ::osl::MutexGuard
aGuard( m_aMutex
);
751 Reference
< XAccessibleKeyBinding
> xRet
;
752 checkActionIndex_Impl( nIndex
);
756 //........................................................................
757 }// namespace accessibility
758 //........................................................................