diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 15:32:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-23 09:04:48 +0200 |
commit | ee6bdeec8d618f039e72d496dff44beb5b99abb2 (patch) | |
tree | eabd23b280c8a819137b3a2b22507ed8f1bfb858 /svx/source/accessibility | |
parent | a8622c77d26ca7a635afc95bba9a5054dc31eb7c (diff) |
loplugin:flatten in svl..svx
and implement a check in the plugin to prevent us modifying the
same patch of source code twice. This logic should probably be moved
into plugin.cxx at some point.
Change-Id: I7ebff6424cc8733bb2c8f7dba75eaaec68649290
Reviewed-on: https://gerrit.libreoffice.org/42660
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/accessibility')
-rw-r--r-- | svx/source/accessibility/AccessibleTextHelper.cxx | 23 | ||||
-rw-r--r-- | svx/source/accessibility/GraphCtlAccessibleContext.cxx | 42 | ||||
-rw-r--r-- | svx/source/accessibility/charmapacc.cxx | 12 |
3 files changed, 35 insertions, 42 deletions
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index d38b26a68319..f14d5bbd4c01 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -281,10 +281,10 @@ namespace accessibility if( !pTextForwarder ) throw uno::RuntimeException("Unable to fetch text forwarder, model might be dead", mxFrontEnd); - if( pTextForwarder->IsValid() ) - return *pTextForwarder; - else + if( !pTextForwarder->IsValid() ) throw uno::RuntimeException("Text forwarder is invalid, model might be dead", mxFrontEnd); + + return *pTextForwarder; } SvxViewForwarder& AccessibleTextHelper_Impl::GetViewForwarder() const @@ -297,10 +297,10 @@ namespace accessibility if( !pViewForwarder ) throw uno::RuntimeException("Unable to fetch view forwarder, model might be dead", mxFrontEnd); - if( pViewForwarder->IsValid() ) - return *pViewForwarder; - else + if( !pViewForwarder->IsValid() ) throw uno::RuntimeException("View forwarder is invalid, model might be dead", mxFrontEnd); + + return *pViewForwarder; } SvxEditViewForwarder& AccessibleTextHelper_Impl::GetEditViewForwarder() const @@ -315,20 +315,19 @@ namespace accessibility throw uno::RuntimeException("No edit view forwarder, object not in edit mode", mxFrontEnd); } - if( pViewForwarder->IsValid() ) - return *pViewForwarder; - else + if( !pViewForwarder->IsValid() ) { throw uno::RuntimeException("View forwarder is invalid, object not in edit mode", mxFrontEnd); } + + return *pViewForwarder; } SvxEditSourceAdapter& AccessibleTextHelper_Impl::GetEditSource() const { - if( maEditSource.IsValid() ) - return maEditSource; - else + if( !maEditSource.IsValid() ) throw uno::RuntimeException("AccessibleTextHelper_Impl::GetEditSource: no edit source", mxFrontEnd ); + return maEditSource; } // functor for sending child events (no stand-alone function, they are maybe not inlined) diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 3020c2cbf4de..274caf4badf3 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -175,26 +175,24 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt Reference< XAccessible > xAccessible; - if( mpControl ) + if( !mpControl ) { - Point aPnt( rPoint.X, rPoint.Y ); - mpControl->PixelToLogic( aPnt ); + throw DisposedException(); + } - SdrObject* pObj = nullptr; + Point aPnt( rPoint.X, rPoint.Y ); + mpControl->PixelToLogic( aPnt ); - if(mpView && mpView->GetSdrPageView()) - { - pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), nullptr, false); - } + SdrObject* pObj = nullptr; - if( pObj ) - xAccessible = getAccessible( pObj ); - } - else + if(mpView && mpView->GetSdrPageView()) { - throw DisposedException(); + pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), nullptr, false); } + if( pObj ) + xAccessible = getAccessible( pObj ); + return xAccessible; } @@ -684,18 +682,16 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox() tools::Rectangle aBounds ( 0, 0, 0, 0 ); vcl::Window* pWindow = mpControl; - if (pWindow != nullptr) + if (!(pWindow != nullptr)) + throw DisposedException(); + + aBounds = pWindow->GetWindowExtentsRelative (nullptr); + vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); + if (pParent != nullptr) { - aBounds = pWindow->GetWindowExtentsRelative (nullptr); - vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); - if (pParent != nullptr) - { - tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative (nullptr); - aBounds -= aParentRect.TopLeft(); - } + tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative (nullptr); + aBounds -= aParentRect.TopLeft(); } - else - throw DisposedException(); return aBounds; } diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 9e8c3ab5fa71..a0034b8beb40 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -333,15 +333,13 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::ge uno::Reference< css::accessibility::XAccessible > xRet; SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16 >( i ) ); - if( pItem ) - { - pItem->m_pParent = this; - xRet = pItem->GetAccessible(); - m_aChildren.push_back(xRet); - } - else + if( !pItem ) throw lang::IndexOutOfBoundsException(); + pItem->m_pParent = this; + xRet = pItem->GetAccessible(); + m_aChildren.push_back(xRet); + return xRet; } |