diff options
145 files changed, 436 insertions, 279 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 48f429848f66..9da55fa318a8 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -175,13 +175,13 @@ void lcl_SeparateNameAndIndex( const OUString& rVName, OUString& rVar, OUString& { sal_uInt16 nLastChar = rVar.getLength()-1; if ( cSuffixes.find(rVar[ nLastChar ] ) != std::u16string_view::npos ) - rVar = rVar.replaceAt( nLastChar, 1, "" ); + rVar = rVar.replaceAt( nLastChar, 1, u"" ); } if ( !rIndex.isEmpty() ) { sal_uInt16 nLastChar = rIndex.getLength()-1; if ( cSuffixes.find(rIndex[ nLastChar ] ) != std::u16string_view::npos ) - rIndex = rIndex.replaceAt( nLastChar, 1, "" ); + rIndex = rIndex.replaceAt( nLastChar, 1, u"" ); } } @@ -373,7 +373,7 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt ) { sal_uInt16 nLastChar = aWord.getLength() - 1; if ( cSuffixes.find(aWord[ nLastChar ] ) != std::u16string_view::npos ) - aWord = aWord.replaceAt( nLastChar, 1, "" ); + aWord = aWord.replaceAt( nLastChar, 1, u"" ); SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); if (SbxVariable const* pVar = IsSbxVariable(pSBX)) { diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 00c90e30379d..bad307f27dd6 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2853,7 +2853,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 ) sal_Int32 iComma = aStr.indexOf(','); if( iComma >= 0 ) { - aStr = aStr.replaceAt(iComma, 1, "."); + aStr = aStr.replaceAt(iComma, 1, u"."); } sal_Int32 nParseEnd = 0; rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx index e8daa87d5c95..18adcebf7187 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -206,7 +206,7 @@ sal_Int16 getShortForLongAlso( const css::uno::Any& rAny ); OOO_DLLPUBLIC_CHARTTOOLS bool replaceParamterInString( OUString & rInOutResourceString, const OUString & rParamToReplace, - const OUString & rReplaceWith ); + std::u16string_view rReplaceWith ); } //namespace chart diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index b4b4cbf62e72..2695d2da3418 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -519,7 +519,7 @@ sal_Int16 getShortForLongAlso( const uno::Any& rAny ) bool replaceParamterInString( OUString & rInOutResourceString, const OUString & rParamToReplace, - const OUString & rReplaceWith ) + std::u16string_view rReplaceWith ) { sal_Int32 nPos = rInOutResourceString.indexOf( rParamToReplace ); if( nPos == -1 ) diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx index 405a4acaeb68..b656389def83 100644 --- a/comphelper/source/misc/logging.cxx +++ b/comphelper/source/misc/logging.cxx @@ -94,7 +94,7 @@ namespace comphelper namespace { - void lcl_replaceParameter( OUString& _inout_Message, const char* _rPlaceHolder, const OUString& _rReplacement ) + void lcl_replaceParameter( OUString& _inout_Message, const char* _rPlaceHolder, std::u16string_view _rReplacement ) { sal_Int32 nPlaceholderPosition = _inout_Message.indexOfAsciiL( _rPlaceHolder, strlen(_rPlaceHolder) ); OSL_ENSURE( nPlaceholderPosition >= 0, "lcl_replaceParameter: placeholder not found!" ); diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index e1217dc5560f..a3ee9bc58521 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -465,7 +465,7 @@ OUString removeAny(std::u16string_view rIn, } OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok, - const OUString& rNewToken) + std::u16string_view rNewToken) { sal_Int32 nLen = rIn.getLength(); sal_Int32 nTok = 0; diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index 81338b3dc9fa..38f20af0926c 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -90,7 +90,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, nIndex += 2; nIndex = aTemp.indexOf(sQuot,nIndex); if(nIndex != -1) - aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), "\'\'"); + aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), u"\'\'"); } while (nIndex != -1); aRet.append(aTemp); diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 0adfe23bdac9..5f07a272cec2 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -122,7 +122,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const { sal_Int32 nIndex = sTypeName.indexOf(sAutoIncrementValue); if (nIndex != -1) - sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex,OUString()); + sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex, u""); } if ( (nPrecision > 0 || nScale > 0) && bUseLiteral ) @@ -387,7 +387,7 @@ OUString createSqlCreateTableStatement( const Reference< XPropertySet >& descri else { if ( aSql.endsWith(",") ) - aSql = aSql.replaceAt(aSql.getLength()-1, 1, ")"); + aSql = aSql.replaceAt(aSql.getLength()-1, 1, u")"); else aSql += ")"; } diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 37a0d6862c62..047f9ccc7c94 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -153,7 +153,7 @@ namespace dbtools sal_Int32 nTemp = 0; while ( -1 != ( nIndex = sQuoted.indexOf( '\'',nTemp ) ) ) { - sQuoted = sQuoted.replaceAt( nIndex, 1, "''" ); + sQuoted = sQuoted.replaceAt( nIndex, 1, u"''" ); nTemp = nIndex+2; } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 90d0b9f21759..c5da1d6b2477 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -646,7 +646,7 @@ OUString ODbaseTable::getEntry(file::OConnection const * _pConnection, std::u16s // name and extension have to coincide if ( _pConnection->matchesExtension( sExt ) ) { - sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, u""); if ( sName == _sName ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index 215ffe61bdf9..ebd6f2309cc8 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -178,7 +178,7 @@ ObjectType Tables::appendObject(const OUString& rName, else { if ( sSql.endsWith(",") ) - sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")"); + sSql = sSql.replaceAt(sSql.getLength()-1, 1, u")"); else sSql += ")"; } diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 6cc70b4270f4..2d694eac94ec 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -417,7 +417,7 @@ OUString firebird::escapeWith( const OUString& sText, const char aKey, const cha aIndex = sRet.indexOf(aKey, aIndex); if ( aIndex <= 0 || aIndex >= sRet.getLength()) break; - sRet = sRet.replaceAt(aIndex, 1, OUStringChar(aEscapeChar) + OUStringChar(aKey) ); + sRet = sRet.replaceAt(aIndex, 1, rtl::OUStringConcatenation(OUStringChar(aEscapeChar) + OUStringChar(aKey)) ); aIndex += 2; } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 7c47240c27c4..68f1a82dcdd7 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -472,7 +472,7 @@ OUString OFlatTable::getEntry() const if ( m_pConnection->matchesExtension( sExt ) ) { if ( !sExt.isEmpty() ) - sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, u""); if ( sName == m_Name ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index a60898eb44f4..9a23b6052468 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -301,7 +301,7 @@ void OHSQLTable::executeStatement(const OUString& _rStatement ) { OUString sSQL = _rStatement; if(sSQL.endsWith(",")) - sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, ")"); + sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, u")"); Reference< XStatement > xStmt = getConnection()->createStatement( ); if ( xStmt.is() ) diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx index 54b8915cab63..b5b02fefc1bc 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx @@ -312,7 +312,7 @@ void OMySQLTable::executeStatement(const OUString& _rStatement) { OUString sSQL = _rStatement; if (sSQL.endsWith(",")) - sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, ")"); + sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, u")"); Reference<XStatement> xStmt = getConnection()->createStatement(); if (xStmt.is()) diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx index be962d3d7c33..9d598892d32b 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx @@ -153,7 +153,7 @@ OUString OTables::adjustSQL(const OUString& _sSql) sal_Int32 nPos = nIndex + strlen(s_sUNSIGNED); OUString sNewUnsigned(sSQL.copy(nPos, nParen - nPos + 1)); sSQL = sSQL.replaceAt(nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(), - sNewUnsigned + s_sUNSIGNED); + rtl::OUStringConcatenation(sNewUnsigned + s_sUNSIGNED)); nIndex = sSQL.indexOf(s_sUNSIGNED, nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength()); } return sSQL; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 48c55051ef6b..02056253c300 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -106,7 +106,7 @@ namespace @return The quoted string. */ - OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, const OUString& rQuotToReplace) + OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, std::u16string_view rQuotToReplace) { OUString rNewValue = rQuot + rValue; sal_Int32 nIndex = sal_Int32(-1); // Replace quotes with double quotes or the parser gets into problems @@ -757,7 +757,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c { OUString aStr = ConvertLikeToken(pParaNode, pEscNode, rParam.bInternational); rString.append(" "); - rString.append(SetQuotation(aStr,"\'","\'\'")); + rString.append(SetQuotation(aStr, "\'", u"\'\'")); } else pParaNode->impl_parseNodeToString_throw( rString, aNewParam, false ); @@ -1140,7 +1140,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale) aValue = OUString::number(aResult.Value); sal_Int32 nPos = aValue.lastIndexOf('.'); if((nPos+_nScale) < aValue.getLength()) - aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale,OUString()); + aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale, u""); aValue = aValue.replaceAt(aValue.lastIndexOf('.'),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator); return aValue; } @@ -2429,7 +2429,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet case SQLNodeType::String: if (!rString.isEmpty()) rString.append(" "); - rString.append(SetQuotation(m_aNodeValue,"\'","\'\'")); + rString.append(SetQuotation(m_aNodeValue, "\'", u"\'\'")); break; case SQLNodeType::Name: if (!rString.isEmpty()) diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx index a6f218147e71..0f8bccefd96b 100644 --- a/connectivity/source/resource/sharedresources.cxx +++ b/connectivity/source/resource/sharedresources.cxx @@ -101,7 +101,7 @@ namespace connectivity namespace { size_t lcl_substitute( OUString& _inout_rString, - const char* _pAsciiPattern, const OUString& _rReplace ) + const char* _pAsciiPattern, std::u16string_view _rReplace ) { size_t nOccurrences = 0; diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 79961fe690c2..526aa4e9c411 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2990,7 +2990,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem( namespace { - OUString ReplaceIconName(const OUString& rMessage) + OUString ReplaceIconName(std::u16string_view rMessage) { OUString name; OUString message = CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ); @@ -3009,7 +3009,7 @@ namespace private: std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - SvxIconReplacementDialog(weld::Window *pParent, const OUString& rMessage, bool bYestoAll) + SvxIconReplacementDialog(weld::Window *pParent, std::u16string_view rMessage, bool bYestoAll) : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::NONE, ReplaceIconName(rMessage))) { m_xQueryBox->set_title(CuiResId(RID_SVXSTR_REPLACE_ICON_CONFIRM)); diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 36a7e6e69656..7216ca55e3b8 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -76,7 +76,7 @@ AboutDialog::AboutDialog(weld::Window *pParent) m_pBuildLabel->set_uri("https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=" + sbuildId); m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt( - nMaxChar, sbuildId.getLength() - nMaxChar, "...") + nMaxChar, sbuildId.getLength() - nMaxChar, u"...") : sbuildId); } else { m_pBuildCaption->hide(); diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index a16dca1e20a3..0535902d4447 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -263,7 +263,7 @@ bool SvxHyphenWordDialog::SelLeft() DBG_ASSERT(i <= aTxt.getLength(), "index out of range"); if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR )) { - aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) ); + aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) ); m_nOldPos = i; m_xWordEdit->set_text(aTxt); @@ -286,7 +286,7 @@ bool SvxHyphenWordDialog::SelRight() { if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR )) { - aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) ); + aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) ); m_nOldPos = i; m_xWordEdit->set_text(aTxt); diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 3bc7a52b40ab..acbdad7a1b16 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -1091,11 +1091,11 @@ namespace { OUString ReplaceString( const OUString& source, const OUString& token, - const OUString& value ) + std::u16string_view value ) { sal_Int32 pos = source.indexOf( token ); - if ( pos != -1 && !value.isEmpty() ) + if ( pos != -1 && !value.empty() ) { return source.replaceAt( pos, token.getLength(), value ); } @@ -1107,9 +1107,9 @@ OUString ReplaceString( OUString FormatErrorString( const OUString& unformatted, - const OUString& language, - const OUString& script, - const OUString& line, + std::u16string_view language, + std::u16string_view script, + std::u16string_view line, std::u16string_view type, std::u16string_view message ) { @@ -1247,7 +1247,7 @@ OUString GetErrorMessage( message = sError.Message; } return FormatErrorString( - unformatted, language, script, OUString(), std::u16string_view(), message ); + unformatted, language, script, u"", std::u16string_view(), message ); } OUString GetErrorMessage( const css::uno::Any& aException ) diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 3058847d3c8a..219972d75edc 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -103,12 +103,12 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr, { mnChar = aPrevStr[ mnPos + 1 ]; // delete placeholder and char to repeat - aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" ); + aPrevStr = aPrevStr.replaceAt( mnPos, 2, u"" ); } else { // delete placeholder - aPrevStr = aPrevStr.replaceAt( mnPos, 1, "" ); + aPrevStr = aPrevStr.replaceAt( mnPos, 1, u"" ); // do not attempt to draw a 0 fill character mnPos = -1; } @@ -158,7 +158,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools:: if (nNumCharsToInsert > 0) { for (int i = 0; i < nNumCharsToInsert; ++i) - aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar)); + aTmpStr = aTmpStr.replaceAt(mnPos, 0, rtl::OUStringChar(mnChar)); } } diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx index 041df17a700a..10e07cf3ba30 100644 --- a/dbaccess/source/filter/hsqldb/utils.cxx +++ b/dbaccess/source/filter/hsqldb/utils.cxx @@ -79,7 +79,7 @@ OUString utils::convertToUTF8(std::string_view original) if (escape) { i -= 2; - res = res.replaceAt(i, 6, OUString(c)); + res = res.replaceAt(i, 6, rtl::OUStringChar(c)); ++i; } } diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index c04218620e9c..5a67b9166185 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -778,7 +778,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { OUString sDefaultName = DBA_RES( STR_DATABASEDEFAULTNAME ); OUString sExtension = pFilter->GetDefaultExtension(); - sDefaultName += sExtension.replaceAt( 0, 1, OUString() ); + sDefaultName += sExtension.replaceAt( 0, 1, u"" ); INetURLObject aWorkURL( m_sWorkPath ); aWorkURL.Append( sDefaultName ); sDefaultName = createUniqueFileName( aWorkURL ); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 1d0664305452..4ea3681e26cd 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -326,7 +326,7 @@ namespace if(_rJoin.endsWith(")")) { bBrace = true; - _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' ')); + _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1, u" "); } _rJoin += C_AND + BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData); if(bBrace) @@ -1082,7 +1082,7 @@ namespace } if(!aTableListStr.isEmpty()) - aTableListStr = aTableListStr.replaceAt(aTableListStr.getLength()-1,1, OUString() ); + aTableListStr = aTableListStr.replaceAt(aTableListStr.getLength()-1,1, u"" ); return aTableListStr; } OUString GenerateGroupBy(const OQueryDesignView* _pView,OTableFields& _rFieldList, bool bMulti ) @@ -1140,7 +1140,7 @@ namespace } if ( !aGroupByStr.isEmpty() ) { - aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, OUString(' ') ); + aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, u" " ); OUString aGroupByStr2 = " GROUP BY " + aGroupByStr; aGroupByStr = aGroupByStr2; } diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 4fdff5b2a378..4d4de9497b67 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -287,7 +287,7 @@ public: void UnExpandPositions( sal_Int32 &rStartPos, sal_Int32 &rEndPos ); void SetChar(sal_Int32 nPos, sal_Unicode c); - void Insert(const OUString& rStr, sal_Int32 nPos); + void Insert(std::u16string_view rStr, sal_Int32 nPos); void Append(std::u16string_view rStr); void Erase(sal_Int32 nPos); void Erase(sal_Int32 nPos, sal_Int32 nCount); diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 740f58f0b772..8215c451118a 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -371,7 +371,7 @@ private: virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) override { //fprintf(stderr, "TestAutoCorrDoc::Delete\n"); - m_rText = m_rText.replaceAt(nStt, nEnd-nStt, ""); + m_rText = m_rText.replaceAt(nStt, nEnd-nStt, u""); return true; } virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) override diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index f2fef724e696..36a7d5727434 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1697,10 +1697,10 @@ void ContentNode::UnExpandPositions( sal_Int32 &rStartPos, sal_Int32 &rEndPos ) void ContentNode::SetChar(sal_Int32 nPos, sal_Unicode c) { - maString = maString.replaceAt(nPos, 1, OUString(c)); + maString = maString.replaceAt(nPos, 1, rtl::OUStringChar(c)); } -void ContentNode::Insert(const OUString& rStr, sal_Int32 nPos) +void ContentNode::Insert(std::u16string_view rStr, sal_Int32 nPos) { maString = maString.replaceAt(nPos, 0, rStr); } @@ -1717,7 +1717,7 @@ void ContentNode::Erase(sal_Int32 nPos) void ContentNode::Erase(sal_Int32 nPos, sal_Int32 nCount) { - maString = maString.replaceAt(nPos, nCount, ""); + maString = maString.replaceAt(nPos, nCount, u""); } OUString ContentNode::Copy(sal_Int32 nPos) const @@ -2291,7 +2291,7 @@ EditPaM EditDoc::InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem ) { assert(aPaM.GetNode()); - aPaM.GetNode()->Insert( OUString(CH_FEATURE), aPaM.GetIndex() ); + aPaM.GetNode()->Insert( rtl::OUStringChar(CH_FEATURE), aPaM.GetIndex() ); aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), 1, GetItemPool() ); // Create a feature-attribute for the feature... diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index d83b5410d14f..a3de37005ffc 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -195,7 +195,7 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) sal_Int32 nTabPos = aText.indexOf( '\t'); while ( nTabPos != -1 ) { - aText = aText.replaceAt( nTabPos, 1, " " ); + aText = aText.replaceAt( nTabPos, 1, u" " ); nTabPos = aText.indexOf( '\t', nTabPos+8 ); } } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 3eacc677e00a..47672cb090f3 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1659,7 +1659,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) const OUString aFldText = static_cast<const EditCharAttribField*>(pField)->GetFieldValue(); if ( !aFldText.isEmpty() ) { - aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(0,1) ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.subView(0,1) ); short nFldScriptType = _xBI->getScriptType( aFldText, 0 ); for ( sal_Int32 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) @@ -1670,14 +1670,14 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) if ( nFldScriptType == i18n::ScriptType::WEAK ) { nFldScriptType = nTmpType; - aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.subView(nCharInField,1) ); } // ... but if the first one is LATIN, and there are CJK or CTL chars too, // we prefer that ScriptType because we need another font. if ( ( nTmpType == i18n::ScriptType::ASIAN ) || ( nTmpType == i18n::ScriptType::COMPLEX ) ) { - aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.subView(nCharInField,1) ); break; } } diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 028a08413bb0..6469691b1f99 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -113,7 +113,7 @@ namespace abp sal_Int32 nPos = sName.indexOf(aURL.GetFileExtension()); if ( nPos != -1 ) { - sName = sName.replaceAt(nPos-1, 4, ""); + sName = sName.replaceAt(nPos-1, 4, u""); } m_xName->set_text(sName); diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index f82a8479e4bd..32d90aa7d87c 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -680,7 +680,7 @@ Any OEditModel::translateDbColumnToControlValue() if ( nMaxTextLen && sValue.getLength() > nMaxTextLen ) { sal_Int32 nDiff = sValue.getLength() - nMaxTextLen; - sValue = sValue.replaceAt( nMaxTextLen, nDiff, OUString() ); + sValue = sValue.replaceAt( nMaxTextLen, nDiff, u"" ); } aRet <<= sValue; diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index af9d19f68191..9d84909c71c2 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2633,7 +2633,7 @@ OpCode FormulaCompiler::NextToken() if ( c == mxSymbols->getSymbolChar( ocEqual) ) { // >= instead of => aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1, - OUString( mxSymbols->getSymbolChar(ocGreater) ) ); + rtl::OUStringChar( mxSymbols->getSymbolChar(ocGreater) ) ); aCorrectedSymbol = OUString(c); bCorrected = true; } @@ -2642,14 +2642,14 @@ OpCode FormulaCompiler::NextToken() if ( c == mxSymbols->getSymbolChar( ocEqual) ) { // <= instead of =< aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1, - OUString( mxSymbols->getSymbolChar(ocLess) ) ); + rtl::OUStringChar( mxSymbols->getSymbolChar(ocLess) ) ); aCorrectedSymbol = OUString(c); bCorrected = true; } else if ( c == mxSymbols->getSymbolChar( ocGreater) ) { // <> instead of >< aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1, - OUString( mxSymbols->getSymbolChar(ocLess) ) ); + rtl::OUStringChar( mxSymbols->getSymbolChar(ocLess) ) ); aCorrectedSymbol = OUString(c); bCorrected = true; } @@ -2658,7 +2658,7 @@ OpCode FormulaCompiler::NextToken() if ( c == mxSymbols->getSymbolChar( ocSub) ) { // *- instead of -* aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1, - OUString( mxSymbols->getSymbolChar(ocMul) ) ); + rtl::OUStringChar( mxSymbols->getSymbolChar(ocMul) ) ); aCorrectedSymbol = OUString(c); bCorrected = true; } @@ -2667,7 +2667,7 @@ OpCode FormulaCompiler::NextToken() if ( c == mxSymbols->getSymbolChar( ocSub) ) { // /- instead of -/ aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1, - OUString( mxSymbols->getSymbolChar(ocDiv) ) ); + rtl::OUStringChar( mxSymbols->getSymbolChar(ocDiv) ) ); aCorrectedSymbol = OUString(c); bCorrected = true; } diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 0bbc57c85721..a1081e0427f5 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -173,7 +173,7 @@ void SAL_CALL FontMenuController::itemActivated( const css::awt::MenuEvent& ) // TODO: must be replaced by implementation of VCL, when available sal_Int32 nIndex = aText.indexOf( '~' ); if ( nIndex >= 0 ) - aText = aText.replaceAt( nIndex, 1, "" ); + aText = aText.replaceAt( nIndex, 1, u"" ); // TODO: must be replaced by implementation of VCL, when available if ( aText == m_aFontFamilyName ) diff --git a/i18npool/source/inputchecker/inputsequencechecker.cxx b/i18npool/source/inputchecker/inputsequencechecker.cxx index 4820c10ca153..ff1ea652f980 100644 --- a/i18npool/source/inputchecker/inputsequencechecker.cxx +++ b/i18npool/source/inputchecker/inputsequencechecker.cxx @@ -68,7 +68,7 @@ InputSequenceCheckerImpl::correctInputSequence(OUString& Text, sal_Int32 nStartP if (language) return getInputSequenceChecker(language)->correctInputSequence(Text, nStartPos, inputChar, inputCheckMode); } - Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar)); + Text = Text.replaceAt(++nStartPos, 0, rtl::OUStringChar(inputChar)); return nStartPos; } diff --git a/i18npool/source/inputchecker/inputsequencechecker_hi.cxx b/i18npool/source/inputchecker/inputsequencechecker_hi.cxx index c857f286650a..b1f9e99f6987 100644 --- a/i18npool/source/inputchecker/inputsequencechecker_hi.cxx +++ b/i18npool/source/inputchecker/inputsequencechecker_hi.cxx @@ -126,7 +126,7 @@ InputSequenceChecker_hi::correctInputSequence(OUString& Text, sal_Int16 inputCheckMode) { if (checkInputSequence(Text, nStartPos, inputChar, inputCheckMode)) - Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar)); + Text = Text.replaceAt(++nStartPos, 0, rtl::OUStringChar(inputChar)); else nStartPos=Text.getLength(); return nStartPos; diff --git a/i18npool/source/inputchecker/inputsequencechecker_th.cxx b/i18npool/source/inputchecker/inputsequencechecker_th.cxx index cf686be78633..c6d6f349d26d 100644 --- a/i18npool/source/inputchecker/inputsequencechecker_th.cxx +++ b/i18npool/source/inputchecker/inputsequencechecker_th.cxx @@ -111,26 +111,26 @@ https://bz.apache.org/ooo/show_bug.cgi?id=42661 #define CT_ABV1(t) (t==CT_AV1 || t==CT_BV1) if (check(Text[nStartPos], inputChar, inputCheckMode)) - Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar)); + Text = Text.replaceAt(++nStartPos, 0, rtl::OUStringChar(inputChar)); else if (nStartPos > 0 && getCharType(Text[nStartPos-1]) == CT_CONS) { sal_uInt16 t1=getCharType(Text[nStartPos]), t2=getCharType(inputChar); if ( (CT_ABV(t1) && CT_ABV(t2)) || // 1. (t1==CT_TONE && t2==CT_TONE) )// 2. - Text = Text.replaceAt(nStartPos, 1, OUString(inputChar)); + Text = Text.replaceAt(nStartPos, 1, rtl::OUStringChar(inputChar)); else if ( (t1==CT_TONE && CT_ABV(t2)) || // 5. (t1==CT_FV1 && t2==CT_TONE) || // 6. (Text[nStartPos]==0x0E4C && CT_ABV1(t2)) ) // 8. - Text = Text.replaceAt(nStartPos++, 0, OUString(inputChar)); + Text = Text.replaceAt(nStartPos++, 0, rtl::OUStringChar(inputChar)); else nStartPos=Text.getLength(); } else if (nStartPos > 1 && getCharType(Text[nStartPos-2]) == CT_CONS) { sal_uInt16 t1=getCharType(Text[nStartPos-1]), t2=getCharType(Text[nStartPos]), t3=getCharType(inputChar); if (CT_ABV(t1) && t2==CT_TONE && t3==CT_TONE) // 3. - Text = Text.replaceAt(nStartPos, 1, OUString(inputChar)); + Text = Text.replaceAt(nStartPos, 1, rtl::OUStringChar(inputChar)); else if ( (CT_ABV(t1) && t2==CT_TONE && CT_ABV(t3)) || // 4. (t1==CT_TONE && t2==CT_FV1 && t3==CT_TONE) || // 7. (CT_ABV1(t1) && Text[nStartPos]==0x0E4C && CT_ABV1(t3)) ) // 9. - Text = Text.replaceAt(nStartPos-1, 1, OUString(inputChar)); + Text = Text.replaceAt(nStartPos-1, 1, rtl::OUStringChar(inputChar)); else nStartPos=Text.getLength(); } else diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 349dc17360a4..d4c9ccd1b947 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -234,7 +234,7 @@ inline OUStringBuffer& padToLength( @return original string with token nToken replaced by rNewToken */ COMPHELPER_DLLPUBLIC OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok, - const OUString& rNewToken); + std::u16string_view rNewToken); /** Find any of a list of code units in the string. @param rIn OUString to search diff --git a/include/rtl/string.h b/include/rtl/string.h index e0d751f18bd3..f80bef02ca91 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -1108,6 +1108,11 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_Stri SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt( rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, rtl_String * subStr ) SAL_THROW_EXTERN_C(); +#ifdef LIBO_INTERNAL_ONLY +SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt_WithLength ( + rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, char const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C(); +#endif + /** Create a new string by replacing all occurrences of a single character within another string. diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index cebaa114517d..440f80900855 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -1594,6 +1594,8 @@ public: } #endif +// hide this from internal code to avoid ambiguous lookup error +#ifndef LIBO_INTERNAL_ONLY /** Returns a new string resulting from replacing n = count characters from position index in this string with newStr. @@ -1613,6 +1615,16 @@ public: rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData ); return OString( pNew, SAL_NO_ACQUIRE ); } +#endif + +#ifdef LIBO_INTERNAL_ONLY + SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, std::string_view newStr ) const + { + rtl_String* pNew = NULL; + rtl_string_newReplaceStrAt_WithLength ( &pNew, pData, index, count, newStr.data(), newStr.size() ); + return OString( pNew, SAL_NO_ACQUIRE ); + } +#endif /** Returns a new string resulting from replacing all occurrences of diff --git a/include/rtl/ustring.h b/include/rtl/ustring.h index b4990fec12eb..16ec6ed5931c 100644 --- a/include/rtl/ustring.h +++ b/include/rtl/ustring.h @@ -1541,6 +1541,11 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_newConcatUtf16L( SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAt( rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, rtl_uString * subStr ) SAL_THROW_EXTERN_C(); +#ifdef LIBO_INTERNAL_ONLY +SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceStrAtUtf16L( + rtl_uString ** newStr, rtl_uString * str, sal_Int32 idx, sal_Int32 count, sal_Unicode const * subStr, sal_Int32 substrLen ) SAL_THROW_EXTERN_C(); +#endif + /** Create a new string by replacing all occurrences of a single character within another string. diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index e14549482f35..13cc367c5589 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -2223,6 +2223,8 @@ public: } #endif +// hide this from internal code to avoid ambiguous lookup error +#ifndef LIBO_INTERNAL_ONLY /** Returns a new string resulting from replacing n = count characters from position index in this string with newStr. @@ -2242,6 +2244,16 @@ public: rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData ); return OUString( pNew, SAL_NO_ACQUIRE ); } +#endif + +#ifdef LIBO_INTERNAL_ONLY + SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const + { + rtl_uString* pNew = NULL; + rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() ); + return OUString( pNew, SAL_NO_ACQUIRE ); + } +#endif /** Returns a new string resulting from replacing all occurrences of diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index af49c561ae51..e3b2abe6b942 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -50,7 +50,7 @@ static OUString lclGenerateApiString( const OUString& rString ) OUString aRetString = rString; sal_Int32 nQuotePos = aRetString.getLength(); while( (nQuotePos = aRetString.lastIndexOf( '"', nQuotePos )) >= 0 ) - aRetString = aRetString.replaceAt( nQuotePos, 1, "\"\"" ); + aRetString = aRetString.replaceAt( nQuotePos, 1, u"\"\"" ); return "\"" + aRetString + "\""; } diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 2c24593c981e..a5f54160094b 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -798,7 +798,7 @@ void exportModuleStream(SvStream& rStrm, const OUString& rSourceCode, const OUSt const sal_Int32 nPos = aSourceCode.indexOf("Rem Attribute VBA_ModuleType="); const sal_Int32 nEndPos = nPos != -1 ? aSourceCode.indexOf("\n", nPos) : -1; if (nPos != -1 && nEndPos != -1) - aSourceCode = aSourceCode.replaceAt(nPos, nEndPos - nPos+1, ""); + aSourceCode = aSourceCode.replaceAt(nPos, nEndPos - nPos+1, u""); aSourceCode = aSourceCode.replaceAll("\n", "\r\n"); exportString(aModuleStream, aSourceCode); diff --git a/reportdesign/source/core/api/Group.cxx b/reportdesign/source/core/api/Group.cxx index 5a60997d5bf0..165214513bbe 100644 --- a/reportdesign/source/core/api/Group.cxx +++ b/reportdesign/source/core/api/Group.cxx @@ -171,7 +171,7 @@ uno::Reference< report::XSection > SAL_CALL OGroup::getFooter() void SAL_CALL OGroup::setGroupOn( ::sal_Int16 _groupon ) { if ( _groupon < report::GroupOn::DEFAULT || _groupon > report::GroupOn::INTERVAL ) - throwIllegallArgumentException("css::report::GroupOn" + throwIllegallArgumentException(u"css::report::GroupOn" ,*this ,1); set(PROPERTY_GROUPON,_groupon,m_aProps.m_nGroupOn); @@ -197,7 +197,7 @@ void SAL_CALL OGroup::setGroupInterval( ::sal_Int32 _groupinterval ) void SAL_CALL OGroup::setKeepTogether( ::sal_Int16 _keeptogether ) { if ( _keeptogether < report::KeepTogether::NO || _keeptogether > report::KeepTogether::WITH_FIRST_DETAIL ) - throwIllegallArgumentException("css::report::KeepTogether" + throwIllegallArgumentException(u"css::report::KeepTogether" ,*this ,1); set(PROPERTY_KEEPTOGETHER,_keeptogether,m_aProps.m_nKeepTogether); diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index ad35f9e34354..39785167d6c0 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -762,7 +762,7 @@ void SAL_CALL OReportDefinition::setCaption( const OUString& _caption ) void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether ) { if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN ) - throwIllegallArgumentException("css::report::GroupKeepTogether" + throwIllegallArgumentException(u"css::report::GroupKeepTogether" ,*this ,1); set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether); @@ -777,7 +777,7 @@ void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptog void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption ) { if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER ) - throwIllegallArgumentException("css::report::ReportPrintOption" + throwIllegallArgumentException(u"css::report::ReportPrintOption" ,*this ,1); set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption); @@ -792,7 +792,7 @@ void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderopt void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption ) { if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER ) - throwIllegallArgumentException("css::report::ReportPrintOption" + throwIllegallArgumentException(u"css::report::ReportPrintOption" ,*this ,1); set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption); @@ -818,7 +818,7 @@ void SAL_CALL OReportDefinition::setCommand( const OUString& _command ) void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype ) { if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND ) - throwIllegallArgumentException("css::sdb::CommandType" + throwIllegallArgumentException(u"css::sdb::CommandType" ,*this ,1); set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType); @@ -1920,7 +1920,7 @@ void SAL_CALL OReportDefinition::setMimeType( const OUString& _mimetype ) ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); const uno::Sequence< OUString > aList = getAvailableMimeTypes(); if ( ::std::find(aList.begin(), aList.end(), _mimetype) == aList.end() ) - throwIllegallArgumentException("getAvailableMimeTypes()" + throwIllegallArgumentException(u"getAvailableMimeTypes()" ,*this ,1); set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType); diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index bed193b3242f..62795c756ab2 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -303,7 +303,7 @@ void OSection::checkNotPageHeaderFooter() void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) { if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION ) - throwIllegallArgumentException("css::report::ForceNewPage" + throwIllegallArgumentException(u"css::report::ForceNewPage" ,*this ,1); checkNotPageHeaderFooter(); @@ -320,7 +320,7 @@ void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) { if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION ) - throwIllegallArgumentException("css::report::ForceNewPage" + throwIllegallArgumentException(u"css::report::ForceNewPage" ,*this ,1); checkNotPageHeaderFooter(); diff --git a/reportdesign/source/core/api/Tools.cxx b/reportdesign/source/core/api/Tools.cxx index 5d21217cc450..8f066a68d668 100644 --- a/reportdesign/source/core/api/Tools.cxx +++ b/reportdesign/source/core/api/Tools.cxx @@ -40,7 +40,7 @@ uno::Reference< report::XSection> lcl_getSection(const uno::Reference< uno::XInt return xRet; } -void throwIllegallArgumentException( const OUString& _sTypeName +void throwIllegallArgumentException( std::u16string_view _sTypeName ,const uno::Reference< uno::XInterface >& ExceptionContext_ ,sal_Int16 ArgumentPosition_ ) diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index 004d4cc4f77a..3e0a699cef21 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -45,7 +45,7 @@ namespace reportdesign * \param ExceptionContext_ The exception context. * \param ArgumentPosition_ The argument position. */ - void throwIllegallArgumentException(const OUString& _sTypeName + void throwIllegallArgumentException(std::u16string_view _sTypeName ,const css::uno::Reference< css::uno::XInterface >& ExceptionContext_ ,sal_Int16 ArgumentPosition_); diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index d9a673e81250..222bb423e79e 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1041,7 +1041,7 @@ void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinit sal_Int32 nIndex = sExpression.indexOf('"'); while ( nIndex > -1 ) { - sExpression = sExpression.replaceAt(nIndex, 1, "\"\""); + sExpression = sExpression.replaceAt(nIndex, 1, u"\"\""); nIndex = sExpression.indexOf('"',nIndex+2); } diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index 1c8681494217..355ed8feab8f 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -91,7 +91,7 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport sal_Int32 nIndex = sValue.indexOf(s_sQuote,nPos); while ( nIndex > -1 ) { - sValue = sValue.replaceAt(nIndex,2, "\""); + sValue = sValue.replaceAt(nIndex,2, u"\""); nIndex = sValue.indexOf(s_sQuote,nIndex+2); } nLen = sValue.getLength() - 1; diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx index f1b95f953c62..f2b95e0df1b7 100644 --- a/reportdesign/source/ui/dlg/Formula.cxx +++ b/reportdesign/source/ui/dlg/Formula.cxx @@ -152,7 +152,7 @@ void FormulaDialog::setCurrentFormula(const OUString& _sReplacement) const sal_Int32 nOldLen = m_nEnd - m_nStart; const sal_Int32 nNewLen = _sReplacement.getLength(); if (nOldLen) - m_sFormula = m_sFormula.replaceAt( m_nStart, nOldLen, "" ); + m_sFormula = m_sFormula.replaceAt( m_nStart, nOldLen, u"" ); if (nNewLen) m_sFormula = m_sFormula.replaceAt( m_nStart, 0, _sReplacement ); m_nEnd = m_nStart + nNewLen; diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index e651a8436363..93d1c5a11648 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -255,7 +255,7 @@ static OUString & getIniFileName_Impl() // rc files in LIBO_ETC_FOLDER (typically "Resources"). sal_Int32 off = fileName.lastIndexOf( "/MacOS/" ); if (off != -1) - fileName = fileName.replaceAt(off + 1, strlen("MacOS"), LIBO_ETC_FOLDER); + fileName = fileName.replaceAt(off + 1, strlen("MacOS"), u"" LIBO_ETC_FOLDER); #endif } #endif diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx index b8a96d43a07b..d67246dc159c 100644 --- a/sal/rtl/string.cxx +++ b/sal/rtl/string.cxx @@ -659,6 +659,35 @@ void SAL_CALL rtl_string_newConcat(rtl_String** ppThis, rtl_String* pLeft, rtl_S rtl::str::newConcat(ppThis, pLeft, pRight); } +static void rtl_string_newConcatL( + rtl_String ** newString, rtl_String * left, char const * right, + sal_Int32 rightLength) +{ + assert(newString != nullptr); + assert(left != nullptr); + assert(right != nullptr || rightLength == 0); + assert(rightLength >= 0); + if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) { +#if !defined(__COVERITY__) + throw std::length_error("rtl_string_newConcatL"); +#else + //coverity doesn't report std::bad_alloc as an unhandled exception when + //potentially thrown from destructors but does report std::length_error + throw std::bad_alloc(); +#endif + } + sal_Int32 n = left->length + rightLength; + rtl_string_assign(newString, left); + rtl_string_ensureCapacity(newString, n); + if (rightLength != 0) { + memcpy( + (*newString)->buffer + (*newString)->length, right, + rightLength); + } + (*newString)->buffer[n] = 0; + (*newString)->length = n; +} + void SAL_CALL rtl_string_ensureCapacity(rtl_String** ppThis, sal_Int32 size) SAL_THROW_EXTERN_C() { rtl::str::ensureCapacity(ppThis, size); @@ -671,6 +700,13 @@ void SAL_CALL rtl_string_newReplaceStrAt(rtl_String** ppThis, rtl_String* pStr, rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, pNewSubStr); } +void SAL_CALL rtl_string_newReplaceStrAt_WithLength(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nIndex, + sal_Int32 nCount, char const * subStr, sal_Int32 substrLen) + SAL_THROW_EXTERN_C() +{ + rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, subStr, substrLen); +} + void SAL_CALL rtl_string_newReplace(rtl_String** ppThis, rtl_String* pStr, char cOld, char cNew) SAL_THROW_EXTERN_C() { diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx index f26c21225177..7a909bb5efe3 100644 --- a/sal/rtl/strtmpl.hxx +++ b/sal/rtl/strtmpl.hxx @@ -1466,6 +1466,80 @@ void newReplaceStrAt ( IMPL_RTL_STRINGDATA** ppTh /* ----------------------------------------------------------------------- */ +template <typename IMPL_RTL_STRINGDATA, typename IMPL_RTL_STRCODE> +void newReplaceStrAt ( IMPL_RTL_STRINGDATA** ppThis, + IMPL_RTL_STRINGDATA* pStr, + sal_Int32 nIndex, + sal_Int32 nCount, + const IMPL_RTL_STRCODE* pNewSubStr, + sal_Int32 nNewSubStrLen ) +{ + assert(ppThis); + assert(nIndex >= 0 && nIndex <= pStr->length); + assert(nCount >= 0); + assert(nCount <= pStr->length - nIndex); + assert(pNewSubStr); + assert(nNewSubStrLen >= 0); + /* Append? */ + if ( nIndex >= pStr->length ) + { + if constexpr (sizeof(IMPL_RTL_STRCODE) == sizeof(char)) + rtl_string_newConcatL( ppThis, pStr, pNewSubStr, nNewSubStrLen ); + else + rtl_uString_newConcatUtf16L( ppThis, pStr, pNewSubStr, nNewSubStrLen ); + return; + } + + /* not more than the String length could be deleted */ + if ( nCount >= pStr->length-nIndex ) + { + nCount = pStr->length-nIndex; + + /* Assign of NewSubStr? */ + if ( !nIndex && (nCount >= pStr->length) ) + { + newFromStr_WithLength( ppThis, pNewSubStr, nNewSubStrLen ); + return; + } + } + + /* Assign of Str? */ + if ( !nCount && !nNewSubStrLen ) + { + assign( ppThis, pStr ); + return; + } + + IMPL_RTL_STRINGDATA* pOrg = *ppThis; + sal_Int32 nNewLen; + + /* Calculate length of the new string */ + nNewLen = pStr->length-nCount + nNewSubStrLen; + + /* Alloc New Buffer */ + *ppThis = Alloc<IMPL_RTL_STRINGDATA>( nNewLen ); + OSL_ASSERT(*ppThis != nullptr); + auto* pBuffer = (*ppThis)->buffer; + if ( nIndex ) + { + Copy( pBuffer, pStr->buffer, nIndex ); + pBuffer += nIndex; + } + if ( nNewSubStrLen ) + { + Copy( pBuffer, pNewSubStr, nNewSubStrLen ); + pBuffer += nNewSubStrLen; + } + Copy( pBuffer, pStr->buffer+nIndex+nCount, pStr->length-nIndex-nCount ); + + RTL_LOG_STRING_NEW( *ppThis ); + /* must be done last, if pStr or pNewSubStr == *ppThis */ + if ( pOrg ) + release( pOrg ); +} + +/* ----------------------------------------------------------------------- */ + template <typename IMPL_RTL_STRINGDATA> void newReplace ( IMPL_RTL_STRINGDATA** ppThis, IMPL_RTL_STRINGDATA* pStr, diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index ee84510bcc7f..64f13cabc7ee 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -1866,6 +1866,13 @@ void SAL_CALL rtl_uString_newReplaceStrAt(rtl_uString** ppThis, rtl_uString* pSt rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, pNewSubStr); } +void SAL_CALL rtl_uString_newReplaceStrAtUtf16L(rtl_uString** ppThis, rtl_uString* pStr, sal_Int32 nIndex, + sal_Int32 nCount, sal_Unicode const * subStr, sal_Int32 substrLen) + SAL_THROW_EXTERN_C() +{ + rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, subStr, substrLen); +} + void SAL_CALL rtl_uString_newReplace(rtl_uString** ppThis, rtl_uString* pStr, sal_Unicode cOld, sal_Unicode cNew) SAL_THROW_EXTERN_C() { diff --git a/sal/util/sal.map b/sal/util/sal.map index 49efb2a436cd..c5c3e4d55641 100644 --- a/sal/util/sal.map +++ b/sal/util/sal.map @@ -755,6 +755,12 @@ PRIVATE_1.7 { # LibreOffice 7.1 rtl_uString_newReplaceAllFromIndexUtf16LUtf16L; } PRIVATE_1.5; +PRIVATE_1.8 { # LibreOffice 7.3 + global: + rtl_string_newReplaceStrAt_WithLength; + rtl_uString_newReplaceStrAtUtf16L; +} PRIVATE_1.7; + PRIVATE_textenc.1 { # LibreOffice 3.6 global: _ZN3sal6detail7textenc20convertCharToUnicode*; diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index c585d2394c27..a74fff7e04af 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -2328,7 +2328,7 @@ void ScExportTest2::testTdf87973_externalLinkSkipUnuseds() // change external link to: 87973_externalSource.ods OUString aFormula = rDoc.GetFormula(3, 1, 0); auto nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods"); - aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods"); + aFormula = aFormula.replaceAt(nIdxOfFilename, 22, u"87973_externalSource.ods"); auto nIdxOfFile = aFormula.indexOf("file"); // saveAndReload save the file to a temporary directory @@ -2344,7 +2344,7 @@ void ScExportTest2::testTdf87973_externalLinkSkipUnuseds() // tdf#138832: test the same thing with singleref link aFormula = rDoc.GetFormula(3, 2, 0); nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods"); - aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods"); + aFormula = aFormula.replaceAt(nIdxOfFilename, 22, u"87973_externalSource.ods"); nIdxOfFile = aFormula.indexOf("file"); aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename); diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 356379dc3f1f..5dcbbdd11709 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -326,7 +326,7 @@ OUString ScGlobal::GetDocTabName( std::u16string_view rFileName, sal_Int32 nPos = 1; while( (nPos = aDocTab.indexOf( '\'', nPos )) != -1 ) { // escape Quotes - aDocTab = aDocTab.replaceAt( nPos, 0, "\\" ); + aDocTab = aDocTab.replaceAt( nPos, 0, u"\\" ); nPos += 2; } aDocTab += "'" + OUStringChar(SC_COMPILER_FILE_TAB_SEP) + rTabName; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index ae4d48787fe3..c09628608bd2 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -547,7 +547,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( else { rExternDocName = rExternDocName.copy(0, nClose); - rExternDocName = rExternDocName.replaceAt( nOpen, 1, ""); + rExternDocName = rExternDocName.replaceAt( nOpen, 1, u""); pMsoxlQuoteStop = p - 1; // the ' quote char // There may be embedded escaped quotes, just matching the // doc name's length may not work. diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 952a53423b3f..2c8bf6c5655b 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4118,9 +4118,9 @@ void ScCompiler::AutoCorrectParsedSymbol() (ScCharFlags::Word | ScCharFlags::CharDontCare)) == ScCharFlags::NONE)) ) nPos--; if ( nPos == MAXSTRLEN - 1 ) - aCorrectedSymbol = aCorrectedSymbol.replaceAt( nPos, 1, OUString(cQuote) ); // '"' the MAXSTRLENth character + aCorrectedSymbol = aCorrectedSymbol.replaceAt( nPos, 1, rtl::OUStringChar(cQuote) ); // '"' the MAXSTRLENth character else - aCorrectedSymbol = aCorrectedSymbol.replaceAt( nPos + 1, 0, OUString(cQuote) ); + aCorrectedSymbol = aCorrectedSymbol.replaceAt( nPos + 1, 0, rtl::OUStringChar(cQuote) ); bCorrected = true; } else if ( c1 != cQuote && c2 == cQuote ) @@ -5448,7 +5448,7 @@ bool ScCompiler::EnQuote( OUString& rStr ) sal_Int32 nPos = 0; while ( (nPos = rStr.indexOf( '\'', nPos)) != -1 ) { - rStr = rStr.replaceAt( nPos, 0, "\\" ); + rStr = rStr.replaceAt( nPos, 0, u"\\" ); nPos += 2; } rStr = "'" + rStr + "'"; diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 4e1471c46fbc..fae8a6eeb222 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3412,12 +3412,12 @@ void ScInterpreter::ScNumberValue() { sal_Unicode c = aInputString[ i ]; if ( c == 0x0020 || c == 0x0009 || c == 0x000A || c == 0x000D ) - aInputString = aInputString.replaceAt( i, 1, "" ); // remove spaces etc. + aInputString = aInputString.replaceAt( i, 1, u"" ); // remove spaces etc. } sal_Int32 nPercentCount = 0; for ( sal_Int32 i = aInputString.getLength() - 1; i >= 0 && aInputString[ i ] == 0x0025; i-- ) { - aInputString = aInputString.replaceAt( i, 1, "" ); // remove and count trailing '%' + aInputString = aInputString.replaceAt( i, 1, u"" ); // remove and count trailing '%' nPercentCount++; } @@ -3446,7 +3446,7 @@ void ScInterpreter::ScClean() for ( sal_Int32 i = 0; i < aStr.getLength(); i++ ) { if ( !lcl_ScInterpreter_IsPrintable( aStr[i] ) ) - aStr = aStr.replaceAt(i,1,""); + aStr = aStr.replaceAt(i, 1, u""); } PushString(aStr); } @@ -8860,7 +8860,7 @@ void ScInterpreter::ScReplace() aOldStr.iterateCodePoints( &nIdx ); ++nCnt; } - aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, "" ); + aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, u"" ); if ( CheckStringResultLen( aOldStr, aNewStr ) ) aOldStr = aOldStr.replaceAt( nStart, 0, aNewStr ); PushString( aOldStr ); @@ -9700,7 +9700,7 @@ void ScInterpreter::ScSubstitute() nCount++; if( !nCnt || nCount == nCnt ) { - sStr = sStr.replaceAt(nPos,nOldLen, ""); + sStr = sStr.replaceAt(nPos,nOldLen, u""); if ( CheckStringResultLen( sStr, sNewStr ) ) { sStr = sStr.replaceAt(nPos, 0, sNewStr); diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index a0d213ed3c9a..11e177158148 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -440,7 +440,7 @@ void ScRangeData::MakeValidName( const ScDocument& rDoc, OUString& rName ) for (nPos=0; nPos<nLen; nPos++) { if ( !ScCompiler::IsCharFlagAllConventions( rName, nPos, ScCharFlags::Name) ) - rName = rName.replaceAt( nPos, 1, "_" ); + rName = rName.replaceAt( nPos, 1, u"_" ); } // Ensure that the proposed name is not a reference under any convention, diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index 439f00a6cb97..c5901c834b40 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -519,7 +519,7 @@ bool ScRangeStringConverter::GetRangeFromString( if ( nIndex < aUIString.getLength() - 1 && aUIString[ nIndex + 1 ] == '.' ) - aUIString = aUIString.replaceAt( nIndex + 1, 1, "" ); + aUIString = aUIString.replaceAt( nIndex + 1, 1, u"" ); bResult = ((rRange.Parse(aUIString, rDocument, eConv) & ScRefFlags::VALID) == ScRefFlags::VALID); diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index 18706b2c0916..4e5984f9e943 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -204,7 +204,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, sal_Int32 nPos = aTmpStr.indexOf( cStrDelim ); while ( nPos != -1 ) { - aTmpStr = aTmpStr.replaceAt( nPos, 0, OUString(cStrDelim) ); + aTmpStr = aTmpStr.replaceAt( nPos, 0, rtl::OUStringChar(cStrDelim) ); nPos = aTmpStr.indexOf( cStrDelim, nPos+2 ); } rOut.WriteUniOrByteChar( cStrDelim, eCharSet ); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 006e3cb2c956..17a614b8fdf3 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -425,7 +425,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU if(nSepPos < nPointPos) { nSepPos = nPointPos; - aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" ); + aTextMark = aTextMark.replaceAt( nSepPos, 1, u"!" ); } if (nSepPos != -1) @@ -434,7 +434,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'') { - aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, "'"); + aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, u"'"); } } else diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index c12d39376d56..872632a1c061 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -341,7 +341,7 @@ OUString XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm ) ScRange aRange; if ((aRange.ParseAny( xTextMark->copy( nSepPos + 1 ), rDoc, formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) - xTextMark.reset( new OUString( xTextMark->replaceAt( nSepPos, 1, OUString( '.' )))); + xTextMark.reset( new OUString( xTextMark->replaceAt( nSepPos, 1, rtl::OUStringChar( '.' )))); } } } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index c1749c310ab6..298517b0f5b0 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2111,7 +2111,7 @@ void XclImpTbxObjBase::ConvertLabel( ScfPropertySet& rPropSet ) const { sal_Int32 nPos = aLabel.indexOf( static_cast< sal_Unicode >( maTextData.maData.mnShortcut ) ); if( nPos != -1 ) - aLabel = aLabel.replaceAt( nPos, 0, "~" ); + aLabel = aLabel.replaceAt( nPos, 0, u"~" ); } rPropSet.SetStringProperty( "Label", aLabel ); diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index d82b84a2eb60..9605dc7a46f7 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -152,10 +152,10 @@ OUString ScfTools::ConvertToScDefinedName(const OUString& rName ) u'_'); sal_Int32 nLen = sName.getLength(); if( nLen && !ScCompiler::IsCharFlagAllConventions( sName, 0, ScCharFlags::CharName ) ) - sName = sName.replaceAt( 0, 1, "_" ); + sName = sName.replaceAt( 0, 1, u"_" ); for( sal_Int32 nPos = 1; nPos < nLen; ++nPos ) if( !ScCompiler::IsCharFlagAllConventions( sName, nPos, ScCharFlags::Name ) ) - sName = sName.replaceAt( nPos, 1, "_" ); + sName = sName.replaceAt( nPos, 1, u"_" ); return sName; } diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 3cb012bda7c8..2dcc513f21a9 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -1566,7 +1566,7 @@ OUString FormulaProcessorBase::generateApiString( const OUString& rString ) OUString aRetString = rString; sal_Int32 nQuotePos = aRetString.getLength(); while( (nQuotePos = aRetString.lastIndexOf( '"', nQuotePos )) >= 0 ) - aRetString = aRetString.replaceAt( nQuotePos, 1, "\"\"" ); + aRetString = aRetString.replaceAt( nQuotePos, 1, u"\"\"" ); return "\"" + aRetString + "\""; } diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index c4daa9cd98bd..a00f6cb6cc78 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -134,7 +134,7 @@ void WorksheetBuffer::convertSheetNameRef( OUString& sSheetNameRef ) const ScRange aRange; if ((aRange.ParseAny( sSheetNameRef.copy( nSepPos + 1 ), getScDocument(), formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) - sSheetNameRef = sSheetNameRef.replaceAt( nSepPos, 1, OUString( '.' ) ); + sSheetNameRef = sSheetNameRef.replaceAt( nSepPos, 1, rtl::OUStringChar( '.' ) ); } // #i66592# convert sheet names that have been renamed on import OUString aSheetName = sSheetNameRef.copy( 1, nSepPos - 1 ); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index a5fc023f8a99..40a99cdb444b 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1034,7 +1034,7 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c if ((aRange.ParseAny( aUrl.copy( nSepPos + 1 ), rDoc.getDoc(), formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) - aUrl = aUrl.replaceAt( nSepPos, 1, OUString( '.' ) ); + aUrl = aUrl.replaceAt( nSepPos, 1, rtl::OUStringChar( '.' ) ); } // #i66592# convert sheet names that have been renamed on import OUString aSheetName = aUrl.copy( 1, nSepPos - 1 ); diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index ed1dbd8ebeda..654dfe84ef67 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -457,7 +457,7 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange, pRelationSet->AddRelation(aRelation); } -static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view replacedChar, const OUString& replaceStr) +static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view replacedChar, std::u16string_view replaceStr) { int iReplace = oldOUString.lastIndexOf(replacedChar); OUString aRet = oldOUString; @@ -471,11 +471,11 @@ static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view static OUString ReplaceFourChar(const OUString& oldOUString) { - OUString aRet = ReplaceOneChar(oldOUString, u"\\", "\\\\"); - aRet = ReplaceOneChar(aRet, u";", "\\;"); - aRet = ReplaceOneChar(aRet, u"=", "\\="); - aRet = ReplaceOneChar(aRet, u",", "\\,"); - aRet = ReplaceOneChar(aRet, u":", "\\:"); + OUString aRet = ReplaceOneChar(oldOUString, u"\\", u"\\\\"); + aRet = ReplaceOneChar(aRet, u";", u"\\;"); + aRet = ReplaceOneChar(aRet, u"=", u"\\="); + aRet = ReplaceOneChar(aRet, u",", u"\\,"); + aRet = ReplaceOneChar(aRet, u":", u"\\:"); return aRet; } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8c06ebfcc111..6466c30576f0 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -362,10 +362,10 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) sal_Int32 nColon = aDelimiters.indexOf( ':' ); if ( nColon != -1 ) - aDelimiters = aDelimiters.replaceAt( nColon, 1, ""); // Delimiter without colon + aDelimiters = aDelimiters.replaceAt( nColon, 1, u""); // Delimiter without colon sal_Int32 nDot = aDelimiters.indexOf(cSheetSep); if ( nDot != -1 ) - aDelimiters = aDelimiters.replaceAt( nDot, 1 , ""); // Delimiter without dot + aDelimiters = aDelimiters.replaceAt( nDot, 1 , u""); // Delimiter without dot const sal_Unicode* pChar = rFormula.getStr(); sal_Int32 nLen = rFormula.getLength(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 289c66f756d9..a97a47ecc6ec 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1213,7 +1213,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) } else if ( (nPos = aLangText.indexOf(aDocLangPrefix)) != -1 ) { - aLangText = aLangText.replaceAt(nPos, aDocLangPrefix.getLength(), ""); + aLangText = aLangText.replaceAt(nPos, aDocLangPrefix.getLength(), u""); if ( aLangText == "LANGUAGE_NONE" ) { @@ -1243,12 +1243,12 @@ void ScDocShell::Execute( SfxRequest& rReq ) else if (-1 != (nPos = aLangText.indexOf( aSelectionLangPrefix ))) { bSelection = true; - aLangText = aLangText.replaceAt( nPos, aSelectionLangPrefix.getLength(), "" ); + aLangText = aLangText.replaceAt( nPos, aSelectionLangPrefix.getLength(), u"" ); } else if (-1 != (nPos = aLangText.indexOf( aParagraphLangPrefix ))) { bParagraph = true; - aLangText = aLangText.replaceAt( nPos, aParagraphLangPrefix.getLength(), "" ); + aLangText = aLangText.replaceAt( nPos, aParagraphLangPrefix.getLength(), u"" ); } if (bSelection || bParagraph) @@ -1345,7 +1345,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) sal_Int32 nPos = 0; if(-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { - sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), ""); + sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), u""); pEditView->InsertText( sApplyText ); } } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 72dad3cc6410..5d8e755c18f6 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -890,7 +890,7 @@ static void lcl_DoubleEscapeChar( OUString& rString, sal_Unicode cStr ) sal_Int32 n = 0; while( ( n = rString.indexOf( cStr, n ) ) != -1 ) { - rString = rString.replaceAt( n, 0, OUString(cStr) ); + rString = rString.replaceAt( n, 0, rtl::OUStringChar(cStr) ); n += 2; } } diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 554bf801d1de..1d0ab68a3313 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -1680,7 +1680,7 @@ namespace { // cut out alignment string aStr = rExtraString.copy(nPos, n2 - nPos + 1); - rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, ""); + rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, u""); aStr = aStr.copy( n1-nPos+1 ); } } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index c19c6b87a6fd..1b30df7f2406 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -943,7 +943,7 @@ static OUString lcl_NoteString( const ScPostIt& rNote ) OUString aText = rNote.GetText(); sal_Int32 nAt; while ( (nAt = aText.indexOf( '\n' )) != -1 ) - aText = aText.replaceAt( nAt, 1, " " ); + aText = aText.replaceAt( nAt, 1, u" " ); return aText; } diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index 0e307071d9ef..520f110a6f5d 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -196,7 +196,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const OUString& aPropert sal_Int32 nColon = aUIString.lastIndexOf( ':' ); if ( nColon >= 0 && nColon < aUIString.getLength() - 1 && aUIString[nColon+1] == '.' ) - aUIString = aUIString.replaceAt( nColon+1, 1, "" ); + aUIString = aUIString.replaceAt( nColon+1, 1, u"" ); } // parse the rest like a UI string diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 6ec3a1e633d1..40e72bbfc8d9 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2261,7 +2261,7 @@ OUString SAL_CALL ScChart2DataProvider::convertRangeFromXML( const OUString& sXM sal_Int32 nIndex = ScRangeStringConverter::IndexOf( sToken, ':', 0 ); if ( nIndex >= 0 && nIndex < aUIString.getLength() - 1 && aUIString[nIndex + 1] == '.' ) - aUIString = aUIString.replaceAt( nIndex + 1, 1, "" ); + aUIString = aUIString.replaceAt( nIndex + 1, 1, u"" ); if ( aUIString[0] == '.' ) aUIString = aUIString.copy( 1 ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 7c8758bb75e1..ba4a1b13a795 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -536,7 +536,7 @@ bool ScDrawStringsVars::SetText( const ScRefCellValue& rCell ) { nRepeatChar = aString[ nRepeatPos + 1 ]; // delete placeholder and char to repeat - aString = aString.replaceAt( nRepeatPos, 2, "" ); + aString = aString.replaceAt( nRepeatPos, 2, u"" ); // Do not cache/reuse a repeat-filled string, column // widths or fonts or sizes may differ. maLastCell.clear(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 339c70d30aac..af151534c018 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -383,7 +383,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { ++nIndex; } - OUString aString = rString.replaceAt( 1, nIndex - 1, "" ); + OUString aString = rString.replaceAt( 1, nIndex - 1, u"" ); // if the remaining part without the leading '+' or '-' character // is non-empty and not a number, handle as formula @@ -2745,7 +2745,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement ) for ( sal_Int32 i=1 ; i<sExponentialStandardFormat.getLength() ; i++ ) { if ( sExponentialStandardFormat[i] >= '1' && sExponentialStandardFormat[i] <= '9' ) - sExponentialStandardFormat = sExponentialStandardFormat.replaceAt( i, 1, "0" ); + sExponentialStandardFormat = sExponentialStandardFormat.replaceAt( i, 1, u"0" ); } aOut = aOut.copy( 0, nIndexE ); // remove exponential part } diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 2f6fbfaccb47..c17910d686e3 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -286,7 +286,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(const OUString& rOldName, std::u16st { if (aURL.getLength() == rOldName.getLength() + 1) // standard page name { - aURL = aURL.replaceAt(1, aURL.getLength() - 1, "") + + aURL = aURL.replaceAt(1, aURL.getLength() - 1, u"") + rNewName; pURLField->SetURL(aURL); } @@ -296,7 +296,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(const OUString& rOldName, std::u16st if (aURL.getLength() == rOldName.getLength() + 2 + sNotes.getLength() && aURL.indexOf(sNotes, rOldName.getLength() + 2) == rOldName.getLength() + 2) { - aURL = aURL.replaceAt(1, aURL.getLength() - 1, "") + + aURL = aURL.replaceAt(1, aURL.getLength() - 1, u"") + rNewName + " " + sNotes; pURLField->SetURL(aURL); } @@ -333,7 +333,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo OUString aURLCopy = aURL; const OUString sNotes(SdResId(STR_NOTES)); - aURLCopy = aURLCopy.replaceAt(0, aHashSlide.getLength(), ""); + aURLCopy = aURLCopy.replaceAt(0, aHashSlide.getLength(), u""); bool bNotesLink = ( aURLCopy.getLength() >= sNotes.getLength() + 3 && aURLCopy.endsWith(sNotes) ); @@ -342,7 +342,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo continue; // no compatible link and page if (bNotes) - aURLCopy = aURLCopy.replaceAt(aURLCopy.getLength() - sNotes.getLength(), sNotes.getLength(), ""); + aURLCopy = aURLCopy.replaceAt(aURLCopy.getLength() - sNotes.getLength(), sNotes.getLength(), u""); sal_Int32 number = aURLCopy.toInt32(); sal_uInt16 realPageNumber = (nPos + 1)/ 2; @@ -351,7 +351,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo { // update link page number number += nIncrement; - aURL = aURL.replaceAt(aHashSlide.getLength() + 1, aURL.getLength() - aHashSlide.getLength() - 1, "") + + aURL = aURL.replaceAt(aHashSlide.getLength() + 1, aURL.getLength() - aHashSlide.getLength() - 1, u"") + OUString::number(number); if (bNotes) { diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index ec7a16e045e9..59f2e879b06f 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -2266,7 +2266,7 @@ void PowerPointExport::embedEffectAudio(const FSHelperPtr& pFS, const OUString& sRelId = addRelation(pFS->getOutputStream(), oox::getRelationship(Relationship::AUDIO), sPath); - uno::Reference<io::XOutputStream> xOutputStream = openFragmentStream(sPath.replaceAt(0, 2, "/ppt"), + uno::Reference<io::XOutputStream> xOutputStream = openFragmentStream(sPath.replaceAt(0, 2, u"/ppt"), "audio/x-wav"); comphelper::OStorageHelper::CopyInputToOutput(xAudioStream, xOutputStream); diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index fc8e774d82e9..78274f3f4492 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -199,7 +199,7 @@ void SdCustomShowDlg::SelectHdl(void const *p) const CharClass* pCharClass = rDoc.GetCharClass(); while( pCharClass->isDigit( aStr, nStrPos ) ) - aStr = aStr.replaceAt( nStrPos, 1, "" ); + aStr = aStr.replaceAt( nStrPos, 1, u"" ); aStr = aStr.subView( 0, nStrPos) + OUString::number( ++nNum ) + aStr.subView( nStrPos); } diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index b3c142d06750..5ed24657d9f1 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -308,7 +308,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) sal_Int32 nPos = -1; if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix ))) { - aNewLangTxt = aNewLangTxt.replaceAt( nPos, aDocumentLangPrefix.getLength(), "" ); + aNewLangTxt = aNewLangTxt.replaceAt( nPos, aDocumentLangPrefix.getLength(), u"" ); if (aNewLangTxt == "LANGUAGE_NONE") lcl_setLanguage( pDoc, u"", true ); @@ -320,12 +320,12 @@ void DrawDocShell::Execute( SfxRequest& rReq ) else if (-1 != (nPos = aNewLangTxt.indexOf( aSelectionLangPrefix ))) { bSelection = true; - aNewLangTxt = aNewLangTxt.replaceAt( nPos, aSelectionLangPrefix.getLength(), "" ); + aNewLangTxt = aNewLangTxt.replaceAt( nPos, aSelectionLangPrefix.getLength(), u"" ); } else if (-1 != (nPos = aNewLangTxt.indexOf( aParagraphLangPrefix ))) { bParagraph = true; - aNewLangTxt = aNewLangTxt.replaceAt( nPos, aParagraphLangPrefix.getLength(), "" ); + aNewLangTxt = aNewLangTxt.replaceAt( nPos, aParagraphLangPrefix.getLength(), u"" ); } if (bSelection || bParagraph) @@ -410,7 +410,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) sal_Int32 nPos = 0; if(-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { - sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), ""); + sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), u""); rEditView.InsertText( sApplyText ); } } diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index 4f823eaee75d..0797e78560cf 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -264,7 +264,7 @@ void InformationDialog::InitDialog() aTitle = xURLTransformer->getPresentation( aPresentationURL, false ); if ( aTitle.match( sFileProtocol ) ) - aTitle = aTitle.replaceAt( 0, sFileProtocol.getLength(), OUString() ); + aTitle = aTitle.replaceAt( 0, sFileProtocol.getLength(), u"" ); } OUString aInfoString( getString( eInfoString ) ); diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 09e97f6de3da..263f750f9b12 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -405,7 +405,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI { // there is extra information rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); - aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); + aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, u"" ); rInfo.aExtraString = aWinData; } else @@ -471,7 +471,7 @@ bool SfxChildWinInfo::GetExtraData_Impl { // Cut out Alignment string aStr = aExtraString.copy(nPos, n2 - nPos + 1); - aStr = aStr.replaceAt(nPos, n1-nPos+1, ""); + aStr = aStr.replaceAt(nPos, n1-nPos+1, u""); } } diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index eb419d7c1656..e19949b279f8 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -815,8 +815,8 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) { // extract alignment information from extrastring aStr = pInfo->aExtraString.copy(nPos, n2 - nPos + 1); - pInfo->aExtraString = pInfo->aExtraString.replaceAt(nPos, n2 - nPos + 1, ""); - aStr = aStr.replaceAt(nPos, n1-nPos+1, ""); + pInfo->aExtraString = pInfo->aExtraString.replaceAt(nPos, n2 - nPos + 1, u""); + aStr = aStr.replaceAt(nPos, n1-nPos+1, u""); } } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 918b9c1869b7..60fb167c359a 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1949,7 +1949,7 @@ void FileDialogHelper_Impl::addGraphicFilter() constexpr OUStringLiteral GRF_CONFIG_STR = u" "; constexpr OUStringLiteral STD_CONFIG_STR = u"1 "; -static void SetToken( OUString& rOrigStr, sal_Int32 nToken, sal_Unicode cTok, const OUString& rStr) +static void SetToken( OUString& rOrigStr, sal_Int32 nToken, sal_Unicode cTok, std::u16string_view rStr) { const sal_Unicode* pStr = rOrigStr.getStr(); sal_Int32 nLen = rOrigStr.getLength(); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 41aff2bd93c7..f2e13da357e2 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -560,7 +560,7 @@ void SfxDocTplService_Impl::getDirList() if (nIndex<0) continue; - rTemplateDir = rTemplateDir.replaceAt(nIndex, aPrefix.getLength(), OUString()); + rTemplateDir = rTemplateDir.replaceAt(nIndex, aPrefix.getLength(), u""); rTemplateDir = xExpander->expandMacros( rTemplateDir ); } } diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 2de3a680bd4d..37edc065bd88 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -174,7 +174,7 @@ IMPL_LINK( SfxNewFileDialog, RegionSelect, weld::TreeView&, rBox, void ) OUString aSel = m_xRegionLb->get_selected_text(); sal_Int32 nc = aSel.indexOf('('); if (nc != -1 && nc != 0) - aSel = aSel.replaceAt(nc-1, 1, ""); + aSel = aSel.replaceAt(nc-1, 1, u""); if ( aSel.compareToIgnoreAsciiCase( SfxResId(STR_STANDARD) ) == 0 ) m_xTemplateLb->append_text(SfxResId(STR_NONE)); for (sal_uInt16 i = 0; i < nCount; ++i) @@ -221,7 +221,7 @@ sal_uInt16 SfxNewFileDialog::GetSelectedTemplatePos() const OUString aSel = m_xRegionLb->get_selected_text(); sal_Int32 nc = aSel.indexOf('('); if (nc != -1 && nc != 0) - aSel = aSel.replaceAt(nc-1, 1, ""); + aSel = aSel.replaceAt(nc-1, 1, u""); if ( aSel.compareToIgnoreAsciiCase(SfxResId(STR_STANDARD)) != 0 ) nEntry++; return nEntry; diff --git a/shell/source/win32/spsupp/spsuppHelper.cxx b/shell/source/win32/spsupp/spsuppHelper.cxx index 595128ca7479..b5f6514decd6 100644 --- a/shell/source/win32/spsupp/spsuppHelper.cxx +++ b/shell/source/win32/spsupp/spsuppHelper.cxx @@ -50,7 +50,7 @@ OUString GetString(TranslateId pResId) OUString sPath = GetSofficeExe(); if (const sal_Int32 nDotPos = sPath.lastIndexOf('.'); nDotPos >= 0) { - sPath = sPath.replaceAt(nDotPos, sPath.getLength() - nDotPos, SAL_CONFIGFILE("")); + sPath = sPath.replaceAt(nDotPos, sPath.getLength() - nDotPos, SAL_CONFIGFILE(u"")); if (osl::FileBase::getFileURLFromSystemPath(sPath, sPath) == osl::FileBase::E_None) rtl::Bootstrap::setIniFilename(sPath); } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index cea9fff62b35..6eb1213071cb 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1114,7 +1114,7 @@ Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rTex } aText = aLine.copy(0, m); - aLine = aLine.replaceAt(0, m, ""); + aLine = aLine.replaceAt(0, m, u""); aSize = GetTextLineSize(rDevice, aText); aTextSize.AdjustHeight(aSize.Height() ); aTextSize.setWidth( std::clamp(aSize.Width(), aTextSize.Width(), MaxWidth) ); @@ -1194,7 +1194,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const } } aText = aLine.copy(0, m); - aLine = aLine.replaceAt(0, m, ""); + aLine = aLine.replaceAt(0, m, u""); DrawTextLine(rDevice, aPoint, aText); aPoint.AdjustY(aSize.Height() ); @@ -1781,7 +1781,7 @@ void SmViewShell::Execute(SfxRequest& rReq) } if ( bForceUTF16 ) { - OUString aNewString = aString.replaceAt( nPosL,nPosU-nPosL,"UTF-16"); + OUString aNewString = aString.replaceAt( nPosL, nPosU-nPosL, u"UTF-16"); pStrm.reset(new SvMemoryStream( const_cast<sal_Unicode *>(aNewString.getStr()), aNewString.getLength() * sizeof(sal_Unicode), StreamMode::READ)); } else diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 8c9d7909602f..6c3a2c070d2b 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -1168,7 +1168,7 @@ HtmlTokenId HTMLParser::GetNextToken_() if ((nRet >= HtmlTokenId::ONOFF_START) && aToken.endsWith("/")) { mnPendingOffToken = static_cast<HtmlTokenId>(static_cast<int>(nRet) + 1); // HtmlTokenId::<TOKEN>_ON -> HtmlTokenId::<TOKEN>_OFF - aToken = aToken.replaceAt( aToken.getLength()-1, 1, ""); // remove trailing '/' + aToken = aToken.replaceAt( aToken.getLength()-1, 1, u""); // remove trailing '/' } if( sal_Unicode(EOF) == nNextCh && rInput.eof() ) { @@ -1387,7 +1387,7 @@ void HTMLParser::UnescapeToken() bEscape = false; if( '\\'==aToken[nPos] && !bOldEscape ) { - aToken = aToken.replaceAt( nPos, 1, "" ); + aToken = aToken.replaceAt( nPos, 1, u"" ); bEscape = true; } else @@ -1477,7 +1477,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken ) case '\r': case '\n': if( bStripCRLF ) - aToken = aToken.replaceAt( nPos, 1, "" ); + aToken = aToken.replaceAt( nPos, 1, u"" ); else { nPos++; @@ -1492,7 +1492,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken ) } else { - aToken = aToken.replaceAt( nPos, 1, "" ); + aToken = aToken.replaceAt( nPos, 1, u"" ); bEscape = true; } break; @@ -1549,7 +1549,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken ) } else { - aToken = aToken.replaceAt( nPos, 1, "" ); + aToken = aToken.replaceAt( nPos, 1, u"" ); bEscape = true; } break; diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 929921af4c17..af3231432864 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -129,7 +129,7 @@ bool CleanAndCheckEmpty(OUString& rText) for (sal_Int32 i = 0; i < rText.getLength(); ++i) { if (0xa == rText[i] || 0xd == rText[i]) - rText = rText.replaceAt(i, 1, " "); + rText = rText.replaceAt(i, 1, u" "); else bEmpty = false; } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index a513784d35f9..c99547c8c8fc 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1179,7 +1179,7 @@ void DbTextField::updateFromModel( Reference< XPropertySet > _rxModel ) if (nMaxTextLen != 0 && sText.getLength() > nMaxTextLen) { sal_Int32 nDiff = sText.getLength() - nMaxTextLen; - sText = sText.replaceAt(sText.getLength() - nDiff,nDiff, OUString()); + sText = sText.replaceAt(sText.getLength() - nDiff,nDiff, u""); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 957ea2e38ebc..51f65f76755f 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1108,7 +1108,7 @@ OUString SdrObject::ImpGetDescriptionStr(TranslateId pStrCacheID) const nPos = aStr.indexOf("%2"); if (nPos >= 0) // Replace '%2' with the passed value. - aStr = aStr.replaceAt(nPos, 2, "0"); + aStr = aStr.replaceAt(nPos, 2, u"0"); return aStr; } diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index d79f4eb5caef..419206c56f00 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -370,7 +370,7 @@ uno::Any SwAccessibleCell::getMinimumIncrement( ) return uno::Any(); } -static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view replacedChar, const OUString& replaceStr) +static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view replacedChar, std::u16string_view replaceStr) { int iReplace = oldOUString.lastIndexOf(replacedChar); OUString aRet = oldOUString; @@ -384,11 +384,11 @@ static OUString ReplaceOneChar(const OUString& oldOUString, std::u16string_view static OUString ReplaceFourChar(const OUString& oldOUString) { - OUString aRet = ReplaceOneChar(oldOUString,u"\\","\\\\"); - aRet = ReplaceOneChar(aRet,u";","\\;"); - aRet = ReplaceOneChar(aRet,u"=","\\="); - aRet = ReplaceOneChar(aRet,u",","\\,"); - aRet = ReplaceOneChar(aRet,u":","\\:"); + OUString aRet = ReplaceOneChar(oldOUString, u"\\", u"\\\\"); + aRet = ReplaceOneChar(aRet, u";", u"\\;"); + aRet = ReplaceOneChar(aRet, u"=", u"\\="); + aRet = ReplaceOneChar(aRet, u",", u"\\,"); + aRet = ReplaceOneChar(aRet, u":", u"\\:"); return aRet; } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 6f4ed5f01ed0..c5061c42f854 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1546,7 +1546,7 @@ static OUString lcl_MaskDeletedRedlines( const SwTextNode* pTextNd ) pRed->CalcStartEnd( pTextNd->GetIndex(), nStart, nEnd ); while ( nStart < nEnd && nStart < sNodeText.getLength() ) - sNodeText = sNodeText.replaceAt( nStart++, 1, OUString(CH_TXTATR_INWORD) ); + sNodeText = sNodeText.replaceAt( nStart++, 1, rtl::OUStringChar(CH_TXTATR_INWORD) ); } } } diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 27b6b1c79108..6df314ae55c2 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -853,7 +853,7 @@ SwAutoFormat::GetDigitLevel(const SwTextFrame& rFrame, TextFrameIndex& rPos, eScan = (eScan & ~(UPPER_ALPHA|LOWER_ALPHA)) | eTmpScan; if( pNumTypes ) - (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, OUString(c) ); + (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, rtl::OUStringChar(c) ); } if( eScan & DELIM ) diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 44c589060feb..ee4cfc5c3460 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -112,7 +112,7 @@ OUString ReplacePoint( const OUString& rTmpName, bool bWithCommandType ) return rTmpName; } - OUString sRes = rTmpName.replaceAt(nIndex, 1, OUString(DB_DELIM)); + OUString sRes = rTmpName.replaceAt(nIndex, 1, rtl::OUStringChar(DB_DELIM)); if (bWithCommandType) { @@ -121,13 +121,13 @@ OUString ReplacePoint( const OUString& rTmpName, bool bWithCommandType ) { return sRes; } - sRes = sRes.replaceAt(nIndex, 1, OUString(DB_DELIM)); + sRes = sRes.replaceAt(nIndex, 1, rtl::OUStringChar(DB_DELIM)); } nIndex = sRes.indexOf('.'); if (nIndex>=0) { - sRes = sRes.replaceAt(nIndex, 1, OUString(DB_DELIM)); + sRes = sRes.replaceAt(nIndex, 1, rtl::OUStringChar(DB_DELIM)); } return sRes; } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index da6255a73770..a272642125da 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -101,10 +101,10 @@ static OUString& lcl_TabToBlankAtSttEnd( OUString& rText ) for( n = 0; n < rText.getLength() && ' ' >= ( c = rText[n] ); ++n ) if( '\x9' == c ) - rText = rText.replaceAt( n, 1, " " ); + rText = rText.replaceAt( n, 1, u" " ); for( n = rText.getLength(); n && ' ' >= ( c = rText[--n] ); ) if( '\x9' == c ) - rText = rText.replaceAt( n, 1, " " ); + rText = rText.replaceAt( n, 1, u" " ); return rText; } diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 7c9aba47d74e..c366401c9153 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -68,7 +68,7 @@ void SwFieldPortion::TakeNextOffset( const SwFieldPortion* pField ) { OSL_ENSURE( pField, "TakeNextOffset: Missing Source" ); m_nNextOffset = pField->GetNextOffset(); - m_aExpand = m_aExpand.replaceAt(0, sal_Int32(m_nNextOffset), ""); + m_aExpand = m_aExpand.replaceAt(0, sal_Int32(m_nNextOffset), u""); m_bFollow = true; } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index ccc25f50df9c..f2c18d7b1ce9 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1616,16 +1616,16 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) if ((i + nCopyStart + 1 >= sal_Int32(rInf.GetLen())) || aKernArray[i + nCopyStart] != aKernArray[ i + nCopyStart + 1]) { - aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BULLET)); + aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(CH_BULLET)); } else { - aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK)); + aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(CH_BLANK)); } } else { - aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK)); + aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(CH_BLANK)); } } @@ -2502,7 +2502,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe // In this case, the beginning of aTmpText is wrong. OUString aSnippetTmp(aSnippet.copy(0, 1)); aSnippetTmp = m_aSub[m_nActual].CalcCaseMap( aSnippetTmp ); - aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.getLength(), OUString(aSnippet[0]) ); + aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.getLength(), rtl::OUStringChar(aSnippet[0]) ); } } diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index cf4983192b23..c8c6095726cb 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -226,7 +226,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, sal_Int32 const viewBlockPos(nBlockStart + nOffset); m_aMap.emplace_back(modelBlockPos, viewBlockPos, false); - m_aRetText = m_aRetText.replaceAt(nOffset + nBlockStart, nBlockLen, OUString()); + m_aRetText = m_aRetText.replaceAt(nOffset + nBlockStart, nBlockLen, u""); nOffset -= nBlockLen; } else diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 33509d405aad..5134d7672fa2 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2392,8 +2392,8 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart, abort(); } pDest->m_Text = pDest->m_Text.replaceAt(nDestStart, 0, - m_Text.copy(nTextStartIdx, nLen)); - OUString const newText = m_Text.replaceAt(nTextStartIdx, nLen, ""); + m_Text.subView(nTextStartIdx, nLen)); + OUString const newText = m_Text.replaceAt(nTextStartIdx, nLen, u""); nLen = pDest->m_Text.getLength() - nInitSize; // update w/ current size! if (!nLen) // String didn't grow? return; @@ -2639,7 +2639,7 @@ void SwTextNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount, ? m_Text.getLength() - nStartIdx : nCount; const sal_Int32 nEndIdx = nStartIdx + nCnt; if (nEndIdx <= m_Text.getLength()) - m_Text = m_Text.replaceAt(nStartIdx, nCnt, ""); + m_Text = m_Text.replaceAt(nStartIdx, nCnt, u""); // GCAttr(); don't remove all empty ones, just the ones that are in the // range but not at the end of the range. @@ -3679,10 +3679,10 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, { // Replace the 1st char, then delete the rest and insert. // This way the attributes of the 1st char are expanded! - m_Text = m_Text.replaceAt(nStartPos, 1, sInserted.copy(0, 1)); + m_Text = m_Text.replaceAt(nStartPos, 1, sInserted.subView(0, 1)); ++const_cast<SwIndex&>(rStart); - m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, ""); + m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, u""); Update( rStart, nLen - 1, true ); OUString aTmpText( sInserted.copy(1) ); @@ -3691,7 +3691,7 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, } else { - m_Text = m_Text.replaceAt(nStartPos, nLen, ""); + m_Text = m_Text.replaceAt(nStartPos, nLen, u""); Update( rStart, nLen, true ); m_Text = m_Text.replaceAt(nStartPos, 0, sInserted); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index e97df81267df..5aba3a2b6e64 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1389,7 +1389,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode ) // delete the char from the string assert(CH_TXTATR_BREAKWORD == m_Text[pAttr->GetStart()] || CH_TXTATR_INWORD == m_Text[pAttr->GetStart()]); - m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, ""); + m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, u""); // Update SwIndexes SwIndex aTmpIdx( this, pAttr->GetStart() ); Update( aTmpIdx, 1, true ); @@ -1420,7 +1420,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode ) // delete the char from the string assert(CH_TXTATR_BREAKWORD == m_Text[pAttr->GetStart()] || CH_TXTATR_INWORD == m_Text[pAttr->GetStart()]); - m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, ""); + m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, u""); // Update SwIndexes SwIndex aTmpIdx( this, pAttr->GetStart() ); Update( aTmpIdx, 1, true ); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 88c8b2ed1f76..ed1cdf38794d 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -589,7 +589,7 @@ bool SwUndoDelete::CanGrouping( SwDoc& rDoc, const SwPaM& rDelPam ) m_nEndContent++; // Delete: attach char at the end nUChrPos++; } - m_aSttStr = m_aSttStr->replaceAt( nUChrPos, 0, OUString(cDelChar) ); + m_aSttStr = m_aSttStr->replaceAt( nUChrPos, 0, rtl::OUStringChar(cDelChar) ); pDelTextNd->EraseText( pStt->nContent, 1 ); m_bGroup = true; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 729a2581075a..a09e6785c864 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2568,10 +2568,10 @@ static OUString OldNameToNewName_Impl( const OUString &rOld ) OUString sServiceNameCC( rOld ); sal_Int32 nIdx = sServiceNameCC.indexOf( aOldNamePart1 ); if (nIdx >= 0) - sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart1), ".textfield.docinfo." ); + sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart1), u".textfield.docinfo." ); nIdx = sServiceNameCC.indexOf( aOldNamePart2 ); if (nIdx >= 0) - sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart2), ".textfield." ); + sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart2), u".textfield." ); return sServiceNameCC; } diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 6618a5479165..de952e8552d8 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -886,7 +886,7 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFormat *pFormat, OString& rTok sal_Int32 nPos = rClass.indexOf( '.' ); if( nPos >= 0 && rClass.getLength() > nPos+1 ) { - rClass = rClass.replaceAt( 0, nPos+1, "" ); + rClass = rClass.replaceAt( 0, nPos+1, u"" ); } rClass = GetAppCharClass().lowercase( rClass ); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 73ab34c60616..2aee659fc6e8 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -2187,7 +2187,7 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL ) // Just remember it in a sorted array if( bEncoded ) { - aURL = aURL.replaceAt( nPos - 1, 3, OUString(cMarkSeparator) ); + aURL = aURL.replaceAt( nPos - 1, 3, rtl::OUStringChar(cMarkSeparator) ); } m_aImplicitMarks.insert( aURL ); } @@ -2209,7 +2209,7 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL ) m_aOutlineMarkPoss.insert( m_aOutlineMarkPoss.begin()+nIns, nIdx ); if( bEncoded ) { - aURL = aURL.replaceAt( nPos - 1, 3, OUString(cMarkSeparator) ); + aURL = aURL.replaceAt( nPos - 1, 3, rtl::OUStringChar(cMarkSeparator) ); } m_aOutlineMarks.insert( m_aOutlineMarks.begin()+nIns, aURL ); } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 94af6b26f7a1..60e6ea0f2924 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -2484,7 +2484,7 @@ void SwHTMLParser::InsertSelectText() { sal_Int32 nLen = rText.getLength(); if( !nLen || ' '==rText[nLen-1]) - aToken = aToken.replaceAt( 0, 1, "" ); + aToken = aToken.replaceAt( 0, 1, u"" ); } if( !aToken.isEmpty() ) rText += aToken; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index db4a0baad396..df4cef472ca2 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -672,13 +672,13 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, sal_Int32 nPos = aSection.indexOf( '%' ); while( nPos != -1 ) { - aSection = aSection.replaceAt(nPos, 1, "%25"); + aSection = aSection.replaceAt(nPos, 1, u"%25"); nPos = aSection.indexOf( '%', nPos+3 ); } nPos = aSection.indexOf( cDelim ); while( nPos != -1 ) { - aSection = aSection.replaceAt(nPos, 1, "%FF" ); + aSection = aSection.replaceAt(nPos, 1, u"%FF" ); nPos = aSection.indexOf( cDelim, nPos+3 ); } HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aSection, diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 2e47db39fe5e..80fcb68c4e06 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -869,7 +869,7 @@ namespace sw bool bIsCharA = ( nPos != -1 && IsNotAM( rParams, nPos ) ); bForceNatNum |= bIsCharA; if ( bIsCharA ) - rParams = rParams.replaceAt( nPos, 1, "D" ); + rParams = rParams.replaceAt( nPos, 1, u"D" ); nLastPos = nPos; } while ( -1 != nLastPos ); } @@ -898,7 +898,7 @@ namespace sw if ( nDocLang == LANGUAGE_FRENCH ) { if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) ) - rParams = rParams.replaceAt(nI, 1, "Y"); + rParams = rParams.replaceAt(nI, 1, u"Y"); } if (nChar == '/') { @@ -906,7 +906,7 @@ namespace sw // But not if it's a '/' inside AM/PM if (!(IsPreviousAM(rParams, nI) && IsNextPM(rParams, nI))) { - rParams = rParams.replaceAt(nI, 1, "\\/"); + rParams = rParams.replaceAt(nI, 1, u"\\/"); nLen++; } nI++; @@ -922,13 +922,13 @@ namespace sw if ( rLang == LANGUAGE_FINNISH ) { if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "V"); + rParams = rParams.replaceAt(nI, 1, u"V"); else if (nChar == 'm' || nChar == 'M') - rParams = rParams.replaceAt(nI, 1, "K"); + rParams = rParams.replaceAt(nI, 1, u"K"); else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "P"); + rParams = rParams.replaceAt(nI, 1, u"P"); else if (nChar == 'h' || nChar == 'H') - rParams = rParams.replaceAt(nI, 1, "T"); + rParams = rParams.replaceAt(nI, 1, u"T"); } else if ( rLang.anyOf( LANGUAGE_DANISH, @@ -939,7 +939,7 @@ namespace sw LANGUAGE_SWEDISH_FINLAND)) { if (nChar == 'h' || nChar == 'H') - rParams = rParams.replaceAt(nI, 1, "T"); + rParams = rParams.replaceAt(nI, 1, u"T"); } else if ( rLang.anyOf( LANGUAGE_PORTUGUESE, @@ -966,31 +966,31 @@ namespace sw LANGUAGE_SPANISH_PUERTO_RICO)) { if (nChar == 'a' || nChar == 'A') - rParams = rParams.replaceAt(nI, 1, "O"); + rParams = rParams.replaceAt(nI, 1, u"O"); else if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "A"); + rParams = rParams.replaceAt(nI, 1, u"A"); } else if ( rLang.anyOf( LANGUAGE_DUTCH, LANGUAGE_DUTCH_BELGIAN)) { if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "J"); + rParams = rParams.replaceAt(nI, 1, u"J"); else if (nChar == 'u' || nChar == 'U') - rParams = rParams.replaceAt(nI, 1, "H"); + rParams = rParams.replaceAt(nI, 1, u"H"); } else if ( rLang.anyOf( LANGUAGE_ITALIAN, LANGUAGE_ITALIAN_SWISS)) { if (nChar == 'a' || nChar == 'A') - rParams = rParams.replaceAt(nI, 1, "O"); + rParams = rParams.replaceAt(nI, 1, u"O"); else if (nChar == 'g' || nChar == 'G') - rParams = rParams.replaceAt(nI, 1, "X"); + rParams = rParams.replaceAt(nI, 1, u"X"); else if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "A"); + rParams = rParams.replaceAt(nI, 1, u"A"); else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "G"); + rParams = rParams.replaceAt(nI, 1, u"G"); } else if ( rLang.anyOf( LANGUAGE_GERMAN, @@ -1000,9 +1000,9 @@ namespace sw LANGUAGE_GERMAN_LIECHTENSTEIN)) { if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "J"); + rParams = rParams.replaceAt(nI, 1, u"J"); else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "T"); + rParams = rParams.replaceAt(nI, 1, u"T"); } else if ( rLang.anyOf( LANGUAGE_FRENCH, @@ -1013,9 +1013,9 @@ namespace sw LANGUAGE_FRENCH_MONACO)) { if (nChar == 'y' || nChar == 'Y' || nChar == 'a') - rParams = rParams.replaceAt(nI, 1, "A"); + rParams = rParams.replaceAt(nI, 1, u"A"); else if (nChar == 'd' || nChar == 'D' || nChar == 'j') - rParams = rParams.replaceAt(nI, 1, "J"); + rParams = rParams.replaceAt(nI, 1, u"J"); } } } @@ -1061,9 +1061,9 @@ namespace sw if (!nI || rFormat[nI-1]!='\\') { if (rFormat[nI]=='\"') - rFormat = rFormat.replaceAt(nI, 1, "\'"); + rFormat = rFormat.replaceAt(nI, 1, u"\'"); else if (rFormat[nI]=='\'') - rFormat = rFormat.replaceAt(nI, 1, "\""); + rFormat = rFormat.replaceAt(nI, 1, u"\""); } } } diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 857007872cea..4836678172e9 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -488,7 +488,7 @@ void MSWordExportBase::NumberingLevel( { *pLvlPos = static_cast<sal_uInt8>(nFnd + 1); ++pLvlPos; - sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), OUString(static_cast<char>(i))); + sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), rtl::OUStringChar(static_cast<char>(i))); } } } @@ -635,7 +635,7 @@ void MSWordExportBase::SubstituteBullet( OUString& rNumStr, // If Bullet char is "", don't change if (rNumStr[0] != u'\0') { - rNumStr = rNumStr.replaceAt(0, 1, OUString( + rNumStr = rNumStr.replaceAt(0, 1, rtl::OUStringChar( msfilter::util::bestFitOpenSymbolToMSFont(rNumStr[0], rChrSet, sFontName))); } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 6a1d32d4ee21..35476fd90c34 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -542,7 +542,7 @@ static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp) } const bool was0x14 = rString[nStopPos]==0x14; - rString = rString.replaceAt(nStartPos, nStopPos+1-nStartPos, ""); + rString = rString.replaceAt(nStartPos, nStopPos+1-nStartPos, u""); rNewStartCp += nStopPos-nStartPos; if (was0x14) @@ -551,7 +551,7 @@ static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp) nStartPos = rString.indexOf(0x15, nStartPos); if (nStartPos<0) return; - rString = rString.replaceAt(nStartPos, 1, ""); + rString = rString.replaceAt(nStartPos, 1, u""); } } } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index eba02826418e..85af5106bfaa 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -184,7 +184,7 @@ tools::Long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) case 0x0d: if( bAllowCr ) { - aVal = aVal.replaceAt( nI, 1, "\n" ); + aVal = aVal.replaceAt( nI, 1, u"\n" ); bSetAsHex = false; } else @@ -1058,29 +1058,29 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) case 132: // Exchange typographical quotation marks for normal ones case 148: case 147: - rStr = rStr.replaceAt( nI, 1, "\"" ); + rStr = rStr.replaceAt( nI, 1, u"\"" ); break; case 19: - rStr = rStr.replaceAt( nI, 1, "{" ); + rStr = rStr.replaceAt( nI, 1, u"{" ); break; // 19..21 to {|} case 20: - rStr = rStr.replaceAt( nI, 1, "|" ); + rStr = rStr.replaceAt( nI, 1, u"|" ); break; case 21: - rStr = rStr.replaceAt( nI, 1, "}" ); + rStr = rStr.replaceAt( nI, 1, u"}" ); break; case '\\': // Tag \{|} with \ ... case '{': case '|': case '}': - rStr = rStr.replaceAt( nI, 0, "\\" ); + rStr = rStr.replaceAt( nI, 0, u"\\" ); ++nI; break; case 0x0b: case 0x0c: case 0x0d: if( bAllowCr ) - rStr = rStr.replaceAt( nI, 1, "\n" ); + rStr = rStr.replaceAt( nI, 1, u"\n" ); else bSetAsHex = true; break; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 041412a32dba..83440e7bde58 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -555,7 +555,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableToFromHdl, weld::Button&, rButton, void const sal_Int32 nSel = nMax - nPos; if( nSel ) // first delete the existing selection - aStr = aStr.replaceAt( nPos, nSel, "" ); + aStr = aStr.replaceAt( nPos, nSel, u"" ); aField = OUStringChar(cDBFieldStart) + aField + OUStringChar(cDBFieldEnd); if( !aStr.isEmpty() ) diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index ee6733259408..2812cc3be8a5 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -101,7 +101,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( weld::Window* pParent, SwDocShell& rDocSh, if(sAsciiOptions.isEmpty()) sAsciiOptions = m_sExtraData.copy(nStt, nEnd - nStt); nStt -= nDialogExtraDataLen; - m_sExtraData = m_sExtraData.replaceAt(nStt, nEnd - nStt + 1, ""); + m_sExtraData = m_sExtraData.replaceAt(nStt, nEnd - nStt + 1, u""); } } if(!sAsciiOptions.isEmpty()) @@ -303,7 +303,7 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) sal_Int32 nEnd = m_sExtraData.indexOf( cDialogExtraDataClose, nStt + nDialogExtraDataLen ); if( -1 != nEnd ) - m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" ); + m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, u"" ); } m_sExtraData += sFindNm + sData + OUStringChar(cDialogExtraDataClose); } diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 4bb9ed9f49c1..47af40becc01 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -125,7 +125,7 @@ static const SwFrameFormat *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& OUString sDBName; if( (!rItem.m_bSynchron || !(nCol|nRow)) && !(sDBName = InsertLabEnvText( rSh, rFieldMgr, rItem.m_aWriting )).isEmpty() && !bLast ) { - sDBName = comphelper::string::setToken(sDBName, 3, DB_DELIM, "True"); + sDBName = comphelper::string::setToken(sDBName, 3, DB_DELIM, u"True"); SwInsertField_Data aData(SwFieldTypesEnum::DatabaseNextSet, 0, sDBName, OUString(), 0, &rSh); rFieldMgr.InsertField( aData ); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index fb1aedb3bdd7..9323c52770b2 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2686,7 +2686,7 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference OUString sNewName = rURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::Unambiguous); sal_Int32 nExtLen = sExt.getLength(); - sNewName = sNewName.replaceAt(sNewName.getLength() - nExtLen - 1, nExtLen + 1, ""); + sNewName = sNewName.replaceAt(sNewName.getLength() - nExtLen - 1, nExtLen + 1, u""); //find a unique name if sNewName already exists sFind = sNewName; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 4c8608c4a5b9..85e5eb8fb275 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6085,7 +6085,7 @@ void QuickHelpData::FillStrArr( SwWrtShell const & rSh, const OUString& rWord ) else { // First character is not lower case i.e. assume upper or title case - OUString sWordSentence = sWordLower.replaceAt( 0, 1, OUString(rWord[0]) ); + OUString sWordSentence = sWordLower.replaceAt( 0, 1, rtl::OUStringChar(rWord[0]) ); if ( rWord == sWordSentence ) aWordCase = CASE_SENTENCE; else @@ -6121,7 +6121,7 @@ void QuickHelpData::FillStrArr( SwWrtShell const & rSh, const OUString& rWord ) if ( aWordCase == CASE_LOWER ) sStr = rCC.lowercase(rStr); else if ( aWordCase == CASE_SENTENCE ) - sStr = rCC.lowercase(rStr).replaceAt(0, 1, OUString(rStr[0])); + sStr = rCC.lowercase(rStr).replaceAt(0, 1, rtl::OUStringChar(rStr[0])); else if ( aWordCase == CASE_UPPER ) sStr = rCC.uppercase(rStr); @@ -6172,7 +6172,7 @@ void QuickHelpData::FillStrArr( SwWrtShell const & rSh, const OUString& rWord ) sStr = rCC.lowercase(aCompletedString); else if (aWordCase == CASE_SENTENCE) sStr = rCC.lowercase(aCompletedString) - .replaceAt(0, 1, OUString(aCompletedString[0])); + .replaceAt(0, 1, rtl::OUStringChar(aCompletedString[0])); else if (aWordCase == CASE_UPPER) sStr = rCC.uppercase(aCompletedString); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index e27a0a7d4c9b..cf5041236ee7 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1173,7 +1173,7 @@ namespace { // cut out the alignment string aStr = rExtraString.copy(nPos, n2 - nPos + 1); - rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, ""); + rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, u""); aStr = aStr.copy(n1 - nPos + 1); } } diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index de01e243399c..0de6c4863ada 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -132,20 +132,20 @@ namespace SwLangHelper if (-1 != (nPos = aNewLangText.indexOf( aSelectionLangPrefix ))) { // ... for the current selection - aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), u""); bForSelection = true; } else if (-1 != (nPos = aNewLangText.indexOf( aParagraphLangPrefix ))) { // ... for the current paragraph language - aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), u""); bForSelection = true; bForParagraph = true; } else if (-1 != (nPos = aNewLangText.indexOf( aDocumentLangPrefix ))) { // ... as default document language - aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), u""); bForSelection = false; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index f3b83841ccf1..0436659b20a0 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -478,20 +478,20 @@ void SwTextShell::Execute(SfxRequest &rReq) if (-1 != (nPos = aNewLangText.indexOf( aSelectionLangPrefix ))) { // ... for the current selection - aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), u""); bForSelection = true; } else if (-1 != (nPos = aNewLangText.indexOf(aParagraphLangPrefix))) { // ... for the current paragraph language - aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), u""); bForSelection = true; bForParagraph = true; } else if (-1 != (nPos = aNewLangText.indexOf(aDocumentLangPrefix))) { // ... as default document language - aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), ""); + aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), u""); bForSelection = false; } @@ -1574,12 +1574,12 @@ void SwTextShell::Execute(SfxRequest &rReq) uno::Reference< linguistic2::XSpellAlternatives > xSpellAlt; if(-1 != (nPos = sApplyText.indexOf( sGrammarRule ))) { - sApplyText = sApplyText.replaceAt(nPos, sGrammarRule.getLength(), ""); + sApplyText = sApplyText.replaceAt(nPos, sGrammarRule.getLength(), u""); bGrammar = true; } else if (-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { - sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), ""); + sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), u""); SwRect aToFill; xSpellAlt.set(rWrtSh.GetCorrection(nullptr, aToFill)); bGrammar = false; diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a5c2791da06b..050df4445d0c 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -183,7 +183,7 @@ static OUString lcl_ConvertTabsToSpaces( const OUString& sLine ) } // Not 4 blanks, but on 4th TabPos: const sal_Int32 nPadLen = 4 - (nPos % 4); - aRet = aRet.replaceAt(nPos, 1, OUString(aPadSpaces, nPadLen)); + aRet = aRet.replaceAt(nPos, 1, std::u16string_view{aPadSpaces, static_cast<size_t>(nPadLen)}); nPos += nPadLen; } return aRet; diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 6f4dfd068304..dee820474a73 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2291,7 +2291,7 @@ namespace void lcl_Erase(OUStringBuffer &rBuf, sal_Int32 index, sal_Int32 count) { OUString sTemp(rBuf.makeStringAndClear()); - rBuf.append(sTemp.replaceAt(index, count, OUString())); + rBuf.append(sTemp.replaceAt(index, count, u"")); } } diff --git a/ucb/source/ucp/hierarchy/hierarchyuri.cxx b/ucb/source/ucp/hierarchy/hierarchyuri.cxx index 90aab6235ef1..618a640229c5 100644 --- a/ucb/source/ucp/hierarchy/hierarchyuri.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyuri.cxx @@ -92,7 +92,7 @@ void HierarchyUri::init() const m_aUri = m_aUri.replaceAt( HIERARCHY_URL_SCHEME.getLength() + 2, 0, - "/" + DEFAULT_DATA_SOURCE_SERVICE + "/" ); + rtl::OUStringConcatenation("/" + DEFAULT_DATA_SOURCE_SERVICE + "/") ); m_aService = DEFAULT_DATA_SOURCE_SERVICE; nPos diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index aeda577a2615..3164ba873bae 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -601,7 +601,7 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem, { sal_Int32 nPos2 = aText.indexOf( ')' ); if( nPos2 != -1 ) - aText = aText.replaceAt( nPos, nPos2-nPos+1, "" ); + aText = aText.replaceAt( nPos, nPos2-nPos+1, u"" ); } } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index de3de3d6e1f7..1f728ce03ab4 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -376,7 +376,7 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) sal_Int32 nP = m_pImplLB->GetEntryList().FindEntry( aToken ); if ((nP != LISTBOX_ENTRY_NOTFOUND) && (!m_pImplLB->GetEntryList().IsEntryPosSelected(nP))) { - aText = aText.replaceAt( nPrevIndex, nTokenLen, "" ); + aText = aText.replaceAt( nPrevIndex, nTokenLen, u"" ); nIndex = nIndex - nTokenLen; sal_Int32 nSepCount=0; if ((nPrevIndex+nSepCount < aText.getLength()) && (aText[nPrevIndex+nSepCount] == m_cMultiSep)) @@ -384,7 +384,7 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) nIndex--; ++nSepCount; } - aText = aText.replaceAt( nPrevIndex, nSepCount, "" ); + aText = aText.replaceAt( nPrevIndex, nSepCount, u"" ); } aText = comphelper::string::strip(aText, ' '); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index a3e2264d3f8c..9e39516887c4 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -264,7 +264,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth ) do { if (pItem->maFormatText.getLength() > aAppendStr.getLength()) - pItem->maFormatText = pItem->maFormatText.replaceAt( pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, "" ); + pItem->maFormatText = pItem->maFormatText.replaceAt( pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, u"" ); aSize.setWidth( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText ) ); aSize.AdjustWidth(aImageSize.Width() ); aSize.AdjustWidth(TAB_TABOFFSET_X*2 ); diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index 2be8c372c273..9e0c80b96815 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -271,13 +271,13 @@ void TextNode::InsertText( sal_Int32 nPos, const OUString& rText ) void TextNode::InsertText( sal_Int32 nPos, sal_Unicode c ) { - maText = maText.replaceAt( nPos, 0, OUString(c) ); + maText = maText.replaceAt( nPos, 0, rtl::OUStringChar(c) ); ExpandAttribs( nPos, 1 ); } void TextNode::RemoveText( sal_Int32 nPos, sal_Int32 nChars ) { - maText = maText.replaceAt( nPos, nChars, "" ); + maText = maText.replaceAt( nPos, nChars, u"" ); CollapseAttribs( nPos, nChars ); } diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 64e4e6929dea..a314a6ca1660 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -69,7 +69,7 @@ OUString FilterConfigCache::FilterConfigCacheEntry::GetShortName() { aShortName = lExtensionList[ 0 ]; if ( aShortName.startsWith( "*." ) ) - aShortName = aShortName.replaceAt( 0, 2, "" ); + aShortName = aShortName.replaceAt( 0, 2, u"" ); } return aShortName; } @@ -375,7 +375,7 @@ OUString FilterConfigCache::GetImportWildcard(sal_uInt16 nFormat, sal_Int32 nEnt { OUString aWildcard( GetImportFormatExtension( nFormat, nEntry ) ); if ( !aWildcard.isEmpty() ) - aWildcard = aWildcard.replaceAt( 0, 0, "*." ); + aWildcard = aWildcard.replaceAt( 0, 0, u"*." ); return aWildcard; } @@ -473,7 +473,7 @@ OUString FilterConfigCache::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEn { OUString aWildcard( GetExportFormatExtension( nFormat, nEntry ) ); if ( !aWildcard.isEmpty() ) - aWildcard = aWildcard.replaceAt( 0, 0, "*." ); + aWildcard = aWildcard.replaceAt( 0, 0, u"*." ); return aWildcard; } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 48dda1916a0f..3db1ca90f235 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7054,7 +7054,7 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, tools::Long nWidth, Fo // do not get broader than nWidth modulo 1 character while( GetTextWidth( aStrikeout ) >= nWidth ) - aStrikeout = aStrikeout.replaceAt( 0, 1, "" ); + aStrikeout = aStrikeout.replaceAt( 0, 1, u"" ); aStrikeout += aStrikeoutChar; bool bShadow = m_aCurrentPDFState.m_aFont.IsShadow(); if ( bShadow ) diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx index 6df732c09d97..a5637c3bb452 100644 --- a/vcl/source/image/ImplImage.cxx +++ b/vcl/source/image/ImplImage.cxx @@ -66,7 +66,7 @@ bool ImplImage::loadStockAtScale(double fScale, BitmapEx &rBitmapEx) sal_Int32 nStart = maStockName.indexOf("%3f"); sal_Int32 nEnd = maStockName.lastIndexOf("."); - OUString aFileName = maStockName.replaceAt(nStart, nEnd - nStart, ""); + OUString aFileName = maStockName.replaceAt(nStart, nEnd - nStart, u""); if (!ImageTree::get().loadImage(aFileName, aIconTheme, aBitmapEx, true, nScalePercentage, eScalingFlags)) { diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index bdeee4fbc428..8fb3a2c87118 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2023,7 +2023,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, { if ( (nIndex > 1) || (nIndex == aStr.getLength()) ) nIndex--; - aStr = aStr.replaceAt( nIndex, 1, ""); + aStr = aStr.replaceAt( nIndex, 1, u""); } } @@ -2295,12 +2295,12 @@ OUString OutputDevice::GetNonMnemonicString( const OUString& rStr, sal_Int32& rM { if ( rMnemonicPos == -1 ) rMnemonicPos = i; - aStr = aStr.replaceAt( i, 1, "" ); + aStr = aStr.replaceAt( i, 1, u"" ); nLen--; } else { - aStr = aStr.replaceAt( i, 1, "" ); + aStr = aStr.replaceAt( i, 1, u"" ); nLen--; i++; } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 35422acc2273..f86501cc8def 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -1875,7 +1875,7 @@ bool TransferableDataHelper::GetINetBookmark( const css::datatransfer::DataFlavo } aURL = aString.copy( nStart + 1, nLen ); - aString = aString.replaceAt( 0, nStart + 1 + nLen, "" ); + aString = aString.replaceAt( 0, nStart + 1 + nLen, u"" ); nStart = aString.indexOf( '@' ); nLen = aString.toInt32(); diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 4dd12668b48d..d412b2ad4071 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -195,7 +195,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey ) if ( maMnemonics[nMnemonicIndex] ) { maMnemonics[nMnemonicIndex] = 0; - rKey = rKey.replaceAt( nIndex, 0, OUString(m_cMnemonic) ); + rKey = rKey.replaceAt( nIndex, 0, rtl::OUStringChar(m_cMnemonic) ); bChanged = true; break; } @@ -247,7 +247,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey ) if ( nBestCount != 0xFFFF ) { maMnemonics[nBestMnemonicIndex] = 0; - rKey = rKey.replaceAt( nBestIndex, 0, OUString(m_cMnemonic) ); + rKey = rKey.replaceAt( nBestIndex, 0, rtl::OUStringChar(m_cMnemonic) ); bChanged = true; } } @@ -327,7 +327,7 @@ OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr ) aStr[ i+2 ] == ')' && c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END ) { - aStr = aStr.replaceAt( i-1, 4, "" ); + aStr = aStr.replaceAt( i-1, 4, u"" ); nLen -= 4; i--; continue; @@ -335,7 +335,7 @@ OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr ) } // remove standard mnemonics - aStr = aStr.replaceAt( i, 1, "" ); + aStr = aStr.replaceAt( i, 1, u"" ); nLen--; } else diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 8ea34f144054..f9309413825e 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1320,7 +1320,7 @@ void PPDParser::parseOrderDependency(const OString& rLine) OUString aKey(OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); if( aKey[ 0 ] != '*' ) return; // invalid order dependency - aKey = aKey.replaceAt( 0, 1, "" ); + aKey = aKey.replaceAt( 0, 1, u"" ); PPDKey* pKey; PPDParser::hash_type::const_iterator keyit = m_aKeys.find( aKey ); @@ -1354,7 +1354,7 @@ void PPDParser::parseConstraint( const OString& rLine ) OUString aLine(OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252)); sal_Int32 nIdx = rLine.indexOf(':'); if (nIdx != -1) - aLine = aLine.replaceAt(0, nIdx + 1, ""); + aLine = aLine.replaceAt(0, nIdx + 1, u""); PPDConstraint aConstraint; int nTokens = GetCommandLineTokenCount( aLine ); for( int i = 0; i < nTokens; i++ ) @@ -1362,7 +1362,7 @@ void PPDParser::parseConstraint( const OString& rLine ) OUString aToken = GetCommandLineToken( i, aLine ); if( !aToken.isEmpty() && aToken[ 0 ] == '*' ) { - aToken = aToken.replaceAt( 0, 1, "" ); + aToken = aToken.replaceAt( 0, 1, u"" ); if( aConstraint.m_pKey1 ) aConstraint.m_pKey2 = getKey( aToken ); else diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 8c0e638d024b..3c52b7ca3981 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -439,11 +439,11 @@ shrinkFilterName( const OUString &rFilterName, bool bAllowNoStar = false ) if( nBracketEnd <= 0 ) continue; if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) ) - aRealName = aRealName.replaceAt( i, nBracketLen + 1, OUString() ); + aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); else if (bAllowNoStar) { if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), ".") ) - aRealName = aRealName.replaceAt( i, nBracketLen + 1, OUString() ); + aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); } } } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b52969e300a7..97cb3511506b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3978,7 +3978,7 @@ static OUString lcl_ParseFormat( const OUString& rCommand ) if (delimPos != -1) { sal_Int32 wsChars = rCommand.indexOf('\"') - delimPos - 2; - command = rCommand.replaceAt(delimPos+2, wsChars, ""); + command = rCommand.replaceAt(delimPos+2, wsChars, u""); } else command = rCommand; @@ -4973,7 +4973,7 @@ void DomainMapper_Impl::handleFieldFormula sal_Int32 delimPos = command.indexOf("\\#"); if (delimPos != -1) { - command = command.replaceAt(delimPos, command.getLength() - delimPos, "").trim(); + command = command.replaceAt(delimPos, command.getLength() - delimPos, u"").trim(); } // command must contains = and at least another char diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 17e3116e26ad..d7dd36714dea 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -464,7 +464,7 @@ TVChildTarget::SearchAndInsert(std::unique_ptr<TVDom> p, TVDom* tvDom) for(i = tvDom->children.begin(); i!=tvDom->children.end(); ++i) if (!((*i)->isLeaf()) && ((*i)->id.getLength() == p->id.getLength()) && - (p->id.replaceAt((*i)->parent->id.getLength(), p->id.getLength()-(*i)->parent->id.getLength(), "") == (*i)->parent->id)) //prefix check + (p->id.replaceAt((*i)->parent->id.getLength(), p->id.getLength()-(*i)->parent->id.getLength(), u"") == (*i)->parent->id)) //prefix check { h = true; c_int = (*i)->id.toInt32(); diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index bc2f7f948130..87f653873904 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -2014,7 +2014,7 @@ void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex ) sal_Int32 nPos = sRealCond.indexOf( "!=" ); if ( nPos >= 0 ) { - sRealCond = sRealCond.replaceAt( nPos, 2, "<>" ); + sRealCond = sRealCond.replaceAt( nPos, 2, u"<>" ); } nPos = sRealCond.indexOf( '.' ); |