diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-29 13:13:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-29 19:43:11 +0200 |
commit | 52c2cf22aa78ee886ee447a2629332e1e6f6c611 (patch) | |
tree | 9b91680232117080901a968a90d6bb33c2becda9 /sw/source | |
parent | b81432a23c900329ece07854fd06a322225a97c1 (diff) |
loplugin:simplifybool in sw
Change-Id: Ib842d5a768806fc41a66802908acc8679cf7a985
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95107
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/doccomp.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/lingu/hhcwrp.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 4 |
20 files changed, 40 insertions, 44 deletions
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 1fe455f50968..279fbdeb4c54 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -983,7 +983,7 @@ namespace if( i != i_end && pData->GetIndex( start ) == pData->GetIndex( i ) && !pOtherData->GetChanged( j ) && - !( start == preceding || other_start == other_preceding )) + start != preceding && other_start != other_preceding ) { pData->SetChanged( start++, false ); pData->SetChanged( i ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index c16ffcdd0911..15222f091f25 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1529,8 +1529,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, if( pRule ) { nTmpNum = static_cast<sal_uInt8>(pNd->GetActualListLevel()); - if( !( ! pNd->IsCountedInList() && - (nTmpNum >= nSrchNum )) ) + if( pNd->IsCountedInList() || (nTmpNum < nSrchNum ) ) break; // found it! } else @@ -1696,8 +1695,8 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, pNode = &aIdx.GetNode(); } - while (!(pNode == GetNodes().DocumentSectionStartNode(pStartFromNode) || - pNode == GetNodes().DocumentSectionEndNode(pStartFromNode))); + while (pNode != GetNodes().DocumentSectionStartNode(pStartFromNode) && + pNode != GetNodes().DocumentSectionEndNode(pStartFromNode)); } return pResult; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 83a38236c04d..0604c83930fd 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -825,9 +825,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, const SwContentNode* pNdAfterTOX = pSectNd->GetNodes().GoNext( &aIdx ); const SwAttrSet& aNdAttrSet = pNdAfterTOX->GetSwAttrSet(); const SvxBreak eBreak = aNdAttrSet.GetBreak().GetBreak(); - if ( !( eBreak == SvxBreak::PageBefore || - eBreak == SvxBreak::PageBoth ) - ) + if ( eBreak != SvxBreak::PageBefore && eBreak != SvxBreak::PageBoth ) { pDefaultPageDesc = pNdAfterTOX->FindPageDesc(); } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 7ef60935f672..f59db1e8533e 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -412,8 +412,8 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange, const SwStartNode* pPrvNd; const SwEndNode* pNxtNd; while( nullptr != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) && - !( aIdx.GetIndex() < nCmp && - nCmp < pPrvNd->EndOfSectionIndex() ) ) + ( aIdx.GetIndex() >= nCmp || + nCmp >= pPrvNd->EndOfSectionIndex() ) ) { --aIdx; } @@ -425,8 +425,8 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange, nCmp = pStt->nNode.GetIndex(); while( nullptr != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) && pNxtNd->StartOfSectionNode()->IsSectionNode() && - !( pNxtNd->StartOfSectionIndex() < nCmp && - nCmp < aIdx.GetIndex() ) ) + ( pNxtNd->StartOfSectionIndex() >= nCmp || + nCmp >= aIdx.GetIndex() ) ) { ++aIdx; } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index b0a6055d782f..e854f0935861 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -126,9 +126,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, // NEVER include nodes from the RedLineArea sal_uLong nNd = rInsPos.GetIndex(); - bool bInsOutlineIdx = !( - rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() < nNd && - nNd < rNds.GetEndOfRedlines().GetIndex() ); + bool bInsOutlineIdx = ( + rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() >= nNd || + nNd >= rNds.GetEndOfRedlines().GetIndex() ); if( &rNds == this ) // if in the same node array -> move { @@ -478,9 +478,9 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // NEVER include nodes from the RedLineArea sal_uLong nNd = aIdx.GetIndex(); - bool bInsOutlineIdx = !( rNodes.GetEndOfRedlines(). - StartOfSectionNode()->GetIndex() < nNd && - nNd < rNodes.GetEndOfRedlines().GetIndex() ); + bool bInsOutlineIdx = ( rNodes.GetEndOfRedlines(). + StartOfSectionNode()->GetIndex() >= nNd || + nNd >= rNodes.GetEndOfRedlines().GetIndex() ); if( bNewFrames ) // delete all frames diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx index 95331da7f8a2..e115ed5a688b 100644 --- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx @@ -654,8 +654,8 @@ void SwToContentAnchoredObjectPosition::CalcPosition() // which are anchored inside a table, doesn't follow // the text flow. if ( DoesObjFollowsTextFlow() && - !( aVert.GetRelationOrient() == text::RelOrientation::PAGE_FRAME || - aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) && + ( aVert.GetRelationOrient() != text::RelOrientation::PAGE_FRAME && + aVert.GetRelationOrient() != text::RelOrientation::PAGE_PRINT_AREA ) && !GetAnchorFrame().IsInTab() ) { if ( bMoveable ) @@ -811,8 +811,8 @@ void SwToContentAnchoredObjectPosition::CalcPosition() } if ( DoesObjFollowsTextFlow() && - !( aVert.GetRelationOrient() == text::RelOrientation::PAGE_FRAME || - aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) ) + ( aVert.GetRelationOrient() != text::RelOrientation::PAGE_FRAME && + aVert.GetRelationOrient() != text::RelOrientation::PAGE_PRINT_AREA ) ) { nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(), diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 4b0cf5738cea..c2f9c915d43b 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1986,7 +1986,7 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel( { const sal_Unicode *pBuf = aCellName.getStr(); const sal_Unicode *pEnd = pBuf + nLen; - while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9')) + while (pBuf < pEnd && ('0' > *pBuf || *pBuf > '9')) ++pBuf; // start of number found? if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9')) diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 9965a5b9ca8e..c9a2cdc0dff4 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1412,7 +1412,7 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex) if(static_cast<size_t>(nIndex) == i) break; } - if(!(nIndex >= 0 && o3tl::make_unsigned(nIndex) < rFormats.size())) + if(nIndex < 0 || o3tl::make_unsigned(nIndex) >= rFormats.size()) throw IndexOutOfBoundsException(); SwSectionFormat* pFormat = rFormats[nIndex]; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 762dcf73dd1d..cc90ec288046 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3954,7 +3954,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this))); SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this)); const size_t nRowCount = pTable->GetTabLines().size(); - if (nCount <= 0 || !(0 <= nIndex && o3tl::make_unsigned(nIndex) <= nRowCount)) + if (nCount <= 0 || 0 > nIndex || o3tl::make_unsigned(nIndex) > nRowCount) throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this)); const OUString sTLName = sw_GetCellName(0, nIndex); const SwTableBox* pTLBox = pTable->GetTableBox(sTLName); @@ -4113,7 +4113,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.front(); const size_t nColCount = pLine->GetTabBoxes().size(); - if (nCount <= 0 || !(0 <= nIndex && o3tl::make_unsigned(nIndex) <= nColCount)) + if (nCount <= 0 || 0 > nIndex || o3tl::make_unsigned(nIndex) > nColCount) throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this)); const OUString sTLName = sw_GetCellName(nIndex, 0); const SwTableBox* pTLBox = pTable->GetTableBox( sTLName ); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c5d20fe38d88..7bf77605ed7d 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1616,8 +1616,8 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) const SwTwips nBottom = VisArea().Bottom(); const SwTwips nRight = VisArea().Right(); bool bRet = false; - while ( !bRet && pPage && !((pPage->getFrameArea().Top() > nBottom) || - (pPage->getFrameArea().Left() > nRight))) + while ( !bRet && pPage && ((pPage->getFrameArea().Top() <= nBottom) && + (pPage->getFrameArea().Left() <= nRight))) { if ( pPage->IsInvalid() || pPage->IsInvalidFly() ) bRet = true; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f5551f90ce57..ecdc1860d6e3 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6884,7 +6884,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, // start with the nStart value. Do not write w:start if Numbered Lists // starts from zero.As it's an optional parameter. // refer ECMA 376 Second edition Part-1 - if(!(0 == nLevel && 0 == nStart)) + if(0 != nLevel || 0 != nStart) { m_pSerializer->singleElementNS( XML_w, XML_start, FSNS( XML_w, XML_val ), OString::number(nStart) ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 3b4ed85e97e2..25eb28a85c15 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -965,7 +965,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) if ( nSpacePos<0 ) nSpacePos = aStr.getLength(); - if ( !( aStr.getLength()>1 && aStr[1]=='=') && + if ( ( aStr.getLength() <= 1 || aStr[1] != '=') && (( nDotPos>=0 && nDotPos < nSpacePos ) || ( nSlashPos>=0 && nSlashPos < nSpacePos ))) return aF.nLen; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 30294ca3ab9f..49c8f93714cc 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2139,7 +2139,7 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, bool bValid = checkSeek(*pSt, nFilePos); std::size_t nRemainingSize = pSt->remainingSize(); - if( !(nRemainingSize >= nValidMin && nPLCF >= nValidMin )) + if( nRemainingSize < nValidMin || nPLCF < nValidMin ) bValid = false; nPLCF = bValid ? std::min(nRemainingSize, static_cast<std::size_t>(nPLCF)) : nValidMin; @@ -2506,7 +2506,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, bool bValid = checkSeek(*pSt, nFilePos); std::size_t nRemainingSize = pSt->remainingSize(); - if( !(nRemainingSize >= nValidMin && nPLCF >= nValidMin )) + if( nRemainingSize < nValidMin || nPLCF < nValidMin ) bValid = false; nPLCF = bValid ? std::min(nRemainingSize, static_cast<std::size_t>(nPLCF)) : nValidMin; diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 11d884ec6652..c6eae395ad0e 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1229,8 +1229,8 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove) const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); if(!pBeginAttrib || - !(pBeginAttrib->nStart <= aSelection.nStartPos && - pBeginAttrib->nEnd >= aSelection.nEndPos)) + pBeginAttrib->nStart > aSelection.nStartPos || + pBeginAttrib->nEnd < aSelection.nEndPos) return; //current item has been found diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 693ae7f20b14..458c01d8d725 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2727,8 +2727,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() } if( rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) && !(nId & USER_FMT) && - !( RES_POOLCHR_HTML_BEGIN <= nId && - nId < RES_POOLCHR_HTML_END ) && + ( RES_POOLCHR_HTML_BEGIN > nId || nId >= RES_POOLCHR_HTML_END ) && RES_POOLCHR_INET_NORMAL != nId && RES_POOLCHR_INET_VISIT != nId && RES_POOLCHR_FOOTNOTE != nId && diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8cb4910502c5..6345066d36ba 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -3054,7 +3054,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) pHdl->GetKind() != SdrHdlKind::Anchor_TR; if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle) && - !(rMEvt.GetModifier() == KEY_SHIFT && !bHitHandle)) + (rMEvt.GetModifier() != KEY_SHIFT || bHitHandle)) { rSh.EnterSelFrameMode( &aDocPos ); if ( !m_pApplyTempl ) diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx index 168f6246a33c..6cedaad79681 100644 --- a/sw/source/uibase/lingu/hhcwrp.cxx +++ b/sw/source/uibase/lingu/hhcwrp.cxx @@ -194,7 +194,7 @@ void SwHHCWrapper::HandleNewUnit( const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd ) { OSL_ENSURE( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" ); - if (!(0 <= nUnitStart && nUnitStart <= nUnitEnd)) + if (0 > nUnitStart || nUnitStart > nUnitEnd) return; lcl_ActivateTextShell( m_rWrtShell ); @@ -357,7 +357,7 @@ void SwHHCWrapper::ReplaceUnit( LanguageType *pNewUnitLanguage ) { OSL_ENSURE( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" ); - if (!(nUnitStart >= 0 && nUnitEnd >= nUnitStart)) + if (nUnitStart < 0 || nUnitEnd < nUnitStart) return; lcl_ActivateTextShell( m_rWrtShell ); diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 841dc4a829bb..7cce5f47dd0d 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -548,8 +548,8 @@ void InputEdit::UpdateRange(const OUString& rBoxes, ++nEndPos; } // Only if the current position lies in the range or right behind. - if( bFound && !( nStartPos < o3tl::make_unsigned(aSelection.Max()) && - static_cast<sal_uInt16>(aSelection.Max()) <= nEndPos + 1 )) + if( bFound && ( nStartPos >= o3tl::make_unsigned(aSelection.Max()) || + static_cast<sal_uInt16>(aSelection.Max()) > nEndPos + 1 )) bFound = false; } if( bFound ) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 72481f9a608b..066b6d855c54 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1788,7 +1788,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) if ( SfxItemState::SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, true, &pItem )) { const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem *>(pItem)->GetValue(); - const bool bBookMode = !(0 == nColumns || 0 != (nColumns % 2)) && + const bool bBookMode = (0 != nColumns && 0 == (nColumns % 2)) && static_cast<const SvxViewLayoutItem *>(pItem)->IsBookMode(); SetViewLayout( nColumns, bBookMode ); diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 48d84b512ce7..24e44dfbc675 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -617,7 +617,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c case HANDLE_VIEWSET_RASTER_SUBDIVISION_X : { sal_Int32 nTmp = 0; - if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100)) + if(!(rValue >>= nTmp) || (0 > nTmp || nTmp >= 100)) throw IllegalArgumentException(); mpViewOption->SetDivisionX( static_cast<short>(nTmp) ); } @@ -625,7 +625,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y : { sal_Int32 nTmp = 0; - if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100)) + if(!(rValue >>= nTmp) || (0 > nTmp || nTmp >= 100)) throw IllegalArgumentException(); mpViewOption->SetDivisionY( static_cast<short>(nTmp) ); } |