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 | |
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>
143 files changed, 283 insertions, 297 deletions
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 217e8fa7ea76..a3a61feaa2c5 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -220,7 +220,7 @@ bool MediaWindow::executeMediaURLDialog(const vcl::Window* pParent, OUString& rU static const char aSeparator[] = ";"; OUString aAllTypes; - aDlg.SetTitle( AvmResId( (o_pbLink) + aDlg.SetTitle( AvmResId( o_pbLink ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) ); getMediaFilters( aFilters ); diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 042cb480437b..69939ffb2037 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -98,9 +98,9 @@ namespace basegfx // get the polygon vector we want to plant this arrow on const double fConsumedLength(fArrowYLength * (1.0 - fDockingPosition) - fShift); - const B2DVector aHead(rCandidate.getB2DPoint((bStart) ? 0 : rCandidate.count() - 1)); + const B2DVector aHead(rCandidate.getB2DPoint(bStart ? 0 : rCandidate.count() - 1)); const B2DVector aTail(getPositionAbsolute(rCandidate, - (bStart) ? fConsumedLength : fCandidateLength - fConsumedLength, fCandidateLength)); + bStart ? fConsumedLength : fCandidateLength - fConsumedLength, fCandidateLength)); // from that vector, take the needed rotation and add rotate for arrow to transformation const B2DVector aTargetDirection(aHead - aTail); diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 3d64dee7838b..ea5efa39af39 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -633,7 +633,7 @@ namespace basegfx if(areParallel(aEdgeVector, aTestVector)) { - const double fCut((bTestUsingX) + const double fCut(bTestUsingX ? aTestVector.getX() / aEdgeVector.getX() : aTestVector.getY() / aEdgeVector.getY()); const double fZero(0.0); diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx index 7613a071d3e4..7bffdd7812fd 100644 --- a/chart2/source/tools/StatisticsHelper.cxx +++ b/chart2/source/tools/StatisticsHelper.cxx @@ -301,7 +301,7 @@ Reference< beans::XPropertySet > StatisticsHelper::addErrorBars( return xErrorBar; const OUString aPropName( - (bYError) ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X)); + bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X)); if( !( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar ) || !xErrorBar.is()) { @@ -326,7 +326,7 @@ Reference< beans::XPropertySet > StatisticsHelper::getErrorBars( Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY ); Reference< beans::XPropertySet > xErrorBar; const OUString aPropName( - (bYError) ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X)); + bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X)); if ( xSeriesProp.is()) xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar; diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index be1f49b7236c..b72c6da3eea2 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -453,7 +453,7 @@ OUString removeAny(OUString const& rIn, buf.append(c); } } - return (isFound) ? buf.makeStringAndClear() : rIn; + return isFound ? buf.makeStringAndClear() : rIn; } OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok, diff --git a/compilerplugins/clang/test/unnecessaryparen.cxx b/compilerplugins/clang/test/unnecessaryparen.cxx index d07f4930c4d3..968522d63a73 100644 --- a/compilerplugins/clang/test/unnecessaryparen.cxx +++ b/compilerplugins/clang/test/unnecessaryparen.cxx @@ -31,8 +31,7 @@ int main() case (EFoo::Bar): break; // expected-error {{parentheses immediately inside case statement [loplugin:unnecessaryparen]}} } - // lots of our code uses this style, which I'm loathe to bulk-fix as yet - int z = (y) ? 1 : 0; + int z = (y) ? 1 : 0; // expected-error {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}} (void)z; int v1 = (static_cast<short>(1)) + 1; // expected-error {{unnecessary parentheses around cast [loplugin:unnecessaryparen]}} diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx index fe3b0dd4b028..fdc83410cb0e 100644 --- a/compilerplugins/clang/unnecessaryparen.cxx +++ b/compilerplugins/clang/unnecessaryparen.cxx @@ -83,12 +83,10 @@ public: bool VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *); bool TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *); bool TraverseCaseStmt(CaseStmt *); - bool TraverseConditionalOperator(ConditionalOperator *); private: void VisitSomeStmt(Stmt const * stmt, const Expr* cond, StringRef stmtName); Expr const * insideSizeof = nullptr; Expr const * insideCaseStmt = nullptr; - Expr const * insideConditionalOperator = nullptr; }; bool UnnecessaryParen::TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr * expr) @@ -111,15 +109,6 @@ bool UnnecessaryParen::TraverseCaseStmt(CaseStmt * caseStmt) return ret; } -bool UnnecessaryParen::TraverseConditionalOperator(ConditionalOperator * conditionalOperator) -{ - auto old = insideConditionalOperator; - insideConditionalOperator = ignoreAllImplicit(conditionalOperator->getCond()); - bool ret = RecursiveASTVisitor::TraverseConditionalOperator(conditionalOperator); - insideConditionalOperator = old; - return ret; -} - bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr) { if (ignoreLocation(parenExpr)) @@ -130,8 +119,6 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr) return true; if (insideCaseStmt && parenExpr == insideCaseStmt) return true; - if (insideConditionalOperator && parenExpr == insideConditionalOperator) - return true; auto subExpr = ignoreAllImplicit(parenExpr->getSubExpr()); diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 4e16c3f74db3..d724ecacc61d 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -505,7 +505,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) delete pNumFmtShell; // delete old shell if applicable (== reset) - nInitFormat = ( pValFmtAttr ) // memorize init key + nInitFormat = pValFmtAttr // memorize init key ? pValFmtAttr->GetValue() // (for FillItemSet()) : ULONG_MAX; // == DONT_KNOW @@ -513,13 +513,13 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) if ( eValType == SvxNumberValueType::String ) pNumFmtShell =SvxNumberFormatShell::Create( pNumItem->GetNumberFormatter(), - (pValFmtAttr) ? nInitFormat : 0, + pValFmtAttr ? nInitFormat : 0, eValType, aValString ); else pNumFmtShell =SvxNumberFormatShell::Create( pNumItem->GetNumberFormatter(), - (pValFmtAttr) ? nInitFormat : 0, + pValFmtAttr ? nInitFormat : 0, eValType, nValDouble, &aValString ); diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx index ae9391900db0..8e3149711e57 100644 --- a/dbaccess/source/ui/app/AppSwapWindow.cxx +++ b/dbaccess/source/ui/app/AppSwapWindow.cxx @@ -129,7 +129,7 @@ bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent ) ElementType OApplicationSwapWindow::getElementType() const { SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(); - return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE; + return pEntry ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE; } bool OApplicationSwapWindow::onContainerSelected( ElementType _eType ) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 598e01c2d783..00c2eaf5dddf 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1383,7 +1383,7 @@ bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentCo {"Parent", uno::Any(xNameAccess)}, {PROPERTY_EMBEDDEDOBJECT, uno::Any(_xContent)}, })); - OUString sServiceName(_bCollection ? ((_bForm) ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION)); + OUString sServiceName(_bCollection ? (_bForm ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION)); Reference<XContent > xNew( xORB->createInstanceWithArguments( sServiceName, aArguments ), UNO_QUERY_THROW ); Reference< XNameContainer > xNameContainer( xNameAccess, UNO_QUERY_THROW ); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 2ee459617553..40eac4395e04 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); const bool bOldSimpleTextureActive(getSimpleTextureActive()); - std::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; + std::shared_ptr< texture::GeoTexSvx > pOldTex = bTransparence ? mpTransparenceGeoTexSvx : mpGeoTexSvx; // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 1cf15dcfe7b9..fd831d55febc 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -368,25 +368,25 @@ namespace pcr OUString OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sTranslation : OUString(); + return pInfo ? pInfo->sTranslation : OUString(); } OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sHelpId : OString(); + return pInfo ? pInfo->sHelpId : OString(); } sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nPos : 0xFFFF; + return pInfo ? pInfo->nPos : 0xFFFF; } sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nUIFlags : 0; + return pInfo ? pInfo->nUIFlags : 0; } std::vector< OUString > OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index a155d8d5dd65..694998345361 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -1971,7 +1971,7 @@ void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rV { if ( i > 0 ) nx = pDXArry[ i - 1 ]; - ImplWriteDouble( ( bStretch ) ? nx : rVDev.GetTextWidth( OUString(rString[i]) ) ); + ImplWriteDouble( bStretch ? nx : rVDev.GetTextWidth( OUString(rString[i]) ) ); ImplWriteDouble( nx ); ImplWriteLine( "(", PS_NONE ); ImplWriteCharacter( rString[i] ); diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index e20d60d3bd69..31c583900e1f 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -221,7 +221,7 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize ) else // ->RP_FIXED { long nVal; - const int nSwitch = ( bCompatible ) ? 0 : 1 ; + const int nSwitch = bCompatible ? 0 : 1 ; if ( nRealSize == 4 ) { sal_uInt16* pShort = static_cast<sal_uInt16*>(pPtr); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index b06a325ded6b..128d1556b4c6 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1891,7 +1891,7 @@ bool EscherPropertyContainer::CreatePolygonProperties( { css::uno::Any aAny; bRetValue = EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, - ( bBezier ) ? OUString("PolyPolygonBezier") : OUString("PolyPolygon"), true ); + bBezier ? OUString("PolyPolygonBezier") : OUString("PolyPolygon"), true ); if ( bRetValue ) { aPolyPolygon = GetPolyPolygon( aAny ); @@ -4003,7 +4003,7 @@ EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize ) { - sal_uInt32 nPictureOffset = ( bWritePictureOffset ) ? mnPictureOffset : 0; + sal_uInt32 nPictureOffset = bWritePictureOffset ? mnPictureOffset : 0; rSt.WriteUInt32( ( ESCHER_BSE << 16 ) | ( ( (sal_uInt16)meBlibType << 4 ) | 2 ) ) .WriteUInt32( 36 + nResize ) @@ -4452,9 +4452,9 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) sal_uInt32 nRule = 0; css::uno::Any aAny; - css::awt::Point aRefPoint( ( bFirst ) ? maPointA : maPointB ); + css::awt::Point aRefPoint( bFirst ? maPointA : maPointB ); css::uno::Reference< css::drawing::XShape > - aXShape( ( bFirst ) ? mXConnectToA : mXConnectToB ); + aXShape( bFirst ? mXConnectToA : mXConnectToB ); OUString aString(aXShape->getShapeType()); OStringBuffer aBuf(OUStringToOString(aString, RTL_TEXTENCODING_UTF8)); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 78a8e1b9500a..f1b8c65759d6 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2276,7 +2276,7 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* } } sal_Int32 nParaIndex = pTextObj->GetCurrentIndex(); - SfxStyleSheet* pS = ( ppStyleSheetAry ) ? ppStyleSheetAry[ pPara->mxParaSet->mnDepth ] : pSheet; + SfxStyleSheet* pS = ppStyleSheetAry ? ppStyleSheetAry[ pPara->mxParaSet->mnDepth ] : pSheet; ESelection aSelection( nParaIndex, 0, nParaIndex, 0 ); rOutliner.Insert( OUString(), nParaIndex, pPara->mxParaSet->mnDepth ); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 95b229723474..824f21be6ccd 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -695,7 +695,7 @@ sal_Int32 SVGTextWriter::setTextPosition( const GDIMetaFile& rMtf, sal_uLong& nC if( bEmpty ) { nCurAction = nActionIndex; - return ( (bEOL) ? -2 : ( (bEOP) ? -1 : 0 ) ); + return ( bEOL ? -2 : ( bEOP ? -1 : 0 ) ); } else { diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 766bc7b141df..2ed63c36af8f 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -434,7 +434,7 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL ) bCreateOrShowToolbar &= bool( xContainerWindow->isActive()); if ( bCreateOrShowToolbar ) - bNotify = ( bMustCallCreate ) ? createToolbar( rResourceURL ) : showToolbar( rResourceURL ); + bNotify = bMustCallCreate ? createToolbar( rResourceURL ) : showToolbar( rResourceURL ); return bNotify; } @@ -3116,7 +3116,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( if ( isDefaultPos( pIter->m_aDockedData.m_aPos )) continue; - sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? pIter->m_aDockedData.m_aPos.Y : pIter->m_aDockedData.m_aPos.X; + sal_Int32 nWindowRowCol = bHorzDockingArea ? pIter->m_aDockedData.m_aPos.Y : pIter->m_aDockedData.m_aPos.X; if ( nWindowRowCol >= nRowCol ) { if ( bHorzDockingArea ) @@ -3158,7 +3158,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( if ( isDefaultPos( aDockedPos )) continue; - sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? aDockedPos.Y : aDockedPos.X; + sal_Int32 nWindowRowCol = bHorzDockingArea ? aDockedPos.Y : aDockedPos.X; if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol )) { if ( bHorzDockingArea ) diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 87f3ef0c9db6..388c990ee762 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -156,7 +156,7 @@ hchar_string DateCode::GetString() for (; *fmt && ((int) ret.size() < DATE_SIZE); fmt++) { - form = (add_zero) ? "%02d" : "%d"; + form = add_zero ? "%02d" : "%d"; add_zero = false; is_pm = (date[HOUR] >= 12); @@ -230,13 +230,13 @@ hchar_string DateCode::GetString() break; case '7': ret.push_back(0xB5A1); - ret.push_back((is_pm) ? 0xD281 : 0xB8E5); + ret.push_back(is_pm ? 0xD281 : 0xB8E5); break; case '&': - strncat(cbuf, (is_pm) ? "p.m." : "a.m.", sizeof(cbuf) - strlen(cbuf) - 1); + strncat(cbuf, is_pm ? "p.m." : "a.m.", sizeof(cbuf) - strlen(cbuf) - 1); break; case '+': - strncat(cbuf, (is_pm) ? "P.M." : "A.M.", sizeof(cbuf) - strlen(cbuf) - 1); + strncat(cbuf, is_pm ? "P.M." : "A.M.", sizeof(cbuf) - strlen(cbuf) - 1); break; case '8': // 2.5 feature case '9': diff --git a/include/osl/file.hxx b/include/osl/file.hxx index a5823fbe1174..3c2848eaa590 100644 --- a/include/osl/file.hxx +++ b/include/osl/file.hxx @@ -1906,7 +1906,7 @@ public: { return static_cast< RC >(osl_createDirectoryPath( aDirectoryUrl.pData, - (aDirectoryCreationObserver) ? onDirectoryCreated : NULL, + aDirectoryCreationObserver ? onDirectoryCreated : NULL, aDirectoryCreationObserver)); } }; diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 60a2aaff7249..3a4159d35392 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -202,7 +202,7 @@ private: inline void PushButton::Check( bool bCheck ) { - SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE ); + SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); } inline bool PushButton::IsChecked() const @@ -474,7 +474,7 @@ public: inline void CheckBox::Check( bool bCheck ) { - SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE ); + SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); } inline bool CheckBox::IsChecked() const diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 6a936d8e03fa..e6d213027e60 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -518,7 +518,7 @@ public: inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck ) { - SetItemState( nItemId, (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE ); + SetItemState( nItemId, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); } inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index aed694c109e0..82732af556f6 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -162,21 +162,21 @@ namespace rptui OUString OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sTranslation : OUString(); + return pInfo ? pInfo->sTranslation : OUString(); } OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sHelpId : OString(); + return pInfo ? pInfo->sHelpId : OString(); } PropUIFlags OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nUIFlags : PropUIFlags::NONE; + return pInfo ? pInfo->nUIFlags : PropUIFlags::NONE; } diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index c7261f1eec76..3633ee5bfd6c 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -1476,7 +1476,7 @@ oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket, nullptr, PTR_FD_SET(WriteSet), PTR_FD_SET(ExcptSet), - (pTimeout) ? &tv : nullptr); + pTimeout ? &tv : nullptr); if (ReadyHandles > 0) /* connected */ { diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 7fd28345c0a6..d1ac259cc33c 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -79,7 +79,7 @@ private: void doTest(util::Duration const & rid, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); util::Duration od; OUString is(::rtl::OUString::createFromAscii(pis)); SAL_INFO("sax.cppunit","about to convert '" << is << "'"); @@ -155,7 +155,7 @@ bool eqDateTime(const util::DateTime& a, const util::DateTime& b) { void doTest(util::DateTime const & rdt, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); @@ -249,7 +249,7 @@ void ConverterTest::testDateTime() void doTestTime(util::DateTime const & rdt, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 121ae8a2ffa4..ad5cb8c19113 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -991,7 +991,7 @@ readUnsignedNumber(const OUString & rString, io_rnPos = nPos; o_rNumber = nTemp; - return (bOverflow) ? R_OVERFLOW : R_SUCCESS; + return bOverflow ? R_OVERFLOW : R_SUCCESS; } static Result @@ -1035,7 +1035,7 @@ readUnsignedNumberMaxDigits(int maxDigits, io_rnPos = nPos; o_rNumber = nTemp; - return (bOverflow) ? R_OVERFLOW : R_SUCCESS; + return bOverflow ? R_OVERFLOW : R_SUCCESS; } static bool @@ -1778,12 +1778,12 @@ static bool lcl_parseDateTime( if (bSuccess) { - sal_Int16 const nTimezoneOffset = ((bHaveTimezoneMinus) ? (-1) : (+1)) + sal_Int16 const nTimezoneOffset = (bHaveTimezoneMinus ? (-1) : (+1)) * ((nTimezoneHours * 60) + nTimezoneMinutes); if (!pDate || bHaveTime) // time is optional { rDateTime.Year = - ((isNegative) ? (-1) : (+1)) * static_cast<sal_Int16>(nYear); + (isNegative ? (-1) : (+1)) * static_cast<sal_Int16>(nYear); rDateTime.Month = static_cast<sal_uInt16>(nMonth); rDateTime.Day = static_cast<sal_uInt16>(nDay); rDateTime.Hours = static_cast<sal_uInt16>(nHours); @@ -1818,7 +1818,7 @@ static bool lcl_parseDateTime( else { pDate->Year = - ((isNegative) ? (-1) : (+1)) * static_cast<sal_Int16>(nYear); + (isNegative ? (-1) : (+1)) * static_cast<sal_Int16>(nYear); pDate->Month = static_cast<sal_uInt16>(nMonth); pDate->Day = static_cast<sal_uInt16>(nDay); if (bHaveTimezone) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 56be6df03201..cd09f5d0247f 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1638,7 +1638,7 @@ CommentCaptionState ScTable::GetAllNoteCaptionsState(const ScRange& rRange, std: } } } - return (bIsFirstNoteShownState) ? CommentCaptionState::ALLSHOWN : CommentCaptionState::ALLHIDDEN; + return bIsFirstNoteShownState ? CommentCaptionState::ALLSHOWN : CommentCaptionState::ALLHIDDEN; } void ScTable::GetUnprotectedCells( ScRangeList& rRangeList ) const diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 909965676139..29d9d845b8f6 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -2490,7 +2490,7 @@ void ScInterpreter::CalculateRGPRKP(bool _bRKP) double fSSreg = fSlope * fSlope * fSumX2; pResMat->PutDouble(fSSreg, 0, 4); - double fDegreesFreedom =static_cast<double>( (bConstant) ? N-2 : N-1 ); + double fDegreesFreedom =static_cast<double>( bConstant ? N-2 : N-1 ); pResMat->PutDouble(fDegreesFreedom, 1, 3); double fSSresid = lcl_GetSSresid(pMatX,pMatY,fSlope,N); @@ -2621,7 +2621,7 @@ void ScInterpreter::CalculateRGPRKP(bool _bRKP) pResMat->PutDouble(fSSreg, 0, 4); pResMat->PutDouble(fSSresid, 1, 4); - double fDegreesFreedom =static_cast<double>( (bConstant) ? N-K-1 : N-K ); + double fDegreesFreedom =static_cast<double>( bConstant ? N-K-1 : N-K ); pResMat->PutDouble(fDegreesFreedom, 1, 3); if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0) @@ -2778,7 +2778,7 @@ void ScInterpreter::CalculateRGPRKP(bool _bRKP) pResMat->PutDouble(fSSreg, 0, 4); pResMat->PutDouble(fSSresid, 1, 4); - double fDegreesFreedom =static_cast<double>( (bConstant) ? N-K-1 : N-K ); + double fDegreesFreedom =static_cast<double>( bConstant ? N-K-1 : N-K ); pResMat->PutDouble(fDegreesFreedom, 1, 3); if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0) diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 0461d7e48c66..cc69f4ae3c1e 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -737,7 +737,7 @@ bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) sal_uInt32 nIndex = 0; bool bIsNum = !bLen || GetFormatter().IsNumberFormat( sText, nIndex, fVal ); OUString* pText; - (bIsNum) ? pText = nullptr : pText = &sText; + bIsNum ? pText = nullptr : pText = &sText; // top10 flags sal_uInt16 nNewFlags = 0x0000; diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 39ea16bf683a..1a6b3f56157b 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1372,7 +1372,7 @@ void ScCheckListMenuWindow::updateMemberParents( const SvTreeListEntry* pLeaf, s if ( pLeaf ) { SvTreeListEntry* pMonthEntry = pLeaf->GetParent(); - SvTreeListEntry* pYearEntry = ( pMonthEntry ) ? pMonthEntry->GetParent() : nullptr; + SvTreeListEntry* pYearEntry = pMonthEntry ? pMonthEntry->GetParent() : nullptr; maMembers[nIdx].mpParent = pMonthEntry; if ( aItr != maYearMonthMap.end() ) diff --git a/sc/source/ui/miscdlgs/delcodlg.cxx b/sc/source/ui/miscdlgs/delcodlg.cxx index 16767809cc26..79f52c5dd2b6 100644 --- a/sc/source/ui/miscdlgs/delcodlg.cxx +++ b/sc/source/ui/miscdlgs/delcodlg.cxx @@ -111,7 +111,7 @@ InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const ScDeleteContentsDlg::bPreviousAllCheck = aBtnDelAll->IsChecked(); - return ( (ScDeleteContentsDlg::bPreviousAllCheck) + return ( ScDeleteContentsDlg::bPreviousAllCheck ? InsertDeleteFlags::ALL : ScDeleteContentsDlg::nPreviousChecks ); } diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx index 0845e7627c23..eddd015b646d 100644 --- a/sc/source/ui/miscdlgs/inscodlg.cxx +++ b/sc/source/ui/miscdlgs/inscodlg.cxx @@ -147,7 +147,7 @@ InsertDeleteFlags ScInsertContentsDlg::GetInsContentsCmdBits() const if (bUsedShortCut) return nShortCutInsContentsCmdBits; - return ( (ScInsertContentsDlg::bPreviousAllCheck) + return ( ScInsertContentsDlg::bPreviousAllCheck ? InsertDeleteFlags::ALL : ScInsertContentsDlg::nPreviousChecks ); } diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 6283edca1486..c627970fd4e2 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -1118,7 +1118,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, // Subtitle template SvxNumBulletItem const*const pItem( rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET)); - SvxNumRule *const pDefaultRule = (pItem) ? pItem->GetNumRule() : nullptr; + SvxNumRule *const pDefaultRule = pItem ? pItem->GetNumRule() : nullptr; DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" ); if(pDefaultRule) diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx index a17ee08d6a89..693607413215 100644 --- a/sd/source/filter/eppt/pptx-stylesheet.cxx +++ b/sd/source/filter/eppt/pptx-stylesheet.cxx @@ -168,7 +168,7 @@ PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBull { nBulletChar = 0x2022; nBulletOfs = 0; - nTextOfs = ( bHasBullet ) ? 0xd8 : 0; + nTextOfs = bHasBullet ? 0xd8 : 0; } break; case 1 : diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 2c189d79516c..60eb678303b0 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -585,7 +585,7 @@ bool ImplSdPPTImport::Import() bool bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bNotesMaster; bool bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bStarDrawFiller; - PageKind ePgKind = ( bNotesMaster ) ? PageKind::Notes : PageKind::Standard; + PageKind ePgKind = bNotesMaster ? PageKind::Notes : PageKind::Standard; bool bHandout = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bHandoutMaster; if ( bHandout ) ePgKind = PageKind::Handout; diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 8392c0e7f5d1..ea8b5dc326c8 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -681,7 +681,7 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt ) if(rKEvt.GetKeyCode().IsMod2()) { OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); - Size aLogicSizeOnePixel = (pOut) ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); + Size aLogicSizeOnePixel = pOut ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); nX *= aLogicSizeOnePixel.Width(); nY *= aLogicSizeOnePixel.Height(); } diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 68d2f165c147..e7e5c1a2cba3 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -396,7 +396,7 @@ bool AnnotationTag::OnMove( const KeyEvent& rKEvt ) if(rKEvt.GetKeyCode().IsMod2()) { OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); - Size aLogicSizeOnePixel = (pOut) ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); + Size aLogicSizeOnePixel = pOut ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); nX *= aLogicSizeOnePixel.Width(); nY *= aLogicSizeOnePixel.Height(); } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 3dbd3503b13a..99dca2efed88 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -455,7 +455,7 @@ OUString ViewShellBase::GetSelectionText(bool bCompleteWords) std::shared_ptr<ViewShell> const pMainShell(GetMainViewShell()); DrawViewShell *const pDrawViewShell( dynamic_cast<DrawViewShell*>(pMainShell.get())); - return (pDrawViewShell) + return pDrawViewShell ? pDrawViewShell->GetSelectionText(bCompleteWords) : SfxViewShell::GetSelectionText(bCompleteWords); } @@ -465,7 +465,7 @@ bool ViewShellBase::HasSelection(bool bText) const std::shared_ptr<ViewShell> const pMainShell(GetMainViewShell()); DrawViewShell *const pDrawViewShell( dynamic_cast<DrawViewShell*>(pMainShell.get())); - return (pDrawViewShell) + return pDrawViewShell ? pDrawViewShell->HasSelection(bText) : SfxViewShell::HasSelection(bText); } diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 93ea92fe6d08..4b83bca30b7a 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1585,7 +1585,7 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, KeywordHdl, IndexTabPage_Impl&, void) if( !bIndex) bIndex = pIPage->HasKeywordIgnoreCase(); // then set index or search page as current. - sal_uInt16 nPageId = ( bIndex ) ? m_pTabCtrl->GetPageId("index") : m_pTabCtrl->GetPageId("find"); + sal_uInt16 nPageId = bIndex ? m_pTabCtrl->GetPageId("index") : m_pTabCtrl->GetPageId("find"); if ( nPageId != m_pTabCtrl->GetCurPageId() ) { m_pTabCtrl->SetCurPageId( nPageId ); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 861a9f1af91d..89048b3d9998 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1433,7 +1433,7 @@ SmNode *SmParser::DoTerm(bool bGroupNumberIdent) bool bIsAttr; while ( (bIsAttr = TokenInGroup(TG::Attribute)) || TokenInGroup(TG::FontAttr)) - aStack.push((bIsAttr) ? DoAttribut() : DoFontAttribut()); + aStack.push(bIsAttr ? DoAttribut() : DoFontAttribut()); SmNode *pFirstNode = DoPower(); while (!aStack.empty()) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index cbad6e420028..a4b64f2ef042 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -181,7 +181,7 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) bInvalid = ( nWidth != *pIt ); ++pIt; } - nWidth = (bInvalid) ? 0.0 : nLine1 + nLine2 + nGap; + nWidth = bInvalid ? 0.0 : nLine1 + nLine2 + nGap; } return nWidth; @@ -583,7 +583,7 @@ sal_Int32 LineListBox::GetEntryPos( SvxBorderLineStyle nStyle ) const SvxBorderLineStyle LineListBox::GetEntryStyle( sal_Int32 nPos ) const { ImpLineListData* pData = (0 <= nPos && static_cast<size_t>(nPos) < pLineList->size()) ? (*pLineList)[ nPos ] : nullptr; - return ( pData ) ? pData->GetStyle() : SvxBorderLineStyle::NONE; + return pData ? pData->GetStyle() : SvxBorderLineStyle::NONE; } void LineListBox::UpdatePaintLineColor() diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 34f71b8b7c33..03670dbbebb8 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1234,7 +1234,7 @@ void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart ) pVD->DrawBitmap( Point(), aBitmap ); InsertEntry( pEntry->GetName(), Image(pVD->GetBitmap( - (bStart) ? Point() : Point(aBmpSize.Width() / 2, 0), + bStart ? Point() : Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())))); } else diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index b99594b3ee33..036b6472a19b 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -1874,7 +1874,7 @@ void DbGridControl::RecalcRows(long nNewTopRow, sal_uInt16 nLinesOnScreen, bool // positioned on the first sentence long nDelta = nNewTopRow - GetTopRow(); // limit for relative positioning - long nLimit = (nCacheSize) ? nCacheSize / 2 : 0; + long nLimit = nCacheSize ? nCacheSize / 2 : 0; // more lines on screen than in cache if (nLimit < nLinesOnScreen) diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 4ffd872cd7f0..083e7692f7cb 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -251,7 +251,7 @@ namespace sdr aRegionBoundRect.Left(), aRegionBoundRect.Top(), aRegionBoundRect.Right(), aRegionBoundRect.Bottom()); - OutputDevice& rTarget = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice(); + OutputDevice& rTarget = pPreRenderDevice ? *pPreRenderDevice : getOutputDevice(); ImpDrawMembers(aRegionRange, rTarget); } } diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index a718970689f4..a2bc553580c7 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -153,7 +153,7 @@ namespace sdr void OverlayManagerBuffered::ImpSaveBackground(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice) { // prepare source - OutputDevice& rSource = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice(); + OutputDevice& rSource = pPreRenderDevice ? *pPreRenderDevice : getOutputDevice(); // Ensure buffer is valid ImpPrepareBufferDevice(); diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index 7d6526bcaf0f..992e240540dd 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -124,7 +124,7 @@ void AreaPropertyPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& rColorItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_COLOR, - SfxCallMode::RECORD, (pStyleItem) + SfxCallMode::RECORD, pStyleItem ? std::initializer_list<SfxPoolItem const*>{ &rColorItem, pStyleItem } : std::initializer_list<SfxPoolItem const*>{ &rColorItem }); } @@ -133,7 +133,7 @@ void AreaPropertyPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem const XFillGradientItem& rGradientItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_GRADIENT, - SfxCallMode::RECORD, (pStyleItem) + SfxCallMode::RECORD, pStyleItem ? std::initializer_list<SfxPoolItem const*>{ &rGradientItem, pStyleItem } : std::initializer_list<SfxPoolItem const*>{ &rGradientItem }); } @@ -142,7 +142,7 @@ void AreaPropertyPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& rHatchItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_HATCH, - SfxCallMode::RECORD, (pStyleItem) + SfxCallMode::RECORD, pStyleItem ? std::initializer_list<SfxPoolItem const*>{ &rHatchItem, pStyleItem } : std::initializer_list<SfxPoolItem const*>{ &rHatchItem }); } @@ -151,7 +151,7 @@ void AreaPropertyPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_BITMAP, - SfxCallMode::RECORD, (pStyleItem) + SfxCallMode::RECORD, pStyleItem ? std::initializer_list<SfxPoolItem const*>{ &rBitmapItem, pStyleItem } : std::initializer_list<SfxPoolItem const*>{ &rBitmapItem }); } diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 1bde1afca7f0..e7447041e23b 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -964,7 +964,7 @@ bool SdrTextFitToSizeTypeItem::GetBoolValue() const { return GetValue() != drawi void SdrTextFitToSizeTypeItem::SetBoolValue(bool bVal) { - SetValue((bVal) ? drawing::TextFitToSizeType_PROPORTIONAL : drawing::TextFitToSizeType_NONE); + SetValue(bVal ? drawing::TextFitToSizeType_PROPORTIONAL : drawing::TextFitToSizeType_NONE); } bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index be0d4d140eec..c373caac480f 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -212,7 +212,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++) { // over all pages - SdrPage* pPage = (bMaPg) ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum); + SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum); const size_t nObjCount(pPage->GetObjCount()); // make sure OrdNums are correct diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx index 55e8c175fb41..faf855bc96a4 100644 --- a/svx/source/svdraw/svdmark.cxx +++ b/svx/source/svdraw/svdmark.cxx @@ -123,16 +123,16 @@ static bool ImpSdrMarkListSorter(SdrMark* const& lhs, SdrMark* const& rhs) { SdrObject* pObj1 = lhs->GetMarkedSdrObj(); SdrObject* pObj2 = rhs->GetMarkedSdrObj(); - SdrObjList* pOL1 = (pObj1) ? pObj1->GetObjList() : nullptr; - SdrObjList* pOL2 = (pObj2) ? pObj2->GetObjList() : nullptr; + SdrObjList* pOL1 = pObj1 ? pObj1->GetObjList() : nullptr; + SdrObjList* pOL2 = pObj2 ? pObj2->GetObjList() : nullptr; if (pOL1 == pOL2) { // AF: Note that I reverted a change from sal_uInt32 to sal_uLong (made // for 64bit compliance, #i78198#) because internally in SdrObject // both nOrdNum and mnNavigationPosition are stored as sal_uInt32. - sal_uInt32 nObjOrd1((pObj1) ? pObj1->GetNavigationPosition() : 0); - sal_uInt32 nObjOrd2((pObj2) ? pObj2->GetNavigationPosition() : 0); + sal_uInt32 nObjOrd1(pObj1 ? pObj1->GetNavigationPosition() : 0); + sal_uInt32 nObjOrd2(pObj2 ? pObj2->GetNavigationPosition() : 0); return nObjOrd1 < nObjOrd2; } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 3d71630005d0..23e5cfdf8822 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1552,7 +1552,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) size_t nSearchBeg = 0; E3dScene* pScene = nullptr; - SdrObject* pObjHit = (bPrev) ? pBtmObjHit : pTopObjHit; + SdrObject* pObjHit = bPrev ? pBtmObjHit : pTopObjHit; bool bRemap = dynamic_cast< const E3dCompoundObject* >(pObjHit) != nullptr && static_cast<E3dCompoundObject*>(pObjHit)->IsAOrdNumRemapCandidate(pScene); diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index f121952d8992..a03b6f53963c 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1176,7 +1176,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) mbPageBorderOnlyLeftRight(false) { aPrefVisiLayers.SetAll(); - eListKind = (bMasterPage) ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage; + eListKind = bMasterPage ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage; mpSdrPageProperties.reset(new SdrPageProperties(*this)); } diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index 0ea5fc21ee64..f6b9bd6d7845 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -164,7 +164,7 @@ void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmoot if(!b1stSegm && !bSegmFuz) { - eMarkedSegmentsKind = (bCurve) ? SdrPathSegmentKind::Curve : SdrPathSegmentKind::Line; + eMarkedSegmentsKind = bCurve ? SdrPathSegmentKind::Curve : SdrPathSegmentKind::Line; } } diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx index 3c0ab9badb08..6ef07497b40b 100644 --- a/svx/source/svdraw/svdviter.cxx +++ b/svx/source/svdraw/svdviter.cxx @@ -38,7 +38,7 @@ void SdrViewIter::ImpInitVars() SdrViewIter::SdrViewIter(const SdrPage* pPage) { mpPage = pPage; - mpModel = (pPage) ? pPage->GetModel() : nullptr; + mpModel = pPage ? pPage->GetModel() : nullptr; mpObject = nullptr; mbNoMasterPage = false; ImpInitVars(); @@ -48,8 +48,8 @@ SdrViewIter::SdrViewIter(const SdrPage* pPage) SdrViewIter::SdrViewIter(const SdrObject* pObject) { mpObject = pObject; - mpModel = (pObject) ? pObject->GetModel() : nullptr; - mpPage = (pObject) ? pObject->GetPage() : nullptr; + mpModel = pObject ? pObject->GetModel() : nullptr; + mpPage = pObject ? pObject->GetPage() : nullptr; mbNoMasterPage = false; if(!mpModel || !mpPage) diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index f763b7869825..661ce1700f76 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -787,7 +787,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) // #i122676# Change FillStyle and Gradinet in one call SfxViewFrame::Current()->GetDispatcher()->ExecuteList( SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD, - (bFillStyleChange) + bFillStyleChange ? std::initializer_list<SfxPoolItem const*>{ &aXFillGradientItem, &aXFillStyleItem } : std::initializer_list<SfxPoolItem const*>{ &aXFillGradientItem }); } @@ -820,7 +820,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) // #i122676# Change FillStyle and Hatch in one call SfxViewFrame::Current()->GetDispatcher()->ExecuteList( SID_ATTR_FILL_HATCH, SfxCallMode::RECORD, - (bFillStyleChange) + bFillStyleChange ? std::initializer_list<SfxPoolItem const*>{ &aXFillHatchItem, &aXFillStyleItem } : std::initializer_list<SfxPoolItem const*>{ &aXFillHatchItem }); } @@ -853,7 +853,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) // #i122676# Change FillStyle and Bitmap in one call SfxViewFrame::Current()->GetDispatcher()->ExecuteList( SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD, - (bFillStyleChange) + bFillStyleChange ? std::initializer_list<SfxPoolItem const*>{ &aXFillBitmapItem, &aXFillStyleItem } : std::initializer_list<SfxPoolItem const*>{ &aXFillBitmapItem }); } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 3d1328a44a2e..f5eb6a14c375 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2813,7 +2813,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl if(pPageObj) { SdrPage* pPage = pPageObj->GetReferencedPage(); - sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L; + sal_Int32 nPageNumber = pPage ? pPage->GetPageNum() : 0L; nPageNumber++; nPageNumber >>= 1; rValue <<= nPageNumber; 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) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 0e3bd3951837..f0a3cd605588 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -687,7 +687,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) bool const isEnter(pMouseEvt->IsEnterWindow()); Callback aCallback = [ this, isEnter, aEvent ]() { MouseListenerMultiplexer& rMouseListeners = this->mpImpl->getMouseListeners(); - (isEnter) + isEnter ? rMouseListeners.mouseEntered(aEvent) : rMouseListeners.mouseExited(aEvent); }; diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 85cfdcc4e8a2..cd5dda474c22 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -942,7 +942,7 @@ namespace DOM if (nullptr == m_aNodePtr) { return nullptr; } - xmlDocPtr const pClone(xmlCopyDoc(m_aDocPtr, (bDeep) ? 1 : 0)); + xmlDocPtr const pClone(xmlCopyDoc(m_aDocPtr, bDeep ? 1 : 0)); if (nullptr == pClone) { return nullptr; } Reference< XNode > const xRet( static_cast<CNode*>(CDocument::CreateCDocument(pClone).get())); diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx index 7634a6e07d92..01cf55720b78 100644 --- a/unoxml/source/dom/elementlist.cxx +++ b/unoxml/source/dom/elementlist.cxx @@ -82,7 +82,7 @@ namespace DOM : m_pElement(pElement) , m_rMutex(rMutex) , m_pName(lcl_initXmlString(rName)) - , m_pURI((pURI) ? lcl_initXmlString(*pURI) : nullptr) + , m_pURI(pURI ? lcl_initXmlString(*pURI) : nullptr) , m_bRebuild(true) { } diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index 7a32acb59b45..1508ea80a23f 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -393,7 +393,7 @@ namespace DOM return nullptr; } ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode( - xmlCopyNode(m_aNodePtr, (bDeep) ? 1 : 0)); + xmlCopyNode(m_aNodePtr, bDeep ? 1 : 0)); if (!pNode.is()) { return nullptr; } pNode->m_bUnlinked = true; // not linked yet return pNode.get(); diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx index 51572eea5e99..27a394940233 100644 --- a/unoxml/source/events/eventdispatcher.cxx +++ b/unoxml/source/events/eventdispatcher.cxx @@ -36,7 +36,7 @@ namespace DOM { namespace events { void CEventDispatcher::addListener(xmlNodePtr pNode, const OUString& aType, const Reference<XEventListener>& aListener, bool bCapture) { - TypeListenerMap *const pTMap = (bCapture) + TypeListenerMap *const pTMap = bCapture ? (& m_CaptureListeners) : (& m_TargetListeners); // get the multimap for the specified type @@ -55,7 +55,7 @@ namespace DOM { namespace events { void CEventDispatcher::removeListener(xmlNodePtr pNode, const OUString& aType, const Reference<XEventListener>& aListener, bool bCapture) { - TypeListenerMap *const pTMap = (bCapture) + TypeListenerMap *const pTMap = bCapture ? (& m_CaptureListeners) : (& m_TargetListeners); // get the multimap for the specified type diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index fd8c2a1bb480..b94acb97f6dc 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -585,8 +585,8 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) ImplTabItem* pOldItem = ImplGetItem( nOldId ); ImplTabItem* pItem = ImplGetItem( nId ); - TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage.get() : nullptr; - TabPage* pPage = (pItem) ? pItem->mpTabPage.get() : nullptr; + TabPage* pOldPage = pOldItem ? pOldItem->mpTabPage.get() : nullptr; + TabPage* pPage = pItem ? pItem->mpTabPage.get() : nullptr; vcl::Window* pCtrlParent = GetParent(); if ( IsReallyVisible() && IsUpdateMode() ) diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index f13f62b39ff2..51b23dcb4a2d 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -1243,9 +1243,9 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo } // job has been spooled - i_rController.setJobState( (bAborted) + i_rController.setJobState( bAborted ? view::PrintableState_JOB_ABORTED - : ((bSuccess) ? view::PrintableState_JOB_SPOOLED + : (bSuccess ? view::PrintableState_JOB_SPOOLED : view::PrintableState_JOB_SPOOLING_FAILED)); // clean up the temporary PDF files diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 697dc84cad4a..3041578f0cf9 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -153,10 +153,10 @@ void XMLGraphicsDefaultStyle::SetDefaults() XMLPropertyByIndex(nStrokeIndex))) { sal_Int32 const nStroke( - (bIsAOO4) ? RGB_COLORDATA(128, 128, 128) : COL_BLACK); + bIsAOO4 ? RGB_COLORDATA(128, 128, 128) : COL_BLACK); xDefaults->setPropertyValue("LineColor", makeAny(nStroke)); } - sal_Int32 const nFillColor( (bIsAOO4) + sal_Int32 const nFillColor( bIsAOO4 ? RGB_COLORDATA(0xCF, 0xE7, 0xF5) : RGB_COLORDATA(153, 204, 255)); sal_Int32 const nFillIndex( pImpPrMap->GetEntryIndex(XML_NAMESPACE_DRAW, "fill-color", 0)); diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 86370e8a118b..53a8727fc87a 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -388,7 +388,7 @@ SdXMLExport::SdXMLExport( OUString const & implementationName, bool bIsDraw, SvXMLExportFlags nExportFlags ) : SvXMLExport( util::MeasureUnit::CM, xContext, implementationName, - (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), + bIsDraw ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), mnDocMasterPageCount(0), mnDocDrawPageCount(0), mnObjectCount(0), diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index fe75012bd407..7ff3bec70784 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1527,7 +1527,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( { sStyleName = rImport.GetStyleDisplayName( nFamily, sStyleName ); const OUString rPropName = bPara ? OUString("ParaStyleName") : OUString("CharStyleName"); - const Reference < XNameContainer > & rStyles = (bPara) + const Reference < XNameContainer > & rStyles = bPara ? m_xImpl->m_xParaStyles : m_xImpl->m_xTextStyles; if( rStyles.is() && |