Kaydet (Commit) 72ef2b5d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/45088Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst b140f925
......@@ -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 );
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
......
......@@ -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]}}
......
......@@ -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());
......
......@@ -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 );
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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
......
......@@ -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] );
......
......@@ -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);
......
......@@ -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));
......
......@@ -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 );
......
......@@ -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
{
......
......@@ -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 )
......
......@@ -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':
......
......@@ -1906,7 +1906,7 @@ public:
{
return static_cast< RC >(osl_createDirectoryPath(
aDirectoryUrl.pData,
(aDirectoryCreationObserver) ? onDirectoryCreated : NULL,
aDirectoryCreationObserver ? onDirectoryCreated : NULL,
aDirectoryCreationObserver));
}
};
......
......@@ -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
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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 */
{
......
......@@ -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 << "'");
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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;
......
......@@ -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() )
......
......@@ -111,7 +111,7 @@ InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const
ScDeleteContentsDlg::bPreviousAllCheck = aBtnDelAll->IsChecked();
return ( (ScDeleteContentsDlg::bPreviousAllCheck)
return ( ScDeleteContentsDlg::bPreviousAllCheck
? InsertDeleteFlags::ALL
: ScDeleteContentsDlg::nPreviousChecks );
}
......
......@@ -147,7 +147,7 @@ InsertDeleteFlags ScInsertContentsDlg::GetInsContentsCmdBits() const
if (bUsedShortCut)
return nShortCutInsContentsCmdBits;
return ( (ScInsertContentsDlg::bPreviousAllCheck)
return ( ScInsertContentsDlg::bPreviousAllCheck
? InsertDeleteFlags::ALL
: ScInsertContentsDlg::nPreviousChecks );
}
......
......@@ -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)
......
......@@ -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 :
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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();
}
......
......@@ -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);
}
......
......@@ -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 );
......
......@@ -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())
......