diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2018-04-22 16:02:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-22 21:56:07 +0200 |
commit | fca20f3083c78cc76046e824b062b1ea20d4522b (patch) | |
tree | 099fb74ad5a4ee793d86cbca38cf940e673af8df /accessibility | |
parent | 4cd1b3562871b9701b8e5f062262582511875d35 (diff) |
accessibility: reuse GetWindow result in VCLXAccessibleTextComponent.
Change-Id: I4107d6e3b891cd7fa31146eac50aa337765624fa
Reviewed-on: https://gerrit.libreoffice.org/53283
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/vclxaccessibletextcomponent.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx index 44dee58c31e8..4430fa195254 100644 --- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx +++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx @@ -50,8 +50,9 @@ using namespace ::comphelper; VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow ) :VCLXAccessibleComponent( pVCLXWindow ) { - if ( GetWindow() ) - m_sText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() ); + VclPtr<vcl::Window> pWindow = GetWindow(); + if ( pWindow ) + m_sText = OutputDevice::GetNonMnemonicString( pWindow->GetText() ); } @@ -88,8 +89,9 @@ void VCLXAccessibleTextComponent::ProcessWindowEvent( const VclWindowEvent& rVcl OUString VCLXAccessibleTextComponent::implGetText() { OUString aText; - if ( GetWindow() ) - aText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() ); + VclPtr<vcl::Window> pWindow = GetWindow(); + if ( pWindow ) + aText = OutputDevice::GetNonMnemonicString( pWindow->GetText() ); return aText; } @@ -166,12 +168,13 @@ Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( s if ( !implIsValidIndex( nIndex, sText.getLength() ) ) throw IndexOutOfBoundsException(); - if ( GetWindow() ) + VclPtr<vcl::Window> pWindow = GetWindow(); + if ( pWindow ) { - vcl::Font aFont = GetWindow()->GetControlFont(); + vcl::Font aFont = pWindow->GetControlFont(); - Color nBackColor = GetWindow()->GetControlBackground(); - Color nColor = GetWindow()->GetControlForeground(); + Color nBackColor = pWindow->GetControlBackground(); + Color nColor = pWindow->GetControlForeground(); // MT: Code with default font was introduced with the IA2 CWS, but I am not convinced that this is the correct font... // Decide what to do when we have a concrete issue. @@ -348,9 +351,10 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32 bool bReturn = false; - if ( GetWindow() ) + VclPtr<vcl::Window> pWindow = GetWindow(); + if ( pWindow ) { - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); + Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard(); if ( xClipboard.is() ) { OUString sText( getTextRange( nStartIndex, nEndIndex ) ); |