[Libreoffice-commits] core.git: accessibility/source

Arnaud Versini arnaud.versini at gmail.com
Sun Apr 22 19:57:38 UTC 2018


 accessibility/source/standard/vclxaccessibletextcomponent.cxx |   24 +++++-----
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit fca20f3083c78cc76046e824b062b1ea20d4522b
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Sun Apr 22 16:02:02 2018 +0200

    accessibility: reuse GetWindow result in VCLXAccessibleTextComponent.
    
    Change-Id: I4107d6e3b891cd7fa31146eac50aa337765624fa
    Reviewed-on: https://gerrit.libreoffice.org/53283
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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 ) );


More information about the Libreoffice-commits mailing list