[Libreoffice-commits] core.git: svx/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Apr 26 10:16:24 UTC 2017


 svx/source/accessibility/AccessibleTextHelper.cxx     |    5 ----
 svx/source/dialog/dlgctl3d.cxx                        |    7 ------
 svx/source/fmcomp/gridctrl.cxx                        |    5 ----
 svx/source/items/numfmtsh.cxx                         |    7 ------
 svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx |    7 ------
 svx/source/svdraw/svdhdl.cxx                          |   10 +--------
 svx/source/svdraw/svdibrow.cxx                        |    3 --
 svx/source/svdraw/svdobj.cxx                          |    9 +-------
 svx/source/svdraw/svdoole2.cxx                        |   20 +++---------------
 svx/source/svdraw/svdotxed.cxx                        |    2 -
 svx/source/table/tablecontroller.cxx                  |    5 ----
 svx/source/table/tableundo.cxx                        |    9 --------
 svx/source/tbxctrls/tbcontrl.cxx                      |    5 ----
 13 files changed, 18 insertions(+), 76 deletions(-)

New commits:
commit 93bf0b1ba11c7710f80a7773eaf0b5ca816d82a7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 25 10:34:09 2017 +0200

    clang-tidy readability-simplify-boolean-expr in svx
    
    Change-Id: I5190e453edd9fc2eda57f730834567e8e214ff16
    Reviewed-on: https://gerrit.libreoffice.org/36931
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 44daca62b2e6..f933056909d1 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -492,10 +492,7 @@ namespace accessibility
                         return xCell->IsActiveCell();
                 }
             }
-            if( pViewForwarder->IsValid() )
-                return true;
-            else
-                return false;
+            return pViewForwarder->IsValid();
         }
         catch( const uno::RuntimeException& )
         {
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 85b23ffcf272..4c704e318eee 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -723,12 +723,7 @@ void Svx3DLightControl::SetObjectType(SvxPreviewObjectType nType)
 
 bool Svx3DLightControl::IsSelectionValid()
 {
-    if((NO_LIGHT_SELECTED != maSelectedLight) && (GetLightOnOff(maSelectedLight)))
-    {
-        return true;
-    }
-
-    return false;
+    return (NO_LIGHT_SELECTED != maSelectedLight) && GetLightOnOff(maSelectedLight);
 }
 
 void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 8b72c13e6f86..13e1618b4385 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2068,10 +2068,7 @@ bool DbGridControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol)
         return false;
     }
 
-    if ( !EditBrowseBox::CursorMoving( nNewRow, nNewCol ) )
-        return false;
-
-    return true;
+    return EditBrowseBox::CursorMoving( nNewRow, nNewCol );
 }
 
 bool DbGridControl::SetCurrent(long nNewRow)
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index b0a8d9211e9d..4b077eaec97e 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1463,12 +1463,7 @@ bool SvxNumberFormatShell::IsTmpCurrencyFormat( const OUString& rFmtString )
 {
     sal_uInt32 nFound;
     FindEntry(rFmtString, &nFound);
-
-    if(nFound==NUMBERFORMAT_ENTRY_NEW_CURRENCY)
-    {
-        return true;
-    }
-    return false;
+    return nFound == NUMBERFORMAT_ENTRY_NEW_CURRENCY;
 }
 
 sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const OUString& rFmtString )
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
index 65f21ca3e438..351cffaf3700 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -311,12 +311,7 @@ bool ViewObjectContactOfOuterPageBorder::isPrimitiveVisible(const DisplayInfo& r
 
     const SdrView& rView = pSdrPageView->GetView();
 
-    if(!rView.IsPageVisible() && rView.IsPageBorderVisible())
-    {
-        return false;
-    }
-
-    return true;
+    return rView.IsPageVisible() || !rView.IsPageBorderVisible();
 }
 
 ViewObjectContactOfInnerPageBorder::ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 16a28661adb6..74d2345c3548 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1036,10 +1036,7 @@ bool SdrHdl::IsFocusHdl() const
         case SdrHdlKind::LowerRight:
         {
             // if it's an activated TextEdit, it's moved to extended points
-            if(pHdlList && pHdlList->IsMoveOutside())
-                return false;
-            else
-                return true;
+            return !pHdlList || !pHdlList->IsMoveOutside();
         }
 
         case SdrHdlKind::Move:      // handle to move object
@@ -1676,10 +1673,7 @@ bool ImpEdgeHdl::IsHorzDrag() const
     else if (eEdgeKind==SdrEdgeKind::ThreeLines)
     {
         long nAngle=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
-        if (nAngle==0 || nAngle==18000)
-            return true;
-        else
-            return false;
+        return nAngle==0 || nAngle==18000;
     }
     return false;
 }
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 97100753fee4..77bf2c1a3243 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -824,8 +824,7 @@ bool IsItemIneffective(sal_uInt16 nWhich, const SfxItemSet* pSet, sal_uInt16& rI
             if (ImpGetItem(*pSet,SDRATTR_EDGEKIND,pItem)) {
                 SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem*>(pItem)->GetValue();
                 if (eKind==SdrEdgeKind::ThreeLines) {
-                    if (nWhich>SDRATTR_EDGELINE2DELTA) return true;
-                    else return false;
+                    return nWhich>SDRATTR_EDGELINE2DELTA;
                 }
                 if (eKind!=SdrEdgeKind::OrthoLines && eKind!=SdrEdgeKind::Bezier) return true;
             }
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index d0cdb107f9e3..82d9ceb7bf99 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1295,14 +1295,9 @@ bool SdrObject::beginSpecialDrag(SdrDragStat& rDrag) const
 
     SdrHdlKind eHdl = (pHdl == nullptr) ? SdrHdlKind::Move : pHdl->GetKind();
 
-    if(eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::Upper || eHdl==SdrHdlKind::UpperRight ||
+    return eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::Upper || eHdl==SdrHdlKind::UpperRight ||
         eHdl==SdrHdlKind::Left || eHdl==SdrHdlKind::Right || eHdl==SdrHdlKind::LowerLeft ||
-        eHdl==SdrHdlKind::Lower || eHdl==SdrHdlKind::LowerRight)
-    {
-        return true;
-    }
-
-    return false;
+        eHdl==SdrHdlKind::Lower || eHdl==SdrHdlKind::LowerRight;
 }
 
 bool SdrObject::applySpecialDrag(SdrDragStat& rDrag)
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 1c3d959ac688..149b81c88567 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -667,18 +667,11 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj
         return false;
 
     SvGlobalName aClassName( rObjRef->getClassID() );
-    if( aClassName == SvGlobalName(SO3_SM_CLASSID_30) ||
+    return aClassName == SvGlobalName(SO3_SM_CLASSID_30) ||
         aClassName == SvGlobalName(SO3_SM_CLASSID_40) ||
         aClassName == SvGlobalName(SO3_SM_CLASSID_50) ||
         aClassName == SvGlobalName(SO3_SM_CLASSID_60) ||
-        aClassName == SvGlobalName(SO3_SM_CLASSID)      )
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
+        aClassName == SvGlobalName(SO3_SM_CLASSID);
 }
 
 // BaseProperties section
@@ -2010,18 +2003,13 @@ bool SdrOle2Obj::IsCalc() const
         return false;
 
     SvGlobalName aObjClsId( mpImpl->mxObjRef->getClassID() );
-    if(    SvGlobalName(SO3_SC_CLASSID_30) == aObjClsId
+    return SvGlobalName(SO3_SC_CLASSID_30) == aObjClsId
         || SvGlobalName(SO3_SC_CLASSID_40) == aObjClsId
         || SvGlobalName(SO3_SC_CLASSID_50) == aObjClsId
         || SvGlobalName(SO3_SC_CLASSID_60) == aObjClsId
         || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_60) == aObjClsId
         || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_8) == aObjClsId
-        || SvGlobalName(SO3_SC_CLASSID) == aObjClsId )
-    {
-        return true;
-    }
-
-    return false;
+        || SvGlobalName(SO3_SC_CLASSID) == aObjClsId;
 }
 
 uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index ff7d7310d76e..d6ba21c3c69b 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -297,7 +297,7 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
             delete pNewText;
     }
 
-    /* Beginning Chaining-related code */
+    /* Chaining-related code */
     rOutl.ClearOverflowingParaNum();
 
     pEdtOutl = nullptr;
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 0e53a54d7450..49e09878df0f 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -341,10 +341,7 @@ bool SvxTableController::onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* /
 
     mbLeftButtonDown = false;
 
-    if( rMEvt.GetClicks() == 2 )
-        return true;
-
-    return false;
+    return rMEvt.GetClicks() == 2;
 }
 
 
diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx
index cb0093fbc80e..665254521c9d 100644
--- a/svx/source/table/tableundo.cxx
+++ b/svx/source/table/tableundo.cxx
@@ -96,14 +96,7 @@ void CellUndo::Redo()
 bool CellUndo::Merge( SfxUndoAction *pNextAction )
 {
     CellUndo* pNext = dynamic_cast< CellUndo* >( pNextAction );
-    if( pNext && pNext->mxCell.get() == mxCell.get() )
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
+    return pNext && pNext->mxCell.get() == mxCell.get();
 }
 
 void CellUndo::setDataToCell( const Data& rData )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 41b4e8ed3f54..4eb42448dd37 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2018,10 +2018,7 @@ SvxCurrencyList_Impl::SvxCurrencyList_Impl(
             m_pCurrencyLb->InsertEntry( *i );
             const NfCurrencyEntry& aCurrencyEntry = rCurrencyTable[ rCurrencyIndex ];
 
-            if ( nPos < nLen )
-                bIsSymbol = false;
-            else
-                bIsSymbol = true;
+            bIsSymbol = nPos >= nLen;
 
             sal_uInt16 nDefaultFormat = aFormatter.GetCurrencyFormatStrings( aStringsDtor, aCurrencyEntry, bIsSymbol );
             const OUString& rFormatStr = aStringsDtor[ nDefaultFormat ];


More information about the Libreoffice-commits mailing list