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_svtools.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define _SV_VALUESET_CXX 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 34*cdf0e10cSrcweir #include <vcl/svapp.hxx> 35*cdf0e10cSrcweir #include <svtools/valueset.hxx> 36*cdf0e10cSrcweir #include "valueimp.hxx" 37*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir using namespace ::com::sun::star; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir // ---------------- 44*cdf0e10cSrcweir // - ValueSetItem - 45*cdf0e10cSrcweir // ---------------- 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir ValueSetItem::ValueSetItem( ValueSet& rParent ) : 48*cdf0e10cSrcweir mrParent( rParent ), 49*cdf0e10cSrcweir mnId( 0 ), 50*cdf0e10cSrcweir mnBits( 0 ), 51*cdf0e10cSrcweir mpData( NULL ), 52*cdf0e10cSrcweir mpxAcc( NULL ) 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir // ----------------------------------------------------------------------- 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir ValueSetItem::~ValueSetItem() 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir if( mpxAcc ) 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed(); 63*cdf0e10cSrcweir delete mpxAcc; 64*cdf0e10cSrcweir } 65*cdf0e10cSrcweir } 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir // ----------------------------------------------------------------------- 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir if( !mpxAcc ) 72*cdf0e10cSrcweir mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) ); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir return *mpxAcc; 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir // ----------------------------------------------------------------------- 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir void ValueSetItem::ClearAccessible() 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir if( mpxAcc ) 82*cdf0e10cSrcweir delete mpxAcc, mpxAcc = NULL; 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // --------------- 87*cdf0e10cSrcweir // - ValueSetAcc - 88*cdf0e10cSrcweir // --------------- 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) : 91*cdf0e10cSrcweir ValueSetAccComponentBase (m_aMutex), 92*cdf0e10cSrcweir mpParent( pParent ), 93*cdf0e10cSrcweir mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ), 94*cdf0e10cSrcweir mbIsFocused(false) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir ValueSetAcc::~ValueSetAcc() 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir // ----------------------------------------------------------------------- 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir if( nEventId ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners ); 111*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ); 112*cdf0e10cSrcweir accessibility::AccessibleEventObject aEvtObject; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir aEvtObject.EventId = nEventId; 115*cdf0e10cSrcweir aEvtObject.Source = static_cast<uno::XWeak*>(this); 116*cdf0e10cSrcweir aEvtObject.NewValue = rNewValue; 117*cdf0e10cSrcweir aEvtObject.OldValue = rOldValue; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir while( aIter != aTmpListeners.end() ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir try 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir (*aIter)->notifyEvent( aEvtObject ); 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir catch( uno::Exception& ) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir aIter++; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId() 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir if( !aSeq.getLength() ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir static osl::Mutex aCreateMutex; 143*cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( aCreateMutex ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir aSeq.realloc( 16 ); 146*cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir return aSeq; 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData ) 155*cdf0e10cSrcweir throw() 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir try 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY ); 160*cdf0e10cSrcweir return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : NULL ); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& ) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir return NULL; 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir void ValueSetAcc::GetFocus (void) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir mbIsFocused = true; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // Boradcast the state change. 176*cdf0e10cSrcweir ::com::sun::star::uno::Any aOldState, aNewState; 177*cdf0e10cSrcweir aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; 178*cdf0e10cSrcweir FireAccessibleEvent( 179*cdf0e10cSrcweir ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, 180*cdf0e10cSrcweir aOldState, aNewState); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir void ValueSetAcc::LoseFocus (void) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir mbIsFocused = false; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // Boradcast the state change. 190*cdf0e10cSrcweir ::com::sun::star::uno::Any aOldState, aNewState; 191*cdf0e10cSrcweir aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; 192*cdf0e10cSrcweir FireAccessibleEvent( 193*cdf0e10cSrcweir ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, 194*cdf0e10cSrcweir aOldState, aNewState); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext() 200*cdf0e10cSrcweir throw (uno::RuntimeException) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir ThrowIfDisposed(); 203*cdf0e10cSrcweir return this; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount() 209*cdf0e10cSrcweir throw (uno::RuntimeException) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 212*cdf0e10cSrcweir ThrowIfDisposed(); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir sal_Int32 nCount = mpParent->ImplGetVisibleItemCount(); 215*cdf0e10cSrcweir if (HasNoneField()) 216*cdf0e10cSrcweir nCount += 1; 217*cdf0e10cSrcweir return nCount; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleChild( sal_Int32 i ) 223*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir ThrowIfDisposed(); 226*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 227*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 228*cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i)); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir if( pItem ) 231*cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); 232*cdf0e10cSrcweir else 233*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir return xRet; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleParent() 241*cdf0e10cSrcweir throw (uno::RuntimeException) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir ThrowIfDisposed(); 244*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 245*cdf0e10cSrcweir Window* pParent = mpParent->GetParent(); 246*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir if( pParent ) 249*cdf0e10cSrcweir xRet = pParent->GetAccessible(); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir return xRet; 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent() 257*cdf0e10cSrcweir throw (uno::RuntimeException) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir ThrowIfDisposed(); 260*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 261*cdf0e10cSrcweir Window* pParent = mpParent->GetParent(); 262*cdf0e10cSrcweir sal_Int32 nRet = 0; 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir if( pParent ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir sal_Bool bFound = sal_False; 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = pParent->GetChildCount(); ( i < nCount ) && !bFound; i++ ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir if( pParent->GetChild( i ) == mpParent ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir nRet = i; 273*cdf0e10cSrcweir bFound = sal_True; 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir return nRet; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole() 284*cdf0e10cSrcweir throw (uno::RuntimeException) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir ThrowIfDisposed(); 287*cdf0e10cSrcweir // #i73746# As the Java Access Bridge (v 2.0.1) uses "managesDescendants" 288*cdf0e10cSrcweir // always if the role is LIST, we need a different role in this case 289*cdf0e10cSrcweir return (mbIsTransientChildrenDisabled 290*cdf0e10cSrcweir ? accessibility::AccessibleRole::PANEL 291*cdf0e10cSrcweir : accessibility::AccessibleRole::LIST ); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleDescription() 297*cdf0e10cSrcweir throw (uno::RuntimeException) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir ThrowIfDisposed(); 300*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 301*cdf0e10cSrcweir String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) ); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir return aRet; 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleName() 309*cdf0e10cSrcweir throw (uno::RuntimeException) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir ThrowIfDisposed(); 312*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 313*cdf0e10cSrcweir String aRet; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir if ( mpParent ) 316*cdf0e10cSrcweir aRet = mpParent->GetAccessibleName(); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir if ( !aRet.Len() ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir Window* pLabel = mpParent->GetAccessibleRelationLabeledBy(); 321*cdf0e10cSrcweir if ( pLabel && pLabel != mpParent ) 322*cdf0e10cSrcweir aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() ); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir return aRet; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::getAccessibleRelationSet() 331*cdf0e10cSrcweir throw (uno::RuntimeException) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir ThrowIfDisposed(); 334*cdf0e10cSrcweir return uno::Reference< accessibility::XAccessibleRelationSet >(); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet() 340*cdf0e10cSrcweir throw (uno::RuntimeException) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir ThrowIfDisposed(); 343*cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper(); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir // Set some states. 346*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::ENABLED); 347*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE); 348*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SHOWING); 349*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE); 350*cdf0e10cSrcweir if ( !mbIsTransientChildrenDisabled ) 351*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS); 352*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE); 353*cdf0e10cSrcweir if (mbIsFocused) 354*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir return pStateSet; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir lang::Locale SAL_CALL ValueSetAcc::getLocale() 362*cdf0e10cSrcweir throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir ThrowIfDisposed(); 365*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 366*cdf0e10cSrcweir const ::rtl::OUString aEmptyStr; 367*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() ); 368*cdf0e10cSrcweir lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir if( xParent.is() ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir if( xParentContext.is() ) 375*cdf0e10cSrcweir aRet = xParentContext->getLocale (); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir return aRet; 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) 384*cdf0e10cSrcweir throw (uno::RuntimeException) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir ThrowIfDisposed(); 387*cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if( rxListener.is() ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin(); 392*cdf0e10cSrcweir sal_Bool bFound = sal_False; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir if( *aIter == rxListener ) 397*cdf0e10cSrcweir bFound = sal_True; 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir aIter++; 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir if (!bFound) 403*cdf0e10cSrcweir mxEventListeners.push_back( rxListener ); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) 410*cdf0e10cSrcweir throw (uno::RuntimeException) 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir ThrowIfDisposed(); 413*cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir if( rxListener.is() ) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin(); 418*cdf0e10cSrcweir sal_Bool bFound = sal_False; 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) ) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir if( *aIter == rxListener ) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir mxEventListeners.erase( aIter ); 425*cdf0e10cSrcweir bFound = sal_True; 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir else 428*cdf0e10cSrcweir aIter++; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir sal_Bool SAL_CALL ValueSetAcc::containsPoint( const awt::Point& aPoint ) 436*cdf0e10cSrcweir throw (uno::RuntimeException) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir ThrowIfDisposed(); 439*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 440*cdf0e10cSrcweir const Point aSize( aRect.Width, aRect.Height ); 441*cdf0e10cSrcweir const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y ); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint ); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleAtPoint( const awt::Point& aPoint ) 449*cdf0e10cSrcweir throw (uno::RuntimeException) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir ThrowIfDisposed(); 452*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 453*cdf0e10cSrcweir const sal_uInt16 nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) ); 454*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir if( VALUESET_ITEM_NOTFOUND != nItemId ) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir const sal_uInt16 nItemPos = mpParent->GetItemPos( nItemId ); 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir if( VALUESET_ITEM_NONEITEM != nItemPos ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir ValueSetItem* pItem = mpParent->mpImpl->mpItemList->GetObject( nItemPos ); 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir if( ( pItem->meType != VALUESETITEM_SPACE ) && !pItem->maRect.IsEmpty() ) 465*cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir return xRet; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir awt::Rectangle SAL_CALL ValueSetAcc::getBounds() 475*cdf0e10cSrcweir throw (uno::RuntimeException) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir ThrowIfDisposed(); 478*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 479*cdf0e10cSrcweir const Point aOutPos( mpParent->GetPosPixel() ); 480*cdf0e10cSrcweir const Size aOutSize( mpParent->GetOutputSizePixel() ); 481*cdf0e10cSrcweir awt::Rectangle aRet; 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir aRet.X = aOutPos.X(); 484*cdf0e10cSrcweir aRet.Y = aOutPos.Y(); 485*cdf0e10cSrcweir aRet.Width = aOutSize.Width(); 486*cdf0e10cSrcweir aRet.Height = aOutSize.Height(); 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir return aRet; 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir awt::Point SAL_CALL ValueSetAcc::getLocation() 494*cdf0e10cSrcweir throw (uno::RuntimeException) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir ThrowIfDisposed(); 497*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 498*cdf0e10cSrcweir awt::Point aRet; 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir aRet.X = aRect.X; 501*cdf0e10cSrcweir aRet.Y = aRect.Y; 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir return aRet; 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen() 509*cdf0e10cSrcweir throw (uno::RuntimeException) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir ThrowIfDisposed(); 512*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 513*cdf0e10cSrcweir const Point aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) ); 514*cdf0e10cSrcweir awt::Point aRet; 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir aRet.X = aScreenPos.X(); 517*cdf0e10cSrcweir aRet.Y = aScreenPos.Y(); 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir return aRet; 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir awt::Size SAL_CALL ValueSetAcc::getSize() 525*cdf0e10cSrcweir throw (uno::RuntimeException) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir ThrowIfDisposed(); 528*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 529*cdf0e10cSrcweir awt::Size aRet; 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir aRet.Width = aRect.Width; 532*cdf0e10cSrcweir aRet.Height = aRect.Height; 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir return aRet; 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::grabFocus() 540*cdf0e10cSrcweir throw (uno::RuntimeException) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir ThrowIfDisposed(); 543*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 544*cdf0e10cSrcweir mpParent->GrabFocus(); 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir uno::Any SAL_CALL ValueSetAcc::getAccessibleKeyBinding() 550*cdf0e10cSrcweir throw (uno::RuntimeException) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir ThrowIfDisposed(); 553*cdf0e10cSrcweir return uno::Any(); 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getForeground( ) 559*cdf0e10cSrcweir throw (uno::RuntimeException) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir ThrowIfDisposed(); 562*cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor(); 563*cdf0e10cSrcweir return static_cast<sal_Int32>(nColor); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getBackground( ) 569*cdf0e10cSrcweir throw (uno::RuntimeException) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir ThrowIfDisposed(); 572*cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor(); 573*cdf0e10cSrcweir return static_cast<sal_Int32>(nColor); 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex ) 579*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir ThrowIfDisposed(); 582*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 583*cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir if(pItem != NULL) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir mpParent->SelectItem( pItem->mnId ); 588*cdf0e10cSrcweir mpParent->Select (); 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir else 591*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) 597*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir ThrowIfDisposed(); 600*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 601*cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); 602*cdf0e10cSrcweir sal_Bool bRet = sal_False; 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir if (pItem != NULL) 605*cdf0e10cSrcweir bRet = mpParent->IsItemSelected( pItem->mnId ); 606*cdf0e10cSrcweir else 607*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir return bRet; 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::clearAccessibleSelection() 615*cdf0e10cSrcweir throw (uno::RuntimeException) 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir ThrowIfDisposed(); 618*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 619*cdf0e10cSrcweir mpParent->SetNoSelection(); 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::selectAllAccessibleChildren() 625*cdf0e10cSrcweir throw (uno::RuntimeException) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir ThrowIfDisposed(); 628*cdf0e10cSrcweir // unsupported due to single selection only 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount() 634*cdf0e10cSrcweir throw (uno::RuntimeException) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir ThrowIfDisposed(); 637*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 638*cdf0e10cSrcweir sal_Int32 nRet = 0; 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = getItemCount(); i < nCount; i++ ) 641*cdf0e10cSrcweir { 642*cdf0e10cSrcweir ValueSetItem* pItem = getItem (i); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir if( pItem && mpParent->IsItemSelected( pItem->mnId ) ) 645*cdf0e10cSrcweir ++nRet; 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir return nRet; 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 654*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir ThrowIfDisposed(); 657*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 658*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = getItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ ) 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir ValueSetItem* pItem = getItem(i); 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) ) 665*cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir return xRet; 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) 674*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir ThrowIfDisposed(); 677*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 678*cdf0e10cSrcweir // Because of the single selection we can reset the whole selection when 679*cdf0e10cSrcweir // the specified child is currently selected. 680*cdf0e10cSrcweir if (isAccessibleChildSelected(nChildIndex)) 681*cdf0e10cSrcweir mpParent->SetNoSelection(); 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException ) 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir sal_Int64 nRet; 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) 691*cdf0e10cSrcweir nRet = reinterpret_cast< sal_Int64 >( this ); 692*cdf0e10cSrcweir else 693*cdf0e10cSrcweir nRet = 0; 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir return nRet; 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir void SAL_CALL ValueSetAcc::disposing (void) 702*cdf0e10cSrcweir { 703*cdf0e10cSrcweir ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy; 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir // Make a copy of the list and clear the original. 707*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 708*cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex); 709*cdf0e10cSrcweir aListenerListCopy = mxEventListeners; 710*cdf0e10cSrcweir mxEventListeners.clear(); 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir // Reset the pointer to the parent. It has to be the one who has 713*cdf0e10cSrcweir // disposed us because he is dying. 714*cdf0e10cSrcweir mpParent = NULL; 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir // Inform all listeners that this objects is disposing. 718*cdf0e10cSrcweir ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator 719*cdf0e10cSrcweir aListenerIterator (aListenerListCopy.begin()); 720*cdf0e10cSrcweir lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this)); 721*cdf0e10cSrcweir while (aListenerIterator != aListenerListCopy.end()) 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir try 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir (*aListenerIterator)->disposing (aEvent); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir catch( uno::Exception& ) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir // Ignore exceptions. 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir ++aListenerIterator; 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir sal_uInt16 ValueSetAcc::getItemCount (void) const 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir sal_uInt16 nCount = mpParent->ImplGetVisibleItemCount(); 740*cdf0e10cSrcweir // When the None-Item is visible then increase the number of items by 741*cdf0e10cSrcweir // one. 742*cdf0e10cSrcweir if (HasNoneField()) 743*cdf0e10cSrcweir nCount += 1; 744*cdf0e10cSrcweir return nCount; 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir ValueSetItem* pItem = NULL; 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir if (HasNoneField()) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir if (nIndex == 0) 755*cdf0e10cSrcweir // When present the first item is the then allways visible none field. 756*cdf0e10cSrcweir pItem = mpParent->ImplGetItem (VALUESET_ITEM_NONEITEM); 757*cdf0e10cSrcweir else 758*cdf0e10cSrcweir // Shift down the index to compensate for the none field. 759*cdf0e10cSrcweir nIndex -= 1; 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir if (pItem == NULL) 762*cdf0e10cSrcweir pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex)); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir return pItem; 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir void ValueSetAcc::ThrowIfDisposed (void) 771*cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir OSL_TRACE ("Calling disposed object. Throwing exception:"); 776*cdf0e10cSrcweir throw lang::DisposedException ( 777*cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), 778*cdf0e10cSrcweir static_cast<uno::XWeak*>(this)); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir else 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL"); 783*cdf0e10cSrcweir } 784*cdf0e10cSrcweir } 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir sal_Bool ValueSetAcc::IsDisposed (void) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir return (rBHelper.bDisposed || rBHelper.bInDispose); 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir 796*cdf0e10cSrcweir bool ValueSetAcc::HasNoneField (void) const 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir DBG_ASSERT (mpParent!=NULL, "ValueSetAcc::HasNoneField called with mpParent==NULL"); 799*cdf0e10cSrcweir return ((mpParent->GetStyle() & WB_NONEFIELD) != 0); 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir // ---------------- 806*cdf0e10cSrcweir // - ValueItemAcc - 807*cdf0e10cSrcweir // ---------------- 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir ValueItemAcc::ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ) : 810*cdf0e10cSrcweir mpParent( pParent ), 811*cdf0e10cSrcweir mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ) 812*cdf0e10cSrcweir { 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir ValueItemAcc::~ValueItemAcc() 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir // ----------------------------------------------------------------------- 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue ) 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir if( nEventId ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners ); 828*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ); 829*cdf0e10cSrcweir accessibility::AccessibleEventObject aEvtObject; 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir aEvtObject.EventId = nEventId; 832*cdf0e10cSrcweir aEvtObject.Source = static_cast<uno::XWeak*>(this); 833*cdf0e10cSrcweir aEvtObject.NewValue = rNewValue; 834*cdf0e10cSrcweir aEvtObject.OldValue = rOldValue; 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir while( aIter != aTmpListeners.end() ) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir (*aIter)->notifyEvent( aEvtObject ); 839*cdf0e10cSrcweir aIter++; 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir } 842*cdf0e10cSrcweir } 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir void ValueItemAcc::ParentDestroyed() 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex ); 849*cdf0e10cSrcweir mpParent = NULL; 850*cdf0e10cSrcweir } 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId() 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq; 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir if( !aSeq.getLength() ) 859*cdf0e10cSrcweir { 860*cdf0e10cSrcweir static osl::Mutex aCreateMutex; 861*cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( aCreateMutex ); 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir aSeq.realloc( 16 ); 864*cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir return aSeq; 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir 870*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData ) 873*cdf0e10cSrcweir throw() 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir try 876*cdf0e10cSrcweir { 877*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY ); 878*cdf0e10cSrcweir return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : NULL ); 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir return NULL; 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueItemAcc::getAccessibleContext() 889*cdf0e10cSrcweir throw (uno::RuntimeException) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir return this; 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getAccessibleChildCount() 897*cdf0e10cSrcweir throw (uno::RuntimeException) 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir return 0; 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 903*cdf0e10cSrcweir 904*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleChild( sal_Int32 ) 905*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent() 913*cdf0e10cSrcweir throw (uno::RuntimeException) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 916*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir if( mpParent ) 919*cdf0e10cSrcweir xRet = mpParent->mrParent.GetAccessible(); 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir return xRet; 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() 927*cdf0e10cSrcweir throw (uno::RuntimeException) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 930*cdf0e10cSrcweir // The index defaults to -1 to indicate the child does not belong to its 931*cdf0e10cSrcweir // parent. 932*cdf0e10cSrcweir sal_Int32 nIndexInParent = -1; 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir if( mpParent ) 935*cdf0e10cSrcweir { 936*cdf0e10cSrcweir bool bDone = false; 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir sal_uInt16 nCount = mpParent->mrParent.ImplGetVisibleItemCount(); 939*cdf0e10cSrcweir ValueSetItem* pItem; 940*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount && !bDone; i++) 941*cdf0e10cSrcweir { 942*cdf0e10cSrcweir // Guard the retrieval of the i-th child with a try/catch block 943*cdf0e10cSrcweir // just in case the number of children changes in the mean time. 944*cdf0e10cSrcweir try 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir pItem = mpParent->mrParent.ImplGetVisibleItem (i); 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir catch (lang::IndexOutOfBoundsException aException) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir pItem = NULL; 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir // Do not create an accessible object for the test. 954*cdf0e10cSrcweir if (pItem != NULL && pItem->mpxAcc != NULL) 955*cdf0e10cSrcweir if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this ) 956*cdf0e10cSrcweir { 957*cdf0e10cSrcweir nIndexInParent = i; 958*cdf0e10cSrcweir bDone = true; 959*cdf0e10cSrcweir } 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir return nIndexInParent; 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole() 969*cdf0e10cSrcweir throw (uno::RuntimeException) 970*cdf0e10cSrcweir { 971*cdf0e10cSrcweir return accessibility::AccessibleRole::LIST_ITEM; 972*cdf0e10cSrcweir } 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription() 977*cdf0e10cSrcweir throw (uno::RuntimeException) 978*cdf0e10cSrcweir { 979*cdf0e10cSrcweir return ::rtl::OUString(); 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir 982*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName() 985*cdf0e10cSrcweir throw (uno::RuntimeException) 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 988*cdf0e10cSrcweir String aRet; 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir if( mpParent ) 991*cdf0e10cSrcweir { 992*cdf0e10cSrcweir aRet = mpParent->maText; 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir if( !aRet.Len() ) 995*cdf0e10cSrcweir { 996*cdf0e10cSrcweir aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) ); 997*cdf0e10cSrcweir aRet += String::CreateFromInt32( mpParent->mnId ); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir } 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir return aRet; 1002*cdf0e10cSrcweir } 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1005*cdf0e10cSrcweir 1006*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::getAccessibleRelationSet() 1007*cdf0e10cSrcweir throw (uno::RuntimeException) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir return uno::Reference< accessibility::XAccessibleRelationSet >(); 1010*cdf0e10cSrcweir } 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet() 1015*cdf0e10cSrcweir throw (uno::RuntimeException) 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1018*cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper; 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir if( mpParent ) 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::ENABLED); 1023*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE); 1024*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SHOWING); 1025*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE); 1026*cdf0e10cSrcweir if ( !mbIsTransientChildrenDisabled ) 1027*cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::TRANSIENT); 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir // SELECTABLE 1030*cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE ); 1031*cdf0e10cSrcweir // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE ); 1032*cdf0e10cSrcweir 1033*cdf0e10cSrcweir // SELECTED 1034*cdf0e10cSrcweir if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId ) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTED ); 1037*cdf0e10cSrcweir // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED ); 1038*cdf0e10cSrcweir } 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir return pStateSet; 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1045*cdf0e10cSrcweir 1046*cdf0e10cSrcweir lang::Locale SAL_CALL ValueItemAcc::getLocale() 1047*cdf0e10cSrcweir throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException) 1048*cdf0e10cSrcweir { 1049*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1050*cdf0e10cSrcweir const ::rtl::OUString aEmptyStr; 1051*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() ); 1052*cdf0e10cSrcweir lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); 1053*cdf0e10cSrcweir 1054*cdf0e10cSrcweir if( xParent.is() ) 1055*cdf0e10cSrcweir { 1056*cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir if( xParentContext.is() ) 1059*cdf0e10cSrcweir aRet = xParentContext->getLocale(); 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir return aRet; 1063*cdf0e10cSrcweir } 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) 1068*cdf0e10cSrcweir throw (uno::RuntimeException) 1069*cdf0e10cSrcweir { 1070*cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex ); 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir if( rxListener.is() ) 1073*cdf0e10cSrcweir { 1074*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin(); 1075*cdf0e10cSrcweir sal_Bool bFound = sal_False; 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) ) 1078*cdf0e10cSrcweir { 1079*cdf0e10cSrcweir if( *aIter == rxListener ) 1080*cdf0e10cSrcweir bFound = sal_True; 1081*cdf0e10cSrcweir else 1082*cdf0e10cSrcweir aIter++; 1083*cdf0e10cSrcweir } 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir if (!bFound) 1086*cdf0e10cSrcweir mxEventListeners.push_back( rxListener ); 1087*cdf0e10cSrcweir } 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) 1093*cdf0e10cSrcweir throw (uno::RuntimeException) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex ); 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir if( rxListener.is() ) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin(); 1100*cdf0e10cSrcweir sal_Bool bFound = sal_False; 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) ) 1103*cdf0e10cSrcweir { 1104*cdf0e10cSrcweir if( *aIter == rxListener ) 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir mxEventListeners.erase( aIter ); 1107*cdf0e10cSrcweir bFound = sal_True; 1108*cdf0e10cSrcweir } 1109*cdf0e10cSrcweir else 1110*cdf0e10cSrcweir aIter++; 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir sal_Bool SAL_CALL ValueItemAcc::containsPoint( const awt::Point& aPoint ) 1118*cdf0e10cSrcweir throw (uno::RuntimeException) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 1121*cdf0e10cSrcweir const Point aSize( aRect.Width, aRect.Height ); 1122*cdf0e10cSrcweir const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y ); 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint ); 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1128*cdf0e10cSrcweir 1129*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleAtPoint( const awt::Point& ) 1130*cdf0e10cSrcweir throw (uno::RuntimeException) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet; 1133*cdf0e10cSrcweir return xRet; 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir 1136*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir awt::Rectangle SAL_CALL ValueItemAcc::getBounds() 1139*cdf0e10cSrcweir throw (uno::RuntimeException) 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1142*cdf0e10cSrcweir awt::Rectangle aRet; 1143*cdf0e10cSrcweir 1144*cdf0e10cSrcweir if( mpParent ) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir Rectangle aRect( mpParent->maRect ); 1147*cdf0e10cSrcweir Point aOrigin; 1148*cdf0e10cSrcweir Rectangle aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() ); 1149*cdf0e10cSrcweir 1150*cdf0e10cSrcweir aRect.Intersection( aParentRect ); 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir aRet.X = aRect.Left(); 1153*cdf0e10cSrcweir aRet.Y = aRect.Top(); 1154*cdf0e10cSrcweir aRet.Width = aRect.GetWidth(); 1155*cdf0e10cSrcweir aRet.Height = aRect.GetHeight(); 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir return aRet; 1159*cdf0e10cSrcweir } 1160*cdf0e10cSrcweir 1161*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1162*cdf0e10cSrcweir 1163*cdf0e10cSrcweir awt::Point SAL_CALL ValueItemAcc::getLocation() 1164*cdf0e10cSrcweir throw (uno::RuntimeException) 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 1167*cdf0e10cSrcweir awt::Point aRet; 1168*cdf0e10cSrcweir 1169*cdf0e10cSrcweir aRet.X = aRect.X; 1170*cdf0e10cSrcweir aRet.Y = aRect.Y; 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir return aRet; 1173*cdf0e10cSrcweir } 1174*cdf0e10cSrcweir 1175*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen() 1178*cdf0e10cSrcweir throw (uno::RuntimeException) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1181*cdf0e10cSrcweir awt::Point aRet; 1182*cdf0e10cSrcweir 1183*cdf0e10cSrcweir if( mpParent ) 1184*cdf0e10cSrcweir { 1185*cdf0e10cSrcweir const Point aScreenPos( mpParent->mrParent.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) ); 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir aRet.X = aScreenPos.X(); 1188*cdf0e10cSrcweir aRet.Y = aScreenPos.Y(); 1189*cdf0e10cSrcweir } 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir return aRet; 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir awt::Size SAL_CALL ValueItemAcc::getSize() 1197*cdf0e10cSrcweir throw (uno::RuntimeException) 1198*cdf0e10cSrcweir { 1199*cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() ); 1200*cdf0e10cSrcweir awt::Size aRet; 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweir aRet.Width = aRect.Width; 1203*cdf0e10cSrcweir aRet.Height = aRect.Height; 1204*cdf0e10cSrcweir 1205*cdf0e10cSrcweir return aRet; 1206*cdf0e10cSrcweir } 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir void SAL_CALL ValueItemAcc::grabFocus() 1211*cdf0e10cSrcweir throw (uno::RuntimeException) 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir // nothing to do 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir uno::Any SAL_CALL ValueItemAcc::getAccessibleKeyBinding() 1219*cdf0e10cSrcweir throw (uno::RuntimeException) 1220*cdf0e10cSrcweir { 1221*cdf0e10cSrcweir return uno::Any(); 1222*cdf0e10cSrcweir } 1223*cdf0e10cSrcweir 1224*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1225*cdf0e10cSrcweir 1226*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getForeground( ) 1227*cdf0e10cSrcweir throw (uno::RuntimeException) 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor(); 1230*cdf0e10cSrcweir return static_cast<sal_Int32>(nColor); 1231*cdf0e10cSrcweir } 1232*cdf0e10cSrcweir 1233*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1234*cdf0e10cSrcweir 1235*cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getBackground( ) 1236*cdf0e10cSrcweir throw (uno::RuntimeException) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir sal_uInt32 nColor; 1239*cdf0e10cSrcweir if (mpParent && mpParent->meType == VALUESETITEM_COLOR) 1240*cdf0e10cSrcweir nColor = mpParent->maColor.GetColor(); 1241*cdf0e10cSrcweir else 1242*cdf0e10cSrcweir nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor(); 1243*cdf0e10cSrcweir return static_cast<sal_Int32>(nColor); 1244*cdf0e10cSrcweir } 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException ) 1249*cdf0e10cSrcweir { 1250*cdf0e10cSrcweir sal_Int64 nRet; 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) 1253*cdf0e10cSrcweir nRet = reinterpret_cast< sal_Int64 >( this ); 1254*cdf0e10cSrcweir else 1255*cdf0e10cSrcweir nRet = 0; 1256*cdf0e10cSrcweir 1257*cdf0e10cSrcweir return nRet; 1258*cdf0e10cSrcweir } 1259