1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_editeng.hxx" 30 #include <tools/gen.hxx> 31 #include <vos/mutex.hxx> 32 #include <vcl/svapp.hxx> 33 #include <rtl/ustring.hxx> 34 #include <com/sun/star/awt/Point.hpp> 35 #include <com/sun/star/awt/Rectangle.hpp> 36 #include <com/sun/star/lang/DisposedException.hpp> 37 #include <com/sun/star/accessibility/AccessibleRole.hpp> 38 #include <com/sun/star/accessibility/AccessibleTextType.hpp> 39 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 40 #include <com/sun/star/accessibility/AccessibleEventId.hpp> 41 #include <comphelper/accessibleeventnotifier.hxx> 42 #include <unotools/accessiblestatesethelper.hxx> 43 #include <editeng/unolingu.hxx> 44 #include "editeng/AccessibleEditableTextPara.hxx" 45 #include "editeng/AccessibleImageBullet.hxx" 46 #include <editeng/eerdll.hxx> 47 48 #include <editeng/editdata.hxx> 49 #include <editeng/editeng.hxx> 50 #include <editeng/outliner.hxx> 51 #include "editeng.hrc" 52 #include <svtools/colorcfg.hxx> 53 54 55 using namespace ::com::sun::star; 56 using namespace ::com::sun::star::accessibility; 57 58 namespace accessibility 59 { 60 DBG_NAME( AccessibleImageBullet ) 61 62 AccessibleImageBullet::AccessibleImageBullet ( const uno::Reference< XAccessible >& rParent ) : 63 mnParagraphIndex( 0 ), 64 mnIndexInParent( 0 ), 65 mpEditSource( NULL ), 66 maEEOffset( 0, 0 ), 67 mxParent( rParent ), 68 // well, that's strictly (UNO) exception safe, though not 69 // really robust. We rely on the fact that this member is 70 // constructed last, and that the constructor body catches 71 // exceptions, thus no chance for exceptions once the Id is 72 // fetched. Nevertheless, normally should employ RAII here... 73 mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient()) 74 { 75 #ifdef DBG_UTIL 76 DBG_CTOR( AccessibleImageBullet, NULL ); 77 OSL_TRACE( "Received ID: %d", mnNotifierClientId ); 78 #endif 79 80 try 81 { 82 // Create the state set. 83 ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper (); 84 mxStateSet = pStateSet; 85 86 // these are always on 87 pStateSet->AddState( AccessibleStateType::VISIBLE ); 88 pStateSet->AddState( AccessibleStateType::SHOWING ); 89 pStateSet->AddState( AccessibleStateType::ENABLED ); 90 pStateSet->AddState( AccessibleStateType::SENSITIVE ); 91 } 92 catch( const uno::Exception& ) {} 93 } 94 95 AccessibleImageBullet::~AccessibleImageBullet() 96 { 97 DBG_DTOR( AccessibleImageBullet, NULL ); 98 99 // sign off from event notifier 100 if( getNotifierClientId() != -1 ) 101 { 102 try 103 { 104 ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() ); 105 #ifdef DBG_UTIL 106 OSL_TRACE( "AccessibleImageBullet revoked ID: %d\n", mnNotifierClientId ); 107 #endif 108 } 109 catch( const uno::Exception& ) {} 110 } 111 } 112 113 uno::Any SAL_CALL AccessibleImageBullet::queryInterface (const uno::Type & rType) throw (uno::RuntimeException) 114 { 115 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 116 117 return AccessibleImageBulletInterfaceBase::queryInterface(rType); 118 } 119 120 uno::Reference< XAccessibleContext > SAL_CALL AccessibleImageBullet::getAccessibleContext( ) throw (uno::RuntimeException) 121 { 122 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 123 124 // We implement the XAccessibleContext interface in the same object 125 return uno::Reference< XAccessibleContext > ( this ); 126 } 127 128 sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleChildCount() throw (uno::RuntimeException) 129 { 130 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 131 132 return 0; 133 } 134 135 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 136 { 137 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 138 (void)i; 139 140 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")), 141 uno::Reference< uno::XInterface > 142 ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy 143 } 144 145 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleParent() throw (uno::RuntimeException) 146 { 147 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 148 149 return mxParent; 150 } 151 152 sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleIndexInParent() throw (uno::RuntimeException) 153 { 154 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 155 156 return mnIndexInParent; 157 } 158 159 sal_Int16 SAL_CALL AccessibleImageBullet::getAccessibleRole() throw (uno::RuntimeException) 160 { 161 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 162 163 return AccessibleRole::GRAPHIC; 164 } 165 166 ::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleDescription() throw (uno::RuntimeException) 167 { 168 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 169 170 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 171 172 // Get the string from the resource for the specified id. 173 return ::rtl::OUString( String( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION) ) ); 174 } 175 176 ::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleName() throw (uno::RuntimeException) 177 { 178 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 179 180 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 181 182 // Get the string from the resource for the specified id. 183 return ::rtl::OUString( String ( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_NAME) ) ); 184 } 185 186 uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleImageBullet::getAccessibleRelationSet() throw (uno::RuntimeException) 187 { 188 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 189 190 // no relations, therefore empty 191 return uno::Reference< XAccessibleRelationSet >(); 192 } 193 194 uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleImageBullet::getAccessibleStateSet() throw (uno::RuntimeException) 195 { 196 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 197 198 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 199 200 // Create a copy of the state set and return it. 201 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 202 203 if( !pStateSet ) 204 return uno::Reference<XAccessibleStateSet>(); 205 206 return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) ); 207 } 208 209 lang::Locale SAL_CALL AccessibleImageBullet::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException) 210 { 211 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 212 213 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 214 215 lang::Locale aLocale; 216 217 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 218 "AccessibleImageBullet::getLocale: paragraph index value overflow"); 219 220 // return locale of first character in the paragraph 221 return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); 222 } 223 224 void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) 225 { 226 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 227 228 if( getNotifierClientId() != -1 ) 229 ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener ); 230 } 231 232 void SAL_CALL AccessibleImageBullet::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) 233 { 234 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 235 236 if( getNotifierClientId() != -1 ) 237 ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener ); 238 } 239 240 sal_Bool SAL_CALL AccessibleImageBullet::containsPoint( const awt::Point& rPoint ) throw (uno::RuntimeException) 241 { 242 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 243 244 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 245 246 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 247 "AccessibleEditableTextPara::contains: index value overflow"); 248 249 awt::Rectangle aTmpRect = getBounds(); 250 Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) ); 251 Point aPoint( rPoint.X, rPoint.Y ); 252 253 return aRect.IsInside( aPoint ); 254 } 255 256 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) throw (uno::RuntimeException) 257 { 258 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 259 260 // as we have no children, empty reference 261 return uno::Reference< XAccessible >(); 262 } 263 264 awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds( ) throw (uno::RuntimeException) 265 { 266 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 267 268 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 269 270 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 271 "AccessibleEditableTextPara::getBounds: index value overflow"); 272 273 SvxTextForwarder& rCacheTF = GetTextForwarder(); 274 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) ); 275 Rectangle aParentRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 276 277 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && 278 aBulletInfo.bVisible && 279 aBulletInfo.nType == SVX_NUM_BITMAP ) 280 { 281 Rectangle aRect = aBulletInfo.aBounds; 282 283 // subtract paragraph position (bullet pos is absolute in EditEngine/Outliner) 284 aRect.Move( -aParentRect.Left(), -aParentRect.Top() ); 285 286 // convert to screen coordinates 287 Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, 288 rCacheTF.GetMapMode(), 289 GetViewForwarder() ); 290 291 // offset from shape/cell 292 Point aOffset = GetEEOffset(); 293 294 return awt::Rectangle( aScreenRect.Left() + aOffset.X(), 295 aScreenRect.Top() + aOffset.Y(), 296 aScreenRect.GetSize().Width(), 297 aScreenRect.GetSize().Height() ); 298 } 299 300 return awt::Rectangle(); 301 } 302 303 awt::Point SAL_CALL AccessibleImageBullet::getLocation( ) throw (uno::RuntimeException) 304 { 305 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 306 307 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 308 309 awt::Rectangle aRect = getBounds(); 310 311 return awt::Point( aRect.X, aRect.Y ); 312 } 313 314 awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen( ) throw (uno::RuntimeException) 315 { 316 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 317 318 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 319 320 // relate us to parent 321 uno::Reference< XAccessible > xParent = getAccessibleParent(); 322 if( xParent.is() ) 323 { 324 uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY ); 325 if( xParentComponent.is() ) 326 { 327 awt::Point aRefPoint = xParentComponent->getLocationOnScreen(); 328 awt::Point aPoint = getLocation(); 329 aPoint.X += aRefPoint.X; 330 aPoint.Y += aRefPoint.Y; 331 332 return aPoint; 333 } 334 } 335 336 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")), 337 uno::Reference< uno::XInterface > 338 ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy 339 } 340 341 awt::Size SAL_CALL AccessibleImageBullet::getSize( ) throw (uno::RuntimeException) 342 { 343 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 344 345 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 346 347 awt::Rectangle aRect = getBounds(); 348 349 return awt::Size( aRect.Width, aRect.Height ); 350 } 351 352 void SAL_CALL AccessibleImageBullet::grabFocus( ) throw (uno::RuntimeException) 353 { 354 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 355 356 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")), 357 uno::Reference< uno::XInterface > 358 ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy 359 } 360 361 sal_Int32 SAL_CALL AccessibleImageBullet::getForeground( ) throw (::com::sun::star::uno::RuntimeException) 362 { 363 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 364 365 // #104444# Added to XAccessibleComponent interface 366 svtools::ColorConfig aColorConfig; 367 sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; 368 return static_cast<sal_Int32>(nColor); 369 } 370 371 sal_Int32 SAL_CALL AccessibleImageBullet::getBackground( ) throw (::com::sun::star::uno::RuntimeException) 372 { 373 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 374 375 // #104444# Added to XAccessibleComponent interface 376 Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() ); 377 378 // the background is transparent 379 aColor.SetTransparency( 0xFF); 380 381 return static_cast<sal_Int32>( aColor.GetColor() ); 382 } 383 384 ::rtl::OUString SAL_CALL AccessibleImageBullet::getImplementationName (void) throw (uno::RuntimeException) 385 { 386 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 387 388 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleImageBullet")); 389 } 390 391 sal_Bool SAL_CALL AccessibleImageBullet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException) 392 { 393 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 394 395 // Iterate over all supported service names and return true if on of them 396 // matches the given name. 397 uno::Sequence< ::rtl::OUString> aSupportedServices ( 398 getSupportedServiceNames ()); 399 for (int i=0; i<aSupportedServices.getLength(); i++) 400 if (sServiceName == aSupportedServices[i]) 401 return sal_True; 402 return sal_False; 403 } 404 405 uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleImageBullet::getSupportedServiceNames (void) throw (uno::RuntimeException) 406 { 407 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 408 409 const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext")); 410 return uno::Sequence< ::rtl::OUString > (&sServiceName, 1); 411 } 412 413 ::rtl::OUString SAL_CALL AccessibleImageBullet::getServiceName (void) throw (uno::RuntimeException) 414 { 415 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 416 417 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext")); 418 } 419 420 void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex ) 421 { 422 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 423 424 mnIndexInParent = nIndex; 425 } 426 427 sal_Int32 AccessibleImageBullet::GetIndexInParent() const 428 { 429 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 430 431 return mnIndexInParent; 432 } 433 434 void AccessibleImageBullet::SetEEOffset( const Point& rOffset ) 435 { 436 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 437 438 maEEOffset = rOffset; 439 } 440 441 void AccessibleImageBullet::Dispose() 442 { 443 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 444 445 int nClientId( getNotifierClientId() ); 446 447 // #108212# drop all references before notifying dispose 448 mxParent = NULL; 449 mnNotifierClientId = -1; 450 mpEditSource = NULL; 451 452 // notify listeners 453 if( nClientId != -1 ) 454 { 455 try 456 { 457 uno::Reference < XAccessibleContext > xThis = getAccessibleContext(); 458 459 // #106234# Delegate to EventNotifier 460 ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis ); 461 #ifdef DBG_UTIL 462 OSL_TRACE( "AccessibleImageBullet disposed ID: %d", nClientId ); 463 #endif 464 } 465 catch( const uno::Exception& ) {} 466 } 467 } 468 469 void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource ) 470 { 471 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 472 473 mpEditSource = pEditSource; 474 475 if( !mpEditSource ) 476 { 477 // going defunc 478 UnSetState( AccessibleStateType::SHOWING ); 479 UnSetState( AccessibleStateType::VISIBLE ); 480 SetState( AccessibleStateType::INVALID ); 481 SetState( AccessibleStateType::DEFUNC ); 482 483 Dispose(); 484 } 485 } 486 487 void AccessibleImageBullet::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const 488 { 489 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 490 491 uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() ); 492 493 AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue); 494 495 // #106234# Delegate to EventNotifier 496 ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(), 497 aEvent ); 498 } 499 500 void AccessibleImageBullet::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const 501 { 502 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 503 504 FireEvent( nEventId, rNewValue ); 505 } 506 507 void AccessibleImageBullet::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const 508 { 509 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 510 511 FireEvent( nEventId, uno::Any(), rOldValue ); 512 } 513 514 void AccessibleImageBullet::SetState( const sal_Int16 nStateId ) 515 { 516 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 517 518 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 519 if( pStateSet != NULL && 520 !pStateSet->contains(nStateId) ) 521 { 522 pStateSet->AddState( nStateId ); 523 GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED ); 524 } 525 } 526 527 void AccessibleImageBullet::UnSetState( const sal_Int16 nStateId ) 528 { 529 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 530 531 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 532 if( pStateSet != NULL && 533 pStateSet->contains(nStateId) ) 534 { 535 pStateSet->RemoveState( nStateId ); 536 LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED ); 537 } 538 } 539 540 int AccessibleImageBullet::getNotifierClientId() const 541 { 542 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 543 544 return mnNotifierClientId; 545 } 546 547 void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex ) 548 { 549 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 550 551 uno::Any aOldDesc; 552 uno::Any aOldName; 553 554 try 555 { 556 aOldDesc <<= getAccessibleDescription(); 557 aOldName <<= getAccessibleName(); 558 } 559 catch( const uno::Exception& ) {} // optional behaviour 560 561 sal_Int32 nOldIndex = mnParagraphIndex; 562 563 mnParagraphIndex = nIndex; 564 565 try 566 { 567 if( nOldIndex != nIndex ) 568 { 569 // index and therefore description changed 570 FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc ); 571 FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName ); 572 } 573 } 574 catch( const uno::Exception& ) {} // optional behaviour 575 } 576 577 sal_Int32 AccessibleImageBullet::GetParagraphIndex() const SAL_THROW((uno::RuntimeException)) 578 { 579 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 580 581 return mnParagraphIndex; 582 } 583 584 SvxEditSource& AccessibleImageBullet::GetEditSource() const SAL_THROW((uno::RuntimeException)) 585 { 586 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 587 588 if( mpEditSource ) 589 return *mpEditSource; 590 else 591 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")), 592 uno::Reference< uno::XInterface > 593 ( static_cast< ::cppu::OWeakObject* > 594 ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy 595 } 596 597 SvxTextForwarder& AccessibleImageBullet::GetTextForwarder() const SAL_THROW((uno::RuntimeException)) 598 { 599 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 600 601 SvxEditSource& rEditSource = GetEditSource(); 602 SvxTextForwarder* pTextForwarder = rEditSource.GetTextForwarder(); 603 604 if( !pTextForwarder ) 605 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")), 606 uno::Reference< uno::XInterface > 607 ( static_cast< ::cppu::OWeakObject* > 608 ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy 609 610 if( pTextForwarder->IsValid() ) 611 return *pTextForwarder; 612 else 613 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")), 614 uno::Reference< uno::XInterface > 615 ( static_cast< ::cppu::OWeakObject* > 616 ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy 617 } 618 619 SvxViewForwarder& AccessibleImageBullet::GetViewForwarder() const SAL_THROW((uno::RuntimeException)) 620 { 621 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 622 623 SvxEditSource& rEditSource = GetEditSource(); 624 SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder(); 625 626 if( !pViewForwarder ) 627 { 628 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")), 629 uno::Reference< uno::XInterface > 630 ( static_cast< ::cppu::OWeakObject* > 631 ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy 632 } 633 634 if( pViewForwarder->IsValid() ) 635 return *pViewForwarder; 636 else 637 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")), 638 uno::Reference< uno::XInterface > 639 ( static_cast< ::cppu::OWeakObject* > 640 ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy 641 } 642 643 const Point& AccessibleImageBullet::GetEEOffset() const 644 { 645 DBG_CHKTHIS( AccessibleImageBullet, NULL ); 646 647 return maEEOffset; 648 } 649 650 } // end of namespace accessibility 651 652