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 | |
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>
86 files changed, 438 insertions, 759 deletions
diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx index 5bdb0bb561eb..cef72d8b6a8e 100644 --- a/bridges/source/cpp_uno/shared/component.cxx +++ b/bridges/source/cpp_uno/shared/component.cxx @@ -87,18 +87,15 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) if (xHome.is()) { // interface - OUStringBuffer oid( 64 ); - oid.append( reinterpret_cast< sal_Int64 >(xHome.get()), 16 ); - oid.append( ';' ); - // ;environment[context] - oid.append( OUString::unacquired(&pEnv->aBase.pTypeName) ); - oid.append( '[' ); - oid.append( - reinterpret_cast< sal_Int64 >(pEnv->aBase.pContext), - 16 ); - // ];good guid - oid.append( cppu_cppenv_getStaticOIdPart() ); - OUString aRet( oid.makeStringAndClear() ); + OUString aRet = + OUString::number( reinterpret_cast< sal_Int64 >(xHome.get()), 16 ) + + ";" + + // ;environment[context] + OUString::unacquired(&pEnv->aBase.pTypeName) + + "[" + + OUString::number( reinterpret_cast< sal_Int64 >(pEnv->aBase.pContext), 16 ) + + // ];good guid + cppu_cppenv_getStaticOIdPart(); *ppOId = aRet.pData; ::rtl_uString_acquire( *ppOId ); } 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( diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index dbe942a3fd01..13a799e55a9a 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -109,12 +109,9 @@ namespace dbtools OUString DBTypeConversion::toDateTimeString(const css::util::DateTime& _rDateTime) { css::util::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year); - OUStringBuffer aTemp(toDateString(aDate)); - aTemp.append(" "); css::util::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds, _rDateTime.Minutes, _rDateTime.Hours, _rDateTime.IsUTC); - aTemp.append( toTimeString(aTime) ); - return aTemp.makeStringAndClear(); + return toDateString(aDate) + " " + toTimeString(aTime); } css::util::Date DBTypeConversion::toDate(const sal_Int32 _nVal) diff --git a/connectivity/source/drivers/hsqldb/HView.cxx b/connectivity/source/drivers/hsqldb/HView.cxx index 0a09ec0d201b..29e5a4000a51 100644 --- a/connectivity/source/drivers/hsqldb/HView.cxx +++ b/connectivity/source/drivers/hsqldb/HView.cxx @@ -90,12 +90,11 @@ namespace connectivity::hsqldb // create a statement which can be used to re-create the original view, in case // dropping it succeeds, but creating it with a new statement fails - OUStringBuffer aRestoreCommand; - aRestoreCommand.append( "CREATE VIEW " ); - aRestoreCommand.append ( sQualifiedName ); - aRestoreCommand.append( " AS " ); - aRestoreCommand.append ( impl_getCommand_throwSQLException() ); - OUString sRestoreCommand( aRestoreCommand.makeStringAndClear() ); + OUString sRestoreCommand = + "CREATE VIEW " + + sQualifiedName + + " AS " + + impl_getCommand_throwSQLException(); bool bDropSucceeded( false ); try diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx index 124a606a8f9e..3d0ac9ce8411 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx @@ -80,11 +80,11 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column) { // MYSQL_FIELD::charsetnr is the collation identifier // _ci postfix means it's insensitive - OUStringBuffer sql{ "SHOW COLLATION WHERE Id =" }; - sql.append(static_cast<sal_Int32>(m_fields.at(column - 1).charsetNumber)); + OUString sql + = "SHOW COLLATION WHERE Id =" + OUString::number(m_fields.at(column - 1).charsetNumber); Reference<XStatement> stmt = m_rConnection.createStatement(); - Reference<XResultSet> rs = stmt->executeQuery(sql.makeStringAndClear()); + Reference<XResultSet> rs = stmt->executeQuery(sql); Reference<XRow> xRow(rs, UNO_QUERY_THROW); if (!rs->next()) // fetch first and only row diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 58047bb31101..8291597870c5 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1892,11 +1892,7 @@ OUString SAL_CALL ODocumentDefinition::getHierarchicalName() OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const OUString& i_rRelativeName ) { - OUStringBuffer aBuffer; - aBuffer.append( getHierarchicalName() ); - aBuffer.append( '/' ); - aBuffer.append( i_rRelativeName ); - return aBuffer.makeStringAndClear(); + return getHierarchicalName() + "/" + i_rRelativeName; } void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName ) diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx index bc830418db39..5cd5367ba117 100644 --- a/dbaccess/source/core/misc/sdbcoretools.cxx +++ b/dbaccess/source/core/misc/sdbcoretools.cxx @@ -95,12 +95,9 @@ namespace dbaccess Exception aExcept; _rError >>= aExcept; - OUStringBuffer aBuffer; - aBuffer.append( _rError.getValueTypeName() ); - aBuffer.append( ":\n" ); - aBuffer.append( aExcept.Message ); - - sDisplayMessage = aBuffer.makeStringAndClear(); + sDisplayMessage = _rError.getValueTypeName() + + ":\n" + + aExcept.Message; } return sDisplayMessage; diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 3e615428f2d4..c3b7951a8219 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -84,10 +84,7 @@ public: if (sName.indexOf('"') >= 0) { // Table name with string delimiter - OUStringBuffer sMultiName("\""); - sMultiName.append(string::split(m_sql, u'"')[1]); - sMultiName.append("\""); - sName = sMultiName.makeStringAndClear(); + sName = "\"" + string::split(m_sql, u'"')[1] + "\""; } return sName; } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index f13926e3d204..00ace78497b1 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -334,12 +334,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForType(const ElementType eTy bool bParent = rTreeView.iter_parent(*xParent); while (bParent) { - OUStringBuffer buffer; - buffer.append(rTreeView.get_text(*xParent)); - buffer.append('/'); - buffer.append(sName); - sName = buffer.makeStringAndClear(); - + sName = rTreeView.get_text(*xParent) + "/" + sName; bParent = rTreeView.iter_parent(*xParent); } diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx index d00a77899572..7220eb2bdb30 100644 --- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx +++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx @@ -152,10 +152,10 @@ void ODocumentInfoPreview::insertDateTime( value.Hours, value.Minutes, value.Seconds, value.NanoSeconds)); if (aToolsDT.IsValidAndGregorian()) { const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - OUStringBuffer buf(rLocaleWrapper.getDate(aToolsDT)); - buf.append(", "); - buf.append(rLocaleWrapper.getTime(aToolsDT)); - insertEntry(SvtDocInfoTable_Impl::GetString(id), buf.makeStringAndClear()); + OUString buf = rLocaleWrapper.getDate(aToolsDT) + + ", " + + rLocaleWrapper.getTime(aToolsDT); + insertEntry(SvtDocInfoTable_Impl::GetString(id), buf); } } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 05d6181ca881..6ef0819c4099 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -369,12 +369,8 @@ OFieldDescription* NamedTableCopySource::createFieldDescription( const OUString& OUString NamedTableCopySource::getSelectStatement() const { - OUStringBuffer aSQL; - aSQL.append( "SELECT * FROM " ); - - aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ) ); - - return aSQL.makeStringAndClear(); + return "SELECT * FROM " + + ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ); } ::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::getPreparedSelectStatement() const diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 22408bbc58aa..63c5d07998ec 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -658,11 +658,10 @@ namespace if ( field->isAggregateFunction() ) { OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-("); - OUStringBuffer aTmpStr2( field->GetFunction()); - aTmpStr2.append("("); - aTmpStr2.append(aTmpStr.makeStringAndClear()); - aTmpStr2.append(")"); - aTmpStr = aTmpStr2; + aTmpStr = field->GetFunction() + + "(" + + aTmpStr + + ")"; } if (!rFieldAlias.isEmpty() && diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 9dea7779405a..a2e79d8283ae 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -93,14 +93,13 @@ struct DispatchHolder std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( std::u16string_view rUrl, std::u16string_view rFactory ) { // create the list of filters - OUStringBuffer sQuery(256); - sQuery.append("getSortedFilterList()"); - sQuery.append(":module="); - sQuery.append(rFactory); // use long name here ! - sQuery.append(":iflags="); - sQuery.append(OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT))); - sQuery.append(":eflags="); - sQuery.append(OUString::number(static_cast<int>(SFX_FILTER_NOTINSTALLED))); + OUString sQuery = "getSortedFilterList()" + ":module=" + + OUString::Concat(rFactory) + // use long name here ! + ":iflags=" + + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT)) + + ":eflags=" + + OUString::number(static_cast<int>(SFX_FILTER_NOTINSTALLED)); const Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); const Reference< XContainerQuery > xFilterFactory( @@ -110,7 +109,7 @@ std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( std::u16string_v std::shared_ptr<const SfxFilter> pBestMatch; const Reference< XEnumeration > xFilterEnum( - xFilterFactory->createSubSetEnumerationByQuery( sQuery.makeStringAndClear() ), UNO_SET_THROW ); + xFilterFactory->createSubSetEnumerationByQuery( sQuery ), UNO_SET_THROW ); while ( xFilterEnum->hasMoreElements() ) { comphelper::SequenceAsHashMap aFilterProps( xFilterEnum->nextElement() ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index a3c33f6d639d..730854127ac2 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -640,11 +640,8 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() supportedFilters.append(filter); if ( ! insertion.second ) { // already existing, append extensions: - OUStringBuffer buf; - buf.append( insertion.first->second ); - buf.append( ';' ); - buf.append( filter ); - insertion.first->second = buf.makeStringAndClear(); + insertion.first->second = insertion.first->second + + ";" + filter; } } } diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx index 92d7191111d3..75a499ffda9e 100644 --- a/desktop/source/deployment/manager/dp_properties.cxx +++ b/desktop/source/deployment/manager/dp_properties.cxx @@ -103,17 +103,14 @@ OUString ExtensionProperties::getPropertyValue(css::beans::NamedValue const & v) void ExtensionProperties::write() { ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv, m_xContext); - OUStringBuffer buf; + OUString buf; if (m_prop_suppress_license) { - buf.append(PROP_SUPPRESS_LICENSE); - buf.append("="); - buf.append(*m_prop_suppress_license); + buf = OUString::Concat(PROP_SUPPRESS_LICENSE) + "=" + *m_prop_suppress_license; } - OString stamp = OUStringToOString( - buf.makeStringAndClear(), RTL_TEXTENCODING_UTF8); + OString stamp = OUStringToOString(buf, RTL_TEXTENCODING_UTF8); Reference<css::io::XInputStream> xData( ::xmlscript::createInputStream( reinterpret_cast<sal_Int8 const *>(stamp.getStr()), diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 3cdf121438e9..f2dd75ccca6e 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -1001,14 +1001,13 @@ void BackendImpl::PackageImpl::exportTo( } erase_path( destURL, xCmdEnv ); - OUStringBuffer buf; - buf.append( "vnd.sun.star.zip://" ); - buf.append( ::rtl::Uri::encode( destURL, - rtl_UriCharClassRegName, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ); - buf.append( '/' ); - OUString destFolder( buf.makeStringAndClear() ); + OUString destFolder = + "vnd.sun.star.zip://" + + ::rtl::Uri::encode( destURL, + rtl_UriCharClassRegName, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) + + "/"; ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv, getMyBackend()->getComponentContext() ); diff --git a/extensions/source/logging/simpletextformatter.cxx b/extensions/source/logging/simpletextformatter.cxx index 83416e61c7d6..71e40a362562 100644 --- a/extensions/source/logging/simpletextformatter.cxx +++ b/extensions/source/logging/simpletextformatter.cxx @@ -61,17 +61,14 @@ OUString SAL_CALL SimpleTextFormatter::getHead() { return OUString(); } OUString SAL_CALL SimpleTextFormatter::format(const LogRecord& _rRecord) { - OUStringBuffer aLogEntry; + OUString aLogEntry; // Highlight warnings if (_rRecord.Level == css::logging::LogLevel::SEVERE) - aLogEntry.append("ERROR: "); - if (_rRecord.Level == css::logging::LogLevel::WARNING) - aLogEntry.append("WARNING: "); + aLogEntry = "ERROR: "; + else if (_rRecord.Level == css::logging::LogLevel::WARNING) + aLogEntry = "WARNING: "; - aLogEntry.append(_rRecord.Message); - aLogEntry.append("\n"); - - return aLogEntry.makeStringAndClear(); + return aLogEntry + _rRecord.Message + "\n"; } OUString SAL_CALL SimpleTextFormatter::getTail() { return OUString(); } diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx index 300d4a0fb6d8..30c4f894bf9c 100644 --- a/filter/source/xsltdialog/typedetectionexport.cxx +++ b/filter/source/xsltdialog/typedetectionexport.cxx @@ -153,7 +153,9 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co xHandler->startElement( sNode, pAttrList ); addLocaleProperty( xHandler, sUIName, filter->maInterfaceName ); - OUStringBuffer sValue("0" + + const application_info_impl* pAppInfo = getApplicationInfo( filter->maExportService ); + OUString sValue = + "0" + sComma + filter->maType + sComma + @@ -166,26 +168,23 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co sXSLTFilterService + sDelim + OUString::boolean( filter->mbNeedsXSLT2 ) + - sDelim); - - const application_info_impl* pAppInfo = getApplicationInfo( filter->maExportService ); - sValue.append(pAppInfo->maXMLImporter + + sDelim + + pAppInfo->maXMLImporter + sDelim + pAppInfo->maXMLExporter + - sDelim); - - sValue.append(createRelativeURL( filter->maFilterName, filter->maImportXSLT )); - sValue.append(sDelim); - sValue.append(createRelativeURL( filter->maFilterName, filter->maExportXSLT )); - sValue.append(sDelim); - // entry DTD obsolete and removed, but delimiter kept - sValue.append(sDelim); - sValue.append(filter->maComment); - sValue.append(sComma); - sValue.append("0"); - sValue.append(sComma); - sValue.append(createRelativeURL( filter->maFilterName, filter->maImportTemplate )); - addProperty( xHandler, sData, sValue.makeStringAndClear() ); + sDelim + + createRelativeURL( filter->maFilterName, filter->maImportXSLT ) + + sDelim + + createRelativeURL( filter->maFilterName, filter->maExportXSLT ) + + sDelim + + // entry DTD obsolete and removed, but delimiter kept + sDelim + + filter->maComment + + sComma + + "0" + + sComma + + createRelativeURL( filter->maFilterName, filter->maImportTemplate ); + addProperty( xHandler, sData, sValue ); xHandler->ignorableWhitespace ( sWhiteSpace ); xHandler->endElement( sNode ); } diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index f9eaab0b31b5..6ef66237a174 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -537,14 +537,14 @@ void OComboBoxModel::loadData( bool _bForce ) OUString sCatalog, sSchema, sTable; qualifiedNameComponents( xMeta, m_aListSource, sCatalog, sSchema, sTable, EComposeRule::InDataManipulation ); - OUStringBuffer aStatement; - aStatement.append( "SELECT DISTINCT " ); - aStatement.append ( quoteName( aQuote, aFieldName ) ); - aStatement.append( " FROM " ); - aStatement.append ( composeTableNameForSelect( xConnection, sCatalog, sSchema, sTable ) ); + OUString aStatement = + "SELECT DISTINCT " + + quoteName( aQuote, aFieldName ) + + " FROM " + + composeTableNameForSelect( xConnection, sCatalog, sSchema, sTable ); m_aListRowSet.setEscapeProcessing( false ); - m_aListRowSet.setCommand( aStatement.makeStringAndClear() ); + m_aListRowSet.setCommand( aStatement ); bExecuteRowSet = true; } } break; diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 50de9d7179e5..e4ae9251ab84 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -355,10 +355,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType { case E_GLOBAL : { - sRelPathBuf.append("global"); - sRelPathBuf.append("/"); - sRelPathBuf.append(sResource); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = OUString::Concat("global/") + sResource; sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, true ); @@ -368,12 +365,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType case E_MODULES : { - sRelPathBuf.append("modules"); - sRelPathBuf.append("/"); - sRelPathBuf.append(sModule); - sRelPathBuf.append("/"); - sRelPathBuf.append(sResource); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = OUString::Concat("modules/") + sModule + "/" + sResource; sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, true ); diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index fad4fc858fdd..c67f3b65a06d 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -952,31 +952,26 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -987,8 +982,7 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine aNodePropValues[3] >>= aMergeMenuInstruction.aMergeFallback; aNodePropValues[4] >>= aMergeMenuInstruction.aMergeContext; - OUString aMergeMenuBase = aMergeAddonInstructionBase.makeStringAndClear(); - ReadMergeMenuData( aMergeMenuBase, aMergeMenuInstruction.aMergeMenu ); + ReadMergeMenuData( aMergeAddonInstructionBase, aMergeMenuInstruction.aMergeMenu ); aContainer.push_back( aMergeMenuInstruction ); } @@ -1028,35 +1022,29 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ] ); - aNodePropNames[5] = aBuffer.makeStringAndClear(); + aNodePropNames[5] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1068,7 +1056,7 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction aNodePropValues[4] >>= aMergeToolbarInstruction.aMergeFallback; aNodePropValues[5] >>= aMergeToolbarInstruction.aMergeContext; - ReadMergeToolbarData( aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeToolbarData( aMergeAddonInstructionBase, aMergeToolbarInstruction.aMergeToolbarItems ); MergeToolbarInstructionContainer& rVector = rCachedToolbarMergingInstructions[ aMergeToolbarInstruction.aMergeToolbar ]; @@ -1105,36 +1093,29 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( for (sal_uInt32 j = 0; j < nCountAddons; j++) { - OUStringBuffer aMergeAddonInstructionBase(aMergeAddonInstructions); - aMergeAddonInstructionBase.append(m_aPathDelimiter); - aMergeAddonInstructionBase.append(aAddonInstMergeNodesSeq[j]); - aMergeAddonInstructionBase.append(m_aPathDelimiter); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer(aMergeAddonInstructionBase); - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( - m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]); - aNodePropNames[5] = aBuffer.makeStringAndClear(); + aNodePropNames[5] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]; Sequence<Any> aNodePropValues = GetProperties(aNodePropNames); @@ -1146,7 +1127,7 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( aNodePropValues[4] >>= aMergeNotebookBarInstruction.aMergeFallback; aNodePropValues[5] >>= aMergeNotebookBarInstruction.aMergeContext; - ReadMergeNotebookBarData(aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeNotebookBarData(aMergeAddonInstructionBase, aMergeNotebookBarInstruction.aMergeNotebookBarItems); MergeNotebookBarInstructionContainer& rVector @@ -1185,31 +1166,26 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1220,7 +1196,7 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi // aNodePropValues[3] >>= aMergeStatusbarInstruction.aMergeFallback; aNodePropValues[4] >>= aMergeStatusbarInstruction.aMergeContext; - ReadMergeStatusbarData( aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeStatusbarData( aMergeAddonInstructionBase, aMergeStatusbarInstruction.aMergeStatusbarItems ); aContainer.push_back( aMergeStatusbarInstruction ); diff --git a/framework/source/xml/acceleratorconfigurationreader.cxx b/framework/source/xml/acceleratorconfigurationreader.cxx index 1b36119f2fd6..ea31cd6b1d0d 100644 --- a/framework/source/xml/acceleratorconfigurationreader.cxx +++ b/framework/source/xml/acceleratorconfigurationreader.cxx @@ -248,13 +248,11 @@ OUString AcceleratorConfigurationReader::implts_getErrorLineString() if (!m_xLocator.is()) return "Error during parsing XML. (No further info available ...)"; - OUStringBuffer sMsg(256); - sMsg.append("Error during parsing XML in\nline = "); - sMsg.append (m_xLocator->getLineNumber() ); - sMsg.append("\ncolumn = " ); - sMsg.append (m_xLocator->getColumnNumber() ); - sMsg.append("." ); - return sMsg.makeStringAndClear(); + return "Error during parsing XML in\nline = " + + OUString::number(m_xLocator->getLineNumber()) + + "\ncolumn = " + + OUString::number(m_xLocator->getColumnNumber()) + + "."; } } // namespace framework diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index 0cb245cfcc3a..c3007397ea33 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -279,10 +279,9 @@ OUString OReadImagesDocumentHandler::getErrorLineString() SolarMutexGuard g; if ( m_xLocator.is() ) { - OUStringBuffer buffer("Line: "); - buffer.append(m_xLocator->getLineNumber()); - buffer.append(" - "); - return buffer.makeStringAndClear(); + return "Line: " + + OUString::number(m_xLocator->getLineNumber()) + + " - "; } else return OUString(); diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 01ad077f8a60..dc4cecb34895 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -328,9 +328,7 @@ SvMetaAttribute * SvIdlDataBase::ReadKnownAttr } } - OStringBuffer aStr("Not found : "); - aStr.append(rTok.GetString()); - OSL_FAIL(aStr.getStr()); + OSL_FAIL(OString("Not found : " + rTok.GetString()).getStr()); } } diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 1b74a2367578..2418e13afdf0 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -170,9 +170,8 @@ bool Options::badOption(char const * reason, std::string const & rArg) { if (reason != nullptr) { - OStringBuffer message; - message.append(reason); message.append(" option '"); message.append(rArg.c_str()); message.append("'"); - throw IllegalArgument(message.makeStringAndClear()); + OString message = OString::Concat(reason) + " option '" + rArg.c_str() + "'"; + throw IllegalArgument(message); } return false; } diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index 96d777fd0d8b..50a6db4bc13a 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -146,18 +146,11 @@ namespace io_acceptor { void SocketConnection::completeConnectionString() { - OUStringBuffer buf( 256 ); - buf.append( ",peerPort=" ); - buf.append( m_socket.getPeerPort() ); - buf.append( ",peerHost=" ); - buf.append( m_socket.getPeerHost( ) ); - - buf.append( ",localPort=" ); - buf.append( m_socket.getLocalPort() ); - buf.append( ",localHost=" ); - buf.append( m_socket.getLocalHost() ); - - m_sDescription += buf; + m_sDescription += + ",peerPort=" + OUString::number(m_socket.getPeerPort()) + + ",peerHost=" + m_socket.getPeerHost( ) + + ",localPort=" + OUString::number( m_socket.getLocalPort() ) + + ",localHost=" + m_socket.getLocalHost(); } sal_Int32 SocketConnection::read( Sequence < sal_Int8 > & aReadBytes , sal_Int32 nBytesToRead ) diff --git a/io/source/connector/ctr_socket.cxx b/io/source/connector/ctr_socket.cxx index 164cd4f6f31c..98b4131be407 100644 --- a/io/source/connector/ctr_socket.cxx +++ b/io/source/connector/ctr_socket.cxx @@ -105,18 +105,11 @@ namespace stoc_connector { nPort = m_socket.getPeerPort(); - OUStringBuffer buf( 256 ); - buf.append( ",peerPort=" ); - buf.append( nPort ); - buf.append( ",peerHost=" ); - buf.append( m_socket.getPeerHost() ); - - buf.append( ",localPort=" ); - buf.append( nPort ); - buf.append( ",localHost=" ); - buf.append( m_socket.getLocalHost( ) ); - - m_sDescription += buf; + m_sDescription += + ",peerPort=" + OUString::number( nPort ) + + ",peerHost=" + m_socket.getPeerHost() + + ",localPort=" + OUString::number( nPort ) + + ",localHost=" + m_socket.getLocalHost( ); } sal_Int32 SocketConnection::read( Sequence < sal_Int8 > & aReadBytes , sal_Int32 nBytesToRead ) diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 3ba3c9d2effa..f7d4d1b3b0c4 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -389,14 +389,13 @@ ErrCode DictionaryNeo::loadEntries(const OUString &rMainURL) static OString formatForSave(const uno::Reference< XDictionaryEntry > &xEntry, rtl_TextEncoding eEnc ) { - OStringBuffer aStr(OUStringToOString(xEntry->getDictionaryWord(), eEnc)); + OUStringBuffer aStr(xEntry->getDictionaryWord()); if (xEntry->isNegative() || !xEntry->getReplacementText().isEmpty()) { - aStr.append("=="); - aStr.append(OUStringToOString(xEntry->getReplacementText(), eEnc)); + aStr.append("==" + xEntry->getReplacementText()); } - return aStr.makeStringAndClear(); + return OUStringToOString(aStr, eEnc); } ErrCode DictionaryNeo::saveEntries(const OUString &rURL) @@ -438,9 +437,8 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL) pStream->WriteLine("lang: <none>"); else { - OStringBuffer aLine("lang: "); - aLine.append(OUStringToOString(LanguageTag::convertToBcp47(nLanguage), eEnc)); - pStream->WriteLine(aLine.makeStringAndClear()); + OString aLine = "lang: " + OUStringToOString(LanguageTag::convertToBcp47(nLanguage), eEnc); + pStream->WriteLine(aLine); } if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx index 301b414e1b4d..bec6bcf7466b 100644 --- a/lotuswordpro/source/filter/lwptblformula.cxx +++ b/lotuswordpro/source/filter/lwptblformula.cxx @@ -408,11 +408,7 @@ void LwpFormulaFunc::AddArg(std::unique_ptr<LwpFormulaArg> pArg) */ OUString LwpFormulaFunc::ToArgString(LwpTableLayout* pCellsMap) { - OUStringBuffer aFormula; - aFormula.append('('); - aFormula.append(ToString(pCellsMap)); - aFormula.append(')'); - return aFormula.makeStringAndClear(); + return "(" + ToString(pCellsMap) + ")"; } /** * Convert the function to a formula string. @@ -422,8 +418,8 @@ OUString LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap) OUStringBuffer aFormula; OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType); - aFormula.append(aFuncName); - aFormula.append(" ");//Append a blank space + aFormula.append(aFuncName + + " ");//Append a blank space //Append args for (auto const& elem : m_aArgs) diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index a61d80e6cc6b..cdd2ebb35c47 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -408,8 +408,8 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan } catch( Exception& ) { - OSL_FAIL( OStringBuffer( "XmlFilterBase::importFragment - XML parser failed in fragment '" ). - append( OUStringToOString( aFragmentPath, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() ); + OSL_FAIL( OStringBuffer( "XmlFilterBase::importFragment - XML parser failed in fragment '" + + OUStringToOString( aFragmentPath, RTL_TEXTENCODING_ASCII_US ) + "'" ).getStr() ); } } catch( Exception& ) diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index ecaa4c5121e4..d02a8d8644e2 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1117,8 +1117,8 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo } catch( Exception& ) { - OSL_FAIL( OStringBuffer( "ObjectFormatter::convertNumberFormat - cannot create number format '" ). - append( OUStringToOString( rNumberFormat.maFormatCode, osl_getThreadTextEncoding() ) ).append( '\'' ).getStr() ); + OSL_FAIL( OStringBuffer( "ObjectFormatter::convertNumberFormat - cannot create number format '" + + OUStringToOString( rNumberFormat.maFormatCode, osl_getThreadTextEncoding() ) + "'" ).getStr() ); } // Setting "LinkNumberFormatToSource" does not really work, at least not for axis :-/ diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0506041e67d5..2539c7eac143 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -162,14 +162,11 @@ sal_uInt32 VMLExport::EnterGroup( const OUString& rShapeName, const tools::Recta if ( pRect && ( mnGroupLevel == 1 ) ) { pAttrList->add( XML_coordorigin, - OStringBuffer( 20 ).append( sal_Int32( pRect->Left() ) ) - .append( "," ).append( sal_Int32( pRect->Top() ) ) - .makeStringAndClear() ); + OString::number( pRect->Left() ) + "," + OString::number( pRect->Top() ) ); pAttrList->add( XML_coordsize, - OStringBuffer( 20 ).append( sal_Int32( pRect->Right() ) - sal_Int32( pRect->Left() ) ) - .append( "," ).append( sal_Int32( pRect->Bottom() ) - sal_Int32( pRect->Top() ) ) - .makeStringAndClear() ); + OString::number( pRect->Right() - pRect->Left() ) + "," + + OString::number( pRect->Bottom() - pRect->Top() ) ); } m_pSerializer->startElementNS( XML_v, XML_group, pAttrList ); @@ -516,9 +513,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } if(nTop!=0 && nLeft!=0) m_pShapeAttrList->add( XML_coordorigin, - OStringBuffer( 20 ).append( sal_Int32( nLeft ) ) - .append( "," ).append( sal_Int32( nTop ) ) - .makeStringAndClear() ); + OString::number( nLeft ) + "," + OString::number( nTop ) ); } bAlreadyWritten[ ESCHER_Prop_geoLeft ] = true; bAlreadyWritten[ ESCHER_Prop_geoTop ] = true; @@ -545,9 +540,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if(nBottom!=0 && nRight!=0 ) m_pShapeAttrList->add( XML_coordsize, - OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) ) - .append( "," ).append( sal_Int32( nBottom ) - sal_Int32( nTop ) ) - .makeStringAndClear() ); + OString::number( nRight - nLeft ) + "," + OString::number( nBottom - nTop ) ); } bAlreadyWritten[ ESCHER_Prop_geoRight ] = true; bAlreadyWritten[ ESCHER_Prop_geoBottom ] = true; diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 1c737952872f..9e7308c7c496 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -474,10 +474,7 @@ void PresentationFragmentHandler::finalizeImport() if( !aPageRange.getLength() ) { - aPageRange = OUStringBuffer() - .append( static_cast< sal_Int32 >( 1 ) ) - .append( '-' ) - .append( nPageCount ).makeStringAndClear(); + aPageRange = "1-" + OUString::number( nPageCount ); } StringRangeEnumerator aRangeEnumerator( aPageRange, 0, nPageCount - 1 ); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 96d26efe8ff8..0fca9b06a017 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -294,8 +294,8 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, } } - OSL_FAIL( OStringBuffer( "lclGetColor - invalid VML color name '" ). - append( OUStringToOString( roVmlColor.get(), RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() ); + OSL_FAIL( OStringBuffer( "lclGetColor - invalid VML color name '" + + OUStringToOString( roVmlColor.get(), RTL_TEXTENCODING_ASCII_US ) + "'" ).getStr() ); aDmlColor.setSrgbClr( nDefaultRgb ); return aDmlColor; } diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index 13e5dacb3c70..25016a25ef0f 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -192,11 +192,11 @@ OUString OReportEngineJFree::getNewOutputName() // some meta data SvtUserOptions aUserOpts; - OUStringBuffer sAuthor(aUserOpts.GetFirstName()); - sAuthor.append(" "); - sAuthor.append(aUserOpts.GetLastName()); + OUString sAuthor = aUserOpts.GetFirstName() + + " " + + aUserOpts.GetLastName(); aConvertedProperties[nPos].Name = "Author"; - aConvertedProperties[nPos++].Value <<= sAuthor.makeStringAndClear(); + aConvertedProperties[nPos++].Value <<= sAuthor; aConvertedProperties[nPos].Name = "Title"; aConvertedProperties[nPos++].Value <<= m_xReport->getCaption(); diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx index ea70758ba6f3..cd6ae4df5db2 100644 --- a/reportdesign/source/core/misc/reportformula.cxx +++ b/reportdesign/source/core/misc/reportformula.cxx @@ -114,10 +114,7 @@ namespace rptui OUString ReportFormula::getEqualUndecoratedContent() const { - OUStringBuffer aBuffer; - aBuffer.append( "=" ); - aBuffer.append( getUndecoratedContent() ); - return aBuffer.makeStringAndClear(); + return "=" + getUndecoratedContent(); } diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx index 74576c820b01..70fa54e1aa3c 100644 --- a/sc/inc/dputil.hxx +++ b/sc/inc/dputil.hxx @@ -46,7 +46,7 @@ public: double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart, const SvNumberFormatter* pFormatter); - SC_DLLPUBLIC static OUString getDisplayedMeasureName(std::u16string_view rName, ScSubTotalFunc eFunc); + SC_DLLPUBLIC static OUString getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc); SC_DLLPUBLIC static ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc); }; diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index a9fe44f3f4e7..f1c32e376091 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -132,13 +132,9 @@ OUString createLabelString( const ScDocument& rDoc, SCCOL nCol, const ScRefCellV if (aDocStr.isEmpty()) { // Replace an empty label string with column name. - OUStringBuffer aBuf; - aBuf.append(ScResId(STR_COLUMN)); - aBuf.append(' '); ScAddress aColAddr(nCol, 0, 0); - aBuf.append(aColAddr.Format(ScRefFlags::COL_VALID)); - aDocStr = aBuf.makeStringAndClear(); + aDocStr = ScResId(STR_COLUMN) + " " + aColAddr.Format(ScRefFlags::COL_VALID); } return aDocStr; } diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index a561b870e2cd..6fabf2e286dd 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -387,19 +387,15 @@ const char* aFuncStrIds[] = { } -OUString ScDPUtil::getDisplayedMeasureName(std::u16string_view rName, ScSubTotalFunc eFunc) +OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc) { - OUStringBuffer aRet; assert(unsigned(eFunc) < SAL_N_ELEMENTS(aFuncStrIds)); const char* pId = aFuncStrIds[eFunc]; - if (pId) - { - aRet.append(ScResId(pId)); // function name - aRet.append(" - "); - } - aRet.append(rName); // field name - - return aRet.makeStringAndClear(); + if (!pId) + return rName; + return ScResId(pId) + // function name + " - " + + rName; // field name } ScSubTotalFunc ScDPUtil::toSubTotalFunc(ScGeneralFunction eGenFunc) diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 9efd334a4401..c7ea3cc5f927 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -874,14 +874,8 @@ ScFunctionList::ScFunctionList() pDesc->nFIndex = nNextId++; // ??? OpCode vergeben pDesc->nCategory = ID_FUNCTION_GRP_ADDINS; pDesc->mxFuncName = pLegacyFuncData->GetInternalName().toAsciiUpperCase(); - - OUStringBuffer aBuf(aArgDesc); - aBuf.append('\n'); - aBuf.append("( AddIn: "); - aBuf.append(pLegacyFuncData->GetModuleName()); - aBuf.append(" )"); - pDesc->mxFuncDesc = aBuf.makeStringAndClear(); - + pDesc->mxFuncDesc = aArgDesc + "\n" + "( AddIn: " + pLegacyFuncData->GetModuleName() + " )"; pDesc->nArgCount = nArgs; if (nArgs) { diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx index 21be72e4d37c..242b4b539bc4 100644 --- a/sc/source/core/tool/chartarr.cxx +++ b/sc/source/core/tool/chartarr.cxx @@ -235,14 +235,9 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() aString = rDocument.GetString(aCols[nCol], nStrRow, nTab1); if (aString.isEmpty()) { - OUStringBuffer aBuf; - aBuf.append(ScResId(STR_COLUMN)); - aBuf.append(' '); - ScAddress aPos( aCols[ nCol ], 0, 0 ); - aBuf.append(aPos.Format(ScRefFlags::COL_VALID)); - - aString = aBuf.makeStringAndClear(); + aString = ScResId(STR_COLUMN) + " " + + aPos.Format(ScRefFlags::COL_VALID); } pMemChart->SetColText( nCol, aString); } diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 73362197a771..bbcba23903e9 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -208,11 +208,9 @@ public: if (meRangeType == ScDBCollection::GlobalAnonymous) { // name - OUStringBuffer aBuf; - aBuf.append(STR_DB_GLOBAL_NONAME); - aBuf.append(++mnCounter); // 1-based, for entirely arbitrary reasons. The numbers are ignored on import. + OUString aBuf = STR_DB_GLOBAL_NONAME + OUString::number(++mnCounter); // 1-based, for entirely arbitrary reasons. The numbers are ignored on import. - write(aBuf.makeStringAndClear(), rData); + write(aBuf, rData); } else if (meRangeType == ScDBCollection::GlobalNamed) write(rData.GetName(), rData); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 2a01ad60ce6f..9df7d551e88b 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -827,15 +827,13 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, std::u16string_vi { ScXMLImport::MutexGuard aGuard(*this); LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(), LanguageTag( aLocale) ); - OUStringBuffer aBuffer(15); - aBuffer.append("#"); - aBuffer.append( aLocaleData.getNumThousandSep() ); - aBuffer.append("##0"); - aBuffer.append( aLocaleData.getNumDecimalSep() ); - aBuffer.append("00 [$"); - aBuffer.append(rCurrency); - aBuffer.append("]"); - sFormatString = aBuffer.makeStringAndClear(); + sFormatString = "#" + + aLocaleData.getNumThousandSep() + + "##0" + + aLocaleData.getNumDecimalSep() + + "00 [$" + + rCurrency + + "]"; } sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, true); if (nNewKey == -1) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index bca87cd88aaa..69b6142d702f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1162,10 +1162,6 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText ) if (nStartPosition > 0) { - OUStringBuffer aBuf; - aBuf.append(aNew.subView(0, nStartPosition)); - aBuf.append(u'\x25BA'); - aBuf.append(aNew.subView(nStartPosition)); nArgs = ppFDesc->getParameterCount(); sal_Int16 nVarArgsSet = 0; if ( nArgs >= PAIRED_VAR_ARGS ) @@ -1180,9 +1176,11 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText ) } if ( nVarArgsSet > 0 && nActive > nArgs ) nActive = nArgs - (nActive - nArgs) % nVarArgsSet; - aBuf.append( " : " ); - aBuf.append( ppFDesc->getParameterDescription(nActive-1) ); - aNew = aBuf.makeStringAndClear(); + aNew = OUString::Concat(aNew.subView(0, nStartPosition)) + + u"\x25BA" + + aNew.subView(nStartPosition) + + " : " + + ppFDesc->getParameterDescription(nActive-1); if (eMode != SC_INPUT_TOP) { ShowTipBelow( aNew ); diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 68aacb9275ba..687578c251e5 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -169,13 +169,13 @@ void ScFunctionWin::SetDescription() { pDesc->initArgumentInfo(); // full argument info is needed - OUStringBuffer aBuf(xFuncList->get_selected_text()); - aBuf.append(":\n\n"); - aBuf.append(pDesc->GetParamList()); - aBuf.append("\n\n"); - aBuf.append(*pDesc->mxFuncDesc); + OUString aBuf = xFuncList->get_selected_text() + + ":\n\n" + + pDesc->GetParamList() + + "\n\n" + + *pDesc->mxFuncDesc; - xFiFuncDesc->set_label(aBuf.makeStringAndClear()); + xFiFuncDesc->set_label(aBuf); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index f6edfe5909de..59c0868e7c31 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4286,29 +4286,29 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos // TODO: we could define ocQuote for " const OUString aQuote('"'); const OUString& sSep = ScCompiler::GetNativeSymbol( ocSep); - OUStringBuffer aFormula; - aFormula.append('='); - aFormula.append(ScCompiler::GetNativeSymbol(ocDde)); - aFormula.append(ScCompiler::GetNativeSymbol(ocOpen)); - aFormula.append(aQuote); - aFormula.append(aApp); - aFormula.append(aQuote); - aFormula.append(sSep); - aFormula.append(aQuote); - aFormula.append(aTopic); - aFormula.append(aQuote); - aFormula.append(sSep); - aFormula.append(aQuote); - aFormula.append(aItem); - aFormula.append(aQuote); - aFormula.append(ScCompiler::GetNativeSymbol(ocClose)); + OUString aFormula = + "=" + + ScCompiler::GetNativeSymbol(ocDde) + + ScCompiler::GetNativeSymbol(ocOpen) + + aQuote + + aApp + + aQuote + + sSep + + aQuote + + aTopic + + aQuote + + sSep + + aQuote + + aItem + + aQuote + + ScCompiler::GetNativeSymbol(ocClose); pView->DoneBlockMode(); pView->InitBlockMode( nDestPosX, nDestPosY, nThisTab ); pView->MarkCursor( nDestPosX + nSizeX - 1, nDestPosY + nSizeY - 1, nThisTab ); - pView->EnterMatrix( aFormula.makeStringAndClear(), ::formula::FormulaGrammar::GRAM_NATIVE ); + pView->EnterMatrix( aFormula, ::formula::FormulaGrammar::GRAM_NATIVE ); pView->MarkRange( aDest, false ); pView->SetCursor( aDest.aStart.Col(), aDest.aStart.Row() ); diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 282d631a6f21..041f77a65c40 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -141,15 +141,14 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args ) { Any aError( ::cppu::getCaughtException() ); - OUStringBuffer buf; - buf.append( "MasterScriptProvider::initialize: caught " ); - buf.append( aError.getValueTypeName() ); - buf.append( ":" ); - Exception aException; aError >>= aException; - buf.append ( aException.Message ); - throw lang::WrappedTargetException( buf.makeStringAndClear(), *this, aError ); + OUString buf = + "MasterScriptProvider::initialize: caught " + + aError.getValueTypeName() + + ":" + + aException.Message; + throw lang::WrappedTargetException( buf, *this, aError ); } if ( m_xInvocationContext.is() && m_xInvocationContext != m_xModel ) diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 94d0e1fd041c..9247f4b9fa98 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -190,16 +190,13 @@ ScriptingFrameworkURIHelper::getLanguagePath(const OUString& rLanguagePart) OUString SAL_CALL ScriptingFrameworkURIHelper::getScriptURI(const OUString& rStorageURI) { - OUStringBuffer buf(120); - - buf.append("vnd.sun.star.script:"); - buf.append(getLanguagePart(rStorageURI)); - buf.append("?language="); - buf.append(m_sLanguage); - buf.append("&location="); - buf.append(m_sLocation); - - return buf.makeStringAndClear(); + return + "vnd.sun.star.script:" + + getLanguagePart(rStorageURI) + + "?language=" + + m_sLanguage + + "&location=" + + m_sLocation; } OUString SAL_CALL @@ -219,14 +216,7 @@ ScriptingFrameworkURIHelper::getStorageURI(const OUString& rScriptURI) uno::Reference< uno::XInterface >(), 1 ); } - OUStringBuffer buf(120); - buf.append(m_sBaseURI); - buf.append("/"); - buf.append(getLanguagePath(sLanguagePart)); - - OUString result = buf.makeStringAndClear(); - - return result; + return m_sBaseURI + "/" + getLanguagePath(sLanguagePart); } OUString SAL_CALL diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index c65a5d4c48df..8279ddf33b4e 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -89,16 +89,10 @@ void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber ) aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); // Start the writing - OStringBuffer aBuffer; - - aBuffer.append( "slide_preview\n" ); - - aBuffer.append( static_cast<sal_Int32>(aSlideNumber) ); - aBuffer.append( "\n" ); - - aBuffer.append( aEncodedShortString.getStr() ); - aBuffer.append( "\n\n" ); - pTransmitter->addMessage( aBuffer.makeStringAndClear(), + OString aBuffer = "slide_preview\n" + + OString::number(aSlideNumber) + + "\n" + aEncodedShortString + "\n\n"; + pTransmitter->addMessage( aBuffer, Transmitter::PRIORITY_LOW ); } diff --git a/sdext/source/pdfimport/misc/pdfihelper.cxx b/sdext/source/pdfimport/misc/pdfihelper.cxx index bd29d406b1be..8268be6b9d46 100644 --- a/sdext/source/pdfimport/misc/pdfihelper.cxx +++ b/sdext/source/pdfimport/misc/pdfihelper.cxx @@ -107,20 +107,12 @@ OUString pdfi::getPercentString(double value) OUString pdfi::unitMMString( double fMM ) { - OUStringBuffer aBuf( 32 ); - aBuf.append( rtl_math_round( fMM, 2, rtl_math_RoundingMode_Floor ) ); - aBuf.append( "mm" ); - - return aBuf.makeStringAndClear(); + return OUString::number(rtl_math_round( fMM, 2, rtl_math_RoundingMode_Floor )) + "mm"; } OUString pdfi::convertPixelToUnitString( double fPix ) { - OUStringBuffer aBuf( 32 ); - aBuf.append( rtl_math_round( convPx2mm( fPix ), 2, rtl_math_RoundingMode_Floor ) ); - aBuf.append( "mm" ); - - return aBuf.makeStringAndClear(); + return OUString::number( rtl_math_round( convPx2mm( fPix ), 2, rtl_math_RoundingMode_Floor ) ) + "mm"; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 3ae22dedd324..91edc7d0ef15 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -727,12 +727,12 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext ); eCurrentApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xCurrentFrame ) ); - OUStringBuffer aPath("org.openoffice.Office.UI.ToolbarMode/Applications/"); - aPath.append( lcl_getAppName( eCurrentApp ) ); + OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + + lcl_getAppName( eCurrentApp ); const utl::OConfigurationTreeRoot aAppNode( xContext, - aPath.makeStringAndClear(), + aPath, true); if ( !aAppNode.isValid() ) { @@ -793,14 +793,14 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) std::vector<OUString> aBackupList; OUString aSidebarMode; - OUStringBuffer aPath( "org.openoffice.Office.UI.ToolbarMode/Applications/" ); - aPath.append( lcl_getAppName( eApp ) ); - aPath.append( "/Modes" ); + OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + + lcl_getAppName( eApp ) + + "/Modes"; // Read mode settings const utl::OConfigurationTreeRoot aModesNode( xContext, - aPath.makeStringAndClear(), + aPath, true); if ( !aModesNode.isValid() ) { @@ -965,11 +965,10 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( xLayoutManager.is() ) { - OUStringBuffer aBuf( "private:resource/toolbar/" ); - aBuf.append( pToolbarName->GetValue() ); + OUString aToolbarName = "private:resource/toolbar/" + + pToolbarName->GetValue(); // Evaluate Parameter - OUString aToolbarName( aBuf.makeStringAndClear() ); bool bShow( !xLayoutManager->isElementVisible( aToolbarName )); if ( bShow ) diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index 95ace6cf665e..f77d557f09f4 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -314,11 +314,12 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, css::uno::Any& rRetval, else { // direct API call on a specified object - OUStringBuffer aCall; - aCall.append('[').append(INetURLObject::decode(aMacro.subView(6), - INetURLObject::DecodeMechanism::WithCharset)); - aCall.append(']'); - pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear()); + OUString aCall = + "[" + + INetURLObject::decode(aMacro.subView(6), + INetURLObject::DecodeMechanism::WithCharset) + + "]"; + pAppMgr->GetLib(0)->Execute(aCall); nErr = SbxBase::GetError(); } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 9b85b791f7a4..b10b17853914 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -709,15 +709,12 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) { uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); - OUStringBuffer aBuffer( 60 ); auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:PrintDefault", vcl::CommandInfoProvider::GetModuleIdentifier(xFrame)); - aBuffer.append(vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); - aBuffer.append( " (" ); - aBuffer.append( aPrinterName ); - aBuffer.append(')'); + OUString val = vcl::CommandInfoProvider::GetLabelForCommand(aProperties) + + " (" + aPrinterName + ")"; - rSet.Put( SfxStringItem( SID_PRINTDOCDIRECT, aBuffer.makeStringAndClear() ) ); + rSet.Put( SfxStringItem( SID_PRINTDOCDIRECT, val ) ); } } break; diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx index b6e926bd2e7c..f8717b37b9dd 100644 --- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx +++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx @@ -94,15 +94,14 @@ Factory::createVndSunStarPkgUrlReference( " XVndSunStarPkgUrlReferenceFactory.createVndSunStarPkgUrlReference"); } if (authority->isAbsolute() && !authority->hasFragment()) { - OUStringBuffer buf(128); - buf.append("vnd.sun.star.pkg://"); - buf.append( + OUString buf = + "vnd.sun.star.pkg://" + rtl::Uri::encode( authority->getUriReference(), rtl_UriCharClassRegName, - rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8)); + rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8); css::uno::Reference< css::uri::XUriReference > uriRef( css::uri::UriReferenceFactory::create(m_context)->parse( - buf.makeStringAndClear())); + buf)); return uriRef; } else { return css::uno::Reference< css::uri::XUriReference >(); diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx index 39542232f33f..c68462860c35 100644 --- a/svx/source/engine3d/cube3d.cxx +++ b/svx/source/engine3d/cube3d.cxx @@ -134,17 +134,14 @@ void E3dCubeObj::SetPosIsCenter(bool bNew) OUString E3dCubeObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulCube3d)); + OUString sName = SvxResId(STR_ObjNameSingulCube3d); OUString aName(GetName()); if (!aName.isEmpty()) { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); + sName += " \'" + aName + "'"; } - return sName.makeStringAndClear(); + return sName; } // Get the name of the object (plural) diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index 605851d90476..d0cb345755a3 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -132,17 +132,14 @@ void E3dExtrudeObj::SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew) OUString E3dExtrudeObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulExtrude3d)); + OUString sName(SvxResId(STR_ObjNameSingulExtrude3d)); OUString aName(GetName()); if (!aName.isEmpty()) { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); + sName += " '" + aName + "'"; } - return sName.makeStringAndClear(); + return sName; } // Get the name of the object (plural) diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx index ef80d9379202..e811d0eebfeb 100644 --- a/svx/source/engine3d/lathe3d.cxx +++ b/svx/source/engine3d/lathe3d.cxx @@ -159,17 +159,14 @@ void E3dLatheObj::SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew) OUString E3dLatheObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulLathe3d)); + OUString sName(SvxResId(STR_ObjNameSingulLathe3d)); OUString aName(GetName()); if (!aName.isEmpty()) { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); + sName += " '" + aName + "'"; } - return sName.makeStringAndClear(); + return sName; } // Get the name of the object (plural) diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index f12780305615..9f9263b02587 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -388,17 +388,14 @@ basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const // Get the name of the object (singular) OUString E3dObject::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulObj3d)); + OUString sName = SvxResId(STR_ObjNameSingulObj3d); OUString aName(GetName()); if (!aName.isEmpty()) { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); + sName += " '" + aName + "'"; } - return sName.makeStringAndClear(); + return sName; } // Get the name of the object (plural) diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0589b1cc9e73..099f3fb75f7d 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -574,17 +574,12 @@ void E3dScene::RotateScene (const Point& rRef, double sn, double cs) OUString E3dScene::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulScene3d)); + OUString sName(SvxResId(STR_ObjNameSingulScene3d)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } - return sName.makeStringAndClear(); + sName += " '" + aName + "'"; + return sName; } OUString E3dScene::TakeObjNamePlural() const diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx index b36e5248faa1..7cc16a82ff65 100644 --- a/svx/source/engine3d/sphere3d.cxx +++ b/svx/source/engine3d/sphere3d.cxx @@ -129,17 +129,14 @@ void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew) OUString E3dSphereObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulSphere3d)); + OUString sName(SvxResId(STR_ObjNameSingulSphere3d)); OUString aName(GetName()); if (!aName.isEmpty()) { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); + sName += " '" + aName + "'"; } - return sName.makeStringAndClear(); + return sName; } // Get the name of the object (plural) diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 2ad95ffd0a94..ba2875998cdc 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2866,12 +2866,10 @@ void FmXFormShell::impl_collectFormSearchContexts_nothrow_Lock( const Reference< sCurrentFormName = xNamed->getName(); // the name of the current form - OUStringBuffer sCompleteCurrentName( sCurrentFormName ); + OUString sCompleteCurrentName( sCurrentFormName ); if ( !_rCurrentLevelPrefix.isEmpty() ) { - sCompleteCurrentName.append( " (" ); - sCompleteCurrentName.append ( _rCurrentLevelPrefix ); - sCompleteCurrentName.append( ")" ); + sCompleteCurrentName += " (" + _rCurrentLevelPrefix + ")"; } // the prefix for the next level @@ -2882,7 +2880,7 @@ void FmXFormShell::impl_collectFormSearchContexts_nothrow_Lock( const Reference< // remember both the form and its "display name" _out_rForms.push_back( xCurrentAsForm ); - _out_rNames.push_back( sCompleteCurrentName.makeStringAndClear() ); + _out_rNames.push_back( sCompleteCurrentName ); // and descend impl_collectFormSearchContexts_nothrow_Lock( diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 409915bc1c8a..e5ccc84e7cae 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2782,16 +2782,11 @@ SdrObjCustomShape* SdrObjCustomShape::CloneSdrObject(SdrModel& rTargetModel) con OUString SdrObjCustomShape::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulCUSTOMSHAPE)); + OUString sName(SvxResId(STR_ObjNameSingulCUSTOMSHAPE)); OUString aNm(GetName()); if (!aNm.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aNm); - sName.append('\''); - } - return sName.makeStringAndClear(); + sName += " '" + aNm + "'"; + return sName; } OUString SdrObjCustomShape::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 8a30af0054e5..b0996d5d8405 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1055,17 +1055,12 @@ SdrObject* SdrObject::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrObject::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulNONE)); + OUString sName(SvxResId(STR_ObjNameSingulNONE)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } - return sName.makeStringAndClear(); + sName += " '" + aName + "'"; + return sName; } OUString SdrObject::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 6be4d7e7cdac..fdec2552981a 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -247,18 +247,13 @@ SdrCaptionObj* SdrCaptionObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrCaptionObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulCAPTION)); + OUString sName(SvxResId(STR_ObjNameSingulCAPTION)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrCaptionObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 8c16d470d3f3..4250b762ea86 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -338,17 +338,12 @@ OUString SdrCircObj::TakeObjNameSingul() const default: break; } } - OUStringBuffer sName(SvxResId(pID)); + OUString sName(SvxResId(pID)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } - return sName.makeStringAndClear(); + sName += " '" + aName + "'"; + return sName; } OUString SdrCircObj::TakeObjNamePlural() const @@ -621,12 +616,10 @@ OUString SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const { const Degree100 nAngle(1 == rDrag.GetHdl()->GetPointNum() ? nStartAngle : nEndAngle); - OUStringBuffer aBuf(ImpGetDescriptionStr(STR_DragCircAngle)); - aBuf.append(" ("); - aBuf.append(SdrModel::GetAngleString(nAngle)); - aBuf.append(')'); - - return aBuf.makeStringAndClear(); + return ImpGetDescriptionStr(STR_DragCircAngle) + + " (" + + SdrModel::GetAngleString(nAngle) + + ")"; } else { diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 512d7b048bdc..c9411425e2e5 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1671,17 +1671,12 @@ SdrEdgeObj* SdrEdgeObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrEdgeObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulEDGE)); + OUString sName(SvxResId(STR_ObjNameSingulEDGE)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } - return sName.makeStringAndClear(); + sName += " '" + aName + "'"; + return sName; } OUString SdrEdgeObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index c71cff4b279e..620dfc154cf8 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -225,28 +225,23 @@ SdrObjGroup* SdrObjGroup::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrObjGroup::TakeObjNameSingul() const { - OUStringBuffer sName; + OUString sName; if(0 == GetObjCount()) { - sName.append(SvxResId(STR_ObjNameSingulGRUPEMPTY)); + sName = SvxResId(STR_ObjNameSingulGRUPEMPTY); } else { - sName.append(SvxResId(STR_ObjNameSingulGRUP)); + sName = SvxResId(STR_ObjNameSingulGRUP); } const OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index dcf0858705e5..db470844e4e0 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -714,18 +714,13 @@ SdrMeasureObj* SdrMeasureObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrMeasureObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulMEASURE)); + OUString sName(SvxResId(STR_ObjNameSingulMEASURE)); OUString aName( GetName() ); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrMeasureObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 5826d3e72bed..515bdff11b42 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -118,19 +118,14 @@ SdrObjKind SdrMediaObj::GetObjIdentifier() const OUString SdrMediaObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulMEDIA)); + OUString sName(SvxResId(STR_ObjNameSingulMEDIA)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrMediaObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx index d4f0bc208838..d0eb579cc6dd 100644 --- a/svx/source/svdraw/svdopage.cxx +++ b/svx/source/svdraw/svdopage.cxx @@ -159,18 +159,13 @@ SdrPageObj* SdrPageObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrPageObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulPAGE)); + OUString sName(SvxResId(STR_ObjNameSingulPAGE)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrPageObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index dc6f6ce3df5d..a9aaefae3239 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1832,7 +1832,7 @@ SdrPathObj* SdrPathObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrPathObj::TakeObjNameSingul() const { - OUStringBuffer sName; + OUString sName; if(OBJ_LINE == meKind) { @@ -1867,7 +1867,7 @@ OUString SdrPathObj::TakeObjNameSingul() const } } - sName.append(SvxResId(pId)); + sName = SvxResId(pId); } else if(OBJ_PLIN == meKind || OBJ_POLY == meKind) { @@ -1885,7 +1885,7 @@ OUString SdrPathObj::TakeObjNameSingul() const pId = STR_ObjNameSingulPLIN; } - sName.append(SvxResId(pId)); + sName = SvxResId(pId); } else { @@ -1906,35 +1906,29 @@ OUString SdrPathObj::TakeObjNameSingul() const pId = STR_ObjNameSingulPLIN_PointCount; } - OUString sTemp(SvxResId(pId)); // #i96537# - sName.append(sTemp.replaceFirst("%2", OUString::number(nPointCount))); + sName = SvxResId(pId).replaceFirst("%2", OUString::number(nPointCount)); } } else { switch (meKind) { - case OBJ_PATHLINE: sName.append(SvxResId(STR_ObjNameSingulPATHLINE)); break; - case OBJ_FREELINE: sName.append(SvxResId(STR_ObjNameSingulFREELINE)); break; - case OBJ_SPLNLINE: sName.append(SvxResId(STR_ObjNameSingulNATSPLN)); break; - case OBJ_PATHFILL: sName.append(SvxResId(STR_ObjNameSingulPATHFILL)); break; - case OBJ_FREEFILL: sName.append(SvxResId(STR_ObjNameSingulFREEFILL)); break; - case OBJ_SPLNFILL: sName.append(SvxResId(STR_ObjNameSingulPERSPLN)); break; + case OBJ_PATHLINE: sName = SvxResId(STR_ObjNameSingulPATHLINE); break; + case OBJ_FREELINE: sName = SvxResId(STR_ObjNameSingulFREELINE); break; + case OBJ_SPLNLINE: sName = SvxResId(STR_ObjNameSingulNATSPLN); break; + case OBJ_PATHFILL: sName = SvxResId(STR_ObjNameSingulPATHFILL); break; + case OBJ_FREEFILL: sName = SvxResId(STR_ObjNameSingulFREEFILL); break; + case OBJ_SPLNFILL: sName = SvxResId(STR_ObjNameSingulPERSPLN); break; default: break; } } OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrPathObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index bead75b27b44..825bf866ee96 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -207,8 +207,6 @@ OUString SdrRectObj::TakeObjNameSingul() const return SdrTextObj::TakeObjNameSingul(); } - OUStringBuffer sName; - bool bRounded = GetEckenradius() != 0; // rounded down const char* pResId = bRounded ? STR_ObjNameSingulRECTRND : STR_ObjNameSingulRECT; if (aGeo.nShearAngle) @@ -219,18 +217,13 @@ OUString SdrRectObj::TakeObjNameSingul() const { pResId = bRounded ? STR_ObjNameSingulQUADRND : STR_ObjNameSingulQUAD; // square } - sName.append(SvxResId(pResId)); + OUString sName(SvxResId(pResId)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrRectObj::TakeObjNamePlural() const @@ -422,12 +415,10 @@ OUString SdrRectObj::getSpecialDragComment(const SdrDragStat& rDrag) const if(nRad < 0) nRad = 0; - OUStringBuffer aBuf(ImpGetDescriptionStr(STR_DragRectEckRad)); - aBuf.append(" ("); - aBuf.append(GetMetrStr(nRad)); - aBuf.append(')'); - - return aBuf.makeStringAndClear(); + return ImpGetDescriptionStr(STR_DragRectEckRad) + + " (" + + GetMetrStr(nRad) + + ")"; } else { diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 1d3f0ba2e4bf..c52ef1dff5ce 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1017,18 +1017,13 @@ OUString SdrTextObj::TakeObjNameSingul() const } } - OUStringBuffer sName(aStr); + OUString sName(aStr); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrTextObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 648463460622..eebe934ddf10 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -267,18 +267,13 @@ void SdrUnoObj::SetContextWritingMode( const sal_Int16 _nContextWritingMode ) OUString SdrUnoObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulUno)); + OUString sName(SvxResId(STR_ObjNameSingulUno)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrUnoObj::TakeObjNamePlural() const diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 204b67057c3f..0bc2a393a400 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -145,28 +145,18 @@ SdrVirtObj* SdrVirtObj::CloneSdrObject(SdrModel& rTargetModel) const OUString SdrVirtObj::TakeObjNameSingul() const { - OUStringBuffer sName(rRefObj.TakeObjNameSingul()); - sName.insert(0, '['); - sName.append(']'); + OUString sName = "[" + rRefObj.TakeObjNameSingul() + "]"; OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } OUString SdrVirtObj::TakeObjNamePlural() const { - OUStringBuffer sName(rRefObj.TakeObjNamePlural()); - sName.insert(0, '['); - sName.append(']'); - return sName.makeStringAndClear(); + return "[" + rRefObj.TakeObjNamePlural() + "]"; } bool SdrVirtObj::HasLimitedRotation() const diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 5731c12acdd9..9acef67c552f 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1756,18 +1756,13 @@ EEAnchorMode SdrTableObj::GetOutlinerViewAnchorMode() const OUString SdrTableObj::TakeObjNameSingul() const { - OUStringBuffer sName(SvxResId(STR_ObjNameSingulTable)); + OUString sName(SvxResId(STR_ObjNameSingulTable)); OUString aName(GetName()); if (!aName.isEmpty()) - { - sName.append(' '); - sName.append('\''); - sName.append(aName); - sName.append('\''); - } + sName += " '" + aName + "'"; - return sName.makeStringAndClear(); + return sName; } diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 40b30bebaf1d..a67a08aab16b 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -905,11 +905,9 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u throw UnknownPropertyException(); bBool = false; - OUStringBuffer sHelpURL; - sHelpURL.append ( INET_HID_SCHEME ); SwEditWin &rEditWin = pView->GetEditWin(); - sHelpURL.append( OUString::fromUtf8( rEditWin.GetHelpId() ) ); - rValue <<= sHelpURL.makeStringAndClear(); + OUString sHelpURL = INET_HID_SCHEME + OUString::fromUtf8( rEditWin.GetHelpId() ); + rValue <<= sHelpURL; } break; case HANDLE_VIEWSET_HORI_RULER_METRIC: diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index effcdae4380e..ce94e6bb6af1 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -189,13 +189,10 @@ css::uno::Sequence< OUString > VCLXPrinterPropertySet::getFormDescriptions( ) for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ ) { // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId> - OUStringBuffer aDescr( "*;*;" ); - aDescr.append(GetPrinter()->GetPaperBinName( n )); - aDescr.append(';'); - aDescr.append(static_cast<sal_Int32>(n)); - aDescr.append(";*;*"); + OUString aDescr = "*;*;" + GetPrinter()->GetPaperBinName( n ) + ";" + + OUString::number(n) + ";*;*"; - aDescriptions.getArray()[n] = aDescr.makeStringAndClear(); + aDescriptions.getArray()[n] = aDescr; } return aDescriptions; } diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index e2a0e9770d13..62889bae4733 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -159,9 +159,9 @@ int INetMIMEMessageStream::GetMsgLine(char* pData, sal_uInt32 nSize) if (pSourceMsg->IsMultipart()) { // Insert multipart delimiter. - OStringBuffer aDelim("--"); - aDelim.append(pSourceMsg->GetMultipartBoundary()); - aDelim.append("\r\n"); + OString aDelim = "--" + + pSourceMsg->GetMultipartBoundary() + + "\r\n"; memcpy(pData, aDelim.getStr(), aDelim.getLength()); @@ -177,9 +177,9 @@ int INetMIMEMessageStream::GetMsgLine(char* pData, sal_uInt32 nSize) if (pSourceMsg->IsMultipart()) { // Insert close delimiter. - OStringBuffer aDelim("--"); - aDelim.append(pSourceMsg->GetMultipartBoundary()); - aDelim.append("--\r\n"); + OString aDelim = "--" + + pSourceMsg->GetMultipartBoundary() + + "--\r\n"; memcpy(pData, aDelim.getStr(), aDelim.getLength()); diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 7b4461aca83a..d6b0a41e029d 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -1091,10 +1091,10 @@ void addChaffWhenEncryptedStorage(const uno::Reference< io::XOutputStream > &rSt reinterpret_cast<sal_Int8*>(pBuffer), preamblelen); rStream->writeBytes(buf); - OStringBuffer aComment; - aComment.append("<!--"); - aComment.append(comphelper::xml::makeXMLChaff()); - aComment.append("-->"); + OString aComment = + "<!--" + + comphelper::xml::makeXMLChaff() + + "-->"; buf = uno::Sequence<sal_Int8>( reinterpret_cast<const sal_Int8*>(aComment.getStr()), aComment.getLength()); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index d5fcad21571e..a8bd2d5dc37e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -70,8 +70,7 @@ static OString ImplGetDialogText( Dialog* pDialog ) { - OStringBuffer aErrorStr(OUStringToOString( - pDialog->GetText(), RTL_TEXTENCODING_UTF8)); + OUString aErrorStr(pDialog->GetText()); OUString sMessage; if (MessageDialog* pMessDialog = dynamic_cast<MessageDialog*>(pDialog)) @@ -81,11 +80,9 @@ static OString ImplGetDialogText( Dialog* pDialog ) if (!sMessage.isEmpty()) { - aErrorStr.append(", "); - aErrorStr.append(OUStringToOString( - sMessage, RTL_TEXTENCODING_UTF8)); + aErrorStr += ", " + sMessage; } - return aErrorStr.makeStringAndClear(); + return OUStringToOString(aErrorStr, RTL_TEXTENCODING_UTF8); } static bool ImplIsMnemonicCtrl( vcl::Window* pWindow ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a7aeb0c7f9c3..94c8cc2df391 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -124,18 +124,14 @@ namespace pWindow = pTempWin; } - OStringBuffer aErrorString; - aErrorString.append(' '); - aErrorString.append(typeid( *pWindow ).name()); - aErrorString.append("("); - aErrorString.append( - OUStringToOString( - pWindow->GetText(), - RTL_TEXTENCODING_UTF8 - ) - ); - aErrorString.append(")"); - return aErrorString.makeStringAndClear(); + return OString::Concat(" ") + + typeid( *pWindow ).name() + + "(" + + OUStringToOString( + pWindow->GetText(), + RTL_TEXTENCODING_UTF8 + ) + + ")"; } } #endif @@ -264,9 +260,9 @@ void Window::dispose() if ( mpWindowImpl->mpFirstChild ) { - OStringBuffer aTempStr("Window ("); - aTempStr.append(lcl_createWindowInfo(this)); - aTempStr.append(") with live children destroyed: "); + OStringBuffer aTempStr = "Window (" + + lcl_createWindowInfo(this) + + ") with live children destroyed: "; pTempWin = mpWindowImpl->mpFirstChild; while ( pTempWin ) { @@ -291,15 +287,14 @@ void Window::dispose() } if ( bError ) { - OStringBuffer aTempStr; - aTempStr.append("Window ("); - aTempStr.append(lcl_createWindowInfo(this)); - aTempStr.append(") with live SystemWindows destroyed: "); - aTempStr.append(aErrorStr); + OString aTempStr = + "Window (" + + lcl_createWindowInfo(this) + + ") with live SystemWindows destroyed: " + + aErrorStr; OSL_FAIL(aTempStr.getStr()); // abort in debug builds, must be fixed! - Application::Abort(OStringToOUString( - aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); + Application::Abort(OStringToOUString(aTempStr, RTL_TEXTENCODING_UTF8)); } } @@ -316,19 +311,19 @@ void Window::dispose() } if ( bError ) { - OStringBuffer aTempStr( "Window (" ); - aTempStr.append(lcl_createWindowInfo(this)); - aTempStr.append(") with live SystemWindows destroyed: "); - aTempStr.append(aErrorStr); + OString aTempStr = "Window (" + + lcl_createWindowInfo(this) + + ") with live SystemWindows destroyed: " + + aErrorStr; OSL_FAIL( aTempStr.getStr() ); - Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed! + Application::Abort(OStringToOUString(aTempStr, RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed! } if ( mpWindowImpl->mpFirstOverlap ) { - OStringBuffer aTempStr("Window ("); - aTempStr.append(lcl_createWindowInfo(this)); - aTempStr.append(") with live SystemWindows destroyed: "); + OStringBuffer aTempStr = "Window (" + + lcl_createWindowInfo(this) + + ") with live SystemWindows destroyed: "; pTempWin = mpWindowImpl->mpFirstOverlap; while ( pTempWin ) { @@ -352,11 +347,11 @@ void Window::dispose() } if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) ) { - OStringBuffer aTempStr("Window ("); - aTempStr.append(lcl_createWindowInfo(this)); - aTempStr.append(") still in TaskPanelList!"); + OString aTempStr = "Window (" + + lcl_createWindowInfo(this) + + ") still in TaskPanelList!"; OSL_FAIL( aTempStr.getStr() ); - Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed! + Application::Abort(OStringToOUString(aTempStr, RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed! } } #endif diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 136cf0d2559b..b6a4c4ad474f 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -224,9 +224,7 @@ static void BuildSmPropertyList() pSmProps[ eRestartCommand ].vals = new SmPropValue[3]; pSmProps[ eRestartCommand ].vals[0].length = aExec.getLength()+1; pSmProps[ eRestartCommand ].vals[0].value = strdup( aExec.getStr() ); - OStringBuffer aRestartOption; - aRestartOption.append("--session="); - aRestartOption.append(SessionManagerClient::getSessionID()); + OString aRestartOption = "--session=" + SessionManagerClient::getSessionID(); pSmProps[ eRestartCommand ].vals[1].length = aRestartOption.getLength()+1; pSmProps[ eRestartCommand ].vals[1].value = strdup(aRestartOption.getStr()); OString aRestartOptionNoLogo("--nologo"); diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index d31d145504b2..a04f57a632e6 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -318,11 +318,8 @@ RTFError RTFTokenizer::dispatchKeyword(OString const& rKeyword, bool bParam, int OUString RTFTokenizer::getPosition() { - OUStringBuffer aRet; - aRet.append(m_nLineNumber + 1); - aRet.append(","); - aRet.append(sal_Int32(Strm().Tell() - m_nLineStartPos + 1)); - return aRet.makeStringAndClear(); + return OUString::number(m_nLineNumber + 1) + "," + + OUString::number(Strm().Tell() - m_nLineStartPos + 1); } } // namespace writerfilter::rtftok diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 32312229c1a9..c5bcc2a4db95 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -882,10 +882,7 @@ SvXMLExport::EnsureNamespace(OUString const & i_rNamespace) // add the namespace to the map and as attribute mpNamespaceMap->Add( sPrefix, i_rNamespace ); - buf.append( GetXMLToken(XML_XMLNS) ); - buf.append( ':' ); - buf.append( sPrefix ); - AddAttribute( buf.makeStringAndClear(), i_rNamespace ); + AddAttribute( GetXMLToken(XML_XMLNS) + ":" + sPrefix, i_rNamespace ); } else { diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index b676d26e898c..027bef033031 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -242,8 +242,7 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, // text:level OUStringBuffer sTmp; - sTmp.append( nLevel + 1 ); - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() ); + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, OUString::number( nLevel + 1 ) ); // #i110694#: no style-name on list-level-style-image // #i116149#: neither prefix/suffix if (NumberingType::BITMAP != eType) |