1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_accessibility.hxx"
30 #include <accessibility/extended/accessibleiconchoicectrlentry.hxx>
31 #include <svtools/ivctrl.hxx>
32 #include <com/sun/star/awt/Point.hpp>
33 #include <com/sun/star/awt/Rectangle.hpp>
34 #include <com/sun/star/awt/Size.hpp>
35 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36 #include <com/sun/star/accessibility/AccessibleRole.hpp>
37 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
38 #include <tools/debug.hxx>
39 #include <vcl/svapp.hxx>
40 #include <vcl/controllayout.hxx>
41 #include <toolkit/awt/vclxwindow.hxx>
42 #include <toolkit/helper/convert.hxx>
43 #include <unotools/accessiblestatesethelper.hxx>
44 #include <unotools/accessiblerelationsethelper.hxx>
45 #include <cppuhelper/typeprovider.hxx>
46 #include <comphelper/sequence.hxx>
47 #include <svtools/stringtransfer.hxx>
48 #include <comphelper/accessibleeventnotifier.hxx>
50 #define ACCESSIBLE_ACTION_COUNT 1
52 #define AID_COLLAPSE 1
56 void checkActionIndex_Impl( sal_Int32 _nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
)
58 if ( _nIndex
< 0 || _nIndex
>= ACCESSIBLE_ACTION_COUNT
)
60 throw ::com::sun::star::lang::IndexOutOfBoundsException();
64 //........................................................................
65 namespace accessibility
67 //........................................................................
68 // class ALBSolarGuard ---------------------------------------------------------
70 /** Aquire the solar mutex. */
71 class ALBSolarGuard
: public ::vos::OGuard
74 inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
77 // class AccessibleIconChoiceCtrlEntry -----------------------------------------------------
79 using namespace ::com::sun::star::accessibility
;
80 using namespace ::com::sun::star::uno
;
81 using namespace ::com::sun::star::lang
;
82 using namespace ::com::sun::star
;
84 DBG_NAME(AccessibleIconChoiceCtrlEntry
)
86 // -----------------------------------------------------------------------------
88 // -----------------------------------------------------------------------------
89 AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl
& _rIconCtrl
,
91 const Reference
< XAccessible
>& _xParent
) :
93 AccessibleIconChoiceCtrlEntry_BASE ( m_aMutex
),
95 m_pIconCtrl ( &_rIconCtrl
),
98 m_xParent ( _xParent
)
101 osl_incrementInterlockedCount( &m_refCount
);
103 Reference
< XComponent
> xComp( m_xParent
, UNO_QUERY
);
105 xComp
->addEventListener( this );
107 osl_decrementInterlockedCount( &m_refCount
);
109 DBG_CTOR( AccessibleIconChoiceCtrlEntry
, NULL
);
111 // -----------------------------------------------------------------------------
112 void AccessibleIconChoiceCtrlEntry::disposing( const EventObject
& _rSource
)
113 throw(RuntimeException
)
115 if ( _rSource
.Source
== m_xParent
)
118 DBG_ASSERT( !m_xParent
.is() && ( NULL
== m_pIconCtrl
), "" );
121 // -----------------------------------------------------------------------------
122 AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry()
124 DBG_DTOR( AccessibleIconChoiceCtrlEntry
, NULL
);
126 if ( IsAlive_Impl() )
128 // increment ref count to prevent double call of Dtor
129 osl_incrementInterlockedCount( &m_refCount
);
133 #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED
134 // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and
136 // -----------------------------------------------------------------------------
137 void AccessibleIconChoiceCtrlEntry::NotifyAccessibleEvent( sal_Int16 _nEventId
,
138 const ::com::sun::star::uno::Any
& _aOldValue
,
139 const ::com::sun::star::uno::Any
& _aNewValue
)
141 Reference
< uno::XInterface
> xSource( *this );
142 AccessibleEventObject
aEventObj( xSource
, _nEventId
, _aNewValue
, _aOldValue
);
145 comphelper::AccessibleEventNotifier::addEvent( m_nClientId
, aEventObj
);
148 // -----------------------------------------------------------------------------
149 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const
152 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
154 aRect
= m_pIconCtrl
->GetBoundingBox( pEntry
);
158 // -----------------------------------------------------------------------------
159 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const
162 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
165 aRect
= m_pIconCtrl
->GetBoundingBox( pEntry
);
166 Point aTopLeft
= aRect
.TopLeft();
167 aTopLeft
+= m_pIconCtrl
->GetWindowExtentsRelative( NULL
).TopLeft();
168 aRect
= Rectangle( aTopLeft
, aRect
.GetSize() );
173 // -----------------------------------------------------------------------------
174 sal_Bool
AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const
176 return ( !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
&& m_pIconCtrl
);
178 // -----------------------------------------------------------------------------
179 sal_Bool
AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const
181 sal_Bool bShowing
= sal_False
;
182 Reference
< XAccessibleContext
> m_xParentContext
=
183 m_xParent
.is() ? m_xParent
->getAccessibleContext() : Reference
< XAccessibleContext
>();
184 if( m_xParentContext
.is() )
186 Reference
< XAccessibleComponent
> xParentComp( m_xParentContext
, uno::UNO_QUERY
);
187 if( xParentComp
.is() )
188 bShowing
= GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp
->getBounds() ) );
193 // -----------------------------------------------------------------------------
194 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBox() throw ( lang::DisposedException
)
196 ALBSolarGuard aSolarGuard
;
197 ::osl::MutexGuard
aGuard( m_aMutex
);
200 return GetBoundingBox_Impl();
202 // -----------------------------------------------------------------------------
203 Rectangle
AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException
)
205 ALBSolarGuard aSolarGuard
;
206 ::osl::MutexGuard
aGuard( m_aMutex
);
209 return GetBoundingBoxOnScreen_Impl();
211 // -----------------------------------------------------------------------------
212 void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const throw ( lang::DisposedException
)
214 if ( !IsAlive_Impl() )
215 throw lang::DisposedException();
217 // -----------------------------------------------------------------------------
218 ::rtl::OUString
AccessibleIconChoiceCtrlEntry::implGetText()
220 ::rtl::OUString sRet
;
221 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
223 sRet
= pEntry
->GetDisplayText();
226 // -----------------------------------------------------------------------------
227 Locale
AccessibleIconChoiceCtrlEntry::implGetLocale()
230 aLocale
= Application::GetSettings().GetUILocale();
234 void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
)
239 // -----------------------------------------------------------------------------
241 // -----------------------------------------------------------------------------
242 // -----------------------------------------------------------------------------
243 Sequence
< sal_Int8
> AccessibleIconChoiceCtrlEntry::getImplementationId() throw (RuntimeException
)
245 static ::cppu::OImplementationId
* pId
= NULL
;
249 ::osl::Guard
< ::osl::Mutex
> aGuard( m_aMutex
);
253 static ::cppu::OImplementationId aId
;
257 return pId
->getImplementationId();
259 // -----------------------------------------------------------------------------
261 // -----------------------------------------------------------------------------
262 void SAL_CALL
AccessibleIconChoiceCtrlEntry::disposing()
264 ::osl::MutexGuard
aGuard( m_aMutex
);
266 // Send a disposing to all listeners.
269 sal_uInt32 nId
= m_nClientId
;
271 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId
, *this );
274 Reference
< XComponent
> xComp( m_xParent
, UNO_QUERY
);
276 xComp
->removeEventListener( this );
281 // -----------------------------------------------------------------------------
283 // -----------------------------------------------------------------------------
284 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException
)
286 return getImplementationName_Static();
288 // -----------------------------------------------------------------------------
289 Sequence
< ::rtl::OUString
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException
)
291 return getSupportedServiceNames_Static();
293 // -----------------------------------------------------------------------------
294 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::supportsService( const ::rtl::OUString
& _rServiceName
) throw (RuntimeException
)
296 Sequence
< ::rtl::OUString
> aSupported( getSupportedServiceNames() );
297 const ::rtl::OUString
* pSupported
= aSupported
.getConstArray();
298 const ::rtl::OUString
* pEnd
= pSupported
+ aSupported
.getLength();
299 for ( ; pSupported
!= pEnd
&& !pSupported
->equals(_rServiceName
); ++pSupported
)
302 return pSupported
!= pEnd
;
304 // -----------------------------------------------------------------------------
305 // XServiceInfo - static methods
306 // -----------------------------------------------------------------------------
307 Sequence
< ::rtl::OUString
> AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static(void) throw( RuntimeException
)
309 Sequence
< ::rtl::OUString
> aSupported(3);
310 aSupported
[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
311 aSupported
[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
312 aSupported
[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControlEntry") );
315 // -----------------------------------------------------------------------------
316 ::rtl::OUString
AccessibleIconChoiceCtrlEntry::getImplementationName_Static(void) throw( RuntimeException
)
318 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry") );
320 // -----------------------------------------------------------------------------
322 // -----------------------------------------------------------------------------
323 Reference
< XAccessibleContext
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) throw (RuntimeException
)
328 // -----------------------------------------------------------------------------
329 // XAccessibleContext
330 // -----------------------------------------------------------------------------
331 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) throw (RuntimeException
)
333 return 0; // no children
335 // -----------------------------------------------------------------------------
336 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int32
) throw (IndexOutOfBoundsException
,RuntimeException
)
338 throw IndexOutOfBoundsException();
340 // -----------------------------------------------------------------------------
341 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) throw (RuntimeException
)
343 ::osl::MutexGuard
aGuard( m_aMutex
);
348 // -----------------------------------------------------------------------------
349 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) throw (RuntimeException
)
351 ::osl::MutexGuard
aGuard( m_aMutex
);
355 // -----------------------------------------------------------------------------
356 sal_Int16 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException
)
358 return AccessibleRole::LABEL
;
360 // -----------------------------------------------------------------------------
361 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException
)
363 // no description for every item
364 return ::rtl::OUString();
366 // -----------------------------------------------------------------------------
367 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleName( ) throw (RuntimeException
)
369 ::osl::MutexGuard
aGuard( m_aMutex
);
372 return implGetText();
374 // -----------------------------------------------------------------------------
375 Reference
< XAccessibleRelationSet
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) throw (RuntimeException
)
377 return new utl::AccessibleRelationSetHelper
;
379 // -----------------------------------------------------------------------------
380 Reference
< XAccessibleStateSet
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) throw (RuntimeException
)
382 ALBSolarGuard aSolarGuard
;
383 ::osl::MutexGuard
aGuard( m_aMutex
);
385 utl::AccessibleStateSetHelper
* pStateSetHelper
= new utl::AccessibleStateSetHelper
;
386 Reference
< XAccessibleStateSet
> xStateSet
= pStateSetHelper
;
388 if ( IsAlive_Impl() )
390 pStateSetHelper
->AddState( AccessibleStateType::TRANSIENT
);
391 pStateSetHelper
->AddState( AccessibleStateType::SELECTABLE
);
392 pStateSetHelper
->AddState( AccessibleStateType::ENABLED
);
393 pStateSetHelper
->AddState( AccessibleStateType::SENSITIVE
);
394 if ( IsShowing_Impl() )
396 pStateSetHelper
->AddState( AccessibleStateType::SHOWING
);
397 pStateSetHelper
->AddState( AccessibleStateType::VISIBLE
);
400 if ( m_pIconCtrl
&& m_pIconCtrl
->GetCursor() == m_pIconCtrl
->GetEntry( m_nIndex
) )
401 pStateSetHelper
->AddState( AccessibleStateType::SELECTED
);
404 pStateSetHelper
->AddState( AccessibleStateType::DEFUNC
);
408 // -----------------------------------------------------------------------------
409 Locale SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocale( ) throw (IllegalAccessibleComponentStateException
, RuntimeException
)
411 ALBSolarGuard aSolarGuard
;
412 ::osl::MutexGuard
aGuard( m_aMutex
);
414 return implGetLocale();
416 // -----------------------------------------------------------------------------
417 // XAccessibleComponent
418 // -----------------------------------------------------------------------------
419 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::containsPoint( const awt::Point
& rPoint
) throw (RuntimeException
)
421 return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint
) );
423 // -----------------------------------------------------------------------------
424 Reference
< XAccessible
> SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point
& ) throw (RuntimeException
)
426 return Reference
< XAccessible
>();
428 // -----------------------------------------------------------------------------
429 awt::Rectangle SAL_CALL
AccessibleIconChoiceCtrlEntry::getBounds( ) throw (RuntimeException
)
431 return AWTRectangle( GetBoundingBox() );
433 // -----------------------------------------------------------------------------
434 awt::Point SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocation( ) throw (RuntimeException
)
436 return AWTPoint( GetBoundingBox().TopLeft() );
438 // -----------------------------------------------------------------------------
439 awt::Point SAL_CALL
AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) throw (RuntimeException
)
441 return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
443 // -----------------------------------------------------------------------------
444 awt::Size SAL_CALL
AccessibleIconChoiceCtrlEntry::getSize( ) throw (RuntimeException
)
446 return AWTSize( GetBoundingBox().GetSize() );
448 // -----------------------------------------------------------------------------
449 void SAL_CALL
AccessibleIconChoiceCtrlEntry::grabFocus( ) throw (RuntimeException
)
451 // do nothing, because no focus for each item
453 // -----------------------------------------------------------------------------
454 sal_Int32
AccessibleIconChoiceCtrlEntry::getForeground( ) throw (RuntimeException
)
456 ALBSolarGuard aSolarGuard
;
457 ::osl::MutexGuard
aGuard( m_aMutex
);
459 sal_Int32 nColor
= 0;
460 Reference
< XAccessible
> xParent
= getAccessibleParent();
463 Reference
< XAccessibleComponent
> xParentComp( xParent
->getAccessibleContext(), UNO_QUERY
);
464 if ( xParentComp
.is() )
465 nColor
= xParentComp
->getForeground();
470 // -----------------------------------------------------------------------------
471 sal_Int32
AccessibleIconChoiceCtrlEntry::getBackground( ) throw (RuntimeException
)
473 ALBSolarGuard aSolarGuard
;
474 ::osl::MutexGuard
aGuard( m_aMutex
);
476 sal_Int32 nColor
= 0;
477 Reference
< XAccessible
> xParent
= getAccessibleParent();
480 Reference
< XAccessibleComponent
> xParentComp( xParent
->getAccessibleContext(), UNO_QUERY
);
481 if ( xParentComp
.is() )
482 nColor
= xParentComp
->getBackground();
487 // -----------------------------------------------------------------------------
489 // -----------------------------------------------------------------------------
490 // -----------------------------------------------------------------------------
491 awt::Rectangle SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
493 ALBSolarGuard aSolarGuard
;
494 ::osl::MutexGuard
aGuard( m_aMutex
);
496 if ( ( 0 > _nIndex
) || ( getCharacterCount() <= _nIndex
) )
497 throw IndexOutOfBoundsException();
499 awt::Rectangle
aBounds( 0, 0, 0, 0 );
502 Rectangle aItemRect
= GetBoundingBox_Impl();
503 Rectangle aCharRect
= m_pIconCtrl
->GetEntryCharacterBounds( m_nIndex
, _nIndex
);
504 aCharRect
.Move( -aItemRect
.Left(), -aItemRect
.Top() );
505 aBounds
= AWTRectangle( aCharRect
);
510 // -----------------------------------------------------------------------------
511 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point
& aPoint
) throw (RuntimeException
)
513 ALBSolarGuard aSolarGuard
;
514 ::osl::MutexGuard
aGuard( m_aMutex
);
516 sal_Int32 nIndex
= -1;
519 ::vcl::ControlLayoutData aLayoutData
;
520 Rectangle aItemRect
= GetBoundingBox_Impl();
521 m_pIconCtrl
->RecordLayoutData( &aLayoutData
, aItemRect
);
522 Point
aPnt( VCLPoint( aPoint
) );
523 aPnt
+= aItemRect
.TopLeft();
524 nIndex
= aLayoutData
.GetIndexForPoint( aPnt
);
526 long nLen
= aLayoutData
.m_aUnicodeBoundRects
.size();
527 for ( long i
= 0; i
< nLen
; ++i
)
529 Rectangle aRect
= aLayoutData
.GetCharacterBounds(i
);
530 sal_Bool bInside
= aRect
.IsInside( aPnt
);
539 // -----------------------------------------------------------------------------
540 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
542 ALBSolarGuard aSolarGuard
;
543 ::osl::MutexGuard
aGuard( m_aMutex
);
545 String sText
= getText();
546 if ( ( 0 > nStartIndex
) || ( sText
.Len() <= nStartIndex
)
547 || ( 0 > nEndIndex
) || ( sText
.Len() <= nEndIndex
) )
548 throw IndexOutOfBoundsException();
550 sal_Int32 nLen
= nEndIndex
- nStartIndex
+ 1;
551 ::svt::OStringTransfer::CopyString( sText
.Copy( (sal_uInt16
)nStartIndex
, (sal_uInt16
)nLen
), m_pIconCtrl
);
555 // -----------------------------------------------------------------------------
556 // XAccessibleEventBroadcaster
557 // -----------------------------------------------------------------------------
558 void SAL_CALL
AccessibleIconChoiceCtrlEntry::addEventListener( const Reference
< XAccessibleEventListener
>& xListener
) throw (RuntimeException
)
562 ::osl::MutexGuard
aGuard( m_aMutex
);
564 m_nClientId
= comphelper::AccessibleEventNotifier::registerClient( );
565 comphelper::AccessibleEventNotifier::addEventListener( m_nClientId
, xListener
);
568 // -----------------------------------------------------------------------------
569 void SAL_CALL
AccessibleIconChoiceCtrlEntry::removeEventListener( const Reference
< XAccessibleEventListener
>& xListener
) throw (RuntimeException
)
573 ::osl::MutexGuard
aGuard( m_aMutex
);
575 sal_Int32 nListenerCount
= comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId
, xListener
);
576 if ( !nListenerCount
)
578 // no listeners anymore
579 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
580 // and at least to us not firing any events anymore, in case somebody calls
581 // NotifyAccessibleEvent, again
582 sal_Int32 nId
= m_nClientId
;
584 comphelper::AccessibleEventNotifier::revokeClient( nId
);
589 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException
)
593 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
595 ALBSolarGuard aSolarGuard
;
596 ::osl::MutexGuard
aGuard( m_aMutex
);
599 if ( !implIsValidRange( nIndex
, nIndex
, implGetText().getLength() ) )
600 throw IndexOutOfBoundsException();
604 sal_Unicode SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
606 ALBSolarGuard aSolarGuard
;
607 ::osl::MutexGuard
aGuard( m_aMutex
);
609 return OCommonAccessibleText::getCharacter( nIndex
);
611 ::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
)
613 ALBSolarGuard aSolarGuard
;
614 ::osl::MutexGuard
aGuard( m_aMutex
);
617 ::rtl::OUString
sText( implGetText() );
619 if ( !implIsValidIndex( nIndex
, sText
.getLength() ) )
620 throw IndexOutOfBoundsException();
622 return ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>();
624 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException
)
626 ALBSolarGuard aSolarGuard
;
627 ::osl::MutexGuard
aGuard( m_aMutex
);
629 return OCommonAccessibleText::getCharacterCount( );
632 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException
)
634 ALBSolarGuard aSolarGuard
;
635 ::osl::MutexGuard
aGuard( m_aMutex
);
637 return OCommonAccessibleText::getSelectedText( );
639 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException
)
641 ALBSolarGuard aSolarGuard
;
642 ::osl::MutexGuard
aGuard( m_aMutex
);
644 return OCommonAccessibleText::getSelectionStart( );
646 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException
)
648 ALBSolarGuard aSolarGuard
;
649 ::osl::MutexGuard
aGuard( m_aMutex
);
651 return OCommonAccessibleText::getSelectionEnd( );
653 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
655 ALBSolarGuard aSolarGuard
;
656 ::osl::MutexGuard
aGuard( m_aMutex
);
659 if ( !implIsValidRange( nStartIndex
, nEndIndex
, implGetText().getLength() ) )
660 throw IndexOutOfBoundsException();
664 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getText( ) throw (::com::sun::star::uno::RuntimeException
)
666 ALBSolarGuard aSolarGuard
;
667 ::osl::MutexGuard
aGuard( m_aMutex
);
669 return OCommonAccessibleText::getText( );
671 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
)
673 ALBSolarGuard aSolarGuard
;
674 ::osl::MutexGuard
aGuard( m_aMutex
);
676 return OCommonAccessibleText::getTextRange( nStartIndex
, nEndIndex
);
678 ::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
)
680 ALBSolarGuard aSolarGuard
;
681 ::osl::MutexGuard
aGuard( m_aMutex
);
683 return OCommonAccessibleText::getTextAtIndex( nIndex
,aTextType
);
685 ::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
)
687 ALBSolarGuard aSolarGuard
;
688 ::osl::MutexGuard
aGuard( m_aMutex
);
690 return OCommonAccessibleText::getTextBeforeIndex( nIndex
,aTextType
);
692 ::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
)
694 ALBSolarGuard aSolarGuard
;
695 ::osl::MutexGuard
aGuard( m_aMutex
);
698 return OCommonAccessibleText::getTextBehindIndex( nIndex
,aTextType
);
701 // -----------------------------------------------------------------------------
703 // -----------------------------------------------------------------------------
704 sal_Int32 SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) throw (RuntimeException
)
706 ::osl::MutexGuard
aGuard( m_aMutex
);
708 // three actions supported
709 return ACCESSIBLE_ACTION_COUNT
;
711 // -----------------------------------------------------------------------------
712 sal_Bool SAL_CALL
AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
714 ALBSolarGuard aSolarGuard
;
715 ::osl::MutexGuard
aGuard( m_aMutex
);
717 sal_Bool bRet
= sal_False
;
718 checkActionIndex_Impl( nIndex
);
721 SvxIconChoiceCtrlEntry
* pEntry
= m_pIconCtrl
->GetEntry( m_nIndex
);
722 if ( pEntry
&& !pEntry
->IsSelected() )
724 m_pIconCtrl
->SetNoSelection();
725 m_pIconCtrl
->SetCursor( pEntry
);
731 // -----------------------------------------------------------------------------
732 ::rtl::OUString SAL_CALL
AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
734 ALBSolarGuard aSolarGuard
;
735 ::osl::MutexGuard
aGuard( m_aMutex
);
737 checkActionIndex_Impl( nIndex
);
740 static const ::rtl::OUString
sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "Select" ) );
743 // -----------------------------------------------------------------------------
744 Reference
< XAccessibleKeyBinding
> AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
746 ::osl::MutexGuard
aGuard( m_aMutex
);
748 Reference
< XAccessibleKeyBinding
> xRet
;
749 checkActionIndex_Impl( nIndex
);
753 //........................................................................
754 }// namespace accessibility
755 //........................................................................