diff options
author | Arnaud Versini <Arnaud.Versini@libreoffice.org> | 2017-07-23 14:05:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-30 20:05:35 +0200 |
commit | aba73077851a744c06e72b3bddf5a0bae85d7c28 (patch) | |
tree | fbd55975423a3cc69850c14fcf0b3fb3e7e49294 /accessibility | |
parent | 633248e240b904352e66c8ff8b23a3b5f2854b69 (diff) |
Accessibility: simplify VCLXAccessibleEdit::setText.
Change-Id: Ie007d8e005909cfa8a59a25178c5694588443e94
Reviewed-on: https://gerrit.libreoffice.org/40324
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/source/standard/vclxaccessibleedit.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 005ddac8e4d6..4a85ab8797f1 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -592,16 +592,18 @@ sal_Bool VCLXAccessibleEdit::setText( const OUString& sText ) { OExternalLockGuard aGuard( this ); - bool bSuccess = false; - try - { - bSuccess = replaceText( 0, implGetText().getLength(), sText ); - } - catch( const IndexOutOfBoundsException& ) + bool bReturn = false; + + VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); + if ( pVCLXEdit && pVCLXEdit->isEditable() ) { - OSL_FAIL( "VCLXAccessibleText::setText: caught an exception!" ); + pVCLXEdit->setText( sText ); + sal_Int32 nSize = sText.getLength(); + pVCLXEdit->setSelection( awt::Selection( nSize, nSize ) ); + bReturn = true; } - return bSuccess; + + return bReturn; } |