From 9348b322a5c230dfcc2231661b73e480b130fcd9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 12 Apr 2017 11:21:58 +0200 Subject: clang-tidy readability-simplify-boolean-expr Change-Id: Iea7ab64683f0b29794d50d774cc482b54a00e70a Reviewed-on: https://gerrit.libreoffice.org/36450 Tested-by: Jenkins Reviewed-by: Noel Grandin --- scripting/source/provider/MasterScriptProvider.cxx | 47 +++++----------------- scripting/source/vbaevents/eventhelper.cxx | 19 ++------- 2 files changed, 13 insertions(+), 53 deletions(-) (limited to 'scripting') diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 56faea32c6d2..0b4baeddd981 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -55,16 +55,11 @@ using namespace ::sf_misc; namespace func_provider { -bool endsWith( const OUString& target, - const OUString& item ) +bool endsWith( const OUString& target, const OUString& item ) { - sal_Int32 index = 0; - if ( ( index = target.indexOf( item ) ) != -1 && - ( index == ( target.getLength() - item.getLength() ) ) ) - { - return true; - } - return false; + sal_Int32 index = target.indexOf( item ); + return index != -1 && + index == ( target.getLength() - item.getLength() ); } /* should be available in some central location. */ @@ -607,30 +602,17 @@ MasterScriptProvider::removeByName( const OUString& Name ) void SAL_CALL -MasterScriptProvider::replaceByName( const OUString& aName, const Any& aElement ) +MasterScriptProvider::replaceByName( const OUString& /*aName*/, const Any& /*aElement*/ ) { - (void)aName; - (void)aElement; - // TODO needs implementing - if ( true ) - { - throw RuntimeException( "replaceByName not implemented!!!!" ); - } + throw RuntimeException( "replaceByName not implemented!!!!" ); } Any SAL_CALL -MasterScriptProvider::getByName( const OUString& aName ) +MasterScriptProvider::getByName( const OUString& /*aName*/ ) { - (void)aName; - // TODO needs to be implemented - Any result; - if ( true ) - { - throw RuntimeException( "getByName not implemented!!!!" ); - } - return result; + throw RuntimeException( "getByName not implemented!!!!" ); } sal_Bool SAL_CALL @@ -701,12 +683,7 @@ Sequence< OUString > SAL_CALL MasterScriptProvider::getElementNames( ) { // TODO needs implementing - Sequence< OUString > names; - if ( true ) - { - throw RuntimeException( "getElementNames not implemented!!!!" ); - } - return names; + throw RuntimeException( "getElementNames not implemented!!!!" ); } Type SAL_CALL @@ -720,11 +697,7 @@ MasterScriptProvider::getElementType( ) sal_Bool SAL_CALL MasterScriptProvider::hasElements( ) { // TODO needs implementing - if ( true ) - { - throw RuntimeException( "hasElements not implemented!!!!" ); - } - return false; + throw RuntimeException( "hasElements not implemented!!!!" ); } diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 96b4ee53ba7a..ea1128344ec4 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -87,18 +87,12 @@ static const sal_Int32 DELIMLEN = strlen(DELIM); bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params ) { - if ( !( params.getLength() > 0 ) || - !( params[ 0 ] >>= evt ) ) - return false; - return true; + return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt ); } bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params ) { - if ( !( params.getLength() > 0 ) || - !( params[ 0 ] >>= evt ) ) - return false; - return true; + return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt ); } Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params ) @@ -793,14 +787,7 @@ bool DenyMouseDrag(const ScriptEvent& evt, void const * ) { awt::MouseEvent aEvent; evt.Arguments[ 0 ] >>= aEvent; - if (aEvent.Buttons == 0 ) - { - return true; - } - else - { - return false; - } + return aEvent.Buttons == 0; } -- cgit