diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/valueacc.cxx | 22 | ||||
-rw-r--r-- | svtools/source/uno/unoevent.cxx | 50 |
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(); - } } } |