Kaydet (Commit) 4d20ec5a authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:stringloop in filter

Change-Id: Icb2df9854975544ae3e164b5d25a6628824027e5
Reviewed-on: https://gerrit.libreoffice.org/58212
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst d4073045
......@@ -105,8 +105,7 @@ const uno::Reference< container::XIndexContainer >&
while( xNameCont->hasByName( sName ) )
{
sName = sWW8_form;
sName += OUString::number( ++n );
sName = sWW8_form + OUString::number( ++n );
}
const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory
......
......@@ -6813,7 +6813,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
// idea.
if (nVal == 0)
{
OUString aStr;
OUStringBuffer aStr;
bool inquote = false;
for (int nLen = 0; nLen < 64; ++nLen)
{
......@@ -6826,7 +6826,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
else if (!n)
{
// End of format string
xEntry->xString = aStr;
xEntry->xString = aStr.makeStringAndClear();
break;
}
else if (!inquote)
......@@ -6838,7 +6838,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
}
else
{
aStr += OUStringLiteral1(n);
aStr.append(OUStringLiteral1(n));
}
}
}
......
......@@ -2123,12 +2123,11 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
if( pInfo && mbPresentation )
{
bFieldProcessed = true;
OUString aRepresentation;
if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() )
{
// to notify to the SVGActionWriter::ImplWriteText method
// that we are dealing with a placeholder shape
aRepresentation = sPlaceholderTag;
OUStringBuffer aRepresentation = sPlaceholderTag;
if( !mCreateOjectsCurrentMasterPage.is() )
{
......@@ -2208,17 +2207,17 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
}
// Independently of the date format, we always put all these characters by default.
// They should be enough to cover every time format.
aRepresentation += "0123456789.:/-APM";
aRepresentation.append( "0123456789.:/-APM" );
if( eDateFormat != SvxDateFormat::AppDefault )
{
OUString sDate;
OUStringBuffer sDate;
LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM );
// We always collect the characters obtained by using the SvxDateFormat::B (as: 13.02.1996)
// so we are sure to include any unusual day|month|year separator.
Date aDate( 1, 1, 1996 );
sDate += SvxDateField::GetFormatted( aDate, SvxDateFormat::B, *pNumberFormatter, eLang );
sDate.append( SvxDateField::GetFormatted( aDate, SvxDateFormat::B, *pNumberFormatter, eLang ) );
switch( eDateFormat )
{
case SvxDateFormat::E: // Tue, 13.February 1996
......@@ -2227,7 +2226,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
for( sal_uInt16 i = 1; i <= 7; ++i ) // we get all days in a week
{
aDate.SetDay( i );
sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
sDate.append( SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ) );
}
SAL_FALLTHROUGH; // We need months too!
case SvxDateFormat::C: // 13.Feb 1996
......@@ -2235,7 +2234,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
{
aDate.SetMonth( i );
sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
sDate.append( SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ) );
}
break;
// coverity[dead_error_begin] - following conditions exist to avoid compiler warning
......@@ -2246,7 +2245,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
// nothing to do here, we always collect the characters needed for these cases.
break;
}
aRepresentation += sDate;
aRepresentation.append( sDate.makeStringAndClear() );
}
}
}
......@@ -2255,22 +2254,22 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
switch( mVisiblePagePropSet.nPageNumberingType )
{
case css::style::NumberingType::CHARS_UPPER_LETTER:
aRepresentation += "QWERTYUIOPASDFGHJKLZXCVBNM";
aRepresentation.append( "QWERTYUIOPASDFGHJKLZXCVBNM" );
break;
case css::style::NumberingType::CHARS_LOWER_LETTER:
aRepresentation += "qwertyuiopasdfghjklzxcvbnm";
aRepresentation.append( "qwertyuiopasdfghjklzxcvbnm" );
break;
case css::style::NumberingType::ROMAN_UPPER:
aRepresentation += "IVXLCDM";
aRepresentation.append( "IVXLCDM" );
break;
case css::style::NumberingType::ROMAN_LOWER:
aRepresentation += "ivxlcdm";
aRepresentation.append( "ivxlcdm" );
break;
// arabic numbering type is the default
case css::style::NumberingType::ARABIC:
// in case the numbering type is not handled we fall back on arabic numbering
default:
aRepresentation += "0123456789";
aRepresentation.append( "0123456789" );
break;
}
}
......@@ -2284,10 +2283,10 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
{
for (auto const& elem : *pCharSet)
{
aRepresentation += OUStringLiteral1(elem);
aRepresentation.append(elem);
}
}
pInfo->SetRepresentation( aRepresentation );
pInfo->SetRepresentation( aRepresentation.makeStringAndClear() );
}
}
else
......
......@@ -1427,7 +1427,6 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
const GDIMetaFile& rMtf = *mpTextEmbeddedBitmapMtf;
OUString sId, sRefId;
BitmapChecksum nId, nChecksum = 0;
Point aPt;
Size aSz;
......@@ -1463,11 +1462,7 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
{
// embedded bitmap id
nId = SVGActionWriter::GetChecksum( pAction );
sId = "embedded-bitmap(";
sId += msShapeId;
sId += ".";
sId += OUString::number( nId );
sId += ")";
OUString sId = "embedded-bitmap(" + msShapeId + "." + OUString::number( nId ) + ")";
mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", sId );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "EmbeddedBitmap" );
......@@ -1476,9 +1471,7 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
// <use x="?" y="?" xlink:ref="?" >
{
// referenced bitmap template
sRefId = "#bitmap(";
sRefId += OUString::number( nChecksum );
sRefId += ")";
OUString sRefId = "#bitmap(" + OUString::number( nChecksum ) + ")";
Point aPoint;
Size aSize;
......@@ -1778,7 +1771,7 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol
OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bool bLine )
{
OUString aPathData;
OUStringBuffer aPathData;
const OUString aBlank( " " );
const OUString aComma( "," );
Point aPolyPoint;
......@@ -1791,33 +1784,33 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo
if( nSize > 1 )
{
aPolyPoint = rPoly[ 0 ];
aPathData += "M "
+ OUString::number( aPolyPoint.X() )
+ aComma
+ OUString::number( aPolyPoint.Y() );
aPathData.append("M ")
.append(OUString::number( aPolyPoint.X() ))
.append(aComma)
.append(OUString::number( aPolyPoint.Y() ));
sal_Char nCurrentMode = 0;
const bool bClose(!bLine || rPoly[0] == rPoly[nSize - 1]);
while( n < nSize )
{
aPathData += aBlank;
aPathData.append(aBlank);
if ( ( rPoly.GetFlags( n ) == PolyFlags::Control ) && ( ( n + 2 ) < nSize ) )
{
if ( nCurrentMode != 'C' )
{
nCurrentMode = 'C';
aPathData += "C ";
aPathData.append("C ");
}
for ( int j = 0; j < 3; j++ )
{
if ( j )
aPathData += aBlank;
aPathData.append(aBlank);
aPolyPoint = rPoly[ n++ ];
aPathData += OUString::number( aPolyPoint.X() )
+ aComma
+ OUString::number( aPolyPoint.Y() );
aPathData.append(OUString::number( aPolyPoint.X() ))
.append(aComma)
.append(OUString::number( aPolyPoint.Y() ));
}
}
else
......@@ -1825,25 +1818,25 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo
if ( nCurrentMode != 'L' )
{
nCurrentMode = 'L';
aPathData += "L ";
aPathData.append("L ");
}
aPolyPoint = rPoly[ n++ ];
aPathData += OUString::number( aPolyPoint.X() )
+ aComma
+ OUString::number( aPolyPoint.Y() );
aPathData.append(OUString::number( aPolyPoint.X() ))
.append(aComma)
.append(OUString::number( aPolyPoint.Y() ));
}
}
if(bClose)
aPathData += " Z";
aPathData.append(" Z");
if( i < ( nCount - 1 ) )
aPathData += aBlank;
aPathData.append(aBlank);
}
}
return aPathData;
return aPathData.makeStringAndClear();
}
......@@ -2061,20 +2054,19 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
if( rShape.maDashArray.size() )
{
const OUString aComma( "," );
OUString aDashArrayStr;
OUStringBuffer aDashArrayStr;
for( size_t k = 0; k < rShape.maDashArray.size(); ++k )
{
const sal_Int32 nDash = ImplMap( FRound( rShape.maDashArray[ k ] ) );
if( k )
aDashArrayStr += aComma;
aDashArrayStr.append(",");
aDashArrayStr += OUString::number( nDash );
aDashArrayStr.append(OUString::number( nDash ));
}
mrExport.AddAttribute( XML_NAMESPACE_NONE, "stroke-dasharray", aDashArrayStr );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "stroke-dasharray", aDashArrayStr.makeStringAndClear() );
}
ImplWritePolyPolygon( aPolyPoly, bLineOnly, false );
......
......@@ -51,25 +51,25 @@ static OUString checkExtensions( const OUString& rExtensions )
const sal_Unicode* pSource = rExtensions.getStr();
sal_Int32 nCount = rExtensions.getLength();
OUString aRet;
OUStringBuffer aRet;
while( nCount-- )
{
switch(*pSource)
{
case u',':
aRet += ";";
aRet.append(";");
break;
case u'.':
case u'*':
break;
default:
aRet += OUStringLiteral1( *pSource );
aRet.append( *pSource );
}
pSource++;
}
return aRet;
return aRet.makeStringAndClear();
}
void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment