From 2eb991561c3ca6751bfe3bd674de28d7677e993d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 29 Nov 2016 17:18:20 +0100 Subject: Rewrite some (trivial) assignments inside if/while conditions: sw Change-Id: I288c5125a1316828df74f73aeaac85392638ffd8 --- sw/inc/calbck.hxx | 3 ++- sw/source/core/attr/format.cxx | 12 ++++++++---- sw/source/core/crsr/crsrsh.cxx | 6 ++++-- sw/source/core/crsr/swcrsr.cxx | 14 ++++++++------ sw/source/core/crsr/trvltbl.cxx | 3 ++- sw/source/core/doc/docsort.cxx | 3 ++- sw/source/core/doc/tblrwcl.cxx | 9 ++++----- sw/source/core/docnode/node.cxx | 6 ++++-- sw/source/core/fields/authfld.cxx | 6 ++++-- sw/source/core/layout/calcmove.cxx | 16 ++++++++++------ sw/source/core/layout/ftnfrm.cxx | 4 ++-- sw/source/core/layout/pagechg.cxx | 3 ++- sw/source/core/layout/paintfrm.cxx | 20 ++++++++++++++------ sw/source/core/layout/tabfrm.cxx | 3 ++- sw/source/core/unocore/unoframe.cxx | 23 +++++++++++++---------- sw/source/core/view/viewsh.cxx | 3 ++- sw/source/filter/basflt/shellio.cxx | 3 ++- sw/source/filter/html/swhtml.cxx | 9 ++++++--- sw/source/filter/ww8/ww8graf2.cxx | 3 ++- sw/source/ui/fldui/fldedt.cxx | 3 ++- sw/source/ui/fldui/javaedit.cxx | 3 ++- sw/source/ui/misc/srtdlg.cxx | 3 ++- sw/source/uibase/app/docsh.cxx | 4 ++-- sw/source/uibase/dochdl/swdtflvr.cxx | 6 ++++-- sw/source/uibase/fldui/fldwrap.cxx | 9 ++++----- sw/source/uibase/misc/redlndlg.cxx | 5 ++--- sw/source/uibase/ribbar/conarc.cxx | 5 ++--- sw/source/uibase/ribbar/conpoly.cxx | 5 ++--- sw/source/uibase/ribbar/drawbase.cxx | 3 ++- sw/source/uibase/shells/textsh1.cxx | 4 ++-- sw/source/uibase/uiview/viewdraw.cxx | 10 ++++++++-- sw/source/uibase/uiview/viewtab.cxx | 6 ++++-- sw/source/uibase/wrtsh/move.cxx | 8 ++++++-- 33 files changed, 137 insertions(+), 86 deletions(-) diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 7ab28b11370c..92d457c1261e 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -256,7 +256,8 @@ namespace sw WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } WriterListener* GoStart() { - if((m_pPosition = m_rRoot.m_pWriterListeners)) + m_pPosition = m_rRoot.m_pWriterListeners; + if(m_pPosition) while( m_pPosition->m_pLeft ) m_pPosition = m_pPosition->m_pLeft; return m_pCurrent = m_pPosition; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index a71e0ff29131..f9bd0a6c37c4 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -495,7 +495,8 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr ) if(IsModifyLocked()) { - if( ( bRet = m_aSet.Put( aTempSet ) ) ) + bRet = m_aSet.Put( aTempSet ); + if( bRet ) { m_aSet.SetModifyAtAttr( this ); } @@ -528,7 +529,8 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr ) (RES_GRFFMTCOLL == nFormatWhich || RES_TXTFMTCOLL == nFormatWhich ) ) ) { - if( ( bRet = (nullptr != m_aSet.Put( rAttr ))) ) + bRet = nullptr != m_aSet.Put( rAttr ); + if( bRet ) m_aSet.SetModifyAtAttr( this ); // #i71574# if ( nFormatWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE ) @@ -599,7 +601,8 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet ) if(IsModifyLocked()) { - if( ( bRet = m_aSet.Put( aTempSet ) ) ) + bRet = m_aSet.Put( aTempSet ); + if( bRet ) { m_aSet.SetModifyAtAttr( this ); } @@ -633,7 +636,8 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet ) ( RES_GRFFMTCOLL == nFormatWhich || RES_TXTFMTCOLL == nFormatWhich ) ) ) { - if( ( bRet = m_aSet.Put( aTempSet )) ) + bRet = m_aSet.Put( aTempSet ); + if( bRet ) m_aSet.SetModifyAtAttr( this ); // #i71574# if ( nFormatWhich == RES_TXTFMTCOLL ) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index a6eeb6f7c05b..a16ce8dc3ffa 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1320,7 +1320,8 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect ) bool bVis; // switch off all cursors when scrolling // if a cursor is visible then hide the SV cursor - if( ( bVis = m_pVisibleCursor->IsVisible() ) ) + bVis = m_pVisibleCursor->IsVisible(); + if( bVis ) m_pVisibleCursor->Hide(); m_bVisPortChgd = true; @@ -2543,7 +2544,8 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ) { if( *ppDelRing == m_pCurrentCursor ) { - if( ( bDelete = GoNextCursor() ) ) + bDelete = GoNextCursor(); + if( bDelete ) { bGoNext = false; pTmp = pTmp->GetNext(); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index f2d4a64062aa..931a6dec1fe1 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -593,16 +593,17 @@ bool SwCursor::IsInProtectTable( bool bMove, bool bChgCursor ) SwNodeIndex aCellStt( *GetNode().FindTableBoxStartNode()->EndOfSectionNode(), 1 ); bool bProt = true; GoNextCell: - do { + for (;;) { if( !aCellStt.GetNode().IsStartNode() ) break; ++aCellStt; if( nullptr == ( pCNd = aCellStt.GetNode().GetContentNode() )) pCNd = aCellStt.GetNodes().GoNext( &aCellStt ); - if( !( bProt = pCNd->IsProtect() )) + bProt = pCNd->IsProtect(); + if( !bProt ) break; aCellStt.Assign( *pCNd->FindTableBoxStartNode()->EndOfSectionNode(), 1 ); - } while( bProt ); + } SetNextCursor: if( !bProt ) // found free cell @@ -642,16 +643,17 @@ SetNextCursor: SwNode* pNd; bool bProt = true; GoPrevCell: - do { + for (;;) { if( !( pNd = &aCellStt.GetNode())->IsEndNode() ) break; aCellStt.Assign( *pNd->StartOfSectionNode(), +1 ); if( nullptr == ( pCNd = aCellStt.GetNode().GetContentNode() )) pCNd = pNd->GetNodes().GoNext( &aCellStt ); - if( !( bProt = pCNd->IsProtect() )) + bProt = pCNd->IsProtect(); + if( !bProt ) break; aCellStt.Assign( *pNd->FindTableBoxStartNode(), -1 ); - } while( bProt ); + } SetPrevCursor: if( !bProt ) // found free cell diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 62c2dc082000..472c2766a782 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -95,7 +95,8 @@ bool SwCursorShell::GoNextCell( bool bAppendLine ) static_cast(this)->EndAllAction(); } } - if( bRet && ( bRet = pCursor->GoNextCell() ) ) + bRet = bRet && pCursor->GoNextCell(); + if( bRet ) UpdateCursor(); } return bRet; diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index cc24c5f9b34e..e23c961d5138 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -753,7 +753,8 @@ FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const FndBox_& rBox) : nRow(0), nCol(0) { // If the array is symmetric - if( (bSym = CheckLineSymmetry(rBoxRef)) ) + bSym = CheckLineSymmetry(rBoxRef); + if( bSym ) { // Determine column/row count nCols = GetColCount(rBoxRef); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 0a86446243ec..0e4a3ebd763d 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -3627,8 +3627,8 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else { - if( ( bRet = bLeft ? nDist != 0 - : ( rSz.GetWidth() - nDist ) > COLFUZZY ) ) + bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY; + if( bRet ) { for( n = 0; n < m_aLines.size(); ++n ) { @@ -3780,9 +3780,8 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // First, see if there is enough room at all if( bInsDel ) { - if( ( bRet = bLeft ? nDist != 0 - : ( rSz.GetWidth() - nDist ) > COLFUZZY ) && - !aParam.bBigger ) + bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY; + if( bRet && !aParam.bBigger ) { bRet = (*fnOtherBox)( pLine, aParam, 0, true ); if( bRet && !aParam.bAnyBoxFnd ) diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 7e54c68ca1eb..fa98422c937b 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1446,7 +1446,8 @@ bool SwContentNode::SetAttr(const SfxPoolItem& rAttr ) { SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ), aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ); - if( ( bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ) ) + bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ); + if( bRet ) { SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld ); SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew ); @@ -1520,7 +1521,8 @@ bool SwContentNode::SetAttr( const SfxItemSet& rSet ) { SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ), aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ); - if( (bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) ) + bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew ); + if( bRet ) { // Some special treatment for Attributes SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld ); diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 27fc7d33359b..a2ce70de6b28 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -423,7 +423,8 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) case FIELD_PROP_LOCALE: { css::lang::Locale aLocale; - if( (bRet = rAny >>= aLocale )) + bRet = rAny >>= aLocale; + if( bRet ) SetLanguage( LanguageTag::convertToLanguageType( aLocale )); } break; @@ -431,7 +432,8 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) case FIELD_PROP_PROP_SEQ: { Sequence aSeq; - if( (bRet = rAny >>= aSeq) ) + bRet = rAny >>= aSeq; + if( bRet ) { m_SortKeyArr.clear(); const PropertyValues* pValues = aSeq.getConstArray(); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index c7ebf84ae900..8f65b8ed8da9 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -269,14 +269,18 @@ void SwFrame::PrepareMake(vcl::RenderContext* pRenderContext) bFoll = pThis->IsFollow(); bNoSect = false; } - else if ( bCnt && (bFoll = pThis->IsFollow()) && GetPrev() ) + else if ( bCnt ) { - //Do not follow the chain when we need only one instance - const SwTextFrame* pMaster = static_cast(this)->FindMaster(); - if ( pMaster && pMaster->IsLocked() ) + bFoll = pThis->IsFollow(); + if ( bFoll && GetPrev() ) { - MakeAll(pRenderContext); - return; + //Do not follow the chain when we need only one instance + const SwTextFrame* pMaster = static_cast(this)->FindMaster(); + if ( pMaster && pMaster->IsLocked() ) + { + MakeAll(pRenderContext); + return; + } } } diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 6ec9160ac346..44eab116b817 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2672,10 +2672,10 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, SwFootnoteBossFrame *pO if ( pNewUpper ) { - bool bSameBoss = true; SwFootnoteBossFrame * const pNewBoss = pNewUpper->FindFootnoteBossFrame(); // Are we changing the column/page? - if ( !( bSameBoss = (pNewBoss == pOldBoss) ) ) + bool bSameBoss = pNewBoss == pOldBoss; + if ( !bSameBoss ) { bSamePage = pOldBoss->FindPageFrame() == pNewBoss->FindPageFrame(); // page change? pNewUpper->Calc(getRootFrame()->GetCurrShell()->GetOut()); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 8405280e5169..735af25573ea 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -192,7 +192,8 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg // create and insert body area if it is not a blank page SwDoc *pDoc = pFormat->GetDoc(); - if ( !(m_bEmptyPage = (pFormat == pDoc->GetEmptyPageFormat())) ) + m_bEmptyPage = pFormat == pDoc->GetEmptyPageFormat(); + if ( !m_bEmptyPage ) { m_bEmptyPage = false; Calc(pRenderContext); // so that the PrtArea is correct diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index b73b625c2008..a5471f7df4a9 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3589,8 +3589,8 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec return; SwShortCut aShortCut( *pFrame, rRect ); - bool bCnt; - if ( (bCnt = pFrame->IsContentFrame()) ) + bool bCnt = pFrame->IsContentFrame(); + if ( bCnt ) pFrame->Calc(&rRenderContext); if ( pFrame->IsFootnoteContFrame() ) @@ -3652,8 +3652,12 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec { gProp.pSGlobalShell->InvalidateWindows( aPaintRect ); pFrame = pFrame->GetNext(); - if ( pFrame && (bCnt = pFrame->IsContentFrame()) ) - pFrame->Calc(&rRenderContext); + if ( pFrame ) + { + bCnt = pFrame->IsContentFrame(); + if ( bCnt ) + pFrame->Calc(&rRenderContext); + } continue; } } @@ -3684,8 +3688,12 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec pFrame = pFrame->GetNext(); - if ( pFrame && (bCnt = pFrame->IsContentFrame()) ) - pFrame->Calc(&rRenderContext); + if ( pFrame ) + { + bCnt = pFrame->IsContentFrame(); + if ( bCnt ) + pFrame->Calc(&rRenderContext); + } } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index e22b064990d1..97dfccb8ec8b 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3307,7 +3307,8 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool &rReformat long nNewWidth = (pNewUpper->Prt().*fnRectX->fnGetWidth)(); if( std::abs( nNewWidth - nOldWidth ) < 2 ) { - if( !( bMoveAnyway = (BwdMoveNecessary( pOldPage, Frame() ) > 1) ) ) + bMoveAnyway = BwdMoveNecessary( pOldPage, Frame() ) > 1; + if( !bMoveAnyway ) { SwRect aRect( pNewUpper->Prt() ); aRect.Pos() += pNewUpper->Frame().Pos(); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 43ff3cec26bd..33565d39033d 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2552,18 +2552,21 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) pFormat->SetFormatAttr(aSet); } } - else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME)) - || rPropertyName == UNO_NAME_CHAIN_PREV_NAME) + else { - SwDoc* pDoc = pFormat->GetDoc(); - if(bNextFrame) - pDoc->Unchain(*pFormat); - else + bNextFrame = rPropertyName == UNO_NAME_CHAIN_NEXT_NAME; + if( bNextFrame || rPropertyName == UNO_NAME_CHAIN_PREV_NAME ) { - SwFormatChain aChain( pFormat->GetChain() ); - SwFrameFormat *pPrev = aChain.GetPrev(); - if(pPrev) - pDoc->Unchain(*pPrev); + SwDoc* pDoc = pFormat->GetDoc(); + if(bNextFrame) + pDoc->Unchain(*pFormat); + else + { + SwFormatChain aChain( pFormat->GetChain() ); + SwFrameFormat *pPrev = aChain.GetPrev(); + if(pPrev) + pDoc->Unchain(*pPrev); + } } } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 9d94244d7729..83a58afc203b 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1604,7 +1604,8 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) for ( size_t i = 0; i < pRegion->size(); ++i ) { const SwRect &rTmp = (*pRegion)[i]; - if ( !(bStop = rTmp.IsOver( VisArea() )) ) + bStop = rTmp.IsOver( VisArea() ); + if ( !bStop ) break; } if ( bStop ) diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 69e5ed9cb688..c9f300379892 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -119,7 +119,8 @@ sal_uLong SwReader::Read( const Reader& rOptions ) if( bSaveUndo ) { // the reading of the page template cannot be undone! - if( ( bReadPageDescs = po->aOpt.IsPageDescs() ) ) + bReadPageDescs = po->aOpt.IsPageDescs(); + if( bReadPageDescs ) { bSaveUndo = false; pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 7d81018855be..9b4fac0e3d48 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -593,10 +593,13 @@ void SwHTMLParser::Continue( int nToken ) } m_bSetModEnabled = false; - if( m_pDoc->GetDocShell() && - (m_bSetModEnabled = m_pDoc->GetDocShell()->IsEnableSetModified()) ) + if( m_pDoc->GetDocShell() ) { - m_pDoc->GetDocShell()->EnableSetModified( false ); + m_bSetModEnabled = m_pDoc->GetDocShell()->IsEnableSetModified(); + if( m_bSetModEnabled ) + { + m_pDoc->GetDocShell()->EnableSetModified( false ); + } } // waehrend des einlesens kein OLE-Modified rufen diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 90e60214fd84..08099375f463 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -287,7 +287,8 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, if (nData > 0) { rpGraphic = new Graphic(); - if (!(bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt))) + bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt); + if (!bOk) DELETEZ(rpGraphic); } return bOk; // Contains graphic diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 09cf8a99b6a9..c310348ccfdf 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -143,7 +143,8 @@ void SwFieldEditDlg::Init() rMgr.GoPrev(); m_pNextBT->Enable(bMove); - if( ( bMove = rMgr.GoPrev() ) ) + bMove = rMgr.GoPrev(); + if( bMove ) rMgr.GoNext(); m_pPrevBT->Enable( bMove ); diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 4c8d82e3c90b..137ceb7ee552 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -154,7 +154,8 @@ void SwJavaEditDialog::CheckTravel() if( bNext ) pMgr->GoPrev(); - if( ( bPrev = pMgr->GoPrev() ) ) + bPrev = pMgr->GoPrev(); + if( bPrev ) pMgr->GoNext(); bTravel |= bNext || bPrev; diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 5c781853a02b..aeaff222cdf4 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -358,7 +358,8 @@ void SwSortDlg::Apply() { SwWait aWait( *rSh.GetView().GetDocShell(), true ); rSh.StartAllAction(); - if( (bRet = rSh.Sort( aOptions ))) + bRet = rSh.Sort( aOptions ); + if( bRet ) rSh.SetModified(); rSh.EndAllAction(); } diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 235c553c4f6d..2872e78040f4 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -806,8 +806,8 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, sal_uInt16 nAspect ) { //fix #25341# Draw should not affect the Modified - bool bResetModified; - if ( (bResetModified = IsEnableSetModified()) ) + bool bResetModified = IsEnableSetModified(); + if ( bResetModified ) EnableSetModified( false ); // When there is a JobSetup connected to the Document, we copy it to diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 9e8a3f8cefcb..b139536b10d2 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2269,7 +2269,8 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, case SotClipboardFormatId::NETSCAPE_BOOKMARK: case SotClipboardFormatId::FILEGRPDESCRIPTOR: case SotClipboardFormatId::UNIFORMRESOURCELOCATOR: - if( ( bRet = rData.GetINetBookmark( nFormat, aBkmk ) )) + bRet = rData.GetINetBookmark( nFormat, aBkmk ); + if( bRet ) { if( SwPasteSdr::SetAttr == nAction ) nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK; @@ -2281,7 +2282,8 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, case SotClipboardFormatId::SIMPLE_FILE: { OUString sText; - if( ( bRet = rData.GetString( nFormat, sText ) ) ) + bRet = rData.GetString( nFormat, sText ); + if( bRet ) { OUString sDesc; SwTransferable::CheckForURLOrLNKFile( rData, sText, &sDesc ); diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx index 38b45e577fa5..9380d20924c5 100644 --- a/sw/source/uibase/fldui/fldwrap.cxx +++ b/sw/source/uibase/fldui/fldwrap.cxx @@ -91,9 +91,8 @@ SwFieldDlgWrapper::SwFieldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, // newly initialise dialog after Doc switch bool SwFieldDlgWrapper::ReInitDlg(SwDocShell *pDocSh) { - bool bRet; - - if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, Doc switch + bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); + if (bRet) // update immediately, Doc switch { pDlgInterface->ReInitDlg(); } @@ -138,8 +137,8 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal // re-init after doc activation bool SwFieldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh) { - bool bRet; - if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, Doc switch + bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); + if (bRet) // update immediately, Doc switch { pDlgInterface->ReInitDlg(); } diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 891c245d35f9..ccfc18e8fb77 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -75,9 +75,8 @@ SwRedlineAcceptChild::SwRedlineAcceptChild( vcl::Window* _pParent, // newly initialise dialog after document switch bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh) { - bool bRet; - - if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, doc switch! + bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); + if (bRet) // update immediately, doc switch! static_cast(GetWindow())->Activate(); return bRet; diff --git a/sw/source/uibase/ribbar/conarc.cxx b/sw/source/uibase/ribbar/conarc.cxx index 33b4a2cade5a..4373c677ecac 100644 --- a/sw/source/uibase/ribbar/conarc.cxx +++ b/sw/source/uibase/ribbar/conarc.cxx @@ -32,9 +32,8 @@ ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt ) { - bool bReturn; - - if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt))) + bool bReturn = SwDrawBase::MouseButtonDown(rMEvt); + if (bReturn) { if (!m_nButtonUpCount) m_aStartPoint = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); diff --git a/sw/source/uibase/ribbar/conpoly.cxx b/sw/source/uibase/ribbar/conpoly.cxx index 3a8df72e21a0..eb1125fca610 100644 --- a/sw/source/uibase/ribbar/conpoly.cxx +++ b/sw/source/uibase/ribbar/conpoly.cxx @@ -35,9 +35,8 @@ ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* p bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt) { - bool bReturn; - - if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt))) + bool bReturn = SwDrawBase::MouseButtonDown(rMEvt); + if (bReturn) aLastPos = rMEvt.GetPosPixel(); return bReturn; diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx index 820a99e14052..fbcb2589e236 100644 --- a/sw/source/uibase/ribbar/drawbase.cxx +++ b/sw/source/uibase/ribbar/drawbase.cxx @@ -201,7 +201,8 @@ bool SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt) if (!m_pSh->IsSelFrameMode()) m_pSh->EnterSelFrameMode(); - if( (bReturn = m_pSh->BeginMark(m_aStartPos)) ) + bReturn = m_pSh->BeginMark(m_aStartPos); + if( bReturn ) m_pWin->SetDrawAction(true); SetDrawPointer(); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index cb4017cf26f9..010e14ebaedc 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -770,8 +770,8 @@ void SwTextShell::Execute(SfxRequest &rReq) OUString sFormula(static_cast(pItem)->GetValue()); SwFieldMgr aFieldMgr; rWrtSh.StartAllAction(); - bool bDelSel; - if( (bDelSel = rWrtSh.HasSelection()) ) + bool bDelSel = rWrtSh.HasSelection(); + if( bDelSel ) { rWrtSh.StartUndo( UNDO_START ); rWrtSh.DelRight(); diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 9f0d1a58c015..1d322df294be 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -687,8 +687,11 @@ bool SwView::HasDrwObj(SdrObject *pSdrObj) const const size_t nCnt = pList->GetObjCount(); for (size_t i = 0; i < nCnt; ++i) - if ((bRet = HasDrwObj(pList->GetObj(i)))) + { + bRet = HasDrwObj(pList->GetObj(i)); + if (bRet) break; + } } else if (SdrInventor::Default == pSdrObj->GetObjInventor() || pSdrObj->Is3DObj()) return true; @@ -706,8 +709,11 @@ bool SwView::HasOnlyObj(SdrObject *pSdrObj, SdrInventor eObjInventor) const const size_t nCnt = pList->GetObjCount(); for (size_t i = 0; i < nCnt; ++i) - if (!(bRet = HasOnlyObj(pList->GetObj(i), eObjInventor))) + { + bRet = HasOnlyObj(pList->GetObj(i), eObjInventor); + if (!bRet) break; + } } else if (eObjInventor == pSdrObj->GetObjInventor()) return true; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 84eaceb7ef29..adca0764286c 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1648,7 +1648,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) { SwTabCols aTabCols; size_t nNum = 0; - if ( ( m_bSetTabColFromDoc = IsTabColFromDoc() ) ) + m_bSetTabColFromDoc = IsTabColFromDoc(); + if ( m_bSetTabColFromDoc ) { rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos ); nNum = rSh.GetCurMouseTabColNum( m_aTabColFromDocPos ); @@ -1892,7 +1893,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) !(nFrameType & FrameTypeFlags::COLSECT ) ) ) { SwTabCols aTabCols; - if ( ( m_bSetTabRowFromDoc = IsTabRowFromDoc() ) ) + m_bSetTabRowFromDoc = IsTabRowFromDoc(); + if ( m_bSetTabRowFromDoc ) { rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos ); } diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 0970b14f62b2..b26db5abca90 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -87,8 +87,12 @@ bool SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, bool bSelect ) bRet = (this->*FnSimpleMove)(); EndCursorMove(); } - else if( ( bRet = (this->*FnSimpleMove)() ) ) - MoveCursor(); + else + { + bRet = (this->*FnSimpleMove)(); + if( bRet ) + MoveCursor(); + } return bRet; } -- cgit