chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx | 8 +++--- chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx | 8 +++--- chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx | 4 +-- chart2/source/controller/dialogs/ChartTypeDialogController.cxx | 2 - chart2/source/controller/dialogs/DataBrowserModel.cxx | 6 ++--- chart2/source/controller/main/ChartDropTargetHelper.cxx | 2 - chart2/source/controller/main/ControllerCommandDispatch.cxx | 2 - chart2/source/controller/main/ElementSelector.cxx | 2 - chart2/source/controller/main/ObjectHierarchy.cxx | 12 +++++----- chart2/source/model/main/ChartModel_Persistence.cxx | 4 +-- chart2/source/model/main/Diagram.cxx | 6 ++--- chart2/source/model/template/ChartTypeTemplate.cxx | 4 +-- chart2/source/model/template/PieChartTypeTemplate.cxx | 2 - chart2/source/tools/ExplicitCategoriesProvider.cxx | 6 ++--- chart2/source/tools/InternalDataProvider.cxx | 2 - chart2/source/tools/ThreeDHelper.cxx | 2 - chart2/source/tools/WrappedPropertySet.cxx | 12 +++------- chart2/source/view/charttypes/VSeriesPlotter.cxx | 12 +++++----- chart2/source/view/main/SeriesPlotterContainer.cxx | 4 +-- chart2/source/view/main/VLegend.cxx | 4 +-- cui/source/dialogs/cuihyperdlg.cxx | 2 - cui/source/dialogs/screenshotannotationdlg.cxx | 2 - cui/source/options/optdict.cxx | 7 ++--- cui/source/options/optgdlg.cxx | 4 +-- cui/source/options/optpath.cxx | 2 - cui/source/tabpages/border.cxx | 2 - cui/source/tabpages/numfmt.cxx | 2 - cui/source/tabpages/numpages.cxx | 2 - cui/source/tabpages/tparea.cxx | 4 +-- cui/source/tabpages/tpbitmap.cxx | 4 +-- cui/source/tabpages/tpcolor.cxx | 2 - cui/source/tabpages/tphatch.cxx | 8 +++--- cui/source/tabpages/tppattern.cxx | 2 - 33 files changed, 71 insertions(+), 76 deletions(-)
New commits: commit 950cd20f5f210b06ed1cc34a858535f51acfe68a Author: Noel Grandin <[email protected]> AuthorDate: Fri Nov 8 12:34:04 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Nov 11 10:10:51 2024 +0100 clang-tidy: performance-unnecessary-copy-initialization in chart2 Change-Id: I6f84cfea6390d6a263e5e43ec5a638260c10c00d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176374 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index 8c25b54d92bc..fa34ef63a825 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -200,7 +200,7 @@ void SAL_CALL MinMaxLineWrapper::setPropertyValues( const uno::Sequence< OUStrin sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<nMinCount; nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); try { setPropertyValue( aPropertyName, rValueSeq[nN] ); @@ -221,7 +221,7 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const u auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyValue( aPropertyName ); } } @@ -268,7 +268,7 @@ uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertySta auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyState( aPropertyName ); } } @@ -319,7 +319,7 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyDefault( aPropertyName ); } } diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index f8645b46647a..92128857b891 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -171,7 +171,7 @@ void SAL_CALL UpDownBarWrapper::setPropertyValues( const uno::Sequence< OUString sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<nMinCount; nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); try { setPropertyValue( aPropertyName, rValueSeq[nN] ); @@ -192,7 +192,7 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const un auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyValue( aPropertyName ); } } @@ -231,7 +231,7 @@ uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStat auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyState( aPropertyName ); } } @@ -283,7 +283,7 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); + const OUString& aPropertyName( rNameSeq[nN] ); pRetSeq[nN] = getPropertyDefault( aPropertyName ); } } diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx index 1acc5b3749d2..c17f6c50c263 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx @@ -728,7 +728,7 @@ void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< be if( xDataSource.is() && xDataProvider.is()) { OUString aTmp( aNewValue ); - OUString aXMLRange( aNewValue ); + const OUString& aXMLRange( aNewValue ); lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact ); StatisticsHelper::setErrorDataSequence( xDataSource, xDataProvider, aTmp, true /* positive */, true /* y-error */, &aXMLRange ); @@ -792,7 +792,7 @@ void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< be if( xDataSource.is() && xDataProvider.is()) { OUString aTmp( aNewValue ); - OUString aXMLRange( aNewValue ); + const OUString& aXMLRange( aNewValue ); lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact ); StatisticsHelper::setErrorDataSequence( xDataSource, xDataProvider, aTmp, false /* positive */, true /* y-error */, &aXMLRange ); diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index dd5f67ed99cb..308ff1930457 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -778,7 +778,7 @@ void OfPieChartDialogController::fillExtraControls( const std::vector< rtl::Reference< DataSeries > > dataSeriesVec = ChartModelHelper::getDataSeries( xChartModel); if (!dataSeriesVec.empty()) { - const rtl::Reference<DataSeries> ds = dataSeriesVec[0]; + const rtl::Reference<DataSeries>& ds = dataSeriesVec[0]; const DataSeries::tDataSequenceContainer data = ds->getDataSequences2(); const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aValuesSeries( DataSeriesHelper::getAllDataSequencesByRole( data , u"values"_ustr ) ); diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 1f04f29ae69f..dd333023a64c 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -768,7 +768,7 @@ void DataBrowserModel::updateFromModel() sal_Int32 nLevelCount = rSplitCategoriesList.size(); for( sal_Int32 nL = 0; nL<nLevelCount; nL++ ) { - Reference< chart2::data::XLabeledDataSequence > xCategories( rSplitCategoriesList[nL] ); + const Reference< chart2::data::XLabeledDataSequence >& xCategories( rSplitCategoriesList[nL] ); if( !xCategories.is() ) continue; @@ -794,7 +794,7 @@ void DataBrowserModel::updateFromModel() for( auto const & CT: aChartTypes ) { - rtl::Reference< ChartType > xSeriesCnt( CT ); + const rtl::Reference< ChartType >& xSeriesCnt( CT ); OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( CT ); const std::vector< rtl::Reference< DataSeries > > & aSeries( xSeriesCnt->getDataSeries2()); @@ -815,7 +815,7 @@ void DataBrowserModel::updateFromModel() for( rtl::Reference< DataSeries > const & dataSeries : aSeries ) { tDataColumnVector::size_type nStartColIndex = m_aColumns.size(); - rtl::Reference< DataSeries > xSeries( dataSeries ); + const rtl::Reference< DataSeries >& xSeries( dataSeries ); if( xSeries.is()) { const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aLSeqs( xSeries->getDataSequences2()); diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx index fc6762598a68..f03596e96475 100644 --- a/chart2/source/controller/main/ChartDropTargetHelper.cxx +++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx @@ -110,7 +110,7 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes )); if( aStrings.size() >= 3 && aStrings[0] == "soffice" ) { - OUString aRangeString( aStrings[2] ); + const OUString& aRangeString( aStrings[2] ); if( m_xChartDocument.is()) { Reference< frame::XModel > xParentModel( m_xChartDocument->getParent(), uno::UNO_QUERY ); diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 2aa350e48aa3..c732fae2c49a 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -182,7 +182,7 @@ void ControllerState::update( uno::Any aSelObj( xSelectionSupplier->getSelection() ); ObjectIdentifier aSelOID( aSelObj ); - OUString aSelObjCID( aSelOID.getObjectCID() ); + const OUString& aSelObjCID( aSelOID.getObjectCID() ); bHasSelectedObject = aSelOID.isValid(); diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index f342b3538aad..ee49f261299a 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -107,7 +107,7 @@ void SelectorListBox::UpdateChartElementsListAndSelection() if( xChartController.is() ) { ObjectIdentifier aSelectedOID( xChartController->getSelection() ); - OUString aSelectedCID = aSelectedOID.getObjectCID(); + const OUString& aSelectedCID = aSelectedOID.getObjectCID(); rtl::Reference<::chart::ChartModel> xChartDoc = xChartController->getChartModel(); ObjectType eType( aSelectedOID.getObjectType() ); diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index 1c46cfba5eb7..e5603394b5af 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -325,7 +325,7 @@ void ObjectHierarchy::createDataSeriesTree( std::vector< rtl::Reference< ChartType > > aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2()); for( std::size_t nCTIdx=0; nCTIdx<aChartTypeSeq.size(); ++nCTIdx ) { - rtl::Reference< ChartType > xChartType( aChartTypeSeq[nCTIdx] ); + const rtl::Reference< ChartType >& xChartType( aChartTypeSeq[nCTIdx] ); std::vector< rtl::Reference< DataSeries > > aSeriesSeq( xChartType->getDataSeries2() ); const sal_Int32 nNumberOfSeries = ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.size()); @@ -616,7 +616,7 @@ void ObjectKeyNavigation::setCurrentSelection( const ObjectIdentifier& rOID ) bool ObjectKeyNavigation::first() { ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider ); - ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) ); + const ObjectHierarchy::tChildContainer& aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) ); bool bResult = !aSiblings.empty(); if( bResult ) setCurrentSelection( aSiblings.front()); @@ -628,7 +628,7 @@ bool ObjectKeyNavigation::first() bool ObjectKeyNavigation::last() { ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider ); - ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) ); + const ObjectHierarchy::tChildContainer& aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) ); bool bResult = !aSiblings.empty(); if( bResult ) setCurrentSelection( aSiblings.back()); @@ -692,7 +692,7 @@ bool ObjectKeyNavigation::down() bool bResult = aHierarchy.hasChildren( getCurrentSelection()); if( bResult ) { - ObjectHierarchy::tChildContainer aChildren = aHierarchy.getChildren( getCurrentSelection()); + const ObjectHierarchy::tChildContainer& aChildren = aHierarchy.getChildren( getCurrentSelection()); OSL_ASSERT( !aChildren.empty()); setCurrentSelection( aChildren.front()); } @@ -702,7 +702,7 @@ bool ObjectKeyNavigation::down() bool ObjectKeyNavigation::veryFirst() { ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider ); - ObjectHierarchy::tChildContainer aChildren( aHierarchy.getTopLevelChildren()); + const ObjectHierarchy::tChildContainer& aChildren( aHierarchy.getTopLevelChildren()); bool bResult = !aChildren.empty(); if( bResult ) setCurrentSelection( aChildren.front()); @@ -712,7 +712,7 @@ bool ObjectKeyNavigation::veryFirst() bool ObjectKeyNavigation::veryLast() { ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider ); - ObjectHierarchy::tChildContainer aChildren( aHierarchy.getTopLevelChildren()); + const ObjectHierarchy::tChildContainer& aChildren( aHierarchy.getTopLevelChildren()); bool bResult = !aChildren.empty(); if( bResult ) setCurrentSelection( aChildren.back()); diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index 025a937e8400..fe5db160cf32 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -250,7 +250,7 @@ void SAL_CALL ChartModel::storeAsURL( return; //behave passive if already disposed or closed or throw exception @todo? apphelper::MediaDescriptorHelper aMediaDescriptorHelper(rMediaDescriptor); - uno::Sequence< beans::PropertyValue > aReducedMediaDescriptor( + const uno::Sequence< beans::PropertyValue >& aReducedMediaDescriptor( aMediaDescriptorHelper.getReducedForModel() ); m_bReadOnly = false; @@ -278,7 +278,7 @@ void SAL_CALL ChartModel::storeToURL( aGuard.clear(); apphelper::MediaDescriptorHelper aMediaDescriptorHelper(rMediaDescriptor); - uno::Sequence< beans::PropertyValue > aReducedMediaDescriptor( + const uno::Sequence< beans::PropertyValue >& aReducedMediaDescriptor( aMediaDescriptorHelper.getReducedForModel() ); if ( rURL == "private:stream" ) diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index f47a92b58971..bbd5dd61fab2 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -1096,7 +1096,7 @@ static bool lcl_moveSeriesOrCheckIfMoveIsAllowed( else if( nT+1 < aChartTypeList.size() ) { //exchange series with next charttype - rtl::Reference< ChartType > xOtherChartType( aChartTypeList[nT+1] ); + const rtl::Reference< ChartType >& xOtherChartType( aChartTypeList[nT+1] ); if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) ) { bMovedOrMoveAllowed = true; @@ -1259,7 +1259,7 @@ uno::Reference< chart2::data::XLabeledDataSequence > Diagram::getCategories() if (aCatAxes.empty()) return xResult; - rtl::Reference< Axis > xCatAxis(aCatAxes[0]); + const rtl::Reference< Axis >& xCatAxis(aCatAxes[0]); if( !xCatAxis.is()) return xResult; @@ -1636,7 +1636,7 @@ StackMode Diagram::getStackMode( bool& rbFound, bool& rbAmbiguous ) std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); for( std::size_t nT = 0; nT < aChartTypeList.size(); ++nT ) { - rtl::Reference< ChartType > xChartType( aChartTypeList[nT] ); + const rtl::Reference< ChartType >& xChartType( aChartTypeList[nT] ); StackMode eLocalStackMode = DiagramHelper::getStackModeFromChartType( xChartType, rbFound, rbAmbiguous, xCooSys ); diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 3a9c99aa3fdf..265a5a97058a 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -516,7 +516,7 @@ void ChartTypeTemplate::createCoordinateSystems( // there are coordinate systems but they do not fit. So overwrite them. //copy as much info from former coordinate system as possible: - rtl::Reference< BaseCoordinateSystem > xOldCooSys( aCoordinateSystems[0] ); + const rtl::Reference< BaseCoordinateSystem >& xOldCooSys( aCoordinateSystems[0] ); sal_Int32 nMaxDimensionCount = std::min( xCooSys->getDimension(), xOldCooSys->getDimension() ); for(sal_Int32 nDimensionIndex=0; nDimensionIndex<nMaxDimensionCount; nDimensionIndex++) @@ -633,7 +633,7 @@ void ChartTypeTemplate::createAxes( if( rCoordSys.empty() ) return; - rtl::Reference< BaseCoordinateSystem > xCooSys( rCoordSys[0] ); + const rtl::Reference< BaseCoordinateSystem >& xCooSys( rCoordSys[0] ); if(!xCooSys.is()) return; diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 6bd4d3bb6efb..cc5c0c0ed09f 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -326,7 +326,7 @@ bool PieChartTypeTemplate::matchesTemplate2( if( !aSeriesVec.empty() ) { //@todo in future this will depend on Orientation of the radius axis scale - rtl::Reference< DataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] ); + const rtl::Reference< DataSeries >& xSeries( aSeriesVec[nOuterSeriesIndex] ); xSeries->getPropertyValue( u"Offset"_ustr) >>= fOffset; // "AttributedDataPoints" diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 7f6de91b6e82..c5e32760f6b3 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -107,7 +107,7 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const rtl::Reference< Ba std::vector< rtl::Reference< DataSeries > > aSeries = ChartModelHelper::getDataSeries( &mrModel ); if( !aSeries.empty() ) { - rtl::Reference< DataSeries > xSeriesSource = aSeries.front(); + const rtl::Reference< DataSeries >& xSeriesSource = aSeries.front(); OUString aStringDummy; bool bDummy; uno::Sequence< sal_Int32 > aSeqDummy; @@ -194,7 +194,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr for(sal_Int32 nN=0;nN<nCount;nN++) { OUString aText; - uno::Any aAny = rInAnys[nN]; + const uno::Any& aAny = rInAnys[nN]; if( aAny.hasValue() ) { double fDouble = 0; @@ -437,7 +437,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& bIsDate = true; bool bContainsEmptyString = false; - uno::Any aAny = aValues[nN]; + const uno::Any& aAny = aValues[nN]; if( aAny.hasValue() ) { OUString aTest; diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 71285ab6c7e7..157c7cbca336 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -332,7 +332,7 @@ InternalDataProvider::InternalDataProvider( sal_Int32 nLevelCount = rSplitCategoriesList.size(); for( sal_Int32 nL = 0; nL<nLevelCount; nL++ ) { - Reference< chart2::data::XLabeledDataSequence > xLDS( rSplitCategoriesList[nL] ); + const Reference< chart2::data::XLabeledDataSequence >& xLDS( rSplitCategoriesList[nL] ); if( !xLDS.is() ) continue; Sequence< uno::Any > aDataSeq; diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index f8bb84a26f06..df3ab62d082c 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -670,7 +670,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines( for( sal_Int32 nS = 0; nS < nSeriesCount; ++nS ) { - rtl::Reference< DataSeries > xSeries( aSeriesList[nS] ); + const rtl::Reference< DataSeries >& xSeries( aSeriesList[nS] ); if(!nS) { rnRoundedEdges = 0; diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 073fd67aeae8..ae7ff6467c05 100644 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -215,10 +215,9 @@ void SAL_CALL WrappedPropertySet::setPropertyValues( const Sequence< OUString >& sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<nMinCount; nN++) { - OUString aPropertyName( rNameSeq[nN] ); try { - setPropertyValue( aPropertyName, rValueSeq[nN] ); + setPropertyValue( rNameSeq[nN], rValueSeq[nN] ); } catch( const beans::UnknownPropertyException& ) { @@ -242,8 +241,7 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyValues( const Sequence< { try { - OUString aPropertyName( rNameSeq[nN] ); - pRetSeq[nN] = getPropertyValue( aPropertyName ); + pRetSeq[nN] = getPropertyValue( rNameSeq[nN] ); } catch( const beans::UnknownPropertyException& ) { @@ -313,8 +311,7 @@ Sequence< beans::PropertyState > SAL_CALL WrappedPropertySet::getPropertyStates( auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); - pRetSeq[nN] = getPropertyState( aPropertyName ); + pRetSeq[nN] = getPropertyState( rNameSeq[nN] ); } } return aRetSeq; @@ -372,8 +369,7 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { - OUString aPropertyName( rNameSeq[nN] ); - pRetSeq[nN] = getPropertyDefault( aPropertyName ); + pRetSeq[nN] = getPropertyDefault( rNameSeq[nN] ); } } return aRetSeq; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index c0e45faf99ef..a65b0f3cd428 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1188,8 +1188,8 @@ void VSeriesPlotter::createErrorRectangle( double fScaledX = fX; m_pPosHelper->doLogicScaling( &fScaledX, nullptr, nullptr ); - uno::Sequence< double > aDataX( rVDataSeries.getAllX() ); - uno::Sequence< double > aDataY( rVDataSeries.getAllY() ); + const uno::Sequence< double >& aDataX( rVDataSeries.getAllX() ); + const uno::Sequence< double >& aDataY( rVDataSeries.getAllY() ); double fPosX = 0.0; double fPosY = 0.0; @@ -1303,7 +1303,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer { if(m_nDimension!=2) return; - rtl::Reference< DataSeries > xContainer( rVDataSeries.getModel() ); + const rtl::Reference< DataSeries >& xContainer( rVDataSeries.getModel() ); if(!xContainer.is()) return; @@ -2596,7 +2596,7 @@ bool lcl_HasVisibleLine( const uno::Reference< beans::XPropertySet >& xProps, bo bool lcl_HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLine ) { bool bHasRegressionCurves = false; - rtl::Reference< DataSeries > xRegrCont( rSeries.getModel() ); + const rtl::Reference< DataSeries >& xRegrCont( rSeries.getModel() ); for( const rtl::Reference< RegressionCurveModel > & rCurve : xRegrCont->getRegressionCurves2() ) { bHasRegressionCurves = true; @@ -2716,7 +2716,7 @@ rtl::Reference< SvxShapeGroup > VSeriesPlotter::createLegendSymbolForPoint( // the default properties for the data point are the data series properties. // If a data point has own attributes overwrite them - Reference< beans::XPropertySet > xSeriesProps( rSeries.getPropertiesOfSeries() ); + const Reference< beans::XPropertySet >& xSeriesProps( rSeries.getPropertiesOfSeries() ); Reference< beans::XPropertySet > xPointSet( xSeriesProps ); if( rSeries.isAttributedDataPoint( nPointIndex ) ) xPointSet.set( rSeries.getPropertiesOfPoint( nPointIndex )); @@ -2864,7 +2864,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( if (!ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension )) return aResult; - rtl::Reference< DataSeries > xRegrCont = rSeries.getModel(); + const rtl::Reference< DataSeries >& xRegrCont = rSeries.getModel(); if( xRegrCont.is()) { const std::vector< rtl::Reference< RegressionCurveModel > > & aCurves = xRegrCont->getRegressionCurves2(); diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index c76d96a4f20f..43b62ae747ad 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -187,7 +187,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart sal_Int32 nGlobalSeriesIndex = 0; //for automatic symbols for (std::size_t nCS = 0; nCS < aCooSysList.size(); ++nCS) { - rtl::Reference<BaseCoordinateSystem> xCooSys(aCooSysList[nCS]); + const rtl::Reference<BaseCoordinateSystem>& xCooSys(aCooSysList[nCS]); VCoordinateSystem* pVCooSys = SeriesPlotterContainer::addCooSysToList(m_rVCooSysList, xCooSys, rChartModel); // Let's check whether the secondary Y axis is visible @@ -207,7 +207,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart std::vector<rtl::Reference<ChartType>> aChartTypeList(xCooSys->getChartTypes2()); for (std::size_t nT = 0; nT < aChartTypeList.size(); ++nT) { - rtl::Reference<ChartType> xChartType(aChartTypeList[nT]); + const rtl::Reference<ChartType>& xChartType(aChartTypeList[nT]); if (nDimensionCount == 3 && xChartType->getChartType().equalsIgnoreAsciiCase( CHART2_SERVICE_NAME_CHARTTYPE_PIE)) diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 6bb58b4458a5..d98910468dec 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -330,7 +330,7 @@ awt::Size lcl_placeLegendEntries( sal_Int32 nMaxColumnCount=-1; for( sal_Int32 nN=0; nN<static_cast<sal_Int32>(aTextShapes.size()); nN++ ) { - rtl::Reference<SvxShapeText> xShape( aTextShapes[nN] ); + const rtl::Reference<SvxShapeText>& xShape( aTextShapes[nN] ); if( !xShape.is() ) continue; awt::Size aSize( xShape->getSize() ); @@ -586,7 +586,7 @@ awt::Size lcl_placeLegendEntries( break; // text shape - rtl::Reference<SvxShapeText> xTextShape( aTextShapes[nEntry] ); + const rtl::Reference<SvxShapeText>& xTextShape( aTextShapes[nEntry] ); if( xTextShape.is() ) { awt::Size aTextSize( xTextShape->getSize() ); commit 0879fd8ea4920c51dab59a35b8df204f19796fad Author: Noel Grandin <[email protected]> AuthorDate: Fri Nov 8 12:36:55 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Nov 11 10:10:38 2024 +0100 clang-tidy: performance-unnecessary-copy-initialization in cui Change-Id: Idbce2978dee6c485e50dc6ceccf67d7d3722bb17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176375 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 2270ab330f0b..428ed342a3ac 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -238,7 +238,7 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem ) { OUString sPageId(u"internet"_ustr); - OUString aStrURL(pItem->GetURL()); + const OUString& aStrURL(pItem->GetURL()); INetURLObject aURL(aStrURL); INetProtocol eProtocolTyp = aURL.GetProtocol(); diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index c321931f8f49..4fc295f84286 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -305,7 +305,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&, if (!files.hasElements()) return; - OUString aConfirmedName = files[0]; + const OUString& aConfirmedName = files[0]; if (aConfirmedName.isEmpty()) return; diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 2a3b089c8762..f383280e5bc9 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -600,7 +600,6 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) { int nEntry = m_pWordsLB->get_selected_index(); OUString aNewWord(fixSpace(m_xWordED->get_text())); - OUString sEntry(aNewWord); OUString aReplaceStr(fixSpace(m_xReplaceED->get_text())); DictionaryError nAddRes = DictionaryError::UNKNOWN; @@ -632,21 +631,21 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) if (DictionaryError::NONE != nAddRes) SvxDicError(m_xDialog.get(), nAddRes); - if (DictionaryError::NONE == nAddRes && !sEntry.isEmpty()) + if (DictionaryError::NONE == nAddRes && !aNewWord.isEmpty()) { // insert new entry in list-box etc... m_pWordsLB->freeze(); if (nEntry != -1) // entry selected in m_pWordsLB ie action = modify entry { - m_pWordsLB->set_text(nEntry, sEntry); + m_pWordsLB->set_text(nEntry, aNewWord); if (!aReplaceStr.isEmpty()) m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } else { nEntry = GetLBInsertPos(aNewWord); - m_pWordsLB->insert_text(nEntry, sEntry); + m_pWordsLB->insert_text(nEntry, aNewWord); if(!aReplaceStr.isEmpty()) m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 6cfc67c9496b..6ca5847d22cf 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -144,7 +144,7 @@ bool lcl_HasSystemFilePicker() try { - OUString aFileService = impl_SystemFileOpenServiceName(); + const OUString& aFileService = impl_SystemFileOpenServiceName(); Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService ); if ( xEnum.is() && xEnum->hasMoreElements() ) bRet = true; @@ -1134,7 +1134,7 @@ static Sequence< OUString > seqInstalledLanguages; static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper ) { - Sequence< OUString > aDateAcceptancePatterns = rLocaleWrapper.getDateAcceptancePatterns(); + const Sequence< OUString >& aDateAcceptancePatterns = rLocaleWrapper.getDateAcceptancePatterns(); sal_Int32 nPatterns = aDateAcceptancePatterns.getLength(); OUStringBuffer aBuf( nPatterns * 6 ); // 6 := length of Y-M-D; SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern"); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 5eb31909fc22..d11aab9e7eaf 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -572,7 +572,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void) try { sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); - uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = aHelper.GetFilePicker(); + const uno::Reference<ui::dialogs::XFilePicker3>& xFilePicker = aHelper.GetFilePicker(); xFilePicker->appendFilter(OUString(), u"*.xml"_ustr); if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK) { diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 330f8f77aa17..eba8bdc23fe4 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1231,7 +1231,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void) { - NamedColor aNamedColor = rColorBox.GetSelectedEntry(); + const NamedColor& aNamedColor = rColorBox.GetSelectedEntry(); m_aFrameSel.SetColorToSelection(aNamedColor.m_aColor, aNamedColor.getComplexColor()); } diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index d078e82f9f85..ab05111e7b95 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -1016,7 +1016,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl { if(bUpdateEdit) { - OUString aFormat=aEntryList[nFmtLbSelPos]; + const OUString& aFormat=aEntryList[nFmtLbSelPos]; m_xEdFormat->set_text(aFormat); m_xFtComment->set_label(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); } diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 240711ffca10..c2309176784f 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -593,7 +593,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl { SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ]; - Reference<XIndexAccess> xLevel = aOutlineAccess[nItem]; + const Reference<XIndexAccess>& xLevel = aOutlineAccess[nItem]; for(sal_Int32 nLevel = 0; nLevel < SVX_MAX_NUM; nLevel++) { // use the last locale-defined level for all remaining levels. diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index dc9b0e4ea542..efd8dfacce78 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -169,7 +169,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) drawing::FillStyle eXFS = drawing::FillStyle_NONE; if( rSet.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::INVALID ) { - XFillStyleItem aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ); + const XFillStyleItem& aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ); eXFS = aFillStyleItem.GetValue(); m_rXFSet.Put( aFillStyleItem ); } @@ -179,7 +179,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) default: case drawing::FillStyle_NONE: { - XFillUseSlideBackgroundItem aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); + const XFillUseSlideBackgroundItem& aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); if (aBckItem.GetValue()) SelectFillType(*m_xBtnUseBackground); else diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 9dadae520bd5..9ed75da8d3c8 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -149,7 +149,7 @@ void SvxBitmapTabPage::Construct() void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) { - XFillBitmapItem aItem( rSet.Get(XATTR_FILLBITMAP) ); + const XFillBitmapItem& aItem( rSet.Get(XATTR_FILLBITMAP) ); sal_Int32 nPos( 0 ); if ( !aItem.isPattern() ) @@ -278,7 +278,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(m_fObjectHeight), mePoolUnit, MapUnit::Map100thMM )) / fUIScale); m_fObjectHeight = fTmpHeight; - XFillBitmapItem aItem( rAttrs->Get(XATTR_FILLBITMAP) ); + const XFillBitmapItem& aItem( rAttrs->Get(XATTR_FILLBITMAP) ); if(!aItem.isPattern()) { diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 8a84b1a99bca..ef8f208205e7 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -265,7 +265,7 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) if ( nState >= SfxItemState::DEFAULT ) { - XFillColorItem aColorItem( rSet->Get( XATTR_FILLCOLOR ) ); + const XFillColorItem& aColorItem( rSet->Get( XATTR_FILLCOLOR ) ); m_aPreviousColor = aColorItem.GetColorValue(); aNewColor = aColorItem.GetColorValue(); } diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 343e9fac7708..bfa6d2fa417a 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -172,13 +172,13 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) ChangeHatchHdl_Impl(); } - XFillBackgroundItem aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); + const XFillBackgroundItem& aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); m_rXFSet.Put( aBckItem ); if (aBckItem.GetValue()) { m_xCbBackgroundColor->set_state(TRISTATE_TRUE); - XFillColorItem aColorItem( rSet.Get(XATTR_FILLCOLOR) ); + const XFillColorItem& aColorItem( rSet.Get(XATTR_FILLCOLOR) ); Color aColor(aColorItem.GetColorValue()); m_xLbBackgroundColor->SelectEntry(aColor); m_xLbBackgroundColor->set_sensitive(true); @@ -254,11 +254,11 @@ void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) { ChangeHatchHdl_Impl(); - XFillColorItem aColItem( rSet->Get(XATTR_FILLCOLOR) ); + const XFillColorItem& aColItem( rSet->Get(XATTR_FILLCOLOR) ); m_xLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); m_rXFSet.Put( aColItem ); - XFillBackgroundItem aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); + const XFillBackgroundItem& aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); if(aBckItem.GetValue()) m_xCbBackgroundColor->set_state(TRISTATE_TRUE); else diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 6128ae946184..481248e29278 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -160,7 +160,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - XFillBitmapItem aItem( rSet.Get( XATTR_FILLBITMAP ) ); + const XFillBitmapItem& aItem( rSet.Get( XATTR_FILLBITMAP ) ); if ( aItem.isPattern() ) {
