sw/inc/ToxWhitespaceStripper.hxx             |    2 
 sw/inc/calc.hxx                              |    8 +--
 sw/inc/doc.hxx                               |    2 
 sw/inc/docufld.hxx                           |    2 
 sw/inc/fmtmeta.hxx                           |    2 
 sw/inc/hhcwrp.hxx                            |    2 
 sw/inc/modcfg.hxx                            |    2 
 sw/inc/ndtxt.hxx                             |    2 
 sw/inc/shellio.hxx                           |    2 
 sw/inc/swtable.hxx                           |    2 
 sw/inc/tox.hxx                               |    6 +-
 sw/inc/unocrsrhelper.hxx                     |    4 -
 sw/inc/unotbl.hxx                            |   10 ++--
 sw/inc/unotextcursor.hxx                     |    2 
 sw/inc/unotextrange.hxx                      |    2 
 sw/qa/core/test_ToxMiscTest.cxx              |    2 
 sw/qa/core/test_ToxWhitespaceStripper.cxx    |   22 ++++-----
 sw/qa/core/uwriter.cxx                       |   58 ++++++++++++------------
 sw/qa/extras/odfexport/odfexport.cxx         |   12 ++---
 sw/qa/extras/uiwriter/uiwriter7.cxx          |    8 +--
 sw/source/core/access/accpara.cxx            |    8 +--
 sw/source/core/access/accpara.hxx            |    4 -
 sw/source/core/doc/docchart.cxx              |   18 +++----
 sw/source/core/doc/docnum.cxx                |    6 +-
 sw/source/core/docnode/ndtbl.cxx             |    6 +-
 sw/source/core/edit/autofmt.cxx              |   18 +++----
 sw/source/core/fields/docufld.cxx            |   16 ++----
 sw/source/core/fields/reffld.cxx             |    6 +-
 sw/source/core/inc/UndoCore.hxx              |   16 +++---
 sw/source/core/inc/scriptinfo.hxx            |    4 -
 sw/source/core/inc/swblocks.hxx              |    4 -
 sw/source/core/inc/txtfrm.hxx                |    2 
 sw/source/core/swg/swblocks.cxx              |   12 ++---
 sw/source/core/text/itratr.hxx               |    2 
 sw/source/core/text/porlay.cxx               |    6 +-
 sw/source/core/text/redlnitr.cxx             |    4 -
 sw/source/core/text/txtfrm.cxx               |    8 +--
 sw/source/core/tox/ToxWhitespaceStripper.cxx |    4 -
 sw/source/core/tox/tox.cxx                   |   64 +++++++++++++--------------
 sw/source/core/txtnode/fmtatr2.cxx           |    4 -
 sw/source/core/txtnode/justify.cxx           |   21 ++++----
 sw/source/core/txtnode/justify.hxx           |    8 +--
 sw/source/core/txtnode/txtedt.cxx            |   14 ++---
 sw/source/core/undo/undel.cxx                |   16 +++---
 sw/source/core/undo/undobj.cxx               |   10 ++--
 sw/source/core/unocore/unocrsrhelper.cxx     |   20 ++++----
 sw/source/core/unocore/unoobj.cxx            |    8 +--
 sw/source/core/unocore/unoobj2.cxx           |   18 +++----
 sw/source/core/unocore/unotbl.cxx            |   34 +++++++-------
 sw/source/core/unocore/unotext.cxx           |    4 -
 sw/source/filter/html/htmlflywriter.cxx      |   28 ++++++-----
 sw/source/filter/html/htmlftn.cxx            |   20 ++++----
 sw/source/filter/html/swhtml.hxx             |    4 -
 sw/source/filter/html/wrthtml.hxx            |    2 
 sw/source/filter/ww8/writerwordglue.cxx      |   30 ++++++------
 sw/source/filter/ww8/wrtw8sty.cxx            |    8 +--
 sw/source/filter/ww8/wrtww8.hxx              |    2 
 sw/source/filter/ww8/ww8par.cxx              |   18 +++----
 sw/source/filter/ww8/ww8par.hxx              |    6 +-
 sw/source/filter/ww8/ww8par5.cxx             |   46 +++++++++----------
 sw/source/filter/ww8/ww8scan.cxx             |    8 +--
 sw/source/ui/dbui/dbinsdlg.cxx               |   15 +++---
 sw/source/ui/dialog/uiregionsw.cxx           |    4 -
 sw/source/ui/vba/vbarangehelper.cxx          |   14 ++---
 sw/source/ui/vba/vbarangehelper.hxx          |    2 
 sw/source/ui/vba/vbatemplate.cxx             |    8 +--
 sw/source/uibase/config/modcfg.cxx           |   12 ++---
 sw/source/uibase/dbui/mailmergehelper.cxx    |   10 ++--
 sw/source/uibase/dochdl/gloshdl.cxx          |    4 -
 sw/source/uibase/docvw/srcedtw.cxx           |   26 +++++-----
 sw/source/uibase/inc/gloshdl.hxx             |    2 
 sw/source/uibase/inc/mailmergehelper.hxx     |    2 
 sw/source/uibase/inc/srcedtw.hxx             |    2 
 sw/source/uibase/lingu/hhcwrp.cxx            |    6 +-
 sw/source/uibase/misc/glosdoc.cxx            |   10 ++--
 sw/source/uibase/uiview/view2.cxx            |   26 +++++-----
 76 files changed, 416 insertions(+), 416 deletions(-)

New commits:
commit 71337b4327805b73e92c995153c5746d89793b13
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Oct 10 12:09:44 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Oct 11 08:44:09 2022 +0200

    use more string_view in sw
    
    Change-Id: Ibefb8549834ba5011286e3221f1ae276e2c0c0bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141153
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/ToxWhitespaceStripper.hxx b/sw/inc/ToxWhitespaceStripper.hxx
index 9decbc020bf4..755c3f721af2 100644
--- a/sw/inc/ToxWhitespaceStripper.hxx
+++ b/sw/inc/ToxWhitespaceStripper.hxx
@@ -31,7 +31,7 @@ namespace sw
 class ToxWhitespaceStripper
 {
 public:
-    ToxWhitespaceStripper(const OUString&);
+    ToxWhitespaceStripper(std::u16string_view);
 
     sal_Int32 GetPositionInStrippedString(sal_Int32 pos) const;
 
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index f88fe8582f6c..e91ede14e6a5 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -162,14 +162,14 @@ public:
     std::unique_ptr<T> const & operator[](size_t idx) const { return 
m_aData[idx]; }
     void resize(size_t nSize) { m_aData.resize(nSize); }
 
-    T* Find( const OUString& rStr, sal_uInt32* pPos = nullptr ) const
+    T* Find( std::u16string_view aStr, sal_uInt32* pPos = nullptr ) const
     {
         size_t nTableSize = m_aData.size();
         assert(nTableSize < SAL_MAX_UINT32);
         sal_uInt32 ii = 0;
-        for( sal_Int32 n = 0; n < rStr.getLength(); ++n )
+        for( size_t n = 0; n < aStr.size(); ++n )
         {
-            ii = ii << 1 ^ rStr[n];
+            ii = ii << 1 ^ aStr[n];
         }
         ii %= nTableSize;
 
@@ -178,7 +178,7 @@ public:
 
         for( T* pEntry = m_aData[ii].get(); pEntry; pEntry = 
static_cast<T*>(pEntry->pNext.get()) )
         {
-            if( rStr == pEntry->aStr )
+            if( aStr == pEntry->aStr )
             {
                 return pEntry;
             }
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5e552cfcadc9..f5e868494cf6 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1263,7 +1263,7 @@ public:
     SwTableLineFormat* MakeTableLineFormat();
 
     // helper function: cleanup before checking number value
-    bool IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& 
fOutNumber);
+    bool IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, 
double& fOutNumber);
     // Check if box has numerical value. Change format of box if required.
     void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
     void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 76c0c2cb1f51..b907763a2d8c 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -345,7 +345,7 @@ public:
     virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) 
const override;
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich 
) override;
 
-    static void         ParseIfFieldDefinition(const OUString& 
aFieldDefinition,
+    static void         ParseIfFieldDefinition(std::u16string_view 
aFieldDefinition,
                                                OUString& rCondition,
                                                OUString& rTrue,
                                                OUString& rFalse);
diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx
index 5f476e0011a5..ac94d120008d 100644
--- a/sw/inc/fmtmeta.hxx
+++ b/sw/inc/fmtmeta.hxx
@@ -175,7 +175,7 @@ private:
     sal_uInt32 m_nNumberFormat;
     bool       m_bIsFixedLanguage;
 
-    sal_uInt32 GetNumberFormat(OUString const & rContent) const;
+    sal_uInt32 GetNumberFormat(std::u16string_view aContent) const;
     void SetNumberFormat(sal_uInt32 nNumberFormat);
     bool IsFixedLanguage() const    { return m_bIsFixedLanguage; }
     void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; }
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx
index 2a6bcb688d27..205d82cc4c24 100644
--- a/sw/inc/hhcwrp.hxx
+++ b/sw/inc/hhcwrp.hxx
@@ -62,7 +62,7 @@ class SW_DLLPUBLIC SwHHCWrapper final : public 
editeng::HangulHanjaConversion
     void        SelectNewUnit_impl( const sal_Int32 nUnitStart,
                                     const sal_Int32 nUnitEnd );
     void        ChangeText( const OUString &rNewText,
-                            const OUString& rOrigText,
+                            std::u16string_view aOrigText,
                             const css::uno::Sequence< sal_Int32 > *pOffsets,
                             SwPaM *pCursor );
     void        ChangeText_impl( const OUString &rNewText, bool 
bKeepAttributes );
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 5ed47511c56b..16862c5536c7 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -361,7 +361,7 @@ public:
                                                             
m_aMiscConfig.SetModified();}
 
     //convert word delimiter from or to user interface
-    static OUString ConvertWordDelimiter(const OUString& rDelim, bool bFromUI);
+    static OUString ConvertWordDelimiter(std::u16string_view aDelim, bool 
bFromUI);
 
     bool    IsShowIndexPreview() const {return  
m_aMiscConfig.m_bShowIndexPreview;}
     void        SetShowIndexPreview(bool bSet)
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 5cfc5d31be5c..2a1f9f878cfa 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -370,7 +370,7 @@ public:
     void ReplaceText( SwPosition& rStart, const sal_Int32 nDelLen,
             const OUString & rText );
     void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
-            const OUString& rText,
+            std::u16string_view aText,
             const css::uno::Sequence<sal_Int32>& rOffsets );
 
     /// Virtual methods from ContentNode.
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index f88286c57502..1a1f45ce46fc 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -328,7 +328,7 @@ public:
 
     sal_uInt16 GetCount() const;                        // Get count text 
modules.
     sal_uInt16 GetIndex( const OUString& ) const;       // Get index of short 
names.
-    sal_uInt16 GetLongIndex( const OUString& ) const;   // Get index of long 
names.
+    sal_uInt16 GetLongIndex( std::u16string_view ) const;   // Get index of 
long names.
     OUString GetShortName( sal_uInt16 ) const;          // Get short name for 
index.
     OUString GetLongName( sal_uInt16 ) const;           // Get long name for 
index.
 
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 7502f0605778..e750ee02bd4d 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -299,7 +299,7 @@ public:
     bool IsTableComplex() const;
 
     // Returns true if table or selection is balanced.
-    bool IsTableComplexForChart( const OUString& rSel ) const;
+    bool IsTableComplexForChart( std::u16string_view aSel ) const;
 
     // Search all content-bearing boxes of the base line on which this box 
stands.
     // rBoxes as a return value for immediate use.
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 3357cde5160c..8cf20d6a90c7 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -68,7 +68,7 @@ namespace sw {
         
CollectTextTOXMarksForLayoutHint(std::vector<std::reference_wrapper<SwTextTOXMark>>&
 rMarks, const SwRootFrame* pLayout)
             : SfxHint(SfxHintId::SwCollectTextTOXMarksForLayout), 
m_rMarks(rMarks), m_pLayout(pLayout) {}
     };
-    SW_DLLPUBLIC auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& 
rName)
+    SW_DLLPUBLIC auto PrepareJumpToTOXMark(SwDoc const& rDoc, 
std::u16string_view aName)
         -> std::optional<std::pair<SwTOXMark, sal_Int32>>;
 }
 
@@ -300,7 +300,7 @@ public:
 
        @param rStr   string representation of the tokens
     */
-    SwFormTokensHelper(const OUString & rStr);
+    SwFormTokensHelper(std::u16string_view aStr);
 
     /**
        Returns vector of tokens.
@@ -332,7 +332,7 @@ public:
 
     // #i21237#
     void    SetPattern(sal_uInt16 nLevel, SwFormTokens&& rName);
-    void    SetPattern(sal_uInt16 nLevel, const OUString& rStr);
+    void    SetPattern(sal_uInt16 nLevel, std::u16string_view aStr);
     const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
 
     // fill tab stop positions from template to pattern- #i21237#
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index af3c779f2288..c52601cdfefa 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -113,7 +113,7 @@ namespace SwUnoCursorHelper
                                     css::beans::PropertyState& eState);
 
     bool    DocInsertStringSplitCR(  SwDoc &rDoc,
-                    const SwPaM &rNewCursor, const OUString &rText,
+                    const SwPaM &rNewCursor, std::u16string_view aText,
                     const bool bForceExpandHints );
     /// @throws css::lang::IllegalArgumentException
     /// @throws css::uno::RuntimeException
@@ -141,7 +141,7 @@ namespace SwUnoCursorHelper
     SwFormatColl * GetCurTextFormatColl(SwPaM & rPam, const bool bConditional);
 
     void SelectPam(SwPaM & rPam, const bool bExpand);
-    void SetString(SwCursor & rCursor, const OUString & rString);
+    void SetString(SwCursor & rCursor, std::u16string_view aString);
 
     css::uno::Sequence< css::beans::PropertyValue >
            CreateSortDescriptor(const bool bFromTable);
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 3522beb6b998..178989fbaefc 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -279,7 +279,7 @@ public:
 
     SW_DLLPUBLIC static const css::uno::Sequence< sal_Int8 > & 
getUnoTunnelId();
 
-    SW_DLLPUBLIC static void GetCellPosition(const OUString& rCellName, 
sal_Int32& o_rColumn, sal_Int32& o_rRow);
+    SW_DLLPUBLIC static void GetCellPosition(std::u16string_view aCellName, 
sal_Int32& o_rColumn, sal_Int32& o_rRow);
 
     SW_DLLPUBLIC SwFrameFormat* GetFrameFormat();
 
@@ -500,17 +500,17 @@ public:
 };
 
 int sw_CompareCellRanges(
-        const OUString &rRange1StartCell, const OUString &rRange1EndCell,
-        const OUString &rRange2StartCell, const OUString &rRange2EndCell,
+        std::u16string_view aRange1StartCell, std::u16string_view 
aRange1EndCell,
+        std::u16string_view aRange2StartCell, std::u16string_view 
aRange2EndCell,
         bool bCmpColsFirst );
 
 void sw_NormalizeRange( OUString &rCell1, OUString &rCell2 );
 
 OUString sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow );
 
-int sw_CompareCellsByColFirst( const OUString &rCellName1, const OUString 
&rCellName2 );
+int sw_CompareCellsByColFirst( std::u16string_view aCellName1, 
std::u16string_view aCellName2 );
 
-int sw_CompareCellsByRowFirst( const OUString &rCellName1, const OUString 
&rCellName2 );
+int sw_CompareCellsByRowFirst( std::u16string_view aCellName1, 
std::u16string_view aCellName2 );
 
 #endif
 
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
index 4979fba063c0..922e7581329c 100644
--- a/sw/inc/unotextcursor.hxx
+++ b/sw/inc/unotextcursor.hxx
@@ -102,7 +102,7 @@ public:
     bool IsAtEndOfMeta() const;
     bool IsAtEndOfContentControl() const;
 
-    void DeleteAndInsert(OUString const& rText, ::sw::DeleteAndInsertMode 
eMode);
+    void DeleteAndInsert(std::u16string_view aText, ::sw::DeleteAndInsertMode 
eMode);
     // OTextCursorHelper
     virtual const SwPaM*        GetPaM() const override;
     virtual SwPaM*              GetPaM() override;
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index b4862b7f6523..b124b0cf282c 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -109,7 +109,7 @@ private:
     //TODO: new exception type for protected content
     /// @throws css::uno::RuntimeException
     void    DeleteAndInsert(
-                const OUString& rText, ::sw::DeleteAndInsertMode eMode);
+                std::u16string_view aText, ::sw::DeleteAndInsertMode eMode);
     void    Invalidate();
 
     virtual ~SwXTextRange() override;
diff --git a/sw/qa/core/test_ToxMiscTest.cxx b/sw/qa/core/test_ToxMiscTest.cxx
index 22ad986aca4e..c7e6223b927b 100644
--- a/sw/qa/core/test_ToxMiscTest.cxx
+++ b/sw/qa/core/test_ToxMiscTest.cxx
@@ -27,7 +27,7 @@ void ToxMiscTest::testTdf73162()
 {
     //create Tokens with the help of input string
     SwFormTokensHelper tokensHelper(
-        "<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET 
,65535,><T "
+        u"<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET 
,65535,><T "
         ",65535,0,5,.,1><# ,65535,><LE ,65535,>"); //input token string
     SwFormTokens formTokens = tokensHelper.GetTokens();
 
diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx 
b/sw/qa/core/test_ToxWhitespaceStripper.cxx
index 7af8dae25184..14ebc6ac2e14 100644
--- a/sw/qa/core/test_ToxWhitespaceStripper.cxx
+++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx
@@ -41,14 +41,14 @@ class ToxWhitespaceStripperTest : public 
CppUnit::TestFixture
 void 
ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
 {
     {
-        ToxWhitespaceStripper sut("abc\n");
+        ToxWhitespaceStripper sut(u"abc\n");
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
sut.GetPositionInStrippedString(0));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
sut.GetPositionInStrippedString(1));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
sut.GetPositionInStrippedString(2));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), 
sut.GetPositionInStrippedString(3));
     }
     {
-        ToxWhitespaceStripper sut("abc\n\n");
+        ToxWhitespaceStripper sut(u"abc\n\n");
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
sut.GetPositionInStrippedString(0));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
sut.GetPositionInStrippedString(1));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
sut.GetPositionInStrippedString(2));
@@ -56,7 +56,7 @@ void 
ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), 
sut.GetPositionInStrippedString(4));
     }
     {
-        ToxWhitespaceStripper sut("abc\ndef");
+        ToxWhitespaceStripper sut(u"abc\ndef");
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
sut.GetPositionInStrippedString(0));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
sut.GetPositionInStrippedString(1));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
sut.GetPositionInStrippedString(2));
@@ -69,7 +69,7 @@ void 
ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
         //             012345 6789
         //             01234567
         //            " abc def"
-        ToxWhitespaceStripper sut("  abc \ndef");
+        ToxWhitespaceStripper sut(u"  abc \ndef");
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
sut.GetPositionInStrippedString(0));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), 
sut.GetPositionInStrippedString(1));
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
sut.GetPositionInStrippedString(2));
@@ -86,27 +86,27 @@ void 
ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
 void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks()
 {
     {
-        ToxWhitespaceStripper sut("abc\n");
+        ToxWhitespaceStripper sut(u"abc\n");
         CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString());
     }
     {
-        ToxWhitespaceStripper sut("abc\n\n");
+        ToxWhitespaceStripper sut(u"abc\n\n");
         CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString());
     }
     {
-        ToxWhitespaceStripper sut("abc\ndef");
+        ToxWhitespaceStripper sut(u"abc\ndef");
         CPPUNIT_ASSERT_EQUAL(OUString("abc def"), sut.GetStrippedString());
     }
     {
-        ToxWhitespaceStripper sut("  abc \ndef");
+        ToxWhitespaceStripper sut(u"  abc \ndef");
         CPPUNIT_ASSERT_EQUAL(OUString(" abc def"), sut.GetStrippedString());
     }
     {
-        ToxWhitespaceStripper sut("  ");
+        ToxWhitespaceStripper sut(u"  ");
         CPPUNIT_ASSERT_EQUAL(OUString(""), sut.GetStrippedString());
     }
     {
-        ToxWhitespaceStripper sut("d  ");
+        ToxWhitespaceStripper sut(u"d  ");
         CPPUNIT_ASSERT_EQUAL(OUString("d"), sut.GetStrippedString());
     }
 }
@@ -121,7 +121,7 @@ void 
ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested()
 
 void ToxWhitespaceStripperTest::InvalidPositionIsMappedToLastEntry()
 {
-    ToxWhitespaceStripper sut("ab  c");
+    ToxWhitespaceStripper sut(u"ab  c");
     sal_Int32 const expected = 4; // the length of the string after merging 
the two whitespaces
     sal_Int32 result
         = sut.GetPositionInStrippedString(40); // a value past the original 
string length
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index a51a472ec7bc..7eea1b230e06 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1852,35 +1852,35 @@ void SwDocTest::testTdf92308()
 
 void SwDocTest::testTableCellComparison()
 {
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByColFirst("A1", "Z1") );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst("Z1", "A1") );
-    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellsByColFirst("A1", "A1") );
-
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst("A2", "A1") );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst("Z3", "A2") );
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByColFirst("A3", "Z1") );
-
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByRowFirst("A1", "Z1") );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst("Z1", "A1") );
-    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellsByRowFirst("A1", "A1") );
-
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst("A2", "A1") );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst("Z3", "A2") );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst("A3", "Z1") );
-
-    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges("A1", "A1", "A1", "A1", 
true) );
-    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges("A1", "Z1", "A1", "Z1", 
true) );
-    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges("A1", "Z1", "A1", "Z1", 
false) );
-
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges("A1", "Z1", "B1", "Z1", 
true) );
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges("A1", "Z1", "A2", "Z2", 
false) );
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges("A1", "Z1", "A2", "Z2", 
true) );
-    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges("A1", "Z1", "A6", "Z2", 
true) );
-
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("B1", "Z1", "A1", "Z1", 
true) );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", 
false) );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", 
true) );
-    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A6", "Z2", "A1", "Z1", 
true) );
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByColFirst(u"A1", u"Z1") );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst(u"Z1", u"A1") );
+    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellsByColFirst(u"A1", u"A1") );
+
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst(u"A2", u"A1") );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByColFirst(u"Z3", u"A2") );
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByColFirst(u"A3", u"Z1") );
+
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellsByRowFirst(u"A1", u"Z1") );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst(u"Z1", u"A1") );
+    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellsByRowFirst(u"A1", u"A1") );
+
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst(u"A2", u"A1") );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst(u"Z3", u"A2") );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellsByRowFirst(u"A3", u"Z1") );
+
+    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges(u"A1", u"A1", u"A1", u"A1", 
true) );
+    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges(u"A1", u"Z1", u"A1", u"Z1", 
true) );
+    CPPUNIT_ASSERT_EQUAL(  0, sw_CompareCellRanges(u"A1", u"Z1", u"A1", u"Z1", 
false) );
+
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges(u"A1", u"Z1", u"B1", u"Z1", 
true) );
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges(u"A1", u"Z1", u"A2", u"Z2", 
false) );
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges(u"A1", u"Z1", u"A2", u"Z2", 
true) );
+    CPPUNIT_ASSERT_EQUAL( -1, sw_CompareCellRanges(u"A1", u"Z1", u"A6", u"Z2", 
true) );
+
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges(u"B1", u"Z1", u"A1", u"Z1", 
true) );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges(u"A2", u"Z2", u"A1", u"Z1", 
false) );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges(u"A2", u"Z2", u"A1", u"Z1", 
true) );
+    CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges(u"A6", u"Z2", u"A1", u"Z1", 
true) );
 
     OUString rCell1("A1");
     OUString rCell2("C5");
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index b07249cc7d77..d5fe2c8cf706 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -128,7 +128,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("IF A B C", paramCondition, 
paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"IF A B C", paramCondition, 
paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("A"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString("B"), paramTrue);
@@ -140,7 +140,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("  IF AAA BBB CCC  ", 
paramCondition, paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"  IF AAA BBB CCC  ", 
paramCondition, paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue);
@@ -152,7 +152,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("  IF AAA \"BBB\" \"CCC\"  
", paramCondition, paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"  IF AAA \"BBB\" \"CCC\"  
", paramCondition, paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue);
@@ -165,7 +165,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("  IF A A A \"B B B\" \"C C 
C\"  ", paramCondition, paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"  IF A A A \"B B B\" \"C C 
C\"  ", paramCondition, paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("A A A"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString("B B B"), paramTrue);
@@ -178,7 +178,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" 
C1 C2\"  ", paramCondition, paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"IF A1 A2 A3 \"B1 B2 \" \" 
C1 C2\"  ", paramCondition, paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("A1 A2 A3"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString("B1 B2 "), paramTrue);
@@ -191,7 +191,7 @@ static void testTdf43569_CheckIfFieldParse()
         OUString paramTrue;
         OUString paramFalse;
 
-        SwHiddenTextField::ParseIfFieldDefinition("IF condition \"\" \"\"  ", 
paramCondition, paramTrue, paramFalse);
+        SwHiddenTextField::ParseIfFieldDefinition(u"IF condition \"\" \"\"  ", 
paramCondition, paramTrue, paramFalse);
 
         CPPUNIT_ASSERT_EQUAL(OUString("condition"), paramCondition);
         CPPUNIT_ASSERT_EQUAL(OUString(""), paramTrue);
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 816bdcd766a6..5c64d09ea667 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -2122,13 +2122,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, 
testUnoCursorPointer)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextTableCellNames)
 {
     sal_Int32 nCol, nRow2;
-    SwXTextTable::GetCellPosition("z1", nCol, nRow2);
+    SwXTextTable::GetCellPosition(u"z1", nCol, nRow2);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(51), nCol);
-    SwXTextTable::GetCellPosition("AA1", nCol, nRow2);
+    SwXTextTable::GetCellPosition(u"AA1", nCol, nRow2);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(52), nCol);
-    SwXTextTable::GetCellPosition("AB1", nCol, nRow2);
+    SwXTextTable::GetCellPosition(u"AB1", nCol, nRow2);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(53), nCol);
-    SwXTextTable::GetCellPosition("BB1", nCol, nRow2);
+    SwXTextTable::GetCellPosition(u"BB1", nCol, nRow2);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(105), nCol);
 }
 
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index d3194f3dea3c..f10840f27a68 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -587,10 +587,10 @@ bool SwAccessibleParagraph::GetSentenceBoundary(
 
 bool SwAccessibleParagraph::GetLineBoundary(
     i18n::Boundary& rBound,
-    const OUString& rText,
+    std::u16string_view aText,
     sal_Int32 nPos )
 {
-    if( rText.getLength() == nPos )
+    if( sal_Int32(aText.size()) == nPos )
         GetPortionData().GetLastLineBoundary( rBound );
     else
         GetPortionData().GetLineBoundary( rBound, nPos );
@@ -599,10 +599,10 @@ bool SwAccessibleParagraph::GetLineBoundary(
 
 bool SwAccessibleParagraph::GetParagraphBoundary(
     i18n::Boundary& rBound,
-    const OUString& rText )
+    std::u16string_view aText )
 {
     rBound.startPos = 0;
-    rBound.endPos = rText.getLength();
+    rBound.endPos = aText.size();
     return true;
 }
 
diff --git a/sw/source/core/access/accpara.hxx 
b/sw/source/core/access/accpara.hxx
index 7c335388579c..eb5825b54fb9 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -203,10 +203,10 @@ protected:
                                   const OUString& rText,
                                   sal_Int32 nPos );
     bool GetLineBoundary( css::i18n::Boundary& rBound,
-                              const OUString& rText,
+                              std::u16string_view aText,
                               sal_Int32 nPos );
     static bool GetParagraphBoundary( css::i18n::Boundary& rBound,
-                                   const OUString& rText );
+                                   std::u16string_view aText );
     bool GetAttributeBoundary( css::i18n::Boundary& rBound,
                                    sal_Int32 nPos );
     bool GetGlyphBoundary( css::i18n::Boundary& rBound,
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 05ebd8fa7956..70e96968e4df 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -36,21 +36,21 @@ void SwTable::UpdateCharts() const
     GetFrameFormat()->GetDoc()->UpdateCharts( GetFrameFormat()->GetName() );
 }
 
-bool SwTable::IsTableComplexForChart( const OUString& rSelection ) const
+bool SwTable::IsTableComplexForChart( std::u16string_view aSelection ) const
 {
     const SwTableBox* pSttBox, *pEndBox;
-    if( 2 < rSelection.getLength() )
+    if( 2 < aSelection.size() )
     {
-        const sal_Int32 nSeparator {rSelection.indexOf( ':' )};
-        OSL_ENSURE( -1 != nSeparator, "no valid selection" );
+        const size_t nSeparator = aSelection.find( u':' );
+        OSL_ENSURE( std::u16string_view::npos != nSeparator, "no valid 
selection" );
 
         // Remove brackets at the beginning and from the end
-        const sal_Int32 nOffset {'<' == rSelection[0] ? 1 : 0};
-        const sal_Int32 nLength {'>' == rSelection[ rSelection.getLength()-1 ]
-            ? rSelection.getLength()-1 : rSelection.getLength()};
+        const sal_Int32 nOffset = '<' == aSelection[0] ? 1 : 0;
+        const sal_Int32 nLength = '>' == aSelection[ aSelection.size()-1 ]
+            ? aSelection.size()-1 : aSelection.size();
 
-        pSttBox = GetTableBox(rSelection.copy( nOffset, nSeparator - nOffset 
));
-        pEndBox = GetTableBox(rSelection.copy( nSeparator+1, nLength - 
(nSeparator+1) ));
+        pSttBox = GetTableBox(OUString(aSelection.substr( nOffset, nSeparator 
- nOffset )));
+        pEndBox = GetTableBox(OUString(aSelection.substr( nSeparator+1, 
nLength - (nSeparator+1) )));
     }
     else
     {
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0fd45531965f..4827dfb75d94 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -594,7 +594,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, 
SwOutlineNodes::difference_type
 }
 
 static SwTextNode* lcl_FindOutlineName(const SwOutlineNodes& rOutlNds,
-    SwRootFrame const*const pLayout, const OUString& rName, bool const bExact)
+    SwRootFrame const*const pLayout, std::u16string_view aName, bool const 
bExact)
 {
     SwTextNode * pExactButDeleted(nullptr);
     SwTextNode* pSavedNode = nullptr;
@@ -602,9 +602,9 @@ static SwTextNode* lcl_FindOutlineName(const 
SwOutlineNodes& rOutlNds,
     {
         SwTextNode* pTextNd = pOutlNd->GetTextNode();
         const OUString sText( pTextNd->GetExpandText(pLayout) );
-        if (sText.startsWith(rName))
+        if (sText.startsWith(aName))
         {
-            if (sText.getLength() == rName.getLength())
+            if (sText.getLength() == sal_Int32(aName.size()))
             {
                 if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTextNd))
                 {
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 8dc8719deeeb..679437f4d880 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4011,13 +4011,13 @@ void SwDoc::SetColRowWidthHeight( SwTableBox& 
rCurrentBox, TableChgWidthHeightTy
     }
 }
 
-bool SwDoc::IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, 
double& fOutNumber )
+bool SwDoc::IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, 
double& fOutNumber )
 {
-    if( rString.getLength() > 308 ) // optimization matches svl:IsNumberFormat 
arbitrary value
+    if( aString.size() > 308 ) // optimization matches svl:IsNumberFormat 
arbitrary value
         return false;
 
     // remove any comment anchor marks
-    OUStringBuffer sStringBuffer(rString);
+    OUStringBuffer sStringBuffer(aString);
     sal_Int32 nCommentPosition = sStringBuffer.indexOf( CH_TXTATR_INWORD );
     while( nCommentPosition != -1 )
     {
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 955cfdc3bee3..4be8c9711188 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -154,8 +154,8 @@ class SwAutoFormat
 
     static OUString DelLeadingBlanks(const OUString& rStr);
     static OUString DelTrailingBlanks( const OUString& rStr );
-    static sal_Int32 GetLeadingBlanks( const OUString& rStr );
-    static sal_Int32 GetTrailingBlanks( const OUString& rStr );
+    static sal_Int32 GetLeadingBlanks( std::u16string_view aStr );
+    static sal_Int32 GetTrailingBlanks( std::u16string_view aStr );
 
     bool IsFirstCharCapital(const SwTextFrame & rNd) const;
     sal_uInt16 GetDigitLevel(const SwTextFrame& rFrame, TextFrameIndex& rPos,
@@ -707,23 +707,23 @@ OUString SwAutoFormat::DelTrailingBlanks( const OUString& 
rStr )
     return rStr;
 }
 
-sal_Int32 SwAutoFormat::GetLeadingBlanks( const OUString& rStr )
+sal_Int32 SwAutoFormat::GetLeadingBlanks( std::u16string_view aStr )
 {
-    sal_Int32 nL;
-    sal_Int32 n;
+    size_t nL;
+    size_t n;
 
-    for( nL = rStr.getLength(), n = 0; n < nL && IsSpace( rStr[ n ] ); ++n )
+    for( nL = aStr.size(), n = 0; n < nL && IsSpace( aStr[ n ] ); ++n )
         ;
     return n;
 }
 
-sal_Int32 SwAutoFormat::GetTrailingBlanks( const OUString& rStr )
+sal_Int32 SwAutoFormat::GetTrailingBlanks( std::u16string_view aStr )
 {
-    sal_Int32 nL = rStr.getLength(), n = nL;
+    size_t nL = aStr.size(), n = nL;
     if( !nL )
         return 0;
 
-    while( --n && IsSpace( rStr[ n ] )  )
+    while( --n && IsSpace( aStr[ n ] )  )
         ;
     return ++n;
 }
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index c52a26373d95..2015216f2a91 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/util/Date.hpp>
 #include <com/sun/star/util/Duration.hpp>
 #include <o3tl/any.hxx>
+#include <o3tl/string_view.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
@@ -1537,7 +1538,7 @@ OUString SwHiddenTextField::GetDBName(std::u16string_view 
rName, SwDoc& rDoc)
 }
 
 // [aFieldDefinition] value sample : " IF A == B \"TrueText\" \"FalseText\""
-void SwHiddenTextField::ParseIfFieldDefinition(const OUString& 
aFieldDefinition,
+void SwHiddenTextField::ParseIfFieldDefinition(std::u16string_view 
aFieldDefinition,
                                                OUString& rCondition,
                                                OUString& rTrue,
                                                OUString& rFalse)
@@ -1554,7 +1555,7 @@ void SwHiddenTextField::ParseIfFieldDefinition(const 
OUString& aFieldDefinition,
     {
         bool quoted = false;
         bool insideWord = false;
-        for (sal_Int32 i = 0; i < aFieldDefinition.getLength(); i++)
+        for (size_t i = 0; i < aFieldDefinition.size(); i++)
         {
             if (quoted)
             {
@@ -1607,14 +1608,9 @@ void SwHiddenTextField::ParseIfFieldDefinition(const 
OUString& aFieldDefinition,
 
     // Syntax
     // OUString::copy( sal_Int32 beginIndex, sal_Int32 count )
-    rCondition = aFieldDefinition.copy(conditionBegin, conditionLength);
-    rTrue = aFieldDefinition.copy(trueBegin, trueLength);
-    rFalse = aFieldDefinition.copy(falseBegin);
-
-    // trim
-    rCondition = rCondition.trim();
-    rTrue = rTrue.trim();
-    rFalse = rFalse.trim();
+    rCondition = o3tl::trim(aFieldDefinition.substr(conditionBegin, 
conditionLength));
+    rTrue = o3tl::trim(aFieldDefinition.substr(trueBegin, trueLength));
+    rFalse = o3tl::trim(aFieldDefinition.substr(falseBegin));
 
     // remove quotes
     if (rCondition.getLength() >= 2)
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 277540d12ee0..c0ed059e2882 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -399,10 +399,10 @@ const SwTextNode* SwGetRefField::GetReferencedTextNode() 
const
 }
 
 // strikethrough for tooltips using Unicode combining character
-static OUString lcl_formatStringByCombiningCharacter(const OUString& sText, 
const sal_Unicode cChar)
+static OUString lcl_formatStringByCombiningCharacter(std::u16string_view 
sText, const sal_Unicode cChar)
 {
-    OUStringBuffer sRet(sText.getLength() * 2);
-    for (sal_Int32 i = 0; i < sText.getLength(); ++i)
+    OUStringBuffer sRet(sText.size() * 2);
+    for (size_t i = 0; i < sText.size(); ++i)
     {
         sRet.append(sText[i]);
         sRet.append(cChar);
diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx
index 76d474adcc99..5c4b709ffb70 100644
--- a/sw/source/core/inc/UndoCore.hxx
+++ b/sw/source/core/inc/UndoCore.hxx
@@ -247,26 +247,26 @@ const int nUndoStringLength = 20;
 
    @param rStr      the string to be shortened
    @param nLength   the maximum length for rStr
-   @param rFillStr  string to replace cut out characters with
+   @param aFillStr  string to replace cut out characters with
 
    If rStr has less than nLength characters it will be returned unaltered.
 
    If rStr has more than nLength characters the following algorithm
    generates the shortened string:
 
-       frontLength = (nLength - length(rFillStr)) / 2
-       rearLength = nLength - length(rFillStr) - frontLength
+       frontLength = (nLength - length(aFillStr)) / 2
+       rearLength = nLength - length(aFillStr) - frontLength
        shortenedString = concat(<first frontLength characters of rStr,
-                                rFillStr,
+                                aFillStr,
                                 <last rearLength characters of rStr>)
 
    Preconditions:
-      - nLength - length(rFillStr) >= 2
+      - nLength - length(aFillStr) >= 2
 
    @return the shortened string
  */
 OUString
-ShortenString(const OUString & rStr, sal_Int32 nLength, const OUString & 
rFillStr);
+ShortenString(const OUString & rStr, sal_Int32 nLength, std::u16string_view 
aFillStr);
 /**
    Denotes special characters in a string.
 
@@ -275,7 +275,7 @@ ShortenString(const OUString & rStr, sal_Int32 nLength, 
const OUString & rFillSt
    special characters all characters are equal. These parts are
    maximal.
 
-   @param rStr     the string to denote in
+   @param aStr     the string to denote in
    @param bQuoted  add quotation marks to the text
 
    The resulting string is generated by concatenating the found
@@ -286,7 +286,7 @@ ShortenString(const OUString & rStr, sal_Int32 nLength, 
const OUString & rFillSt
 
    @return the denoted string
 */
-OUString DenoteSpecialCharacters(const OUString & rStr, bool bQuoted = true);
+OUString DenoteSpecialCharacters(std::u16string_view aStr, bool bQuoted = 
true);
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOCORE_HXX
 
diff --git a/sw/source/core/inc/scriptinfo.hxx 
b/sw/source/core/inc/scriptinfo.hxx
index 28d0ea3f2014..9fdaa9073eb8 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -350,7 +350,7 @@ public:
 
     @descr  Add some extra space for thai justification to the
             positions in the kerning array.
-    @param  rText
+    @param  aText
                 The String
     @param  pKernArray
                 The printers kerning array. Optional.
@@ -362,7 +362,7 @@ public:
                 The value which has to be added to the cells.
     @return The number of extra spaces in the given range
 */
-    static TextFrameIndex ThaiJustify( const OUString& rText, sal_Int32* 
pKernArray,
+    static TextFrameIndex ThaiJustify( std::u16string_view aText, sal_Int32* 
pKernArray,
                                   TextFrameIndex nIdx,
                                   TextFrameIndex nLen,
                                   TextFrameIndex nNumberOfBlanks = 
TextFrameIndex(0),
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index 18e73678c0ce..d822acbe26ab 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -87,10 +87,10 @@ protected:
 public:
     virtual ~SwImpBlocks();
 
-    static sal_uInt16 Hash( const OUString& );        /// Hashcode for Block 
names
+    static sal_uInt16 Hash( std::u16string_view );        /// Hashcode for 
Block names
     sal_uInt16 GetCount() const;                      /// Get count of Text 
Blocks
     sal_uInt16 GetIndex( const OUString& ) const;     /// Index for shortnames
-    sal_uInt16 GetLongIndex( const OUString& ) const; /// Index for longnames
+    sal_uInt16 GetLongIndex( std::u16string_view ) const; /// Index for 
longnames
     OUString GetShortName( sal_uInt16 ) const;        /// Return shortname for 
index
     OUString GetLongName( sal_uInt16 ) const;         /// Return longname for 
index
     OUString GetPackageName( sal_uInt16 ) const;      /// Return packagename 
for index
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index f75de95ae0ae..fd9c38336dcf 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -276,7 +276,7 @@ class SW_DLLPUBLIC SwTextFrame final : public SwContentFrame
     virtual void MakePos() override;
 
     // Corrects the position from which we need to format
-    static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart,
+    static TextFrameIndex FindBrk(std::u16string_view aText, TextFrameIndex 
nStart,
                                   TextFrameIndex nEnd);
 
     // inline branch
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx
index 1707c43d02ea..d9ccbe4c56c3 100644
--- a/sw/source/core/swg/swblocks.cxx
+++ b/sw/source/core/swg/swblocks.cxx
@@ -36,11 +36,11 @@
 /**
  * Calculate hash code (is not guaranteed to be unique)
  */
-sal_uInt16 SwImpBlocks::Hash( const OUString& r )
+sal_uInt16 SwImpBlocks::Hash( std::u16string_view r )
 {
     sal_uInt16 n = 0;
     // std::min requires an explicit cast to sal_Int32 on 32bit platforms
-    const sal_Int32 nLen = std::min(r.getLength(), static_cast<sal_Int32>(8));
+    const sal_Int32 nLen = std::min(sal_Int32(r.size()), 
static_cast<sal_Int32>(8));
     for (sal_Int32 i=0; i<nLen; ++i)
     {
         n = ( n << 1 ) + r[i];
@@ -139,14 +139,14 @@ sal_uInt16 SwImpBlocks::GetIndex( const OUString& rShort 
) const
     return USHRT_MAX;
 }
 
-sal_uInt16 SwImpBlocks::GetLongIndex( const OUString& rLong ) const
+sal_uInt16 SwImpBlocks::GetLongIndex( std::u16string_view aLong ) const
 {
-    sal_uInt16 nHash = Hash( rLong );
+    sal_uInt16 nHash = Hash( aLong );
     for( size_t i = 0; i < m_aNames.size(); i++ )
     {
         const SwBlockName* pName = m_aNames[ i ].get();
         if( pName->m_nHashL == nHash
-         && pName->m_aLong == rLong )
+         && pName->m_aLong == aLong )
             return i;
     }
     return USHRT_MAX;
@@ -263,7 +263,7 @@ sal_uInt16 SwTextBlocks::GetIndex( const OUString& r ) const
     return m_pImp ? m_pImp->GetIndex( r ) : USHRT_MAX;
 }
 
-sal_uInt16 SwTextBlocks::GetLongIndex( const OUString& r ) const
+sal_uInt16 SwTextBlocks::GetLongIndex( std::u16string_view r ) const
 {
     return m_pImp ? m_pImp->GetLongIndex( r ) : USHRT_MAX;
 }
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index e4dedc22cda1..eb15400cf5d8 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -61,7 +61,7 @@ private:
     void SetFnt( SwFont* pNew ) { m_pFont = pNew; }
     void InitFontAndAttrHandler(
         SwTextNode const& rPropsNode, SwTextNode const& rTextNode,
-        OUString const& rText, bool const* pbVertLayout,
+        std::u16string_view aText, bool const* pbVertLayout,
         bool const* pbVertLayoutLRBT);
 
 protected:
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index d11d67414b62..078b053cca7e 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2574,13 +2574,13 @@ void SwScriptInfo::MarkKashidasInvalid(sal_Int32 const 
nCnt,
     }
 }
 
-TextFrameIndex SwScriptInfo::ThaiJustify( const OUString& rText, sal_Int32* 
pKernArray,
+TextFrameIndex SwScriptInfo::ThaiJustify( std::u16string_view aText, 
sal_Int32* pKernArray,
                                      TextFrameIndex const nStt,
                                      TextFrameIndex const nLen,
                                      TextFrameIndex nNumberOfBlanks,
                                      tools::Long nSpaceAdd )
 {
-    SAL_WARN_IF( nStt + nLen > TextFrameIndex(rText.getLength()), "sw.core", 
"String in ThaiJustify too small" );
+    SAL_WARN_IF( nStt + nLen > TextFrameIndex(aText.size()), "sw.core", 
"String in ThaiJustify too small" );
 
     SwTwips nNumOfTwipsToDistribute = nSpaceAdd * sal_Int32(nNumberOfBlanks) /
                                       SPACING_PRECISION_FACTOR;
@@ -2590,7 +2590,7 @@ TextFrameIndex SwScriptInfo::ThaiJustify( const OUString& 
rText, sal_Int32* pKer
 
     for (sal_Int32 nI = 0; nI < sal_Int32(nLen); ++nI)
     {
-        const sal_Unicode cCh = rText[sal_Int32(nStt) + nI];
+        const sal_Unicode cCh = aText[sal_Int32(nStt) + nI];
 
         // check if character is not above or below base
         if ( ( 0xE34 > cCh || cCh > 0xE3A ) &&
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 03697cce97c2..2b8c11693d20 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -442,7 +442,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & 
rTextNode,
 void SwAttrIter::InitFontAndAttrHandler(
         SwTextNode const& rPropsNode,
         SwTextNode const& rTextNode,
-        OUString const& rText,
+        std::u16string_view aText,
         bool const*const pbVertLayout,
         bool const*const pbVertLayoutLRBT)
 {
@@ -512,7 +512,7 @@ void SwAttrIter::InitFontAndAttrHandler(
             m_pFont->GetFontCacheId( m_aFontCacheIds[ nTmp ], m_aFontIdx[ nTmp 
], nTmp );
         }
     }
-    while (nChg < TextFrameIndex(rText.getLength()));
+    while (nChg < TextFrameIndex(aText.size()));
 }
 
 void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 22a8a0bc0ae1..166757f53d36 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1630,15 +1630,15 @@ void SwTextFrame::HideAndShowObjects()
  * line has to be formatted as well.
  * nFound is <= nEndLine.
  */
-TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
+TextFrameIndex SwTextFrame::FindBrk(std::u16string_view aText,
                               const TextFrameIndex nStart,
                               const TextFrameIndex nEnd)
 {
     sal_Int32 nFound = sal_Int32(nStart);
-    const sal_Int32 nEndLine = std::min(sal_Int32(nEnd), rText.getLength() - 
1);
+    const sal_Int32 nEndLine = std::min(sal_Int32(nEnd), 
sal_Int32(aText.size()) - 1);
 
     // Skip all leading blanks.
-    while( nFound <= nEndLine && ' ' == rText[nFound] )
+    while( nFound <= nEndLine && ' ' == aText[nFound] )
     {
          nFound++;
     }
@@ -1647,7 +1647,7 @@ TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
     // "Dr.$Meyer" at the beginning of the second line. Typing a blank after 
that
     // doesn't result in the word moving into first line, even though that 
would work.
     // For this reason we don't skip the dummy char.
-    while( nFound <= nEndLine && ' ' != rText[nFound] )
+    while( nFound <= nEndLine && ' ' != aText[nFound] )
     {
         nFound++;
     }
diff --git a/sw/source/core/tox/ToxWhitespaceStripper.cxx 
b/sw/source/core/tox/ToxWhitespaceStripper.cxx
index 28c9056ce365..58ae043a46d4 100644
--- a/sw/source/core/tox/ToxWhitespaceStripper.cxx
+++ b/sw/source/core/tox/ToxWhitespaceStripper.cxx
@@ -16,12 +16,12 @@
 
 namespace sw {
 
-ToxWhitespaceStripper::ToxWhitespaceStripper(const OUString& inputString)
+ToxWhitespaceStripper::ToxWhitespaceStripper(std::u16string_view inputString)
 {
     OUStringBuffer buffer;
 
     bool lastCharacterWasWhitespace = false;
-    for (sal_Int32 pos = 0; pos < inputString.getLength(); ++pos) {
+    for (size_t pos = 0; pos < inputString.size(); ++pos) {
         sal_Unicode cur = inputString[pos];
 
         if (cur == ' ' || cur == '\n' || cur == '\t') {
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index ee91b1ad6ae6..d87e78c002fd 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -799,34 +799,34 @@ static FormTokenType lcl_GetTokenType(std::u16string_view 
sToken,
 
    @return   the string representation of the token
 */
-static OUString
-lcl_SearchNextToken(const OUString & sPattern, sal_Int32 const nStt)
+static std::u16string_view
+lcl_SearchNextToken(std::u16string_view sPattern, sal_Int32 const nStt)
 {
-    sal_Int32 nEnd = sPattern.indexOf( '>', nStt );
-    if (nEnd >= 0)
+    size_t nEnd = sPattern.find( u'>', nStt );
+    if (nEnd != std::u16string_view::npos)
     {
         // apparently the TOX_STYLE_DELIMITER act as a bracketing for
         // TOKEN_TEXT tokens so that the user can have '>' inside the text...
-        const sal_Int32 nTextSeparatorFirst = sPattern.indexOf( 
TOX_STYLE_DELIMITER, nStt );
-        if (    nTextSeparatorFirst >= 0
-            &&  nTextSeparatorFirst + 1 < sPattern.getLength()
+        const size_t nTextSeparatorFirst = sPattern.find( TOX_STYLE_DELIMITER, 
nStt );
+        if (    nTextSeparatorFirst != std::u16string_view::npos
+            &&  nTextSeparatorFirst + 1 < sPattern.size()
             &&  nTextSeparatorFirst < nEnd)
         {
-            const sal_Int32 nTextSeparatorSecond = sPattern.indexOf( 
TOX_STYLE_DELIMITER,
+            const size_t nTextSeparatorSecond = sPattern.find( 
TOX_STYLE_DELIMITER,
                                                                      
nTextSeparatorFirst + 1 );
-            // Since nEnd>=0 we don't need to check if nTextSeparatorSecond<0!
+            // Since nEnd>=0 we don't need to check if 
nTextSeparatorSecond==std::u16string_view::npos!
             if( nEnd < nTextSeparatorSecond )
-                nEnd = sPattern.indexOf( '>', nTextSeparatorSecond );
+                nEnd = sPattern.find( '>', nTextSeparatorSecond );
             // FIXME: No check to verify that nEnd is still >=0?
-            assert(nEnd >= 0);
+            assert(nEnd != std::u16string_view::npos);
         }
 
         ++nEnd;
 
-        return sPattern.copy( nStt, nEnd - nStt );
+        return sPattern.substr( nStt, nEnd - nStt );
     }
 
-    return OUString();
+    return std::u16string_view();
 }
 
 /**
@@ -838,15 +838,15 @@ lcl_SearchNextToken(const OUString & sPattern, sal_Int32 
const nStt)
    @return the token
  */
 static std::optional<SwFormToken>
-lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos)
+lcl_BuildToken(std::u16string_view sPattern, size_t & nCurPatternPos)
 {
-    OUString sToken( lcl_SearchNextToken(sPattern, nCurPatternPos) );
-    nCurPatternPos += sToken.getLength();
+    std::u16string_view sToken( lcl_SearchNextToken(sPattern, nCurPatternPos) 
);
+    nCurPatternPos += sToken.size();
     sal_Int32 nTokenLen = 0;
     FormTokenType const eTokenType = lcl_GetTokenType(sToken, nTokenLen);
     if (TOKEN_END == eTokenType) // invalid input? skip it
     {
-        nCurPatternPos = sPattern.getLength();
+        nCurPatternPos = sPattern.size();
         return std::optional<SwFormToken>();
     }
 
@@ -855,11 +855,11 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & 
nCurPatternPos)
     // the form is: CharStyleName, PoolId[, 
TabStopPosition|ChapterInfoFormat[, TabStopAlignment[, TabFillChar]]]
     // in text tokens the form differs from the others: CharStyleName, 
PoolId[,\0xffinserted text\0xff]
     SwFormToken eRet( eTokenType );
-    const OUString sAuthFieldEnum = sToken.copy( 2, 2 );
-    sToken = sToken.copy( nTokenLen, sToken.getLength() - nTokenLen - 1);
+    const std::u16string_view sAuthFieldEnum = sToken.substr( 2, 2 );
+    sToken = sToken.substr( nTokenLen, sToken.size() - nTokenLen - 1);
 
     sal_Int32 nIdx{ 0 };
-    eRet.sCharStyleName = sToken.getToken( 0, ',', nIdx );
+    eRet.sCharStyleName = o3tl::getToken(sToken, 0, ',', nIdx );
     std::u16string_view sTmp( o3tl::getToken(sToken, 0, ',', nIdx ));
     if( !sTmp.empty() )
         eRet.nPoolId = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sTmp));
@@ -880,14 +880,14 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & 
nCurPatternPos)
 
     case TOKEN_TEXT:
         {
-            const sal_Int32 nStartText = sToken.indexOf( TOX_STYLE_DELIMITER );
-            if( nStartText>=0 && nStartText+1<sToken.getLength())
+            const size_t nStartText = sToken.find( TOX_STYLE_DELIMITER );
+            if( nStartText != std::u16string_view::npos && 
nStartText+1<sToken.size())
             {
-                const sal_Int32 nEndText = sToken.indexOf( TOX_STYLE_DELIMITER,
+                const size_t nEndText = sToken.find( TOX_STYLE_DELIMITER,
                                                            nStartText + 1);
-                if( nEndText>=0 )
+                if( nEndText != std::u16string_view::npos )
                 {
-                    eRet.sText = sToken.copy( nStartText + 1,
+                    eRet.sText = sToken.substr( nStartText + 1,
                                                 nEndText - nStartText - 1);
                 }
             }
@@ -913,21 +913,21 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & 
nCurPatternPos)
         break;
 
     case TOKEN_AUTHORITY:
-        eRet.nAuthorityField = 
o3tl::narrowing<sal_uInt16>(sAuthFieldEnum.toInt32());
+        eRet.nAuthorityField = 
o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sAuthFieldEnum));
         break;
     default: break;
     }
     return eRet;
 }
 
-SwFormTokensHelper::SwFormTokensHelper(const OUString & rPattern)
+SwFormTokensHelper::SwFormTokensHelper(std::u16string_view aPattern)
 {
-    sal_Int32 nCurPatternPos = 0;
+    size_t nCurPatternPos = 0;
 
-    while (nCurPatternPos < rPattern.getLength())
+    while (nCurPatternPos < aPattern.size())
     {
         std::optional<SwFormToken> const oToken(
-                lcl_BuildToken(rPattern, nCurPatternPos));
+                lcl_BuildToken(aPattern, nCurPatternPos));
         if (oToken)
             m_Tokens.push_back(*oToken);
     }
@@ -941,11 +941,11 @@ void SwForm::SetPattern(sal_uInt16 nLevel, SwFormTokens&& 
rTokens)
     m_aPattern[nLevel] = std::move(rTokens);
 }
 
-void SwForm::SetPattern(sal_uInt16 nLevel, const OUString & rStr)
+void SwForm::SetPattern(sal_uInt16 nLevel, std::u16string_view aStr)
 {
     OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX");
 
-    SwFormTokensHelper aHelper(rStr);
+    SwFormTokensHelper aHelper(aStr);
     m_aPattern[nLevel] = aHelper.GetTokens();
 }
 
diff --git a/sw/source/core/txtnode/fmtatr2.cxx 
b/sw/source/core/txtnode/fmtatr2.cxx
index 4c806cc01577..d3843f4db1e8 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -756,7 +756,7 @@ void MetaField::GetPrefixAndSuffix(
     }
 }
 
-sal_uInt32 MetaField::GetNumberFormat(OUString const & rContent) const
+sal_uInt32 MetaField::GetNumberFormat(std::u16string_view aContent) const
 {
     //TODO: this probably lacks treatment for some special cases
     sal_uInt32 nNumberFormat( m_nNumberFormat );
@@ -764,7 +764,7 @@ sal_uInt32 MetaField::GetNumberFormat(OUString const & 
rContent) const
     if (pTextNode)
     {
         double number;
-        (void) pTextNode->GetDoc().IsNumberFormat( rContent, nNumberFormat, 
number );
+        (void) pTextNode->GetDoc().IsNumberFormat( aContent, nNumberFormat, 
number );
     }
     return nNumberFormat;
 }
diff --git a/sw/source/core/txtnode/justify.cxx 
b/sw/source/core/txtnode/justify.cxx
index 45a73223c9f4..b59c5d8787b9 100644
--- a/sw/source/core/txtnode/justify.cxx
+++ b/sw/source/core/txtnode/justify.cxx
@@ -97,10 +97,11 @@ sal_Int32 GetModelPosition(const std::vector<sal_Int32>& 
rKernArray, sal_Int32 n
     return nIdx;
 }
 
-void SpaceDistribution(std::vector<sal_Int32>& rKernArray, const OUString& 
rText, sal_Int32 nStt,
-                       sal_Int32 nLen, tools::Long nSpaceAdd, tools::Long 
nKern, bool bNoHalfSpace)
+void SpaceDistribution(std::vector<sal_Int32>& rKernArray, std::u16string_view 
aText,
+                       sal_Int32 nStt, sal_Int32 nLen, tools::Long nSpaceAdd, 
tools::Long nKern,
+                       bool bNoHalfSpace)
 {
-    assert(nStt + nLen <= rText.getLength());
+    assert(nStt + nLen <= sal_Int32(aText.size()));
     assert(nLen <= sal_Int32(rKernArray.size()));
     // nSpaceSum contains the sum of the intermediate space distributed
     // among Spaces by the Justification.
@@ -117,7 +118,7 @@ void SpaceDistribution(std::vector<sal_Int32>& rKernArray, 
const OUString& rText
     const tools::Long nHalfSpace = bNoHalfSpace ? 0 : nSpaceAdd / 2;
     const tools::Long nOtherHalf = nSpaceAdd - nHalfSpace;
     tools::Long nKernSum = nKern;
-    sal_Unicode cChPrev = rText[nStt];
+    sal_Unicode cChPrev = aText[nStt];
 
     if (nSpaceAdd && (cChPrev == CH_BLANK))
         nSpaceSum = nHalfSpace;
@@ -133,7 +134,7 @@ void SpaceDistribution(std::vector<sal_Int32>& rKernArray, 
const OUString& rText
         if (i == nLen)
             break;
 
-        sal_Unicode nCh = rText[nStt + i];
+        sal_Unicode nCh = aText[nStt + i];
 
         // Apply SpaceSum
         if (cChPrev == CH_BLANK)
@@ -169,15 +170,15 @@ void SpaceDistribution(std::vector<sal_Int32>& 
rKernArray, const OUString& rText
         rKernArray[nPrevIdx++] += nKernSum + nSpaceSum;
 }
 
-tools::Long SnapToGrid(std::vector<sal_Int32>& rKernArray, const OUString& 
rText, sal_Int32 nStt,
-                       sal_Int32 nLen, tools::Long nGridWidth, bool bForceLeft)
+tools::Long SnapToGrid(std::vector<sal_Int32>& rKernArray, std::u16string_view 
aText,
+                       sal_Int32 nStt, sal_Int32 nLen, tools::Long nGridWidth, 
bool bForceLeft)
 {
-    assert(nStt + nLen <= rText.getLength());
+    assert(nStt + nLen <= sal_Int32(aText.size()));
     assert(nLen <= sal_Int32(rKernArray.size()));
 
     tools::Long nCharWidth = rKernArray[0];
     tools::Long nMinWidth = lcl_MinGridWidth(nGridWidth, nCharWidth);
-    tools::Long nDelta = lcl_OffsetFromGridEdge(nMinWidth, nCharWidth, 
rText[nStt], bForceLeft);
+    tools::Long nDelta = lcl_OffsetFromGridEdge(nMinWidth, nCharWidth, 
aText[nStt], bForceLeft);
     tools::Long nEdge = nMinWidth - nDelta;
 
     sal_Int32 nLast = 0;
@@ -190,7 +191,7 @@ tools::Long SnapToGrid(std::vector<sal_Int32>& rKernArray, 
const OUString& rText
         nCharWidth = rKernArray[i] - rKernArray[nLast];
         nMinWidth = lcl_MinGridWidth(nGridWidth, nCharWidth);
         tools::Long nX
-            = nEdge + lcl_OffsetFromGridEdge(nMinWidth, nCharWidth, rText[nStt 
+ i], bForceLeft);
+            = nEdge + lcl_OffsetFromGridEdge(nMinWidth, nCharWidth, aText[nStt 
+ i], bForceLeft);
         nEdge += nMinWidth;
 
         while (nLast < i)
diff --git a/sw/source/core/txtnode/justify.hxx 
b/sw/source/core/txtnode/justify.hxx
index 4720a4c04d64..9a7ff5f126ab 100644
--- a/sw/source/core/txtnode/justify.hxx
+++ b/sw/source/core/txtnode/justify.hxx
@@ -20,7 +20,7 @@ SW_DLLPUBLIC sal_Int32 GetModelPosition(const 
std::vector<sal_Int32>& rKernArray
                                         tools::Long nX);
 /// Distribute space between words and letters.
 /// @param[in,out] rKernArray text positions from OutDev::GetTextArray().
-/// @param rText string used to determine where space and kern are inserted.
+/// @param aText string used to determine where space and kern are inserted.
 /// @param nStt starting index of rText.
 /// @param nLen number of elements to process in rKernArray and rText.
 /// @param nSpaceAdd amount of space to insert for each CH_BLANK.
@@ -28,7 +28,7 @@ SW_DLLPUBLIC sal_Int32 GetModelPosition(const 
std::vector<sal_Int32>& rKernArray
 /// @param bNoHalfSpace whether to split the space into two halves.
 ///        Split spaces are inserted before and after CH_BLANK.
 ///        Set to true in word line mode and for Arabic text to avoid 
splitting.
-SW_DLLPUBLIC void SpaceDistribution(std::vector<sal_Int32>& rKernArray, const 
OUString& rText,
+SW_DLLPUBLIC void SpaceDistribution(std::vector<sal_Int32>& rKernArray, 
std::u16string_view aText,
                                     sal_Int32 nStt, sal_Int32 nLen, 
tools::Long nSpaceAdd,
                                     tools::Long nKern, bool bNoHalfSpace);
 
@@ -40,14 +40,14 @@ SW_DLLPUBLIC void SpaceDistribution(std::vector<sal_Int32>& 
rKernArray, const OU
 /// ideograph.
 /// c) Other ideographs are aligned to the center of the spanned grids.
 /// @param[in,out] rKernArray text positions from OutDev::GetTextArray().
-/// @param rText string used to determine where space and kern are inserted.
+/// @param aText string used to determine where space and kern are inserted.
 /// @param nStt starting index of rText.
 /// @param nLen number of elements to process in rKernArray and rText.
 /// @param nGridWidth width of a text grid
 /// @param bForceLeft for align to the left edge of the grid disregard of the 
punctuation type.
 /// This is useful for calculate text width, line break, and conversion model 
position.
 /// @return the delta offset of first glyph so text origin can be updated 
accordingly.
-SW_DLLPUBLIC tools::Long SnapToGrid(std::vector<sal_Int32>& rKernArray, const 
OUString& rText,
+SW_DLLPUBLIC tools::Long SnapToGrid(std::vector<sal_Int32>& rKernArray, 
std::u16string_view aText,
                                     sal_Int32 nStt, sal_Int32 nLen, 
tools::Long nGridWidth,
                                     bool bForceLeft);
 
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 0706bf1b1ab7..131869909782 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -652,12 +652,12 @@ void SwTextNode::RstTextAttr(
     CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aNew));
 }
 
-static sal_Int32 clipIndexBounds(const OUString &rStr, sal_Int32 nPos)
+static sal_Int32 clipIndexBounds(std::u16string_view aStr, sal_Int32 nPos)
 {
     if (nPos < 0)
         return 0;
-    if (nPos > rStr.getLength())
-        return rStr.getLength();
+    if (nPos > sal_Int32(aStr.size()))
+        return aStr.size();
     return nPos;
 }
 
@@ -1975,14 +1975,14 @@ void SwTextNode::TransliterateText(
 }
 
 void SwTextNode::ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
-                                const OUString & rText,
+                                std::u16string_view aText,
                                 const Sequence<sal_Int32>& rOffsets )
 {
-    assert(rText.getLength() - nLen <= GetSpaceLeft());
+    assert(sal_Int32(aText.size()) - nLen <= GetSpaceLeft());
 
-    m_Text = m_Text.replaceAt(nPos, nLen, rText);
+    m_Text = m_Text.replaceAt(nPos, nLen, aText);
 
-    sal_Int32 nTLen = rText.getLength();
+    sal_Int32 nTLen = aText.size();
     const sal_Int32* pOffsets = rOffsets.getConstArray();
     // now look for no 1-1 mapping -> move the indices!
     sal_Int32 nMyOff = nPos;
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 42de132107c0..15088959db00 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -716,21 +716,21 @@ static OUString lcl_DenotedPortion(std::u16string_view 
rStr, sal_Int32 nStart, s
     return aResult;
 }
 
-OUString DenoteSpecialCharacters(const OUString & rStr, bool bQuoted)
+OUString DenoteSpecialCharacters(std::u16string_view aStr, bool bQuoted)
 {
     OUStringBuffer aResult;
 
-    if (!rStr.isEmpty())
+    if (!aStr.empty())
     {
         bool bStart = false;
         sal_Int32 nStart = 0;
         sal_Unicode cLast = 0;
 
-        for( sal_Int32 i = 0; i < rStr.getLength(); i++)
+        for( size_t i = 0; i < aStr.size(); i++)
         {
-            if (lcl_IsSpecialCharacter(rStr[i]))
+            if (lcl_IsSpecialCharacter(aStr[i]))
             {
-                if (cLast != rStr[i])
+                if (cLast != aStr[i])
                     bStart = true;
 
             }
@@ -742,16 +742,16 @@ OUString DenoteSpecialCharacters(const OUString & rStr, 
bool bQuoted)
 
             if (bStart)
             {
-                aResult.append(lcl_DenotedPortion(rStr, nStart, i, bQuoted));
+                aResult.append(lcl_DenotedPortion(aStr, nStart, i, bQuoted));
 
                 nStart = i;
                 bStart = false;
             }
 
-            cLast = rStr[i];
+            cLast = aStr[i];
         }
 
-        aResult.append(lcl_DenotedPortion(rStr, nStart, rStr.getLength(), 
bQuoted));
+        aResult.append(lcl_DenotedPortion(aStr, nStart, aStr.size(), bQuoted));
     }
     else
         aResult = SwRewriter::GetPlaceHolder(UndoArg2);
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index b9c73ae237ee..11009dfd230d 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1534,22 +1534,22 @@ bool SwUndo::CanRedlineGroup( SwRedlineSaveDatas& rCurr,
     return true;
 }
 
-OUString ShortenString(const OUString & rStr, sal_Int32 nLength, const 
OUString & rFillStr)
+OUString ShortenString(const OUString & rStr, sal_Int32 nLength, 
std::u16string_view aFillStr)
 {
-    assert(nLength - rFillStr.getLength() >= 2);
+    assert(nLength - aFillStr.size() >= 2);
 
     if (rStr.getLength() <= nLength)
         return rStr;
 
-    nLength -= rFillStr.getLength();
+    nLength -= aFillStr.size();
     if ( nLength < 2 )
         nLength = 2;
 
     const sal_Int32 nFrontLen = nLength - nLength / 2;
     const sal_Int32 nBackLen = nLength - nFrontLen;
 
-    return rStr.subView(0, nFrontLen)
-           + rFillStr
+    return OUString::Concat(rStr.subView(0, nFrontLen))
+           + aFillStr
            + rStr.subView(rStr.getLength() - nBackLen);
 }
 
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 24b9e6883c63..04567219168f 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1168,12 +1168,12 @@ void InsertFile(SwUnoCursor* pUnoCursor, const 
OUString& rURL,
 bool DocInsertStringSplitCR(
         SwDoc &rDoc,
         const SwPaM &rNewCursor,
-        const OUString &rText,
+        std::u16string_view rText,
         const bool bForceExpandHints )
 {
     bool bOK = true;
 
-    for (sal_Int32 i = 0; i < rText.getLength(); ++i)
+    for (size_t i = 0; i < rText.size(); ++i)
     {
         sal_Unicode const ch(rText[i]);
         if (linguistic::IsControlChar(ch)
@@ -1202,16 +1202,16 @@ bool DocInsertStringSplitCR(
     sal_Int32 nStartIdx = 0;
     const sal_Int32 nMaxLength = COMPLETE_STRING - 
pTextNd->GetText().getLength();
 
-    sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
-    if( ( nIdx == -1 && nMaxLength < rText.getLength() ) ||
-        ( nIdx != -1 && nMaxLength < nIdx ) )
+    size_t nIdx = rText.find( '\r', nStartIdx );
+    if( ( nIdx == std::u16string_view::npos && nMaxLength < 
sal_Int32(rText.size()) ) ||
+        ( nIdx != std::u16string_view::npos && nMaxLength < sal_Int32(nIdx) ) )
     {
         nIdx = nMaxLength;
     }
-    while (nIdx != -1 )
+    while (nIdx != std::u16string_view::npos )
     {
-        OSL_ENSURE( nIdx - nStartIdx >= 0, "index negative!" );
-        aText = rText.copy( nStartIdx, nIdx - nStartIdx );
+        OSL_ENSURE( sal_Int32(nIdx) - nStartIdx >= 0, "index negative!" );
+        aText = rText.substr( nStartIdx, nIdx - nStartIdx );
         if (!aText.isEmpty() &&
             !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, 
aText, nInsertFlags ))
         {
@@ -1224,9 +1224,9 @@ bool DocInsertStringSplitCR(
             bOK = false;
         }
         nStartIdx = nIdx + 1;
-        nIdx = rText.indexOf( '\r', nStartIdx );
+        nIdx = rText.find( '\r', nStartIdx );
     }
-    aText = rText.copy( nStartIdx );
+    aText = rText.substr( nStartIdx );
     if (!aText.isEmpty() &&
         !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, 
nInsertFlags ))
     {
diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index c52d7c154785..f4c7c659bd04 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -706,7 +706,7 @@ SwXTextCursor::~SwXTextCursor()
     m_pUnoCursor.reset(nullptr); // need to delete this with SolarMutex held
 }
 
-void SwXTextCursor::DeleteAndInsert(const OUString& rText,
+void SwXTextCursor::DeleteAndInsert(std::u16string_view aText,
         ::sw::DeleteAndInsertMode const eMode)
 {
     auto pUnoCursor = static_cast<SwCursor*>(m_pUnoCursor.get());
@@ -716,7 +716,7 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
     // Start/EndAction
     SwDoc& rDoc = pUnoCursor->GetDoc();
     UnoActionContext aAction(&rDoc);
-    const sal_Int32 nTextLen = rText.getLength();
+    const sal_Int32 nTextLen = aText.size();
     rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
     auto pCurrent = pUnoCursor;
     do
@@ -731,11 +731,11 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
         {
             const bool bSuccess(
                 SwUnoCursorHelper::DocInsertStringSplitCR(
-                    rDoc, *pCurrent, rText, bool(eMode & 
::sw::DeleteAndInsertMode::ForceExpandHints)));
+                    rDoc, *pCurrent, aText, bool(eMode & 
::sw::DeleteAndInsertMode::ForceExpandHints)));
             OSL_ENSURE( bSuccess, "Doc->Insert(Str) failed." );
 
             SwUnoCursorHelper::SelectPam(*pUnoCursor, true);
-            pCurrent->Left(rText.getLength());
+            pCurrent->Left(aText.size());
         }
         pCurrent = pCurrent->GetNext();
     } while (pCurrent != pUnoCursor);
diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index c9a1cfca662e..83828ad45b94 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -798,7 +798,7 @@ static void DeleteTable(SwDoc & rDoc, SwTable& rTable)
 }
 
 void SwXTextRange::DeleteAndInsert(
-        const OUString& rText, ::sw::DeleteAndInsertMode const eMode)
+        std::u16string_view aText, ::sw::DeleteAndInsertMode const eMode)
 {
     if (RANGE_IS_TABLE == m_pImpl->m_eRangePosition)
     {
@@ -886,16 +886,16 @@ void SwXTextRange::DeleteAndInsert(
     if (aCursor.HasMark())
     {
         m_pImpl->m_rDoc.getIDocumentContentOperations().DeleteAndJoin(aCursor,
-            (!rText.isEmpty() || eMode & 
::sw::DeleteAndInsertMode::ForceReplace) ? SwDeleteFlags::ArtificialSelection : 
SwDeleteFlags::Default);
+            (!aText.empty() || eMode & 
::sw::DeleteAndInsertMode::ForceReplace) ? SwDeleteFlags::ArtificialSelection : 
SwDeleteFlags::Default);
     }
 
-    if (!rText.isEmpty())
+    if (!aText.empty())
     {
         SwUnoCursorHelper::DocInsertStringSplitCR(
-            m_pImpl->m_rDoc, aCursor, rText, bool(eMode & 
::sw::DeleteAndInsertMode::ForceExpandHints));
+            m_pImpl->m_rDoc, aCursor, aText, bool(eMode & 
::sw::DeleteAndInsertMode::ForceExpandHints));
 
         SwUnoCursorHelper::SelectPam(aCursor, true);
-        aCursor.Left(rText.getLength());
+        aCursor.Left(aText.size());
     }
     SetPositions(aCursor);
     m_pImpl->m_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
@@ -1649,7 +1649,7 @@ uno::Any SAL_CALL SwXTextRangesImpl::getByIndex(sal_Int32 
nIndex)
     return ret;
 }
 
-void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
+void SwUnoCursorHelper::SetString(SwCursor & rCursor, std::u16string_view 
aString)
 {
     // Start/EndAction
     SwDoc& rDoc = rCursor.GetDoc();
@@ -1659,13 +1659,13 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, 
const OUString& rString)
     {
         rDoc.getIDocumentContentOperations().DeleteAndJoin(rCursor);
     }
-    if (!rString.isEmpty())
+    if (!aString.empty())
     {
         const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
-                    rDoc, rCursor, rString, false ) );
+                    rDoc, rCursor, aString, false ) );
         OSL_ENSURE( bSuccess, "DocInsertStringSplitCR" );
         SwUnoCursorHelper::SelectPam(rCursor, true);
-        rCursor.Left(rString.getLength());
+        rCursor.Left(aString.size());
     }
     rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
 }
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 266ca6f1aaa8..f06befaad2ee 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -349,10 +349,10 @@ static uno::Any lcl_GetSpecialProperty(SwFrameFormat* 
pFormat, const SfxItemProp
  * @param [IN,OUT] o_rRow (0-based)
  */
 //TODO: potential for throwing proper exceptions instead of having every 
caller to check for errors
-void SwXTextTable::GetCellPosition(const OUString& rCellName, sal_Int32& 
o_rColumn, sal_Int32& o_rRow)
+void SwXTextTable::GetCellPosition(std::u16string_view aCellName, sal_Int32& 
o_rColumn, sal_Int32& o_rRow)
 {
     o_rColumn = o_rRow = -1;    // default return values indicating failure
-    const sal_Int32 nLen = rCellName.getLength();
+    const sal_Int32 nLen = aCellName.size();
     if(!nLen)
     {
         SAL_WARN("sw.uno", "failed to get column or row index");
@@ -361,7 +361,7 @@ void SwXTextTable::GetCellPosition(const OUString& 
rCellName, sal_Int32& o_rColu
     sal_Int32 nRowPos = 0;
     while (nRowPos<nLen)
     {
-        if (rCellName[nRowPos]>='0' && rCellName[nRowPos]<='9')
+        if (aCellName[nRowPos]>='0' && aCellName[nRowPos]<='9')
         {
             break;
         }
@@ -376,7 +376,7 @@ void SwXTextTable::GetCellPosition(const OUString& 
rCellName, sal_Int32& o_rColu
         nColIdx *= 52;
         if (i < nRowPos - 1)
             ++nColIdx;
-        const sal_Unicode cChar = rCellName[i];
+        const sal_Unicode cChar = aCellName[i];
         if ('A' <= cChar && cChar <= 'Z')
             nColIdx += cChar - 'A';
         else if ('a' <= cChar && cChar <= 'z')
@@ -389,7 +389,7 @@ void SwXTextTable::GetCellPosition(const OUString& 
rCellName, sal_Int32& o_rColu
     }
 
     o_rColumn = nColIdx;
-    o_rRow    = o3tl::toInt32(rCellName.subView(nRowPos)) - 1; // - 1 because 
indices ought to be 0 based
+    o_rRow    = o3tl::toInt32(aCellName.substr(nRowPos)) - 1; // - 1 because 
indices ought to be 0 based
 }
 
 /** compare position of two cells (check rows first)
@@ -401,11 +401,11 @@ void SwXTextTable::GetCellPosition(const OUString& 
rCellName, sal_Int32& o_rColu
  * @param rCellName2 e.g. "A1" (non-empty string with valid cell name)
  * @return -1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > 
cell_2
  */
-int sw_CompareCellsByRowFirst( const OUString &rCellName1, const OUString 
&rCellName2 )
+int sw_CompareCellsByRowFirst( std::u16string_view aCellName1, 
std::u16string_view aCellName2 )
 {
     sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
-    SwXTextTable::GetCellPosition( rCellName1, nCol1, nRow1 );
-    SwXTextTable::GetCellPosition( rCellName2, nCol2, nRow2 );
+    SwXTextTable::GetCellPosition( aCellName1, nCol1, nRow1 );
+    SwXTextTable::GetCellPosition( aCellName2, nCol2, nRow2 );
 
     if (nRow1 < nRow2 || (nRow1 == nRow2 && nCol1 < nCol2))
         return -1;
@@ -424,11 +424,11 @@ int sw_CompareCellsByRowFirst( const OUString 
&rCellName1, const OUString &rCell
  * @param rCellName2 e.g. "A1" (non-empty string with valid cell name)
  * @return -1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > 
cell_2
  */
-int sw_CompareCellsByColFirst( const OUString &rCellName1, const OUString 
&rCellName2 )
+int sw_CompareCellsByColFirst( std::u16string_view aCellName1, 
std::u16string_view aCellName2 )
 {
     sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
-    SwXTextTable::GetCellPosition( rCellName1, nCol1, nRow1 );
-    SwXTextTable::GetCellPosition( rCellName2, nCol2, nRow2 );
+    SwXTextTable::GetCellPosition( aCellName1, nCol1, nRow1 );
+    SwXTextTable::GetCellPosition( aCellName2, nCol2, nRow2 );
 
     if (nCol1 < nCol2 || (nCol1 == nCol2 && nRow1 < nRow2))
         return -1;
@@ -452,20 +452,20 @@ int sw_CompareCellsByColFirst( const OUString 
&rCellName1, const OUString &rCell
  * @return -1 if cell_range_1 < cell_range_2; 0 if both cell ranges are equal; 
+1 if cell_range_1 > cell_range_2
  */
 int sw_CompareCellRanges(
-        const OUString &rRange1StartCell, const OUString &rRange1EndCell,
-        const OUString &rRange2StartCell, const OUString &rRange2EndCell,
+        std::u16string_view aRange1StartCell, std::u16string_view 
aRange1EndCell,
+        std::u16string_view aRange2StartCell, std::u16string_view 
aRange2EndCell,
         bool bCmpColsFirst )
 {
-    int (*pCompareCells)( const OUString &, const OUString & ) =
+    int (*pCompareCells)( std::u16string_view, std::u16string_view ) =
             bCmpColsFirst ? &sw_CompareCellsByColFirst : 
&sw_CompareCellsByRowFirst;
 
-    int nCmpResStartCells = pCompareCells( rRange1StartCell, rRange2StartCell 
);
+    int nCmpResStartCells = pCompareCells( aRange1StartCell, aRange2StartCell 
);
     if ((-1 == nCmpResStartCells ) ||
          ( 0 == nCmpResStartCells &&
-          -1 == pCompareCells( rRange1EndCell, rRange2EndCell ) ))
+          -1 == pCompareCells( aRange1EndCell, aRange2EndCell ) ))
         return -1;
     else if (0 == nCmpResStartCells &&
-             0 == pCompareCells( rRange1EndCell, rRange2EndCell ))
+             0 == pCompareCells( aRange1EndCell, aRange2EndCell ))
         return 0;
     else
         return +1;
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 5d65f5ef8b63..9378016997a6 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -613,12 +613,12 @@ SwXText::insertTextContent(
         uno::Reference<lang::XUnoTunnel> const xRangeTunnel(xRange, 
uno::UNO_QUERY);
         if (SwXTextRange *const pRange = 
comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel))
         {
-            pRange->DeleteAndInsert(OUString(), 
::sw::DeleteAndInsertMode::ForceReplace
+            pRange->DeleteAndInsert(u"", 
::sw::DeleteAndInsertMode::ForceReplace
                 | (bForceExpandHints ? 
::sw::DeleteAndInsertMode::ForceExpandHints : 
::sw::DeleteAndInsertMode::Default));
         }
         else if (SwXTextCursor *const pCursor = 
dynamic_cast<SwXTextCursor*>(comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel)))
         {
-            pCursor->DeleteAndInsert(OUString(), 
::sw::DeleteAndInsertMode::ForceReplace
+            pCursor->DeleteAndInsert(u"", 
::sw::DeleteAndInsertMode::ForceReplace
                 | (bForceExpandHints ? 
::sw::DeleteAndInsertMode::ForceExpandHints : 
::sw::DeleteAndInsertMode::Default));
         }
         else
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 8021b62f1ba9..d7849a56e4c7 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -2162,29 +2162,29 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const 
SwFrameFormat& rFrameFormat,
     return rWrt;
 }
 
-void SwHTMLWriter::AddLinkTarget( const OUString& rURL )
+void SwHTMLWriter::AddLinkTarget( std::u16string_view aURL )
 {
-    if( rURL.isEmpty() || rURL[0] != '#' )
+    if( aURL.empty() || aURL[0] != '#' )
         return;
 
     // There might be a '|' as delimiter (if the link has been inserted
     // freshly) or a '%7c' or a '%7C' if the document has been saved and
     // loaded already.
-    sal_Int32 nPos = rURL.getLength();
+    sal_Int32 nPos = aURL.size();
     bool bFound = false, bEncoded = false;
     while( !bFound && nPos > 0 )
     {
-        sal_Unicode c = rURL[ --nPos ];
+        sal_Unicode c = aURL[ --nPos ];
         switch( c )
         {
         case cMarkSeparator:
             bFound = true;
             break;
         case '%':
-            bFound = (rURL.getLength() - nPos) >=3 && rURL[ nPos+1 ] == '7';
+            bFound = (aURL.size() - nPos) >=3 && aURL[ nPos+1 ] == '7';
             if(bFound)
             {
-                c = rURL[ nPos+2 ];
+                c = aURL[ nPos+2 ];
                 bFound = (c == 'C' || c == 'c');
             }
             if( bFound )
@@ -2194,10 +2194,10 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL )
     if( !bFound || nPos < 2 ) // at least "#a|..."
         return;
 
-    OUString aURL( rURL.copy( 1 ) );
+    aURL = aURL.substr( 1 );
 
     // nPos-1+1/3 (-1 because of Erase)
-    OUString sCmp = aURL.copy(bEncoded ? nPos+2 : nPos).replaceAll(" ","");
+    OUString sCmp = OUString(aURL.substr(bEncoded ? nPos+2 : 
nPos)).replaceAll(" ","");
     if( sCmp.isEmpty() )
         return;
 
@@ -2210,17 +2210,18 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL )
         sCmp == "table" )
     {
         // Just remember it in a sorted array
+        OUString aURL2(aURL);
         if( bEncoded )
         {
-            aURL = aURL.replaceAt( nPos - 1, 3, 
rtl::OUStringChar(cMarkSeparator)  );
+            aURL2 = aURL2.replaceAt( nPos - 1, 3, 
rtl::OUStringChar(cMarkSeparator)  );
         }
-        m_aImplicitMarks.insert( aURL );
+        m_aImplicitMarks.insert( aURL2 );
     }
     else if( sCmp == "outline" )
     {
         // Here, we need position and name. That's why we sort a
         // sal_uInt16 and a string array ourselves.
-        OUString aOutline( aURL.copy( 0, nPos-1 ) );
+        OUString aOutline( aURL.substr( 0, nPos-1 ) );
         SwPosition aPos( *m_pCurrentPam->GetPoint() );
         if( m_pDoc->GotoOutline( aPos, aOutline ) )
         {
@@ -2232,11 +2233,12 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL )
                 nIns++;
 
             m_aOutlineMarkPoss.insert( m_aOutlineMarkPoss.begin()+nIns, nIdx );
+            OUString aURL2(aURL);
             if( bEncoded )
             {
-                aURL = aURL.replaceAt( nPos - 1, 3, 
rtl::OUStringChar(cMarkSeparator) );
+                aURL2 = aURL2.replaceAt( nPos - 1, 3, 
rtl::OUStringChar(cMarkSeparator) );
             }
-            m_aOutlineMarks.insert( m_aOutlineMarks.begin()+nIns, aURL );
+            m_aOutlineMarks.insert( m_aOutlineMarks.begin()+nIns, aURL2 );
         }
     }
 }
diff --git a/sw/source/filter/html/htmlftn.cxx 
b/sw/source/filter/html/htmlftn.cxx
index a3a1222a3050..7b3d3e7ad030 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -37,11 +37,11 @@
 #include "swhtml.hxx"
 #include "wrthtml.hxx"
 
-static sal_Int32 lcl_html_getNextPart( OUString& rPart, const OUString& 
rContent,
+static sal_Int32 lcl_html_getNextPart( OUString& rPart, std::u16string_view 
aContent,
                              sal_Int32 nPos )
 {
     rPart.clear();
-    sal_Int32 nLen = rContent.getLength();
+    sal_Int32 nLen = aContent.size();
     if( nPos >= nLen )
     {
         nPos = -1;
@@ -51,7 +51,7 @@ static sal_Int32 lcl_html_getNextPart( OUString& rPart, const 
OUString& rContent
         bool bQuoted = false, bDone = false;
         for( ; nPos < nLen && !bDone; nPos++ )
         {
-            sal_Unicode c = rContent[nPos];
+            sal_Unicode c = aContent[nPos];
             switch( c )
             {
             case '\\':
@@ -80,7 +80,7 @@ static sal_Int32 lcl_html_getNextPart( OUString& rPart, const 
OUString& rContent
 }
 
 static sal_Int32 lcl_html_getEndNoteInfo( SwEndNoteInfo& rInfo,
-                                    const OUString& rContent,
+                                    std::u16string_view aContent,
                                     bool bEndNote )
 {
     sal_Int32 nStrPos = 0;
@@ -88,7 +88,7 @@ static sal_Int32 lcl_html_getEndNoteInfo( SwEndNoteInfo& 
rInfo,
     {
         OUString aPart;
         if( -1 != nStrPos )
-            nStrPos = lcl_html_getNextPart( aPart, rContent, nStrPos );
+            nStrPos = lcl_html_getNextPart( aPart, aContent, nStrPos );
 
         switch( nPart )
         {
@@ -116,24 +116,24 @@ static sal_Int32 lcl_html_getEndNoteInfo( SwEndNoteInfo& 
rInfo,
     return nStrPos;
 }
 
-void SwHTMLParser::FillEndNoteInfo( const OUString& rContent )
+void SwHTMLParser::FillEndNoteInfo( std::u16string_view aContent )
 {
     SwEndNoteInfo aInfo( m_xDoc->GetEndNoteInfo() );
-    lcl_html_getEndNoteInfo( aInfo, rContent, true );
+    lcl_html_getEndNoteInfo( aInfo, aContent, true );
     m_xDoc->SetEndNoteInfo( aInfo );
 }
 
-void SwHTMLParser::FillFootNoteInfo( const OUString& rContent )
+void SwHTMLParser::FillFootNoteInfo( std::u16string_view aContent )
 {
     SwFootnoteInfo aInfo( m_xDoc->GetFootnoteInfo() );
 
-    sal_Int32 nStrPos = lcl_html_getEndNoteInfo( aInfo, rContent, false );
+    sal_Int32 nStrPos = lcl_html_getEndNoteInfo( aInfo, aContent, false );
 
     for( int nPart = 4; nPart < 8; ++nPart )
     {
         OUString aPart;
         if( -1 != nStrPos )
-            nStrPos = lcl_html_getNextPart( aPart, rContent, nStrPos );
+            nStrPos = lcl_html_getNextPart( aPart, aContent, nStrPos );
 
         switch( nPart )
         {
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 9123d4e2b6e4..fa4811c6d416 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -860,8 +860,8 @@ private:
     void InsertLineBreak();
     void InsertHorzRule();
 
-    void FillEndNoteInfo( const OUString& rContent );
-    void FillFootNoteInfo( const OUString& rContent );
+    void FillEndNoteInfo( std::u16string_view aContent );
+    void FillFootNoteInfo( std::u16string_view aContent );
     void InsertFootEndNote( const OUString& rName, bool bEndNote, bool bFixed 
);
     void FinishFootEndNote();
     void InsertFootEndNoteText();
diff --git a/sw/source/filter/html/wrthtml.hxx 
b/sw/source/filter/html/wrthtml.hxx
index 8dbcb9781e52..b62aab60af6e 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -282,7 +282,7 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
     const SwPageDesc *MakeHeader( sal_uInt16& rHeaderAtrs );
     void GetControls();
 
-    void AddLinkTarget( const OUString& rURL );
+    void AddLinkTarget( std::u16string_view aURL );
     void CollectLinkTargets();
 
     void SetupFilterOptions(std::u16string_view rFilterOptions);
diff --git a/sw/source/filter/ww8/writerwordglue.cxx 
b/sw/source/filter/ww8/writerwordglue.cxx
index 6d1f40c556b2..f457905ffd9d 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -763,14 +763,14 @@ namespace sw
         /** Find cFind in rParams if not embedded in " double quotes.
             Will NOT find '\\' or '"'.
          */
-        static sal_Int32 findUnquoted( const OUString& rParams, sal_Unicode 
cFind, sal_Int32 nFromPos )
+        static sal_Int32 findUnquoted( std::u16string_view aParams, 
sal_Unicode cFind, sal_Int32 nFromPos )
         {
-            const sal_Int32 nLen = rParams.getLength();
+            const sal_Int32 nLen = aParams.size();
             if (nFromPos < 0 || nLen <= nFromPos)
                 return -1;
             for (sal_Int32 nI = nFromPos; nI < nLen; ++nI)
             {
-                const sal_Unicode c = rParams[nI];
+                const sal_Unicode c = aParams[nI];
                 if (c == '\\')
                     ++nI;
                 else if (c == '\"')
@@ -779,7 +779,7 @@ namespace sw
                     // While not at the end and not at an unescaped end quote
                     while (nI < nLen)
                     {
-                        if (rParams[nI] == '\"' && rParams[nI-1] != '\\')
+                        if (aParams[nI] == '\"' && aParams[nI-1] != '\\')
                             break;
                         ++nI;
                     }
@@ -796,12 +796,12 @@ namespace sw
         /** Find all rFind in rParams if not embedded in " double quotes and
             replace with rReplace. Will NOT find '\\' or '"'.
          */
-        static bool replaceUnquoted( OUString& rParams, const OUString& rFind, 
const OUString& rReplace )
+        static bool replaceUnquoted( OUString& rParams, std::u16string_view 
aFind, std::u16string_view aReplace )
         {
             bool bReplaced = false;
-            if (rFind.isEmpty())
+            if (aFind.empty())
                 return bReplaced;
-            const sal_Unicode cFirst = rFind[0];
+            const sal_Unicode cFirst = aFind[0];
 
             sal_Int32 nLen = rParams.getLength();
             for (sal_Int32 nI = 0; nI < nLen; ++nI)
@@ -822,11 +822,11 @@ namespace sw
                 }
                 else //normal unquoted section
                 {
-                    if (c == cFirst && rParams.match( rFind, nI))
+                    if (c == cFirst && rParams.match( aFind, nI))
                     {
-                        const sal_Int32 nFindLen = rFind.getLength();
-                        const sal_Int32 nDiff = rReplace.getLength() - 
nFindLen;
-                        rParams = rParams.replaceAt( nI, nFindLen, rReplace);
+                        const sal_Int32 nFindLen = aFind.size();
+                        const sal_Int32 nDiff = aReplace.size() - nFindLen;
+                        rParams = rParams.replaceAt( nI, nFindLen, aReplace);
                         nI += nFindLen + nDiff - 1;
                         nLen += nDiff;
                         bReplaced = true;
@@ -856,8 +856,8 @@ namespace sw
             // effectively changes from Gengou to Gregorian calendar. Legacy
             // because it wasn't supported a decade ago and now moot? Or is
             // that a Word specialty?
-            bForceJapanese |= replaceUnquoted( rParams, "ee", "yyyy");
-            bForceJapanese |= replaceUnquoted( rParams, "EE", "YYYY");
+            bForceJapanese |= replaceUnquoted( rParams, u"ee", u"yyyy");
+            bForceJapanese |= replaceUnquoted( rParams, u"EE", u"YYYY");
             if (LANGUAGE_FRENCH != nDocLang)
             {
                 // Handle the 'a' case here
@@ -871,8 +871,8 @@ namespace sw
             }
 
             // Force to NatNum when finding one of 'oOA'
-            bool bForceNatNum  = replaceUnquoted( rParams, "o", "m")
-                                 || replaceUnquoted( rParams, "O", "M");
+            bool bForceNatNum  = replaceUnquoted( rParams, u"o", u"m")
+                                 || replaceUnquoted( rParams, u"O", u"M");
             if (LANGUAGE_FRENCH != nDocLang)
             {
                 // Handle the 'A' case here
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 06c930ba339d..60a77ead72c8 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -318,12 +318,12 @@ void MSWordStyles::BuildStylesTable()
     }
 }
 
-OString MSWordStyles::CreateStyleId(const OUString &rName)
+OString MSWordStyles::CreateStyleId(std::u16string_view aName)
 {
-    OStringBuffer aStyleIdBuf(rName.getLength());
-    for (int i = 0; i < rName.getLength(); ++i)
+    OStringBuffer aStyleIdBuf(aName.size());
+    for (size_t i = 0; i < aName.size(); ++i)
     {
-        sal_Unicode nChar = rName[i];
+        sal_Unicode nChar = aName[i];
         if (('0' <= nChar && nChar <= '9') ||
             ('a' <= nChar && nChar <= 'z') ||
             ('A' <= nChar && nChar <= 'Z'))
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 0a4e8d93925c..db06ca60790b 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1627,7 +1627,7 @@ public:
     sal_uInt16 GetSlot( const SwFormat* pFormat ) const;
 
     /// create style id using only ASCII characters of the style name
-    static OString CreateStyleId(const OUString &rName);
+    static OString CreateStyleId(std::u16string_view aName);
 
     /// Get styleId of the nId-th style (nId is its position in pFormatA).
     OString const & GetStyleId(sal_uInt16 nId) const;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7d9c80a68481..8e6de1570e06 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3458,12 +3458,12 @@ void 
SwWW8ImplReader::emulateMSWordAddTextToParagraph(const OUString& rAddString
 
 namespace sw {
 
-auto FilterControlChars(OUString const& rString) -> OUString
+auto FilterControlChars(std::u16string_view aString) -> OUString
 {
-    OUStringBuffer buf(rString.getLength());
-    for (sal_Int32 i = 0; i < rString.getLength(); ++i)
+    OUStringBuffer buf(aString.size());
+    for (size_t i = 0; i < aString.size(); ++i)
     {
-        sal_Unicode const ch(rString[i]);
+        sal_Unicode const ch(aString[i]);
         if (!linguistic::IsControlChar(ch) || ch == '\r' || ch == '\n' || ch 
== '\t')
         {
             buf.append(ch);
@@ -3478,9 +3478,9 @@ auto FilterControlChars(OUString const& rString) -> 
OUString
 
 } // namespace sw
 
-void SwWW8ImplReader::simpleAddTextToParagraph(const OUString& rAddString)
+void SwWW8ImplReader::simpleAddTextToParagraph(std::u16string_view aAddString)
 {
-    OUString const addString(sw::FilterControlChars(rAddString));
+    OUString const addString(sw::FilterControlChars(aAddString));
 
     if (addString.isEmpty())
         return;
@@ -6419,13 +6419,13 @@ ErrCode WW8Reader::OpenMainStream( 
tools::SvRef<SotStorageStream>& rRef, sal_uIn
     return nRet;
 }
 
-static void lcl_getListOfStreams(SotStorage * pStorage, 
comphelper::SequenceAsHashMap& aStreamsData, const OUString& sPrefix)
+static void lcl_getListOfStreams(SotStorage * pStorage, 
comphelper::SequenceAsHashMap& aStreamsData, std::u16string_view sPrefix)
 {
     SvStorageInfoList aElements;
     pStorage->FillInfoList(&aElements);
     for (const auto & aElement : aElements)
     {
-        OUString sStreamFullName = sPrefix.getLength() ? sPrefix + "/" + 
aElement.GetName() : aElement.GetName();
+        OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) 
+ "/" + aElement.GetName() : aElement.GetName();
         if (aElement.IsStorage())
         {
             tools::SvRef<SotStorage> xSubStorage = 
pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | 
StreamMode::SHARE_DENYALL);
@@ -6464,7 +6464,7 @@ ErrCode WW8Reader::DecryptDRMPackage()
     }
 
     comphelper::SequenceAsHashMap aStreamsData;
-    lcl_getListOfStreams(m_pStorage.get(), aStreamsData, "");
+    lcl_getListOfStreams(m_pStorage.get(), aStreamsData, u"");
 
     try {
         uno::Sequence<beans::NamedValue> aStreams = 
aStreamsData.getAsConstNamedValueList();
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 3a771e1076b4..c84af0d29d00 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -548,7 +548,7 @@ namespace sw
         };
     }
 
-    auto FilterControlChars(OUString const& rString) -> OUString;
+    auto FilterControlChars(std::u16string_view aString) -> OUString;
 }
 
 class WW8FieldEntry
@@ -1449,7 +1449,7 @@ private:
         DeleteStack(std::move(m_xAnchorStck));
     }
     void emulateMSWordAddTextToParagraph(const OUString& rAddString);
-    void simpleAddTextToParagraph(const OUString& rAddString);
+    void simpleAddTextToParagraph(std::u16string_view aAddString);
     bool HandlePageBreakChar();
     bool ReadChar(tools::Long nPosCp, tools::Long nCpOfs);
     bool ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCpOfs);
@@ -1870,7 +1870,7 @@ public:     // really private, but can only be done public
     eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr );
     eF_ResT Read_F_Author( WW8FieldDesc*, OUString& );
     eF_ResT Read_F_TemplName( WW8FieldDesc*, OUString& );
-    SvNumFormatType GetTimeDatePara(OUString const & rStr, sal_uInt32& 
rFormat, LanguageType &rLang,
+    SvNumFormatType GetTimeDatePara(std::u16string_view aStr, sal_uInt32& 
rFormat, LanguageType &rLang,
         int nWhichDefault, bool bHijri = false);
     bool ForceFieldLanguage(SwField &rField, LanguageType nLang);
     eF_ResT Read_F_DateTime( WW8FieldDesc*, OUString& rStr );
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index f137dfec72a4..3989d0fd5924 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -302,27 +302,27 @@ static void lcl_ConvertSequenceName(OUString& 
rSequenceName)
 
 // FindParaStart() finds 1st Parameter that follows '\' and cToken
 // and returns start of this parameter or -1
-static sal_Int32 FindParaStart( const OUString& rStr, sal_Unicode cToken, 
sal_Unicode cToken2 )
+static sal_Int32 FindParaStart( std::u16string_view aStr, sal_Unicode cToken, 
sal_Unicode cToken2 )
 {
     bool bStr = false; // ignore inside a string
 
-    for( sal_Int32 nBuf = 0; nBuf+1 < rStr.getLength(); nBuf++ )
+    for( size_t nBuf = 0; nBuf+1 < aStr.size(); nBuf++ )
     {
-        if( rStr[ nBuf ] == '"' )
+        if( aStr[ nBuf ] == '"' )
             bStr = !bStr;
 
         if(    !bStr
-            && rStr[ nBuf ] == '\\'
-            && (    rStr[ nBuf + 1 ] == cToken
-                 || rStr[ nBuf + 1 ] == cToken2 ) )
+            && aStr[ nBuf ] == '\\'
+            && (    aStr[ nBuf + 1 ] == cToken
+                 || aStr[ nBuf + 1 ] == cToken2 ) )
         {
             nBuf += 2;
             // skip spaces between cToken and its parameters
-            while(    nBuf < rStr.getLength()
-                   && rStr[ nBuf ] == ' ' )
+            while(    nBuf < aStr.size()
+                   && aStr[ nBuf ] == ' ' )
                 nBuf++;
             // return start of parameters
-            return nBuf < rStr.getLength() ? nBuf : -1;
+            return nBuf < aStr.size() ? nBuf : -1;
         }
     }
     return -1;
@@ -331,31 +331,31 @@ static sal_Int32 FindParaStart( const OUString& rStr, 
sal_Unicode cToken, sal_Un
 // FindPara() finds the first parameter including '\' and cToken.
 // A new String will be allocated (has to be deallocated by the caller)
 // and everything that is part of the parameter will be returned.
-static OUString FindPara( const OUString& rStr, sal_Unicode cToken, 
sal_Unicode cToken2 )
+static OUString FindPara( std::u16string_view aStr, sal_Unicode cToken, 
sal_Unicode cToken2 )
 {
     sal_Int32 n2;                                          // end
-    sal_Int32 n = FindParaStart( rStr, cToken, cToken2 );  // start
+    sal_Int32 n = FindParaStart( aStr, cToken, cToken2 );  // start
     if( n == -1)
         return OUString();
 
-    if(    rStr[ n ] == '"'
-        || rStr[ n ] == 132 )
+    if(    aStr[ n ] == '"'
+        || aStr[ n ] == 132 )
     {                               // Quotationmark in front of parameter
         n++;                        // Skip quotationmark
         n2 = n;                     // search for the end starting from here
-        while(     n2 < rStr.getLength()
-                && rStr[ n2 ] != 147
-                && rStr[ n2 ] != '"' )
+        while(     n2 < sal_Int32(aStr.size())
+                && aStr[ n2 ] != 147
+                && aStr[ n2 ] != '"' )
             n2++;                   // search end of parameter
     }
     else
     {                           // no quotationmarks
         n2 = n;                     // search for the end starting from here
-        while(     n2 < rStr.getLength()
-                && rStr[ n2 ] != ' ' )
+        while(     n2 < sal_Int32(aStr.size())
+                && aStr[ n2 ] != ' ' )
             n2++;                   // search end of parameter
     }
-    return rStr.copy( n, n2-n );
+    return OUString(aStr.substr( n, n2-n ));
 }
 
 static SvxNumType GetNumTypeFromName(const OUString& rStr,
@@ -382,9 +382,9 @@ static SvxNumType GetNumTypeFromName(const OUString& rStr,
     return eTyp;
 }
 
-static SvxNumType GetNumberPara(const OUString& rStr, bool bAllowPageDesc = 
false)
+static SvxNumType GetNumberPara(std::u16string_view aStr, bool bAllowPageDesc 
= false)
 {
-    OUString s( FindPara( rStr, '*', '*' ) );     // Type of number
+    OUString s( FindPara( aStr, '*', '*' ) );     // Type of number
     SvxNumType aType = GetNumTypeFromName( s, bAllowPageDesc );
     return aType;
 }
@@ -430,7 +430,7 @@ static OUString 
GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, Lang
     return sParams;
 }
 
-SvNumFormatType SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, 
sal_uInt32& rFormat,
+SvNumFormatType SwWW8ImplReader::GetTimeDatePara(std::u16string_view aStr, 
sal_uInt32& rFormat,
     LanguageType &rLang, int nWhichDefault, bool bHijri)
 {
     bool bRTL = false;
@@ -446,7 +446,7 @@ SvNumFormatType SwWW8ImplReader::GetTimeDatePara(OUString 
const & rStr, sal_uInt
     rLang = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US;
 

... etc. - the rest is truncated

Reply via email to