summaryrefslogtreecommitdiff
path: root/sdext/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 10:15:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 11:38:07 +0000
commitf24d38de3c23479e79768cd3fcfe37692cee27e4 (patch)
tree2a7804fa21648bb9cfabab827f8e65432ef358c9 /sdext/source
parentdb9912d824c1d621fdc409b9cdd6c79caefe1327 (diff)
loplugin:stringadd in sd/sdext
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: Ic95e72e1c857c6814d6e25b9820494cdfa535465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149746 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext/source')
-rw-r--r--sdext/source/pdfimport/odf/odfemitter.cxx6
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfentries.cxx16
-rw-r--r--sdext/source/pdfimport/sax/emitcontext.cxx13
-rw-r--r--sdext/source/pdfimport/test/pdfunzip.cxx17
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx43
-rw-r--r--sdext/source/pdfimport/tree/style.cxx6
-rw-r--r--sdext/source/pdfimport/tree/writertreevisiting.cxx40
7 files changed, 60 insertions, 81 deletions
diff --git a/sdext/source/pdfimport/odf/odfemitter.cxx b/sdext/source/pdfimport/odf/odfemitter.cxx
index 71bc293aad23..1ff92deb73a4 100644
--- a/sdext/source/pdfimport/odf/odfemitter.cxx
+++ b/sdext/source/pdfimport/odf/odfemitter.cxx
@@ -64,8 +64,7 @@ void OdfEmitter::beginTag( const char* pTag, const PropertyMap& rProperties )
{
OSL_PRECOND(pTag,"Invalid tag string");
- OUStringBuffer aElement;
- aElement.append("<");
+ OUStringBuffer aElement("<");
aElement.appendAscii(pTag);
aElement.append(" ");
@@ -105,8 +104,7 @@ void OdfEmitter::write( const OUString& rText )
void OdfEmitter::endTag( const char* pTag )
{
- OUStringBuffer aElement;
- aElement.append("</");
+ OUStringBuffer aElement("</");
aElement.appendAscii(pTag);
aElement.append(">");
write(aElement.makeStringAndClear());
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 9c9a269d6098..b1b7d9f86a58 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -950,11 +950,11 @@ bool PDFTrailer::emit( EmitContext& rWriteContext ) const
section_end->first == nLast+1 )
nLast = section_end->first;
// write first object number and number of following entries
- OStringBuffer aBuf( 21 );
- aBuf.append( sal_Int32( section_begin->first ) );
- aBuf.append( ' ' );
- aBuf.append( sal_Int32(nLast - section_begin->first + 1) );
- aBuf.append( "\r\n" );
+ OStringBuffer aBuf =
+ OString::number(sal_Int32( section_begin->first ) )
+ + " "
+ + OString::number(sal_Int32(nLast - section_begin->first + 1))
+ + "\r\n";
if( ! rWriteContext.write( aBuf.getStr(), aBuf.getLength() ) )
return false;
while( section_begin != section_end )
@@ -966,14 +966,12 @@ bool PDFTrailer::emit( EmitContext& rWriteContext ) const
int nPad = 10 - aOffset.getLength();
for( int i = 0; i < nPad; i++ )
aBuf.append( '0' );
- aBuf.append( aOffset );
- aBuf.append( ' ' );
+ aBuf.append( aOffset + " " );
OString aGeneration( OString::number( section_begin->second.first ) );
nPad = 5 - aGeneration.getLength();
for( int i = 0; i < nPad; i++ )
aBuf.append( '0' );
- aBuf.append( aGeneration );
- aBuf.append( " n\r\n" );
+ aBuf.append( aGeneration + " n\r\n" );
if( ! rWriteContext.write( aBuf.getStr(), 20 ) )
return false;
++section_begin;
diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx b/sdext/source/pdfimport/sax/emitcontext.cxx
index a923488d688d..c32e327c4c4f 100644
--- a/sdext/source/pdfimport/sax/emitcontext.cxx
+++ b/sdext/source/pdfimport/sax/emitcontext.cxx
@@ -110,15 +110,14 @@ void SaxEmitter::beginTag( const char* pTag, const PropertyMap& rProperties )
pStream->write( " ", 4, nWritten );
OStringBuffer aBuf( 1024 );
- aBuf.append( '<' );
- aBuf.append( pTag );
+ aBuf.append( OString::Concat("<") + pTag );
for( const auto& rProperty : rProperties )
{
- aBuf.append( ' ' );
- aBuf.append( OUStringToOString( rProperty.first, RTL_TEXTENCODING_UTF8 ) );
- aBuf.append( "=\"" );
- aBuf.append( OUStringToOString( rProperty.second, RTL_TEXTENCODING_UTF8 ) );
- aBuf.append( "\"" );
+ aBuf.append( " "
+ + OUStringToOString( rProperty.first, RTL_TEXTENCODING_UTF8 )
+ + "=\""
+ + OUStringToOString( rProperty.second, RTL_TEXTENCODING_UTF8 )
+ + "\"" );
}
aBuf.append( ">\n" );
pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten );
diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx
index 86797056e841..c4d5b6bc0b71 100644
--- a/sdext/source/pdfimport/test/pdfunzip.cxx
+++ b/sdext/source/pdfimport/test/pdfunzip.cxx
@@ -378,17 +378,16 @@ static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile*
if( ! pStream )
continue;
- OStringBuffer aOutStream( i_pOutFile );
- aOutStream.append( "_font_" );
- aOutStream.append( sal_Int32(pStreamRef->m_nNumber) );
- aOutStream.append( "_" );
- aOutStream.append( sal_Int32(pStreamRef->m_nGeneration) );
- aOutStream.append( "_" );
- aOutStream.append( aFontName );
+ OStringBuffer aOutStream( OString::Concat(i_pOutFile)
+ + "_font_"
+ + OString::number( sal_Int32(pStreamRef->m_nNumber) )
+ + "_"
+ + OString::number( sal_Int32(pStreamRef->m_nGeneration) )
+ + "_"
+ + aFontName );
if( pFileType )
{
- aOutStream.append( "." );
- aOutStream.append( pFileType );
+ aOutStream.append( OString::Concat(".") + pFileType );
}
FileEmitContext aContext( aOutStream.getStr(), i_pInFile, i_pPDFFile );
aContext.m_bDecrypt = i_pPDFFile->isEncrypted();
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index b94a302a5583..c1fa22d19100 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -221,8 +221,6 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem,
}
else
{
- OUStringBuffer aBuf(256);
-
basegfx::B2DHomMatrix mat(rGC.Transformation);
if (rElem.MirrorVertical)
@@ -237,21 +235,21 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem,
double scale = convPx2mm(100);
mat.scale(scale, scale);
- aBuf.append("matrix(");
- aBuf.append(mat.get(0, 0));
- aBuf.append(' ');
- aBuf.append(mat.get(1, 0));
- aBuf.append(' ');
- aBuf.append(mat.get(0, 1));
- aBuf.append(' ');
- aBuf.append(mat.get(1, 1));
- aBuf.append(' ');
- aBuf.append(mat.get(0, 2));
- aBuf.append(' ');
- aBuf.append(mat.get(1, 2));
- aBuf.append(")");
-
- rProps[ sDrawTransform ] = aBuf.makeStringAndClear();
+ rProps[ sDrawTransform ] =
+ OUString::Concat("matrix(")
+ + OUString::number(mat.get(0, 0))
+ + " "
+ + OUString::number(mat.get(1, 0))
+ + " "
+ + OUString::number(mat.get(0, 1))
+ + " "
+ + OUString::number(mat.get(1, 1))
+ + " "
+ + OUString::number(mat.get(0, 2))
+ + " "
+ + OUString::number(mat.get(1, 2))
+ + ")";
+
}
}
@@ -334,12 +332,11 @@ void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< std::unique_
// so we need to tell fillFrameProps here that the transformation for
// a PolyPolyElement was already applied (aside from translation)
fillFrameProps( elem, aProps, m_rEmitContext, true );
- OUStringBuffer aBuf( 64 );
- aBuf.append( "0 0 " );
- aBuf.append( convPx2mmPrec2(elem.w)*100.0 );
- aBuf.append( ' ' );
- aBuf.append( convPx2mmPrec2(elem.h)*100.0 );
- aProps[ "svg:viewBox" ] = aBuf.makeStringAndClear();
+ aProps[ "svg:viewBox" ] =
+ "0 0 "
+ + OUString::number( convPx2mmPrec2(elem.w)*100.0 )
+ + " "
+ + OUString::number( convPx2mmPrec2(elem.h)*100.0 );
aProps[ "svg:d" ] = basegfx::utils::exportToSvgD( elem.PolyPoly, false, true, false );
m_rEmitContext.rEmitter.beginTag( "draw:path", aProps );
diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx
index b1cb02a489b3..fe93f2d7ed29 100644
--- a/sdext/source/pdfimport/tree/style.cxx
+++ b/sdext/source/pdfimport/tree/style.cxx
@@ -167,14 +167,12 @@ OUString StyleContainer::getStyleName( sal_Int32 nStyle ) const
else
aStyleName = OStringToOUString( rStyle.Name, RTL_TEXTENCODING_ASCII_US );
sal_Int32 nIndex = aStyleName.lastIndexOf( ':' );
- aRet.append( aStyleName.subView(nIndex+1) );
- aRet.append( nStyle );
+ aRet.append( aStyleName.subView(nIndex+1) + OUString::number( nStyle ) );
}
}
else
{
- aRet.append( "invalid style id " );
- aRet.append( nStyle );
+ aRet.append( "invalid style id " + OUString::number(nStyle) );
}
return aRet.makeStringAndClear();
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index f6c9df0805d5..a8331b87bfd2 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -254,28 +254,24 @@ void WriterXmlEmitter::fillFrameProps( DrawElement& rElem,
}
if( fShearX != 0.0 )
{
- aBuf.append( "skewX( " );
- aBuf.append( fShearX );
- aBuf.append( " )" );
+ aBuf.append( "skewX( " + OUString::number(fShearX) + " )" );
}
if( fRotate != 0.0 )
{
if( !aBuf.isEmpty() )
aBuf.append( ' ' );
- aBuf.append( "rotate( " );
- aBuf.append( -fRotate );
- aBuf.append( " )" );
+ aBuf.append( "rotate( " + OUString::number(-fRotate) + " )" );
}
if( ! rElem.isCharacter )
{
if( !aBuf.isEmpty() )
aBuf.append( ' ' );
- aBuf.append( "translate( " );
- aBuf.append( convertPixelToUnitString( rel_x ) );
- aBuf.append( ' ' );
- aBuf.append( convertPixelToUnitString( rel_y ) );
- aBuf.append( " )" );
+ aBuf.append( "translate( "
+ + convertPixelToUnitString( rel_x )
+ + " "
+ + convertPixelToUnitString( rel_y )
+ + " )" );
}
rProps[ "draw:transform" ] = aBuf.makeStringAndClear();
@@ -358,12 +354,11 @@ void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< std::uniqu
PropertyMap aProps;
fillFrameProps( elem, aProps, m_rEmitContext );
- OUStringBuffer aBuf( 64 );
- aBuf.append( "0 0 " );
- aBuf.append( convPx2mmPrec2(elem.w)*100.0 );
- aBuf.append( ' ' );
- aBuf.append( convPx2mmPrec2(elem.h)*100.0 );
- aProps[ "svg:viewBox" ] = aBuf.makeStringAndClear();
+ aProps[ "svg:viewBox" ] =
+ "0 0 "
+ + OUString::number(convPx2mmPrec2(elem.w)*100.0)
+ + " "
+ + OUString::number( convPx2mmPrec2(elem.h)*100.0 );
aProps[ "svg:d" ] = basegfx::utils::exportToSvgD( elem.PolyPoly, true, true, false );
m_rEmitContext.rEmitter.beginTag( "draw:path", aProps );
@@ -1113,10 +1108,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::un
if( ! bIsCenter && elem.x > p_x + p_w/10 )
{
// indent
- OUStringBuffer aBuf( 32 );
- aBuf.append( convPx2mm( elem.x - p_x ) );
- aBuf.append( "mm" );
- aParaProps[ "fo:margin-left" ] = aBuf.makeStringAndClear();
+ aParaProps[ "fo:margin-left" ] = OUString::number(convPx2mm( elem.x - p_x )) + "mm";
}
// check whether to leave some space to next paragraph
@@ -1129,10 +1121,8 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::un
{
if( pNextPara->y - (elem.y+elem.h) > convmm2Px( 10 ) )
{
- OUStringBuffer aBuf( 32 );
- aBuf.append( convPx2mm( pNextPara->y - (elem.y+elem.h) ) );
- aBuf.append( "mm" );
- aParaProps[ "fo:margin-bottom" ] = aBuf.makeStringAndClear();
+ aParaProps[ "fo:margin-bottom" ] =
+ OUString::number( convPx2mm( pNextPara->y - (elem.y+elem.h) ) ) + "mm";
}
}
}