From e871c9cb7ce4f3df2ba6780be62ed46b5ee7a410 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 May 2020 14:50:01 +0200 Subject: loplugin:simplifybool in canvas..cui Change-Id: Ib7c3b381ce4456e3d48538ee6f762ceaf2784fe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94973 Tested-by: Jenkins Reviewed-by: Noel Grandin --- canvas/source/tools/verifyinput.cxx | 16 ++++++++-------- .../controller/dialogs/tp_3D_SceneIllumination.cxx | 2 +- chart2/source/controller/sidebar/ChartElementsPanel.cxx | 4 ++-- chart2/source/view/charttypes/Splines.cxx | 4 ++-- .../source/container/IndexedPropertyValuesContainer.cxx | 2 +- cui/source/customize/SvxMenuConfigPage.cxx | 6 +++--- cui/source/customize/SvxToolbarConfigPage.cxx | 4 ++-- cui/source/customize/cfg.cxx | 2 +- cui/source/options/optlingu.cxx | 2 +- cui/source/tabpages/page.cxx | 2 +- cui/source/tabpages/tpcolor.cxx | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/canvas/source/tools/verifyinput.cxx b/canvas/source/tools/verifyinput.cxx index de69da5e744a..9d0020c12da9 100644 --- a/canvas/source/tools/verifyinput.cxx +++ b/canvas/source/tools/verifyinput.cxx @@ -295,8 +295,8 @@ namespace canvas::tools #endif } - if( !(renderState.CompositeOperation < rendering::CompositeOperation::CLEAR || - renderState.CompositeOperation > rendering::CompositeOperation::SATURATE) ) + if( renderState.CompositeOperation >= rendering::CompositeOperation::CLEAR && + renderState.CompositeOperation <= rendering::CompositeOperation::SATURATE ) return; #if OSL_DEBUG_LEVEL > 0 @@ -361,8 +361,8 @@ namespace canvas::tools #endif } - if( !(texture.RepeatModeY < rendering::TexturingMode::NONE || - texture.RepeatModeY > rendering::TexturingMode::REPEAT) ) + if( texture.RepeatModeY >= rendering::TexturingMode::NONE && + texture.RepeatModeY <= rendering::TexturingMode::REPEAT ) return; #if OSL_DEBUG_LEVEL > 0 @@ -483,8 +483,8 @@ namespace canvas::tools #endif } - if( !(strokeAttributes.JoinType < rendering::PathJoinType::NONE || - strokeAttributes.JoinType > rendering::PathJoinType::BEVEL) ) + if( strokeAttributes.JoinType >= rendering::PathJoinType::NONE && + strokeAttributes.JoinType <= rendering::PathJoinType::BEVEL ) return; #if OSL_DEBUG_LEVEL > 0 @@ -552,8 +552,8 @@ namespace canvas::tools #endif } - if( !(bitmapLayout.ColorSpace->getEndianness() < util::Endianness::LITTLE || - bitmapLayout.ColorSpace->getEndianness() > util::Endianness::BIG) ) + if( bitmapLayout.ColorSpace->getEndianness() >= util::Endianness::LITTLE && + bitmapLayout.ColorSpace->getEndianness() <= util::Endianness::BIG ) return; #if OSL_DEBUG_LEVEL > 0 diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index e656ef206499..27566a2a1251 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -131,7 +131,7 @@ namespace const ::chart::LightSource & rLightSource, sal_Int32 nIndex ) { - if( !(0 <= nIndex && nIndex < 8) ) + if( 0 > nIndex || nIndex >= 8 ) return; OUString aIndex( OUString::number( nIndex + 1 )); diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index c15572717d50..346672c2bb2a 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -203,7 +203,7 @@ bool isAxisVisible(const css::uno::Reference& xModel, AxisTy else if (eType == AxisType::Z_MAIN) nDimensionIndex = 2; - bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND); + bool bMajor = (eType != AxisType::X_SECOND && eType != AxisType::Y_SECOND); bool bHasAxis = AxisHelper::isAxisShown(nDimensionIndex, bMajor, xDiagram); return bHasAxis; @@ -223,7 +223,7 @@ void setAxisVisible(const css::uno::Reference& xModel, AxisT else if (eType == AxisType::Z_MAIN) nDimensionIndex = 2; - bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND); + bool bMajor = (eType != AxisType::X_SECOND && eType != AxisType::Y_SECOND); if (bVisible) AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext()); diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx index 5d5a02228690..774d5fc1d7ac 100644 --- a/chart2/source/view/charttypes/Splines.cxx +++ b/chart2/source/view/charttypes/Splines.cxx @@ -744,7 +744,7 @@ void SplineCalculater::CalculateBSplines( // find the one interval with u_i <= t_k < u_(i+1) // remember u_0 = ... = u_p = 0.0 and u_(m-p) = ... u_m = 1.0 and 0 t[k] || t[k] >= u[i+1]) { ++i; } @@ -872,7 +872,7 @@ void SplineCalculater::CalculateBSplines( for ( lcl_tSizeType nTIndex = 0; nTIndex <= n-1; ++nTIndex) { for (sal_uInt32 nResolutionStep = 1; - nResolutionStep <= nResolution && !( nTIndex == n-1 && nResolutionStep == nResolution); + nResolutionStep <= nResolution && ( nTIndex != n-1 || nResolutionStep != nResolution); ++nResolutionStep) { lcl_tSizeType nNewIndex = nTIndex * nResolution + nResolutionStep; diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx b/comphelper/source/container/IndexedPropertyValuesContainer.cxx index ecd1c2dbb2f8..fe4ba0cff91a 100644 --- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx +++ b/comphelper/source/container/IndexedPropertyValuesContainer.cxx @@ -117,7 +117,7 @@ sal_Int32 SAL_CALL IndexedPropertyValuesContainer::getCount( ) css::uno::Any SAL_CALL IndexedPropertyValuesContainer::getByIndex( sal_Int32 nIndex ) { sal_Int32 nSize(maProperties.size()); - if (!((nIndex < nSize) && (nIndex >= 0))) + if ((nIndex >= nSize) || (nIndex < 0)) throw lang::IndexOutOfBoundsException(); return uno::Any( maProperties[nIndex] ); diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index a0c6d316a0e5..c40c07dd3ce6 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -172,7 +172,7 @@ void SvxMenuConfigPage::UpdateButtonStates() bool bIsSeparator = selection != -1 && reinterpret_cast(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator(); bool bIsValidSelection = - !(m_xContentsListBox->n_children() == 0 || selection == -1); + (m_xContentsListBox->n_children() != 0 && selection != -1); m_xMoveUpButton->set_sensitive( bIsValidSelection && selection != 0 ); @@ -489,7 +489,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void) // Resetting individual top-level menus is not possible at the moment. // So we are resetting only if it is a context menu - if (!(!m_bIsMenuBar && xQueryBox->run() == RET_YES)) + if (m_bIsMenuBar || xQueryBox->run() != RET_YES) return; sal_Int32 nPos = m_xTopLevelListBox->get_active(); @@ -538,7 +538,7 @@ IMPL_LINK( SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool bIsSeparator = nSelectIndex != -1 && reinterpret_cast(m_xContentsListBox->get_id(nSelectIndex).toInt64())->IsSeparator(); bool bIsValidSelection = - !( m_xContentsListBox->n_children() == 0 || nSelectIndex == -1 ); + ( m_xContentsListBox->n_children() != 0 && nSelectIndex != -1 ); std::unique_ptr xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) ); auto xContextMenu = xBuilder->weld_menu("menu"); diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index dfe66d4e3721..7bc2115b36fa 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -717,7 +717,7 @@ void SvxToolbarConfigPage::UpdateButtonStates() bool bIsSeparator = selection != -1 && reinterpret_cast(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator(); bool bIsValidSelection = - !(m_xContentsListBox->n_children() == 0 || selection == -1); + (m_xContentsListBox->n_children() != 0 && selection != -1); m_xMoveUpButton->set_sensitive( bIsValidSelection ); m_xMoveDownButton->set_sensitive( bIsValidSelection ); @@ -905,7 +905,7 @@ IMPL_LINK( SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCE bool bIsSeparator = nSelectIndex != -1 && reinterpret_cast(m_xContentsListBox->get_id(nSelectIndex).toInt64())->IsSeparator(); bool bIsValidSelection = - !( m_xContentsListBox->n_children() == 0 || nSelectIndex == -1 ); + ( m_xContentsListBox->n_children() != 0 && nSelectIndex != -1 ); std::unique_ptr xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) ); auto xContextMenu = xBuilder->weld_menu("menu"); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 6b2a83d38dc3..d581a95e9ec0 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1974,7 +1974,7 @@ void ToolbarSaveInData::SetSystemStyle( window = VCLUnoHelper::GetWindow( xWindow ).get(); } - if ( !(window != nullptr && window->GetType() == WindowType::TOOLBOX) ) + if ( window == nullptr || window->GetType() != WindowType::TOOLBOX ) return; ToolBox* toolbox = static_cast(window); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 296451e6a380..3a45faab808e 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1625,7 +1625,7 @@ IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const row_col&, rRowCol, v { auto nPos = rRowCol.first; ModuleUserData_Impl* pData = reinterpret_cast(m_xModulesCLB->get_id(nPos).toInt64()); - if (!(!pData->IsParent() && pData->GetType() == TYPE_HYPH)) + if (pData->IsParent() || pData->GetType() != TYPE_HYPH) return; // make hyphenator checkboxes function as radio-buttons diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 1b5fc2851ce9..06820ba647d5 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -1376,7 +1376,7 @@ void SvxPageDescPage::CalcMargin_Impl() long nWidth = nBL + nBR + MINBODY; long nHeight = nBT + nBB + MINBODY; - if ( !(nWidth > nW || nHeight > nH) ) + if ( nWidth <= nW && nHeight <= nH ) return; if ( nWidth > nW ) diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 5933985a9b50..8a79dcd44c9e 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -398,7 +398,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, weld::Button&, void) { sal_uInt16 nId = m_xValSetColorList->GetSelectedItemId(); size_t nPos = m_xValSetColorList->GetSelectItemPos(); - if (!(m_xSelectPalette->get_active() == 0 && nPos != VALUESET_ITEM_NOTFOUND) ) + if (m_xSelectPalette->get_active() != 0 || nPos == VALUESET_ITEM_NOTFOUND) return; std::shared_ptr batch(comphelper::ConfigurationChanges::create(m_context)); -- cgit