[Libreoffice-commits] core.git: basic/source chart2/qa chart2/source codemaker/source comphelper/source compilerplugins/clang connectivity/source cppu/source cpputools/source cui/source dbaccess/source desktop/source editeng/source extensions/source filter/source fpicker/source framework/source i18nlangtag/source i18npool/source include/rtl l10ntools/source lingucomponent/source linguistic/source oox/source package/source registry/source reportdesign/source sal/qa sax/qa sax/source scaddins/source scripting/source sc/source sdext/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk starmath/source stoc/source svgio/source svl/source svtools/source svx/source sw/source ucb/source unodevtools/source unoidl/source unotools/source unoxml/source vcl/source vcl/unx writerfilter/source xmlhelp/source xmloff/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 11 10:59:31 UTC 2020


 basic/source/classes/sbunoobj.cxx                                     |    2 
 basic/source/runtime/methods.cxx                                      |    2 
 chart2/qa/extras/chart2dump/chart2dump.cxx                            |    2 
 chart2/source/view/main/VLegend.cxx                                   |    2 
 codemaker/source/javamaker/javatype.cxx                               |    4 
 comphelper/source/misc/storagehelper.cxx                              |    2 
 compilerplugins/clang/stringview.cxx                                  |  188 ++++++++++
 compilerplugins/clang/test/stringview.cxx                             |   96 +++++
 connectivity/source/drivers/mysql_jdbc/YDriver.cxx                    |    2 
 connectivity/source/drivers/odbc/OConnection.cxx                      |    2 
 cppu/source/uno/cascade_mapping.cxx                                   |    4 
 cppu/source/uno/lbenv.cxx                                             |    2 
 cpputools/source/unoexe/unoexe.cxx                                    |    6 
 cui/source/customize/cfg.cxx                                          |    2 
 cui/source/tabpages/tpgradnt.cxx                                      |    2 
 cui/source/tabpages/tphatch.cxx                                       |    2 
 cui/source/tabpages/tppattern.cxx                                     |    2 
 dbaccess/source/ui/control/SqlNameEdit.cxx                            |    4 
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |    2 
 desktop/source/deployment/registry/dp_backend.cxx                     |    2 
 desktop/source/lib/init.cxx                                           |   14 
 desktop/source/migration/migration.cxx                                |    2 
 editeng/source/outliner/outliner.cxx                                  |    2 
 extensions/source/propctrlr/newdatatype.cxx                           |    2 
 filter/source/config/cache/filterfactory.cxx                          |    2 
 filter/source/graphicfilter/idxf/dxfreprd.cxx                         |    4 
 filter/source/msfilter/msvbahelper.cxx                                |    4 
 filter/source/msfilter/util.cxx                                       |    2 
 filter/source/xsltdialog/xmlfiltertestdialog.cxx                      |    4 
 fpicker/source/office/RemoteFilesDialog.cxx                           |    2 
 fpicker/source/office/breadcrumb.cxx                                  |    2 
 fpicker/source/office/iodlg.cxx                                       |    2 
 framework/source/dispatch/popupmenudispatcher.cxx                     |    4 
 framework/source/fwe/xml/xmlnamespaces.cxx                            |    4 
 framework/source/uielement/generictoolbarcontroller.cxx               |    6 
 framework/source/uielement/menubarmanager.cxx                         |   10 
 i18nlangtag/source/languagetag/languagetag.cxx                        |    2 
 i18npool/source/indexentry/genindex_data.cxx                          |    2 
 i18npool/source/nativenumber/nativenumbersupplier.cxx                 |    2 
 include/rtl/string.hxx                                                |   40 ++
 include/rtl/ustring.hxx                                               |   40 ++
 l10ntools/source/helpex.cxx                                           |    2 
 l10ntools/source/helpmerge.cxx                                        |    2 
 l10ntools/source/localize.cxx                                         |    2 
 l10ntools/source/po.cxx                                               |    2 
 l10ntools/source/treemerge.cxx                                        |    8 
 l10ntools/source/xrmmerge.cxx                                         |    2 
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx                   |    8 
 linguistic/source/dicimp.cxx                                          |    4 
 oox/source/core/filterbase.cxx                                        |    4 
 oox/source/core/xmlfilterbase.cxx                                     |    2 
 oox/source/dump/dumperbase.cxx                                        |    2 
 oox/source/export/drawingml.cxx                                       |    2 
 package/source/zippackage/zipfileaccess.cxx                           |    4 
 registry/source/regimpl.cxx                                           |    4 
 reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx           |    2 
 reportdesign/source/ui/misc/UITools.cxx                               |    2 
 sal/qa/osl/process/osl_process.cxx                                    |    2 
 sal/qa/rtl/process/rtl_Process.cxx                                    |    2 
 sax/qa/cppunit/xmlimport.cxx                                          |    4 
 sax/source/fastparser/fastparser.cxx                                  |    6 
 sc/source/core/opencl/formulagroupcl.cxx                              |    2 
 sc/source/core/tool/interpr1.cxx                                      |    2 
 sc/source/core/tool/rangeutl.cxx                                      |    2 
 sc/source/core/tool/reffind.cxx                                       |    4 
 sc/source/filter/excel/xestream.cxx                                   |    2 
 sc/source/filter/xml/xmlcelli.cxx                                     |    2 
 sc/source/ui/app/inputhdl.cxx                                         |    4 
 sc/source/ui/docshell/impex.cxx                                       |    2 
 sc/source/ui/navipi/content.cxx                                       |    4 
 scaddins/source/analysis/analysishelper.cxx                           |    2 
 scripting/source/dlgprov/dlgevtatt.cxx                                |   10 
 sd/source/core/drawdoc3.cxx                                           |    4 
 sd/source/filter/eppt/pptx-epptbase.cxx                               |    2 
 sd/source/ui/dlg/custsdlg.cxx                                         |    2 
 sd/source/ui/func/fuconstr.cxx                                        |    2 
 sd/source/ui/func/fuinsfil.cxx                                        |    2 
 sd/source/ui/unoidl/unopage.cxx                                       |    6 
 sdext/source/presenter/PresenterSlideSorter.cxx                       |    2 
 sfx2/source/appl/appserv.cxx                                          |    2 
 sfx2/source/appl/sfxhelp.cxx                                          |    8 
 sfx2/source/control/thumbnailviewitem.cxx                             |    2 
 sfx2/source/dialog/templdlg.cxx                                       |    2 
 sfx2/source/doc/objmisc.cxx                                           |    2 
 sfx2/source/view/viewfrm.cxx                                          |    4 
 solenv/CompilerTest_compilerplugins_clang.mk                          |    1 
 starmath/source/dialog.cxx                                            |    2 
 starmath/source/ooxmlimport.cxx                                       |    6 
 stoc/source/defaultregistry/defaultregistry.cxx                       |    6 
 stoc/source/implementationregistration/implreg.cxx                    |    2 
 svgio/source/svgreader/svgstyleattributes.cxx                         |    4 
 svl/source/misc/urihelper.cxx                                         |    2 
 svl/source/numbers/zforfind.cxx                                       |    2 
 svtools/source/control/inettbc.cxx                                    |    2 
 svtools/source/dialogs/PlaceEditDialog.cxx                            |    2 
 svtools/source/uno/popupmenucontrollerbase.cxx                        |    4 
 svx/source/gallery2/galmisc.cxx                                       |    4 
 svx/source/svdraw/svdotext.cxx                                        |    2 
 svx/source/xoutdev/_xoutbmp.cxx                                       |    2 
 sw/source/core/doc/docfld.cxx                                         |    2 
 sw/source/core/doc/doctxm.cxx                                         |    2 
 sw/source/core/text/xmldump.cxx                                       |    2 
 sw/source/core/tox/tox.cxx                                            |    2 
 sw/source/core/tox/txmsrt.cxx                                         |    4 
 sw/source/core/undo/undel.cxx                                         |    2 
 sw/source/core/undo/undobj.cxx                                        |    4 
 sw/source/core/unocore/unofield.cxx                                   |    2 
 sw/source/filter/ascii/wrtasc.cxx                                     |    2 
 sw/source/filter/html/htmlform.cxx                                    |    4 
 sw/source/filter/html/htmlsect.cxx                                    |    4 
 sw/source/filter/ww8/wrtw8nds.cxx                                     |    2 
 sw/source/filter/ww8/ww8atr.cxx                                       |    4 
 sw/source/filter/ww8/ww8scan.cxx                                      |    2 
 sw/source/ui/dbui/mmaddressblockpage.cxx                              |    2 
 sw/source/ui/vba/vbaoptions.cxx                                       |    2 
 sw/source/uibase/dochdl/gloshdl.cxx                                   |    2 
 sw/source/uibase/docvw/AnnotationWin2.cxx                             |    2 
 sw/source/uibase/docvw/edtwin2.cxx                                    |    2 
 sw/source/uibase/misc/glosdoc.cxx                                     |    2 
 ucb/source/ucp/file/filglob.cxx                                       |    2 
 ucb/source/ucp/hierarchy/hierarchydata.cxx                            |    8 
 ucb/source/ucp/package/pkgdatasupplier.cxx                            |    2 
 unodevtools/source/skeletonmaker/javatypemaker.cxx                    |    2 
 unodevtools/source/unodevtools/options.cxx                            |    8 
 unoidl/source/sourcetreeprovider.cxx                                  |    2 
 unotools/source/ucbhelper/tempfile.cxx                                |    2 
 unoxml/source/dom/characterdata.cxx                                   |   10 
 vcl/source/app/IconThemeInfo.cxx                                      |    2 
 vcl/source/edit/textundo.cxx                                          |    4 
 vcl/source/gdi/textlayout.cxx                                         |    2 
 vcl/source/image/ImplImageTree.cxx                                    |    4 
 vcl/source/outdev/text.cxx                                            |    4 
 vcl/source/window/builder.cxx                                         |    2 
 vcl/unx/generic/app/geninst.cxx                                       |    2 
 writerfilter/source/dmapper/SettingsTable.cxx                         |    4 
 xmlhelp/source/cxxhelp/provider/databases.cxx                         |    2 
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx                 |    2 
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx                      |    4 
 xmlhelp/source/treeview/tvread.cxx                                    |    2 
 xmloff/source/core/namespacemap.cxx                                   |    6 
 xmloff/source/draw/shapeexport.cxx                                    |    6 
 xmloff/source/draw/ximpcustomshape.cxx                                |    4 
 142 files changed, 581 insertions(+), 220 deletions(-)

New commits:
commit 93c64a61f2c84e684050294a1391cd32425b7837
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Fri Nov 6 20:01:50 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 11 11:58:37 2020 +0100

    loplugin:stringview
    
    Add new methods "subView" to O(U)String to return substring views
    of the underlying data.
    
    Add a clang plugin to warn when replacing existing calls to copy()
    would be better to use subView().
    
    Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index db7859bf181b..3816d351302c 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1678,7 +1678,7 @@ bool checkUnoObjectType(SbUnoObject& rUnoObj, const OUString& rClass)
             sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
             if( nClassNameDot >= 0 )
             {
-                aClassName += rClass.copy( 0, nClassNameDot + 1 ) + "X" + rClass.copy( nClassNameDot + 1 );
+                aClassName += OUString::Concat(rClass.subView( 0, nClassNameDot + 1 )) + "X" + rClass.subView( nClassNameDot + 1 );
             }
             else
             {
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 32c9caddcde8..1fbcdd9680e2 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1471,7 +1471,7 @@ void SbRtl_Str(StarBASIC *, SbxArray & rPar, bool)
                 {
                     iZeroSearch += 1;
                 }
-                aStrNew += aStr.copy(iZeroSearch);
+                aStrNew += aStr.subView(iZeroSearch);
             }
             else
             {
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 7bb98b648681..0c011aa93fd3 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -120,7 +120,7 @@ protected:
 
         OUString sFileName = m_sTestFileName;
         assert(sFileName.lastIndexOf('.') < sFileName.getLength());
-        sFileName = sFileName.copy(0, sFileName.lastIndexOf('.')) + ".txt";
+        sFileName = OUString::Concat(sFileName.subView(0, sFileName.lastIndexOf('.'))) + ".txt";
         if (!m_bDumpMode)
         {
             if (m_aReferenceFile.is_open())
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 0cde4e500330..2a2048c35016 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -424,7 +424,7 @@ awt::Size lcl_placeLegendEntries(
                         ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
                         for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; nNewLen--)
                         {
-                            OUString aNewLabel = aLabelString.copy(0, nNewLen) + sDots;
+                            OUString aNewLabel = aLabelString.subView(0, nNewLen) + sDots;
                             Reference<drawing::XShape> xEntry = pShapeFactory->createText(
                                 xTarget, aNewLabel, rTextProperties.first, rTextProperties.second, uno::Any());
                             nSumHeight = xEntry->getSize().Height;
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 3fdf79abe300..e29c5d5b6a13 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -1791,7 +1791,7 @@ void handleExceptionType(
         addExceptionBaseArguments(
             manager, dependencies, &desc2, code.get(), entity->getDirectBase(),
             &index3);
-        code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1));
+        code->instrInvokespecial(superClass, "<init>", OString::Concat("(Ljava/lang/Throwable;") + desc2.getDescriptor().subView(1));
     }
     sal_uInt16 maxSize2 = index3;
     if (baseRuntimeException) {
@@ -1817,7 +1817,7 @@ void handleExceptionType(
     code->instrReturn();
     code->setMaxStackAndLocals(maxSize2, index3);
     cf->addMethod(
-        ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1), code.get(),
+        ClassFile::ACC_PUBLIC, "<init>", OString::Concat("(Ljava/lang/Throwable;") + desc2.getDescriptor().subView(1), code.get(),
         std::vector< OString >(), desc2.getSignature());
 
     addTypeInfo(className, typeInfo, dependencies, cf.get());
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 6f86a56484fb..8308e9138514 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -613,7 +613,7 @@ bool OStorageHelper::PathHasSegment( const OUString& aPath, const OUString& aSeg
                 bResult = true;
         }
 
-        if ( !bResult && nPathLen > nSegLen && aPath.copy( nPathLen - nSegLen - 1, nSegLen + 1 ) == aEndSegment )
+        if ( !bResult && nPathLen > nSegLen && aPath.subView( nPathLen - nSegLen - 1, nSegLen + 1 ) == aEndSegment )
             bResult = true;
     }
 
diff --git a/compilerplugins/clang/stringview.cxx b/compilerplugins/clang/stringview.cxx
new file mode 100644
index 000000000000..530cf43d95a0
--- /dev/null
+++ b/compilerplugins/clang/stringview.cxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <unordered_map>
+#include <unordered_set>
+
+#include "plugin.hxx"
+#include "check.hxx"
+#include "clang/AST/CXXInheritance.h"
+#include "clang/AST/StmtVisitor.h"
+
+/**
+    Look for places where we are making a substring copy of an OUString, and then passing it to a
+    function that takes a u16string_view, in which case it is more efficient to pass a view
+    of the OUString, rather than making a copy.
+
+    TODO currently does not check if there is some other visible overload of the callee, that can take
+    a string_view.
+    TODO handle OUStringBuffer/OStringBuffer similarly
+*/
+
+namespace
+{
+class StringView : public loplugin::FilteringPlugin<StringView>
+{
+public:
+    explicit StringView(loplugin::InstantiationData const& data)
+        : FilteringPlugin(data)
+    {
+    }
+
+    bool preRun() override { return true; }
+
+    virtual void run() override
+    {
+        if (!preRun())
+            return;
+        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+    }
+
+    bool VisitCallExpr(CallExpr const*);
+    bool VisitCXXConstructExpr(CXXConstructExpr const*);
+    bool VisitFunctionDecl(FunctionDecl const*);
+    bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr const*);
+};
+
+bool StringView::VisitCallExpr(CallExpr const* callExpr)
+{
+    if (ignoreLocation(callExpr))
+        return true;
+
+    const FunctionDecl* functionDecl;
+    if (isa<CXXMemberCallExpr>(callExpr))
+        functionDecl = dyn_cast<CXXMemberCallExpr>(callExpr)->getMethodDecl();
+    else
+        functionDecl = callExpr->getDirectCallee();
+    if (!functionDecl)
+        return true;
+
+    unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams());
+    for (unsigned i = 0; i < len; ++i)
+    {
+        const Expr* argExpr = callExpr->getArg(i);
+        auto paramDecl = functionDecl->getParamDecl(i);
+        auto paramRecordDecl = dyn_cast_or_null<RecordDecl>(
+            paramDecl->getType()->getUnqualifiedDesugaredType()->getAsTagDecl());
+        if (!paramRecordDecl || !paramRecordDecl->getIdentifier()
+            || paramRecordDecl->getName() != "basic_string_view")
+            continue;
+        // unwrap the operator that converts to std::u16string_view
+        auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(argExpr->IgnoreImpCasts());
+        if (!memberCallExpr)
+            continue;
+        // unwrap the call to copy()
+        auto memberCallExpr2 = dyn_cast<CXXMemberCallExpr>(
+            compat::IgnoreImplicit(memberCallExpr->getImplicitObjectArgument()));
+        if (!memberCallExpr2)
+            continue;
+        auto methodDecl = memberCallExpr2->getMethodDecl();
+        if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
+            continue;
+        report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
+               compat::getBeginLoc(argExpr))
+            << argExpr->getSourceRange();
+    }
+
+    return true;
+}
+
+bool StringView::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* cxxOperatorCallExpr)
+{
+    if (ignoreLocation(cxxOperatorCallExpr))
+        return true;
+
+    auto check = [&](const Expr* expr) -> void {
+        auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(compat::IgnoreImplicit(expr));
+        if (!memberCallExpr)
+            return;
+        auto methodDecl = memberCallExpr->getMethodDecl();
+        if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
+            return;
+        report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
+               compat::getBeginLoc(expr))
+            << expr->getSourceRange();
+    };
+    auto op = cxxOperatorCallExpr->getOperator();
+    if (op == OO_Plus && cxxOperatorCallExpr->getNumArgs() == 2)
+    {
+        check(cxxOperatorCallExpr->getArg(0));
+        check(cxxOperatorCallExpr->getArg(1));
+    }
+    if (compat::isComparisonOp(cxxOperatorCallExpr))
+    {
+        check(cxxOperatorCallExpr->getArg(0));
+        check(cxxOperatorCallExpr->getArg(1));
+    }
+    else if (op == OO_PlusEqual)
+        check(cxxOperatorCallExpr->getArg(1));
+    else if (op == OO_Subscript)
+        check(cxxOperatorCallExpr->getArg(0));
+    return true;
+}
+
+bool StringView::VisitFunctionDecl(FunctionDecl const* functionDecl)
+{
+    if (ignoreLocation(functionDecl))
+        return true;
+    // debugging
+    // if (functionDecl->getIdentifier() && functionDecl->getName() == "f1")
+    //     functionDecl->dump();
+    return true;
+}
+
+bool StringView::VisitCXXConstructExpr(CXXConstructExpr const* constructExpr)
+{
+    if (ignoreLocation(constructExpr))
+        return true;
+
+    const CXXConstructorDecl* constructorDecl = constructExpr->getConstructor();
+    if (!constructorDecl)
+        return true;
+
+    unsigned len = std::min(constructExpr->getNumArgs(), constructorDecl->getNumParams());
+    for (unsigned i = 0; i < len; ++i)
+    {
+        const Expr* argExpr = constructExpr->getArg(i);
+        auto paramDecl = constructorDecl->getParamDecl(i);
+        auto paramRecordDecl = dyn_cast_or_null<RecordDecl>(
+            paramDecl->getType()->getUnqualifiedDesugaredType()->getAsTagDecl());
+        if (!paramRecordDecl || !paramRecordDecl->getIdentifier()
+            || paramRecordDecl->getName() != "basic_string_view")
+            continue;
+        // unwrap the operator that converts to std::u16string_view
+        auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(argExpr->IgnoreImpCasts());
+        if (!memberCallExpr)
+            continue;
+        // unwrap the call to copy()
+        auto memberCallExpr2 = dyn_cast<CXXMemberCallExpr>(
+            compat::IgnoreImplicit(memberCallExpr->getImplicitObjectArgument()));
+        if (!memberCallExpr2)
+            continue;
+        auto methodDecl = memberCallExpr2->getMethodDecl();
+        if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
+            continue;
+        report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
+               compat::getBeginLoc(argExpr))
+            << argExpr->getSourceRange();
+    }
+
+    return true;
+}
+
+loplugin::Plugin::Registration<StringView> stringview("stringview");
+}
+
+#endif // LO_CLANG_SHARED_PLUGINS
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/stringview.cxx b/compilerplugins/clang/test/stringview.cxx
new file mode 100644
index 000000000000..96d4927e533a
--- /dev/null
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <rtl/strbuf.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+
+void call_view(std::u16string_view) {}
+void call_view(std::string_view) {}
+struct ConstructWithView
+{
+    ConstructWithView(std::u16string_view) {}
+    ConstructWithView(std::string_view) {}
+};
+
+namespace test1
+{
+void f1(std::u16string_view s1)
+{
+    // no warning expected
+    call_view(s1);
+}
+void f1(std::string_view s1)
+{
+    // no warning expected
+    call_view(s1);
+}
+void f1(OUString s1)
+{
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    call_view(s1.copy(1, 2));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    call_view(s1.copy(1));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    ConstructWithView(s1.copy(1, 2));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    ConstructWithView(s1.copy(1));
+}
+void f1(OString s1)
+{
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    call_view(s1.copy(1, 2));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    call_view(s1.copy(1));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    ConstructWithView(s1.copy(1, 2));
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    ConstructWithView(s1.copy(1));
+}
+}
+
+namespace test2
+{
+void f3(OUString s1)
+{
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    OUString s2 = s1.copy(1, 2) + "xxx";
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    s2 = s1.copy(1) + "xxx";
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    s2 = "xxx" + s1.copy(1);
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    s2 += s1.copy(1);
+}
+void f3(OString s1)
+{
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    OString s2 = s1.copy(1, 2) + "xxx";
+    (void)s2;
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    OString s3 = s1.copy(1) + "xxx";
+    (void)s3;
+}
+}
+
+namespace test3
+{
+void f4(OUString s1, OUString s2)
+{
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    sal_Unicode x = s2.copy(1, 2)[12];
+    (void)x;
+    // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+    if (s2.copy(1, 2) < s1)
+        ;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index cf834b240923..d575ad874995 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -116,7 +116,7 @@ OUString transformUrl(const OUString& _sUrl)
         sNewUrl = "sdbc:" + sNewUrl;
     else
     {
-        sNewUrl = "jdbc:mysql://" + sNewUrl.copy(5);
+        sNewUrl = OUString::Concat("jdbc:mysql://") + sNewUrl.subView(5);
     }
     return sNewUrl;
 }
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 53a8f8fb1905..7ae8c46802e2 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -175,7 +175,7 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
     sal_Int32 nLen = url.indexOf(':');
     nLen = url.indexOf(':',nLen+2);
     OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings;
-    aDSN += url.copy(nLen+1);
+    aDSN += url.subView(nLen+1);
 
     sal_Int32 nTimeout = 20;
     bool bSilent = true;
diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx
index f57f7dc0ac87..e19173bcff4c 100644
--- a/cppu/source/uno/cascade_mapping.cxx
+++ b/cppu/source/uno/cascade_mapping.cxx
@@ -250,7 +250,7 @@ void getCascadeMapping(uno_Mapping     ** ppMapping,
                 return;
             }
 
-            uno_envDcp += rest.copy(0, index);
+            uno_envDcp += rest.subView(0, index);
         }
         else if (to_envPurpose == purpose)
         {
@@ -263,7 +263,7 @@ void getCascadeMapping(uno_Mapping     ** ppMapping,
                 return;
             }
 
-            uno_envDcp += rest.copy(0, index);
+            uno_envDcp += rest.subView(0, index);
         }
 
         uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr);
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index c67d47dc948a..32529b8e4564 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1078,7 +1078,7 @@ static uno_Environment * initDefaultEnvironment(
         if (!envPurpose.isEmpty())
         {
             OUString libStem(
-                envPurpose.copy(envPurpose.lastIndexOf(':') + 1) + "_uno_uno");
+                OUString::Concat(envPurpose.subView(envPurpose.lastIndexOf(':') + 1)) + "_uno_uno");
             if(!loadEnv(libStem, pEnv))
             {
                 pEnv->release(pEnv);
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index e5f6cc927c23..31365aa43c7b 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -98,13 +98,13 @@ static bool readOption( OUString * pValue, const char * pOpt,
     if (aArg.getLength() < aOpt.getLength())
         return false;
 
-    if (aOpt.equalsIgnoreAsciiCase( aArg.copy(1) ))
+    if (aOpt.equalsIgnoreAsciiCase( aArg.subView(1, aArg.getLength()-1) ))
     {
         // take next argument
         ++(*pnIndex);
 
         rtl_getAppCommandArg(*pnIndex, &pValue->pData);
-        if (*pnIndex >= rtl_getAppCommandArgCount() || pValue->copy(1) == dash)
+        if (*pnIndex >= rtl_getAppCommandArgCount() || pValue->subView(1) == dash)
         {
             throw RuntimeException( "incomplete option \"-" + aOpt + "\" given!" );
         }
@@ -128,7 +128,7 @@ static bool readOption( bool * pbOpt, const char * pOpt,
 {
     OUString aOpt = OUString::createFromAscii(pOpt);
 
-    if(aArg.startsWith("--") && aOpt == aArg.copy(2))
+    if(aArg.startsWith("--") && aOpt == aArg.subView(2))
     {
         ++(*pnIndex);
         *pbOpt = true;
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d638fa7ce473..87753e844bba 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3072,7 +3072,7 @@ void SvxIconSelectorDialog::ImportGraphics(
     OUStringBuffer message;
     OUString fPath;
     if (rejectedCount > 1)
-          fPath = rPaths[0].copy(8) + "/";
+          fPath = OUString::Concat(rPaths[0].subView(8)) + "/";
     for ( sal_Int32 i = 0; i < rejectedCount; ++i )
     {
         message.append(fPath).append(rejected[i]).append("\n");
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index c94f53f56b35..76b58d775cc0 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -153,7 +153,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet )
 
     if ( aURL.getBase().getLength() > 18 )
     {
-        aString += aURL.getBase().copy( 0, 15 ) + "...";
+        aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
     }
     else
         aString += aURL.getBase();
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 59c046ea6d88..f2ff5360e73b 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -153,7 +153,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
 
         if ( aURL.getBase().getLength() > 18 )
         {
-            aString += aURL.getBase().copy( 0, 15 ) + "...";
+            aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
         }
         else
             aString += aURL.getBase();
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 422d70da1814..227100915483 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -151,7 +151,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet )
 
     if( aURL.getBase().getLength() > 18 )
     {
-        aString += aURL.getBase().copy( 0, 15 ) + "...";
+        aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
     }
     else
         aString += aURL.getBase();
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx
index bd67d97deea6..89c0afc0bda1 100644
--- a/dbaccess/source/ui/control/SqlNameEdit.cxx
+++ b/dbaccess/source/ui/control/SqlNameEdit.cxx
@@ -42,12 +42,12 @@ namespace dbaui
             {
                 if ( !isCharOk( _sToCheck[i], i == 0, m_sAllowedChars ) )
                 {
-                    _rsCorrected += _sToCheck.copy(nMatch, i - nMatch);
+                    _rsCorrected += _sToCheck.subView(nMatch, i - nMatch);
                     bCorrected = true;
                     nMatch = i + 1;
                 }
             }
-            _rsCorrected += _sToCheck.copy( nMatch );
+            _rsCorrected += _sToCheck.subView( nMatch );
         }
         return bCorrected;
     }
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index bc1405b7ae19..578e164f13b7 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -675,7 +675,7 @@ OUString replaceOrigin(
     {
         //get the file name of the xcu and add it to the url of the temporary folder
         sal_Int32 i = url.lastIndexOf('/');
-        newUrl = destFolder + url.copy(i);
+        newUrl = destFolder + url.subView(i);
     }
 
     ucbhelper::Content(newUrl, xCmdEnv, xContext).writeStream(
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 42bbc65cdb4c..7f4df142dfd1 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -216,7 +216,7 @@ OUString PackageRegistryBackend::createFolder(
     const OUString baseDir(sDataFolder);
     ::utl::TempFile aTemp(&baseDir, true);
     const OUString& url = aTemp.GetURL();
-    return sDataFolder + url.copy(url.lastIndexOf('/'));
+    return sDataFolder + url.subView(url.lastIndexOf('/'));
 }
 
 //folderURL can have the extension .tmp or .tmp_
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8eacd7e270ce..9aec16e027cb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -991,7 +991,7 @@ OUString desktop::extractParameter(OUString& rOptions, const OUString& rName)
         if (nComma >= 0)
         {
             aValue = rOptions.copy(nIndex + nLen, nComma - nIndex - nLen);
-            rOptions = rOptions.copy(0, nIndex) + rOptions.copy(nComma);
+            rOptions = OUString::Concat(rOptions.subView(0, nIndex)) + rOptions.subView(nComma);
         }
         else
         {
@@ -2563,19 +2563,15 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
         if ((aIndex = aFilterOptions.indexOf(",Watermark=")) >= 0)
         {
             int bIndex = aFilterOptions.indexOf("WATERMARKEND");
-            watermarkText = aFilterOptions.copy(aIndex+11, bIndex-(aIndex+11));
-
-            OUString temp = aFilterOptions.copy(0, aIndex);
-            aFilterOptions = temp + aFilterOptions.copy(bIndex+12);
+            watermarkText = aFilterOptions.subView(aIndex+11, bIndex-(aIndex+11));
+            aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + aFilterOptions.subView(bIndex+12);
         }
 
         if ((aIndex = aFilterOptions.indexOf(",FullSheetPreview=")) >= 0)
         {
             int bIndex = aFilterOptions.indexOf("FULLSHEETPREVEND");
-            sFullSheetPreview = aFilterOptions.copy(aIndex+18, bIndex-(aIndex+18));
-
-            OUString temp = aFilterOptions.copy(0, aIndex);
-            aFilterOptions = temp + aFilterOptions.copy(bIndex+16);
+            sFullSheetPreview = aFilterOptions.subView(aIndex+18, bIndex-(aIndex+18));
+            aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + aFilterOptions.subView(bIndex+16);
         }
 
         bool bFullSheetPreview = sFullSheetPreview == "true";
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index e351d455d4c5..ab22b4abdfe2 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -735,7 +735,7 @@ void MigrationImpl::copyFiles()
                 // LANGUAGE_DONTKNOW with the "[All]" autocorrection entry.
                 // As of LibreOffice 4.0 it is 'und' for LANGUAGE_UNDETERMINED
                 // so the file name is "acor_und.dat".
-                localName = localName.copy( 0, localName.getLength() - 4) + "und.dat";
+                localName = OUString::Concat(localName.subView( 0, localName.getLength() - 4)) + "und.dat";
             }
             destName = userInstall + localName;
             INetURLObject aURL(destName);
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index d6f1301a8424..7485b9ae1bc2 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -698,7 +698,7 @@ void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
         nDepth = 0;
 
     OUString aNewStyleSheetName( pStyle->GetName() );
-    aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 ) +
+    aNewStyleSheetName = aNewStyleSheetName.subView( 0, aNewStyleSheetName.getLength()-1 ) +
         OUString::number( nDepth+1 );
     SfxStyleSheet* pNewStyle = static_cast<SfxStyleSheet*>(GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() ));
     DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx
index f9bd1df24873..09c774d3aa42 100644
--- a/extensions/source/propctrlr/newdatatype.cxx
+++ b/extensions/source/propctrlr/newdatatype.cxx
@@ -48,7 +48,7 @@ namespace pcr
             }
         }
 
-        OUString sNameBase = _rNameBase.copy( 0, nStripUntil ? nStripUntil + 1 : 0 ) + " ";
+        OUString sNameBase = OUString::Concat(_rNameBase.subView( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " ";
         OUString sInitialName;
         sal_Int32 nPostfixNumber = 1;
         do
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
index d379857c7310..079be5723c81 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -148,7 +148,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
     if (pos != -1)
     {
         OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'");
-        OUString sPatchedQuery("matchByDocumentService=" + sNewQuery.copy(7));
+        OUString sPatchedQuery(OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7));
         sNewQuery = sPatchedQuery;
     }
 
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx
index e20e407cc013..d03bf4cf702f 100644
--- a/filter/source/graphicfilter/idxf/dxfreprd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx
@@ -459,7 +459,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const
         {
             char ch = static_cast<char>(asciiNum.toUInt32());
             OUString codePt(&ch, 1, mEnc);
-            result = result.replaceAll(result.copy(pos, 5), codePt, pos);
+            result = result.replaceAll(result.subView(pos, 5), codePt, pos);
         }
         pos = result.indexOf("%%", pos + 1);
     }
@@ -473,7 +473,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const
             lcl_isHex(codePtNum[3]))
         {
             OUString codePt(static_cast<sal_Unicode>(codePtNum.toUInt32(16)));
-            result = result.replaceAll(result.copy(pos, 7), codePt, pos);
+            result = result.replaceAll(result.subView(pos, 7), codePt, pos);
         }
         pos = result.indexOf("\\U+", pos + 1);
     }
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 4614d4306aff..1d1c877c652c 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -147,10 +147,10 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
                     sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
                     if ( lastSlashIndex > -1 )
                     {
-                        bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ) == aURL;
+                        bDocNameNoPathMatch = xModel->getURL().subView( lastSlashIndex + 1 ) == aURL;
                         if ( !bDocNameNoPathMatch )
                         {
-                            OUString aTmpName = "'" + xModel->getURL().copy( lastSlashIndex + 1 ) + "'";
+                            OUString aTmpName = OUString::Concat("'") + xModel->getURL().subView( lastSlashIndex + 1 ) + "'";
                             bDocNameNoPathMatch = aTmpName == aURL;
                         }
                     }
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 8ea3be35dba9..c72a2802c7be 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -523,7 +523,7 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam)
                                 if (nBegin != -1 && nEnd != -1)
                                 {
                                     sCombinedCharacters +=
-                                        sPart.copy(nBegin+1,nEnd-nBegin-1);
+                                        sPart.subView(nBegin+1,nEnd-nBegin-1);
                                 }
                             }
                         }
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 4f804f6a7e2c..c00301bacfc3 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -538,11 +538,11 @@ void XMLFilterTestDialog::onImportBrowse()
         if( nLastIndex == -1 )
         {
 
-            aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex );
+            aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex );
         }
         else
         {
-            aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex, nLastIndex - nCurrentIndex );
+            aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex, nLastIndex - nCurrentIndex );
             nCurrentIndex = nLastIndex + 1;
             nLastIndex = nCurrentIndex;
         }
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index ea151bb9b8ff..d676cbae3e1b 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -392,7 +392,7 @@ void RemoteFilesDialog::AddFileExtension()
 
     if ( nDotPos == -1 )
     {
-        sFileName += sExt.copy( 1 ); // without '*'
+        sFileName += sExt.subView( 1 ); // without '*'
         m_xName_ed->set_text( sFileName );
     }
 }
diff --git a/fpicker/source/office/breadcrumb.cxx b/fpicker/source/office/breadcrumb.cxx
index a300a32cc1d0..d884d5b3fc8e 100644
--- a/fpicker/source/office/breadcrumb.cxx
+++ b/fpicker/source/office/breadcrumb.cxx
@@ -114,7 +114,7 @@ void Breadcrumb::SetURL( const OUString& rURL )
         }
 
         m_aSegments[i]->m_xLink->set_label( sLabel );
-        m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.copy(0, nEnd);
+        m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.subView(0, nEnd);
         m_aSegments[i]->m_xLink->hide();
         m_aSegments[i]->m_xLink->set_sensitive(true);
 
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index bfec874b9326..87e3170c8e4f 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -149,7 +149,7 @@ namespace
         if (nDotPos>=0)
         {
             if (!rExtension.isEmpty())
-                rFile = rFile.copy(0, nDotPos) + rExtension; // replace old extension with new (not empty) one
+                rFile = rFile.subView(0, nDotPos) + rExtension; // replace old extension with new (not empty) one
             else if (nDotPos)
                 rFile = rFile.copy(0, nDotPos-1); // truncate extension (new one is empty)
             else
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index 991c8af1b555..16b0fbd678cc 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -129,9 +129,9 @@ SAL_CALL PopupMenuDispatcher::queryDispatch(
                 {
                     sal_Int32 nQueryPart  = aURL.indexOf( '?', nSchemePart );
                     if ( nQueryPart > 0 )
-                        aBaseURL += aURL.copy( nSchemePart+1, nQueryPart-(nSchemePart+1) );
+                        aBaseURL += aURL.subView( nSchemePart+1, nQueryPart-(nSchemePart+1) );
                     else if ( nQueryPart == -1 )
-                        aBaseURL += aURL.copy( nSchemePart+1 );
+                        aBaseURL += aURL.subView( nSchemePart+1 );
                 }
 
                 css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx
index dfd79edde6b0..7faa6c48d8b6 100644
--- a/framework/source/fwe/xml/xmlnamespaces.cxx
+++ b/framework/source/fwe/xml/xmlnamespaces.cxx
@@ -89,7 +89,7 @@ OUString XMLNamespaces::applyNSToAttributeName( const OUString& aName ) const
             // attribute with namespace but without name "namespace:" is not allowed!!
             throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
         }
-        OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.copy( index+1);
+        OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.subView( index+1);
         return aAttributeName;
     }
 
@@ -123,7 +123,7 @@ OUString XMLNamespaces::applyNSToElementName( const OUString& aName ) const
             // attribute with namespace but without a name is not allowed (e.g. "cfg:" )
             throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
         }
-        aElementName += aName.copy( index+1 );
+        aElementName += aName.subView( index+1 );
     }
     else
         aElementName += aName;
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index f8dc874b2902..c6fec020f502 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -240,15 +240,15 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
             // Replacement for place holders
             if ( aStrValue.startsWith("($1)") )
             {
-                aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.copy( 4 );
+                aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.subView( 4 );
             }
             else if ( aStrValue.startsWith("($2)") )
             {
-                aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.copy( 4 );
+                aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.subView( 4 );
             }
             else if ( aStrValue.startsWith("($3)") )
             {
-                aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.copy( 4 );
+                aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.subView( 4 );
             }
             m_xToolbar->SetItemText( m_nID, aStrValue );
             // tdf#124267 strip mnemonic from tooltip
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index cff2f23a2178..f9bd9f2312ba 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -331,15 +331,15 @@ void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event )
                         // Replacement for place holders
                         if ( aItemText.startsWith("($1)") )
                         {
-                            aItemText = FwkResId(STR_UPDATEDOC) + " " + aItemText.copy( 4 );
+                            aItemText = FwkResId(STR_UPDATEDOC) + " " + aItemText.subView( 4 );
                         }
                         else if ( aItemText.startsWith("($2)") )
                         {
-                            aItemText = FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.copy( 4 );
+                            aItemText = FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.subView( 4 );
                         }
                         else if ( aItemText.startsWith("($3)") )
                         {
-                            aItemText = FwkResId(STR_SAVECOPYDOC) + aItemText.copy( 4 );
+                            aItemText = FwkResId(STR_SAVECOPYDOC) + aItemText.subView( 4 );
                         }
 
                         m_pVCLMenu->SetItemText( menuItemHandler->nItemId, aItemText );
@@ -1506,9 +1506,9 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController
                 OUString aMainURL( "vnd.sun.star.popup:" );
                 sal_Int32 nQueryPart  = aMenuURL.indexOf( '?', nSchemePart );
                 if ( nQueryPart > 0 )
-                    aMainURL += aMenuURL.copy( nSchemePart, nQueryPart-nSchemePart );
+                    aMainURL += aMenuURL.subView( nSchemePart, nQueryPart-nSchemePart );
                 else if ( nQueryPart == -1 )
-                    aMainURL += aMenuURL.copy( nSchemePart+1 );
+                    aMainURL += aMenuURL.subView( nSchemePart+1 );
 
                 rPopupController.emplace( aMainURL, aPopupControllerEntry );
             }
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 0c52a2b3cf45..ab9e33019428 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1957,7 +1957,7 @@ OUString LanguageTag::getGlibcLocaleString( const OUString & rEncoding ) const
         aRet = getImpl()->getGlibcLocaleString();
         sal_Int32 nAt = aRet.indexOf('@');
         if (nAt != -1)
-            aRet = aRet.copy(0, nAt) + rEncoding + aRet.copy(nAt);
+            aRet = aRet.subView(0, nAt) + rEncoding + aRet.subView(nAt);
         else
             aRet += rEncoding;
     }
diff --git a/i18npool/source/indexentry/genindex_data.cxx b/i18npool/source/indexentry/genindex_data.cxx
index 36e17bb19d4d..a4bca51839ab 100644
--- a/i18npool/source/indexentry/genindex_data.cxx
+++ b/i18npool/source/indexentry/genindex_data.cxx
@@ -73,7 +73,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             printf("Code point 0x%lx exceeds MAX_ADDRESS 0x%x, Please increase MAX_ADDRESS", static_cast<long unsigned int>(nChar), MAX_ADDRESS);
             exit(1);
         }
-        OUString key=Ostr.copy(nPos)+sep;
+        OUString key=Ostr.subView(nPos)+sep;
         sal_Int32 idx = result.indexOf(key);
         if (key.getLength() > max) max=key.getLength();
         if (idx >= 0) {
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index b36cfd7b0925..dbd3f77b7b4c 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -622,7 +622,7 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
     }
     OUString sResult = rItem;
     if (i != 0 && i < len)
-        sResult += rNumberString.copy(i);
+        sResult += rNumberString.subView(i);
     return sResult;
 }
 }
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index be78e199c412..4d229fd86931 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -1393,6 +1393,46 @@ public:
         return OString( pNew, SAL_NO_ACQUIRE );
     }
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+      Returns a std::string_view that is a view of a substring of this string.
+
+      The substring begins at the specified beginIndex. If
+      beginIndex is negative or be greater than the length of
+      this string, behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @return    the specified substring.
+    */
+    SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const
+    {
+        assert(beginIndex >= 0);
+        assert(beginIndex <= getLength());
+        return subView(beginIndex, getLength() - beginIndex);
+    }
+
+    /**
+      Returns a std::string_view that is a view of a substring of this string.
+
+      The substring begins at the specified beginIndex and contains count
+      characters.  If either beginIndex or count are negative,
+      or beginIndex + count are greater than the length of this string
+      then behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @param     count        the number of characters.
+      @return    the specified substring.
+    */
+    SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
+    {
+        assert(beginIndex >= 0);
+        assert(count >= 0);
+        assert(beginIndex <= getLength());
+        assert(count <= getLength() - beginIndex);
+        return std::string_view(*this).substr(beginIndex, count);
+    }
+#endif
+
 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
     /**
       Concatenates the specified string to the end of this string.
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index f3006847de1e..48aca3243383 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -2300,6 +2300,46 @@ public:
         return OUString( pNew, SAL_NO_ACQUIRE );
     }
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+      Returns a std::u16string_view that is a view of a substring of this string.
+
+      The substring begins at the specified beginIndex. If
+      beginIndex is negative or be greater than the length of
+      this string, behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @return    the specified substring.
+    */
+    SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
+    {
+        assert(beginIndex >= 0);
+        assert(beginIndex <= getLength());
+        return subView(beginIndex, getLength() - beginIndex);
+    }
+
+    /**
+      Returns a std::u16string_view that is a view of a substring of this string.
+
+      The substring begins at the specified beginIndex and contains count
+      characters.  If either beginIndex or count are negative,
+      or beginIndex + count are greater than the length of this string
+      then behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @param     count        the number of characters.
+      @return    the specified substring.
+    */
+    SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
+    {
+        assert(beginIndex >= 0);
+        assert(count >= 0);
+        assert(beginIndex <= getLength());
+        assert(count <= getLength() - beginIndex);
+        return std::u16string_view(*this).substr(beginIndex, count);
+    }
+#endif
+
 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
     /**
       Concatenates the specified string to the end of this string.
diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx
index 3bfacb823025..b5f622b5c6ea 100644
--- a/l10ntools/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -93,7 +93,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                     HelpParser aParser( sXhpFile );
                     const OString sOutput(
                         aArgs.m_sOutputFile +
-                        sXhpFile.copy( sXhpFile.lastIndexOf('/') ));
+                        sXhpFile.subView( sXhpFile.lastIndexOf('/') ));
                     if( !aParser.Merge( sOutput,
                         aArgs.m_sLanguage, pMergeDataFile.get() ))
                     {
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 10a9de923175..c4643ea4fac4 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -233,7 +233,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
             pEntrys->GetText( sNewText, sCur, true );
             if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText)))
             {
-                sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText;
+                sNewdata = sSourceText.subView(0,nPreSpaces) + sNewText;
             }
         }
     }
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index e069ba6f5a5c..402403a8e5ea 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -381,7 +381,7 @@ void handleDirectory(
         if (aProject == "include" && nLevel > 1)
         {
             aProject = aPotDir.copy(aPotDir.lastIndexOf('/') + 1);
-            aPotDir = aPotDir.copy(0, aPotDir.lastIndexOf("include")) + aProject + "/messages";
+            aPotDir = aPotDir.subView(0, aPotDir.lastIndexOf("include")) + aProject + "/messages";
         }
         if (aProject != "include")
         {
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index 4df1e1782d63..3d001f28e3f4 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -219,7 +219,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
         {
             // assume there are no more than 10 plural forms...
             // and that plural strings are never split to multi-line in po
-            m_sMsgStrPlural.push_back(sLine.copy(0,10) + lcl_GenNormString(sLine.copy(10)));
+            m_sMsgStrPlural.push_back(sLine.subView(0,10) + lcl_GenNormString(sLine.copy(10)));
         }
         else if (sLine.startsWith("\"") && pLastMsg)
         {
diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx
index 933edb79fad1..2920734eea4d 100644
--- a/l10ntools/source/treemerge.cxx
+++ b/l10ntools/source/treemerge.cxx
@@ -72,9 +72,9 @@ namespace
         // Update id attribute of topic
         {
             OString sNewID =
-                sID.copy( 0, nFirstSlash + 1 ) +
-                rXhpRoot.copy( rXhpRoot.lastIndexOf('/') + 1 ) +
-                sID.copy( sID.indexOf( '/', nFirstSlash + 1 ) );
+                OString::Concat(sID.subView( 0, nFirstSlash + 1 )) +
+                rXhpRoot.subView( rXhpRoot.lastIndexOf('/') + 1 ) +
+                sID.subView( sID.indexOf( '/', nFirstSlash + 1 ) );
             xmlSetProp(
                 pReturn, reinterpret_cast<const xmlChar*>("id"),
                 reinterpret_cast<const xmlChar*>(sNewID.getStr()));
@@ -82,7 +82,7 @@ namespace
 
         const OString sXhpPath =
             rXhpRoot +
-            sID.copy(sID.indexOf('/', nFirstSlash + 1));
+            sID.subView(sID.indexOf('/', nFirstSlash + 1));
         xmlDocPtr pXhpFile = xmlParseFile( sXhpPath.getStr() );
         // if xhpfile is missing than put this topic into comment
         if ( !pXhpFile )
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index b77e0138edb1..62734f04ddd9 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -422,7 +422,7 @@ void XRMResMerge::WorkOnDesc(
                         throw false; //TODO
                     }
                     OString sOutputDescFile(
-                        sOutputFile.copy(0, i + 1) + sLocDescFilename);
+                        sOutputFile.subView(0, i + 1) + sLocDescFilename);
                     ofstream file(sOutputDescFile.getStr());
                     if (file.is_open()) {
                         file << sText;
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 2c9bfb196917..79bd0b51ae4a 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -350,7 +350,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
                     if (catpos > 2)
                     {
                         // remove category name for affixation and casing
-                        catst = " " + sTerm.copy(catpos);
+                        catst = OUString::Concat(" ") + sTerm.subView(catpos);
                         sTerm = sTerm.copy(0, catpos);
                         sTerm = sTerm.trim();
                     }
@@ -429,15 +429,15 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
         sal_Int32 pos = aRTerm.lastIndexOf(' ');
         if (!pos)
             return noMeanings;
-        xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
-            aRTerm.copy(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
+        xTmpRes = xSpell->spell( OUString::Concat("<?xml?><query type='stem'><word>") +
+            aRTerm.subView(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
         if (xTmpRes.is())
         {
             Sequence<OUString>seq = xTmpRes->getAlternatives();
             if (seq.hasElements())
             {
                 aPTerm = aRTerm.copy(pos + 1);
-                aRTerm = aRTerm.copy(0, pos + 1) + seq[0];
+                aRTerm = aRTerm.subView(0, pos + 1) + seq[0];
 #if  0
                 for (int i = 0; i < seq.getLength(); i++)
                 {
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 001a028c708b..202f79548d96 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -450,9 +450,9 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
         pStream->WriteLine("type: negative");
     if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT))
     {
-        pStream->WriteLine(OUStringToOString("title: " +
+        pStream->WriteLine(OUStringToOString(OUString::Concat("title: ") +
             // strip EXTENSION_FOR_TITLE_TEXT
-            aDicName.copy(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), eEnc));
+            aDicName.subView(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), eEnc));
     }
     if (ERRCODE_NONE != (nErr = pStream->GetError()))
         return nErr;
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index cabd522b962d..3e90a66158db 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -293,7 +293,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
         aUrl.match( aFilePrefix ) &&
         aUrl.match( aUncPrefix, nFilePrefixLen ) )
     {
-        return aFileSchema + aUrl.copy( nFilePrefixLen );
+        return aFileSchema + aUrl.subView( nFilePrefixLen );
     }
 
     /*  (5) handle URLs relative to current drive, e.g. the URL '/path1/file1'
@@ -303,7 +303,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
         mxImpl->maFileUrl.match( aFilePrefix ) &&
         lclIsDosDrive( mxImpl->maFileUrl, nFilePrefixLen ) )
     {
-        return mxImpl->maFileUrl.copy( 0, nFilePrefixLen + 3 ) + aUrl.copy( 1 );
+        return OUString::Concat(mxImpl->maFileUrl.subView( 0, nFilePrefixLen + 3 )) + aUrl.subView( 1 );
     }
 
     try
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 1eb6fddaf1b6..566e1c4a2909 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -392,7 +392,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan
             OUString sLowerCaseFileName = fileName.toAsciiLowerCase();
             if ( fileName != sLowerCaseFileName )
             {
-                aFragmentPath = aFragmentPath.copy(0, nPathLen) + sLowerCaseFileName;
+                aFragmentPath = aFragmentPath.subView(0, nPathLen) + sLowerCaseFileName;
                 xInStrm = openInputStream(aFragmentPath);
             }
         }
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index aac2af5ff1eb..d553dd092ff7 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -2380,7 +2380,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm )
         {
             while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos;
             if( nPos < aElem.getLength() )
-                aElem = aElem.copy( 0, nPos ) + OUStringChar(' ') + aElem.copy( nPos ).trim();
+                aElem = aElem.subView( 0, nPos ) + OUStringChar(' ') + aElem.copy( nPos ).trim();
             ++nPos;
         }
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d8615d79300e..8a8a8b83fb35 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4863,7 +4863,7 @@ void DrawingML::writeDiagramRels(const uno::Sequence<uno::Sequence<uno::Any>>& x
         if (sExtension.equalsIgnoreAsciiCase(".WMF"))
             sContentType = "image/x-wmf";
         else
-            sContentType = "image/" + sExtension.copy(1);
+            sContentType = OUString::Concat("image/") + sExtension.subView(1);
         sRelId = sRelId.copy(3);
 
         StreamDataSequence dataSeq;
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index b813c165d46e..5e1afc0e345f 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -133,8 +133,8 @@ bool OZipFileAccess::StringGoodForPattern_Impl( const OUString& aString,
     sal_Int32 nBeginInd = aPattern[0].getLength();
     sal_Int32 nEndInd = aString.getLength() - aPattern[nInd].getLength();
     if ( nEndInd >= nBeginInd
-      && ( nEndInd == aString.getLength() || aString.copy( nEndInd ) == aPattern[nInd] )
-      && ( nBeginInd == 0 || aString.copy( 0, nBeginInd ) == aPattern[0] ) )
+      && ( nEndInd == aString.getLength() || aString.subView( nEndInd ) == aPattern[nInd] )
+      && ( nBeginInd == 0 || aString.subView( 0, nBeginInd ) == aPattern[0] ) )
     {
         for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- )
         {
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 13b9d4251802..27a4592c9dc2 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -766,12 +766,12 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
 
     if (lastIndex >= 0)
     {
-        sRelativKey += keyName.copy(lastIndex + 1);
+        sRelativKey += keyName.subView(lastIndex + 1);
 
         if (sFullKeyName.getLength() > 1)
             sFullKeyName += keyName;
         else
-            sFullKeyName += keyName.copy(1);
+            sFullKeyName += keyName.subView(1);
 
         sFullPath = sFullKeyName.copy(0, keyName.lastIndexOf('/') + 1);
     } else
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index 416e3e1e0974..31bfb04f08e9 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -63,7 +63,7 @@ static void lcl_correctCellAddress(const OUString & _sName, const uno::Reference
     const sal_Int32 nPos = sCellAddress.lastIndexOf('$');
     if ( nPos != -1 )
     {
-        sCellAddress = sCellAddress.copy(0,nPos) + "$65535";
+        sCellAddress = OUString::Concat(sCellAddress.subView(0,nPos)) + "$65535";
         pList->RemoveAttribute(_sName);
         pList->AddAttribute(_sName,sCellAddress);
     }
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 019d3b5c4746..4d81c4140a17 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -1090,7 +1090,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
             {
                 OUString sFormula = aDlg.getCurrentFormula();
                 if ( sFormula[0] == '=' )
-                    _in_out_rFormula = "rpt:" + sFormula.copy(1);
+                    _in_out_rFormula = OUString::Concat("rpt:") + sFormula.subView(1);
                 else
                     _in_out_rFormula = "rpt:" + sFormula;
             }
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 4555a0d83394..58510e3a1e08 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -73,7 +73,7 @@ static OUString getExecutablePath()
     osl::Module::getUrlFromAddress(
         reinterpret_cast<oslGenericFunction>(&getExecutablePath), dirPath);
     dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') );
-    dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1) +
+    dirPath = OUString::Concat(dirPath.subView( 0, dirPath.lastIndexOf('/') + 1)) +
         "Executable";
     return dirPath;
 }
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
index eae3cd5c3abb..5c19760b2313 100644
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ b/sal/qa/rtl/process/rtl_Process.cxx
@@ -57,7 +57,7 @@ static OUString getModulePath()
 
     printUString(suDirPath, "modulePath:");
     suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
-    suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1) + "bin";
+    suDirPath = OUString::Concat(suDirPath.subView( 0, suDirPath.lastIndexOf('/') + 1)) + "bin";
     return suDirPath;
 }
 
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index a70627e7a798..1ae4a0320a47 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -108,7 +108,7 @@ OUString TestDocumentHandler::canonicalform(const OUString &sName, const OUStrin
         if ( nIndex >= 0 )
         {
             OUString sNamespace = getNamespace( sName.copy( 0, nIndex ) );
-            return sNamespace + sName.copy(nIndex);
+            return sNamespace + sName.subView(nIndex);
         }
         else
         {
@@ -231,7 +231,7 @@ OUString resolveNamespace( const OUString& aName )
         if ( aName.getLength() > index + 1 )
         {
             OUString aAttributeName = getNamespaceValue( aName.copy( 0, index ) ) +
-                ":" + aName.copy( index + 1 );
+                ":" + aName.subView( index + 1 );
             return aAttributeName;
         }
     }
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index d51f471b43a1..e7f21da8e658 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1485,7 +1485,7 @@ static bool NormalizeW3URI( OUString& rName )
     {
         const OUString& sURISuffix = XML_URI_XFORMS_SUFFIX ;
         sal_Int32 nCompareFrom = rName.getLength() - sURISuffix.getLength();
-        if( rName.copy( nCompareFrom ) == sURISuffix )
+        if( rName.subView( nCompareFrom ) == sURISuffix )
         {
             // found W3 prefix, and xforms suffix
             rName = XML_N_XFORMS_1_0;
@@ -1568,9 +1568,9 @@ static bool NormalizeOasisURN( OUString& rName )
 
     // replace [tcid] with current TCID and version with current version.
 
-    rName = rName.copy( 0, nTCIdStart ) +
+    rName = rName.subView( 0, nTCIdStart ) +
             XML_OPENDOCUMENT +
-            rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) +
+            rName.subView( nTCIdEnd, nVersionStart-nTCIdEnd ) +
             XML_1_0;
 
     return true;
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a12e69ebad07..92083e2a2cd1 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -181,7 +181,7 @@ OUString LimitedString( const OUString& str )
     if( str.getLength() < 20 )
         return "\"" + str + "\"";
     else
-        return "\"" + str.copy( 0, 20 ) + "\"...";
+        return OUString::Concat("\"") + str.subView( 0, 20 ) + "\"...";
 }
 
 // Returns formatted contents of the data (possibly shortened), to be used in debug output.
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 132686ca4a91..52e07726daa1 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3402,7 +3402,7 @@ void ScInterpreter::ScNumberValue()
             aTemporary = aTemporary.replaceAll( OUString( &nChar, 1 ), "" );
         }
         if ( nDecSep >= 0 )
-            aInputString = aTemporary + aInputString.copy( nDecSep );
+            aInputString = aTemporary + aInputString.subView( nDecSep );
         else
             aInputString = aTemporary;
     }
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index eb6737f34879..dfcdb30875ee 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -53,7 +53,7 @@ bool ScRangeUtil::MakeArea( const OUString&   rAreaStr,
 
     if ( nColonPos == -1  && nPointPos != -1 )
     {
-        aStrArea += ":" + rAreaStr.copy( nPointPos+1 ); // do not include '.' in copy
+        aStrArea += OUString::Concat(":") + rAreaStr.subView( nPointPos+1 ); // do not include '.' in copy
     }
 
     bSuccess = ConvertDoubleRef( rDoc, aStrArea, nTab, startPos, endPos, rDetails );
diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index 9702da631d47..e442be66ca75 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -324,9 +324,9 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
         nLoopStart = nEEnd;
     }
 
-    OUString aTotal = maFormula.copy(0, nStartPos) + aResult.makeStringAndClear();
+    OUString aTotal = maFormula.subView(0, nStartPos) + aResult.makeStringAndClear();
     if (nEndPos < maFormula.getLength()-1)
-        aTotal += maFormula.copy(nEndPos+1);
+        aTotal += maFormula.subView(nEndPos+1);
 
     maFormula = aTotal;
 }
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 7f434dd44fc4..476c8a0bdf8d 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1179,7 +1179,7 @@ void XclExpXmlStream::validateTabNames(std::vector<OUString>& aOriginalTabNames)
 
                 for (int i=rangeStart; i<rangeEnd && aNewName.isEmpty(); i++)
                 {
-                    aNewName = rOriginalName.copy(0, MAX_TAB_NAME_LENGTH - 1 - digits) + "-" + OUString::number(i);
+                    aNewName = OUString::Concat(rOriginalName.subView(0, MAX_TAB_NAME_LENGTH - 1 - digits)) + "-" + OUString::number(i);
                     if (aNewTabNames.end() != std::find(aNewTabNames.begin(), aNewTabNames.end(), aNewName) ||
                         aOriginalTabNames.end() != std::find(aOriginalTabNames.begin(), aOriginalTabNames.end(), aNewName))
                     {
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 6763ecf081d0..6068fd901905 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1376,7 +1376,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
         // an error formula cell.
         if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
                 ((nError =
-                  GetScImport().GetFormulaErrorConstant( "#ERR" + aText.copy(4) + "!")) != FormulaError::NONE))
+                  GetScImport().GetFormulaErrorConstant( OUString::Concat("#ERR") + aText.subView(4) + "!")) != FormulaError::NONE))
         {
             pCode->SetCodeError(nError);
         }
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 7d17b6e0526f..7027f8317535 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1642,7 +1642,7 @@ void ScInputHandler::PasteFunctionData()
         const ScTypedStrData& rData = *miAutoPosFormula;
         OUString aInsert = rData.GetString();
         if (aInsert[aInsert.getLength()-1] == cParenthesesReplacement)
-            aInsert = aInsert.copy( 0, aInsert.getLength()-1) + "()";
+            aInsert = OUString::Concat(aInsert.subView( 0, aInsert.getLength()-1)) + "()";
         bool bParInserted = false;
 
         DataChanging(); // Cannot be new
@@ -1792,7 +1792,7 @@ void ScInputHandler::PasteManualTip()
     //  FIXME: Once we have matrix constants, we can change this
     sal_Int32 nTipLen = aManualTip.getLength();
     sal_uInt32 const nTipLen2(sal::static_int_cast<sal_uInt32>(nTipLen));
-    if ( nTipLen && ( nTipLen < 3 || aManualTip.copy( nTipLen2-3 ) != "..." ) )
+    if ( nTipLen && ( nTipLen < 3 || aManualTip.subView( nTipLen2-3 ) != u"..." ) )
     {
         DataChanging(); // Cannot be new
 
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index e737373cae7b..8b09e45b3ba8 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1187,7 +1187,7 @@ static bool lcl_PutString(
                 if (nFound > 6)
                 {
                     sal_Unicode cDec = '.';
-                    OUString aT = OUStringChar(cDec) + rStr.copy( nStart[6], nEnd[6]+1-nStart[6]);
+                    OUString aT = OUStringChar(cDec) + rStr.subView( nStart[6], nEnd[6]+1-nStart[6]);
                     rtl_math_ConversionStatus eStatus;
                     double fV = rtl::math::stringToDouble( aT, cDec, 0, &eStatus );
                     if (eStatus == rtl_math_ConversionStatus_Ok)
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 1b12103737c8..31fce4ea8bb8 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1507,10 +1507,10 @@ void ScContentTree::SelectDoc(const OUString& rName)      // rName like shown in
     OUString aRealName = rName;
     sal_Int32 nLen = rName.getLength();
     sal_Int32 nActiveStart = nLen - pParentWindow->aStrActive.getLength();
-    if ( rName.copy( nActiveStart ) == pParentWindow->aStrActive )
+    if ( rName.subView( nActiveStart ) == pParentWindow->aStrActive )
         aRealName = rName.copy( 0, nActiveStart );
     sal_Int32 nNotActiveStart = nLen - pParentWindow->aStrNotActive.getLength();
-    if ( rName.copy( nNotActiveStart ) == pParentWindow->aStrNotActive )
+    if ( rName.subView( nNotActiveStart ) == pParentWindow->aStrNotActive )
         aRealName = rName.copy( 0, nNotActiveStart );
 
     bool bLoaded = false;
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 7cc6a90a0696..fd4de83c3ce2 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -2058,7 +2058,7 @@ sal_Int16 ConvertData::GetMatchingLevel( const OUString& rRef ) const
     sal_Int32 nLen = rRef.getLength();
     sal_Int32 nIndex = rRef.lastIndexOf( '^' );
     if( nIndex > 0 && nIndex  == ( nLen - 2 ) )
-        aStr = aStr.copy( 0, nLen - 2 ) + OUStringChar( aStr[ nLen - 1 ] );
+        aStr = aStr.subView( 0, nLen - 2 ) + OUStringChar( aStr[ nLen - 1 ] );
     if( aName == aStr )
         return 0;
     else
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index b91ffc3c3a31..43b5851c225a 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -512,10 +512,10 @@ namespace dlgprov
         sal_Int32 nIndex = sScriptCode.indexOf( ':' );
         if ( nIndex >= 0 && nIndex < sScriptCode.getLength() )
         {
-            sScriptURL = "vnd.sun.star.script:" +
-                sScriptCode.copy( nIndex + 1 ) +
+            sScriptURL = OUString::Concat("vnd.sun.star.script:") +
+                sScriptCode.subView( nIndex + 1 ) +
                 "?language=Basic&location=" +
-                sScriptCode.copy( 0, nIndex );
+                sScriptCode.subView( 0, nIndex );
         }
         ScriptEvent aSFScriptEvent( aScriptEvent );
         aSFScriptEvent.ScriptCode = sScriptURL;
@@ -612,9 +612,9 @@ namespace dlgprov
             sal_Int32 nIndex = aRes.indexOf( '%' );
 
             OUString aOUFinal =
-                aRes.copy( 0, nIndex ) +
+                aRes.subView( 0, nIndex ) +
                 aQuoteChar + aMethodName + aQuoteChar +
-                aRes.copy( nIndex + 2 );
+                aRes.subView( nIndex + 2 );
 
             std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
                                                       VclMessageType::Warning, VclButtonsType::Ok, aOUFinal));
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 8d6b3976cada..60fd4b939de3 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1527,7 +1527,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                     if(aOriginalNewLayoutName != aTargetNewLayoutName)
                     {
                         const sal_Int32 nPos(aName.indexOf(SD_LT_SEPARATOR));
-                        aName = aTargetNewLayoutName + aName.copy(nPos);
+                        aName = aTargetNewLayoutName + aName.subView(nPos);
                     }
 
                     SfxStyleSheet* pMySheet = static_cast<SfxStyleSheet*>( mxStyleSheetPool->Find(aName, SfxStyleFamily::Page) );
@@ -1568,7 +1568,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                     // this new style
                     OUString aTemp(pMySheet->GetName());
                     const sal_Int32 nPos(aTemp.indexOf(SD_LT_SEPARATOR));
-                    aTemp = aOldLayoutName + aTemp.copy(nPos);
+                    aTemp = aOldLayoutName + aTemp.subView(nPos);
                     aReplData.aName = aTemp;
                     aReplList.push_back(aReplData);
                 }
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index 27870ec4bb43..6907389968d7 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -569,7 +569,7 @@ bool PPTWriterBase::GetStyleSheets()
                                                 if ( nInstance == EPP_TEXTTYPE_Body )
                                                 {
                                                     sal_Unicode cTemp = aStyle[aStyle.getLength() - 1];
-                                                    aStyle = aStyle.copy(0, aStyle.getLength() - 1) + OUStringChar(++cTemp);
+                                                    aStyle = aStyle.subView(0, aStyle.getLength() - 1) + OUStringChar(++cTemp);
                                                     if ( aXFamily->hasByName( aStyle ) )
                                                     {
                                                         aXFamily->getByName( aStyle ) >>= xStyle;
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index c18e8c117e61..dc0ad6b7f287 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -212,7 +212,7 @@ void SdCustomShowDlg::SelectHdl(void const *p)
                     const CharClass* pCharClass = rDoc.GetCharClass();
                     while( pCharClass->isDigit( aStr, nStrPos ) )
                         aStr = aStr.replaceAt( nStrPos, 1, "" );
-                    aStr = aStr.copy( 0, nStrPos) + OUString::number( ++nNum ) + aStr.copy( nStrPos);
+                    aStr = aStr.subView( 0, nStrPos) + OUString::number( ++nNum ) + aStr.subView( nStrPos);
                 }
 
             }
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index e4eb8b3eda5f..7bf915055b4b 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -316,7 +316,7 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
         ***********************************************/
         OUString aName( pPage->GetLayoutName() );
         sal_Int32 n = aName.indexOf(SD_LT_SEPARATOR) + strlen(SD_LT_SEPARATOR);
-        aName = aName.copy(0, n) + STR_LAYOUT_BACKGROUNDOBJECTS;
+        aName = OUString::Concat(aName.subView(0, n)) + STR_LAYOUT_BACKGROUNDOBJECTS;
         SfxStyleSheet* pSheet(
             static_cast< SfxStyleSheet* >(
                 pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page)));
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 08684ae41a5a..028168b6a8e5 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -632,7 +632,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
             {
                 rDocliner.Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth );
                 OUString aStyleSheetName( pStyleSheet->GetName() );
-                aStyleSheetName = aStyleSheetName.copy( 0, aStyleSheetName.getLength()-1 ) +
+                aStyleSheetName = aStyleSheetName.subView( 0, aStyleSheetName.getLength()-1 ) +
                     OUString::number( nDepth <= 0 ? 1 : nDepth+1 );
                 SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool();
                 SfxStyleSheet* pOutlStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 29ba9c20ee34..0ea67fbd7bcb 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2131,7 +2131,7 @@ OUString getPageApiNameFromUiName( const OUString& rUIName )
 
     if( rUIName.startsWith( aDefPageName ) )
     {
-        aApiName = sEmptyPageName + rUIName.copy( aDefPageName.getLength() );
+        aApiName = OUString::Concat(sEmptyPageName) + rUIName.subView( aDefPageName.getLength() );
     }
     else
     {
@@ -2839,7 +2839,7 @@ void SdMasterPage::setBackground( const Any& rValue )
             if(pSSPool)
             {
                 OUString aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
-                aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
+                aLayoutName = OUString::Concat(aLayoutName.subView(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4)) +
                     STR_LAYOUT_BACKGROUND;
                 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
 
@@ -2885,7 +2885,7 @@ void SdMasterPage::getBackground( Any& rValue )
             if(pSSPool)
             {
                 OUString aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
-                aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
+                aLayoutName = OUString::Concat(aLayoutName.subView(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4)) +
                     STR_LAYOUT_BACKGROUND;
                 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
 
diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx
index 9762b7cd76cd..e87cb442df25 100644
--- a/sdext/source/presenter/PresenterSlideSorter.cxx
+++ b/sdext/source/presenter/PresenterSlideSorter.cxx
@@ -1610,7 +1610,7 @@ OUString PresenterSlideSorter::MouseOverManager::GetFittingText (
         const OUString sEllipses ("...");
         while (true)
         {
-            const OUString sCandidate (rsText.copy(0,nLength) + sEllipses);
+            const OUString sCandidate (rsText.subView(0,nLength) + sEllipses);
             const double nWidth (
                 PresenterCanvasHelper::GetTextSize(mpFont->mxFont, sCandidate).Width);
             if (nWidth > nMaximalWidth)
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index d44927415ed1..d6190e604c78 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -517,7 +517,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
             OUString sURL(officecfg::Office::Common::Menus::SendFeedbackURL::get() + //officecfg/registry/data/org/openoffice/Office/Common.xcu => https://hub.libreoffice.org/send-feedback/
                 "?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
                 "&LOlocale=" + utl::ConfigManager::getUILocale() +
-                "&LOmodule=" + module.copy(module.lastIndexOf('.') + 1 )  );
+                "&LOmodule=" + module.subView(module.lastIndexOf('.') + 1 )  );
             sfx2::openUriExternally(sURL, false);
             break;
         }
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 9cd627dd1f0c..06bb3fc5e454 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -707,7 +707,7 @@ static bool impl_showOnlineHelp( const OUString& rURL )
         return false;
 
     OUString aHelpLink = officecfg::Office::Common::Help::HelpRootURL::get();
-    OUString aTarget = "Target=" + rURL.copy(aInternal.getLength());
+    OUString aTarget = OUString::Concat("Target=") + rURL.subView(aInternal.getLength());
     aTarget = aTarget.replaceAll("%2F", "/").replaceAll("?", "&");
     aHelpLink += aTarget;
 
@@ -888,8 +888,8 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
                         << "\" doesn't contain files segment");
                 throw Failure();
             }
-            path = path.copy(0, i1) + "/runtime/org.libreoffice.LibreOffice.Help/"
-                + path.copy(i2, i3 - i2) + sha + path.copy(i4);
+            path = path.subView(0, i1) + OUString::Concat("/runtime/org.libreoffice.LibreOffice.Help/")
+                + path.subView(i2, i3 - i2) + sha + path.subView(i4);
             // Turn <path> into a file URL:
             OUString url_;
             err = osl::FileBase::getFileURLFromSystemPath(path, url_);
@@ -930,7 +930,7 @@ static bool impl_showOfflineHelp( const OUString& rURL )
     }
 
     OUString aHelpLink( aBaseInstallPath + "/index.html?" );
-    OUString aTarget = "Target=" + rURL.copy(RTL_CONSTASCII_LENGTH("vnd.sun.star.help://"));
+    OUString aTarget = OUString::Concat("Target=") + rURL.subView(RTL_CONSTASCII_LENGTH("vnd.sun.star.help://"));
     aTarget = aTarget.replaceAll("%2F","/").replaceAll("?","&");
     aHelpLink += aTarget;
 
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index e858bb9f0834..3e6a083a98ee 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -248,7 +248,7 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai
                 --nLength;
             }
 
-            aText = aText.copy(0, nLineStart+nLength) + "...";
+            aText = OUString::Concat(aText.subView(0, nLineStart+nLength)) + "...";
             nLineLength = nLength + 3;
         }
 
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index a23b4d904dd5..d9577bc852e3 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -256,7 +256,7 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, QueryTooltipHdl, const weld::TreeIter&,
             const sal_Int32 nMaxLen = 80;
             if (sUsedBy.getLength() > nMaxLen)
             {
-                sUsedBy = sUsedBy.copy(0, nMaxLen) + "...";
+                sUsedBy = OUString::Concat(sUsedBy.subView(0, nMaxLen)) + "...";
             }
 
             OUString aMessage = SfxResId(STR_STYLEUSEDBY);
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 6ca2de78fd8f..10be78bfe98d 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -798,7 +798,7 @@ OUString SfxObjectShell::GetTitle( sal_uInt16  nMaxLength ) const
         {
             const OUString aComplete( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
             if( aComplete.getLength() > nMaxLength )
-                return "..." + aComplete.copy( aComplete.getLength() - nMaxLength + 3, nMaxLength - 3 );
+                return OUString::Concat("...") + aComplete.subView( aComplete.getLength() - nMaxLength + 3, nMaxLength - 3 );
             return aComplete;
         }
         if ( nMaxLength == SFX_TITLE_FILENAME )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3076c58ea033..d525fa400859 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2600,7 +2600,7 @@ static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
         else
             nEndPos++;
 
-        rStr = rStr.copy( 0, nStartPos ) + rStr.copy( nEndPos );
+        rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( nEndPos );
     }
     // erase trailing lines
     if ( nStartPos != -1 )
@@ -2611,7 +2611,7 @@ static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
             n++;
 
         if ( n > nStartPos )
-            rStr = rStr.copy( 0, nStartPos ) + rStr.copy( n );
+            rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( n );
     }
 }
 
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index b707954c3319..b64be198620b 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -88,6 +88,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/stringconstant \
     compilerplugins/clang/test/stringloop \
     compilerplugins/clang/test/stringstatic \
+    compilerplugins/clang/test/stringview \
     compilerplugins/clang/test/typedefparam \
     compilerplugins/clang/test/unnecessarycatchthrow \
     compilerplugins/clang/test/unnecessaryoverride \
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 87bf6a6c41be..5902669c8df4 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1592,7 +1592,7 @@ IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
     // display Unicode position as symbol name while iterating over characters
     const OUString aHex(OUString::number(cChar, 16).toAsciiUpperCase());
     const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
-    OUString aUnicodePos = aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) +
+    OUString aUnicodePos = aPattern.subView( 0, aPattern.getLength() - aHex.getLength() ) +
         aHex;
     m_xSymbols->set_entry_text(aUnicodePos);
     m_xSymbolName->set_label(aUnicodePos);
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index 779f27add50d..5290ad12606c 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -420,7 +420,7 @@ OUString SmOoxmlImport::handleFunc()
     OUString fname = readOMathArgInElement( M_TOKEN( fName ));
     // fix the various functions
     if( fname.startsWith( "lim csub {" ))
-        fname = "lim from {" + fname.copy( 10 );
+        fname = OUString::Concat("lim from {") + fname.subView( 10 );
     OUString ret = fname + " {" + readOMathArgInElement( M_TOKEN( e )) + "}";
     m_rStream.ensureClosingTag( M_TOKEN( func ));
     return ret;
@@ -435,9 +435,9 @@ OUString SmOoxmlImport::handleLimLowUpp( LimLowUpp_t limlowupp )
     m_rStream.ensureClosingTag( token );
     // fix up overbrace/underbrace  (use { }, as {} will be converted to a placeholder)
     if( limlowupp == LimUpp && e.endsWith( " overbrace { }" ))
-        return e.copy( 0, e.getLength() - 2 ) + lim + "}";
+        return e.subView( 0, e.getLength() - 2 ) + lim + "}";
     if( limlowupp == LimLow && e.endsWith( " underbrace { }" ))
-        return e.copy( 0, e.getLength() - 2 ) + lim + "}";
+        return e.subView( 0, e.getLength() - 2 ) + lim + "}";
     return e
         + ( limlowupp == LimLow ? OUStringLiteral( u" csub {" ) : OUStringLiteral( u" csup {" ))
         + lim + "}";
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index ff4c2483e34b..866648439157 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -821,7 +821,7 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OU
             throw InvalidRegistryException();
         }
 
-        resolvedName += aLinkName.copy(lastIndex);
+        resolvedName += aLinkName.subView(lastIndex);
     }
     else
     {
@@ -875,7 +875,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
             throw InvalidRegistryException();
         }
 
-        resolvedName += rLinkName.copy(lastIndex);
+        resolvedName += rLinkName.subView(lastIndex);
     }
     else
     {
@@ -917,7 +917,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
             throw InvalidRegistryException();
         }
 
-        resolvedName += rLinkName.copy(lastIndex);
+        resolvedName += rLinkName.subView(lastIndex);
     }
     else
     {
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index f554cedb4570..d5813d7ad725 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -194,7 +194,7 @@ void prepareLink( const Reference < XSimpleRegistry > & xDest,
 
     if (pShortName)
     {
-        linkRefName += link.copy(pShortName - pTmpName + 1);
+        linkRefName += link.subView(pShortName - pTmpName + 1);
         linkName = link.copy(0, pShortName - pTmpName);
     }
 
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index f3387e11cd52..2c24c4b9acc5 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -223,13 +223,13 @@ namespace svgio::svgreader
                     if(nIndexTokenImportant > 0)
                     {
                         // copy content before token
-                        aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant);
+                        aNewOUTokenValue += aOUTokenValue.subView(0, nIndexTokenImportant);
                     }
 
                     if(aOUTokenValue.getLength() > nIndexTokenImportant + aTokenImportant.getLength())
                     {
                         // copy content after token
-                        aNewOUTokenValue += aOUTokenValue.copy(nIndexTokenImportant + aTokenImportant.getLength());
+                        aNewOUTokenValue += aOUTokenValue.subView(nIndexTokenImportant + aTokenImportant.getLength());
                     }
 
                     // remove spaces
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 507c8c4f0bb9..04d168c4d976 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -179,7 +179,7 @@ OUString normalize(
     normalized = n == -1 ? uriReference : uriReference.copy(0, n);
     switch (normalizePrefix(broker, normalized, &normalized)) {
     case Success:
-        return n == -1 ? normalized : normalized + uriReference.copy(n);
+        return n == -1 ? normalized : normalized + uriReference.subView(n);
     case GeneralFailure:
         return uriReference;
     case SpecificFailure:
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index dfa10d79a41c..eff5d48d9755 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1256,7 +1256,7 @@ static bool lcl_IsSignedYearSep( const OUString& rStr, const OUString& rPat, sal
         if (nPat + nLen < rPat.getLength() && rPat[nPat+nLen] == 'Y')
         {
             // Signed year is possible.
-            bOk = (rPat.indexOf( rStr.copy( 0, nLen), nPat) == nPat);
+            bOk = (rPat.indexOf( rStr.subView( 0, nLen), nPat) == nPat);
         }
     }
     return bOk;
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index eb14db000011..006bc2981af9 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -755,7 +755,7 @@ bool SvtURLBox_Impl::TildeParsing(
             if( !aParseTilde.endsWith("/") )
                 aParseTilde += "/";
             if( aText.getLength() > 2 )
-                aParseTilde += aText.copy( 2 );
+                aParseTilde += aText.subView( 2 );
         }
 
         aText = aParseTilde;
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index 80df9d61c87c..f006f82c84a7 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -298,7 +298,7 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditHdl, DetailsContainer*, void )
             if( nLength < 0 )
                 nLength = sUser.getLength();
 
-            sLabel = sLabel.replaceFirst( "$user$", sUser.copy( 0, nLength ) );
+            sLabel = sLabel.replaceFirst( "$user$", sUser.subView( 0, nLength ) );
             sLabel = sLabel.replaceFirst( "$service$", m_xLBServerType->get_active_text() );
 
             m_xEDServerName->set_text( sLabel );
diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx
index 066deda28830..6cd12e0e0df0 100644
--- a/svtools/source/uno/popupmenucontrollerbase.cxx
+++ b/svtools/source/uno/popupmenucontrollerbase.cxx
@@ -287,9 +287,9 @@ OUString PopupMenuControllerBase::determineBaseURL( const OUString& aURL )
     {
         sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
         if ( nQueryPart > 0 )
-            aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart );
+            aMainURL += aURL.subView( nSchemePart, nQueryPart-nSchemePart );
         else if ( nQueryPart == -1 )
-            aMainURL += aURL.copy( nSchemePart+1 );
+            aMainURL += aURL.subView( nSchemePart+1 );
     }
 
     return aMainURL;
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 946543e9082d..4187a8055d7b 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -167,13 +167,13 @@ OUString GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen )
 
             if (nPathPrefixLen >= 0)
             {
-                aReduced = aPath.copy(0, nPathPrefixLen) + "..."
+                aReduced = OUString::Concat(aPath.subView(0, nPathPrefixLen)) + "..."
                     + OUStringChar(aDelimiter) + aName;
             }
             else
             {
                 aReduced += "..." + OUStringChar(aDelimiter) + "..."
-                    + aName.copy( aName.getLength() - (nMaxLen - 7) );
+                    + aName.subView( aName.getLength() - (nMaxLen - 7) );
             }
         }
         else
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index e58c5f89d629..0daeb7cc9a5d 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -961,7 +961,7 @@ OUString SdrTextObj::TakeObjNameSingul() const
 
             if(aStr2.getLength() > 10)
             {
-                aStr2 = aStr2.copy(0, 8) + "...";
+                aStr2 = OUString::Concat(aStr2.subView(0, 8)) + "...";
             }
 
             aStr += aStr2 + "\'";
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index bff4092d9f6e..2bff13b00b30 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -121,7 +121,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
         {
             OUString aStr( OUString::number( rGraphic.GetChecksum(), 16 ) );
             if ( aStr[0] == '-' )
-                aStr = "m" + aStr.copy(1);
+                aStr = OUString::Concat("m") + aStr.subView(1);
             OUString aName = aURL.getBase() + "_" + aURL.getExtension() + "_" + aStr;
             aURL.setBase( aName );
         }
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index aae20e0da9c4..6646c903d6e6 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -524,7 +524,7 @@ std::vector<OUString>& SwDoc::FindUsedDBs( const std::vector<OUString>& rAllDBNa
             const sal_Int32 nEndPos = sFormula.indexOf('.', nPos);
             if( nEndPos>=0 )
             {
-                rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.copy( nPos, nEndPos - nPos ));
+                rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.subView( nPos, nEndPos - nPos ));
             }
         }
     }
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 5642224b083f..8485a422b409 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1965,7 +1965,7 @@ Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrRe
     if( SwTOIOptions::InitialCaps & GetOptions() )
     {
         aToCompare.sText = rIntl.ToUpper( aToCompare.sText, 0 )
-                         + aToCompare.sText.copy(1);
+                         + aToCompare.sText.subView(1);
     }
 
     OSL_ENSURE(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0");
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 6a982af47944..47d3e6536ab7 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -143,7 +143,7 @@ class XmlPortionDumper:public SwPortionHandler
                 BAD_CAST(m_rText.copy(sal_Int32(ofs), sal_Int32(nLength)).toUtf8().getStr()));
 
         xmlTextWriterEndElement( writer );
-        m_aLine += m_rText.copy(sal_Int32(ofs), sal_Int32(nLength));
+        m_aLine += m_rText.subView(sal_Int32(ofs), sal_Int32(nLength));
         ofs += nLength;
     }
 
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 703cec868733..caf5e3732b3f 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -742,7 +742,7 @@ OUString SwFormToken::GetString() const
             break;
     }
 
-    return sToken.copy(0, sToken.getLength()-1) + sData + sToken.copy(sToken.getLength()-1);
+    return sToken.subView(0, sToken.getLength()-1) + sData + sToken.subView(sToken.getLength()-1);
 }
 
 // -> #i21237#
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 7afb7fcd08c9..f76dafd6a2a9 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -359,7 +359,7 @@ TextAndReading SwTOXIndex::GetText_Impl(SwRootFrame const*const pLayout) const
     // if SwTOIOptions::InitialCaps is set, first character is to be capitalized
     if( SwTOIOptions::InitialCaps & nOpt && pTOXIntl && !aRet.sText.isEmpty())
     {
-        aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.copy(1);
+        aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.subView(1);
     }
 
     return aRet;
@@ -386,7 +386,7 @@ void SwTOXIndex::FillText( SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt16,
                                 : ExpandMode(0)));
         if(SwTOIOptions::InitialCaps & nOpt && pTOXIntl && !aRet.sText.isEmpty())
         {
-            aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.copy(1);
+            aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.subView(1);
         }
     }
     else
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 245dfd3d3921..351883c2a557 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -704,7 +704,7 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
         else if (bQuoted)
         {
             aResult = SwResId(STR_START_QUOTE) +
-                rStr.copy(nStart, nCount) +
+                rStr.subView(nStart, nCount) +
                 SwResId(STR_END_QUOTE);
         }
         else
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index dcc49e905bf9..cc1f806f1696 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1539,9 +1539,9 @@ OUString ShortenString(const OUString & rStr, sal_Int32 nLength, const OUString
     const sal_Int32 nFrontLen = nLength - nLength / 2;
     const sal_Int32 nBackLen = nLength - nFrontLen;
 
-    return rStr.copy(0, nFrontLen)
+    return rStr.subView(0, nFrontLen)
            + rFillStr
-           + rStr.copy(rStr.getLength() - nBackLen);
+           + rStr.subView(rStr.getLength() - nBackLen);
 }
 
 static bool IsAtEndOfSection(SwPosition const& rAnchorPos)
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 5ac8da9bd311..fa423875dbb2 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1034,7 +1034,7 @@ OUString SwXFieldMaster::LocalizeFormula(
         const OUString sDest = bQuery ? sProgName : sTypeName;
         if(rFormula.startsWith(sSource))
         {
-            return sDest + rFormula.copy(sSource.getLength());
+            return sDest + rFormula.subView(sSource.getLength());
         }
     }
     return rFormula;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list