diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 13:32:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-14 18:03:06 +0200 |
commit | e67657d5211f6e95ddf8bd621108608573b00d5d (patch) | |
tree | 66724101dbd95721714bd40fcb4861663432774c /sw | |
parent | 186def8f48e273c3a3b4d23b3ab2efd0d8664731 (diff) |
loplugin:simplifybool more
look for expressions like
!(a && !b)
which can be expanded out
Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
44 files changed, 78 insertions, 80 deletions
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 292099c5e316..3b0ca8fcc21a 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -203,7 +203,7 @@ SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE if (!pFrame) return; pFlyFrame = pFrame->FindFlyFrame(); - if ( !(pFlyFrame && !m_rShell.IsTableMode()) ) + if ( !pFlyFrame || m_rShell.IsTableMode() ) return; const SwNodeIndex* pIndex = pFlyFrame->GetFormat()->GetContent().GetContentIdx(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index a2a169339bae..26ed4473924e 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -3702,7 +3702,7 @@ void SwCursorShell::GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes, SwPaM* pCursor = GetCursor(); SwPosition aPos( *pCursor->GetPoint() ); SwTextNode *pNode = aPos.nNode.GetNode().GetTextNode(); - if ( !(pNode && !pNode->IsInProtectSect()) ) + if ( !pNode || pNode->IsInProtectSect() ) return; const SwWrongList *pSmartTagList = pNode->GetSmartTags(); @@ -3713,7 +3713,7 @@ void SwCursorShell::GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes, sal_Int32 nBegin = nCurrent; sal_Int32 nLen = 1; - if (!(pSmartTagList->InWrongWord(nBegin, nLen) && !pNode->IsSymbolAt(nBegin))) + if (!pSmartTagList->InWrongWord(nBegin, nLen) || pNode->IsSymbolAt(nBegin)) return; const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin ); @@ -3754,7 +3754,7 @@ void SwCursorShell::GetSmartTagRect( const Point& rPt, SwRect& rSelectRect ) sal_Int32 nBegin = aPos.nContent.GetIndex(); sal_Int32 nLen = 1; - if (!(pSmartTagList->InWrongWord(nBegin, nLen) && !pNode->IsSymbolAt(nBegin))) + if (!pSmartTagList->InWrongWord(nBegin, nLen) || pNode->IsSymbolAt(nBegin)) return; // get smarttag word diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index cf544c08a536..3479e62c2c37 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -300,7 +300,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) } } - if ( !(!m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly()) ) + if ( m_pCursorShell->IsCursorReadonly() && !m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() ) return; if ( m_pCursorShell->GetDrawView() ) @@ -450,7 +450,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) // talks about "the" cursor at the moment. As long as that's true, // don't say anything about the Writer cursor till a draw object is // being edited. - if (!(comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject())) + if (!comphelper::LibreOfficeKit::isActive() || pView->GetTextEditObject()) return; // If pSelectionRectangles is set, we're just collecting the text selections -> don't emit start/end. diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index 03e00df6ceee..5d9a6faa94f4 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -86,7 +86,7 @@ void DocumentStatisticsManager::SetDocStat( const SwDocStat& rStat ) void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields ) { - if( !(mpDocStat->bModified || !mbInitialized)) + if( !mpDocStat->bModified && mbInitialized) return; if (!bCompleteAsync) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 69dcd0f98039..005927fbee51 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1221,7 +1221,7 @@ const SwFormatINetFormat* SwDoc::FindINetAttr( const OUString& rName ) const void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress ) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); - if( !(pExtDoc && !rOutNds.empty()) ) + if( !pExtDoc || rOutNds.empty() ) return; ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.size(), GetDocShell() ); diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index a6ecd452e576..385afa6846ea 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1759,8 +1759,8 @@ void SaveBookmark::SetInDoc( else aPam.GetPoint()->nContent.Assign(aPam.GetContentNode(), m_nContent1); - if(!(!aPam.HasMark() - || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true))) + if(aPam.HasMark() + && !CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true)) return; ::sw::mark::IBookmark* const pBookmark = dynamic_cast<::sw::mark::IBookmark*>( diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index b3eba9df2dbd..d5d16626650e 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1840,7 +1840,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd, } // The main entries should get their character style - if (!(xCharStyleIdx && !xCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty())) + if (!xCharStyleIdx || xCharStyleIdx->empty() || GetMainEntryCharStyle().isEmpty()) return; // eventually the last index must me appended diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 4ef745fc1926..f59efb8b10a4 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -51,8 +51,8 @@ namespace TextFormatCollFunc } // #i73790# - if ( !(!pTextFormatColl->StayAssignedToListLevelOfOutlineStyle() && - pTextFormatColl->IsAssignedToListLevelOfOutlineStyle()) ) + if ( pTextFormatColl->StayAssignedToListLevelOfOutlineStyle() || + !pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() ) return; if (!pNewNumRuleItem) diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 437ec985e9be..8022218db3db 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -1455,8 +1455,8 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv // left or right. Here we calculate their width. m_nInhAbsLeftSpace = 0; m_nInhAbsRightSpace = 0; - if( !(!IsTopTable() && (m_nRelLeftFill>0 || m_nRelRightFill>0 || - nAbsTabWidth<nAbsAvail)) ) + if( IsTopTable() || + !(m_nRelLeftFill>0 || m_nRelRightFill>0 || nAbsTabWidth<nAbsAvail) ) return; // Calculate the width of additional cells we use for diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 6860d57a0fa8..ea8bd57e796f 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -912,7 +912,7 @@ void SwSetExpField::SetValue(const double& rValue, SwRootFrame const*const pLayo { SetValue(rValue); } - if (!(!pLayout || pLayout->IsHideRedlines())) + if (pLayout && !pLayout->IsHideRedlines()) return; m_fValueRLHidden = rValue; diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 7b8adb96bbd0..ab5537502d18 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -327,8 +327,8 @@ static void lcl_formatReferenceLanguage( OUString& rRefText, } } // not a title text starting already with a definitive article - if ( !(!sNumbering.startsWith("A ") && !sNumbering.startsWith("Az ") && - !sNumbering.startsWith("a ") && !sNumbering.startsWith("az ")) ) + if ( sNumbering.startsWith("A ") || sNumbering.startsWith("Az ") || + sNumbering.startsWith("a ") || sNumbering.startsWith("az ") ) return; // lowercase, if rReferenceLanguage == "hu", not "Hu" diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 33bfd4ede834..55ced4c704bc 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -839,7 +839,7 @@ void SwGrfNode::ApplyInputStream( void SwGrfNode::UpdateLinkWithInputStream() { // do not work on link, if a <SwapIn> has been triggered. - if ( !(!mbInSwapIn && IsLinkedFile()) ) + if ( mbInSwapIn || !IsLinkedFile() ) return; GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly ); diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 23334a44a01b..0d7a8658b46e 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -523,7 +523,7 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() */ void SwAnchoredDrawObject::InvalidatePage_( SwPageFrame* _pPageFrame ) { - if ( !(_pPageFrame && !_pPageFrame->GetFormat()->GetDoc()->IsInDtor()) ) + if ( !_pPageFrame || _pPageFrame->GetFormat()->GetDoc()->IsInDtor() ) return; if ( !_pPageFrame->GetUpper() ) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index ce6abc998735..953b527ee65b 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -329,7 +329,7 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) return; } - if ( !(!SwOszControl::IsInProgress( this ) && !IsLocked() && !IsColLocked()) ) + if ( SwOszControl::IsInProgress( this ) || IsLocked() || IsColLocked() ) return; // #i28701# - use new method <GetPageFrame()> diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 2a56f8e5cb04..0ade3a3315ed 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -388,7 +388,7 @@ SwFrameNotify::~SwFrameNotify() COVERITY_NOEXCEPT_FALSE // #i61999# // no invalidation of columned Writer fly frames, because automatic // width doesn't make sense for such Writer fly frames. - if ( !(pFly->Lower() && !pFly->Lower()->IsColumnFrame()) ) + if ( !pFly->Lower() || pFly->Lower()->IsColumnFrame() ) return; const SwFormatFrameSize &rFrameSz = pFly->GetFormat()->GetFrameSize(); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index d506251278ff..93076422c5dd 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -228,7 +228,7 @@ void SwLayAction::PaintContent( const SwContentFrame *pCnt, PaintContent_( pCnt, pPage, aPaintRect ); } - if ( !(pCnt->IsRetouche() && !pCnt->GetNext()) ) + if ( !pCnt->IsRetouche() || pCnt->GetNext() ) return; const SwFrame *pTmp = pCnt; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a3454140ed82..9dbd735fabe9 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3543,10 +3543,10 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateDashedIndicator void SwPageFrame::PaintBreak( ) const { - if ( !(gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER && - !gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() && - !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && - !gProp.pSGlobalShell->IsPreview()) ) + if ( gProp.pSGlobalShell->GetOut()->GetOutDevType() == OUTDEV_PRINTER || + gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() || + gProp.pSGlobalShell->GetViewOptions()->IsReadonly() || + gProp.pSGlobalShell->IsPreview() ) return; const SwFrame* pBodyFrame = Lower(); @@ -3580,10 +3580,10 @@ void SwPageFrame::PaintBreak( ) const void SwColumnFrame::PaintBreak( ) const { - if ( !(gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER && - !gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() && - !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && - !gProp.pSGlobalShell->IsPreview()) ) + if ( gProp.pSGlobalShell->GetOut()->GetOutDevType() == OUTDEV_PRINTER || + gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() || + gProp.pSGlobalShell->GetViewOptions()->IsReadonly() || + gProp.pSGlobalShell->IsPreview() ) return; const SwFrame* pBodyFrame = Lower(); @@ -5657,7 +5657,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co void SwPageFrame::PaintMarginArea( const SwRect& _rOutputRect, SwViewShell const * _pViewShell ) const { - if ( !(_pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode()) ) + if ( !_pViewShell->GetWin() || _pViewShell->GetViewOptions()->getBrowseMode() ) return; // Simplified paint with DrawingLayer FillStyle diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index a81b7f1c198c..288ac0e760c8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1360,7 +1360,7 @@ void SwTabFrame::Join() SwTabFrame *pFoll = GetFollow(); - if (!(pFoll && !pFoll->IsJoinLocked())) + if (!pFoll || pFoll->IsJoinLocked()) return; SwRectFnSet aRectFnSet(this); @@ -3747,7 +3747,7 @@ void SwTabFrame::Paste( SwFrame* pParent, SwFrame* pSibling ) // b) The new follower was previously the first in a chain GetNext()->InvalidatePrt_(); - if ( !(pPage && !IsFollow()) ) + if ( !pPage || IsFollow() ) return; if ( pPage->GetUpper() ) diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 04035710861a..9c342a384770 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4227,10 +4227,10 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode( std::set<sal_uLong> *const pSkipped) { auto const pMerged(rFrame.GetMergedPara()); - if (!(pMerged + if (!pMerged // do this only *once*, for the *last* frame // otherwise AppendObj would create multiple frames for fly-frames! - && !rFrame.GetFollow())) + || rFrame.GetFollow()) return; assert(pMerged->pFirstNode->GetIndex() <= rTextNode.GetIndex() diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 50bbe3ebf883..e7840331969c 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -602,7 +602,7 @@ void SwOLENode::DisconnectFileLink_Impl() void SwOLENode::CheckFileLink_Impl() { - if ( !(maOLEObj.m_xOLERef.GetObject().is() && !mpObjectLink) ) + if ( !maOLEObj.m_xOLERef.GetObject().is() || mpObjectLink ) return; try diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 474e9fb4ee5d..e8ca2b1c7623 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -309,7 +309,7 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) { - if( !(m_pImp && !m_pImp->m_bInPutMuchBlocks) ) + if( !m_pImp || m_pImp->m_bInPutMuchBlocks ) return; m_pImp->m_nCurrentIndex = USHRT_MAX; diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index b36b62a05a41..45f5fb716633 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -451,7 +451,7 @@ static void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, else if ( bRefreshHidden ) ::lcl_RefreshHidden( rToFill, nPos ); - if ( !(bHidden && !bRefreshHidden) ) + if ( !bHidden || bRefreshHidden ) return; // calculate minimum/maximum values for the existing entries: diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 8513f33b078c..1a18447cd6f7 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -116,7 +116,7 @@ void SwTextFrame::ValidateFrame() static void ValidateBodyFrame_( SwFrame *pFrame ) { vcl::RenderContext* pRenderContext = pFrame ? pFrame->getRootFrame()->GetCurrShell()->GetOut() : nullptr; - if( !(pFrame && !pFrame->IsCellFrame()) ) + if( !pFrame || pFrame->IsCellFrame() ) return; if( !pFrame->IsBodyFrame() && pFrame->GetUpper() ) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index a167af3ce922..9d3ce8eb2ed4 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1315,7 +1315,7 @@ void SwTextPaintInfo::DrawBorder( const SwLinePortion &rPor ) const void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor, PortionType nWhich ) const { - if( !(OnWin() && !IsMulti()) ) + if( !OnWin() || IsMulti() ) return; bool bDraw = false; diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index cb830f327412..6e9325fa4509 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -228,7 +228,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p // paras inside cells inside new documents: ( pNode->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) || !m_pFrame->IsInTab() || - ( !nLMWithNum && !(bLabelAlignmentActive && !bListLevelIndentsApplicable) ) ) ) + ( !nLMWithNum && (!bLabelAlignmentActive || bListLevelIndentsApplicable) ) ) ) { nLeft = m_pFrame->getFramePrintArea().Left() + m_pFrame->getFrameArea().Left(); if( nLeft >= nRight ) // e.g. with large paragraph indentations in slim table columns @@ -1444,8 +1444,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con // #i27615# if (pCMS && pCMS->m_bInFrontOfLabel) { - if (! (2 * nX < nWidth && pPor->InNumberGrp() && - !pPor->IsFootnoteNumPortion())) + if (2 * nX >= nWidth || !pPor->InNumberGrp() || pPor->IsFootnoteNumPortion()) pCMS->m_bInFrontOfLabel = false; } diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 59a180ca0d98..ace126870b54 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -466,14 +466,13 @@ bool SwTextPortion::Format( SwTextFormatInfo &rInf ) // rInf.nIdx points to the next word, nIdx-1 is the portion's last char void SwTextPortion::FormatEOL( SwTextFormatInfo &rInf ) { - if( !( - ( !GetNextPortion() || ( GetNextPortion()->IsKernPortion() && - !GetNextPortion()->GetNextPortion() ) ) && - GetLen() && - rInf.GetIdx() < TextFrameIndex(rInf.GetText().getLength()) && - TextFrameIndex(1) < rInf.GetIdx() && - ' ' == rInf.GetChar(rInf.GetIdx() - TextFrameIndex(1)) && - !rInf.GetLast()->IsHolePortion()) ) + if( ( GetNextPortion() && + ( !GetNextPortion()->IsKernPortion() || GetNextPortion()->GetNextPortion() ) ) || + !GetLen() || + rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()) || + TextFrameIndex(1) >= rInf.GetIdx() || + ' ' != rInf.GetChar(rInf.GetIdx() - TextFrameIndex(1)) || + rInf.GetLast()->IsHolePortion() ) return; // calculate number of blanks diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 913167342939..2d515cb98ca3 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -490,7 +490,7 @@ void SwTextFootnote::DelFrames(SwRootFrame const*const pRoot) } //JP 13.05.97: if the layout is deleted before the footnotes are deleted, // try to delete the footnote's frames by another way - if ( !(!bFrameFnd && m_pStartNode) ) + if ( bFrameFnd || !m_pStartNode ) return; SwNodeIndex aIdx( *m_pStartNode ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index df046a6f8e6a..3e0f8b16c254 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1535,7 +1535,7 @@ void SwTextNode::Update( // Inform LOK clients about change in position of redlines (if any) // Don't emit notifications during save: redline flags are temporarily changed during save, but // it's not useful to let clients know about such changes. - if (!(comphelper::LibreOfficeKit::isActive() && !GetDoc()->IsInWriting())) + if (!comphelper::LibreOfficeKit::isActive() || GetDoc()->IsInWriting()) return; const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); @@ -4163,7 +4163,7 @@ void SwTextNode::SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNumber ? GetAttrListRestartValue() != nNumber : nNumber != USHRT_MAX ); - if ( !(bChanged || !HasAttrListRestartValue()) ) + if ( !bChanged && HasAttrListRestartValue() ) return; if ( nNumber == USHRT_MAX ) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 1e80073ee479..fe3820f6c461 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -102,7 +102,7 @@ void SwPaintQueue::Add( SwViewShell *pNew, const SwRect &rNew ) void SwPaintQueue::Repaint() { - if (!(!SwRootFrame::IsInPaint() && s_pPaintQueue)) + if (SwRootFrame::IsInPaint() || !s_pPaintQueue) return; SwQueuedPaint *pPt = s_pPaintQueue; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index b6a9062d33c9..22abb0fb76b8 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -1152,7 +1152,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem, } } - if( !(!bContainsKeyword && bGeneric) ) + if( bContainsKeyword || !bGeneric ) return; const char *pStr = nullptr; diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index f47e3bd2f60c..c2286f949b04 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -1516,7 +1516,7 @@ static void ParseCSS1_background( const CSS1Expression *pExpr, if( GPOS_NONE == eRepeat ) eRepeat = ePos; - if( !(bTransparent || bColor || !aURL.isEmpty()) ) + if( !bTransparent && !bColor && aURL.isEmpty() ) return; SvxBrushItem aBrushItem( aItemIds.nBrush ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5b44aec3c2c9..fd3c9aeb360b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2333,7 +2333,7 @@ void DocxAttributeOutput::EndField_Impl( const SwTextNode* pNode, sal_Int32 nPos bool bIsSetField = rInfos.pField->GetTyp( )->Which( ) == SwFieldIds::SetExp; bool bShowRef = bIsSetField && ( nSubType & nsSwExtendedSubType::SUB_INVISIBLE ) == 0; - if ( !(( !m_sFieldBkm.isEmpty() ) && bShowRef) ) + if ( m_sFieldBkm.isEmpty() || !bShowRef ) return; // Write the field beginning @@ -8937,7 +8937,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation(); } - if ( !(!m_bOpenedSectPr || GetWritingHeaderFooter())) + if ( m_bOpenedSectPr && !GetWritingHeaderFooter()) return; // Not inside a section diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index a70801e78773..805fae063a16 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -796,7 +796,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons } // No? Then just approximate based on what we have. - if (!(isAnchor && !nWrapToken)) + if (!isAnchor || nWrapToken) return; switch (pFrameFormat->GetSurround().GetValue()) diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index a34d80d5ffb4..04384ef2ad67 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -280,7 +280,7 @@ void SwBasicEscherEx::PreWriteHyperlinkWithinFly(const SwFrameFormat& rFormat,Es return; const SwFormatURL *pINetFormat = dynamic_cast<const SwFormatURL*>(pItem); - if (!(pINetFormat && !pINetFormat->GetURL().isEmpty())) + if (!pINetFormat || pINetFormat->GetURL().isEmpty()) return; SvMemoryStream aStrm; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 16add838383e..b8440df9fb60 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -543,7 +543,7 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bWriteCombChars) void SwWW8AttrIter::handleToggleProperty(SfxItemSet& rExportSet, const SwFormatCharFormat* pCharFormatItem, sal_uInt16 nWhich, const SfxPoolItem* pValue) { - if (!(!rExportSet.HasItem(nWhich) && pValue)) + if (rExportSet.HasItem(nWhich) || !pValue) return; bool hasPropertyInCharStyle = false; diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index dd8078fd4b50..09ff0e2ddeed 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -834,10 +834,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con : "com.sun.star.comp.Writer.XMLContentImporter"), aFilterArgs, rName, true ); - if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode || - m_aOption.IsFormatsOnly() || + if( !IsOrganizerMode() && !IsBlockMode() && !m_bInsertMode && + !m_aOption.IsFormatsOnly() && // sw_redlinehide: disable layout cache for now - !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges)))) + *o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))) { try { diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 4c0b23195ff6..11c95bc0b478 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -397,7 +397,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, EditHdl_Impl, weld::Button&, void) { int nEntry = m_xListLB->get_selected_index(); AddressUserData_Impl* pUserData = nEntry != -1 ? reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nEntry).toInt64()) : nullptr; - if (!(pUserData && !pUserData->sURL.isEmpty())) + if (!pUserData || pUserData->sURL.isEmpty()) return; if(pUserData->xResultSet.is()) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 03fb621e0123..84426d4962a9 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3254,7 +3254,7 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void ) auto itTest = it; ++itTest; - if (!(!rBtn.IsNextControl() || (itTest != m_aControlList.end() && rBtn.IsNextControl()))) + if (rBtn.IsNextControl() && (itTest == m_aControlList.end() || !rBtn.IsNextControl())) return; bool isNext = rBtn.IsNextControl(); diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx index 347069d69bc4..df4d9a908d63 100644 --- a/sw/source/uibase/app/mainwn.cxx +++ b/sw/source/uibase/app/mainwn.cxx @@ -91,7 +91,7 @@ void SetProgressState( long nPosition, SwDocShell const *pDocShell ) void EndProgress( SwDocShell const *pDocShell ) { - if( !(pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave()) ) + if( !pProgressContainer || SW_MOD()->IsEmbeddedLoadSave() ) return; SwProgress *pProgress = nullptr; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index b876dec35b5f..7b6cc8578016 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -566,7 +566,7 @@ bool SwDBManager::Merge( const SwMergeDescriptor& rMergeDesc ) void SwDBManager::ImportFromConnection( SwWrtShell* pSh ) { - if(!(m_pImpl->pMergeData && !m_pImpl->pMergeData->bEndOfDB)) + if(!m_pImpl->pMergeData || m_pImpl->pMergeData->bEndOfDB) return; pSh->StartAllAction(); @@ -628,7 +628,7 @@ static OUString lcl_FindColumn(const OUString& sFormatStr,sal_uInt16 &nUsedPos void SwDBManager::ImportDBEntry(SwWrtShell* pSh) { - if(!(m_pImpl->pMergeData && !m_pImpl->pMergeData->bEndOfDB)) + if(!m_pImpl->pMergeData || m_pImpl->pMergeData->bEndOfDB) return; uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( m_pImpl->pMergeData->xResultSet, uno::UNO_QUERY ); diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 217d04236ee7..ec4ce8ead6d9 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -424,7 +424,7 @@ void SwSpellDialogChildWindow::ApplyChangedSentence(const svx::SpellPortions& rC { SwWrtShell* pWrtShell = GetWrtShell_Impl(); OSL_ENSURE(!m_pSpellState->m_bInitialCall, "ApplyChangedSentence in initial call or after resume"); - if(!(pWrtShell && !m_pSpellState->m_bInitialCall)) + if(!pWrtShell || m_pSpellState->m_bInitialCall) return; ShellMode eSelMode = pWrtShell->GetView().GetShellMode(); diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 8530a015cfe7..31594da032af 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -77,7 +77,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel ) } } - if ( !(!m_pApplyTempl && !rSh.IsDrawCreate() && !IsDrawAction())) + if ( m_pApplyTempl || rSh.IsDrawCreate() || IsDrawAction()) return; bool bStart = false, bDelSelect = false; @@ -116,7 +116,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel ) aSwContentAtPos ); } - if ( !(bStart && !m_bIsInDrag) ) + if ( !bStart || m_bIsInDrag ) return; m_bMBPressed = false; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index f35cf8705d21..b03419d744ba 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4285,10 +4285,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) else { if( !rMEvt.IsSynthetic() && - !( MOUSE_LEFT == rMEvt.GetButtons() && - KEY_MOD1 == rMEvt.GetModifier() && - rSh.Is_FnDragEQBeginDrag() && - !rSh.IsAddMode() ) ) + ( MOUSE_LEFT != rMEvt.GetButtons() || + KEY_MOD1 != rMEvt.GetModifier() || + !rSh.Is_FnDragEQBeginDrag() || + rSh.IsAddMode() ) ) { rSh.Drag( &aDocPt, false ); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index b4f1cfe2e194..76e4496ef166 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -988,7 +988,7 @@ void SwAutoTextEventDescriptor::replaceByName( OSL_ENSURE( pBlocks, "can't get autotext group; SwAutoTextEntry has illegal name?"); - if( !(pBlocks && !pBlocks->GetError())) + if( !pBlocks || pBlocks->GetError()) return; sal_uInt16 nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() ); @@ -1025,7 +1025,7 @@ void SwAutoTextEventDescriptor::getByName( SvxMacro aEmptyMacro(sEmptyStr, sEmptyStr); rMacro = aEmptyMacro; - if ( !(pBlocks && !pBlocks->GetError())) + if ( !pBlocks || pBlocks->GetError()) return; sal_uInt16 nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() ); |