From e67657d5211f6e95ddf8bd621108608573b00d5d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Aug 2020 13:32:43 +0200 Subject: loplugin:simplifybool more look for expressions like !(a && !b) which can be expanded out Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 2 +- svx/source/dialog/pagectrl.cxx | 6 +++--- svx/source/fmcomp/gridctrl.cxx | 2 +- svx/source/form/fmundo.cxx | 4 ++-- svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 2 +- svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx | 2 +- svx/source/svdraw/svdcrtv.cxx | 2 +- svx/source/svdraw/svddrgv.cxx | 2 +- svx/source/svdraw/svdedxv.cxx | 2 +- svx/source/svdraw/svdhdl.cxx | 14 +++++++------- svx/source/svdraw/svdoole2.cxx | 4 ++-- svx/source/svdraw/svdpoev.cxx | 2 +- svx/source/table/tablecontroller.cxx | 2 +- svx/source/table/tablehandles.cxx | 4 ++-- 14 files changed, 25 insertions(+), 25 deletions(-) (limited to 'svx') diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index adf9bd12e396..6a88afe524df 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -655,7 +655,7 @@ static void GetPoint( const tools::Polygon& rPoly, const std::vector< double >& const Point& rPt = rPoly[ nIdx ]; fx1 = rPt.X(); fy1 = rPt.Y(); - if ( !(nIdx && ( aIter != rDistances.end() ) && !rtl::math::approxEqual( *aIter, fX )) ) + if ( !nIdx || ( aIter == rDistances.end() ) || rtl::math::approxEqual( *aIter, fX ) ) return; nIdx = sal::static_int_cast( std::distance( rDistances.begin(), aIter ) ); diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index e30fbccb7359..6aee246982db 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -327,9 +327,9 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext, { const basegfx::B2DRange aPaintRange = vcl::unotools::b2DRectangleFromRectangle(rPaintRange); - if(!(!aPaintRange.isEmpty() && - !basegfx::fTools::equalZero(aPaintRange.getWidth()) && - !basegfx::fTools::equalZero(aPaintRange.getHeight()))) + if(aPaintRange.isEmpty() || + basegfx::fTools::equalZero(aPaintRange.getWidth()) || + basegfx::fTools::equalZero(aPaintRange.getHeight())) return; const basegfx::B2DRange aDefineRange = vcl::unotools::b2DRectangleFromRectangle(rDefineRange); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index fe556acde87c..18ff809a1bc4 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2714,7 +2714,7 @@ void DbGridControl::CellModified() } } - if (!(!IsFilterMode() && IsValid(m_xCurrentRow) && !m_xCurrentRow->IsModified())) + if (IsFilterMode() || !IsValid(m_xCurrentRow) || m_xCurrentRow->IsModified()) return; // enable edit mode diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 9cb5f876e286..f92403c57312 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -976,7 +976,7 @@ void FmUndoPropertyAction::Undo() { FmXUndoEnvironment& rEnv = static_cast(rMod).GetUndoEnv(); - if (!(xObj.is() && !rEnv.IsLocked())) + if (!xObj.is() || rEnv.IsLocked()) return; rEnv.Lock(); @@ -996,7 +996,7 @@ void FmUndoPropertyAction::Redo() { FmXUndoEnvironment& rEnv = static_cast(rMod).GetUndoEnv(); - if (!(xObj.is() && !rEnv.IsLocked())) + if (!xObj.is() || rEnv.IsLocked()) return; rEnv.Lock(); diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index e54918f51ce7..d8d4fb83035a 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1729,7 +1729,7 @@ namespace sdr::contact { ViewObjectContactOfSdrObj::ActionChanged(); const ControlHolder& rControl(m_pImpl->getExistentControl()); - if(!(rControl.is() && !rControl.isDesignMode())) + if(!rControl.is() || rControl.isDesignMode()) return; // #i93180# if layer visibility has changed and control is in live mode, it is necessary diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx index 5c227e446207..aaa0f3d14fe7 100644 --- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx @@ -207,7 +207,7 @@ namespace bool bMirrored, double fMinimalDiscreteUnit) { - if(!(rStyle.IsUsed() && !basegfx::areParallel(rMyVector, rOtherVector))) + if(!rStyle.IsUsed() || basegfx::areParallel(rMyVector, rOtherVector)) return; // create angle between both. angle() needs vectors pointing away from the same point, diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 7cb50a08f685..061bc034d92e 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -742,7 +742,7 @@ void SdrCreateView::BrkCreateObj() void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/) { - if(!(IsCreateObj() && !maDragStat.IsShown())) + if(!IsCreateObj() || maDragStat.IsShown()) return; if(pCurrentCreate) diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 0be9b5786cb7..1dcb24c9ca10 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -799,7 +799,7 @@ bool SdrDragView::BegInsGluePoint(const Point& rPnt) void SdrDragView::ShowDragObj() { - if(!(mpCurrentSdrDragMethod && !maDragStat.IsShown())) + if(!mpCurrentSdrDragMethod || maDragStat.IsShown()) return; // Changed for the GridOffset stuff: No longer iterate over diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index eaf8a89922b5..02974eaa36a0 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -783,7 +783,7 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const& rOutlView) co bool bTextFrame(pText && pText->IsTextFrame()); bool bFitToSize(pText && pText->IsFitToSize()); - if (!(bTextFrame && !bFitToSize)) + if (!bTextFrame || bFitToSize) return; tools::Rectangle aBlankRect(rOutlView.GetOutputArea()); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index f16f73346c1e..9a3380e8b2b9 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -1134,7 +1134,7 @@ void SdrHdlColor::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; SdrPageView* pPageView = pView->GetSdrPageView(); @@ -1286,7 +1286,7 @@ void SdrHdlGradient::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; SdrPageView* pPageView = pView->GetSdrPageView(); @@ -1506,7 +1506,7 @@ void SdrHdlBezWgt::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; SdrPageView* pPageView = pView->GetSdrPageView(); @@ -1565,7 +1565,7 @@ void E3dVolumeMarker::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; SdrPageView* pPageView = pView->GetSdrPageView(); @@ -1731,7 +1731,7 @@ void ImpMeasureHdl::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan; @@ -1805,7 +1805,7 @@ void ImpTextframeHdl::CreateB2dIAObject() SdrMarkView* pView = pHdlList->GetView(); - if(!(pView && !pView->areMarkHandlesHidden())) + if(!pView || pView->areMarkHandlesHidden()) return; SdrPageView* pPageView = pView->GetSdrPageView(); @@ -2394,7 +2394,7 @@ void SdrCropHdl::CreateB2dIAObject() SdrMarkView* pView = pHdlList ? pHdlList->GetView() : nullptr; SdrPageView* pPageView = pView ? pView->GetSdrPageView() : nullptr; - if( !(pPageView && !pView->areMarkHandlesHidden()) ) + if( !pPageView || pView->areMarkHandlesHidden() ) return; const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 4528172a567b..a1c6846575d7 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -916,7 +916,7 @@ void SdrOle2Obj::DisconnectFileLink_Impl() void SdrOle2Obj::CheckFileLink_Impl() { - if (!(mpImpl->mxObjRef.GetObject().is() && !mpImpl->mpObjectLink)) + if (!mpImpl->mxObjRef.GetObject().is() || mpImpl->mpObjectLink) return; try @@ -1059,7 +1059,7 @@ void SdrOle2Obj::Disconnect() void SdrOle2Obj::RemoveListeners_Impl() { - if ( !(mpImpl->mxObjRef.is() && !mpImpl->aPersistName.isEmpty()) ) + if ( !mpImpl->mxObjRef.is() || mpImpl->aPersistName.isEmpty() ) return; try diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index cd077e4eb8be..79d70de48187 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -62,7 +62,7 @@ void SdrPolyEditView::ImpCheckPolyPossibilities() ImpResetPolyPossibilityFlags(); const size_t nMarkCount(GetMarkedObjectCount()); - if(!(nMarkCount && !ImpIsFrameHandles())) + if(!nMarkCount || ImpIsFrameHandles()) return; bool b1stSmooth(true); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 2169f04599dc..317135b6c260 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2008,7 +2008,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl CellPos aPos( rPos ); findMergeOrigin( aPos ); - if( !(&rTableObj != mrView.GetTextEditObject() || bEmptyOutliner || !rTableObj.IsTextEditActive( aPos )) ) + if( &rTableObj == mrView.GetTextEditObject() && !bEmptyOutliner && rTableObj.IsTextEditActive( aPos ) ) return; if( rTableObj.IsTextEditActive() ) diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 52cef1299295..222624c2b3fa 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -142,7 +142,7 @@ void TableEdgeHdl::CreateB2dIAObject() { GetRidOfIAObject(); - if(!(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())) + if(!pHdlList || !pHdlList->GetView() || pHdlList->GetView()->areMarkHandlesHidden()) return; SdrMarkView* pView = pHdlList->GetView(); @@ -259,7 +259,7 @@ void TableBorderHdl::CreateB2dIAObject() { GetRidOfIAObject(); - if (!(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())) + if (!pHdlList || !pHdlList->GetView() || pHdlList->GetView()->areMarkHandlesHidden()) return; SdrMarkView* pView = pHdlList->GetView(); -- cgit