summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 15:32:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-23 09:04:48 +0200
commitee6bdeec8d618f039e72d496dff44beb5b99abb2 (patch)
treeeabd23b280c8a819137b3a2b22507ed8f1bfb858 /svtools
parenta8622c77d26ca7a635afc95bba9a5054dc31eb7c (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 'svtools')
-rw-r--r--svtools/source/control/valueacc.cxx22
-rw-r--r--svtools/source/uno/unoevent.cxx50
2 files changed, 32 insertions, 40 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 467e704a2586..f1e145cc8e7a 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -176,14 +176,12 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible
{
ThrowIfDisposed();
const SolarMutexGuard aSolarGuard;
- uno::Reference< accessibility::XAccessible > xRet;
ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
- if( pItem )
- xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ );
- else
+ if( !pItem )
throw lang::IndexOutOfBoundsException();
+ uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ );
return xRet;
}
@@ -489,13 +487,11 @@ void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
const SolarMutexGuard aSolarGuard;
ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
- if(pItem != nullptr)
- {
- mpParent->SelectItem( pItem->mnId );
- mpParent->Select ();
- }
- else
+ if(pItem == nullptr)
throw lang::IndexOutOfBoundsException();
+
+ mpParent->SelectItem( pItem->mnId );
+ mpParent->Select ();
}
@@ -504,13 +500,11 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
ThrowIfDisposed();
const SolarMutexGuard aSolarGuard;
ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
- bool bRet = false;
- if (pItem != nullptr)
- bRet = mpParent->IsItemSelected( pItem->mnId );
- else
+ if (!(pItem != nullptr))
throw lang::IndexOutOfBoundsException();
+ bool bRet = mpParent->IsItemSelected( pItem->mnId );
return bRet;
}
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 351f6a76b999..7125562135b6 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -196,39 +196,37 @@ void getMacroFromAny(
// else: unknown PropertyValue -> ignore
}
- if (bTypeOK)
+ if (!bTypeOK)
{
- if (bNone)
+ // no valid type: abort
+ throw IllegalArgumentException();
+ }
+
+ if (bNone)
+ {
+ // return empty macro
+ rMacro = SvxMacro( "", "" );
+ }
+ else
+ {
+ if (eType == STARBASIC)
{
- // return empty macro
- rMacro = SvxMacro( "", "" );
+ // create macro and return
+ SvxMacro aMacro(sMacroVal, sLibVal, eType);
+ rMacro = aMacro;
+ }
+ else if (eType == EXTENDED_STYPE)
+ {
+ SvxMacro aMacro(sScriptVal, sScript);
+ rMacro = aMacro;
}
else
{
- if (eType == STARBASIC)
- {
- // create macro and return
- SvxMacro aMacro(sMacroVal, sLibVal, eType);
- rMacro = aMacro;
- }
- else if (eType == EXTENDED_STYPE)
- {
- SvxMacro aMacro(sScriptVal, sScript);
- rMacro = aMacro;
- }
- else
- {
- // we can't process type: abort
- // TODO: JavaScript macros
- throw IllegalArgumentException();
- }
+ // we can't process type: abort
+ // TODO: JavaScript macros
+ throw IllegalArgumentException();
}
}
- else
- {
- // no valid type: abort
- throw IllegalArgumentException();
- }
}
}