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