summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-24 09:24:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-24 11:41:21 +0200
commit3a8ef92bc0c80d4b8c0a7ef78261d262769f1946 (patch)
treeef6dbba07dea625405dcc9f45a77f59c67662851 /sc/source
parent3698b72185c1ee6ff7e2c65fa8f6e7c6bbf0479e (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')
-rw-r--r--sc/source/core/data/attarray.cxx12
-rw-r--r--sc/source/core/data/column.cxx5
-rw-r--r--sc/source/core/data/conditio.cxx10
-rw-r--r--sc/source/core/data/dociter.cxx5
-rw-r--r--sc/source/core/data/dpsave.cxx9
-rw-r--r--sc/source/core/data/dptabres.cxx5
-rw-r--r--sc/source/core/data/formulacell.cxx6
-rw-r--r--sc/source/core/data/tabprotection.cxx5
-rw-r--r--sc/source/core/tool/calcconfig.cxx3
-rw-r--r--sc/source/core/tool/chgtrack.cxx6
-rw-r--r--sc/source/core/tool/compiler.cxx6
-rw-r--r--sc/source/core/tool/dbdata.cxx5
-rw-r--r--sc/source/core/tool/rangelst.cxx5
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx5
-rw-r--r--sc/source/filter/oox/drawingbase.cxx8
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx7
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx8
-rw-r--r--sc/source/ui/app/inputwin.cxx5
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx4
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx5
-rw-r--r--sc/source/ui/formdlg/formula.cxx5
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx3
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx6
-rw-r--r--sc/source/ui/navipi/content.cxx5
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx5
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx22
-rw-r--r--sc/source/ui/vba/vbarange.cxx16
-rw-r--r--sc/source/ui/vba/vbaworkbooks.cxx6
-rw-r--r--sc/source/ui/view/cellsh.cxx9
-rw-r--r--sc/source/ui/view/formatsh.cxx5
-rw-r--r--sc/source/ui/view/output2.cxx9
-rw-r--r--sc/source/ui/view/prevwsh.cxx10
-rw-r--r--sc/source/ui/view/tabcont.cxx5
-rw-r--r--sc/source/ui/view/viewfun2.cxx12
34 files changed, 55 insertions, 187 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index bb81939ad342..f27d24905071 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1912,10 +1912,7 @@ bool ScAttrArray::IsEmpty() const
if (nCount == 1)
{
- if ( pData[0].pPattern != pDocument->GetDefPattern() )
- return false;
- else
- return true;
+ return pData[0].pPattern == pDocument->GetDefPattern();
}
else
return false;
@@ -2238,11 +2235,8 @@ bool ScAttrArray::TestInsertRow( SCSIZE nSize ) const
while ( nFirstLost && pData[nFirstLost-1].nRow >= sal::static_int_cast<SCROW>(MAXROW + 1 - nSize) )
--nFirstLost;
- if ( static_cast<const ScMergeFlagAttr&>(pData[nFirstLost].pPattern->
- GetItem(ATTR_MERGE_FLAG)).IsVerOverlapped() )
- return false;
-
- return true;
+ return !static_cast<const ScMergeFlagAttr&>(pData[nFirstLost].pPattern->
+ GetItem(ATTR_MERGE_FLAG)).IsVerOverlapped();
}
void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize )
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 1f081ca09e98..7a6b57ae673c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -299,10 +299,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
}
}
- if (bOpen)
- return true;
-
- return false;
+ return bOpen;
}
bool ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index ea0762295e87..c6a5dc0713b5 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -897,10 +897,7 @@ bool ScConditionEntry::IsDuplicate( double nArg, const OUString& rStr ) const
return false;
else
{
- if(itr->second > 1)
- return true;
- else
- return false;
+ return itr->second > 1;
}
}
else
@@ -910,10 +907,7 @@ bool ScConditionEntry::IsDuplicate( double nArg, const OUString& rStr ) const
return false;
else
{
- if(itr->second > 1)
- return true;
- else
- return false;
+ return itr->second > 1;
}
}
}
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index c0d534d25073..098220582e92 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -598,10 +598,7 @@ bool isQueryByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem
;
}
- if (rItem.meType == ScQueryEntry::ByString && rMat.IsString(nCol, nRow))
- return true;
-
- return false;
+ return rItem.meType == ScQueryEntry::ByString && rMat.IsString(nCol, nRow);
}
}
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 9b088a1400cc..c10897a0a50a 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -90,12 +90,9 @@ ScDPSaveMember::~ScDPSaveMember()
bool ScDPSaveMember::operator== ( const ScDPSaveMember& r ) const
{
- if ( aName != r.aName ||
- nVisibleMode != r.nVisibleMode ||
- nShowDetailsMode != r.nShowDetailsMode )
- return false;
-
- return true;
+ return aName == r.aName &&
+ nVisibleMode == r.nVisibleMode &&
+ nShowDetailsMode == r.nShowDetailsMode;
}
bool ScDPSaveMember::HasIsVisible() const
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index f411f614d668..fb9e71031219 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -2950,10 +2950,7 @@ void ScDPResultDimension::LateInitFrom(
bool bAllChildren = false;
if( bShowEmpty )
{
- if ( pResultMember->IsNamedItem( rThisData ) )
- bAllChildren = false;
- else
- bAllChildren = true;
+ bAllChildren = !pResultMember->IsNamedItem( rThisData );
}
rParams.SetInitAllChildren( bAllChildren );
rInitState.AddMember( nDimSource, pResultMember->GetDataId() );
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 263f659c3bbe..6e27d845d053 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -303,11 +303,7 @@ lcl_checkRangeDimensions(
++aCur;
}
- if (bOk && aCur == rEnd)
- {
- return true;
- }
- return false;
+ return bOk && aCur == rEnd;
}
class LessByReference : public std::binary_function<const formula::FormulaToken*, const formula::FormulaToken*, bool>
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index 8d6bfa1d8119..526209c62138 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -438,10 +438,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
}
}
ScRangeList aResultList( aRangeList.GetIntersectedRange( rRange));
- if (aResultList.size() == 1 && *aResultList[0] == rRange)
- return true;
-
- return false;
+ return aResultList.size() == 1 && *aResultList[0] == rRange;
}
bool ScTableProtectionImpl::isSelectionEditable( const ScRangeList& rRangeList ) const
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 97863bbacd23..a1c9fd833fcd 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -143,8 +143,7 @@ bool ScCalcConfig::operator== (const ScCalcConfig& r) const
maOpenCLDevice == r.maOpenCLDevice &&
mnOpenCLMinimumFormulaGroupSize == r.mnOpenCLMinimumFormulaGroupSize &&
*mpOpenCLSubsetOpCodes == *r.mpOpenCLSubsetOpCodes &&
- *mpSwInterpreterSubsetOpCodes == *r.mpSwInterpreterSubsetOpCodes &&
- true;
+ *mpSwInterpreterSubsetOpCodes == *r.mpSwInterpreterSubsetOpCodes;
}
bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 91953cb46633..28557677c2a5 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -864,10 +864,8 @@ bool ScChangeActionDel::IsMultiDelete() const
if ( !p || p->GetType() != GetType() )
return false;
const ScChangeActionDel* pDel = static_cast<const ScChangeActionDel*>(p);
- if ( (pDel->GetDx() > GetDx() || pDel->GetDy() > GetDy()) &&
- pDel->GetBigRange() == aBigRange )
- return true;
- return false;
+ return (pDel->GetDx() > GetDx() || pDel->GetDy() > GetDy()) &&
+ pDel->GetBigRange() == aBigRange;
}
bool ScChangeActionDel::IsTabDeleteCol() const
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 686bb6f389b3..42317b1a3a5c 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -183,11 +183,7 @@ bool ScCompiler::IsEnglishSymbol( const OUString& rName )
// 3. new (uno) add in functions
OUString aIntName = ScGlobal::GetAddInCollection()->FindFunction(aUpper, false);
- if (!aIntName.isEmpty())
- {
- return true;
- }
- return false; // no valid function name
+ return !aIntName.isEmpty(); // no valid function name
}
void ScCompiler::InitCharClassEnglish()
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 30fe568f8837..29dfd5472803 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -244,10 +244,7 @@ bool ScDBData::operator== (const ScDBData& rData) const
ScImportParam aImport1, aImport2;
GetImportParam(aImport1);
rData.GetImportParam(aImport2);
- if (!(aImport1 == aImport2))
- return false;
-
- return true;
+ return aImport1 == aImport2;
}
ScDBData::~ScDBData()
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 942e4ca5a1ad..df273054390d 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -535,10 +535,7 @@ template<typename X, typename Y>
bool checkForOneRange(
X nDeleteX1, X nDeleteX2, Y nDeleteY1, Y nDeleteY2, X nX1, X nX2, Y nY1, Y nY2)
{
- if (nDeleteX1 <= nX1 && nX2 <= nDeleteX2 && (nDeleteY1 <= nY1 || nY2 <= nDeleteY2))
- return true;
-
- return false;
+ return nDeleteX1 <= nX1 && nX2 <= nDeleteX2 && (nDeleteY1 <= nY1 || nY2 <= nDeleteY2);
}
bool handleOneRange( const ScRange& rDeleteRange, ScRange* p )
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 3af2b950b971..58836c29dc96 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -106,10 +106,7 @@ bool isValue(const OUString& rStr, double& rVal)
sal_Int32 nEnd = -1;
rVal = rtl::math::stringToDouble(rStr.trim(), '.', ',', nullptr, &nEnd);
- if (nEnd < rStr.getLength())
- return false;
-
- return true;
+ return nEnd >= rStr.getLength();
}
void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs )
diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx
index 4e1283b787eb..fcb5a2c0693b 100644
--- a/sc/source/filter/oox/drawingbase.cxx
+++ b/sc/source/filter/oox/drawingbase.cxx
@@ -176,13 +176,9 @@ bool ShapeAnchor::isAnchorValid() const
// Checks whether the shape is visible based on the anchor
// if From and To anchor has the same attribute values, the shape will not have width and height
// and thus we can assume that such kind of shape will be not be visible
- if (meAnchorType == ANCHOR_TWOCELL &&
+ return !(meAnchorType == ANCHOR_TWOCELL &&
(maTo.mnRow == maFrom.mnRow && maTo.mnCol == maFrom.mnCol) &&
- (maTo.mnColOffset == maFrom.mnColOffset && maTo.mnRowOffset == maFrom.mnRowOffset))
- {
- return false;
- }
- return true;
+ (maTo.mnColOffset == maFrom.mnColOffset && maTo.mnRowOffset == maFrom.mnRowOffset));
}
EmuRectangle ShapeAnchor::calcAnchorRectEmu( const css::awt::Size& rPageSizeHmm ) const
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index e5cd4e991696..5d501c8426cc 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -65,7 +65,7 @@ ScMyValidation::~ScMyValidation()
bool ScMyValidation::IsEqual(const ScMyValidation& aVal) const
{
- if (aVal.bIgnoreBlanks == bIgnoreBlanks &&
+ return aVal.bIgnoreBlanks == bIgnoreBlanks &&
aVal.bShowImputMessage == bShowImputMessage &&
aVal.bShowErrorMessage == bShowErrorMessage &&
aVal.aBaseCell == aBaseCell &&
@@ -77,10 +77,7 @@ bool ScMyValidation::IsEqual(const ScMyValidation& aVal) const
aVal.sErrorMessage == sErrorMessage &&
aVal.sImputMessage == sImputMessage &&
aVal.sFormula1 == sFormula1 &&
- aVal.sFormula2 == sFormula2)
- return true;
- else
- return false;
+ aVal.sFormula2 == sFormula2;
}
ScMyValidationsContainer::ScMyValidationsContainer()
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 )