From ec1c4c49301758c54394f9943252e192ad54638b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 22 Nov 2021 14:08:27 +0200 Subject: 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 --- 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 +- 29 files changed, 87 insertions(+), 87 deletions(-) (limited to 'sw/source') 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(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(nFnd + 1); ++pLvlPos; - sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), OUString(static_cast(i))); + sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), rtl::OUStringChar(static_cast(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(nPadLen)}); nPos += nPadLen; } return aRet; -- cgit