From 447a013299d148df12ff17306fff77bb7f85eba1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 19 Apr 2017 13:13:16 +0200 Subject: clang-tidy readability-simplify-boolean-expr in dbaccess..framework Change-Id: I96e1bd4000f4ade6ccfac53c57653772b249df99 Reviewed-on: https://gerrit.libreoffice.org/36678 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/sdbtools/connection/objectnames.cxx | 14 ++----- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 14 +++---- dbaccess/source/ui/app/AppView.cxx | 44 ++++++++-------------- dbaccess/source/ui/control/tabletree.cxx | 7 +--- dbaccess/source/ui/dlg/advancedsettings.cxx | 4 +- dbaccess/source/ui/dlg/optionalboolitem.cxx | 5 +-- dbaccess/source/ui/misc/propertysetitem.cxx | 5 +-- .../ui/relationdesign/RTableConnectionData.cxx | 5 +-- 8 files changed, 31 insertions(+), 67 deletions(-) (limited to 'dbaccess/source') diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx index 7787f8e7df70..25452bd5a44c 100644 --- a/dbaccess/source/sdbtools/connection/objectnames.cxx +++ b/dbaccess/source/sdbtools/connection/objectnames.cxx @@ -131,13 +131,9 @@ namespace sdbtools m_xConnection->getMetaData(), _rName, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InTableDefinitions ); OUString sExtraNameCharacters( m_xConnection->getMetaData()->getExtraNameCharacters() ); - if ( ( !sCatalog.isEmpty() && !::dbtools::isValidSQLName( sCatalog, sExtraNameCharacters ) ) - || ( !sSchema.isEmpty() && !::dbtools::isValidSQLName( sSchema, sExtraNameCharacters ) ) - || ( !sName.isEmpty() && !::dbtools::isValidSQLName( sName, sExtraNameCharacters ) ) - ) - return false; - - return true; + return !( ( !sCatalog.isEmpty() && !::dbtools::isValidSQLName( sCatalog, sExtraNameCharacters ) ) + || ( !sSchema.isEmpty() && !::dbtools::isValidSQLName( sSchema, sExtraNameCharacters ) ) + || ( !sName.isEmpty() && !::dbtools::isValidSQLName( sName, sExtraNameCharacters ) )); } virtual void validateName_throw( const OUString& _rName ) override @@ -182,9 +178,7 @@ namespace sdbtools virtual bool validateName( const OUString& _rName ) override { - if ( validateName_getErrorCondition( _rName ) != 0 ) - return false; - return true; + return validateName_getErrorCondition( _rName ) == 0; } virtual void validateName_throw( const OUString& _rName ) override diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index c53476d3b72f..950fbe17ac46 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -518,15 +518,11 @@ bool OAppDetailPageHelper::isLeaf(SvTreeListEntry* _pEntry) if ( !_pEntry ) return false; sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() ); - if ( ( nEntryType == DatabaseObjectContainer::TABLES ) - || ( nEntryType == DatabaseObjectContainer::CATALOG ) - || ( nEntryType == DatabaseObjectContainer::SCHEMA ) - || ( nEntryType == DatabaseObjectContainer::FORMS_FOLDER ) - || ( nEntryType == DatabaseObjectContainer::REPORTS_FOLDER ) - ) - return false; - - return true; + return !( ( nEntryType == DatabaseObjectContainer::TABLES ) + || ( nEntryType == DatabaseObjectContainer::CATALOG ) + || ( nEntryType == DatabaseObjectContainer::SCHEMA ) + || ( nEntryType == DatabaseObjectContainer::FORMS_FOLDER ) + || ( nEntryType == DatabaseObjectContainer::REPORTS_FOLDER )); } bool OAppDetailPageHelper::isALeafSelected() const diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx index 389a1bb5d628..6695065bb57e 100644 --- a/dbaccess/source/ui/app/AppView.cxx +++ b/dbaccess/source/ui/app/AppView.cxx @@ -149,22 +149,16 @@ void OAppBorderWindow::ImplInitSettings() { // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if( true ) - { - vcl::Font aFont; - aFont = rStyleSettings.GetFieldFont(); - aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont(*this, aFont); - } - if( true ) - { - SetTextColor( rStyleSettings.GetFieldTextColor() ); - SetTextFillColor(); - } + vcl::Font aFont; + aFont = rStyleSettings.GetFieldFont(); + aFont.SetColor( rStyleSettings.GetWindowTextColor() ); + SetPointFont(*this, aFont); + + SetTextColor( rStyleSettings.GetFieldTextColor() ); + SetTextFillColor(); - if( true ) - SetBackground( rStyleSettings.GetDialogColor() ); + SetBackground( rStyleSettings.GetDialogColor() ); } @@ -547,22 +541,16 @@ void OApplicationView::ImplInitSettings() { // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if( true ) - { - vcl::Font aFont; - aFont = rStyleSettings.GetFieldFont(); - aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont(*this, aFont); - } - if( true ) - { - SetTextColor( rStyleSettings.GetFieldTextColor() ); - SetTextFillColor(); - } + vcl::Font aFont; + aFont = rStyleSettings.GetFieldFont(); + aFont.SetColor( rStyleSettings.GetWindowTextColor() ); + SetPointFont(*this, aFont); + + SetTextColor( rStyleSettings.GetFieldTextColor() ); + SetTextFillColor(); - if( true ) - SetBackground( rStyleSettings.GetFieldColor() ); + SetBackground( rStyleSettings.GetFieldColor() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index 340e1b863431..cdaddb7069b5 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -87,12 +87,9 @@ void OTableTreeListBox::implSetDefaultImages() bool OTableTreeListBox::isFolderEntry( const SvTreeListEntry* _pEntry ) { sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() ); - if ( ( nEntryType == DatabaseObjectContainer::TABLES ) + return ( nEntryType == DatabaseObjectContainer::TABLES ) || ( nEntryType == DatabaseObjectContainer::CATALOG ) - || ( nEntryType == DatabaseObjectContainer::SCHEMA ) - ) - return true; - return false; + || ( nEntryType == DatabaseObjectContainer::SCHEMA ); } void OTableTreeListBox::notifyHiContrastChanged() diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 4a809983887c..3b59fcb383c6 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -464,9 +464,7 @@ namespace dbaui { DataSourceMetaData aMeta( _sURL ); const FeatureSet& rFeatures( aMeta.getFeatureSet() ); - if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() ) - return true; - return false; + return rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting(); } short AdvancedSettingsDialog::Execute() diff --git a/dbaccess/source/ui/dlg/optionalboolitem.cxx b/dbaccess/source/ui/dlg/optionalboolitem.cxx index ef561f12b779..08acf1c5e51c 100644 --- a/dbaccess/source/ui/dlg/optionalboolitem.cxx +++ b/dbaccess/source/ui/dlg/optionalboolitem.cxx @@ -41,10 +41,7 @@ namespace dbaui if ( !pCompare ) return false; - if ( m_aValue == pCompare->m_aValue ) - return true; - - return false; + return m_aValue == pCompare->m_aValue; } SfxPoolItem* OptionalBoolItem::Clone( SfxItemPool* /*_pPool*/ ) const diff --git a/dbaccess/source/ui/misc/propertysetitem.cxx b/dbaccess/source/ui/misc/propertysetitem.cxx index 26e5dabe70aa..d24ef05247b6 100644 --- a/dbaccess/source/ui/misc/propertysetitem.cxx +++ b/dbaccess/source/ui/misc/propertysetitem.cxx @@ -46,10 +46,7 @@ namespace dbaui bool OPropertySetItem::operator==(const SfxPoolItem& _rItem) const { const OPropertySetItem* pCompare = dynamic_cast( &_rItem ); - if ((!pCompare) || (pCompare->m_xSet.get() != m_xSet.get())) - return false; - - return true; + return pCompare && (pCompare->m_xSet.get() == m_xSet.get()); } SfxPoolItem* OPropertySetItem::Clone(SfxItemPool* /* _pPool */) const diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx index 59733aa125a4..2f48f8edca69 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx @@ -174,10 +174,7 @@ bool ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet if ( nPrimKeysCount != aKeyColumns.getLength() ) return false; } - if ( !nPrimKeysCount || nPrimKeysCount != nValidLinesCount ) - return false; - - return true; + return nPrimKeysCount && nPrimKeysCount == nValidLinesCount; } bool ORelationTableConnectionData::IsConnectionPossible() -- cgit