diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-02 15:42:25 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-05 12:47:48 +0200 |
commit | 4f9b21248ffdf55cef9f3f9d1da76778ee000775 (patch) | |
tree | b059d288339a68aa4c3901f1100e99b04d05a23d /sc | |
parent | b4107411900f5bb4c215e2d9db09fc2b2b82939b (diff) |
simplify ternary conditions "xxx ? yyy : false"
Look for code like:
xxx ? yyy : false;
Which can be simplified to:
xxx && yyy
Change-Id: Ia33c0e452aa28af3f0658a5382895aaad0246b4d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/tabprotection.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/excrecds.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/inc/xlview.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/asciiopt.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/dbgui/imoptdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fusel.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/instbdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/namecrea.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/sharedocdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/select.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 2 |
22 files changed, 30 insertions, 30 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 7cdd62af311a..32324971a002 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -3197,7 +3197,7 @@ SCSIZE ScColumn::GetPatternCount( SCROW nRow1, SCROW nRow2 ) const bool ScColumn::ReservePatternCount( SCSIZE nReserve ) { - return pAttrArray ? pAttrArray->Reserve( nReserve ) : false; + return pAttrArray && pAttrArray->Reserve( nReserve ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 79905b68f76d..0599896315a1 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -118,7 +118,7 @@ SfxPoolItem* ScPatternAttr::Clone( SfxItemPool *pPool ) const inline bool StrCmp( const OUString* pStr1, const OUString* pStr2 ) { - return ( pStr1 ? ( pStr2 ? ( *pStr1 == *pStr2 ) : false ) : ( pStr2 ? false : true ) ); + return ( pStr1 ? ( pStr2 && ( *pStr1 == *pStr2 ) ) : ( pStr2 ? false : true ) ); } inline bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 ) diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index 52bc0fea382c..9beb2063507a 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -293,7 +293,7 @@ void ScTableProtectionImpl::setPasswordHash( const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash, ScPasswordHash eHash2) { sal_Int32 nLen = aPassword.getLength(); - mbEmptyPass = nLen <= 0 ? true : false; + mbEmptyPass = nLen <= 0; meHash1 = eHash; meHash2 = eHash2; maPassHash = aPassword; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 7042189beb4d..949bc9f2647d 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -800,7 +800,7 @@ void ScInterpreter::ScCeil() sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { - bool bAbs = ( nParamCount == 3 ? GetBool() : false ); + bool bAbs = nParamCount == 3 && GetBool(); double fDec = GetDouble(); double fVal = GetDouble(); if ( fDec == 0.0 ) @@ -845,7 +845,7 @@ void ScInterpreter::ScFloor() sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { - bool bAbs = ( nParamCount == 3 ? GetBool() : false ); + bool bAbs = nParamCount == 3 && GetBool(); double fDec = GetDouble(); double fVal = GetDouble(); if ( fDec == 0.0 ) diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 4f37aac58c5a..796b95ca543e 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -302,8 +302,8 @@ const sal_uInt8* ExcDummy_041::GetData( void ) const Exc1904::Exc1904( ScDocument& rDoc ) { Date* pDate = rDoc.GetFormatTable()->GetNullDate(); - bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : false; - bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : false; + bVal = pDate && (*pDate == Date( 1, 1, 1904 )); + bDateCompatibility = pDate && !( *pDate == Date( 30, 12, 1899 )); } diff --git a/sc/source/filter/inc/xlview.hxx b/sc/source/filter/inc/xlview.hxx index ccdea673c039..37d88d0cf5f3 100644 --- a/sc/source/filter/inc/xlview.hxx +++ b/sc/source/filter/inc/xlview.hxx @@ -141,7 +141,7 @@ struct XclTabViewData bool mbShowZeros; /// true = Show zero value zells. bool mbShowOutline; /// true = Show outlines. Color maTabBgColor; /// Tab Color default = (COL_AUTO ) - bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? sal_True : false; }; + bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO); }; sal_uInt32 mnTabBgColorId; /// pallette color id explicit XclTabViewData(); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index c4418de8b331..c547a9eafb6a 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -446,8 +446,8 @@ void ScInputWindow::Select() for ( size_t i = 0; i < nCount; ++i ) { const ScRange aRange( *aMarkRangeList[i] ); - const bool bSetCursor = ( i == nCount - 1 ? true : false ); - const bool bContinue = ( i != 0 ? true : false ); + const bool bSetCursor = ( i == nCount - 1 ); + const bool bContinue = ( i != 0 ); if ( !pViewSh->AutoSum( aRange, bSubTotal, bSetCursor, bContinue ) ) { pViewSh->MarkRange( aRange, false, false ); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 586686de142c..4a3c6c94f3bc 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1449,7 +1449,7 @@ bool ScModule::IsInputMode() bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit ) { ScInputHandler* pHdl = GetInputHdl(); - return ( pHdl ? pHdl->KeyInput( rKEvt, bStartEdit ) : false ); + return pHdl && pHdl->KeyInput( rKEvt, bStartEdit ); } void ScModule::InputEnterHandler( sal_uInt8 nBlockMode ) diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 268e1949dbd8..ef39fdf1d3de 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -272,14 +272,14 @@ void ScAsciiOptions::ReadFromString( const OUString& rString ) if (nCount >= 7) { aToken = rString.getToken(6, ','); - bQuotedFieldAsText = aToken.equalsAscii("true") ? true : false; + bQuotedFieldAsText = aToken.equalsAscii("true"); } // Detect special numbers. if (nCount >= 8) { aToken = rString.getToken(7, ','); - bDetectSpecialNumber = aToken.equalsAscii("true") ? true : false; + bDetectSpecialNumber = aToken.equalsAscii("true"); } else bDetectSpecialNumber = true; // default of versions that didn't add the parameter diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index 4dbc1d45b5d4..39c44a3d702b 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -60,7 +60,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr ) if ( nTokenCount == 4 ) { // compatibility with old options string: "Save as shown" as 4th token, numeric - bSaveAsShown = (rStr.getToken( 3, ',' ).toInt32() ? sal_True : false); + bSaveAsShown = (rStr.getToken( 3, ',' ).toInt32() ? true : false); bQuoteAllText = true; // use old default then } else diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 9a9daa3f42d7..b57fc91ce9f6 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2971,7 +2971,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo if( !rDocShell.GetDocument()->IsImportingXML() ) { - bInsertDocModule = pDoc ? pDoc->IsInVBAMode() : false; + bInsertDocModule = pDoc && pDoc->IsInVBAMode(); } if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) ) bRecord = false; @@ -3017,7 +3017,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ ) bool bSuccess = false; ScDocument* pDoc = rDocShell.GetDocument(); - bool bVbaEnabled = pDoc ? pDoc->IsInVBAMode() : false; + bool bVbaEnabled = pDoc && pDoc->IsInVBAMode(); if (bRecord && !pDoc->IsUndoEnabled()) bRecord = false; if ( bVbaEnabled ) diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 8d1a7ff001a3..402cb4ac1331 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -375,7 +375,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) SetMouseButtonCode(rMEvt.GetButtons()); bool bReturn = FuDraw::MouseButtonUp(rMEvt); - bool bOle = pViewShell ? pViewShell->GetViewFrame()->GetFrame().IsInPlace() : false; + bool bOle = pViewShell && pViewShell->GetViewFrame()->GetFrame().IsInPlace(); SdrObject* pObj = NULL; SdrPageView* pPV = NULL; diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 7b6571a13b12..248504c31696 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -101,7 +101,7 @@ void ScInsertTableDlg::Init_Impl( bool bFromFile ) m_pEdName->Disable(); } - bool bShared = ( rViewData.GetDocShell() ? rViewData.GetDocShell()->IsDocShared() : false ); + bool bShared = rViewData.GetDocShell() && rViewData.GetDocShell()->IsDocShared(); if ( !bFromFile || bShared ) { diff --git a/sc/source/ui/miscdlgs/namecrea.cxx b/sc/source/ui/miscdlgs/namecrea.cxx index 74b462e0f627..722a39500ca7 100644 --- a/sc/source/ui/miscdlgs/namecrea.cxx +++ b/sc/source/ui/miscdlgs/namecrea.cxx @@ -30,10 +30,10 @@ ScNameCreateDlg::ScNameCreateDlg( Window * pParent, sal_uInt16 nFlags ) get(m_pLeftBox, "left"); get(m_pBottomBox, "bottom"); get(m_pRightBox, "right"); - m_pTopBox->Check ( (nFlags & NAME_TOP) ? sal_True : false ); - m_pLeftBox->Check ( (nFlags & NAME_LEFT) ? sal_True : false ); - m_pBottomBox->Check( (nFlags & NAME_BOTTOM)? sal_True : false ); - m_pRightBox->Check ( (nFlags & NAME_RIGHT) ? sal_True : false ); + m_pTopBox->Check ( (nFlags & NAME_TOP) ? true : false ); + m_pLeftBox->Check ( (nFlags & NAME_LEFT) ? true : false ); + m_pBottomBox->Check( (nFlags & NAME_BOTTOM)? true : false ); + m_pRightBox->Check ( (nFlags & NAME_RIGHT) ? true : false ); } sal_uInt16 ScNameCreateDlg::GetFlags() const diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 478a56da7614..ca0e15810a2d 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -93,7 +93,7 @@ ScShareDocumentDlg::ScShareDocumentDlg( Window* pParent, ScViewData* pViewData ) m_aStrUnknownUser = get<FixedText>("unknownuser")->GetText(); m_aStrExclusiveAccess = get<FixedText>("exclusive")->GetText(); - bool bIsDocShared = ( mpDocShell ? mpDocShell->IsDocShared() : false ); + bool bIsDocShared = mpDocShell && mpDocShell->IsDocShared(); m_pCbShare->Check( bIsDocShared ); m_pCbShare->SetToggleHdl( LINK( this, ScShareDocumentDlg, ToggleHandle ) ); m_pFtWarning->Enable( bIsDocShared ); diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 7d35b067a199..1e7ad55be0e7 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -173,7 +173,7 @@ IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG ) IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG ) { - bool bVertical = mpCbStacked->IsChecked() ? true : false; + bool bVertical = mpCbStacked->IsChecked(); SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical ); GetBindings()->GetDispatcher()->Execute( SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 6356d2475399..d85f22feb2cb 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1817,7 +1817,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) { // default for no model is FALSE ScDrawLayer* pModel = pDoc->GetDrawLayer(); - bool bAutoControlFocus = pModel ? pModel->GetAutoControlFocus() : false; + bool bAutoControlFocus = pModel && pModel->GetAutoControlFocus(); ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoControlFocus ); } else if ( aString.equalsAscii( SC_UNO_FORBIDDEN ) ) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 257c0119036b..7d8f4454bc33 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -4477,7 +4477,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const ScDocument* pDoc = pShell ? pShell->GetDocument() : NULL; if (pDoc) { - bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) ) ? sal_True : false; + bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) ) ? true : false; } xFiltProps->setPropertyValue( "ContainsHeader", uno::Any( bHasColHeader ) ); } diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 3dd7df2ca2b6..22d9c435527c 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -386,7 +386,7 @@ void ScGridWindow::UpdateStatusPosSize() bool ScGridWindow::DrawHasMarkedObj() { ScDrawView* p = pViewData->GetScDrawView(); - return p ? p->AreObjectsMarked() : false; + return p && p->AreObjectsMarked(); } void ScGridWindow::DrawMarkDropObj( SdrObject* pObj ) diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index af96c758714b..52d19072bde7 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -414,7 +414,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol ScModule* pScMod = SC_MOD(); ScTabViewShell* pViewShell = pViewData->GetViewShell(); - bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false ); + bool bRefMode = pViewShell && pViewShell->IsRefInputMode(); bool bHide = !bRefMode && !pViewData->IsAnyFillMode() && ( nPosX != (SCsCOL) pViewData->GetCurX() || nPosY != (SCsROW) pViewData->GetCurY() ); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 5312c0d58884..9f002d308aa7 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -288,7 +288,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if ( nPosX != nOldX || nPosY != nOldY || bNew ) { ScTabViewShell* pViewShell = aViewData.GetViewShell(); - bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false ); + bool bRefMode = pViewShell && pViewShell->IsRefInputMode(); if ( aViewData.HasEditView( aViewData.GetActivePart() ) && !bRefMode ) // 23259 oder so { UpdateInputLine(); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index e831738dc009..7d7011490571 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -434,7 +434,7 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) bool bOle = GetViewFrame()->GetFrame().IsInPlace(); bool bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); ScDocShell* pDocShell = ( GetViewData() ? GetViewData()->GetDocShell() : NULL ); - bool bShared = ( pDocShell ? pDocShell->IsDocShared() : false ); + bool bShared = pDocShell && pDocShell->IsDocShared(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); |