diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-11-22 14:12:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-11-22 19:16:52 +0100 |
commit | 72ef2b5d9802c424dbb0810e0a72fae50d92b678 (patch) | |
tree | c043fd16189d55fcc549589cecf145bb522089e6 /sw | |
parent | b140f92531396c1087b997852d7ece18429b79d1 (diff) |
Make loplugin:unnecessaryparen warn about (x) ? ... : ... after all
...which had been left out because "lots of our code uses this style, which I'm
loathe to bulk-fix as yet", but now in
<https://gerrit.libreoffice.org/#/c/45060/1/> "use std::unique_ptr" would have
caused an otherwise innocent-looking code change to trigger a
loplugin:unnecessaryparen warning for
pFormat = (pGrfObj)
? ...
(barring a change to ignoreAllImplicit in
compilerplugins/clang/unnecessaryparen.cxx similar to that in
<https://gerrit.libreoffice.org/#/c/45083/2> "Make not warning about !! in
loplugin:simplifybool consistent", which should also have caused the warning to
disappear for the modified code, IIUC).
Change-Id: I8bff0cc11bbb839ef06d07b8d9237f150804fec2
Reviewed-on: https://gerrit.libreoffice.org/45088
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
78 files changed, 177 insertions, 177 deletions
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx index 42d1ac40d15f..cd87db46817a 100644 --- a/sw/source/core/bastyp/swregion.cxx +++ b/sw/source/core/bastyp/swregion.cxx @@ -186,7 +186,7 @@ void SwRegionRects::Compress() } } } - i = (bRestart) ? 0 : i+1; + i = bRestart ? 0 : i+1; } } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index fae0f3e69a04..8c1a0627f1d0 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1780,10 +1780,10 @@ bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich, { SwPosition& rPos = *m_pCurrentCursor->GetPoint(); SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode(); - pTextAttr = (pTextNd) + pTextAttr = pTextNd ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(), static_cast<RES_TXTATR>(nWhich), - (bExpand) ? SwTextNode::EXPAND : SwTextNode::DEFAULT) + bExpand ? SwTextNode::EXPAND : SwTextNode::DEFAULT) : nullptr; } diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index cfe9031e2f3d..3eed69cbc92a 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -1152,7 +1152,7 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con const_cast< SwPaM* >(pRegion)->GetRingContainer().merge( m_rCursor.GetRingContainer() ); } - std::unique_ptr<OUString> pRepl( (bRegExp) ? + std::unique_ptr<OUString> pRepl( bRegExp ? ReplaceBackReferences( *pSearchOpt, pCursor ) : nullptr ); m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( *pCursor, (pRepl.get()) ? *pRepl : pSearchOpt->replaceString, diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index fc360eea94af..d63d66cbf41d 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -80,7 +80,7 @@ lcl_CleanStr(const SwTextNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd, if ( bNewSoftHyphen ) { - nSoftHyphen = (bRemoveSoftHyphen) + nSoftHyphen = bRemoveSoftHyphen ? rNd.GetText().indexOf(CHAR_SOFTHYPHEN, nSoftHyphen) : -1; } @@ -679,7 +679,7 @@ int SwFindParaText::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, const_cast<SwPaM*>(pRegion)->GetRingContainer().merge( m_rCursor.GetRingContainer() ); } - std::unique_ptr<OUString> pRepl( (bRegExp) + std::unique_ptr<OUString> pRepl( bRegExp ? ReplaceBackReferences( m_rSearchOpt, pCursor ) : nullptr ); bool const bReplaced = m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 1f40f610d805..24561ebd9e51 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -52,7 +52,7 @@ bool SwCursor::GotoFootnoteText() bool bRet = false; SwTextNode* pTextNd = GetPoint()->nNode.GetNode().GetTextNode(); - SwTextAttr *const pFootnote( (pTextNd) + SwTextAttr *const pFootnote( pTextNd ? pTextNd->GetTextAttrForCharAt( GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : nullptr); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index f5d491cd1bc8..a364e7ef5204 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3226,7 +3226,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( *aCpyPaM.GetPoint() = pCopiedPaM->second; } - lcl_CopyBookmarks((pCopiedPaM) ? pCopiedPaM->first : aRgTmp, aCpyPaM); + lcl_CopyBookmarks(pCopiedPaM ? pCopiedPaM->first : aRgTmp, aCpyPaM); } if( bDelRedlines && ( RedlineFlags::DeleteRedlines & pDest->getIDocumentRedlineAccess().GetRedlineFlags() )) @@ -4344,7 +4344,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, if( !bCopyOk ) { - const sal_Int32 nCpyLen = ( (bOneNode) + const sal_Int32 nCpyLen = ( bOneNode ? pEnd->nContent.GetIndex() : pSttTextNd->GetText().getLength()) - pStt->nContent.GetIndex(); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 775f62ba3509..f0e1609c115f 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -1573,7 +1573,7 @@ SwField * DocumentFieldsManager::GetFieldAtPos(const SwPosition & rPos) { SwTextField * const pAttr = GetTextFieldAtPos(rPos); - return (pAttr) ? const_cast<SwField *>( pAttr->GetFormatField().GetField() ) : nullptr; + return pAttr ? const_cast<SwField *>( pAttr->GetFormatField().GetField() ) : nullptr; } SwTextField * DocumentFieldsManager::GetTextFieldAtPos(const SwPosition & rPos) diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 02a5dac0a256..4a1fe172789a 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -115,10 +115,10 @@ namespace SwSection* pSect = pSectFormat->GetSection(); if( pSect ) { - OUString sNm( (bCaseSensitive) + OUString sNm( bCaseSensitive ? pSect->GetSectionName() : GetAppCharClass().lowercase( pSect->GetSectionName() )); - OUString sCompare( (bCaseSensitive) + OUString sCompare( bCaseSensitive ? pItem->m_Item : GetAppCharClass().lowercase( pItem->m_Item ) ); if( sNm == sCompare ) diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index eea50f39ce25..dbd288c0662b 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1706,7 +1706,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall return (nullptr != pNewRedl) ? AppendResult::APPENDED - : ((bMerged) ? AppendResult::MERGED : AppendResult::IGNORED); + : (bMerged ? AppendResult::MERGED : AppendResult::IGNORED); } bool DocumentRedlineManager::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool ) diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index c9c7d58a0c3d..0595503430d9 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1657,7 +1657,7 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo ) --pTmp->GetPoint()->nNode; SwContentNode *const pContentNode( pTmp->GetContentNode() ); pTmp->GetPoint()->nContent.Assign( pContentNode, - (pContentNode) ? pContentNode->Len() : 0 ); + pContentNode ? pContentNode->Len() : 0 ); // tdf#106218 try to avoid losing a paragraph break here: if (pTmp->GetMark()->nContent == 0) { @@ -1700,7 +1700,7 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo ) --pTmp->GetPoint()->nNode; SwContentNode *const pContentNode( pTmp->GetContentNode() ); pTmp->GetPoint()->nContent.Assign( pContentNode, - (pContentNode) ? pContentNode->Len() : 0 ); + pContentNode ? pContentNode->Len() : 0 ); // tdf#106218 try to avoid losing a paragraph break here: if (pTmp->GetMark()->nContent == 0) { diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 2e73dd1d850e..c62ceb64cb4b 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -172,7 +172,7 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode, { SwContentNode *const pContentNode( rOldNode.GetNode().GetContentNode() ); SwPaM const aPam(rOldNode, 0, - rOldNode, (pContentNode) ? pContentNode->Len() : 0); + rOldNode, pContentNode ? pContentNode->Len() : 0); SwPosition aNewPos(rNewPos); aNewPos.nContent += nOffset; @@ -233,7 +233,7 @@ void SwDoc::CorrAbs( { SwContentNode *const pContentNode( rEndNode.GetNode().GetContentNode() ); SwPaM const aPam(rStartNode, 0, - rEndNode, (pContentNode) ? pContentNode->Len() : 0); + rEndNode, pContentNode ? pContentNode->Len() : 0); ::PaMCorrAbs(aPam, rNewPos); } } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 55986aafae5f..bffbc59e30c7 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -277,10 +277,10 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHe // The ContentIdx is _always_ different when called from // SwDocStyleSheet::SetItemSet, because it deep-copies the // PageDesc. So check if it was previously shared. - ((bFirst) ? rDesc.IsFirstShared() : rDesc.IsHeaderShared())) + (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared())) { SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), - (bFirst) ? "First header" : "Left header", + bFirst ? "First header" : "Left header", GetDfltFrameFormat() ); ::lcl_DescSetAttr( *pRight, *pFormat, false ); // The section which the right header attribute is pointing @@ -349,10 +349,10 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFo // The ContentIdx is _always_ different when called from // SwDocStyleSheet::SetItemSet, because it deep-copies the // PageDesc. So check if it was previously shared. - ((bFirst) ? rDesc.IsFirstShared() : rDesc.IsFooterShared())) + (bFirst ? rDesc.IsFirstShared() : rDesc.IsFooterShared())) { SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), - (bFirst) ? "First footer" : "Left footer", + bFirst ? "First footer" : "Left footer", GetDfltFrameFormat() ); ::lcl_DescSetAttr( *pRight, *pFormat, false ); // The section to which the right footer attribute is pointing diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 8c208a97e125..e7c35433eb7d 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -165,7 +165,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, aCpyPam.GetPoint()->nNode = pGDoc->GetNodes().GetEndOfContent().GetIndex()-1; pContentNd = aCpyPam.GetContentNode(); aCpyPam.GetPoint()->nContent.Assign( - pContentNd, (pContentNd) ? pContentNd->Len() : 0 ); + pContentNd, pContentNd ? pContentNd->Len() : 0 ); GetIDocumentUndoRedo().StartUndo( SwUndoId::INSGLOSSARY, nullptr ); SwPaM *_pStartCursor = &rPaM, *_pStartCursor2 = _pStartCursor; diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 8c8edb5ed218..c8a1d4ccbbce 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -280,7 +280,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, --pEndPos->nNode; pTNd = pEndPos->nNode.GetNode().GetTextNode(); } - nContent = (pTNd) ? pTNd->GetText().getLength() : 0; + nContent = pTNd ? pTNd->GetText().getLength() : 0; pEndPos->nContent.Assign( pTNd, nContent ); } } @@ -985,7 +985,7 @@ lcl_initParent(SwSectionNode & rThis, SwSectionFormat & rFormat) SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx, SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase) : SwStartNode( rIdx, SwNodeType::Section ) - , m_pSection( (pTOXBase) + , m_pSection( pTOXBase ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat)) : new SwSection( CONTENT_SECTION, rFormat.GetName(), lcl_initParent(*this, rFormat) ) ) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 957e8e2cf60c..ab6d21065392 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -3966,7 +3966,7 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, TableChgWidthHeightType e { bRet = pTableNd->GetTable().SetColWidth( rAktBox, eType, nAbsDiff, nRelDiff, - (bUndo) ? &pUndo : nullptr ); + bUndo ? &pUndo : nullptr ); } break; case TableChgWidthHeightType::RowTop: @@ -3975,7 +3975,7 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, TableChgWidthHeightType e case TableChgWidthHeightType::CellBottom: bRet = pTableNd->GetTable().SetRowHeight( rAktBox, eType, nAbsDiff, nRelDiff, - (bUndo) ? &pUndo : nullptr ); + bUndo ? &pUndo : nullptr ); break; default: break; } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index f5ab64dc57f0..c9f3ad9c22ce 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -1479,7 +1479,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) // move the content into the new node bool bOneNd = pStt->nNode == pEnd->nNode; const sal_Int32 nLen = - ( (bOneNd) ? std::min(pEnd->nContent.GetIndex(), pSrcNd->Len()) : pSrcNd->Len() ) + ( bOneNd ? std::min(pEnd->nContent.GetIndex(), pSrcNd->Len()) : pSrcNd->Len() ) - pStt->nContent.GetIndex(); if( !pEnd->nNode.GetNode().IsContentNode() ) diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 5a59b878dee1..0a1e5083d4a9 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -351,7 +351,7 @@ bool SwSection::IsProtect() const { SwSectionFormat const *const pFormat( GetFormat() ); OSL_ENSURE(pFormat, "SwSection::IsProtect: no format?"); - return (pFormat) + return pFormat ? pFormat->GetProtect().IsContentProtected() : IsProtectFlag(); } @@ -361,7 +361,7 @@ bool SwSection::IsEditInReadonly() const { SwSectionFormat const *const pFormat( GetFormat() ); OSL_ENSURE(pFormat, "SwSection::IsEditInReadonly: no format?"); - return (pFormat) + return pFormat ? pFormat->GetEditInReadonly().GetValue() : IsEditInReadonlyFlag(); } diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index e958a24b0d50..fbce36232d08 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -374,7 +374,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, aCpyPam.GetPoint()->nNode.Assign( pAutoDoc->GetNodes().GetEndOfContent(), -1 ); pContentNd = aCpyPam.GetContentNode(); aCpyPam.GetPoint()->nContent.Assign( - pContentNd, (pContentNd) ? pContentNd->Len() : 0); + pContentNd, pContentNd ? pContentNd->Len() : 0); SwDontExpandItem aExpItem; aExpItem.SaveDontExpandItems( *aPam.GetPoint() ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index c901cbe9f005..4737f411cd8d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -153,7 +153,7 @@ void SwEditShell::Insert2(SwField const & rField, const bool bForceExpandHints) StartAllAction(); SwFormatField aField( rField ); - const SetAttrMode nInsertFlags = (bForceExpandHints) + const SetAttrMode nInsertFlags = bForceExpandHints ? SetAttrMode::FORCEHINTEXPAND : SetAttrMode::DEFAULT; diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 7c49f728d3d6..98f6288bba39 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -135,7 +135,7 @@ sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, aCpyPam.GetPoint()->nNode = pMyDoc->GetNodes().GetEndOfContent().GetIndex()-1; pContentNd = aCpyPam.GetContentNode(); aCpyPam.GetPoint()->nContent.Assign( - pContentNd, (pContentNd) ? pContentNd->Len() : 0); + pContentNd, pContentNd ? pContentNd->Len() : 0); aStt = pGDoc->GetNodes().GetEndOfExtras(); pContentNd = pGDoc->GetNodes().GoNext( &aStt ); @@ -159,7 +159,7 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc ) SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 ); SwContentNode *const pContentNode = aIdx.GetNode().GetContentNode(); SwPosition aPos( aIdx, - SwIndex(pContentNode, (pContentNode) ? pContentNode->Len() : 0)); + SwIndex(pContentNode, pContentNode ? pContentNode->Len() : 0)); bool bRet = false; SET_CURR_SHELL( this ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 0f9662f01f16..0cd05f4e1d0f 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -87,7 +87,7 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) StartAllAction(); { const SwInsertFlags nInsertFlags = - (bForceExpandHints) + bForceExpandHints ? (SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) : SwInsertFlags::EMPTYEXPAND; diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index 4591c535d6a5..1decb5dc36a3 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -139,7 +139,7 @@ bool SwEditShell::Undo(sal_uInt16 const nCount) { // fdo#39003 Pop does not touch the rest of the cursor ring KillPams(); // so call this first to get rid of unwanted cursors } - Pop((bRestoreCursor) ? PopMode::DeleteCurrent : PopMode::DeleteStack); + Pop(bRestoreCursor ? PopMode::DeleteCurrent : PopMode::DeleteStack); GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld ); GetDoc()->getIDocumentRedlineAccess().CompressRedlines(); @@ -190,7 +190,7 @@ bool SwEditShell::Redo(sal_uInt16 const nCount) SAL_WARN("sw.core", "SwEditShell::Redo(): exception caught: " << e); } - Pop((bRestoreCursor) ? PopMode::DeleteCurrent : PopMode::DeleteStack); + Pop(bRestoreCursor ? PopMode::DeleteCurrent : PopMode::DeleteStack); GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld ); GetDoc()->getIDocumentRedlineAccess().CompressRedlines(); diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 3448535eee06..749bfe58bc62 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -97,7 +97,7 @@ OUString SwTableField::GetCommand() if (EXTRNL_NAME != GetNameType()) { SwNode const*const pNd = GetNodeOfFormula(); - SwTableNode const*const pTableNd = (pNd) ? pNd->FindTableNode() : nullptr; + SwTableNode const*const pTableNd = pNd ? pNd->FindTableNode() : nullptr; if (pTableNd) { PtrToBoxNm( &pTableNd->GetTable() ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index cfcced343bd3..4c465df866c6 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -892,7 +892,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) SwNode & rNode(rPaM.GetPoint()->nNode.GetNode()); SwContentNode *const pContentNode( rNode.GetContentNode() ); SwPaM const tmpPam(rNode, 0, - rNode, (pContentNode) ? pContentNode->Len() : 0); + rNode, pContentNode ? pContentNode->Len() : 0); ::PaMCorrAbs(tmpPam, aPos); } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index a7a64db7d461..0b0644de0a6a 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1218,7 +1218,7 @@ bool SwFEShell::UpdateTableStyleFormatting(SwTableNode *pTableNode, return false; } - OUString const aTableStyleName((pStyleName) + OUString const aTableStyleName(pStyleName ? *pStyleName : pTableNode->GetTable().GetTableStyleName()); SwTableAutoFormat* pTableStyle = GetDoc()->GetTableStyles().FindAutoFormat(aTableStyleName); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index ab52c310ec93..37a3b2bd44ae 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1523,7 +1523,7 @@ void SwFormatAnchor::SetAnchor( const SwPosition *pPos ) dynamic_cast<SwStartNode*>(&pPos->nNode.GetNode())) || (RndStdIds::FLY_AT_PARA == m_eAnchorId && dynamic_cast<SwTableNode*>(&pPos->nNode.GetNode())) || dynamic_cast<SwTextNode*>(&pPos->nNode.GetNode())); - m_pContentAnchor .reset( (pPos) ? new SwPosition( *pPos ) : nullptr ); + m_pContentAnchor .reset( pPos ? new SwPosition( *pPos ) : nullptr ); // Flys anchored AT paragraph should not point into the paragraph content if (m_pContentAnchor && ((RndStdIds::FLY_AT_PARA == m_eAnchorId) || (RndStdIds::FLY_AT_FLY == m_eAnchorId))) diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index bf4f102b1409..83043c78278f 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1417,7 +1417,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, bPrevLineSpacingPorportional ); if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { - nUpper = (bContextualSpacing) ? 0 : nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); + nUpper = bContextualSpacing ? 0 : nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; // OD 07.01.2004 #i11859# - consideration of the line spacing // for the upper spacing of a text frame diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 2956f4315a11..b35a5e1e1e40 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1017,7 +1017,7 @@ void SwFrame::CheckPageDescs( SwPageFrame *pStart, bool bNotifyFields, SwPageFra bool bIsOdd = pPage->OnRightPage(); bool bWantOdd = pPage->WannaRightPage(); bool bFirst = pPage->OnFirstPage(); - SwFrameFormat *pFormatWish = (bWantOdd) + SwFrameFormat *pFormatWish = bWantOdd ? pDesc->GetRightFormat(bFirst) : pDesc->GetLeftFormat(bFirst); if ( bIsOdd != bWantOdd || @@ -1058,7 +1058,7 @@ void SwFrame::CheckPageDescs( SwPageFrame *pStart, bool bNotifyFields, SwPageFra pNextPage->GetPageDesc() == (pNextDesc = pNextPage->FindPageDesc()) ) //4. { bool bNextFirst = pNextPage->OnFirstPage(); - SwFrameFormat *pNextFormatWish = (bNextWantOdd) ? //5. + SwFrameFormat *pNextFormatWish = bNextWantOdd ? //5. pNextDesc->GetRightFormat(bNextFirst) : pNextDesc->GetLeftFormat(bNextFirst); if ( !pNextFormatWish ) // 6. pNextFormatWish = bNextWantOdd ? pNextDesc->GetLeftFormat() : pNextDesc->GetRightFormat(); @@ -1292,7 +1292,7 @@ SwPageFrame *SwFrame::InsertPage( SwPageFrame *pPrevPage, bool bFootnote ) pPrevPage->GetPageDesc(), bFootnote, nullptr ) ) bCheckPages = true; } - SwFrameFormat *const pFormat( (bWishedOdd) + SwFrameFormat *const pFormat( bWishedOdd ? pDesc->GetRightFormat(bWishedFirst) : pDesc->GetLeftFormat(bWishedFirst) ); assert(pFormat); diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 13651d275d67..38d56884e609 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -325,7 +325,7 @@ bool SwPageDesc::IsFollowNextPageOfNode( const SwNode& rNd ) const SwFrameFormat *SwPageDesc::GetLeftFormat(bool const bFirst) { return (UseOnPage::Left & m_eUse) - ? ((bFirst) ? &m_FirstLeft : &m_Left) + ? (bFirst ? &m_FirstLeft : &m_Left) : nullptr; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 6e687eddd781..b1f08ca7fd8e 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2795,13 +2795,13 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte aB.SetRefMode( !bVert ? svx::frame::RefMode::Begin : svx::frame::RefMode::End ); SwLineEntry aLeft (nLeft, nTop, nBottom, - (bVert) ? aB : ((bR2L) ? aR : aL)); + bVert ? aB : (bR2L ? aR : aL)); SwLineEntry aRight (nRight, nTop, nBottom, - (bVert) ? ((bBottomAsTop) ? aB : aT) : ((bR2L) ? aL : aR)); + bVert ? (bBottomAsTop ? aB : aT) : (bR2L ? aL : aR)); SwLineEntry aTop (nTop, nLeft, nRight, - (bVert) ? aL : ((bBottomAsTop) ? aB : aT)); + bVert ? aL : (bBottomAsTop ? aB : aT)); SwLineEntry aBottom(nBottom, nLeft, nRight, - (bVert) ? aR : aB); + bVert ? aR : aB); Insert( aLeft, false ); Insert( aRight, false ); @@ -4652,7 +4652,7 @@ static void lcl_MakeBorderLine(SwRect const& rRect, basegfx::B2DPoint aEnd; if (isVertical) { // fdo#38635: always from outer edge - double const fStartX( (isLeftOrTopBorder) + double const fStartX( isLeftOrTopBorder ? rRect.Left() + (rRect.Width() / 2.0) : rRect.Right() - (rRect.Width() / 2.0)); aStart.setX(fStartX); @@ -4664,7 +4664,7 @@ static void lcl_MakeBorderLine(SwRect const& rRect, } else { // fdo#38635: always from outer edge - double const fStartY( (isLeftOrTopBorder) + double const fStartY( isLeftOrTopBorder ? rRect.Top() + (rRect.Height() / 2.0) : rRect.Bottom() - (rRect.Height() / 2.0)); aStart.setX(rRect.Left() + @@ -7454,7 +7454,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) SwIterator<SwFrame,SwFormat> aIter( *this ); SwFrame *pFirst = aIter.First(); SwViewShell *const pSh = - (pFirst) ? pFirst->getRootFrame()->GetCurrShell() : nullptr; + pFirst ? pFirst->getRootFrame()->GetCurrShell() : nullptr; if (nullptr != pSh) { SwViewShell *pOldGlobal = gProp.pSGlobalShell; diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index f5a1c7b017de..b028322d8601 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -278,7 +278,7 @@ bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint, // try this again but prefer the "previous" position SwCursorMoveState aMoveState; - SwCursorMoveState *const pState((pCMS) ? pCMS : &aMoveState); + SwCursorMoveState *const pState(pCMS ? pCMS : &aMoveState); comphelper::FlagRestorationGuard g( pState->m_bPosMatchesBounds, true); SwPosition prevTextPos(*pPos); diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 500485d26c95..1312f5dce36a 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1921,7 +1921,7 @@ bool SwTable::GetInfo( SfxPoolItem& rInfo ) const SwTable * SwTable::FindTable( SwFrameFormat const*const pFormat ) { - return (pFormat) + return pFormat ? SwIterator<SwTable,SwFormat>(*pFormat).First() : nullptr; } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 32736e5cba1b..d25fcc2ba0b1 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -368,7 +368,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) const SwDoc *pDoc = rInf.GetTextFrame()->GetNode()->GetDoc(); - const sal_uInt16 nGridWidth = (bHasGrid) ? GetGridWidth(*pGrid, *pDoc) : 0; + const sal_uInt16 nGridWidth = bHasGrid ? GetGridWidth(*pGrid, *pDoc) : 0; // used for grid mode only: // the pointer is stored, because after formatting of non-asian text, diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 08b5c744a57d..6b2b9388644d 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -91,7 +91,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } SwViewShell *pSh = rInf.GetVsh(); - SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : nullptr ); + SwDoc *const pDoc( pSh ? pSh->GetDoc() : nullptr ); bool const bInClipboard( pDoc == nullptr || pDoc->IsClipBoard() ); bool bPlaceHolder = false; @@ -113,7 +113,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, case SwFieldIds::HiddenText: { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwHiddenPortion(aStr); @@ -127,7 +127,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, &static_txtattr_cast<SwTextField const*>(pHint)->GetTextNode()); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion( aStr ); @@ -140,7 +140,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, static_cast<SwDocStatField*>(pField)->ChangeExpansion( pFrame ); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion( aStr ); @@ -168,7 +168,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, bVirt, nNumFormat != (SvxNumType)-1 ? &nNumFormat : nullptr); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion( aStr ); @@ -196,7 +196,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion( aStr ); @@ -211,7 +211,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, pDBField->ChgBodyTextFlag( ::lcl_IsInBody( pFrame ) ); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(aStr); @@ -225,7 +225,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, static_txtattr_cast<SwTextField const*>(pHint)); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(aStr); @@ -241,7 +241,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, case SwFieldIds::GetRef: subType = static_cast<SwGetRefField*>(pField)->GetSubType(); { - OUString const str( (bName) + OUString const str( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(str); @@ -254,7 +254,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, case SwFieldIds::DateTime: subType = static_cast<SwDateTimeField*>(pField)->GetSubType(); { - OUString const str( (bName) + OUString const str( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(str); @@ -266,7 +266,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, break; default: { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(aStr); @@ -282,7 +282,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, pTmpFnt->SetDiffFnt( &pChFormat->GetAttrSet(), m_pFrame->GetTextNode()->getIDocumentSettingAccess() ); } { - OUString const aStr( (bName) + OUString const aStr( bName ? pField->GetFieldName() : pField->ExpandField(bInClipboard) ); pRet = new SwFieldPortion(aStr, pTmpFnt, bPlaceHolder); @@ -301,7 +301,7 @@ static SwFieldPortion * lcl_NewMetaPortion(SwTextAttr & rHint, const bool bPrefi OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?"); if (pField) { - pField->GetPrefixAndSuffix((bPrefix) ? &fix : nullptr, (bPrefix) ? nullptr : &fix); + pField->GetPrefixAndSuffix(bPrefix ? &fix : nullptr, bPrefix ? nullptr : &fix); } return new SwFieldPortion( fix ); } diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx index 1a0a9a2c8828..af72d11df73d 100644 --- a/sw/source/core/text/wrong.cxx +++ b/sw/source/core/text/wrong.cxx @@ -361,7 +361,7 @@ auto SwWrongList::Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos, // length of word must be greater than 0 // only report a spelling error if the cursor position is outside the word, // so that the user is not annoyed while typing - FreshState eRet = (nLen) + FreshState eRet = nLen ? (nCursorPos > nPos + nLen || nCursorPos < nPos) ? FreshState::FRESH : FreshState::CURSOR diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 86e0053b6b31..55275b0e8c80 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -732,7 +732,7 @@ void MetaField::GetPrefixAndSuffix( SwTextNode * const pTextNode( GetTextNode() ); SwDocShell const * const pShell(pTextNode->GetDoc()->GetDocShell()); const uno::Reference<frame::XModel> xModel( - (pShell) ? pShell->GetModel() : nullptr, uno::UNO_SET_THROW); + pShell ? pShell->GetModel() : nullptr, uno::UNO_SET_THROW); getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix); } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 297f307d8d04..e68b019b24d7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1336,7 +1336,7 @@ lcl_GetTextAttrs( sal_Int32 const nIndex, RES_TXTATR const nWhich, enum SwTextNode::GetTextAttrMode const eMode) { - size_t const nSize = (pSwpHints) ? pSwpHints->Count() : 0; + size_t const nSize = pSwpHints ? pSwpHints->Count() : 0; sal_Int32 nPreviousIndex(0); // index of last hint with nWhich bool (*pMatchFunc)(sal_Int32, sal_Int32, sal_Int32)=nullptr; switch (eMode) @@ -1366,7 +1366,7 @@ lcl_GetTextAttrs( assert(pEndIdx || pHint->HasDummyChar()); // If EXPAND is set, simulate the text input behavior, i.e. // move the start, and expand the end. - bool const bContained( (pEndIdx) + bool const bContained( pEndIdx ? (*pMatchFunc)(nIndex, nHintStart, *pEndIdx) : (nHintStart == nIndex) ); if (bContained) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 98addf34991a..92c8de9a89db 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -251,7 +251,7 @@ lcl_DoSplitNew(NestList_t & rSplits, SwTextNode & rNode, const sal_Int32 nOtherStart, const sal_Int32 nOtherEnd, bool bOtherDummy) { const bool bSplitAtStart(nNewStart < nOtherStart); - const sal_Int32 nSplitPos( (bSplitAtStart) ? nOtherStart : nOtherEnd ); + const sal_Int32 nSplitPos( bSplitAtStart ? nOtherStart : nOtherEnd ); // first find the portion that is split (not necessarily the last one!) NestList_t::iterator const iter( std::find_if( rSplits.begin(), rSplits.end(), @@ -2718,8 +2718,8 @@ bool SwpHints::MergePortions( SwTextNode& rNode ) // this loop needs to handle the case where one has a CHARFMT and the // other CHARFMT + RSID-only AUTOFMT, so... // want to skip over RSID-only AUTOFMT here, hence the -1 - if ((nAttributesInPor1 - ((isRsidOnlyAutoFormat1) ? 1 : 0)) == - (nAttributesInPor2 - ((isRsidOnlyAutoFormat2) ? 1 : 0)) + if ((nAttributesInPor1 - (isRsidOnlyAutoFormat1 ? 1 : 0)) == + (nAttributesInPor2 - (isRsidOnlyAutoFormat2 ? 1 : 0)) && (nAttributesInPor1 != 0 || nAttributesInPor2 != 0)) { // _if_ there is one element more either in aRange1 or aRange2 diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 7d01bbe9c1d9..60d24750cd51 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1425,7 +1425,7 @@ SwRect SwTextFrame::AutoSpell_( const SwContentNode* pActNode, sal_Int32 nActPos pNode->GetWrong()->SetInvalid( nInvStart, nInvEnd ); pNode->SetWrongDirty( (COMPLETE_STRING != pNode->GetWrong()->GetBeginInv()) - ? ((bPending) + ? (bPending ? SwTextNode::WrongState::PENDING : SwTextNode::WrongState::TODO) : SwTextNode::WrongState::DONE); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index f72f77a2f953..751115d22a59 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -671,7 +671,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext, { return false; } - SwUndoId const nId((pSwAction) + SwUndoId const nId(pSwAction ? pSwAction->GetId() : static_cast<SwUndoId>(pListAction->GetId())); if (DoesUndo()) diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 6787c6a3125b..809b0848dcc5 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -376,7 +376,7 @@ bool SwUndoDelete::SaveContent( const SwPosition* pStt, const SwPosition* pEnd, pHistory->CopyFormatAttr( *pSttTextNd->GetpSwAttrSet(), nNdIdx ); // the length might have changed (!!Fields!!) - sal_Int32 nLen = ((bOneNode) + sal_Int32 nLen = (bOneNode ? pEnd->nContent.GetIndex() : pSttTextNd->GetText().getLength()) - pStt->nContent.GetIndex(); @@ -392,7 +392,7 @@ bool SwUndoDelete::SaveContent( const SwPosition* pStt, const SwPosition* pEnd, bool emptied( !m_pSttStr->isEmpty() && !pSttTextNd->Len() ); if (!bOneNode || emptied) // merging may overwrite xmlids... { - m_pMetadataUndoStart = (emptied) + m_pMetadataUndoStart = emptied ? pSttTextNd->CreateUndoForDelete() : pSttTextNd->CreateUndo(); } @@ -427,7 +427,7 @@ bool SwUndoDelete::SaveContent( const SwPosition* pStt, const SwPosition* pEnd, // METADATA: store bool emptied = !m_pEndStr->isEmpty() && !pEndTextNd->Len(); - m_pMetadataUndoEnd = (emptied) + m_pMetadataUndoEnd = emptied ? pEndTextNd->CreateUndoForDelete() : pEndTextNd->CreateUndo(); } diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index e2b3c08fc15c..f17cae630316 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -73,7 +73,7 @@ SwUndoInsSection::SwUndoInsSection( SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase) : SwUndo( SwUndoId::INSSECTION, rPam.GetDoc() ), SwUndRng( rPam ) , m_pSectionData(new SwSectionData(rNewData)) - , m_pTOXBase( (pTOXBase) ? new SwTOXBase(*pTOXBase) : nullptr ) + , m_pTOXBase( pTOXBase ? new SwTOXBase(*pTOXBase) : nullptr ) , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr ) , m_nSectionNodePos(0) , m_bSplitAtStart(false) diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 13ca1b40db25..d3212fbbe245 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -213,7 +213,7 @@ void SwXBookmark::attachToRangeEx( } SwDoc *const pDoc = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -377,7 +377,7 @@ uno::Reference<frame::XModel> SwXBookmark::GetModel() if (m_pImpl->m_pDoc) { SwDocShell const * const pShell( m_pImpl->m_pDoc->GetDocShell() ); - return (pShell) ? pShell->GetModel() : nullptr; + return pShell ? pShell->GetModel() : nullptr; } return nullptr; } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 9e1b3babed4d..fac07e39e4c1 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -275,15 +275,15 @@ GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex, bool const bParent) { // these should be unambiguous because of the dummy character - SwTextNode::GetTextAttrMode const eMode( (bParent) + SwTextNode::GetTextAttrMode const eMode( bParent ? SwTextNode::PARENT : SwTextNode::EXPAND ); SwTextAttr *const pMetaTextAttr = rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_META, eMode); SwTextAttr *const pMetaFieldTextAttr = rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode); // which is innermost? - SwTextAttr *const pTextAttr = (pMetaTextAttr) - ? ((pMetaFieldTextAttr) + SwTextAttr *const pTextAttr = pMetaTextAttr + ? (pMetaFieldTextAttr ? ((pMetaFieldTextAttr->GetStart() > pMetaTextAttr->GetStart()) ? pMetaFieldTextAttr : pMetaTextAttr) @@ -514,7 +514,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry const SwPosition *pPos = rPam.Start(); const SwTextNode *pTextNd = rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTextNode(); - const SwTextAttr* pTextAttr = (pTextNd) + const SwTextAttr* pTextAttr = pTextNd ? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true ) : nullptr; if ( pTextAttr != nullptr ) diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 9d0b21b2cbc5..d5c26341af07 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -548,7 +548,7 @@ SwXFieldMaster::CreateXFieldMaster(SwDoc * pDoc, SwFieldType *const pType, } if (!xFM.is()) { - SwXFieldMaster *const pFM( (pType) + SwXFieldMaster *const pFM( pType ? new SwXFieldMaster(*pType, pDoc) : new SwXFieldMaster(pDoc, nResId)); xFM.set(pFM); @@ -1137,10 +1137,10 @@ public: , m_pDoc(pDoc) , m_bIsDescriptor(pFormat == nullptr) , m_bCallUpdate(false) - , m_nServiceId((pFormat) + , m_nServiceId(pFormat ? lcl_GetServiceForField(*pFormat->GetField()) : nServiceId) - , m_pProps((pFormat) ? nullptr : new SwFieldProperties_Impl) + , m_pProps(pFormat ? nullptr : new SwFieldProperties_Impl) { } virtual ~Impl() override @@ -1222,7 +1222,7 @@ SwXTextField::CreateXTextField(SwDoc *const pDoc, SwFormatField const* pFormat, } if (!xField.is()) { - SwXTextField *const pField( (pFormat) + SwXTextField *const pField( pFormat ? new SwXTextField(const_cast<SwFormatField&>(*pFormat), *pDoc) : new SwXTextField(nServiceId, pDoc)); xField.set(pField); @@ -1907,7 +1907,7 @@ void SAL_CALL SwXTextField::attach( pTextCursor && pTextCursor->IsAtEndOfMeta() ); const SetAttrMode nInsertFlags = - (bForceExpandHints) + bForceExpandHints ? SetAttrMode::FORCEHINTEXPAND : SetAttrMode::DEFAULT; @@ -2323,7 +2323,7 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName) // get text node for the text field const SwFormatField *pFieldFormat = (m_pImpl->GetField()) ? m_pImpl->m_pFormatField : nullptr; - const SwTextField* pTextField = (pFieldFormat) + const SwTextField* pTextField = pFieldFormat ? m_pImpl->m_pFormatField->GetTextField() : nullptr; if(!pTextField) throw uno::RuntimeException(); diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index fc7710e962ff..d907f74cf314 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -181,7 +181,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, sal_Bool bVal ) if ( text::TextMarkupType::SPELLCHECK == nType ) { GetTextNode()->SetWrongDirty( - (bVal) ? SwTextNode::WrongState::DONE : SwTextNode::WrongState::TODO); + bVal ? SwTextNode::WrongState::DONE : SwTextNode::WrongState::TODO); } else if ( text::TextMarkupType::SMARTTAG == nType ) GetTextNode()->SetSmartTagDirty( !bVal ); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index d9c508893107..789c24eb1903 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1278,7 +1278,7 @@ SwXFrame::CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat) } if (!xFrame.is()) { - NameLookupIsHard *const pNew((pFrameFormat) + NameLookupIsHard *const pNew(pFrameFormat ? new NameLookupIsHard(*pFrameFormat) : new NameLookupIsHard(&rDoc)); xFrame.set(pNew); @@ -2849,7 +2849,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan (*pFilter) >>= sFltName; } - pFormat = (pGrfObj) + pFormat = pGrfObj ? pDoc->getIDocumentContentOperations().InsertGraphicObject( aPam, *pGrfObj, &aFrameSet, &aGrSet, pParentFrameFormat) : pDoc->getIDocumentContentOperations().InsertGraphic( diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 0bd15d1e0301..7b251e910d34 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -147,7 +147,7 @@ SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFormatFootnote *const pFootnoteForm } if (!xNote.is()) { - SwXFootnote *const pNote((pFootnoteFormat) + SwXFootnote *const pNote(pFootnoteFormat ? new SwXFootnote(rDoc, *pFootnoteFormat) : new SwXFootnote(isEndnote)); xNote.set(pNote); @@ -175,7 +175,7 @@ sal_Int64 SAL_CALL SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId) { const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) ); - return (nRet) ? nRet : SwXText::getSomething(rId); + return nRet ? nRet : SwXText::getSomething(rId); } OUString SAL_CALL @@ -300,7 +300,7 @@ SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange) OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pNewDoc = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pNewDoc) { throw lang::IllegalArgumentException(); @@ -322,7 +322,7 @@ SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange) SwXTextCursor const*const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor)); const bool bForceExpandHints( pTextCursor && pTextCursor->IsAtEndOfMeta() ); - const SetAttrMode nInsertFlags = (bForceExpandHints) + const SetAttrMode nInsertFlags = bForceExpandHints ? SetAttrMode::FORCEHINTEXPAND : SetAttrMode::DEFAULT; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index e14606334462..b484f9fb4882 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -328,7 +328,7 @@ public: Impl( SwDoc & rDoc, const TOXTypes eType, SwTOXBaseSection *const pBaseSection) - : SwClient((pBaseSection) ? pBaseSection->GetFormat() : nullptr) + : SwClient(pBaseSection ? pBaseSection->GetFormat() : nullptr) , m_Listeners(m_Mutex) , m_rPropSet( *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Index(eType))) @@ -351,7 +351,7 @@ public: SwSectionFormat *const pSectionFormat(GetSectionFormat()); SwTOXBase *const pTOXSection( (m_bIsDescriptor) ? &m_pProps->GetTOXBase() - : ((pSectionFormat) + : (pSectionFormat ? static_cast<SwTOXBaseSection*>(pSectionFormat->GetSection()) : nullptr)); if (!pTOXSection) @@ -422,7 +422,7 @@ SwXDocumentIndex::CreateXDocumentIndex( } if (!xIndex.is()) { - SwXDocumentIndex *const pIndex((pSection) + SwXDocumentIndex *const pIndex(pSection ? new SwXDocumentIndex(*pSection, rDoc) : new SwXDocumentIndex(eTypes, rDoc)); xIndex.set(pIndex); @@ -1257,7 +1257,7 @@ void SAL_CALL SwXDocumentIndex::refresh() SolarMutexGuard g; SwSectionFormat *const pFormat = m_pImpl->GetSectionFormat(); - SwTOXBaseSection *const pTOXBase = (pFormat) ? + SwTOXBaseSection *const pTOXBase = pFormat ? static_cast<SwTOXBaseSection*>(pFormat->GetSection()) : nullptr; if (!pTOXBase) { @@ -1316,7 +1316,7 @@ SwXDocumentIndex::attach(const uno::Reference< text::XTextRange > & xTextRange) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -1482,7 +1482,7 @@ uno::Reference<frame::XModel> SwXDocumentIndex::GetModel() if (pSectionFormat) { SwDocShell const*const pShell( pSectionFormat->GetDoc()->GetDocShell() ); - return (pShell) ? pShell->GetModel() : nullptr; + return pShell ? pShell->GetModel() : nullptr; } return nullptr; } @@ -1654,7 +1654,7 @@ SwXDocumentIndexMark::CreateXDocumentIndexMark( } if (!xTOXMark.is()) { - SwXDocumentIndexMark *const pNew((pMark) + SwXDocumentIndexMark *const pNew(pMark ? new SwXDocumentIndexMark(rDoc, *const_cast<SwTOXType*>(pMark->GetTOXType()), *pMark) : new SwXDocumentIndexMark(eType)); @@ -1797,7 +1797,7 @@ SwXDocumentIndexMark::attach( OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -1939,7 +1939,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark( } const bool bForceExpandHints( !bMark && pTextCursor && pTextCursor->IsAtEndOfMeta() ); - const SetAttrMode nInsertFlags = (bForceExpandHints) + const SetAttrMode nInsertFlags = bForceExpandHints ? ( SetAttrMode::FORCEHINTEXPAND | SetAttrMode::DONTEXPAND) : SetAttrMode::DONTEXPAND; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 997b4081c3d1..12ee49ce3fb2 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -252,7 +252,7 @@ lcl_setAutoStyle(IStyleAccess & rStyleAccess, const uno::Any & rValue, throw lang::IllegalArgumentException(); } - SwFormatAutoFormat aFormat( (bPara) + SwFormatAutoFormat aFormat( bPara ? sal::static_int_cast< sal_uInt16 >(RES_AUTO_STYLE) : sal::static_int_cast< sal_uInt16 >(RES_TXTATR_AUTOFMT) ); aFormat.SetStyleHandle( pStyle ); @@ -388,7 +388,7 @@ lcl_setCharFormatSequence(SwPaM & rPam, uno::Any const& rValue) lcl_setCharStyle(rPam.GetDoc(), aStyle, aSet); // the first style should replace the current attributes, // all other have to be added - SwUnoCursorHelper::SetCursorAttr(rPam, aSet, (nStyle) + SwUnoCursorHelper::SetCursorAttr(rPam, aSet, nStyle ? SetAttrMode::DONTREPLACE : SetAttrMode::DEFAULT); rPam.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::START, nullptr); @@ -630,7 +630,7 @@ SwUnoCursorHelper::GetCurTextFormatColl(SwPaM & rPaM, const bool bConditional) SwTextNode const*const pNd = rNds[ n ]->GetTextNode(); if( pNd ) { - SwFormatColl *const pNdFormat = (bConditional) + SwFormatColl *const pNdFormat = bConditional ? pNd->GetFormatColl() : &pNd->GetAnyFormatColl(); if( !pFormat ) { @@ -646,7 +646,7 @@ SwUnoCursorHelper::GetCurTextFormatColl(SwPaM & rPaM, const bool bConditional) pTmpCursor = pTmpCursor->GetNext(); } while ( pTmpCursor != &rPaM ); - return (bError) ? nullptr : pFormat; + return bError ? nullptr : pFormat; } class SwXTextCursor::Impl @@ -873,7 +873,7 @@ sal_Int64 SAL_CALL SwXTextCursor::getSomething(const uno::Sequence< sal_Int8 >& rId) { const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXTextCursor>(rId, this) ); - return (nRet) ? nRet : OTextCursorHelper::getSomething(rId); + return nRet ? nRet : OTextCursorHelper::getSomething(rId); } void SAL_CALL SwXTextCursor::collapseToStart() @@ -976,7 +976,7 @@ SwXTextCursor::gotoStart(sal_Bool Expand) { rUnoCursor.GetPoint()->nNode = *pTableNode->EndOfSectionNode(); pCNode = GetDoc()->GetNodes().GoNext(&rUnoCursor.GetPoint()->nNode); - pTableNode = (pCNode) ? pCNode->FindTableNode() : nullptr; + pTableNode = pCNode ? pCNode->FindTableNode() : nullptr; } if (pCNode) { @@ -2915,7 +2915,7 @@ SwXTextCursor::createEnumeration() ? rUnoCursor.GetPoint()->nNode.GetNode().FindTableNode() : nullptr); SwTable const*const pTable( - (pStartNode) ? & pStartNode->GetTable() : nullptr ); + pStartNode ? & pStartNode->GetTable() : nullptr ); return SwXParagraphEnumeration::Create(pParentText, pNewCursor, eSetType, pStartNode, pTable); } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 737a38eec04c..8d13fa4dc7e7 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1049,10 +1049,10 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, } else { - SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc() - : ((pPortion) ? pPortion->GetCursor().GetDoc() : nullptr); - const SwPaM* const pUnoCursor = (pCursor) ? pCursor->GetPaM() - : ((pPortion) ? &pPortion->GetCursor() : nullptr); + SwDoc* const pDoc = pCursor ? pCursor->GetDoc() + : (pPortion ? pPortion->GetCursor().GetDoc() : nullptr); + const SwPaM* const pUnoCursor = pCursor ? pCursor->GetPaM() + : (pPortion ? &pPortion->GetCursor() : nullptr); if (pUnoCursor && pDoc == rToFill.GetDoc()) { OSL_ENSURE(!pUnoCursor->IsMultiSelection(), @@ -1084,7 +1084,7 @@ lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode const *const pSttNode, true, &pItem)) { SfxPoolItem *const pItemNonConst(const_cast<SfxPoolItem *>(pItem)); - SwFrameFormat *const pHeadFootFormat = (bHeader) ? + SwFrameFormat *const pHeadFootFormat = bHeader ? static_cast<SwFormatHeader*>(pItemNonConst)->GetHeaderFormat() : static_cast<SwFormatFooter*>(pItemNonConst)->GetFooterFormat(); if (pHeadFootFormat) @@ -1092,7 +1092,7 @@ lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode const *const pSttNode, const SwFormatContent& rFlyContent = pHeadFootFormat->GetContent(); const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode(); SwStartNode const*const pCurSttNode = rNode.FindSttNodeByType( - (bHeader) ? SwHeaderStartNode : SwFooterStartNode); + bHeader ? SwHeaderStartNode : SwFooterStartNode); if (pCurSttNode && (pCurSttNode == pSttNode)) { rpFormat = pHeadFootFormat; @@ -1145,7 +1145,7 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos) static_cast<SwFrameFormat*>(pTableNode->GetTable().GetFrameFormat()); SwTableBox *const pBox = pSttNode->GetTableBox(); - xParentText = (pBox) + xParentText = pBox ? SwXCell::CreateXCell( pTableFormat, pBox ) : new SwXCell( pTableFormat, *pSttNode ); } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index c755f8ba7dd7..6eb73d3c0147 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -249,7 +249,7 @@ SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTextNode *const pTextNode, SwPosition Pos(*pTextNode); xParentText.set(::sw::CreateParentXText( rDoc, Pos )); } - SwXParagraph *const pXPara( (pTextNode) + SwXParagraph *const pXPara( pTextNode ? new SwXParagraph(xParentText, *pTextNode, nSelStart, nSelEnd) : new SwXParagraph); // this is why the constructor is private: need to acquire pXPara here @@ -1417,7 +1417,7 @@ uno::Reference<frame::XModel> SwXParagraph::GetModel() if (pTextNode) { SwDocShell const*const pShell( pTextNode->GetDoc()->GetDocShell() ); - return (pShell) ? pShell->GetModel() : nullptr; + return pShell ? pShell->GetModel() : nullptr; } return nullptr; } diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 887b76d807f1..6088867622c4 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -172,7 +172,7 @@ SwXRedlinePortion::SwXRedlinePortion(SwRangeRedline const& rRedline, SwUnoCursor const*const pPortionCursor, uno::Reference< text::XText > const& xParent, bool const bStart) : SwXTextPortion(pPortionCursor, xParent, - (bStart) ? PORTION_REDLINE_START : PORTION_REDLINE_END) + bStart ? PORTION_REDLINE_START : PORTION_REDLINE_END) , m_rRedline(rRedline) { SetCollapsed(!m_rRedline.HasMark()); diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index a01ebcbd3179..c462aad698ef 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -223,7 +223,7 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam, bool bMark = *rPam.GetPoint() != *rPam.GetMark(); const bool bForceExpandHints( !bMark && pCursor && pCursor->IsAtEndOfMeta() ); - const SetAttrMode nInsertFlags = (bForceExpandHints) + const SetAttrMode nInsertFlags = bForceExpandHints ? ( SetAttrMode::FORCEHINTEXPAND | SetAttrMode::DONTEXPAND) : SetAttrMode::DONTEXPAND; @@ -298,7 +298,7 @@ SwXReferenceMark::attach(const uno::Reference< text::XTextRange > & xTextRange) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); } SwDoc *const pDocument = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pDocument) { throw lang::IllegalArgumentException(); @@ -552,7 +552,7 @@ const SwStartNode *SwXMetaText::GetStartNode() const { SwXText const * const pParent( dynamic_cast<SwXText*>(m_rMeta.GetParentText().get())); - return (pParent) ? pParent->GetStartNode() : nullptr; + return pParent ? pParent->GetStartNode() : nullptr; } void SwXMetaText::PrepareForAttach( uno::Reference<text::XTextRange> & xRange, @@ -705,7 +705,7 @@ SwXMeta::~SwXMeta() uno::Reference<rdf::XMetadatable> SwXMeta::CreateXMeta(SwDoc & rDoc, bool const isField) { - SwXMeta *const pXMeta((isField) + SwXMeta *const pXMeta(isField ? new SwXMetaField(& rDoc) : new SwXMeta(& rDoc)); // this is why the constructor is private: need to acquire pXMeta here uno::Reference<rdf::XMetadatable> const xMeta(pXMeta); @@ -975,7 +975,7 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange, } SwXTextRange *const pRange( ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel)); - OTextCursorHelper *const pCursor( (pRange) ? nullptr : + OTextCursorHelper *const pCursor( pRange ? nullptr : ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel)); if (!pRange && !pCursor) { @@ -1001,7 +1001,7 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange, SwXTextCursor const*const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor)); const bool bForceExpandHints(pTextCursor && pTextCursor->IsAtEndOfMeta()); - const SetAttrMode nInsertFlags( (bForceExpandHints) + const SetAttrMode nInsertFlags( bForceExpandHints ? ( SetAttrMode::FORCEHINTEXPAND | SetAttrMode::DONTEXPAND) : SetAttrMode::DONTEXPAND ); @@ -1254,7 +1254,7 @@ uno::Reference<frame::XModel> SwXMeta::GetModel() if (pTextNode) { SwDocShell const * const pShell(pTextNode->GetDoc()->GetDocShell()); - return (pShell) ? pShell->GetModel() : nullptr; + return pShell ? pShell->GetModel() : nullptr; } } return nullptr; @@ -1462,7 +1462,7 @@ lcl_getURI(const bool bPrefix) static uno::Reference< rdf::XURI > xOdfSuffix( rdf::URI::createKnown(xContext, rdf::URIs::ODF_SUFFIX), uno::UNO_SET_THROW); - return (bPrefix) ? xOdfPrefix : xOdfSuffix; + return bPrefix ? xOdfPrefix : xOdfSuffix; } static OUString diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 3c79a8315db5..b8c32ae13f78 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -123,7 +123,7 @@ public: , m_EventListeners(m_Mutex) , m_bIndexHeader(bIndexHeader) , m_bIsDescriptor(nullptr == pFormat) - , m_pProps((pFormat) ? nullptr : new SwTextSectionProperties_Impl()) + , m_pProps(pFormat ? nullptr : new SwTextSectionProperties_Impl()) { } @@ -243,7 +243,7 @@ SwXTextSection::getParentSection() SwSectionFormat *const pParentFormat = rSectionFormat.GetParent(); const uno::Reference< text::XTextSection > xRet = - (pParentFormat) ? CreateXTextSection(pParentFormat) : nullptr; + pParentFormat ? CreateXTextSection(pParentFormat) : nullptr; return xRet; } @@ -287,7 +287,7 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange) } SwDoc *const pDoc = - (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : nullptr); + pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -562,7 +562,7 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( } std::unique_ptr<SwSectionData> const pSectionData( - (pFormat) ? new SwSectionData(*pFormat->GetSection()) : nullptr); + pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr); OUString const*const pPropertyNames = rPropertyNames.getConstArray(); uno::Any const*const pValues = rValues.getConstArray(); @@ -950,7 +950,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl( uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); uno::Any* pRet = aRet.getArray(); - SwSection *const pSect = (pFormat) ? pFormat->GetSection() : nullptr; + SwSection *const pSect = pFormat ? pFormat->GetSection() : nullptr; const OUString* pPropertyNames = rPropertyNames.getConstArray(); for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength(); @@ -1448,7 +1448,7 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) } std::unique_ptr<SwSectionData> const pSectionData( - (pFormat) ? new SwSectionData(*pFormat->GetSection()) : nullptr); + pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr); std::unique_ptr<SfxItemSet> pNewAttrSet; bool bLinkModeChanged = false; @@ -1724,7 +1724,7 @@ uno::Reference<frame::XModel> SwXTextSection::GetModel() if (pSectionFormat) { SwDocShell const*const pShell( pSectionFormat->GetDoc()->GetDocShell() ); - return (pShell) ? pShell->GetModel() : nullptr; + return pShell ? pShell->GetModel() : nullptr; } return nullptr; } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 966e8b0af2a6..3839de130984 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -564,7 +564,7 @@ static bool lcl_GetHeaderFooterItem( SvxSetItem const*& o_rpItem) { SfxItemState eState = rSet.GetItemState( - (bFooter) ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, + bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false, reinterpret_cast<const SfxPoolItem**>(&o_rpItem)); if (SfxItemState::SET != eState && rPropName == UNO_NAME_FIRST_IS_SHARED) @@ -3049,7 +3049,7 @@ static uno::Reference<text::XText> lcl_makeHeaderFooter(const sal_uInt16 nRes, c const SfxPoolItem* pItem; if(SfxItemState::SET != rSet.GetItemState(nRes, true, &pItem)) return nullptr; - SwFrameFormat* const pHeadFootFormat = (bHeader) + SwFrameFormat* const pHeadFootFormat = bHeader ? static_cast<SwFormatHeader*>(const_cast<SfxPoolItem*>(pItem))->GetHeaderFormat() : static_cast<SwFormatFooter*>(const_cast<SfxPoolItem*>(pItem))->GetFooterFormat(); if(!pHeadFootFormat) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 67d4458e3740..de6adc6a2130 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1947,9 +1947,9 @@ public: , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)) , m_bFirstRowAsLabel(false) , m_bFirstColumnAsLabel(false) - , m_pTableProps((pFrameFormat) ? nullptr : new SwTableProperties_Impl) - , m_nRows((pFrameFormat) ? 0 : 2) - , m_nColumns((pFrameFormat) ? 0 : 2) + , m_pTableProps(pFrameFormat ? nullptr : new SwTableProperties_Impl) + , m_nRows(pFrameFormat ? 0 : 2) + , m_nColumns(pFrameFormat ? 0 : 2) { } @@ -2024,7 +2024,7 @@ uno::Reference<text::XTextTable> SwXTextTable::CreateXTextTable(SwFrameFormat* c xTable.set(pFrameFormat->GetXObject(), uno::UNO_QUERY); // cached? if(xTable.is()) return xTable; - SwXTextTable* const pNew( (pFrameFormat) ? new SwXTextTable(*pFrameFormat) : new SwXTextTable()); + SwXTextTable* const pNew( pFrameFormat ? new SwXTextTable(*pFrameFormat) : new SwXTextTable()); xTable.set(pNew); if(pFrameFormat) pFrameFormat->SetXObject(xTable); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 8170ecaa9fb7..db3d78c9c382 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -640,7 +640,7 @@ SwXText::insertTextContentBefore( ::sw::UnoTunnelGetImplementation<SwXTextSection>(xSuccTunnel); SwXTextTable *const pXTable = ::sw::UnoTunnelGetImplementation<SwXTextTable>(xSuccTunnel); - SwFrameFormat *const pTableFormat = (pXTable) ? pXTable->GetFrameFormat() : nullptr; + SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; SwTextNode * pTextNode = nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) { @@ -697,7 +697,7 @@ SwXText::insertTextContentAfter( ::sw::UnoTunnelGetImplementation<SwXTextSection>(xPredTunnel); SwXTextTable *const pXTable = ::sw::UnoTunnelGetImplementation<SwXTextTable>(xPredTunnel); - SwFrameFormat *const pTableFormat = (pXTable) ? pXTable->GetFrameFormat() : nullptr; + SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; bool bRet = false; SwTextNode * pTextNode = nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) @@ -747,7 +747,7 @@ SwXText::removeTextContentBefore( ::sw::UnoTunnelGetImplementation<SwXTextSection>(xSuccTunnel); SwXTextTable *const pXTable = ::sw::UnoTunnelGetImplementation<SwXTextTable>(xSuccTunnel); - SwFrameFormat *const pTableFormat = (pXTable) ? pXTable->GetFrameFormat() : nullptr; + SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) { SwTable *const pTable = SwTable::FindTable( pTableFormat ); @@ -799,7 +799,7 @@ SwXText::removeTextContentAfter( ::sw::UnoTunnelGetImplementation<SwXTextSection>(xPredTunnel); SwXTextTable *const pXTable = ::sw::UnoTunnelGetImplementation<SwXTextTable>(xPredTunnel); - SwFrameFormat *const pTableFormat = (pXTable) ? pXTable->GetFrameFormat() : nullptr; + SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) { SwTable *const pTable = SwTable::FindTable( pTableFormat ); @@ -2510,7 +2510,7 @@ SwXHeadFootText::CreateXHeadFootText( SwXHeadFootText::SwXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool bIsHeader) : SwXText(rHeadFootFormat.GetDoc(), - (bIsHeader) ? CursorType::Header : CursorType::Footer) + bIsHeader ? CursorType::Header : CursorType::Footer) , m_pImpl( new SwXHeadFootText::Impl(rHeadFootFormat, bIsHeader) ) { } diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 60b028b8e608..4386de8fdc3e 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -222,7 +222,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ) SwDoc* pGlDoc = rBlocks.GetDoc(); SwNodeIndex aIdx( pGlDoc->GetNodes().GetEndOfContent(), -1 ); pCNd = aIdx.GetNode().GetContentNode(); - SwPosition aPos( aIdx, SwIndex( pCNd, ( pCNd ) ? pCNd->Len() : 0 ) ); + SwPosition aPos( aIdx, SwIndex( pCNd, pCNd ? pCNd->Len() : 0 ) ); pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); rBlocks.PutDoc(); } diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index f6a55669e4c6..436508a5e377 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -337,7 +337,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) } SwTextNode* pOldTextNd = - (bAppended) ? nullptr : m_pPam->GetPoint()->nNode.GetNode().GetTextNode(); + bAppended ? nullptr : m_pPam->GetPoint()->nNode.GetNode().GetTextNode(); m_pPam->Move( fnMoveBackward ); @@ -724,7 +724,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) } SwTextNode* pOldTextNd = - (bAppended) ? nullptr : m_pPam->GetPoint()->nNode.GetNode().GetTextNode(); + bAppended ? nullptr : m_pPam->GetPoint()->nNode.GetNode().GetTextNode(); m_pPam->Move( fnMoveBackward ); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 7a45f8e20524..8a86fef5c6c2 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -502,7 +502,7 @@ void WW8AttributeOutput::StartStyleProperties( bool bParProp, sal_uInt16 nStyle { impl_SkipOdd( m_rWW8Export.pO, m_rWW8Export.pTableStrm->Tell() ); - sal_uInt16 nLen = ( bParProp ) ? 2 : 0; // default length + sal_uInt16 nLen = bParProp ? 2 : 0; // default length m_nStyleLenPos = m_rWW8Export.pO->size(); // adding length // Don't save pointer, because it // changes by _grow! diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 4749fac3ecc8..12a8ef8b6f89 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1195,7 +1195,7 @@ bool WW8_WrFkp::Append( WW8_FC nEndFc, sal_uInt16 nVarLen, const sal_uInt8* pSpr return true; // ignore (do not create a new Fkp) } - sal_uInt8 nOldP = ( nVarLen ) ? SearchSameSprm( nVarLen, pSprms ) : 0; + sal_uInt8 nOldP = nVarLen ? SearchSameSprm( nVarLen, pSprms ) : 0; // Combine equal entries short nOffset=0, nPos = nStartGrp; if (nVarLen && !nOldP) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 95ab936fca09..86c75d4b22e0 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1256,7 +1256,7 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) switch ( rUnderline.GetLineStyle() ) { case LINESTYLE_SINGLE: - b = ( bWord ) ? 2 : 1; + b = bWord ? 2 : 1; break; case LINESTYLE_BOLD: b = 6; diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 00d1f06493d6..d980d393d5d3 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -170,7 +170,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, SwNodeIndex aIdx( pGlDoc->GetNodes().GetEndOfContent(), -1 ); pCNd = aIdx.GetNode().GetContentNode(); - SwPosition aPos(aIdx, SwIndex(pCNd, (pCNd) ? pCNd->Len() : 0)); + SwPosition aPos(aIdx, SwIndex(pCNd, pCNd ? pCNd->Len() : 0)); pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); rBlocks.PutDoc(); } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 4d3a5d50eff0..4991e63fb6f5 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1012,7 +1012,7 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p) { aShortSprm[0] = (sal_uInt8)( ( nPrm & 0xfe) >> 1 ); aShortSprm[1] = (sal_uInt8)( nPrm >> 8 ); - p->nSprmsLen = ( nPrm ) ? 2 : 0; // length + p->nSprmsLen = nPrm ? 2 : 0; // length // store Position of internal mini storage in Data Pointer p->pMemPos = aShortSprm; @@ -1112,7 +1112,7 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p) aShortSprm[2] = (sal_uInt8)( nPrm >> 8 ); // store Sprm Length in member: - p->nSprmsLen = ( nPrm ) ? 3 : 0; + p->nSprmsLen = nPrm ? 3 : 0; // store Position of internal mini storage in Data Pointer p->pMemPos = aShortSprm; diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 35d0bdf6d120..250a31688151 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -58,7 +58,7 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextCursor> const & rCursor ) OTextCursorHelper *const pXCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel); OSL_ENSURE( pXCursor, "OTextCursorHelper missing" ); - return (pXCursor) ? pXCursor->GetDoc() : nullptr; + return pXCursor ? pXCursor->GetDoc() : nullptr; } static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> const & rRange ) @@ -69,7 +69,7 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> const & rRange ) ::sw::UnoTunnelGetImplementation<SwXTextRange>(xTunnel); // #i115174#: this may be a SvxUnoTextRange // OSL_ENSURE( pXRange, "SwXTextRange missing" ); - return (pXRange) ? &pXRange->GetDoc() : nullptr; + return pXRange ? &pXRange->GetDoc() : nullptr; } // XTextRangeOrNodeIndexPosition: store a position into the text diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 2d9877396a51..7025f9efb2f1 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -359,7 +359,7 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell ) for (size_t i = m_Cells.size(); i < nCells; ++i) { m_Cells.push_back(o3tl::make_unique<SwXMLTableCell_Impl>( - 1UL, (bOneCell) ? nColSpan : 1UL)); + 1UL, bOneCell ? nColSpan : 1UL)); nColSpan--; } diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 592a46c5ec89..92024ab1a727 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -81,7 +81,7 @@ SwFieldDokInfPage::SwFieldDokInfPage(vcl::Window* pParent, const SfxItemSet *con //enable 'active' language selection m_pFormatLB->SetShowLanguageControl(true); - const SfxUnoAnyItem* pItem = (pCoreSet) + const SfxUnoAnyItem* pItem = pCoreSet ? pCoreSet->GetItem<SfxUnoAnyItem>(SID_DOCINFO, false) : nullptr; if ( pItem ) diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 6c77133554bf..46fd6eb88802 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -1183,7 +1183,7 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* ) case TYP_INPUTFLD: { SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::User, aName); - nSubType = static_cast< sal_uInt16 >((nSubType & 0xff00) | ((pType) ? INP_USR : INP_VAR)); + nSubType = static_cast< sal_uInt16 >((nSubType & 0xff00) | (pType ? INP_USR : INP_VAR)); break; } diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 64270c3248a2..0b20824c2342 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1355,7 +1355,7 @@ bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) sal_uInt16 nPgNum = static_cast< sal_uInt16 >(m_pPageNoNF->GetValue()); bool const usePageNo(bState && m_pPageNoCB->IsChecked()); boost::optional<sal_uInt16> const oPageNum( - (usePageNo) ? nPgNum : boost::optional<sal_Int16>()); + usePageNo ? nPgNum : boost::optional<sal_Int16>()); if (!pDesc || !pDesc->GetPageDesc() || (pDesc->GetPageDesc()->GetName() != sPage) || (pDesc->GetNumOffset() != oPageNum)) diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index bacf171d9552..6f688a5d9903 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -327,7 +327,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) pSh->Push(); pSh->SttDoc(); bool bInFly = nullptr != pSh->WizardGetFly(); - pSh->Pop((bInFly) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent); + pSh->Pop(bInFly ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent); if( bInFly ) pSh->EndDoc(true); // select all content diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index f390339ce2bb..c414b3c05368 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -824,7 +824,7 @@ sal_uInt16 SwDocShell::Edit( // In HTML mode, we do not always have a printer. In order to show // the correct page size in the Format - Page dialog, we have to // get one here. - SwWrtShell* pCurrShell = (pActShell) ? pActShell : m_pWrtShell; + SwWrtShell* pCurrShell = pActShell ? pActShell : m_pWrtShell; if( ( HTMLMODE_ON & nHtmlMode ) && !pCurrShell->getIDocumentDeviceAccess().getPrinter( false ) ) pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess().getPrinter( true ) ); diff --git a/sw/source/uibase/chrdlg/ccoll.cxx b/sw/source/uibase/chrdlg/ccoll.cxx index d066d7a86e91..d88268e2495c 100644 --- a/sw/source/uibase/chrdlg/ccoll.cxx +++ b/sw/source/uibase/chrdlg/ccoll.cxx @@ -170,7 +170,7 @@ void SwCondCollItem::SetStyle(OUString const*const pStyle, sal_uInt16 const nPos) { if( nPos < COND_COMMAND_COUNT ) - m_sStyles[nPos] = (pStyle) ? *pStyle : OUString(); + m_sStyles[nPos] = pStyle ? *pStyle : OUString(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx index 8e691ed9c25f..f5757699e130 100644 --- a/sw/source/uibase/misc/glshell.cxx +++ b/sw/source/uibase/misc/glshell.cxx @@ -131,7 +131,7 @@ static bool lcl_Save( SwWrtShell& rSh, const OUString& rGroupName, } SwGlosDocShell::SwGlosDocShell(bool bNewShow) - : SwDocShell( (bNewShow) + : SwDocShell( bNewShow ? SfxObjectCreateMode::STANDARD : SfxObjectCreateMode::INTERNAL ) { } diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 6be76c0485c3..e6fc466dfc9a 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -871,7 +871,7 @@ SvxSearchDialog* SwView::GetSearchDialog() #if HAVE_FEATURE_DESKTOP const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->GetChildWindow(nId) ); - auto pSrchDlg = (pWrp) ? pWrp->getDialog() : nullptr; + auto pSrchDlg = pWrp ? pWrp->getDialog() : nullptr; return pSrchDlg; #else return nullptr; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index c866213a36b5..67667185360a 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -2157,7 +2157,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) const SwFormatCol* pCols = pFormat ? &pFormat->GetCol(): &rDesc.GetMaster().GetCol(); const SwColumns& rCols = pCols->GetColumns(); - const sal_uInt16 nBorder = (pFormat) + const sal_uInt16 nBorder = pFormat ? pFormat->GetBox().GetSmallestDistance() : rDesc.GetMaster().GetBox().GetSmallestDistance(); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 9091fb7208a6..28c2c7f85454 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -300,12 +300,12 @@ static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTe SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 ); SwContentNode * pNd = aIdx.GetNode().GetContentNode(); - SwPosition aPos(aIdx, SwIndex(pNd, (pNd) ? pNd->Len() : 0)); + SwPosition aPos(aIdx, SwIndex(pNd, pNd ? pNd->Len() : 0)); bool bRet = false; pInsDoc->getIDocumentFieldsAccess().LockExpFields(); { - SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : &pxRange->GetDoc()); + SwDoc *const pDoc(pxCursor ? pxCursor->GetDoc() : &pxRange->GetDoc()); SwPaM aPam(pDoc->GetNodes()); SwPaM * pPam(nullptr); if(pxCursor) diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1d4a9c6196f7..0d82750de8ce 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -949,7 +949,7 @@ Reference< XIndexAccess > if(!pResultCursor) throw RuntimeException("No result cursor"); Reference< XIndexAccess > xRet; - xRet = SwXTextRanges::Create( (nResult) ? &(*pResultCursor) : nullptr ); + xRet = SwXTextRanges::Create( nResult ? &(*pResultCursor) : nullptr ); return xRet; } @@ -2525,7 +2525,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (pSwView) { // PDF export should not make use of the SwPrtOptions - const SwPrintData *pPrtOptions = (bIsPDFExport) + const SwPrintData *pPrtOptions = bIsPDFExport ? nullptr : m_pRenderData->GetSwPrtOptions(); bool setShowPlaceHoldersInPDF = false; if(bIsPDFExport) |