diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 12:24:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 18:25:31 +0200 |
commit | 04aafba860f613c20e7078d038cc83eb02de0b54 (patch) | |
tree | 8153152b87089419bde17313d9ac7b9de6fcce32 /chart2/source/tools/ObjectIdentifier.cxx | |
parent | 76c793d2acf66f46e9edcda43d2f4327e8374841 (diff) |
loplugin:stringadd simplify some *StringBuffer operations
pulled from a larger patch which I created with a more permissive
variant of this plugin
Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools/ObjectIdentifier.cxx')
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 608f4337a53e..5f566f230c1d 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -510,7 +510,7 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys , ChartModel& rModel ) { - OUStringBuffer aRet; + OUString aRet; Reference< XDiagram > xDiagram( rModel.getFirstDiagram() ); Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); @@ -523,22 +523,20 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem( Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] ); if( xCooSys == xCurrentCooSys ) { - aRet = ObjectIdentifier::createParticleForDiagram(); - aRet.append(":CS="); - aRet.append( nCooSysIndex ); + aRet = ObjectIdentifier::createParticleForDiagram() + ":CS=" + OUString::number( nCooSysIndex ); break; } } } - return aRet.makeStringAndClear(); + return aRet; } OUString ObjectIdentifier::createParticleForCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys , const Reference< frame::XModel >& xChartModel ) { - OUStringBuffer aRet; + OUString aRet; Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); @@ -551,15 +549,13 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem( Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] ); if( xCooSys == xCurrentCooSys ) { - aRet = ObjectIdentifier::createParticleForDiagram(); - aRet.append(":CS="); - aRet.append( nCooSysIndex ); + aRet = ObjectIdentifier::createParticleForDiagram() + ":CS=" + OUString::number( nCooSysIndex ); break; } } } - return aRet.makeStringAndClear(); + return aRet; } OUString ObjectIdentifier::createParticleForAxis( @@ -604,49 +600,27 @@ OUString ObjectIdentifier::createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex ) { - OUStringBuffer aRet; - - aRet.append("D="); - aRet.append( nDiagramIndex ); - aRet.append(":CS="); - aRet.append( nCooSysIndex ); - aRet.append(":CT="); - aRet.append( nChartTypeIndex ); - aRet.append(":"); - aRet.append(getStringForType( OBJECTTYPE_DATA_SERIES )); - aRet.append("="); - aRet.append( nSeriesIndex ); - - return aRet.makeStringAndClear(); + return + "D=" + OUString::number( nDiagramIndex ) + + ":CS=" + OUString::number( nCooSysIndex ) + + ":CT=" + OUString::number( nChartTypeIndex ) + + ":" + getStringForType( OBJECTTYPE_DATA_SERIES ) + "=" + + OUString::number( nSeriesIndex ); } OUString ObjectIdentifier::createParticleForLegend( ChartModel& ) { - OUStringBuffer aRet; - //todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend - aRet.append( ObjectIdentifier::createParticleForDiagram() ); - aRet.append(":"); - aRet.append(getStringForType( OBJECTTYPE_LEGEND )); - aRet.append("="); - - return aRet.makeStringAndClear(); + return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType( OBJECTTYPE_LEGEND ) + "="; } OUString ObjectIdentifier::createParticleForLegend( const Reference< frame::XModel >& ) { - OUStringBuffer aRet; - //todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend - aRet.append( ObjectIdentifier::createParticleForDiagram() ); - aRet.append(":"); - aRet.append(getStringForType( OBJECTTYPE_LEGEND )); - aRet.append("="); - - return aRet.makeStringAndClear(); + return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType( OBJECTTYPE_LEGEND ) + "="; } OUString ObjectIdentifier::createClassifiedIdentifier( |