basctl/source/basicide/baside2b.cxx | 6 - basic/source/runtime/runtime.cxx | 2 chart2/source/inc/CommonConverters.hxx | 2 chart2/source/tools/CommonConverters.cxx | 2 comphelper/source/misc/logging.cxx | 2 comphelper/source/misc/string.cxx | 2 connectivity/source/commontools/DateConversion.cxx | 2 connectivity/source/commontools/dbtools2.cxx | 4 connectivity/source/commontools/predicateinput.cxx | 2 connectivity/source/drivers/dbase/DTable.cxx | 2 connectivity/source/drivers/firebird/Tables.cxx | 2 connectivity/source/drivers/firebird/Util.cxx | 2 connectivity/source/drivers/flat/ETable.cxx | 2 connectivity/source/drivers/hsqldb/HTable.cxx | 2 connectivity/source/drivers/mysql_jdbc/YTable.cxx | 2 connectivity/source/drivers/mysql_jdbc/YTables.cxx | 2 connectivity/source/parse/sqlnode.cxx | 8 - connectivity/source/resource/sharedresources.cxx | 2 cui/source/customize/cfg.cxx | 4 cui/source/dialogs/about.cxx | 2 cui/source/dialogs/hyphen.cxx | 4 cui/source/dialogs/scriptdlg.cxx | 12 +- cui/source/tabpages/numfmt.cxx | 6 - dbaccess/source/filter/hsqldb/utils.cxx | 2 dbaccess/source/ui/dlg/dbwizsetup.cxx | 2 dbaccess/source/ui/querydesign/QueryDesignView.cxx | 6 - editeng/inc/editdoc.hxx | 2 editeng/qa/unit/core-test.cxx | 2 editeng/source/editeng/editdoc.cxx | 8 - editeng/source/editeng/eehtml.cxx | 2 editeng/source/editeng/impedit2.cxx | 6 - extensions/source/abpilot/abpfinalpage.cxx | 2 forms/source/component/Edit.cxx | 2 formula/source/core/api/FormulaCompiler.cxx | 10 +- framework/source/uielement/fontmenucontroller.cxx | 2 i18npool/source/inputchecker/inputsequencechecker.cxx | 2 i18npool/source/inputchecker/inputsequencechecker_hi.cxx | 2 i18npool/source/inputchecker/inputsequencechecker_th.cxx | 10 +- include/comphelper/string.hxx | 2 include/rtl/string.h | 5 + include/rtl/string.hxx | 12 ++ include/rtl/ustring.h | 5 + include/rtl/ustring.hxx | 12 ++ oox/source/drawingml/chart/chartconverter.cxx | 2 oox/source/ole/vbaexport.cxx | 2 reportdesign/source/core/api/Group.cxx | 4 reportdesign/source/core/api/ReportDefinition.cxx | 10 +- reportdesign/source/core/api/Section.cxx | 4 reportdesign/source/core/api/Tools.cxx | 2 reportdesign/source/core/inc/Tools.hxx | 2 reportdesign/source/filter/xml/xmlExport.cxx | 2 reportdesign/source/filter/xml/xmlGroup.cxx | 2 reportdesign/source/ui/dlg/Formula.cxx | 2 sal/rtl/bootstrap.cxx | 2 sal/rtl/string.cxx | 36 +++++++ sal/rtl/strtmpl.hxx | 74 +++++++++++++++ sal/rtl/ustring.cxx | 7 + sal/util/sal.map | 6 + sc/qa/unit/subsequent_export_test2.cxx | 4 sc/source/core/data/global2.cxx | 2 sc/source/core/tool/address.cxx | 2 sc/source/core/tool/compiler.cxx | 6 - sc/source/core/tool/interpr1.cxx | 10 +- sc/source/core/tool/rangenam.cxx | 2 sc/source/core/tool/rangeutl.cxx | 2 sc/source/filter/dif/difexp.cxx | 2 sc/source/filter/excel/xecontent.cxx | 4 sc/source/filter/excel/xicontent.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/ftools/ftools.cxx | 4 sc/source/filter/oox/formulabase.cxx | 2 sc/source/filter/oox/worksheetbuffer.cxx | 2 sc/source/filter/oox/worksheethelper.cxx | 2 sc/source/ui/Accessibility/AccessibleCell.cxx | 12 +- sc/source/ui/app/inputhdl.cxx | 4 sc/source/ui/docshell/docsh4.cxx | 8 - sc/source/ui/docshell/impex.cxx | 2 sc/source/ui/miscdlgs/acredlin.cxx | 2 sc/source/ui/navipi/content.cxx | 2 sc/source/ui/unoobj/addruno.cxx | 2 sc/source/ui/unoobj/chart2uno.cxx | 2 sc/source/ui/view/output2.cxx | 2 sc/source/ui/view/viewfunc.cxx | 4 sd/source/core/drawdoc2.cxx | 10 +- sd/source/filter/eppt/pptx-epptooxml.cxx | 2 sd/source/ui/dlg/custsdlg.cxx | 2 sd/source/ui/docshell/docshel3.cxx | 8 - sdext/source/minimizer/informationdialog.cxx | 2 sfx2/source/appl/childwin.cxx | 4 sfx2/source/dialog/dockwin.cxx | 4 sfx2/source/dialog/filedlghelper.cxx | 2 sfx2/source/doc/doctemplates.cxx | 2 sfx2/source/doc/new.cxx | 4 shell/source/win32/spsupp/spsuppHelper.cxx | 2 starmath/source/view.cxx | 6 - svtools/source/svhtml/parhtml.cxx | 10 +- svx/source/dialog/fntctrl.cxx | 2 svx/source/fmcomp/gridcell.cxx | 2 svx/source/svdraw/svdobj.cxx | 2 sw/source/core/access/acccell.cxx | 12 +- sw/source/core/crsr/swcrsr.cxx | 2 sw/source/core/edit/autofmt.cxx | 2 sw/source/core/fields/expfld.cxx | 6 - sw/source/core/table/swtable.cxx | 4 sw/source/core/text/porfld.cxx | 2 sw/source/core/txtnode/fntcache.cxx | 8 - sw/source/core/txtnode/modeltoviewhelper.cxx | 2 sw/source/core/txtnode/ndtxt.cxx | 12 +- sw/source/core/txtnode/thints.cxx | 4 sw/source/core/undo/undel.cxx | 2 sw/source/core/unocore/unofield.cxx | 4 sw/source/filter/html/css1atr.cxx | 2 sw/source/filter/html/htmlflywriter.cxx | 4 sw/source/filter/html/htmlform.cxx | 2 sw/source/filter/html/wrthtml.cxx | 4 sw/source/filter/ww8/writerwordglue.cxx | 44 ++++---- sw/source/filter/ww8/wrtw8num.cxx | 4 sw/source/filter/ww8/ww8graf.cxx | 4 sw/source/filter/ww8/ww8par5.cxx | 14 +- sw/source/ui/dbui/dbinsdlg.cxx | 2 sw/source/ui/dialog/ascfldlg.cxx | 4 sw/source/uibase/app/applab.cxx | 2 sw/source/uibase/dbui/dbmgr.cxx | 2 sw/source/uibase/docvw/edtwin.cxx | 6 - sw/source/uibase/misc/redlndlg.cxx | 2 sw/source/uibase/shells/langhelper.cxx | 6 - sw/source/uibase/shells/textsh1.cxx | 10 +- sw/source/uibase/uiview/srcview.cxx | 2 tools/source/fsys/urlobj.cxx | 2 ucb/source/ucp/hierarchy/hierarchyuri.cxx | 2 vcl/osx/salmenu.cxx | 2 vcl/source/control/combobox.cxx | 4 vcl/source/control/tabctrl.cxx | 2 vcl/source/edit/textdoc.cxx | 4 vcl/source/filter/FilterConfigCache.cxx | 6 - vcl/source/gdi/pdfwriter_impl.cxx | 2 vcl/source/image/ImplImage.cxx | 2 vcl/source/outdev/text.cxx | 6 - vcl/source/treelist/transfer.cxx | 2 vcl/source/window/mnemonic.cxx | 8 - vcl/unx/generic/printer/ppdparser.cxx | 6 - vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 4 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 xmlhelp/source/treeview/tvread.cxx | 2 xmloff/source/style/xmlnumfi.cxx | 2 145 files changed, 436 insertions(+), 279 deletions(-)
New commits: commit ec1c4c49301758c54394f9943252e192ad54638b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Nov 22 14:08:27 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 23 14:00:08 2021 +0100 O[U]String::replaceAt overloads that take string_view which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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 ... etc. - the rest is truncated