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