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