summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-11-22 14:08:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-23 14:00:08 +0100
commitec1c4c49301758c54394f9943252e192ad54638b (patch)
treeb53af3cb9154a388495b1af35c3f8ff41d6ebe1f /editeng
parentdb0f2c29bf3a6ad5a08f8524ea0e65aa90792bb2 (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editdoc.hxx2
-rw-r--r--editeng/qa/unit/core-test.cxx2
-rw-r--r--editeng/source/editeng/editdoc.cxx8
-rw-r--r--editeng/source/editeng/eehtml.cxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx6
5 files changed, 10 insertions, 10 deletions
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;
}
}