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

Stephan Bergmann sbergman at redhat.com
Tue Feb 24 04:25:54 PST 2015


 accessibility/source/standard/vclxaccessibletoolbox.cxx |   12 ++++++------
 toolkit/source/awt/vclxwindows.cxx                      |    7 +++++--
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 11292487db58c3a5e1204ba03d192f01e5e53cc4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 24 12:52:15 2015 +0100

    Avoid unnecessary bad downcasts to ToolBox
    
    Change-Id: I239aee06ce543b6f7c213d845313ca51b3a5502d

diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index a8a7cdf..41bf9a0 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -528,12 +528,12 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
     // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING)
     Reference< XAccessibleContext > xTemp = this;
 
-    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
     switch ( rVclWindowEvent.GetId() )
     {
         case VCLEVENT_TOOLBOX_CLICK:
         case VCLEVENT_TOOLBOX_SELECT:
         {
+            ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
             if ( rVclWindowEvent.GetData() )
             {
                 UpdateChecked_Impl( (sal_Int32)reinterpret_cast<sal_IntPtr>(rVclWindowEvent.GetData()) );
@@ -617,14 +617,14 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
         case VCLEVENT_OBJECT_DYING :
         {
             // if this toolbox is a subtoolbox, we have to relese it from its parent
-            ToolBox* pBox = static_cast< ToolBox* >( GetWindow() );
-            if ( pBox && pBox->GetParent() &&
-                 pBox->GetParent()->GetType() == WINDOW_TOOLBOX )
+            vcl::Window * pWin = GetWindow();
+            if ( pWin && pWin->GetParent() &&
+                 pWin->GetParent()->GetType() == WINDOW_TOOLBOX )
             {
                 VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >(
-                    pBox->GetParent()->GetAccessible()->getAccessibleContext().get() );
+                    pWin->GetParent()->GetAccessible()->getAccessibleContext().get() );
                 if ( pParent )
-                    pParent->ReleaseSubToolBox( pBox );
+                    pParent->ReleaseSubToolBox(static_cast<ToolBox *>(pWin));
             }
 
             // dispose all items
commit f02ee5b727e75d850fd054d18dd0e0320002109a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 24 10:24:48 2015 +0100

    Avoid unnecessary bad downcasts to Button
    
    Change-Id: I36baaa1cd46385430474f8a841eafaaba07a18fc

diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 6187119..1b51690 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -236,8 +236,7 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
 {
     SolarMutexGuard aGuard;
 
-    Button* pButton = static_cast< Button* >( GetWindow() );
-    if ( !pButton )
+    if ( !GetWindow() )
         return;
     sal_uInt16 nPropType = GetPropertyId( PropertyName );
     switch ( nPropType )
@@ -261,7 +260,10 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
             {
                 sal_Int16 nAlignment = sal_Int16();
                 if ( Value >>= nAlignment )
+                {
+                    Button* pButton = static_cast< Button* >( GetWindow() );
                     pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
+                }
             }
         }
         break;
@@ -275,6 +277,7 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
             {
                 sal_Int16 nImagePosition = 2;
                 OSL_VERIFY( Value >>= nImagePosition );
+                Button* pButton = static_cast< Button* >( GetWindow() );
                 pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
             }
         }


More information about the Libreoffice-commits mailing list