diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-09-04 15:33:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-05 15:55:28 +0200 |
commit | 8be964f0386308a10d02ce4e214da29a77890507 (patch) | |
tree | 06bcbc8d303d8120f0317b9da62d71dd6262b98d /oox | |
parent | afaa86e7e9a0a9effb28d46289805453f3806a74 (diff) |
Simplify by using replace instead of replaceAt in 2 loops in oox/sc
I grouped these because one has a reference with the other
Change-Id: I9bbd87951e2f945dfd20d54d16ea7d9291d74f62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139369
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/chart/chartconverter.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index e215d1883e7b..725b28c3bfe2 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -44,16 +44,6 @@ const sal_Unicode API_TOKEN_ARRAY_OPEN = '{'; const sal_Unicode API_TOKEN_ARRAY_CLOSE = '}'; const sal_Unicode API_TOKEN_ARRAY_COLSEP = ';'; -// Code similar to sc/source/filter/oox/formulabase.cxx -static OUString lclGenerateApiString( const OUString& rString ) -{ - OUString aRetString = rString; - sal_Int32 nQuotePos = aRetString.getLength(); - while( (nQuotePos = aRetString.lastIndexOf( '"', nQuotePos )) >= 0 ) - aRetString = aRetString.replaceAt( nQuotePos, 1, u"\"\"" ); - return "\"" + aRetString + "\""; -} - static OUString lclGenerateApiArray(const std::vector<Any>& rRow, sal_Int32 nStart, sal_Int32 nCount) { OSL_ENSURE( !rRow.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" ); @@ -68,7 +58,10 @@ static OUString lclGenerateApiArray(const std::vector<Any>& rRow, sal_Int32 nSta if( *aIt >>= fValue ) aBuffer.append( fValue ); else if( *aIt >>= aString ) - aBuffer.append( lclGenerateApiString( aString ) ); + { + // Code similar to sc/source/filter/oox/formulabase.cxx + aBuffer.append( "\"" + aString.replaceAll(u"\"", u"\"\"") + "\"" ); + } else aBuffer.append( "\"\"" ); } |