diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-14 09:12:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-15 13:47:49 +0100 |
commit | 6d2c720dccc3a9d2d0dcaeaa7d6014b7acc5708f (patch) | |
tree | bfff59bce7407b3170cbc6f9afc5d5ab8254a7a8 /sd/source/ui/accessibility | |
parent | dab9dbef97316828459244dd2092b6614d2310d0 (diff) |
loplugin:flatten in sd/source/ui/[a-c]*
Change-Id: I7e568e563d2097c7052dfd406396335f5ae36170
Reviewed-on: https://gerrit.libreoffice.org/67836
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/accessibility')
4 files changed, 168 insertions, 168 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index f86604ca3775..d7852eb6cda6 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -620,78 +620,78 @@ void const SolarMutexGuard aSolarGuard; uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY ); - if( xSel.is() ) + if( !xSel.is() ) + return; + + uno::Any aAny; + + if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex ) { - uno::Any aAny; + // Select or deselect all children. - if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex ) + if( !bSelect ) + xSel->select( aAny ); + else { - // Select or deselect all children. + uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create( + comphelper::getProcessComponentContext()); - if( !bSelect ) - xSel->select( aAny ); - else + for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { - uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create( - comphelper::getProcessComponentContext()); + AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) ); - for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) ); - - if( pAcc && pAcc->GetXShape().is() ) - xShapes->add( pAcc->GetXShape() ); - } + if( pAcc && pAcc->GetXShape().is() ) + xShapes->add( pAcc->GetXShape() ); + } - if( xShapes->getCount() ) - { - xSel->select( Any(xShapes) ); - } + if( xShapes->getCount() ) + { + xSel->select( Any(xShapes) ); } } - else if( nAccessibleChildIndex >= 0 ) - { - // Select or deselect only the child with index - // nAccessibleChildIndex. + } + else if( nAccessibleChildIndex >= 0 ) + { + // Select or deselect only the child with index + // nAccessibleChildIndex. - AccessibleShape* pAcc = AccessibleShape::getImplementation( - getAccessibleChild( nAccessibleChildIndex )); + AccessibleShape* pAcc = AccessibleShape::getImplementation( + getAccessibleChild( nAccessibleChildIndex )); - // Add or remove the shape that is made accessible from the - // selection of the controller. - if( pAcc ) - { - uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() ); + // Add or remove the shape that is made accessible from the + // selection of the controller. + if( pAcc ) + { + uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() ); - if( xShape.is() ) - { - uno::Reference< drawing::XShapes > xShapes; - bool bFound = false; + if( xShape.is() ) + { + uno::Reference< drawing::XShapes > xShapes; + bool bFound = false; - aAny = xSel->getSelection(); - aAny >>= xShapes; + aAny = xSel->getSelection(); + aAny >>= xShapes; - // Search shape to be selected in current selection. - if (xShapes.is()) - { - sal_Int32 nCount = xShapes->getCount(); - for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i ) - if( xShapes->getByIndex( i ) == xShape ) - bFound = true; - } - else - // Create an empty selection to add the shape to. - xShapes = drawing::ShapeCollection::create( - comphelper::getProcessComponentContext()); - - // Update the selection. - if( !bFound && bSelect ) - xShapes->add( xShape ); - else if( bFound && !bSelect ) - xShapes->remove( xShape ); - - xSel->select( Any(xShapes) ); + // Search shape to be selected in current selection. + if (xShapes.is()) + { + sal_Int32 nCount = xShapes->getCount(); + for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i ) + if( xShapes->getByIndex( i ) == xShape ) + bFound = true; } + else + // Create an empty selection to add the shape to. + xShapes = drawing::ShapeCollection::create( + comphelper::getProcessComponentContext()); + + // Update the selection. + if( !bFound && bSelect ) + xShapes->add( xShape ); + else if( bFound && !bSelect ) + xShapes->remove( xShape ); + + xSel->select( Any(xShapes) ); } } } @@ -699,23 +699,23 @@ void void AccessibleDrawDocumentView::Activated() { - if (mpChildrenManager != nullptr) + if (mpChildrenManager == nullptr) + return; + + bool bChange = false; + // When none of the children has the focus then claim it for the + // view. + if ( ! mpChildrenManager->HasFocus()) { - bool bChange = false; - // When none of the children has the focus then claim it for the - // view. - if ( ! mpChildrenManager->HasFocus()) - { - SetState (AccessibleStateType::FOCUSED); - bChange = true; - } - else - ResetState (AccessibleStateType::FOCUSED); - mpChildrenManager->UpdateSelection(); - // if the child gets focus in UpdateSelection(), needs to reset the focus on document. - if (mpChildrenManager->HasFocus() && bChange) - ResetState (AccessibleStateType::FOCUSED); + SetState (AccessibleStateType::FOCUSED); + bChange = true; } + else + ResetState (AccessibleStateType::FOCUSED); + mpChildrenManager->UpdateSelection(); + // if the child gets focus in UpdateSelection(), needs to reset the focus on document. + if (mpChildrenManager->HasFocus() && bChange) + ResetState (AccessibleStateType::FOCUSED); } void AccessibleDrawDocumentView::Deactivated() diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx index 1e71a03cc8ae..9e165b4c2686 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx @@ -70,23 +70,23 @@ AccessibleOutlineView::AccessibleOutlineView ( // Beware! Here we leave the paths of the UNO API and descend into the // depths of the core. Necessary for making the edit engine accessible. - if (pSdWindow) - { - ::sd::View* pView = pViewShell->GetView(); + if (!pSdWindow) + return; - if (dynamic_cast<const ::sd::OutlineView* >( pView ) != nullptr) - { - OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>( - pView)->GetViewByWindow( pSdWindow ); - SdrOutliner& rOutliner = - static_cast< ::sd::OutlineView*>(pView)->GetOutliner(); + ::sd::View* pView = pViewShell->GetView(); - if( pOutlineView ) - { - maTextHelper.SetEditSource( ::std::unique_ptr< SvxEditSource >( new AccessibleOutlineEditSource( - rOutliner, *pView, *pOutlineView, *pSdWindow ) ) ); - } - } + if (dynamic_cast<const ::sd::OutlineView* >( pView ) == nullptr) + return; + + OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>( + pView)->GetViewByWindow( pSdWindow ); + SdrOutliner& rOutliner = + static_cast< ::sd::OutlineView*>(pView)->GetOutliner(); + + if( pOutlineView ) + { + maTextHelper.SetEditSource( ::std::unique_ptr< SvxEditSource >( new AccessibleOutlineEditSource( + rOutliner, *pView, *pOutlineView, *pSdWindow ) ) ); } } diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index 50358ef51b90..63ab93880137 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -233,21 +233,21 @@ lang::Locale SAL_CALL AccessibleSlideSorterObject::getLocale() void SAL_CALL AccessibleSlideSorterObject::addAccessibleEventListener( const Reference<XAccessibleEventListener>& rxListener) { - if (rxListener.is()) - { - const osl::MutexGuard aGuard(maMutex); + if (!rxListener.is()) + return; - if (IsDisposed()) - { - uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY); - rxListener->disposing (lang::EventObject (x)); - } - else - { - if (mnClientId == 0) - mnClientId = comphelper::AccessibleEventNotifier::registerClient(); - comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); - } + const osl::MutexGuard aGuard(maMutex); + + if (IsDisposed()) + { + uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY); + rxListener->disposing (lang::EventObject (x)); + } + else + { + if (mnClientId == 0) + mnClientId = comphelper::AccessibleEventNotifier::registerClient(); + comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); } } @@ -255,20 +255,20 @@ void SAL_CALL AccessibleSlideSorterObject::removeAccessibleEventListener( const Reference<XAccessibleEventListener>& rxListener) { ThrowIfDisposed(); - if (rxListener.is() && mnClientId) - { - const osl::MutexGuard aGuard(maMutex); + if (!(rxListener.is() && mnClientId)) + return; - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } + const osl::MutexGuard aGuard(maMutex); + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener ); + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; } } diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index ef6b37566a0c..401faab3cebf 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -320,21 +320,21 @@ lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale() void SAL_CALL AccessibleSlideSorterView::addAccessibleEventListener( const Reference<XAccessibleEventListener >& rxListener) { - if (rxListener.is()) - { - const osl::MutexGuard aGuard(maMutex); + if (!rxListener.is()) + return; - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY); - rxListener->disposing (lang::EventObject (x)); - } - else - { - if ( ! mnClientId) - mnClientId = comphelper::AccessibleEventNotifier::registerClient(); - comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); - } + const osl::MutexGuard aGuard(maMutex); + + if (rBHelper.bDisposed || rBHelper.bInDispose) + { + uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY); + rxListener->disposing (lang::EventObject (x)); + } + else + { + if ( ! mnClientId) + mnClientId = comphelper::AccessibleEventNotifier::registerClient(); + comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); } } @@ -342,24 +342,24 @@ void SAL_CALL AccessibleSlideSorterView::removeAccessibleEventListener( const Reference<XAccessibleEventListener >& rxListener) { ThrowIfDisposed(); - if (rxListener.is()) - { - const osl::MutexGuard aGuard(maMutex); + if (!rxListener.is()) + return; - if (mnClientId != 0) - { - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( - mnClientId, rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore -> revoke ourself. This may lead to - // the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case - // somebody calls NotifyAccessibleEvent, again - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } - } + const osl::MutexGuard aGuard(maMutex); + + if (mnClientId == 0) + return; + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( + mnClientId, rxListener ); + if ( !nListenerCount ) + { + // no listeners anymore -> revoke ourself. This may lead to + // the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case + // somebody calls NotifyAccessibleEvent, again + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; } } @@ -903,35 +903,35 @@ IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, FocusChangeListener, // add a checker whether the focus event is sent out. Only after sent, the mnFocusedIndex should be updated. bool bSentFocus = false; - if (nNewFocusedIndex != mnFocusedIndex) + if (nNewFocusedIndex == mnFocusedIndex) + return; + + if (mnFocusedIndex >= 0) { - if (mnFocusedIndex >= 0) + AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex); + if (pObject != nullptr) { - AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex); - if (pObject != nullptr) - { - pObject->FireAccessibleEvent( - AccessibleEventId::STATE_CHANGED, - Any(AccessibleStateType::FOCUSED), - Any()); - bSentFocus = true; - } + pObject->FireAccessibleEvent( + AccessibleEventId::STATE_CHANGED, + Any(AccessibleStateType::FOCUSED), + Any()); + bSentFocus = true; } - if (nNewFocusedIndex >= 0) + } + if (nNewFocusedIndex >= 0) + { + AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex); + if (pObject != nullptr) { - AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex); - if (pObject != nullptr) - { - pObject->FireAccessibleEvent( - AccessibleEventId::STATE_CHANGED, - Any(), - Any(AccessibleStateType::FOCUSED)); - bSentFocus = true; - } + pObject->FireAccessibleEvent( + AccessibleEventId::STATE_CHANGED, + Any(), + Any(AccessibleStateType::FOCUSED)); + bSentFocus = true; } - if (bSentFocus) - mnFocusedIndex = nNewFocusedIndex; } + if (bSentFocus) + mnFocusedIndex = nNewFocusedIndex; } IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, void*, void) |