diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-19 13:10:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-19 14:38:35 +0200 |
commit | 8fced917aa1af58216cbde56720f2f473eed86d9 (patch) | |
tree | 755d0dfba1fe4a5c34860d0d1ea4c6ce01525405 | |
parent | f0110f798cee31ff87651dc2377eacef2ab8a8b7 (diff) |
clang-tidy readability-simplify-boolean-expr in accessibility..cui
Change-Id: Iae27da322c6ede592e6b268fb2210d3525ed22cc
Reviewed-on: https://gerrit.libreoffice.org/36677
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
21 files changed, 36 insertions, 138 deletions
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 287279acde7d..d74d2edc663c 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -73,10 +73,7 @@ namespace { inline bool hasFloatingChild(vcl::Window *pWindow) { vcl::Window * pChild = pWindow->GetAccessibleChildWindow(0); - if( pChild && WindowType::FLOATINGWINDOW == pChild->GetType() ) - return true; - - return false; + return pChild && WindowType::FLOATINGWINDOW == pChild->GetType(); } // IAccessibleFactory diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index e84824d23de6..3ddf0c643ab9 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -156,9 +156,7 @@ namespace basctl Reference< XEmbeddedScripts > xScripts( _rDocument.xModel, UNO_QUERY ); if ( !xScripts.is() ) return false; - if ( !m_bFilterInvisible || impl_isDocumentVisible_nothrow( _rDocument ) ) - return true; - return false; + return !m_bFilterInvisible || impl_isDocumentVisible_nothrow( _rDocument ); } void lcl_getAllModels_throw( docs::Documents& _out_rModels, bool _bVisibleOnly ) diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index ca4aa090625f..72fabc476327 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -395,12 +395,7 @@ namespace basegfx // test if vectors are used bool B2DCubicBezier::isBezier() const { - if(maControlPointA != maStartPoint || maControlPointB != maEndPoint) - { - return true; - } - - return false; + return maControlPointA != maStartPoint || maControlPointB != maEndPoint; } void B2DCubicBezier::testAndSolveTrivialBezier() diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 8253c24f6226..9a2667a553a8 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1418,14 +1418,7 @@ namespace basegfx const B2DVector aDelta(rTestPosition - aCutPoint); const double fDistanceSquare(aDelta.scalar(aDelta)); - if(fDistanceSquare <= fDistance * fDistance) - { - return true; - } - else - { - return false; - } + return fDistanceSquare <= fDistance * fDistance; } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 3316b1a2be53..50b435c7c80a 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1688,9 +1688,7 @@ bool SbModule::ExceedsLegacyModuleSize() { if ( !IsCompiled() ) Compile(); - if ( pImage && pImage->ExceedsLegacyLimits() ) - return true; - return false; + return pImage && pImage->ExceedsLegacyLimits(); } class ErrorHdlResetter diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 6acfc912845f..ff8f8292c085 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -126,9 +126,7 @@ bool ChartTypeDialogController::isSubType( const OUString& rServiceName ) { const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap(); tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName )); - if( aIt != rTemplateMap.end()) - return true; - return false; + return aIt != rTemplateMap.end(); } ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService( const OUString& rServiceName diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 2b049ab616b1..53b7594e412a 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -576,14 +576,9 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) bool ChartController::isShapeContext() const { - if ( m_aSelection.isAdditionalShapeSelected() || + return m_aSelection.isAdditionalShapeSelected() || ( m_pDrawViewWrapper && m_pDrawViewWrapper->AreObjectsMarked() && - ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ) ) - { - return true; - } - - return false; + ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ); } void ChartController::impl_ClearSelection() diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx index 7e4b17fdd45f..b5171cb3d67b 100644 --- a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx +++ b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx @@ -46,11 +46,7 @@ void FeatureCommandDispatchBase::initialize() bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL ) { SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL ); - if ( aIter != m_aSupportedFeatures.end() ) - { - return true; - } - return false; + return aIter != m_aSupportedFeatures.end(); } void FeatureCommandDispatchBase::fireStatusEvent( const OUString& rURL, diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 4e6375cdd26b..b76a7bfa08ac 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -375,9 +375,7 @@ bool SelectionHelper::isDragableObjectHitTwice( const Point& rMPos return false; SolarMutexGuard aSolarGuard; SdrObject* pObj = rDrawViewWrapper.getNamedSdrObject( rNameOfSelectedObject ); - if( !DrawViewWrapper::IsObjectHit( pObj, rMPos ) ) - return false; - return true; + return DrawViewWrapper::IsObjectHit( pObj, rMPos ); } OUString SelectionHelper::getHitObjectCID( @@ -452,9 +450,7 @@ bool SelectionHelper::isRotateableObject( const OUString& rCID sal_Int32 nDimensionCount = DiagramHelper::getDimension( ChartModelHelper::findDiagram( xChartModel ) ); - if( nDimensionCount == 3 ) - return true; - return false; + return nDimensionCount == 3; } SelectionHelper::SelectionHelper( SdrObject* pSelectedObj ) diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 5837ea28f872..849612de0e54 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -694,9 +694,7 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque return true; } } - if( xDataSequence->getData().getLength() ) - return true; - return false; + return xDataSequence->getData().getLength(); } } diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 0aa654587b94..604d0be5eb77 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -279,12 +279,8 @@ ObjectIdentifier::ObjectIdentifier( const ObjectIdentifier& rOID ) bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const { - if ( areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) && - ( m_xAdditionalShape == rOID.m_xAdditionalShape ) ) - { - return true; - } - return false; + return areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) && + ( m_xAdditionalShape == rOID.m_xAdditionalShape ); } bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const @@ -766,10 +762,7 @@ bool ObjectIdentifier::parsePieSegmentDragParameterString( aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); rMaximumPosition.Y = aValueString.toInt32(); - if( nCharacterIndex < 0 ) - return false; - - return true; + return nCharacterIndex >= 0; } OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID ) diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 10c6edf7e35f..802f86296bb2 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -262,11 +262,9 @@ bool RegressionCurveHelper::isMeanValueLine( const uno::Reference< chart2::XRegressionCurve > & xRegCurve ) { uno::Reference< XServiceName > xServName( xRegCurve, uno::UNO_QUERY ); - if( xServName.is() && + return xServName.is() && xServName->getServiceName() == - "com.sun.star.chart2.MeanValueRegressionCurve" ) - return true; - return false; + "com.sun.star.chart2.MeanValueRegressionCurve"; } uno::Reference< chart2::XRegressionCurve > diff --git a/chart2/source/view/axes/DateHelper.cxx b/chart2/source/view/axes/DateHelper.cxx index 42a77cd045ec..9779ef0a2c4c 100644 --- a/chart2/source/view/axes/DateHelper.cxx +++ b/chart2/source/view/axes/DateHelper.cxx @@ -56,9 +56,7 @@ bool DateHelper::IsLessThanOneMonthAway( const Date& rD1, const Date& rD2 ) Date aDMin( DateHelper::GetDateSomeMonthsAway( rD1, -1 ) ); Date aDMax( DateHelper::GetDateSomeMonthsAway( rD1, 1 ) ); - if( rD2 > aDMin && rD2 < aDMax ) - return true; - return false; + return rD2 > aDMin && rD2 < aDMax; } bool DateHelper::IsLessThanOneYearAway( const Date& rD1, const Date& rD2 ) @@ -66,9 +64,7 @@ bool DateHelper::IsLessThanOneYearAway( const Date& rD1, const Date& rD2 ) Date aDMin( DateHelper::GetDateSomeYearsAway( rD1, -1 ) ); Date aDMax( DateHelper::GetDateSomeYearsAway( rD1, 1 ) ); - if( rD2 > aDMin && rD2 < aDMax ) - return true; - return false; + return rD2 > aDMin && rD2 < aDMax; } double DateHelper::RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution ) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 0d98ead38381..be0cc9bc7e9f 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1502,9 +1502,7 @@ namespace // default implementation: true for Y axes, and for value X axis if( nDimensionIndex == 0 ) return !bCategoryXAxis; - if( nDimensionIndex == 1 ) - return true; - return false; + return nDimensionIndex == 1; } } @@ -2103,9 +2101,7 @@ bool VSeriesPlotter::WantToPlotInFrontOfAxisLine() bool VSeriesPlotter::shouldSnapRectToUsedArea() { - if( m_nDimension == 3 ) - return false; - return true; + return m_nDimension != 3; } std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 7e5c2dbc7ff9..da131acafdd4 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -137,12 +137,7 @@ namespace aArray[2] = sal_uInt8((nSource & 0x0000ff00) >> 8); aArray[3] = sal_uInt8(nSource & 0x000000ff); - if (osl_File_E_None == osl_writeFile(rHandle, static_cast<const void*>(aArray), 4, &nBaseWritten) && 4 == nBaseWritten) - { - return true; - } - - return false; + return osl_File_E_None == osl_writeFile(rHandle, static_cast<const void*>(aArray), 4, &nBaseWritten) && 4 == nBaseWritten; } bool read_OString(FileSharedPtr& rFile, OString& rTarget) @@ -178,12 +173,7 @@ namespace sal_uInt64 nBaseWritten(0); - if (osl_File_E_None == osl_writeFile(rHandle, static_cast<const void*>(rSource.getStr()), nLength, &nBaseWritten) && nLength == nBaseWritten) - { - return true; - } - - return false; + return osl_File_E_None == osl_writeFile(rHandle, static_cast<const void*>(rSource.getStr()), nLength, &nBaseWritten) && nLength == nBaseWritten; } OUString createFileURL(const OUString& rURL, const OUString& rName, const OUString& rExt) @@ -535,12 +525,7 @@ namespace // write mbEnabled nState = static_cast< sal_uInt32 >(mbEnabled); - if (!write_sal_uInt32(rHandle, nState)) - { - return false; - } - - return true; + return write_sal_uInt32(rHandle, nState); } const OString& getName() const diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index 4e1471186d6e..84e705f8b287 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -118,13 +118,10 @@ namespace comphelper bool NamedValueCollection::canExtractFrom( css::uno::Any const & i_value ) { Type const & aValueType = i_value.getValueType(); - if ( aValueType.equals( ::cppu::UnoType< PropertyValue >::get() ) + return aValueType.equals( ::cppu::UnoType< PropertyValue >::get() ) || aValueType.equals( ::cppu::UnoType< NamedValue >::get() ) || aValueType.equals( ::cppu::UnoType< Sequence< PropertyValue > >::get() ) - || aValueType.equals( ::cppu::UnoType< Sequence< NamedValue > >::get() ) - ) - return true; - return false; + || aValueType.equals( ::cppu::UnoType< Sequence< NamedValue > >::get() ); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index c8410db79857..6ac6fbbe8bf8 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -401,11 +401,7 @@ void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry ) bool SvxConfigPage::CanConfig( const OUString& aModuleId ) { - if ( aModuleId == "com.sun.star.script.BasicIDE" || aModuleId == "com.sun.star.frame.Bibliography" ) - { - return false; - } - return true; + return !(aModuleId == "com.sun.star.script.BasicIDE" || aModuleId == "com.sun.star.frame.Bibliography"); } OUString GetModuleName( const OUString& aModuleId ) @@ -3095,29 +3091,17 @@ SvxConfigEntry::~SvxConfigEntry() bool SvxConfigEntry::IsMovable() { - if ( IsPopup() && !IsMain() ) - { - return false; - } - return true; + return !IsPopup() || IsMain(); } bool SvxConfigEntry::IsDeletable() { - if ( IsMain() && !IsUserDefined() ) - { - return false; - } - return true; + return !IsMain() || IsUserDefined(); } bool SvxConfigEntry::IsRenamable() { - if ( IsMain() && !IsUserDefined() ) - { - return false; - } - return true; + return !IsMain() || IsUserDefined(); } SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) @@ -4067,10 +4051,7 @@ ToolbarSaveInData::HasURL( const OUString& rURL ) if ( pEntry->GetCommand().equals( rURL ) ) { - if ( pEntry->IsParentData() ) - return false; - else - return true; + return !pEntry->IsParentData(); } ++iter; @@ -4081,11 +4062,7 @@ ToolbarSaveInData::HasURL( const OUString& rURL ) bool ToolbarSaveInData::HasSettings() { // return true if there is at least one toolbar entry - if ( GetEntries()->size() > 0 ) - { - return true; - } - return false; + return GetEntries()->size() > 0; } void ToolbarSaveInData::Reset() diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 0579880c3bba..8e47238ca3ee 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -119,10 +119,7 @@ bool SfxStylesInfo_Impl::parseStyleCommand(SfxStyleInfo_Impl& aStyle) else if (sArg.startsWith(CMDURL_FPART_ONLY)) aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART); - if (!(aStyle.sFamily.isEmpty() || aStyle.sStyle.isEmpty())) - return true; - - return false; + return !(aStyle.sFamily.isEmpty() || aStyle.sStyle.isEmpty()); } void SfxStylesInfo_Impl::getLabel4Style(SfxStyleInfo_Impl& aStyle) diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 948cc2529606..a8541b98f1d5 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -567,7 +567,7 @@ IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, SvTreeListBox*, pBox, void) // entries in the list box should exactly correspond to those from the // dictionary. Thus: pNewReplacePB->Enable(false); - pDeletePB->Enable( true && !IsDicReadonly_Impl() ); + pDeletePB->Enable( !IsDicReadonly_Impl() ); } }; diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 7fa466f10ae8..13087f5e352a 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -585,9 +585,7 @@ static bool parsePersonaInfo( const OString &rBuffer, OUString *pHeaderURL, OUSt return false; *pName = searchValue( rBuffer, persona, ""name":"" ); - if ( pName->isEmpty() ) - return false; - return true; + return !pName->isEmpty(); } SearchAndParseThread::SearchAndParseThread( SelectPersonaDialog* pDialog, diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index d28fdbff8267..73be739ebdfc 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -959,10 +959,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa case CAT_SCIENTIFIC: // bThousand is for Engineering notation { sal_uInt16 nIntDigits = pNumFmtShell->GetFormatIntegerDigits(theFormat); - if ( (nIntDigits > 0) && (nIntDigits % 3 == 0) ) - bThousand = true; - else - bThousand = false; + bThousand = (nIntDigits > 0) && (nIntDigits % 3 == 0); m_pBtnEngineering->Enable(); m_pBtnEngineering->Check( bThousand ); } |