1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx" 30*cdf0e10cSrcweir #include <accessibility/extended/accessibleiconchoicectrlentry.hxx> 31*cdf0e10cSrcweir #include <svtools/ivctrl.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 38*cdf0e10cSrcweir #include <tools/debug.hxx> 39*cdf0e10cSrcweir #include <vcl/svapp.hxx> 40*cdf0e10cSrcweir #include <vcl/controllayout.hxx> 41*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx> 42*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx> 43*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 44*cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx> 45*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 46*cdf0e10cSrcweir #include <comphelper/sequence.hxx> 47*cdf0e10cSrcweir #include <svtools/stringtransfer.hxx> 48*cdf0e10cSrcweir #include <comphelper/accessibleeventnotifier.hxx> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir #define ACCESSIBLE_ACTION_COUNT 1 51*cdf0e10cSrcweir #define AID_EXPAND 0 52*cdf0e10cSrcweir #define AID_COLLAPSE 1 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException) 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT ) 59*cdf0e10cSrcweir // only three actions 60*cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir } 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir //........................................................................ 65*cdf0e10cSrcweir namespace accessibility 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir //........................................................................ 68*cdf0e10cSrcweir // class ALBSolarGuard --------------------------------------------------------- 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir /** Aquire the solar mutex. */ 71*cdf0e10cSrcweir class ALBSolarGuard : public ::vos::OGuard 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir public: 74*cdf0e10cSrcweir inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {} 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir // class AccessibleIconChoiceCtrlEntry ----------------------------------------------------- 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 80*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 81*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 82*cdf0e10cSrcweir using namespace ::com::sun::star; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir DBG_NAME(AccessibleIconChoiceCtrlEntry) 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 87*cdf0e10cSrcweir // Ctor() and Dtor() 88*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 89*cdf0e10cSrcweir AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, 90*cdf0e10cSrcweir sal_uLong _nPos, 91*cdf0e10cSrcweir const Reference< XAccessible >& _xParent ) : 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir AccessibleIconChoiceCtrlEntry_BASE ( m_aMutex ), 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir m_pIconCtrl ( &_rIconCtrl ), 96*cdf0e10cSrcweir m_nIndex ( _nPos ), 97*cdf0e10cSrcweir m_nClientId ( 0 ), 98*cdf0e10cSrcweir m_xParent ( _xParent ) 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir Reference< XComponent > xComp( m_xParent, UNO_QUERY ); 104*cdf0e10cSrcweir if ( xComp.is() ) 105*cdf0e10cSrcweir xComp->addEventListener( this ); 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount ); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir DBG_CTOR( AccessibleIconChoiceCtrlEntry, NULL ); 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 112*cdf0e10cSrcweir void AccessibleIconChoiceCtrlEntry::disposing( const EventObject& _rSource ) 113*cdf0e10cSrcweir throw(RuntimeException) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir if ( _rSource.Source == m_xParent ) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir dispose(); 118*cdf0e10cSrcweir DBG_ASSERT( !m_xParent.is() && ( NULL == m_pIconCtrl ), "" ); 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 122*cdf0e10cSrcweir AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry() 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir DBG_DTOR( AccessibleIconChoiceCtrlEntry, NULL ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir if ( IsAlive_Impl() ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir // increment ref count to prevent double call of Dtor 129*cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 130*cdf0e10cSrcweir dispose(); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED 134*cdf0e10cSrcweir // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and 135*cdf0e10cSrcweir // in the hxx) 136*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 137*cdf0e10cSrcweir void AccessibleIconChoiceCtrlEntry::NotifyAccessibleEvent( sal_Int16 _nEventId, 138*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aOldValue, 139*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aNewValue ) 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir Reference< uno::XInterface > xSource( *this ); 142*cdf0e10cSrcweir AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir if (m_nClientId) 145*cdf0e10cSrcweir comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj ); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir #endif 148*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 149*cdf0e10cSrcweir Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir Rectangle aRect; 152*cdf0e10cSrcweir SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); 153*cdf0e10cSrcweir if ( pEntry ) 154*cdf0e10cSrcweir aRect = m_pIconCtrl->GetBoundingBox( pEntry ); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir return aRect; 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 159*cdf0e10cSrcweir Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir Rectangle aRect; 162*cdf0e10cSrcweir SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); 163*cdf0e10cSrcweir if ( pEntry ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir aRect = m_pIconCtrl->GetBoundingBox( pEntry ); 166*cdf0e10cSrcweir Point aTopLeft = aRect.TopLeft(); 167*cdf0e10cSrcweir aTopLeft += m_pIconCtrl->GetWindowExtentsRelative( NULL ).TopLeft(); 168*cdf0e10cSrcweir aRect = Rectangle( aTopLeft, aRect.GetSize() ); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir return aRect; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 174*cdf0e10cSrcweir sal_Bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir return ( !rBHelper.bDisposed && !rBHelper.bInDispose && m_pIconCtrl ); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 179*cdf0e10cSrcweir sal_Bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir sal_Bool bShowing = sal_False; 182*cdf0e10cSrcweir Reference< XAccessibleContext > m_xParentContext = 183*cdf0e10cSrcweir m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >(); 184*cdf0e10cSrcweir if( m_xParentContext.is() ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY ); 187*cdf0e10cSrcweir if( xParentComp.is() ) 188*cdf0e10cSrcweir bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) ); 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir return bShowing; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 194*cdf0e10cSrcweir Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox() throw ( lang::DisposedException ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 197*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir EnsureIsAlive(); 200*cdf0e10cSrcweir return GetBoundingBox_Impl(); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 203*cdf0e10cSrcweir Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 206*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir EnsureIsAlive(); 209*cdf0e10cSrcweir return GetBoundingBoxOnScreen_Impl(); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 212*cdf0e10cSrcweir void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const throw ( lang::DisposedException ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir if ( !IsAlive_Impl() ) 215*cdf0e10cSrcweir throw lang::DisposedException(); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 218*cdf0e10cSrcweir ::rtl::OUString AccessibleIconChoiceCtrlEntry::implGetText() 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir ::rtl::OUString sRet; 221*cdf0e10cSrcweir SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); 222*cdf0e10cSrcweir if ( pEntry ) 223*cdf0e10cSrcweir sRet = pEntry->GetDisplayText(); 224*cdf0e10cSrcweir return sRet; 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 227*cdf0e10cSrcweir Locale AccessibleIconChoiceCtrlEntry::implGetLocale() 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir Locale aLocale; 230*cdf0e10cSrcweir aLocale = Application::GetSettings().GetUILocale(); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir return aLocale; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir nStartIndex = 0; 237*cdf0e10cSrcweir nEndIndex = 0; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 240*cdf0e10cSrcweir // XTypeProvider 241*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 242*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 243*cdf0e10cSrcweir Sequence< sal_Int8 > AccessibleIconChoiceCtrlEntry::getImplementationId() throw (RuntimeException) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir static ::cppu::OImplementationId* pId = NULL; 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir if ( !pId ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex ); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir if ( !pId ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir static ::cppu::OImplementationId aId; 254*cdf0e10cSrcweir pId = &aId; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir return pId->getImplementationId(); 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 260*cdf0e10cSrcweir // XComponent 261*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 262*cdf0e10cSrcweir void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing() 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir // Send a disposing to all listeners. 267*cdf0e10cSrcweir if ( m_nClientId ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir sal_uInt32 nId = m_nClientId; 270*cdf0e10cSrcweir m_nClientId = 0; 271*cdf0e10cSrcweir comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir Reference< XComponent > xComp( m_xParent, UNO_QUERY ); 275*cdf0e10cSrcweir if ( xComp.is() ) 276*cdf0e10cSrcweir xComp->removeEventListener( this ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir m_pIconCtrl = NULL; 279*cdf0e10cSrcweir m_xParent = NULL; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 282*cdf0e10cSrcweir // XServiceInfo 283*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 284*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir return getImplementationName_Static(); 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 289*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir return getSupportedServiceNames_Static(); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 294*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); 297*cdf0e10cSrcweir const ::rtl::OUString* pSupported = aSupported.getConstArray(); 298*cdf0e10cSrcweir const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); 299*cdf0e10cSrcweir for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported ) 300*cdf0e10cSrcweir ; 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir return pSupported != pEnd; 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 305*cdf0e10cSrcweir // XServiceInfo - static methods 306*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 307*cdf0e10cSrcweir Sequence< ::rtl::OUString > AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static(void) throw( RuntimeException ) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir Sequence< ::rtl::OUString > aSupported(3); 310*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") ); 311*cdf0e10cSrcweir aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") ); 312*cdf0e10cSrcweir aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControlEntry") ); 313*cdf0e10cSrcweir return aSupported; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 316*cdf0e10cSrcweir ::rtl::OUString AccessibleIconChoiceCtrlEntry::getImplementationName_Static(void) throw( RuntimeException ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry") ); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 321*cdf0e10cSrcweir // XAccessible 322*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 323*cdf0e10cSrcweir Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) throw (RuntimeException) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir EnsureIsAlive(); 326*cdf0e10cSrcweir return this; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 329*cdf0e10cSrcweir // XAccessibleContext 330*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 331*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) throw (RuntimeException) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir return 0; // no children 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 336*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException,RuntimeException) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 341*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) throw (RuntimeException) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir EnsureIsAlive(); 346*cdf0e10cSrcweir return m_xParent; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 349*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) throw (RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir return m_nIndex; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 356*cdf0e10cSrcweir sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir return AccessibleRole::LABEL; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 361*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir // no description for every item 364*cdf0e10cSrcweir return ::rtl::OUString(); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 367*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) throw (RuntimeException) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir EnsureIsAlive(); 372*cdf0e10cSrcweir return implGetText(); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 375*cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) throw (RuntimeException) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir return new utl::AccessibleRelationSetHelper; 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 380*cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) throw (RuntimeException) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 383*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 386*cdf0e10cSrcweir Reference< XAccessibleStateSet > xStateSet = pStateSetHelper; 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir if ( IsAlive_Impl() ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); 391*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); 392*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::ENABLED ); 393*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); 394*cdf0e10cSrcweir if ( IsShowing_Impl() ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 397*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) ) 401*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::SELECTED ); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir else 404*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir return xStateSet; 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 409*cdf0e10cSrcweir Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 412*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir return implGetLocale(); 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 417*cdf0e10cSrcweir // XAccessibleComponent 418*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 419*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 424*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir return Reference< XAccessible >(); 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 429*cdf0e10cSrcweir awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getBounds( ) throw (RuntimeException) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir return AWTRectangle( GetBoundingBox() ); 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 434*cdf0e10cSrcweir awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocation( ) throw (RuntimeException) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir return AWTPoint( GetBoundingBox().TopLeft() ); 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 439*cdf0e10cSrcweir awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) throw (RuntimeException) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 444*cdf0e10cSrcweir awt::Size SAL_CALL AccessibleIconChoiceCtrlEntry::getSize( ) throw (RuntimeException) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir return AWTSize( GetBoundingBox().GetSize() ); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 449*cdf0e10cSrcweir void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) throw (RuntimeException) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir // do nothing, because no focus for each item 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 454*cdf0e10cSrcweir sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) throw (RuntimeException) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 457*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir sal_Int32 nColor = 0; 460*cdf0e10cSrcweir Reference< XAccessible > xParent = getAccessibleParent(); 461*cdf0e10cSrcweir if ( xParent.is() ) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); 464*cdf0e10cSrcweir if ( xParentComp.is() ) 465*cdf0e10cSrcweir nColor = xParentComp->getForeground(); 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir return nColor; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 471*cdf0e10cSrcweir sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) throw (RuntimeException) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 474*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir sal_Int32 nColor = 0; 477*cdf0e10cSrcweir Reference< XAccessible > xParent = getAccessibleParent(); 478*cdf0e10cSrcweir if ( xParent.is() ) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); 481*cdf0e10cSrcweir if ( xParentComp.is() ) 482*cdf0e10cSrcweir nColor = xParentComp->getBackground(); 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir return nColor; 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 488*cdf0e10cSrcweir // XAccessibleText 489*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 490*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 491*cdf0e10cSrcweir awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 494*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir if ( ( 0 > _nIndex ) || ( getCharacterCount() <= _nIndex ) ) 497*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir awt::Rectangle aBounds( 0, 0, 0, 0 ); 500*cdf0e10cSrcweir if ( m_pIconCtrl ) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir Rectangle aItemRect = GetBoundingBox_Impl(); 503*cdf0e10cSrcweir Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); 504*cdf0e10cSrcweir aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); 505*cdf0e10cSrcweir aBounds = AWTRectangle( aCharRect ); 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir return aBounds; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 511*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 514*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir sal_Int32 nIndex = -1; 517*cdf0e10cSrcweir if ( m_pIconCtrl ) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir ::vcl::ControlLayoutData aLayoutData; 520*cdf0e10cSrcweir Rectangle aItemRect = GetBoundingBox_Impl(); 521*cdf0e10cSrcweir m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); 522*cdf0e10cSrcweir Point aPnt( VCLPoint( aPoint ) ); 523*cdf0e10cSrcweir aPnt += aItemRect.TopLeft(); 524*cdf0e10cSrcweir nIndex = aLayoutData.GetIndexForPoint( aPnt ); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir long nLen = aLayoutData.m_aUnicodeBoundRects.size(); 527*cdf0e10cSrcweir for ( long i = 0; i < nLen; ++i ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir Rectangle aRect = aLayoutData.GetCharacterBounds(i); 530*cdf0e10cSrcweir sal_Bool bInside = aRect.IsInside( aPnt ); 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir if ( bInside ) 533*cdf0e10cSrcweir break; 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir return nIndex; 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 540*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 543*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir String sText = getText(); 546*cdf0e10cSrcweir if ( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex ) 547*cdf0e10cSrcweir || ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) ) 548*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir sal_Int32 nLen = nEndIndex - nStartIndex + 1; 551*cdf0e10cSrcweir ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), m_pIconCtrl ); 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir return sal_True; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 556*cdf0e10cSrcweir // XAccessibleEventBroadcaster 557*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 558*cdf0e10cSrcweir void SAL_CALL AccessibleIconChoiceCtrlEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir if (xListener.is()) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 563*cdf0e10cSrcweir if (!m_nClientId) 564*cdf0e10cSrcweir m_nClientId = comphelper::AccessibleEventNotifier::registerClient( ); 565*cdf0e10cSrcweir comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener ); 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 569*cdf0e10cSrcweir void SAL_CALL AccessibleIconChoiceCtrlEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir if (xListener.is()) 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); 576*cdf0e10cSrcweir if ( !nListenerCount ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir // no listeners anymore 579*cdf0e10cSrcweir // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), 580*cdf0e10cSrcweir // and at least to us not firing any events anymore, in case somebody calls 581*cdf0e10cSrcweir // NotifyAccessibleEvent, again 582*cdf0e10cSrcweir sal_Int32 nId = m_nClientId; 583*cdf0e10cSrcweir m_nClientId = 0; 584*cdf0e10cSrcweir comphelper::AccessibleEventNotifier::revokeClient( nId ); 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir } 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir return -1; 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 596*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 597*cdf0e10cSrcweir EnsureIsAlive(); 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) 600*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir return sal_False; 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 607*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 608*cdf0e10cSrcweir EnsureIsAlive(); 609*cdf0e10cSrcweir return OCommonAccessibleText::getCharacter( nIndex ); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir ::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) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 614*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 615*cdf0e10cSrcweir EnsureIsAlive(); 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir ::rtl::OUString sText( implGetText() ); 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir if ( !implIsValidIndex( nIndex, sText.getLength() ) ) 620*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 627*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 628*cdf0e10cSrcweir EnsureIsAlive(); 629*cdf0e10cSrcweir return OCommonAccessibleText::getCharacterCount( ); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 635*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 636*cdf0e10cSrcweir EnsureIsAlive(); 637*cdf0e10cSrcweir return OCommonAccessibleText::getSelectedText( ); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 642*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 643*cdf0e10cSrcweir EnsureIsAlive(); 644*cdf0e10cSrcweir return OCommonAccessibleText::getSelectionStart( ); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 649*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 650*cdf0e10cSrcweir EnsureIsAlive(); 651*cdf0e10cSrcweir return OCommonAccessibleText::getSelectionEnd( ); 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 656*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 657*cdf0e10cSrcweir EnsureIsAlive(); 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) 660*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir return sal_False; 663*cdf0e10cSrcweir } 664*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) throw (::com::sun::star::uno::RuntimeException) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 667*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 668*cdf0e10cSrcweir EnsureIsAlive(); 669*cdf0e10cSrcweir return OCommonAccessibleText::getText( ); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 674*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 675*cdf0e10cSrcweir EnsureIsAlive(); 676*cdf0e10cSrcweir return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir ::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) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 681*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 682*cdf0e10cSrcweir EnsureIsAlive(); 683*cdf0e10cSrcweir return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir ::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) 686*cdf0e10cSrcweir { 687*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 688*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 689*cdf0e10cSrcweir EnsureIsAlive(); 690*cdf0e10cSrcweir return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir ::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) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 695*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 696*cdf0e10cSrcweir EnsureIsAlive(); 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 702*cdf0e10cSrcweir // XAccessibleAction 703*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 704*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) throw (RuntimeException) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir // three actions supported 709*cdf0e10cSrcweir return ACCESSIBLE_ACTION_COUNT; 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 712*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 715*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir sal_Bool bRet = sal_False; 718*cdf0e10cSrcweir checkActionIndex_Impl( nIndex ); 719*cdf0e10cSrcweir EnsureIsAlive(); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); 722*cdf0e10cSrcweir if ( pEntry && !pEntry->IsSelected() ) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir m_pIconCtrl->SetNoSelection(); 725*cdf0e10cSrcweir m_pIconCtrl->SetCursor( pEntry ); 726*cdf0e10cSrcweir bRet = sal_True; 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir return bRet; 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 732*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir ALBSolarGuard aSolarGuard; 735*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir checkActionIndex_Impl( nIndex ); 738*cdf0e10cSrcweir EnsureIsAlive(); 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "Select" ) ); 741*cdf0e10cSrcweir return sActionDesc; 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 744*cdf0e10cSrcweir Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir Reference< XAccessibleKeyBinding > xRet; 749*cdf0e10cSrcweir checkActionIndex_Impl( nIndex ); 750*cdf0e10cSrcweir // ... which key? 751*cdf0e10cSrcweir return xRet; 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir //........................................................................ 754*cdf0e10cSrcweir }// namespace accessibility 755*cdf0e10cSrcweir //........................................................................ 756*cdf0e10cSrcweir 757