From 21e0d8162a0e683558c4d042ce688fc9a6833809 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 3 Jan 2018 14:08:19 +0200 Subject: loplugin:unusedfields fix the ReturnStmt check Change-Id: I95076076bd1313d23798c4615ea12910c86ed9a8 Reviewed-on: https://gerrit.libreoffice.org/47309 Tested-by: Jenkins Reviewed-by: Noel Grandin --- toolkit/source/awt/vclxaccessiblecomponent.cxx | 80 ++++++---------------- .../source/controls/accessiblecontrolcontext.cxx | 19 +---- 2 files changed, 23 insertions(+), 76 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 40a40d2dddcd..fde43fd16a89 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -527,10 +527,9 @@ uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessi { OExternalLockGuard aGuard( this ); - uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() ); - if ( !xAcc.is() ) - // we do _not_ have a foreign-controlled parent -> default to our VCL parent - xAcc = getVclParent(); + uno::Reference< accessibility::XAccessible > xAcc; + // we do _not_ have a foreign-controlled parent -> default to our VCL parent + xAcc = getVclParent(); return xAcc; } @@ -541,39 +540,30 @@ sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) sal_Int32 nIndex = -1; - uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() ); - if ( xAcc.is() ) - { // we _do_ have a foreign-controlled parent -> use the base class' implementation, - // which goes the UNO way - nIndex = OAccessibleExtendedComponentHelper::getAccessibleIndexInParent( ); - } - else + if ( GetWindow() ) { - if ( GetWindow() ) + vcl::Window* pParent = GetWindow()->GetAccessibleParentWindow(); + if ( pParent ) { - vcl::Window* pParent = GetWindow()->GetAccessibleParentWindow(); - if ( pParent ) + // Iterate over all the parent's children and search for this object. + // this should be compatible with the code in SVX + uno::Reference< accessibility::XAccessible > xParentAcc( pParent->GetAccessible() ); + if ( xParentAcc.is() ) { - // Iterate over all the parent's children and search for this object. - // this should be compatible with the code in SVX - uno::Reference< accessibility::XAccessible > xParentAcc( pParent->GetAccessible() ); - if ( xParentAcc.is() ) + uno::Reference< accessibility::XAccessibleContext > xParentContext ( xParentAcc->getAccessibleContext() ); + if ( xParentContext.is() ) { - uno::Reference< accessibility::XAccessibleContext > xParentContext ( xParentAcc->getAccessibleContext() ); - if ( xParentContext.is() ) + sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); + for ( sal_Int32 i=0; igetAccessibleChildCount(); - for ( sal_Int32 i=0; i xChild( xParentContext->getAccessibleChild(i) ); + if ( xChild.is() ) { - uno::Reference< accessibility::XAccessible > xChild( xParentContext->getAccessibleChild(i) ); - if ( xChild.is() ) + uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext(); + if ( xChildContext == static_cast(this) ) { - uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext(); - if ( xChildContext == static_cast(this) ) - { - nIndex = i; - break; - } + nIndex = i; + break; } } } @@ -699,36 +689,6 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds() } } - uno::Reference< accessibility::XAccessible > xParent( implGetForeignControlledParent() ); - if ( xParent.is() ) - { // hmm, we can't rely on our VCL coordinates, as in the Accessibility Hierarchy, somebody gave - // us a parent which is different from our VCL parent - // (actually, we did not check if it's really different ...) - - // the screen location of the foreign parent - uno::Reference< accessibility::XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), uno::UNO_QUERY ); - DBG_ASSERT( xParentComponent.is(), "VCLXAccessibleComponent::implGetBounds: invalid (foreign) parent component!" ); - - awt::Point aScreenLocForeign( 0, 0 ); - if ( xParentComponent.is() ) - aScreenLocForeign = xParentComponent->getLocationOnScreen(); - - // the screen location of the VCL parent - xParent = getVclParent(); - if ( xParent.is() ) - xParentComponent.set(xParent->getAccessibleContext(), css::uno::UNO_QUERY); - - awt::Point aScreenLocVCL( 0, 0 ); - if ( xParentComponent.is() ) - aScreenLocVCL = xParentComponent->getLocationOnScreen(); - - // the difference between them - awt::Size aOffset( aScreenLocVCL.X - aScreenLocForeign.X, aScreenLocVCL.Y - aScreenLocForeign.Y ); - // move the bounds - aBounds.X += aOffset.Width; - aBounds.Y += aOffset.Height; - } - return aBounds; } diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index cde540b577d9..a2685eae8d07 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -133,11 +133,7 @@ namespace toolkit Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleParent( ) { - OContextEntryGuard aGuard( this ); - OSL_ENSURE( implGetForeignControlledParent().is(), "OAccessibleControlContext::getAccessibleParent: somebody forgot to set a parent!" ); - // this parent of us is foreign controlled - somebody has to set it using the OAccessibleImplementationAccess - // class, before integrating our instance into an AccessibleDocumentModel - return implGetForeignControlledParent(); + return Reference< XAccessible >(); } @@ -275,21 +271,12 @@ namespace toolkit if ( pVCLParent ) aVCLParentScreenPos = pVCLParent->GetPosPixel(); - // the screen position of the "accessible parent" of the control - Reference< XAccessible > xParentAcc( implGetForeignControlledParent() ); - Reference< XAccessibleComponent > xParentAccComponent; - if ( xParentAcc.is() ) - xParentAccComponent.set(xParentAcc->getAccessibleContext(), css::uno::UNO_QUERY); - awt::Point aAccParentScreenPos( 0, 0 ); - if ( xParentAccComponent.is() ) - aAccParentScreenPos = xParentAccComponent->getLocationOnScreen(); - // now the size of the control aBounds = xWindow->getPosSize(); // correct the pos - aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X() - aAccParentScreenPos.X; - aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y() - aAccParentScreenPos.Y; + aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X(); + aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y(); } return aBounds; -- cgit