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_accessibility.hxx" 26 27 // includes -------------------------------------------------------------- 28 #include <accessibility/standard/vclxaccessibleedit.hxx> 29 30 #include <toolkit/awt/vclxwindows.hxx> 31 #include <toolkit/helper/convert.hxx> 32 #include <accessibility/helper/accresmgr.hxx> 33 #include <accessibility/helper/accessiblestrings.hrc> 34 35 #include <unotools/accessiblestatesethelper.hxx> 36 #include <unotools/accessiblerelationsethelper.hxx> 37 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 38 #include <com/sun/star/accessibility/AccessibleEventId.hpp> 39 #include <com/sun/star/accessibility/AccessibleRole.hpp> 40 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> 41 #include <cppuhelper/typeprovider.hxx> 42 #include <comphelper/sequence.hxx> 43 #include <vcl/svapp.hxx> 44 #include <vcl/window.hxx> 45 #include <vcl/edit.hxx> 46 #include <sot/exchange.hxx> 47 #include <sot/formats.hxx> 48 49 #include <algorithm> 50 51 using namespace ::com::sun::star; 52 using namespace ::com::sun::star::uno; 53 using namespace ::com::sun::star::lang; 54 using namespace ::com::sun::star::beans; 55 using namespace ::com::sun::star::accessibility; 56 using namespace ::comphelper; 57 58 59 // ----------------------------------------------------------------------------- 60 // VCLXAccessibleEdit 61 // ----------------------------------------------------------------------------- 62 63 VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow ) 64 :VCLXAccessibleTextComponent( pVCLWindow ) 65 { 66 m_nSelectionStart = getSelectionStart(); 67 m_nCaretPosition = getCaretPosition(); 68 } 69 70 // ----------------------------------------------------------------------------- 71 72 VCLXAccessibleEdit::~VCLXAccessibleEdit() 73 { 74 } 75 76 // ----------------------------------------------------------------------------- 77 78 void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) 79 { 80 switch ( rVclWindowEvent.GetId() ) 81 { 82 case VCLEVENT_EDIT_MODIFY: 83 { 84 SetText( implGetText() ); 85 } 86 break; 87 case VCLEVENT_EDIT_SELECTIONCHANGED: 88 { 89 sal_Int32 nOldCaretPosition = m_nCaretPosition; 90 sal_Int32 nOldSelectionStart = m_nSelectionStart; 91 92 m_nCaretPosition = getCaretPosition(); 93 m_nSelectionStart = getSelectionStart(); 94 95 Window* pWindow = GetWindow(); 96 if ( pWindow && pWindow->HasChildPathFocus() ) 97 { 98 if ( m_nCaretPosition != nOldCaretPosition ) 99 { 100 Any aOldValue, aNewValue; 101 aOldValue <<= (sal_Int32) nOldCaretPosition; 102 aNewValue <<= (sal_Int32) m_nCaretPosition; 103 NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); 104 } 105 106 // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED 107 sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition ); 108 sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition ); 109 if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) ) 110 { 111 NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); 112 } 113 114 } 115 } 116 break; 117 default: 118 VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); 119 } 120 } 121 122 // ----------------------------------------------------------------------------- 123 124 void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) 125 { 126 VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); 127 128 VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); 129 if ( pVCLXEdit ) 130 { 131 rStateSet.AddState( AccessibleStateType::FOCUSABLE ); 132 rStateSet.AddState( AccessibleStateType::SINGLE_LINE ); 133 if ( pVCLXEdit->isEditable() ) 134 rStateSet.AddState( AccessibleStateType::EDITABLE ); 135 } 136 } 137 138 // ----------------------------------------------------------------------------- 139 // OCommonAccessibleText 140 // ----------------------------------------------------------------------------- 141 142 ::rtl::OUString VCLXAccessibleEdit::implGetText() 143 { 144 ::rtl::OUString aText; 145 146 Edit* pEdit = static_cast< Edit* >( GetWindow() ); 147 if ( pEdit ) 148 { 149 aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() ); 150 151 if ( getAccessibleRole() == AccessibleRole::PASSWORD_TEXT ) 152 { 153 xub_Unicode cEchoChar = pEdit->GetEchoChar(); 154 if ( !cEchoChar ) 155 cEchoChar = '*'; 156 XubString sTmp; 157 aText = sTmp.Fill( (sal_uInt16)aText.getLength(), cEchoChar ); 158 } 159 } 160 161 return aText; 162 } 163 164 // ----------------------------------------------------------------------------- 165 166 void VCLXAccessibleEdit::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) 167 { 168 awt::Selection aSelection; 169 VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); 170 if ( pVCLXEdit ) 171 aSelection = pVCLXEdit->getSelection(); 172 173 nStartIndex = aSelection.Min; 174 nEndIndex = aSelection.Max; 175 } 176 177 // ----------------------------------------------------------------------------- 178 // XInterface 179 // ----------------------------------------------------------------------------- 180 181 IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE ) 182 183 // ----------------------------------------------------------------------------- 184 // XTypeProvider 185 // ----------------------------------------------------------------------------- 186 187 IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE ) 188 189 // ----------------------------------------------------------------------------- 190 // XServiceInfo 191 // ----------------------------------------------------------------------------- 192 193 ::rtl::OUString VCLXAccessibleEdit::getImplementationName() throw (RuntimeException) 194 { 195 return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleEdit" ); 196 } 197 198 // ----------------------------------------------------------------------------- 199 200 Sequence< ::rtl::OUString > VCLXAccessibleEdit::getSupportedServiceNames() throw (RuntimeException) 201 { 202 Sequence< ::rtl::OUString > aNames(1); 203 aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleEdit" ); 204 return aNames; 205 } 206 207 // ----------------------------------------------------------------------------- 208 // XAccessibleContext 209 // ----------------------------------------------------------------------------- 210 211 sal_Int32 VCLXAccessibleEdit::getAccessibleChildCount() throw (RuntimeException) 212 { 213 OExternalLockGuard aGuard( this ); 214 215 return 0; 216 } 217 218 // ----------------------------------------------------------------------------- 219 220 Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 221 { 222 OExternalLockGuard aGuard( this ); 223 224 if ( i < 0 || i >= getAccessibleChildCount() ) 225 throw IndexOutOfBoundsException(); 226 227 return Reference< XAccessible >(); 228 } 229 230 // ----------------------------------------------------------------------------- 231 232 sal_Int16 VCLXAccessibleEdit::getAccessibleRole( ) throw (RuntimeException) 233 { 234 OExternalLockGuard aGuard( this ); 235 236 sal_Int16 nRole; 237 Edit* pEdit = static_cast< Edit* >( GetWindow() ); 238 if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) ) 239 nRole = AccessibleRole::PASSWORD_TEXT; 240 else 241 nRole = AccessibleRole::TEXT; 242 243 return nRole; 244 } 245 246 // ----------------------------------------------------------------------------- 247 // XAccessibleAction 248 // ----------------------------------------------------------------------------- 249 250 sal_Int32 VCLXAccessibleEdit::getAccessibleActionCount( ) throw (RuntimeException) 251 { 252 OExternalLockGuard aGuard( this ); 253 254 // There is one action: activate 255 return 1; 256 } 257 258 // ----------------------------------------------------------------------------- 259 260 sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 261 { 262 OExternalLockGuard aGuard( this ); 263 264 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) 265 throw IndexOutOfBoundsException(); 266 267 sal_Bool bDoAction = sal_False; 268 Window* pWindow = GetWindow(); 269 if ( pWindow ) 270 { 271 pWindow->GrabFocus(); 272 bDoAction = sal_True; 273 } 274 275 return bDoAction; 276 } 277 278 // ----------------------------------------------------------------------------- 279 280 ::rtl::OUString VCLXAccessibleEdit::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 281 { 282 OExternalLockGuard aGuard( this ); 283 284 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) 285 throw IndexOutOfBoundsException(); 286 287 static const ::rtl::OUString sAction( RTL_CONSTASCII_USTRINGPARAM( "activate" ) ); 288 return sAction; 289 } 290 291 // ----------------------------------------------------------------------------- 292 293 Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 294 { 295 OExternalLockGuard aGuard( this ); 296 297 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) 298 throw IndexOutOfBoundsException(); 299 300 return Reference< XAccessibleKeyBinding >(); 301 } 302 303 // ----------------------------------------------------------------------------- 304 // XAccessibleText 305 // ----------------------------------------------------------------------------- 306 307 sal_Int32 VCLXAccessibleEdit::getCaretPosition( ) throw (RuntimeException) 308 { 309 return getSelectionEnd(); 310 } 311 312 // ----------------------------------------------------------------------------- 313 314 sal_Bool VCLXAccessibleEdit::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 315 { 316 return setSelection( nIndex, nIndex ); 317 } 318 319 // ----------------------------------------------------------------------------- 320 321 sal_Unicode VCLXAccessibleEdit::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 322 { 323 OExternalLockGuard aGuard( this ); 324 325 return VCLXAccessibleTextComponent::getCharacter( nIndex ); 326 } 327 328 // ----------------------------------------------------------------------------- 329 330 Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) 331 { 332 OExternalLockGuard aGuard( this ); 333 334 return VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes ); 335 } 336 337 // ----------------------------------------------------------------------------- 338 339 awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 340 { 341 OExternalLockGuard aGuard( this ); 342 343 awt::Rectangle aBounds( 0, 0, 0, 0 ); 344 sal_Int32 nLength = implGetText().getLength(); 345 346 if ( !implIsValidRange( nIndex, nIndex, nLength ) ) 347 throw IndexOutOfBoundsException(); 348 349 Control* pControl = static_cast< Control* >( GetWindow() ); 350 if ( pControl ) 351 { 352 if ( nIndex == nLength ) 353 { 354 // #108914# calculate virtual bounding rectangle 355 for ( sal_Int32 i = 0; i < nLength; ++i ) 356 { 357 Rectangle aRect = pControl->GetCharacterBounds( i ); 358 sal_Int32 nHeight = aRect.GetHeight(); 359 if ( aBounds.Height < nHeight ) 360 { 361 aBounds.Y = aRect.Top(); 362 aBounds.Height = nHeight; 363 } 364 if ( i == nLength - 1 ) 365 { 366 aBounds.X = aRect.Right() + 1; 367 aBounds.Width = 1; 368 } 369 } 370 } 371 else 372 { 373 aBounds = AWTRectangle( pControl->GetCharacterBounds( nIndex ) ); 374 } 375 } 376 377 return aBounds; 378 } 379 380 // ----------------------------------------------------------------------------- 381 382 sal_Int32 VCLXAccessibleEdit::getCharacterCount( ) throw (RuntimeException) 383 { 384 OExternalLockGuard aGuard( this ); 385 386 return VCLXAccessibleTextComponent::getCharacterCount(); 387 } 388 389 // ----------------------------------------------------------------------------- 390 391 sal_Int32 VCLXAccessibleEdit::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) 392 { 393 OExternalLockGuard aGuard( this ); 394 395 return VCLXAccessibleTextComponent::getIndexAtPoint( aPoint ); 396 } 397 398 // ----------------------------------------------------------------------------- 399 400 ::rtl::OUString VCLXAccessibleEdit::getSelectedText( ) throw (RuntimeException) 401 { 402 OExternalLockGuard aGuard( this ); 403 404 return VCLXAccessibleTextComponent::getSelectedText(); 405 } 406 407 // ----------------------------------------------------------------------------- 408 409 sal_Int32 VCLXAccessibleEdit::getSelectionStart( ) throw (RuntimeException) 410 { 411 OExternalLockGuard aGuard( this ); 412 413 return VCLXAccessibleTextComponent::getSelectionStart(); 414 } 415 416 // ----------------------------------------------------------------------------- 417 418 sal_Int32 VCLXAccessibleEdit::getSelectionEnd( ) throw (RuntimeException) 419 { 420 OExternalLockGuard aGuard( this ); 421 422 return VCLXAccessibleTextComponent::getSelectionEnd(); 423 } 424 425 // ----------------------------------------------------------------------------- 426 427 sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 428 { 429 OExternalLockGuard aGuard( this ); 430 431 sal_Bool bReturn = sal_False; 432 ::rtl::OUString sText( implGetText() ); 433 434 if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) 435 throw IndexOutOfBoundsException(); 436 437 VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); 438 Edit* pEdit = static_cast< Edit* >( GetWindow() ); 439 if ( pVCLXEdit && pEdit && pEdit->IsEnabled() ) 440 { 441 pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) ); 442 bReturn = sal_True; 443 } 444 445 return bReturn; 446 } 447 448 // ----------------------------------------------------------------------------- 449 450 ::rtl::OUString VCLXAccessibleEdit::getText( ) throw (RuntimeException) 451 { 452 OExternalLockGuard aGuard( this ); 453 454 return VCLXAccessibleTextComponent::getText(); 455 } 456 457 // ----------------------------------------------------------------------------- 458 459 ::rtl::OUString VCLXAccessibleEdit::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 460 { 461 OExternalLockGuard aGuard( this ); 462 463 return VCLXAccessibleTextComponent::getTextRange( nStartIndex, nEndIndex ); 464 } 465 466 // ----------------------------------------------------------------------------- 467 468 ::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 469 { 470 OExternalLockGuard aGuard( this ); 471 472 return VCLXAccessibleTextComponent::getTextAtIndex( nIndex, aTextType ); 473 } 474 475 // ----------------------------------------------------------------------------- 476 477 ::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 478 { 479 OExternalLockGuard aGuard( this ); 480 481 return VCLXAccessibleTextComponent::getTextBeforeIndex( nIndex, aTextType ); 482 } 483 484 // ----------------------------------------------------------------------------- 485 486 ::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 487 { 488 OExternalLockGuard aGuard( this ); 489 490 return VCLXAccessibleTextComponent::getTextBehindIndex( nIndex, aTextType ); 491 } 492 493 // ----------------------------------------------------------------------------- 494 495 sal_Bool VCLXAccessibleEdit::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 496 { 497 OExternalLockGuard aGuard( this ); 498 499 return VCLXAccessibleTextComponent::copyText( nStartIndex, nEndIndex ); 500 } 501 502 // ----------------------------------------------------------------------------- 503 // XAccessibleEditableText 504 // ----------------------------------------------------------------------------- 505 506 sal_Bool VCLXAccessibleEdit::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 507 { 508 OExternalLockGuard aGuard( this ); 509 510 return copyText( nStartIndex, nEndIndex ) && deleteText( nStartIndex, nEndIndex ); 511 } 512 513 // ----------------------------------------------------------------------------- 514 515 sal_Bool VCLXAccessibleEdit::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 516 { 517 OExternalLockGuard aGuard( this ); 518 519 sal_Bool bReturn = sal_False; 520 521 if ( GetWindow() ) 522 { 523 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); 524 if ( xClipboard.is() ) 525 { 526 const sal_uInt32 nRef = Application::ReleaseSolarMutex(); 527 Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents(); 528 Application::AcquireSolarMutex( nRef ); 529 if ( xDataObj.is() ) 530 { 531 datatransfer::DataFlavor aFlavor; 532 SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); 533 if ( xDataObj->isDataFlavorSupported( aFlavor ) ) 534 { 535 Any aData = xDataObj->getTransferData( aFlavor ); 536 ::rtl::OUString sText; 537 aData >>= sText; 538 bReturn = replaceText( nIndex, nIndex, sText ); 539 } 540 } 541 } 542 } 543 544 return bReturn; 545 } 546 547 // ----------------------------------------------------------------------------- 548 549 sal_Bool VCLXAccessibleEdit::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) 550 { 551 OExternalLockGuard aGuard( this ); 552 553 return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() ); 554 } 555 556 // ----------------------------------------------------------------------------- 557 558 sal_Bool VCLXAccessibleEdit::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 559 { 560 OExternalLockGuard aGuard( this ); 561 562 return replaceText( nIndex, nIndex, sText ); 563 } 564 565 // ----------------------------------------------------------------------------- 566 567 sal_Bool VCLXAccessibleEdit::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (IndexOutOfBoundsException, RuntimeException) 568 { 569 OExternalLockGuard aGuard( this ); 570 571 sal_Bool bReturn = sal_False; 572 ::rtl::OUString sText( implGetText() ); 573 574 if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) 575 throw IndexOutOfBoundsException(); 576 577 sal_Int32 nMinIndex = ::std::min( nStartIndex, nEndIndex ); 578 sal_Int32 nMaxIndex = ::std::max( nStartIndex, nEndIndex ); 579 580 VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); 581 if ( pVCLXEdit && pVCLXEdit->isEditable() ) 582 { 583 pVCLXEdit->setText( sText.replaceAt( nMinIndex, nMaxIndex - nMinIndex, sReplacement ) ); 584 sal_Int32 nIndex = nMinIndex + sReplacement.getLength(); 585 setSelection( nIndex, nIndex ); 586 bReturn = sal_True; 587 } 588 589 return bReturn; 590 } 591 592 // ----------------------------------------------------------------------------- 593 594 sal_Bool VCLXAccessibleEdit::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const Sequence<PropertyValue>& ) throw (IndexOutOfBoundsException, RuntimeException) 595 { 596 OExternalLockGuard aGuard( this ); 597 598 if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) 599 throw IndexOutOfBoundsException(); 600 601 return sal_False; // attributes cannot be set for an edit 602 } 603 604 // ----------------------------------------------------------------------------- 605 606 sal_Bool VCLXAccessibleEdit::setText( const ::rtl::OUString& sText ) throw (RuntimeException) 607 { 608 OExternalLockGuard aGuard( this ); 609 610 sal_Bool bSuccess = sal_False; 611 try 612 { 613 bSuccess = replaceText( 0, implGetText().getLength(), sText ); 614 } 615 catch( const IndexOutOfBoundsException& ) 616 { 617 OSL_ENSURE( sal_False, "VCLXAccessibleText::setText: caught an exception!" ); 618 } 619 return bSuccess; 620 } 621 622 // ----------------------------------------------------------------------------- 623