[Libreoffice-commits] core.git: xmloff/source
Jelle van der Waa
jelle at vdwaa.nl
Mon Aug 19 08:50:27 PDT 2013
xmloff/source/core/RDFaExportHelper.cxx | 6 +-----
xmloff/source/core/nmspmap.cxx | 10 ++++------
xmloff/source/draw/animationexport.cxx | 4 +---
xmloff/source/draw/shapeexport2.cxx | 6 +-----
xmloff/source/draw/shapeexport4.cxx | 4 +---
xmloff/source/forms/propertyexport.cxx | 4 +---
xmloff/source/style/xmlbahdl.cxx | 8 +-------
xmloff/source/style/xmlexppr.cxx | 8 ++------
xmloff/source/style/xmlnumfi.cxx | 11 +++--------
xmloff/source/text/txtprhdl.cxx | 14 ++------------
xmloff/source/transform/TransformerBase.cxx | 5 +----
xmloff/source/xforms/xformsexport.cxx | 8 +++-----
12 files changed, 21 insertions(+), 67 deletions(-)
New commits:
commit fa0e48c5e4ffc2bf05a60ce0e878073643db8cbe
Author: Jelle van der Waa <jelle at vdwaa.nl>
Date: Fri Aug 9 17:07:04 2013 +0200
fdo#57950: Remove some chained appends in xmloff
Change-Id: Iff0c43d190e6afa26c23416db4da9843cf7f41a5
Reviewed-on: https://gerrit.libreoffice.org/5327
Reviewed-by: Petr Mladek <pmladek at suse.cz>
Tested-by: Petr Mladek <pmladek at suse.cz>
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
index d2b830f..29047f8 100644
--- a/xmloff/source/core/RDFaExportHelper.cxx
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -151,13 +151,9 @@ RDFaExportHelper::AddRDFa(
{
throw uno::RuntimeException();
}
- static const sal_Unicode s_OpenBracket ('[');
- static const sal_Unicode s_CloseBracket(']');
const OUString about( xSubjectURI.is()
? getRelativeReference(m_rExport, xSubjectURI->getStringValue())
- : OUStringBuffer().append(s_OpenBracket).append(
- LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
- .makeStringAndClear()
+ : "[" + LookupBlankNode(xSubjectBNode) + "]"
);
const uno::Reference<rdf::XLiteral> xContent(
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
index 03e5e13..44eb235 100644
--- a/xmloff/source/core/nmspmap.cxx
+++ b/xmloff/source/core/nmspmap.cxx
@@ -548,13 +548,11 @@ sal_Bool SvXMLNamespaceMap::NormalizeOasisURN( OUString& rName )
return sal_False;
// replace [tcid] with current TCID and version with current version.
- OUStringBuffer aNewName( nNameLen +20 );
- aNewName.append( rName.copy( 0, nTCIdStart ) );
- aNewName.append( GetXMLToken( XML_OPENDOCUMENT ) );
- aNewName.append( rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) );
- aNewName.append( GetXMLToken( XML_1_0 ) );
- rName = aNewName.makeStringAndClear();
+ rName = rName.copy( 0, nTCIdStart ) +
+ GetXMLToken( XML_OPENDOCUMENT ) +
+ rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) +
+ GetXMLToken( XML_1_0 );
return sal_True;
}
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 14a63c3..3ccb7e1 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1247,9 +1247,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
if( !sTmp.isEmpty() )
sTmp.append( (sal_Unicode)';' );
- sTmp.append( p->Time );
- sTmp.append( (sal_Unicode)',' );
- sTmp.append( p->Progress );
+ sTmp.append( OUString::number(p->Time) + "," + OUString::number(p->Progress) );
p++;
}
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
index f907121..70593e6 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -500,12 +500,8 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
(aStrLibrary.equalsIgnoreAsciiCase("StarOffice") ||
aStrLibrary.equalsIgnoreAsciiCase("application") ) ? XML_APPLICATION
: XML_DOCUMENT ) );
- OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
- sTmp = sLocation;
- sTmp.append( sal_Unicode( ':' ) );
- sTmp.append( aStrMacro );
mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
- sTmp.makeStringAndClear());
+ sLocation + ":" + aStrMacro);
}
else
{
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index a87f73f..111f015 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -92,9 +92,7 @@ void ExportParameter( OUStringBuffer& rStrBuffer, const com::sun::star::drawing:
{
case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
{
- rStrBuffer.append( (sal_Unicode)'?' );
- rStrBuffer.append( (sal_Unicode)'f' );
- rStrBuffer.append( OUString::valueOf( nValue ) );
+ rStrBuffer.append( "?f" + OUString::number( nValue ) );
}
break;
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index fa960c9..c5727fa 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -674,9 +674,7 @@ namespace xmloff
// the property must exist
if (!m_xPropertyInfo->hasPropertyByName(_rPropertyName))
{
- OStringBuffer aBuf("OPropertyExport::dbg_implCheckProperty: no property with the name ");
- aBuf.append(OUStringToOString(_rPropertyName, RTL_TEXTENCODING_ASCII_US)).append('!');
- OSL_FAIL(aBuf.getStr());
+ OSL_FAIL("OPropertyExport::dbg_implCheckProperty: no property with the name " + OUStringToOString(_rPropertyName, RTL_TEXTENCODING_ASCII_US) + "!");
return;
}
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index bad015c..364121b 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -500,13 +500,7 @@ sal_Bool XMLColorPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue,
Sequence< double > aHSL;
if( (rValue >>= aHSL) && (aHSL.getLength() == 3) )
{
- aOut.append( OUString("hsl(") );
- aOut.append( aHSL[0] );
- aOut.append( OUString(",") );
- aOut.append( aHSL[1] * 100.0 );
- aOut.append( OUString("%,") );
- aOut.append( aHSL[2] * 100.0 );
- aOut.append( OUString("%)") );
+ aOut.append( "hsl(" + OUString::number(aHSL[0]) + "," + OUString::number(aHSL[1] * 100.0) + "%," + OUString::number(aHSL[2] * 100.0) + "%)" );
rStrExpValue = aOut.makeStringAndClear();
bRet = sal_True;
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 4d27c69..6888f6e 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -971,9 +971,7 @@ void SvXMLExportPropertyMapper::_exportXML(
sPrefix = pNamespaceMap->GetPrefixByKey( nKey );
}
// In any case, the attribute name has to be adapted.
- sNameBuffer.append( sPrefix );
- sNameBuffer.append( sal_Unicode(':') );
- sNameBuffer.append( pAttribName->copy( nColonPos+1 ) );
+ sNameBuffer.append( sPrefix + ":" + pAttribName->copy( nColonPos+1 ) );
sAttribName = sNameBuffer.makeStringAndClear();
}
@@ -985,9 +983,7 @@ void SvXMLExportPropertyMapper::_exportXML(
pNamespaceMap = pNewNamespaceMap;
}
pNewNamespaceMap->Add( sPrefix, sNamespace );
- sNameBuffer.append( GetXMLToken(XML_XMLNS) );
- sNameBuffer.append( sal_Unicode(':') );
- sNameBuffer.append( sPrefix );
+ sNameBuffer.append( GetXMLToken(XML_XMLNS) + ":" + sPrefix );
rAttrList.AddAttribute( sNameBuffer.makeStringAndClear(),
sNamespace );
}
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index bf2b245..601771e 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1926,8 +1926,7 @@ void SvXMLNumFormatContext::AddCurrency( const OUString& rContent, LanguageType
if ( nLang != LANGUAGE_SYSTEM )
{
// '-' sign and language code in hex:
- aFormatCode.append( (sal_Unicode) '-' );
- aFormatCode.append(OUString::valueOf(sal_Int32(nLang), 16).toAsciiUpperCase());
+ aFormatCode.append("-" + OUString::number(sal_Int32(nLang), 16).toAsciiUpperCase());
}
aFormatCode.append( (sal_Unicode) ']' ); // end of "new" currency symbol
@@ -1958,9 +1957,7 @@ void SvXMLNumFormatContext::AddNfKeyword( sal_uInt16 nIndex )
if ( !bTruncate && !bHasDateTime )
{
// with truncate-on-overflow = false, add "[]" to first time part
- aFormatCode.append( (sal_Unicode)'[' );
- aFormatCode.append( sKeyword );
- aFormatCode.append( (sal_Unicode)']' );
+ aFormatCode.append("[" + sKeyword + "]");
}
else
{
@@ -2080,9 +2077,7 @@ void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex )
sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
}
}
- aConditions.append( (sal_Unicode) '[' );
- aConditions.append( sRealCond );
- aConditions.append( (sal_Unicode) ']' );
+ aConditions.append("[" + sRealCond + "]");
}
const SvNumberformat* pFormat = pFormatter->GetEntry(l_nKey);
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 7cd2a78..07157c8 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -573,12 +573,7 @@ sal_Bool XMLFrameProtectPropHdl_Impl::exportXML(
}
else
{
- OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
- sVal.getLength() );
- aOut.append( rStrExpValue );
- aOut.append( (sal_Unicode)' ' );
- aOut.append( sVal );
- rStrExpValue = aOut.makeStringAndClear();
+ rStrExpValue = rStrExpValue + " " + sVal;
}
}
else if( rStrExpValue.isEmpty() )
@@ -831,12 +826,7 @@ sal_Bool XMLGrfMirrorPropHdl_Impl::exportXML(
}
else
{
- OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
- sVal.getLength() );
- aOut.append( rStrExpValue );
- aOut.append( (sal_Unicode)' ' );
- aOut.append( sVal );
- rStrExpValue = aOut.makeStringAndClear();
+ rStrExpValue = rStrExpValue + " " + sVal;
}
}
else if( rStrExpValue.isEmpty() )
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index b24665e..6863a5e 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -1222,11 +1222,8 @@ sal_Bool XMLTransformerBase::NegPercent( OUString& rValue )
sal_Int32 nIntVal = 100 - static_cast<sal_Int32>( nVal );
- OUStringBuffer aNewValBuffer;
- aNewValBuffer.append( nIntVal );
- aNewValBuffer.append( sal_Unicode('%' ) );
+ rValue = OUString::number(nIntVal) + "%";
- rValue = aNewValBuffer.makeStringAndClear();
bRet = sal_True;
}
diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx
index 424baf4..6b082b4 100644
--- a/xmloff/source/xforms/xformsexport.cxx
+++ b/xmloff/source/xforms/xformsexport.cxx
@@ -674,11 +674,9 @@ OUString xforms_bool( const Any& rAny )
void xforms_formatDate( OUStringBuffer& aBuffer, const util::Date& rDate )
{
- aBuffer.append( static_cast<sal_Int32>( rDate.Year ) );
- aBuffer.append( sal_Unicode('-') );
- aBuffer.append( static_cast<sal_Int32>( rDate.Month ) );
- aBuffer.append( sal_Unicode('-') );
- aBuffer.append( static_cast<sal_Int32>( rDate.Day ) );
+ aBuffer.append(OUString::number(static_cast<sal_Int32>( rDate.Year ) )
+ + "-" + OUString::number(static_cast<sal_Int32>( rDate.Month ))
+ + "-" + OUString::number(static_cast<sal_Int32>( rDate.Day )) );
}
void xforms_formatTime( OUStringBuffer& aBuffer, const com::sun::star::util::Time& rTime )
More information about the Libreoffice-commits
mailing list