From 93193e23750c2739f4e929cb28149509d97a4d8b Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Mon, 10 Nov 2014 01:08:39 +0100 Subject: sw: convert 'a ? b : sal_False' to 'a && b' Change-Id: I4b7829a1abe1459f2e4915159588fd3e16a14eea --- sw/source/core/access/acccontext.cxx | 2 +- sw/source/core/doc/tblafmt.cxx | 2 +- sw/source/core/docnode/node.cxx | 4 +--- sw/source/core/edit/edlingu.cxx | 5 ++--- sw/source/core/frmedt/feshview.cxx | 2 +- sw/source/core/frmedt/fetab.cxx | 2 +- sw/source/core/txtnode/txtedt.cxx | 2 +- sw/source/core/unocore/unotbl.cxx | 2 +- sw/source/filter/html/css1atr.cxx | 2 +- sw/source/uibase/config/modcfg.cxx | 2 +- sw/source/uibase/config/usrpref.cxx | 4 ++-- sw/source/uibase/dochdl/gloshdl.cxx | 4 ++-- sw/source/uibase/fldui/fldmgr.cxx | 4 +--- sw/source/uibase/lingu/hyp.cxx | 2 +- sw/source/uibase/uiview/viewling.cxx | 4 ++-- sw/source/uibase/uiview/viewprt.cxx | 4 ++-- sw/source/uibase/uno/unomod.cxx | 3 +-- sw/source/uibase/uno/unotxdoc.cxx | 2 +- 18 files changed, 23 insertions(+), 29 deletions(-) (limited to 'sw') diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 3cc2ca663dd4..8021c1908a98 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -55,7 +55,7 @@ using namespace ::com::sun::star::accessibility; void SwAccessibleContext::InitStates() { - bIsShowingState = GetMap() ? IsShowing( *(GetMap()) ) : sal_False; + bIsShowingState = GetMap() && IsShowing( *(GetMap()) ); SwViewShell *pVSh = GetMap()->GetShell(); bIsEditableState = pVSh && IsEditable( pVSh ); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index e1220c683fde..27d40ccda10a 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -879,7 +879,7 @@ void SwTableAutoFmt::StoreTableProperties(const SwTable &table) SwEditShell *pShell = pDoc->GetEditShell(); SwFmtRowSplit *pRowSplit = 0; pDoc->GetRowSplit(*pShell->getShellCrsr(false), pRowSplit); - m_bRowSplit = pRowSplit ? pRowSplit->GetValue() : sal_False; + m_bRowSplit = pRowSplit && pRowSplit->GetValue(); delete pRowSplit; pRowSplit = 0; diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 8857a58b9c36..f24d25bbf358 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -437,9 +437,7 @@ bool SwNode::IsProtect() const if( pFlyFmt->GetProtect().IsCntntProtected() ) return true; const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor(); - return rAnchor.GetCntntAnchor() - ? rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect() - : sal_False; + return rAnchor.GetCntntAnchor() && rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect(); } if( 0 != ( pSttNd = FindFootnoteStartNode() ) ) diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 6785e7ff42ba..f9c455356bb9 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -414,9 +414,8 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) bool SwHyphIter::IsAuto() { uno::Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() ); - return xProp.is() ? *(sal_Bool*)xProp->getPropertyValue( - OUString(UPN_IS_HYPH_AUTO) ).getValue() - : sal_False; + return xProp.is() && *(sal_Bool*)xProp->getPropertyValue( + OUString(UPN_IS_HYPH_AUTO) ).getValue(); } void SwHyphIter::ShowSelection() diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 18bcf016e03d..44e991071e76 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2384,7 +2384,7 @@ bool SwFEShell::IsAlignPossible() const SwDrawContact *pC = (SwDrawContact*)GetUserCall(pO); OSL_ENSURE( pC, "No SwDrawContact!"); //only as character bound drawings can be aligned - bRet = pC ? (pC->GetFmt()->GetAnchor().GetAnchorId() == FLY_AS_CHAR) : sal_False; + bRet = pC && pC->GetFmt()->GetAnchor().GetAnchorId() == FLY_AS_CHAR; } if ( bRet ) return Imp()->GetDrawView()->IsAlignPossible(); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 01c707a215bf..86480505ac9d 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -2342,7 +2342,7 @@ bool SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const SwFrm *pFrm = (SwFrm *)GetBox( rPt ); const SwTabFrm* pTabFrm = pFrm ? pFrm->ImplFindTabFrm() : 0; OSL_ENSURE( pTabFrm, "Table not found" ); - return pTabFrm ? pTabFrm->IsRightToLeft() : sal_False; + return pTabFrm && pTabFrm->IsRightToLeft(); } bool SwFEShell::IsTableVertical() const diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 02deb0dfd605..a7ea3cf9f2d7 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1326,7 +1326,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV // within the word LanguageType eActLang = aScanner.GetCurrentLanguage(); - bool bSpell = xSpell.is() ? xSpell->hasLanguage( eActLang ) : sal_False; + bool bSpell = xSpell.is() && xSpell->hasLanguage( eActLang ); if( bSpell && !rWord.isEmpty() ) { // check for: bAlter => xHyphWord.is() diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 8b91e845fd01..dcfdf18badad 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2114,7 +2114,7 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) ((SfxPoolItem&)aSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH); bPutSize = true; } - bool bTemp = pSzRel ? *(sal_Bool*)pSzRel->getValue() : sal_False; + bool bTemp = pSzRel && *(sal_Bool*)pSzRel->getValue(); if(pSzRel && bTemp && pRelWidth) { ((SfxPoolItem&)aSz).PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS); diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index f32790cf5c98..049fdb17b8da 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -1662,7 +1662,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc, // Size: If the only difference is the Landscape-Flag, // only export Portrait oder Landscape. Otherwise export size. - bool bRefLandscape = pRefPageDesc ? pRefPageDesc->GetLandscape() : sal_False; + bool bRefLandscape = pRefPageDesc && pRefPageDesc->GetLandscape(); Size aRefSz; const Size& rSz = rPageDesc.GetMaster().GetFrmSize().GetSize(); if( pRefPageDesc ) diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx index 5bd15b35d1bb..9313aa9582bd 100644 --- a/sw/source/uibase/config/modcfg.cxx +++ b/sw/source/uibase/config/modcfg.cxx @@ -916,7 +916,7 @@ void SwInsertConfig::Load() { if(pValues[nProp].hasValue()) { - bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *(sal_Bool*)pValues[nProp].getValue(); switch(nProp) { case INS_PROP_TABLE_HEADER: diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index fb8010a1f821..88aa1f3df64a 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -177,7 +177,7 @@ void SwContentViewConfig::Load() { if(pValues[nProp].hasValue()) { - bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + bool bSet = nProp != 16 && *(sal_Bool*)pValues[nProp].getValue(); switch(nProp) { case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject", @@ -433,7 +433,7 @@ void SwGridConfig::Load() { if(pValues[nProp].hasValue()) { - bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + bool bSet = nProp < 3 && *(sal_Bool*)pValues[nProp].getValue(); sal_Int32 nSet = 0; if(nProp >= 3) pValues[nProp] >>= nSet; diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 4e62f0a17c33..995584f2acb2 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -393,7 +393,7 @@ bool SwGlossaryHdl::ExpandGlossary() if(pWrtShell->IsSelection()) aShortName = pWrtShell->GetSelTxt(); } - return pGlossary ? Expand( aShortName, &rStatGlossaries, pGlossary ) : sal_False; + return pGlossary && Expand( aShortName, &rStatGlossaries, pGlossary ); } bool SwGlossaryHdl::Expand( const OUString& rShortName, @@ -693,7 +693,7 @@ bool SwGlossaryHdl::IsOld() const { SwTextBlocks *pGlossary = pCurGrp ? pCurGrp : rStatGlossaries.GetGroupDoc(aCurGrp); - bool bRet = pGlossary ? pGlossary->IsOld() : sal_False; + bool bRet = pGlossary && pGlossary->IsOld(); if( !pCurGrp ) delete pGlossary; return bRet; diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index def26f114f9d..887fb91fe033 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -733,9 +733,7 @@ bool SwFldMgr::GoNextPrev( bool bNext, SwFieldType* pTyp ) return pSh->MoveFldType( 0, bNext, RES_DBFLD ); } - return (pTyp && pSh) - ? pSh->MoveFldType( pTyp, bNext ) - : sal_False; + return pTyp && pSh && pSh->MoveFldType( pTyp, bNext ); } // insert field types diff --git a/sw/source/uibase/lingu/hyp.cxx b/sw/source/uibase/lingu/hyp.cxx index a683fdbc4c6e..1f1e2ffaf298 100644 --- a/sw/source/uibase/lingu/hyp.cxx +++ b/sw/source/uibase/lingu/hyp.cxx @@ -54,7 +54,7 @@ SwHyphWrapper::SwHyphWrapper( SwView* pVw, bInfoBox( false ) { uno::Reference< linguistic2::XLinguProperties > xProp( GetLinguPropertySet() ); - bAutomatic = xProp.is() ? xProp->getIsHyphAuto() : sal_False; + bAutomatic = xProp.is() && xProp->getIsHyphAuto(); SetHyphen(); } diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 68ff90b860c3..8a880767c819 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -269,7 +269,7 @@ void SwView::SpellStart( SvxSpellArea eWhich, SwConversionArgs *pConvArgs ) { Reference< XLinguProperties > xProp = ::GetLinguPropertySet(); - bool bIsWrapReverse = (!pConvArgs && xProp.is()) ? xProp->getIsWrapReverse() : sal_False; + bool bIsWrapReverse = !pConvArgs && xProp.is() && xProp->getIsWrapReverse(); SwDocPositions eStart = DOCPOS_START; SwDocPositions eEnde = DOCPOS_END; @@ -449,7 +449,7 @@ void SwView::HyphenateDocument() m_pWrtShell->StartUndo(UNDO_INSATTR); // valid later - bool bHyphSpecial = xProp.is() ? xProp->getIsHyphSpecial() : sal_False; + bool bHyphSpecial = xProp.is() && xProp->getIsHyphSpecial(); bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection() || m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext(); bool bOther = m_pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection; diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 3d64f8b8b834..59f18ac037c4 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -191,11 +191,11 @@ void SwView::ExecutePrint(SfxRequest& rReq) { SwWrtShell* pSh = &GetWrtShell(); SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, false); - bool bSilent = pSilentItem ? pSilentItem->GetValue() : sal_False; + bool bSilent = pSilentItem && pSilentItem->GetValue(); SFX_REQUEST_ARG(rReq, pPrintFromMergeItem, SfxBoolItem, FN_QRY_MERGE, false); if(pPrintFromMergeItem) rReq.RemoveItem(FN_QRY_MERGE); - bool bFromMerge = pPrintFromMergeItem ? pPrintFromMergeItem->GetValue() : sal_False; + bool bFromMerge = pPrintFromMergeItem && pPrintFromMergeItem->GetValue(); SwMiscConfig aMiscConfig; bool bPrintSelection = false; if(!bSilent && !bFromMerge && diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 2614c3574d6b..4ab522c0b35f 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -608,8 +608,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c IllegalArgumentException, WrappedTargetException, RuntimeException) { - bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle ? - *(sal_Bool*)rValue.getValue() : sal_False; + bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle && *(sal_Bool*)rValue.getValue(); // the API flag should not be set to the application's view settings switch( rInfo.mnHandle ) { diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 3cb41d5e6765..f2585c088b18 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3989,7 +3989,7 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions) aRenderViewOptions.SetLineBreak( false ); // breaks (type 1) aRenderViewOptions.SetPageBreak( false ); // breaks (type 2) aRenderViewOptions.SetColumnBreak( false ); // breaks (type 3) - bool bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : sal_False; + bool bVal = pPrtOptions && pPrtOptions->bPrintHiddenText; if (bContainsHiddenChars) aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text if (bContainsHiddenFields) -- cgit