diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-24 09:24:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-24 11:41:21 +0200 |
commit | 3a8ef92bc0c80d4b8c0a7ef78261d262769f1946 (patch) | |
tree | ef6dbba07dea625405dcc9f45a77f59c67662851 /sc/source/ui | |
parent | 3698b72185c1ee6ff7e2c65fa8f6e7c6bbf0479e (diff) |
clang-tidy readability-simplify-boolean-expr in sc
Change-Id: I702e52e56487f201b9e0d7af21ff8167464aa58c
Reviewed-on: https://gerrit.libreoffice.org/36876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/formdlg/formula.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/conflictsdlg.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpformula.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworkbooks.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 12 |
18 files changed, 31 insertions, 109 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index fa2733e51e8b..cfcf74a6b74f 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -1630,13 +1630,9 @@ void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool bRemoveAll ) bool ScAccessibleSpreadsheet::IsScAddrFormulaSel(const ScAddress &addr) const { - if( addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX && + return addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX && addr.Row() >= m_nMinY && addr.Row() <= m_nMaxY && - addr.Tab() == mpViewShell->GetViewData().GetTabNo() ) - { - return true; - } - return false; + addr.Tab() == mpViewShell->GetViewData().GetTabNo(); } bool ScAccessibleSpreadsheet::CheckChildIndex(sal_Int32 nIndex) const diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index be4ab18234c0..713a0fd5f451 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -639,10 +639,7 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) bool ScInputWindow::IsPointerAtResizePos() { - if ( GetOutputSizePixel().Height() - GetPointerPosPixel().Y() <= 4 ) - return true; - else - return false; + return GetOutputSizePixel().Height() - GetPointerPosPixel().Y() <= 4; } void ScInputWindow::MouseMove( const MouseEvent& rMEvt ) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index cf4d20082181..a7f8508b0942 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1641,9 +1641,7 @@ void ScCheckListBox::Init() bool ScCheckListBox::IsChecked( const OUString& sName, SvTreeListEntry* pParent ) { SvTreeListEntry* pEntry = FindEntry( pParent, sName ); - if ( pEntry && GetCheckButtonState( pEntry ) == SvButtonState::Checked) - return true; - return false; + return pEntry && GetCheckButtonState( pEntry ) == SvButtonState::Checked; } void ScCheckListBox::CheckEntry( const OUString& sName, SvTreeListEntry* pParent, bool bCheck ) diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index ad3617c9666f..ca1cfbdedf40 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -627,10 +627,7 @@ void ScCondFormatDlg::RefInputDone( bool bForced ) bool ScCondFormatDlg::IsTableLocked() const { - if (mpLastEdit && mpLastEdit != mpEdRange) - return false; - - return true; + return !mpLastEdit || mpLastEdit == mpEdRange; } bool ScCondFormatDlg::IsRefInputMode() const diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 9491ee964788..4cb52d5ca53b 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -451,10 +451,7 @@ bool ScFormulaDlg::IsDocAllowed(SfxObjectShell* pDocSh) const { // not allowed: different from this doc, and no name // pDocSh is always a ScDocShell - if (pDocSh && &static_cast<ScDocShell*>(pDocSh)->GetDocument() != m_pDoc && !pDocSh->HasName()) - return false; - - return true; // everything else is allowed + return !(pDocSh && &static_cast<ScDocShell*>(pDocSh)->GetDocument() != m_pDoc && !pDocSh->HasName()); // everything else is allowed } void ScFormulaDlg::SetActive() diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 1b68a73c1c8a..b334e658aa69 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -112,8 +112,7 @@ void ScFormulaReferenceHelper::enableInput( bool bEnable ) if(pParent) { pParent->EnableInput(bEnable); - if(true) - pViewSh->EnableRefInput(bEnable); + pViewSh->EnableRefInput(bEnable); } } } diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index a6c7104e9271..a37e1226eb0f 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -160,11 +160,7 @@ ScConflictsFinder::~ScConflictsFinder() bool ScConflictsFinder::DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 ) { - if ( pAction1 && pAction2 && pAction1->GetBigRange().Intersects( pAction2->GetBigRange() ) ) - { - return true; - } - return false; + return pAction1 && pAction2 && pAction1->GetBigRange().Intersects( pAction2->GetBigRange() ); } ScConflictsListEntry* ScConflictsFinder::GetIntersectingEntry( const ScChangeAction* pAction ) const diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index a1f9ba8d1dde..2cf0cec52da3 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1135,10 +1135,7 @@ bool ScContentTree::NoteStringsChanged() pEntry = NextSibling(pEntry); } - if ( pEntry ) - return true; - - return false; + return pEntry != nullptr; } bool ScContentTree::DrawNamesChanged( ScContentId nType ) diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 3cb64e4244b8..104661b61ddb 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -190,10 +190,7 @@ bool ScTpFormulaOptions::IsValidSeparatorSet() const // Make sure the column and row separators are different. OUString aColStr = mpEdSepArrayCol->GetText(); OUString aRowStr = mpEdSepArrayRow->GetText(); - if (aColStr == aRowStr) - return false; - - return true; + return aColStr != aRowStr; } IMPL_LINK( ScTpFormulaOptions, ButtonHdl, Button*, pBtn, void ) diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 2a21fd58107a..cab984e09dbe 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1749,18 +1749,14 @@ void RangeAnalyzer::analyzeRange( sal_Int32& rnDataInRows, bool RangeAnalyzer::inSameSingleRow( RangeAnalyzer& rOther ) { - if( mnStartRow==rOther.mnStartRow && - mnRowCount==1 && rOther.mnRowCount==1 ) - return true; - return false; + return mnStartRow==rOther.mnStartRow && + mnRowCount==1 && rOther.mnRowCount==1; } bool RangeAnalyzer::inSameSingleColumn( RangeAnalyzer& rOther ) { - if( mnStartColumn==rOther.mnStartColumn && - mnColumnCount==1 && rOther.mnColumnCount==1 ) - return true; - return false; + return mnStartColumn==rOther.mnStartColumn && + mnColumnCount==1 && rOther.mnColumnCount==1; } std::pair<OUString, OUString> constructKey(const uno::Reference< chart2::data::XLabeledDataSequence>& xNew) @@ -3156,17 +3152,11 @@ uno::Sequence< OUString > SAL_CALL ScChart2DataSequence::generateLabel(chart2::d { if (nRows > nCols) { - if (eOrigin == chart2::data::LabelOrigin_SHORT_SIDE) - bColumn = true; - else - bColumn = false; + bColumn = eOrigin == chart2::data::LabelOrigin_SHORT_SIDE; } else if (nCols > nRows) { - if (eOrigin == chart2::data::LabelOrigin_SHORT_SIDE) - bColumn = false; - else - bColumn = true; + bColumn = eOrigin != chart2::data::LabelOrigin_SHORT_SIDE; } else return Sequence<OUString>(); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 8339a5ea538e..8f715d6b8d54 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -522,19 +522,13 @@ public: bool isBooleanType() { - if ( getNumberFormat() & util::NumberFormat::LOGICAL ) - return true; - return false; + return (getNumberFormat() & util::NumberFormat::LOGICAL) != 0; } bool isDateType() { sal_Int16 nType = getNumberFormat(); - if(( nType & util::NumberFormat::DATETIME )) - { - return true; - } - return false; + return ( nType & util::NumberFormat::DATETIME ) != 0; } OUString getNumberFormatString() @@ -2275,10 +2269,8 @@ ScVbaRange::Select() bool cellInRange( const table::CellRangeAddress& rAddr, sal_Int32 nCol, sal_Int32 nRow ) { - if ( nCol >= rAddr.StartColumn && nCol <= rAddr.EndColumn && - nRow >= rAddr.StartRow && nRow <= rAddr.EndRow ) - return true; - return false; + return nCol >= rAddr.StartColumn && nCol <= rAddr.EndColumn && + nRow >= rAddr.StartRow && nRow <= rAddr.EndRow; } void setCursor( SCCOL nCol, SCROW nRow, const uno::Reference< frame::XModel >& xModel, bool bInSel = true ) diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index c26088c42f1a..a0cefaeb7982 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -180,11 +180,9 @@ bool ScVbaWorkbooks::isSpreadSheetFile( const OUString& sType ) { // include calc_QPro etc. ? ( not for the moment anyway ) - if ( sType.startsWith( "calc_MS" ) + return sType.startsWith( "calc_MS" ) || sType.startsWith( "calc8" ) - || sType.startsWith( "calc_StarOffice" ) ) - return true; - return false; + || sType.startsWith( "calc_StarOffice" ); } OUString diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index b432808cbebc..40e9c650f0a7 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -372,14 +372,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) { ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); // Allow editing annotation by Id (without selecting the cell) for LOK - if( isLOKNoTiledAnnotations || rDoc.GetNote(aPos) ) - { - bDisable = false; - } - else - { - bDisable = true; - } + bDisable = !(isLOKNoTiledAnnotations || rDoc.GetNote(aPos)); } break; } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 230223517223..b55f25186ea3 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2484,10 +2484,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) { // if scientific, bThousand is used for engineering notation const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits(); - if (nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0)) - bThousand = true; - else - bThousand = false; + bThousand = nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0); } OUString aFormat; static OUString sBreak = ","; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 50090a289c7e..88f70a8e7249 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1129,13 +1129,8 @@ bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY ) return false; const ScPatternAttr* pPattern = mpDoc->GetPattern( nX, nY, nTab ); - if ( static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)).IsMerged() || - static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).IsOverlapped() ) - { - return false; - } - - return true; + return !(static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)).IsMerged() || + static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).IsOverlapped()); } // nX, nArrY: loop variables from DrawStrings / DrawEdit diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index c4bf44f6c84a..30bd7a7b27b5 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -290,15 +290,9 @@ void ScPreviewShell::UpdateNeededScrollBars( bool bFromZoom ) // recalculate any needed scrollbars long nMaxWidthPos = aPageSize.Width() - aWindowSize.Width(); - if ( nMaxWidthPos<0 ) - bHori = false; - else - bHori = true; + bHori = nMaxWidthPos >= 0; long nMaxHeightPos = aPageSize.Height() - aWindowSize.Height(); - if ( nMaxHeightPos < 0 ) - bVert = false; - else - bVert = true; + bVert = nMaxHeightPos >= 0; // see if having a scroll bar requires the other if ( bVert != bHori && ( bVert || bHori ) ) diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 0329c023ef8a..8534373ba48b 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -588,10 +588,7 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt ) bool ScTabControl::StartRenaming() { - if ( pViewData->GetDocument()->IsDocEditable() ) - return true; - else - return false; + return pViewData->GetDocument()->IsDocEditable(); } TabBarAllowRenamingReturnCode ScTabControl::AllowRenaming() diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 59609fbebfe0..4e7f7a8866e9 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -276,11 +276,7 @@ static bool lcl_FindNextSumEntryInColumn( ScDocument* pDoc, SCCOL nCol, SCROW& n { --nRow; } - if ( eSkip == ScAutoSumSum && nRow < nTmp ) - { - return true; - } - return false; + return eSkip == ScAutoSumSum && nRow < nTmp; } static bool lcl_FindNextSumEntryInRow( ScDocument* pDoc, SCCOL& nCol, SCROW nRow, @@ -293,11 +289,7 @@ static bool lcl_FindNextSumEntryInRow( ScDocument* pDoc, SCCOL& nCol, SCROW nRow { --nCol; } - if ( eSkip == ScAutoSumSum && nCol < nTmp ) - { - return true; - } - return false; + return eSkip == ScAutoSumSum && nCol < nTmp; } static bool lcl_GetAutoSumForColumnRange( ScDocument* pDoc, ScRangeList& rRangeList, const ScRange& rRange ) |