1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 28 #include "svxrectctaccessiblecontext.hxx" 29 #include <com/sun/star/accessibility/AccessibleRole.hpp> 30 #include <com/sun/star/accessibility/AccessibleEventId.hpp> 31 #include <unotools/accessiblestatesethelper.hxx> 32 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 33 #include <com/sun/star/beans/PropertyChangeEvent.hpp> 34 #include <com/sun/star/awt/XWindow.hpp> 35 #include <cppuhelper/typeprovider.hxx> 36 #include <toolkit/helper/vclunohelper.hxx> 37 #include <toolkit/helper/convert.hxx> 38 #include <vcl/svapp.hxx> 39 #include <osl/mutex.hxx> 40 #include <rtl/uuid.h> 41 #include <tools/debug.hxx> 42 #include <tools/gen.hxx> 43 44 #include <svx/dialogs.hrc> 45 #include "accessibility.hrc" 46 #include <svx/dlgctrl.hxx> 47 #include <svx/dialmgr.hxx> 48 #include <comphelper/accessibleeventnotifier.hxx> 49 50 51 using namespace ::cppu; 52 using namespace ::osl; 53 using namespace ::com::sun::star; 54 using namespace ::com::sun::star::uno; 55 using namespace ::com::sun::star::accessibility; 56 57 58 #define MAX_NUM_OF_CHILDS 9 59 #define NOCHILDSELECTED -1 60 61 62 DBG_NAME( SvxRectCtlAccessibleContext ) 63 64 65 //===== internal ============================================================ 66 67 namespace 68 { 69 struct ChildIndexToPointData 70 { 71 short nResIdName; 72 short nResIdDescr; 73 RECT_POINT ePoint; 74 }; 75 } 76 77 78 static const ChildIndexToPointData* IndexToPoint( long nIndex, sal_Bool bAngleControl ) 79 { 80 DBG_ASSERT( nIndex < ( bAngleControl? 8 : 9 ) && nIndex >= 0, "-IndexToPoint(): invalid child index! You have been warned..." ); 81 82 // angles are counted reverse counter clock wise 83 static const ChildIndexToPointData pAngleData[] = 84 { // index 85 { RID_SVXSTR_RECTCTL_ACC_CHLD_A000, RID_SVXSTR_RECTCTL_ACC_CHLD_A000, RP_RM }, // 0 86 { RID_SVXSTR_RECTCTL_ACC_CHLD_A045, RID_SVXSTR_RECTCTL_ACC_CHLD_A045, RP_RT }, // 1 87 { RID_SVXSTR_RECTCTL_ACC_CHLD_A090, RID_SVXSTR_RECTCTL_ACC_CHLD_A090, RP_MT }, // 2 88 { RID_SVXSTR_RECTCTL_ACC_CHLD_A135, RID_SVXSTR_RECTCTL_ACC_CHLD_A135, RP_LT }, // 3 89 { RID_SVXSTR_RECTCTL_ACC_CHLD_A180, RID_SVXSTR_RECTCTL_ACC_CHLD_A180, RP_LM }, // 4 90 { RID_SVXSTR_RECTCTL_ACC_CHLD_A225, RID_SVXSTR_RECTCTL_ACC_CHLD_A225, RP_LB }, // 5 91 { RID_SVXSTR_RECTCTL_ACC_CHLD_A270, RID_SVXSTR_RECTCTL_ACC_CHLD_A270, RP_MB }, // 6 92 { RID_SVXSTR_RECTCTL_ACC_CHLD_A315, RID_SVXSTR_RECTCTL_ACC_CHLD_A315, RP_RB } // 7 93 }; 94 95 // corners are counted from left to right and top to bottom 96 static const ChildIndexToPointData pCornerData[] = 97 { // index 98 { RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RP_LT }, // 0 99 { RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RP_MT }, // 1 100 { RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RP_RT }, // 2 101 { RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RP_LM }, // 3 102 { RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RP_MM }, // 4 103 { RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RP_RM }, // 5 104 { RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RP_LB }, // 6 105 { RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RP_MB }, // 7 106 { RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RP_RB } // 8 107 }; 108 109 return ( bAngleControl? pAngleData : pCornerData ) + nIndex; 110 } 111 112 113 static long PointToIndex( RECT_POINT ePoint, sal_Bool bAngleControl ) 114 { 115 long nRet( (long) ePoint ); 116 if( bAngleControl ) 117 { // angle control 118 // angles are counted reverse counter clock wise 119 switch( ePoint ) 120 { 121 case RP_LT: nRet = 3; break; 122 case RP_MT: nRet = 2; break; 123 case RP_RT: nRet = 1; break; 124 case RP_LM: nRet = 4; break; 125 case RP_MM: nRet = NOCHILDSELECTED; break; 126 case RP_RM: nRet = 0; break; 127 case RP_LB: nRet = 5; break; 128 case RP_MB: nRet = 6; break; 129 case RP_RB: nRet = 7; break; 130 } 131 } 132 else 133 { // corner control 134 // corners are counted from left to right and top to bottom 135 DBG_ASSERT( RP_LT == 0 && RP_MT == 1 && RP_RT == 2 && RP_LM == 3 && RP_MM == 4 && RP_RM == 5 && 136 RP_LB == 6 && RP_MB == 7 && RP_RB == 8, "*PointToIndex(): unexpected enum value!" ); 137 138 nRet = ( long ) ePoint; 139 } 140 141 return nRet; 142 } 143 144 145 SvxRectCtlAccessibleContext::SvxRectCtlAccessibleContext( 146 const Reference< XAccessible >& rxParent, 147 SvxRectCtl& rRepr, 148 const ::rtl::OUString* pName, 149 const ::rtl::OUString* pDesc ) : 150 151 SvxRectCtlAccessibleContext_Base( m_aMutex ), 152 mxParent( rxParent ), 153 mpRepr( &rRepr ), 154 mpChilds( NULL ), 155 mnClientId( 0 ), 156 mnSelectedChild( NOCHILDSELECTED ), 157 mbAngleMode( rRepr.GetNumOfChilds() == 8 ) 158 { 159 DBG_CTOR( SvxRectCtlAccessibleContext, NULL ); 160 161 if( pName ) 162 msName = *pName; 163 else 164 { 165 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 166 msName = SVX_RESSTR( mbAngleMode? RID_SVXSTR_RECTCTL_ACC_ANGL_NAME : RID_SVXSTR_RECTCTL_ACC_CORN_NAME ); 167 } 168 169 if( pDesc ) 170 msDescription = *pDesc; 171 else 172 { 173 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 174 msDescription = SVX_RESSTR( mbAngleMode? RID_SVXSTR_RECTCTL_ACC_ANGL_DESCR : RID_SVXSTR_RECTCTL_ACC_CORN_DESCR ); 175 } 176 177 mpChilds = new SvxRectCtlChildAccessibleContext*[ MAX_NUM_OF_CHILDS ]; 178 179 SvxRectCtlChildAccessibleContext** p = mpChilds; 180 for( int i = MAX_NUM_OF_CHILDS ; i ; --i, ++p ) 181 *p = NULL; 182 } 183 184 185 SvxRectCtlAccessibleContext::~SvxRectCtlAccessibleContext() 186 { 187 DBG_DTOR( SvxRectCtlAccessibleContext, NULL ); 188 189 if( IsAlive() ) 190 { 191 osl_incrementInterlockedCount( &m_refCount ); 192 dispose(); // set mpRepr = NULL & release all childs 193 } 194 } 195 196 //===== XAccessible ========================================================= 197 198 Reference< XAccessibleContext > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleContext( void ) throw( RuntimeException ) 199 { 200 return this; 201 } 202 203 //===== XAccessibleComponent ================================================ 204 205 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) 206 { 207 // no guard -> done in getBounds() 208 // return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); 209 return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); 210 } 211 212 Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint ) throw( RuntimeException ) 213 { 214 ::osl::MutexGuard aGuard( m_aMutex ); 215 216 ThrowExceptionIfNotAlive(); 217 218 Reference< XAccessible > xRet; 219 220 long nChild = PointToIndex( mpRepr->GetApproxRPFromPixPt( rPoint ), mbAngleMode ); 221 222 if( nChild != NOCHILDSELECTED ) 223 xRet = getAccessibleChild( nChild ); 224 225 return xRet; 226 } 227 228 awt::Rectangle SAL_CALL SvxRectCtlAccessibleContext::getBounds() throw( RuntimeException ) 229 { 230 // no guard -> done in GetBoundingBox() 231 return AWTRectangle( GetBoundingBox() ); 232 } 233 234 awt::Point SAL_CALL SvxRectCtlAccessibleContext::getLocation() throw( RuntimeException ) 235 { 236 // no guard -> done in GetBoundingBox() 237 return AWTPoint( GetBoundingBox().TopLeft() ); 238 } 239 240 awt::Point SAL_CALL SvxRectCtlAccessibleContext::getLocationOnScreen() throw( RuntimeException ) 241 { 242 // no guard -> done in GetBoundingBoxOnScreen() 243 return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); 244 } 245 246 awt::Size SAL_CALL SvxRectCtlAccessibleContext::getSize() throw( RuntimeException ) 247 { 248 // no guard -> done in GetBoundingBox() 249 return AWTSize( GetBoundingBox().GetSize() ); 250 } 251 252 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isShowing() throw( RuntimeException ) 253 { 254 return sal_True; 255 } 256 257 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isVisible() throw( RuntimeException ) 258 { 259 ::osl::MutexGuard aGuard( m_aMutex ); 260 261 ThrowExceptionIfNotAlive(); 262 263 return mpRepr->IsVisible(); 264 } 265 266 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isFocusTraversable() throw( RuntimeException ) 267 { 268 return sal_True; 269 } 270 271 //===== XAccessibleContext ================================================== 272 273 sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException ) 274 { 275 ::osl::MutexGuard aGuard( m_aMutex ); 276 277 ThrowExceptionIfNotAlive(); 278 279 return mpRepr->GetNumOfChilds(); 280 } 281 282 Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChild( sal_Int32 nIndex ) 283 throw( RuntimeException, lang::IndexOutOfBoundsException ) 284 { 285 checkChildIndex( nIndex ); 286 287 Reference< XAccessible > xChild = mpChilds[ nIndex ]; 288 if( !xChild.is() ) 289 { 290 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 291 292 ::osl::MutexGuard aGuard( m_aMutex ); 293 294 ThrowExceptionIfNotAlive(); 295 296 xChild = mpChilds[ nIndex ]; 297 298 if( !xChild.is() ) 299 { 300 const ChildIndexToPointData* p = IndexToPoint( nIndex, mbAngleMode ); 301 UniString tmp = SVX_RESSTR( p->nResIdName ); 302 ::rtl::OUString aName( tmp ); 303 tmp = SVX_RESSTR( p->nResIdDescr ); 304 ::rtl::OUString aDescr( tmp ); 305 306 Rectangle aFocusRect( mpRepr->CalculateFocusRectangle( p->ePoint ) ); 307 308 Rectangle aBoundingBoxOnScreen( mpRepr->OutputToScreenPixel( aFocusRect.TopLeft() ), aFocusRect.GetSize() ); 309 310 SvxRectCtlChildAccessibleContext* pChild = new SvxRectCtlChildAccessibleContext( 311 this, *mpRepr, aName, aDescr, aFocusRect, nIndex ); 312 xChild = mpChilds[ nIndex ] = pChild; 313 pChild->acquire(); 314 315 // set actual state 316 if( mnSelectedChild == nIndex ) 317 pChild->setStateChecked( sal_True ); 318 } 319 } 320 321 return xChild; 322 } 323 324 Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleParent( void ) throw( RuntimeException ) 325 { 326 return mxParent; 327 } 328 329 sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException ) 330 { 331 ::osl::MutexGuard aGuard( m_aMutex ); 332 // Use a simple but slow solution for now. Optimize later. 333 334 // Iterate over all the parent's children and search for this object. 335 if( mxParent.is() ) 336 { 337 Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); 338 if( xParentContext.is() ) 339 { 340 sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); 341 for( sal_Int32 i = 0 ; i < nChildCount ; ++i ) 342 { 343 Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) ); 344 if( xChild.get() == ( XAccessible* ) this ) 345 return i; 346 } 347 } 348 } 349 350 // Return -1 to indicate that this object's parent does not know about the 351 // object. 352 return -1; 353 } 354 355 sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException ) 356 { 357 return AccessibleRole::PANEL; 358 } 359 360 ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException ) 361 { 362 ::osl::MutexGuard aGuard( m_aMutex ); 363 return msDescription; 364 } 365 366 ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( RuntimeException ) 367 { 368 ::osl::MutexGuard aGuard( m_aMutex ); 369 return msName; 370 } 371 372 /** Return empty reference to indicate that the relation set is not 373 supported. 374 */ 375 Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException ) 376 { 377 return Reference< XAccessibleRelationSet >(); 378 } 379 380 Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException ) 381 { 382 ::osl::MutexGuard aGuard( m_aMutex ); 383 utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 384 385 if( IsAlive() ) 386 { 387 // pStateSetHelper->AddState( AccessibleStateType::ENABLED ); 388 // pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); 389 pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); 390 if( mpRepr->HasFocus() ) 391 pStateSetHelper->AddState( AccessibleStateType::FOCUSED ); 392 pStateSetHelper->AddState( AccessibleStateType::OPAQUE ); 393 394 if( isShowing() ) 395 pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 396 397 if( isVisible() ) 398 pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); 399 } 400 else 401 pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 402 403 return pStateSetHelper; 404 } 405 406 lang::Locale SAL_CALL SvxRectCtlAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) 407 { 408 ::osl::MutexGuard aGuard( m_aMutex ); 409 if( mxParent.is() ) 410 { 411 Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); 412 if( xParentContext.is() ) 413 return xParentContext->getLocale(); 414 } 415 416 // No parent. Therefore throw exception to indicate this cluelessness. 417 throw IllegalAccessibleComponentStateException(); 418 } 419 420 void SAL_CALL SvxRectCtlAccessibleContext::addEventListener( const Reference< XAccessibleEventListener >& xListener ) 421 throw( RuntimeException ) 422 { 423 if (xListener.is()) 424 { 425 ::osl::MutexGuard aGuard( m_aMutex ); 426 if (!mnClientId) 427 mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 428 comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 429 } 430 } 431 432 void SAL_CALL SvxRectCtlAccessibleContext::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) 433 throw( RuntimeException ) 434 { 435 if (xListener.is()) 436 { 437 ::osl::MutexGuard aGuard( m_aMutex ); 438 439 sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 440 if ( !nListenerCount ) 441 { 442 // no listeners anymore 443 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), 444 // and at least to us not firing any events anymore, in case somebody calls 445 // NotifyAccessibleEvent, again 446 comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 447 mnClientId = 0; 448 } 449 } 450 } 451 452 void SAL_CALL SvxRectCtlAccessibleContext::addFocusListener( const Reference< awt::XFocusListener >& xListener ) 453 throw( RuntimeException ) 454 { 455 if( xListener.is() ) 456 { 457 ::osl::MutexGuard aGuard( m_aMutex ); 458 459 ThrowExceptionIfNotAlive(); 460 461 Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr ); 462 if( xWindow.is() ) 463 xWindow->addFocusListener( xListener ); 464 } 465 } 466 467 void SAL_CALL SvxRectCtlAccessibleContext::removeFocusListener( const Reference< awt::XFocusListener >& xListener ) 468 throw (RuntimeException) 469 { 470 if( xListener.is() ) 471 { 472 ::osl::MutexGuard aGuard( m_aMutex ); 473 474 ThrowExceptionIfNotAlive(); 475 476 Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr ); 477 if( xWindow.is() ) 478 xWindow->removeFocusListener( xListener ); 479 } 480 } 481 482 void SAL_CALL SvxRectCtlAccessibleContext::grabFocus() throw( RuntimeException ) 483 { 484 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 485 ::osl::MutexGuard aGuard( m_aMutex ); 486 487 ThrowExceptionIfNotAlive(); 488 489 mpRepr->GrabFocus(); 490 } 491 492 Any SAL_CALL SvxRectCtlAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException ) 493 { 494 // here is no implementation, because here are no KeyBindings for every object 495 return Any(); 496 } 497 498 sal_Int32 SvxRectCtlAccessibleContext::getForeground( ) 499 throw (::com::sun::star::uno::RuntimeException) 500 { 501 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 502 ::osl::MutexGuard aGuard( m_aMutex ); 503 ThrowExceptionIfNotAlive(); 504 505 return mpRepr->GetControlForeground().GetColor(); 506 } 507 sal_Int32 SvxRectCtlAccessibleContext::getBackground( ) 508 throw (::com::sun::star::uno::RuntimeException) 509 { 510 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 511 ::osl::MutexGuard aGuard( m_aMutex ); 512 ThrowExceptionIfNotAlive(); 513 514 return mpRepr->GetControlBackground().GetColor(); 515 } 516 517 //===== XServiceInfo ======================================================== 518 519 ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getImplementationName( void ) throw( RuntimeException ) 520 { 521 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvxRectCtlAccessibleContext" ) ); 522 } 523 524 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::supportsService( const ::rtl::OUString& sServiceName ) throw( RuntimeException ) 525 { 526 ::osl::MutexGuard aGuard( m_aMutex ); 527 // Iterate over all supported service names and return true if on of them 528 // matches the given name. 529 Sequence< ::rtl::OUString > aSupportedServices( getSupportedServiceNames() ); 530 int nLength = aSupportedServices.getLength(); 531 const ::rtl::OUString* pStr = aSupportedServices.getConstArray(); 532 533 for( int i = nLength ; i ; --i, ++pStr ) 534 { 535 if( sServiceName == *pStr ) 536 return sal_True; 537 } 538 539 return sal_False; 540 } 541 542 Sequence< ::rtl::OUString > SAL_CALL SvxRectCtlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException ) 543 { 544 const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) ); 545 return Sequence< ::rtl::OUString >( &sServiceName, 1 ); 546 } 547 548 //===== XTypeProvider ======================================================= 549 550 Sequence< sal_Int8 > SAL_CALL SvxRectCtlAccessibleContext::getImplementationId( void ) throw( RuntimeException ) 551 { 552 return getUniqueId(); 553 } 554 555 //===== XAccessibleSelection ============================================= 556 557 void SAL_CALL SvxRectCtlAccessibleContext::selectAccessibleChild( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException ) 558 { 559 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 560 561 ::osl::MutexGuard aGuard( m_aMutex ); 562 563 checkChildIndex( nIndex ); 564 565 ThrowExceptionIfNotAlive(); 566 567 const ChildIndexToPointData* pData = IndexToPoint( nIndex, mbAngleMode ); 568 569 DBG_ASSERT( pData, 570 "SvxRectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be..." ); 571 572 // this does all wich is needed, including the change of the child's state! 573 mpRepr->SetActualRP( pData->ePoint ); 574 } 575 576 sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isAccessibleChildSelected( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException ) 577 { 578 ::osl::MutexGuard aGuard( m_aMutex ); 579 580 checkChildIndex( nIndex ); 581 582 return nIndex == mnSelectedChild; 583 } 584 585 void SAL_CALL SvxRectCtlAccessibleContext::clearAccessibleSelection() throw( RuntimeException ) 586 { 587 DBG_ASSERT( sal_False, "SvxRectCtlAccessibleContext::clearAccessibleSelection() is not possible!" ); 588 } 589 590 void SAL_CALL SvxRectCtlAccessibleContext::selectAllAccessibleChildren() throw( RuntimeException ) 591 { 592 // guard in selectAccessibleChild()! 593 594 selectAccessibleChild( 0 ); // default per definition 595 } 596 597 sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getSelectedAccessibleChildCount() throw( RuntimeException ) 598 { 599 ::osl::MutexGuard aGuard( m_aMutex ); 600 601 return mnSelectedChild == NOCHILDSELECTED? 0 : 1; 602 } 603 604 Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getSelectedAccessibleChild( sal_Int32 nIndex ) 605 throw( lang::IndexOutOfBoundsException, RuntimeException ) 606 { 607 ::osl::MutexGuard aGuard( m_aMutex ); 608 609 checkChildIndexOnSelection( nIndex ); 610 611 return getAccessibleChild( mnSelectedChild ); 612 } 613 614 void SAL_CALL SvxRectCtlAccessibleContext::deselectAccessibleChild( sal_Int32 /*nIndex*/ ) throw( lang::IndexOutOfBoundsException, RuntimeException ) 615 { 616 ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "deselectAccessibleChild is not possible in this context" ) ); 617 618 DBG_ASSERT( sal_False, "SvxRectCtlAccessibleContext::deselectAccessibleChild() is not possible!" ); 619 620 throw lang::IndexOutOfBoundsException( aMessage, *this ); // never possible 621 } 622 623 //===== internals ======================================================== 624 625 void SvxRectCtlAccessibleContext::checkChildIndex( long nIndex ) throw( lang::IndexOutOfBoundsException ) 626 { 627 if( nIndex < 0 || nIndex >= getAccessibleChildCount() ) 628 throw lang::IndexOutOfBoundsException(); 629 } 630 631 void SvxRectCtlAccessibleContext::checkChildIndexOnSelection( long nIndex ) throw( lang::IndexOutOfBoundsException ) 632 { 633 if( nIndex || mnSelectedChild == NOCHILDSELECTED ) 634 // in our case only for the first (0) _selected_ child this is a valid request 635 throw lang::IndexOutOfBoundsException(); 636 } 637 638 void SvxRectCtlAccessibleContext::selectChild( long nNew ) 639 { 640 ::osl::MutexGuard aGuard( m_aMutex ); 641 if( nNew != mnSelectedChild ) 642 { 643 long nNumOfChilds = getAccessibleChildCount(); 644 if( nNew < nNumOfChilds ) 645 { // valid index 646 SvxRectCtlChildAccessibleContext* pChild; 647 if( mnSelectedChild != NOCHILDSELECTED ) 648 { // deselect old selected child if one is selected 649 pChild = mpChilds[ mnSelectedChild ]; 650 if( pChild ) 651 pChild->setStateChecked( sal_False ); 652 } 653 654 // select new child 655 mnSelectedChild = nNew; 656 657 if( nNew != NOCHILDSELECTED ) 658 { 659 pChild = mpChilds[ nNew ]; 660 if( pChild ) 661 pChild->setStateChecked( sal_True ); 662 } 663 } 664 else 665 mnSelectedChild = NOCHILDSELECTED; 666 } 667 } 668 669 void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton ) 670 { 671 // no guard -> is done in next selectChild 672 selectChild( PointToIndex( eButton, mbAngleMode ) ); 673 } 674 675 void SvxRectCtlAccessibleContext::setName( const ::rtl::OUString& rName ) 676 { 677 Any aPreVal, aPostVal; 678 { 679 ::osl::MutexGuard aGuard( m_aMutex ); 680 681 aPreVal <<= msName; 682 aPostVal <<= rName; 683 684 msName = rName; 685 } 686 687 const Reference< XInterface > xSource( *this ); 688 CommitChange( AccessibleEventObject( xSource, AccessibleEventId::NAME_CHANGED, aPreVal, aPostVal ) ); 689 } 690 691 void SvxRectCtlAccessibleContext::setDescription( const ::rtl::OUString& rDescr ) 692 { 693 Any aPreVal, aPostVal; 694 { 695 ::osl::MutexGuard aGuard( m_aMutex ); 696 697 aPreVal <<= msDescription; 698 aPostVal <<= rDescr; 699 700 msDescription = rDescr; 701 } 702 703 const Reference< XInterface > xSource( *this ); 704 CommitChange( AccessibleEventObject( xSource, AccessibleEventId::DESCRIPTION_CHANGED, aPreVal, aPostVal ) ); 705 } 706 707 void SvxRectCtlAccessibleContext::CommitChange( const AccessibleEventObject& rEvent ) 708 { 709 if (mnClientId) 710 comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 711 } 712 713 void SAL_CALL SvxRectCtlAccessibleContext::disposing() 714 { 715 if( !rBHelper.bDisposed ) 716 { 717 { 718 ::osl::MutexGuard aGuard( m_aMutex ); 719 mpRepr = NULL; // object dies with representation 720 721 SvxRectCtlChildAccessibleContext** p = mpChilds; 722 for( int i = MAX_NUM_OF_CHILDS ; i ; --i, ++p ) 723 { 724 SvxRectCtlChildAccessibleContext* pChild = *p; 725 if( pChild ) 726 { 727 pChild->dispose(); 728 pChild->release(); 729 *p = NULL; 730 } 731 } 732 733 delete[] mpChilds; 734 mpChilds = NULL; 735 } 736 737 { 738 ::osl::MutexGuard aGuard( m_aMutex ); 739 740 // Send a disposing to all listeners. 741 if ( mnClientId ) 742 { 743 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 744 mnClientId = 0; 745 } 746 747 mxParent = Reference< XAccessible >(); 748 } 749 } 750 } 751 752 Rectangle SvxRectCtlAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) 753 { 754 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 755 ::osl::MutexGuard aGuard( m_aMutex ); 756 757 ThrowExceptionIfNotAlive(); 758 759 return Rectangle( mpRepr->GetParent()->OutputToScreenPixel( mpRepr->GetPosPixel() ), mpRepr->GetSizePixel() ); 760 } 761 762 Rectangle SvxRectCtlAccessibleContext::GetBoundingBox( void ) throw( RuntimeException ) 763 { 764 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 765 ::osl::MutexGuard aGuard( m_aMutex ); 766 767 ThrowExceptionIfNotAlive(); 768 769 return Rectangle( mpRepr->GetPosPixel(), mpRepr->GetSizePixel() ); 770 } 771 772 Sequence< sal_Int8 > SvxRectCtlAccessibleContext::getUniqueId( void ) 773 { 774 static OImplementationId* pId = 0; 775 if( !pId ) 776 { 777 MutexGuard aGuard( Mutex::getGlobalMutex() ); 778 if( !pId) 779 { 780 static OImplementationId aId; 781 pId = &aId; 782 } 783 } 784 return pId->getImplementationId(); 785 } 786 787 void SvxRectCtlAccessibleContext::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 788 { 789 if( IsNotAlive() ) 790 throw lang::DisposedException(); 791 } 792 793 // ------------------------------------------------------------------------------------------------- 794 795 796 DBG_NAME( SvxRectCtlChildAccessibleContext ) 797 798 799 SvxRectCtlChildAccessibleContext::SvxRectCtlChildAccessibleContext( 800 const Reference<XAccessible>& rxParent, 801 const Window& rParentWindow, 802 const ::rtl::OUString& rName, 803 const ::rtl::OUString& rDescription, 804 const Rectangle& rBoundingBox, 805 long nIndexInParent ) : 806 807 SvxRectCtlChildAccessibleContext_Base( maMutex ), 808 msDescription( rDescription ), 809 msName( rName ), 810 mxParent(rxParent), 811 mpBoundingBox( new Rectangle( rBoundingBox ) ), 812 mrParentWindow( rParentWindow ), 813 mnClientId( 0 ), 814 mnIndexInParent( nIndexInParent ), 815 mbIsChecked( sal_False ) 816 { 817 DBG_CTOR( SvxRectCtlChildAccessibleContext, NULL ); 818 } 819 820 821 SvxRectCtlChildAccessibleContext::~SvxRectCtlChildAccessibleContext() 822 { 823 DBG_DTOR( SvxRectCtlChildAccessibleContext, NULL ); 824 825 if( IsAlive() ) 826 { 827 osl_incrementInterlockedCount( &m_refCount ); 828 dispose(); // set mpRepr = NULL & release all childs 829 } 830 } 831 832 //===== XAccessible ========================================================= 833 834 Reference< XAccessibleContext> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleContext( void ) throw( RuntimeException ) 835 { 836 return this; 837 } 838 839 //===== XAccessibleComponent ================================================ 840 841 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) 842 { 843 // no guard -> done in getBounds() 844 // return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); 845 return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); 846 } 847 848 Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleAtPoint( const awt::Point& /*rPoint*/ ) throw( RuntimeException ) 849 { 850 return Reference< XAccessible >(); 851 } 852 853 awt::Rectangle SAL_CALL SvxRectCtlChildAccessibleContext::getBounds() throw( RuntimeException ) 854 { 855 // no guard -> done in getBoundingBox() 856 return AWTRectangle( GetBoundingBox() ); 857 } 858 859 awt::Point SAL_CALL SvxRectCtlChildAccessibleContext::getLocation() throw( RuntimeException ) 860 { 861 // no guard -> done in getBoundingBox() 862 return AWTPoint( GetBoundingBox().TopLeft() ); 863 } 864 865 awt::Point SAL_CALL SvxRectCtlChildAccessibleContext::getLocationOnScreen() throw( RuntimeException ) 866 { 867 // no guard -> done in getBoundingBoxOnScreen() 868 return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); 869 } 870 871 awt::Size SAL_CALL SvxRectCtlChildAccessibleContext::getSize() throw( RuntimeException ) 872 { 873 // no guard -> done in getBoundingBox() 874 return AWTSize( GetBoundingBox().GetSize() ); 875 } 876 877 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isShowing() throw( RuntimeException ) 878 { 879 return sal_True; 880 } 881 882 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isVisible() throw( RuntimeException ) 883 { 884 ::osl::MutexGuard aGuard( maMutex ); 885 886 ThrowExceptionIfNotAlive(); 887 888 return mxParent.is()? ( static_cast< SvxRectCtlAccessibleContext* >( mxParent.get() ) )->isVisible() : sal_False; 889 } 890 891 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isFocusTraversable() throw( RuntimeException ) 892 { 893 return sal_False; 894 } 895 896 void SAL_CALL SvxRectCtlChildAccessibleContext::addFocusListener( const Reference< awt::XFocusListener >& /*xListener*/ ) 897 throw( RuntimeException ) 898 { 899 OSL_ENSURE( false, "SvxRectCtlChildAccessibleContext::addFocusListener: not implemented" ); 900 } 901 902 void SAL_CALL SvxRectCtlChildAccessibleContext::removeFocusListener( const Reference< awt::XFocusListener >& /*xListener*/ ) 903 throw (RuntimeException) 904 { 905 OSL_ENSURE( false, "SvxRectCtlChildAccessibleContext::removeFocusListener: not implemented" ); 906 } 907 908 void SAL_CALL SvxRectCtlChildAccessibleContext::grabFocus() throw( RuntimeException ) 909 { 910 } 911 912 Any SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException ) 913 { 914 // here is no implementation, because here are no KeyBindings for every object 915 return Any(); 916 } 917 sal_Int32 SvxRectCtlChildAccessibleContext::getForeground( ) 918 throw (::com::sun::star::uno::RuntimeException) 919 { 920 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 921 ::osl::MutexGuard aGuard( maMutex ); 922 ThrowExceptionIfNotAlive(); 923 return mrParentWindow.GetControlForeground().GetColor(); 924 } 925 sal_Int32 SvxRectCtlChildAccessibleContext::getBackground( ) 926 throw (::com::sun::star::uno::RuntimeException) 927 { 928 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 929 ::osl::MutexGuard aGuard( maMutex ); 930 931 ThrowExceptionIfNotAlive(); 932 return mrParentWindow.GetControlBackground().GetColor(); 933 } 934 935 //===== XAccessibleContext ================================================== 936 937 sal_Int32 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException ) 938 { 939 return 0; 940 } 941 942 Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChild( sal_Int32 /*nIndex*/ ) throw ( RuntimeException, lang::IndexOutOfBoundsException ) 943 { 944 throw lang::IndexOutOfBoundsException(); 945 } 946 947 Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleParent( void ) throw( RuntimeException ) 948 { 949 return mxParent; 950 } 951 952 sal_Int32 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException ) 953 { 954 return mnIndexInParent; 955 } 956 957 sal_Int16 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRole( void ) throw( RuntimeException ) 958 { 959 return AccessibleRole::RADIO_BUTTON; 960 } 961 962 ::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException ) 963 { 964 ::osl::MutexGuard aGuard( maMutex ); 965 return msDescription; 966 } 967 968 ::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleName( void ) throw( RuntimeException ) 969 { 970 ::osl::MutexGuard aGuard( maMutex ); 971 return msName; 972 } 973 974 /** Return empty reference to indicate that the relation set is not 975 supported. 976 */ 977 Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException ) 978 { 979 return Reference< XAccessibleRelationSet >(); 980 } 981 982 Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException ) 983 { 984 ::osl::MutexGuard aGuard( maMutex ); 985 utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; 986 987 if( IsAlive() ) 988 { 989 if( mbIsChecked ) 990 { 991 pStateSetHelper->AddState( AccessibleStateType::CHECKED ); 992 // pStateSetHelper->AddState( AccessibleStateType::SELECTED ); 993 } 994 995 pStateSetHelper->AddState( AccessibleStateType::ENABLED ); 996 pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); 997 pStateSetHelper->AddState( AccessibleStateType::OPAQUE ); 998 pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); 999 pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 1000 pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); 1001 } 1002 else 1003 pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 1004 1005 return pStateSetHelper; 1006 } 1007 1008 lang::Locale SAL_CALL SvxRectCtlChildAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) 1009 { 1010 ::osl::MutexGuard aGuard( maMutex ); 1011 if( mxParent.is() ) 1012 { 1013 Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); 1014 if( xParentContext.is() ) 1015 return xParentContext->getLocale(); 1016 } 1017 1018 // No locale and no parent. Therefore throw exception to indicate this 1019 // cluelessness. 1020 throw IllegalAccessibleComponentStateException(); 1021 } 1022 1023 void SAL_CALL SvxRectCtlChildAccessibleContext::addEventListener( const Reference< XAccessibleEventListener >& xListener ) 1024 throw( RuntimeException ) 1025 { 1026 if (xListener.is()) 1027 { 1028 ::osl::MutexGuard aGuard( maMutex ); 1029 if (!mnClientId) 1030 mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); 1031 comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); 1032 } 1033 } 1034 1035 1036 1037 1038 void SAL_CALL SvxRectCtlChildAccessibleContext::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) 1039 throw( RuntimeException ) 1040 { 1041 if (xListener.is()) 1042 { 1043 ::osl::MutexGuard aGuard( maMutex ); 1044 1045 sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); 1046 if ( !nListenerCount ) 1047 { 1048 // no listeners anymore 1049 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), 1050 // and at least to us not firing any events anymore, in case somebody calls 1051 // NotifyAccessibleEvent, again 1052 comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); 1053 mnClientId = 0; 1054 } 1055 } 1056 } 1057 1058 //===== XAccessibleValue ================================================ 1059 1060 Any SAL_CALL SvxRectCtlChildAccessibleContext::getCurrentValue() throw( RuntimeException ) 1061 { 1062 ThrowExceptionIfNotAlive(); 1063 1064 Any aRet; 1065 aRet <<= ( mbIsChecked? 1.0 : 0.0 ); 1066 return aRet; 1067 } 1068 1069 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::setCurrentValue( const Any& /*aNumber*/ ) throw( RuntimeException ) 1070 { 1071 return sal_False; 1072 } 1073 1074 Any SAL_CALL SvxRectCtlChildAccessibleContext::getMaximumValue() throw( RuntimeException ) 1075 { 1076 Any aRet; 1077 aRet <<= 1.0; 1078 return aRet; 1079 } 1080 1081 Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeException ) 1082 { 1083 Any aRet; 1084 aRet <<= 0.0; 1085 return aRet; 1086 } 1087 1088 //===== XServiceInfo ======================================================== 1089 1090 ::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException ) 1091 { 1092 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvxRectCtlChildAccessibleContext" ) ); 1093 } 1094 1095 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::supportsService( const ::rtl::OUString& sServiceName ) throw( RuntimeException ) 1096 { 1097 // Iterate over all supported service names and return true if on of them 1098 // matches the given name. 1099 ::osl::MutexGuard aGuard( maMutex ); 1100 Sequence< ::rtl::OUString > aSupportedServices ( getSupportedServiceNames() ); 1101 int nLength = aSupportedServices.getLength(); 1102 for( int i = 0 ; i < nLength; ++i ) 1103 { 1104 if( sServiceName == aSupportedServices[ i ] ) 1105 return sal_True; 1106 } 1107 1108 return sal_False; 1109 } 1110 1111 Sequence< ::rtl::OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException ) 1112 { 1113 const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext")); 1114 return Sequence< ::rtl::OUString >( &sServiceName, 1 ); 1115 } 1116 1117 //===== XTypeProvider ======================================================= 1118 1119 Sequence< sal_Int8 > SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationId( void ) throw( RuntimeException ) 1120 { 1121 static OImplementationId* pId = 0; 1122 if( !pId ) 1123 { 1124 MutexGuard aGuard( Mutex::getGlobalMutex() ); 1125 if( !pId) 1126 { 1127 static OImplementationId aId; 1128 pId = &aId; 1129 } 1130 } 1131 return pId->getImplementationId(); 1132 } 1133 1134 //===== internal ============================================================ 1135 1136 void SvxRectCtlChildAccessibleContext::CommitChange( const AccessibleEventObject& rEvent ) 1137 { 1138 if (mnClientId) 1139 comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); 1140 } 1141 1142 void SAL_CALL SvxRectCtlChildAccessibleContext::disposing() 1143 { 1144 if( !rBHelper.bDisposed ) 1145 { 1146 ::osl::MutexGuard aGuard( maMutex ); 1147 1148 // Send a disposing to all listeners. 1149 if ( mnClientId ) 1150 { 1151 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); 1152 mnClientId = 0; 1153 } 1154 1155 mxParent = Reference< XAccessible >(); 1156 1157 delete mpBoundingBox; 1158 } 1159 } 1160 1161 void SvxRectCtlChildAccessibleContext::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) 1162 { 1163 if( IsNotAlive() ) 1164 throw lang::DisposedException(); 1165 } 1166 1167 Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) 1168 { 1169 ::osl::MutexGuard aGuard( maMutex ); 1170 1171 // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() 1172 Rectangle aRect( GetBoundingBox() ); 1173 1174 return Rectangle( mrParentWindow.OutputToScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); 1175 } 1176 1177 Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBox( void ) throw( RuntimeException ) 1178 { 1179 // no guard neccessary, because no one changes mpBoundingBox after creating it 1180 ThrowExceptionIfNotAlive(); 1181 1182 return *mpBoundingBox; 1183 } 1184 1185 void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked ) 1186 { 1187 if( mbIsChecked != bChecked ) 1188 { 1189 mbIsChecked = bChecked; 1190 1191 const Reference< XInterface > xSource( *this ); 1192 1193 Any aOld; 1194 Any aNew; 1195 Any& rMod = bChecked? aNew : aOld; 1196 1197 rMod <<= AccessibleStateType::CHECKED; 1198 1199 CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) ); 1200 } 1201 } 1202 1203