From 9529e62a4886f3340ec69be6e6a49de597019a32 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Sun, 2 Nov 2014 12:25:25 +0100 Subject: Use boolean operators instead of ?: with sal_True/sal_False Change-Id: I3e2738210b2fb598e15528e262f76a3ec140ab18 --- sw/source/core/layout/atrfrm.cxx | 8 ++++---- sw/source/core/layout/calcmove.cxx | 6 +++--- sw/source/core/layout/findfrm.cxx | 2 +- sw/source/core/layout/flowfrm.cxx | 22 +++++++++++----------- sw/source/core/layout/fly.cxx | 2 +- sw/source/core/layout/frmtool.cxx | 12 +++++------- sw/source/core/layout/ftnfrm.cxx | 2 +- sw/source/core/layout/layact.cxx | 10 +++++----- sw/source/core/layout/newfrm.cxx | 2 +- 9 files changed, 32 insertions(+), 34 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index a1f389eceab2..80df90cc2c7e 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -438,7 +438,7 @@ sal_uInt16 SwFmtFillOrder::GetValueCount() const SwFmtHeader::SwFmtHeader( SwFrmFmt *pHeaderFmt ) : SfxPoolItem( RES_HEADER ), SwClient( pHeaderFmt ), - bActive( pHeaderFmt ? sal_True : sal_False ) + bActive( pHeaderFmt ) { } @@ -483,7 +483,7 @@ void SwFmtHeader::RegisterToFormat( SwFmt& rFmt ) SwFmtFooter::SwFmtFooter( SwFrmFmt *pFooterFmt ) : SfxPoolItem( RES_FOOTER ), SwClient( pFooterFmt ), - bActive( pFooterFmt ? sal_True : sal_False ) + bActive( pFooterFmt ) { } @@ -765,11 +765,11 @@ SwColumn::SwColumn() : bool SwColumn::operator==( const SwColumn &rCmp ) const { - return (nWish == rCmp.GetWishWidth() && + return nWish == rCmp.GetWishWidth() && GetLeft() == rCmp.GetLeft() && GetRight() == rCmp.GetRight() && GetUpper() == rCmp.GetUpper() && - GetLower() == rCmp.GetLower()) ? sal_True : sal_False; + GetLower() == rCmp.GetLower(); } SwFmtCol::SwFmtCol( const SwFmtCol& rCpy ) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 62b383264d67..51ea4e679dca 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1232,7 +1232,7 @@ void SwCntntFrm::MakeAll() // - current frame width is 0. // - current printing area width is 0. // - frame width is adjusted to a value greater than 0. - // - printing area flag is sal_True. + // - printing area flag is true. // Thus, it's assured that the printing area is adjusted, if the // frame area width changes its width from 0 to something greater // than 0. @@ -1309,7 +1309,7 @@ void SwCntntFrm::MakeAll() (Prt().*fnRect->fnGetPos)() != aOldPrtPos ) { // In this Prepare, an _InvalidateSize() might happen. - // mbValidSize becomes sal_False and Format() gets called. + // mbValidSize becomes false and Format() gets called. Prepare( PREP_POS_CHGD, (const void*)&bFormatted, false ); if ( bWidow && GetFollow() ) { @@ -1920,7 +1920,7 @@ bool SwCntntFrm::_WouldFit( SwTwips nSpace, } // OD 11.04.2003 #108824# - If last follow frame of text // frame isn't valid, a formatting of the next content frame - // doesn't makes sense. Thus, return sal_True. + // doesn't makes sense. Thus, return true. if ( IsAnFollow( pFrm ) && !pFrm->IsValid() ) { OSL_FAIL( "Only a warning for task 108824:/nIsInDocBody(); - const bool bFtn = bBody ? sal_False : pThis->IsInFtn(); + const bool bFtn = !bBody && pThis->IsInFtn(); if ( bBody || bFtn ) { while ( pPrvCnt ) diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 2b101b2c7a14..ba8072682243 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -95,7 +95,7 @@ void SwFlowFrm::SetFollow(SwFlowFrm *const pFollow) } } -/// @return sal_True if any follow has the JoinLocked flag +/// @return true if any follow has the JoinLocked flag bool SwFlowFrm::HasLockedFollow() const { const SwFlowFrm* pFrm = GetFollow(); @@ -112,7 +112,7 @@ bool SwFlowFrm::IsKeepFwdMoveAllowed() { // If all the predecessors up to the first of the chain have // the 'keep' attribute set, and the first of the chain's - // IsFwdMoveAllowed returns sal_False, then we're not allowed to move. + // IsFwdMoveAllowed returns false, then we're not allowed to move. SwFrm *pFrm = &m_rThis; if ( !pFrm->IsInFtn() ) do @@ -428,7 +428,7 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart ) bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, SwFrm *pOldParent ) { - //returns sal_True if there's a LayoutFrm in the chain. + // returns true if there's a LayoutFrm in the chain. bool bRet = false; // The chain beginning with pStart is inserted before pSibling @@ -1010,7 +1010,7 @@ SwLayoutFrm *SwFrm::GetPrevLeaf( MakePageType ) bool SwFlowFrm::IsPrevObjMove() const { - //sal_True The FlowFrm must respect the a border of the predecessor, also needs + // true: The FlowFrm must respect the a border of the predecessor, also needs // to insert a break if required. //!!!!!!!!!!!Hack!!!!!!!!!!! @@ -1067,9 +1067,9 @@ bool SwFlowFrm::IsPrevObjMove() const /** |* If there's a hard page break before the Frm AND there's a -|* predecessor on the same page, sal_True is returned (we need to create a -|* new PageBreak). Otherwise, returns sal_False. -|* If bAct is set to sal_True, this function returns sal_True if +|* predecessor on the same page, true is returned (we need to create a +|* new PageBreak). Otherwise, returns false. +|* If bAct is set to true, this function returns true if |* there's a PageBreak. |* Of course, we don't evaluate the hard page break for follows. |* The page break is in it's own FrmFmt (BEFORE) or in the FrmFmt of the @@ -1126,9 +1126,9 @@ bool SwFlowFrm::IsPageBreak( bool bAct ) const /** |* If there's a hard column break before the Frm AND there is -|* a predecessor in the same column, we return sal_True (we need to create -|* a ColBreak). Otherwise, we return sal_False. -|* If bAct is set to sal_True, we return sal_True if there's a ColBreak. +|* a predecessor in the same column, we return true (we need to create +|* a ColBreak). Otherwise, we return false. +|* If bAct is set to true, we return true if there's a ColBreak. |* Of course, we don't evaluate the hard column break for follows. |* |* The column break is in it's own FrmFmt (BEFORE) or in the FrmFmt of the @@ -1190,7 +1190,7 @@ bool SwFlowFrm::HasParaSpaceAtPages( bool bSct ) const ( pTmp->IsFtnFrm() && !((SwFtnFrm*)pTmp)->GetMaster() ) ) return true; if( pTmp->IsPageFrm() ) - return ( pTmp->GetPrev() && !IsPageBreak(true) ) ? sal_False : sal_True; + return !( pTmp->GetPrev() && !IsPageBreak(true) ); if( pTmp->IsColumnFrm() && pTmp->GetPrev() ) return IsColBreak( true ); if( pTmp->IsSctFrm() && ( !bSct || pTmp->GetPrev() ) ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index f2fc5dc10063..4ca1f0ad97e9 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2462,7 +2462,7 @@ bool SwFlyFrm::GetContour( tools::PolyPolygon& rContour, if( !pNd->HasContour() ) { // OD 16.04.2003 #i13147# - no for a graphic - // during paint. Thus, return (value of should be ). + // during paint. Thus, return (value of should be ). if ( pGrfNd && _bForPaint ) { OSL_FAIL( "SwFlyFrm::GetContour() - No Contour found at during paint." ); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index aba165298493..a4a0c7946e61 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -98,9 +98,7 @@ SwFrmNotify::SwFrmNotify( SwFrm *pF ) : mnFlyAnchorOfstNoWrap = 0; } - bHadFollow = pF->IsCntntFrm() ? - (((SwCntntFrm*)pF)->GetFollow() ? sal_True : sal_False) : - sal_False; + bHadFollow = pF->IsCntntFrm() && ((SwCntntFrm*)pF)->GetFollow(); } SwFrmNotify::~SwFrmNotify() @@ -1225,11 +1223,11 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, { pDoc->getIDocumentTimerAccess().BlockIdling(); SwRootFrm* pLayout = pLay->getRootFrm(); - const bool bOldCallbackActionEnabled = pLayout ? pLayout->IsCallbackActionEnabled() : sal_False; + const bool bOldCallbackActionEnabled = pLayout && pLayout->IsCallbackActionEnabled(); if( bOldCallbackActionEnabled ) pLayout->SetCallbackActionEnabled( false ); - //In the generation of the Layout will be bPage with sal_True handed over. + //In the generation of the Layout bPages=true will be handed over. //Then will be new pages generated all x paragraphs already times in advance. //On breaks and/or pagedescriptorchanges the correspondig will be generated //immediately. @@ -1253,7 +1251,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, SwActualSection *pActualSection = 0; SwLayHelper *pPageMaker; - //If the layout will be created (bPages == sal_True) we do head on the progress + //If the layout will be created (bPages == true) we do head on the progress //Flys and DrawObjekte are not connected immediately, this //happens only at the end of the function. if ( bPages ) @@ -1740,7 +1738,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, if( pTmp ) { SwFrm* pOldUp = pTmp->GetFrm().GetUpper(); - // MoveFwd==sal_True means that we are still on the same page. + // MoveFwd==true means that we are still on the same page. // But since we want to move if possible! bool bTmpOldLock = pTmp->IsJoinLocked(); pTmp->LockJoin(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index de205fe97be5..cebf082a950a 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -68,7 +68,7 @@ bool SwFtnFrm::operator<( const SwTxtFtn* pTxtFtn ) const |* bool lcl_NextFtnBoss( SwFtnBossFrm* pBoss, SwPageFrm* pPage) |* sets pBoss on the next SwFtnBossFrm, which can either be a column |* or a page (without columns). If the page changes meanwhile, -|* pPage contains the new page and this function returns sal_True. +|* pPage contains the new page and this function returns true. |* |*/ diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 80832d3b5372..70619a855a93 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -470,7 +470,7 @@ void SwLayAction::InternalAction() pPage = (SwPageFrm*)pPage->GetNext(); IDocumentLayoutAccess *pLayoutAccess = pRoot->GetFmt()->getIDocumentLayoutAccess(); - bool bNoLoop = pPage ? SwLayouter::StartLoopControl( pRoot->GetFmt()->GetDoc(), pPage ) : sal_False; + bool bNoLoop = pPage && SwLayouter::StartLoopControl( pRoot->GetFmt()->GetDoc(), pPage ); sal_uInt16 nPercentPageNum = 0; while ( (pPage && !IsInterrupt()) || nCheckPageNum != USHRT_MAX ) { @@ -1836,8 +1836,8 @@ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt, } } -/// Returns sal_True if all Cntnts of the Fly have been processed completely. -/// Returns sal_False if processing has been interrupted prematurely. +/// Returns true if all Cntnts of the Fly have been processed completely. +/// Returns false if processing has been interrupted prematurely. bool SwLayAction::_FormatFlyCntnt( const SwFlyFrm *pFly ) { const SwCntntFrm *pCntnt = pFly->ContainsCntnt(); @@ -2234,8 +2234,8 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : if ( bCrsrShell ) // If the Crsr was visible, we need to make it visible again. - // Otherwise, EndCrsrMove with sal_True for IdleEnd - ((SwCrsrShell*)pSh)->EndCrsrMove( sal_True^aBools[nBoolIdx] ); + // Otherwise, EndCrsrMove with true for IdleEnd + ((SwCrsrShell*)pSh)->EndCrsrMove( !aBools[nBoolIdx] ); if( bUnlock ) { if( bCrsrShell ) diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index ae0ff76550a1..07ad00049a92 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -484,7 +484,7 @@ void SwRootFrm::Init( SwFrmFmt* pFmt ) pTimerAccess->StopIdling(); // For creating the Flys by MakeFrms() pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() ); - bCallbackActionEnabled = false; // needs to be set to sal_True before leaving! + bCallbackActionEnabled = false; // needs to be set to true before leaving! SwDrawModel* pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel(); if ( pMd ) -- cgit