summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basic/source/classes/sbunoobj.cxx2
-rw-r--r--basic/source/runtime/methods.cxx2
-rw-r--r--chart2/qa/extras/chart2dump/chart2dump.cxx2
-rw-r--r--chart2/source/view/main/VLegend.cxx2
-rw-r--r--codemaker/source/javamaker/javatype.cxx4
-rw-r--r--comphelper/source/misc/storagehelper.cxx2
-rw-r--r--compilerplugins/clang/stringview.cxx188
-rw-r--r--compilerplugins/clang/test/stringview.cxx96
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx2
-rw-r--r--cppu/source/uno/cascade_mapping.cxx4
-rw-r--r--cppu/source/uno/lbenv.cxx2
-rw-r--r--cpputools/source/unoexe/unoexe.cxx6
-rw-r--r--cui/source/customize/cfg.cxx2
-rw-r--r--cui/source/tabpages/tpgradnt.cxx2
-rw-r--r--cui/source/tabpages/tphatch.cxx2
-rw-r--r--cui/source/tabpages/tppattern.cxx2
-rw-r--r--dbaccess/source/ui/control/SqlNameEdit.cxx4
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx2
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx2
-rw-r--r--desktop/source/lib/init.cxx14
-rw-r--r--desktop/source/migration/migration.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--extensions/source/propctrlr/newdatatype.cxx2
-rw-r--r--filter/source/config/cache/filterfactory.cxx2
-rw-r--r--filter/source/graphicfilter/idxf/dxfreprd.cxx4
-rw-r--r--filter/source/msfilter/msvbahelper.cxx4
-rw-r--r--filter/source/msfilter/util.cxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx4
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx2
-rw-r--r--fpicker/source/office/breadcrumb.cxx2
-rw-r--r--fpicker/source/office/iodlg.cxx2
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx4
-rw-r--r--framework/source/fwe/xml/xmlnamespaces.cxx4
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx6
-rw-r--r--framework/source/uielement/menubarmanager.cxx10
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx2
-rw-r--r--i18npool/source/indexentry/genindex_data.cxx2
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx2
-rw-r--r--include/rtl/string.hxx40
-rw-r--r--include/rtl/ustring.hxx40
-rw-r--r--l10ntools/source/helpex.cxx2
-rw-r--r--l10ntools/source/helpmerge.cxx2
-rw-r--r--l10ntools/source/localize.cxx2
-rw-r--r--l10ntools/source/po.cxx2
-rw-r--r--l10ntools/source/treemerge.cxx8
-rw-r--r--l10ntools/source/xrmmerge.cxx2
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.cxx8
-rw-r--r--linguistic/source/dicimp.cxx4
-rw-r--r--oox/source/core/filterbase.cxx4
-rw-r--r--oox/source/core/xmlfilterbase.cxx2
-rw-r--r--oox/source/dump/dumperbase.cxx2
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--package/source/zippackage/zipfileaccess.cxx4
-rw-r--r--registry/source/regimpl.cxx4
-rw-r--r--reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx2
-rw-r--r--sal/qa/osl/process/osl_process.cxx2
-rw-r--r--sal/qa/rtl/process/rtl_Process.cxx2
-rw-r--r--sax/qa/cppunit/xmlimport.cxx4
-rw-r--r--sax/source/fastparser/fastparser.cxx6
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx2
-rw-r--r--sc/source/core/tool/rangeutl.cxx2
-rw-r--r--sc/source/core/tool/reffind.cxx4
-rw-r--r--sc/source/filter/excel/xestream.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx4
-rw-r--r--sc/source/ui/docshell/impex.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx4
-rw-r--r--scaddins/source/analysis/analysishelper.cxx2
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx10
-rw-r--r--sd/source/core/drawdoc3.cxx4
-rw-r--r--sd/source/filter/eppt/pptx-epptbase.cxx2
-rw-r--r--sd/source/ui/dlg/custsdlg.cxx2
-rw-r--r--sd/source/ui/func/fuconstr.cxx2
-rw-r--r--sd/source/ui/func/fuinsfil.cxx2
-rw-r--r--sd/source/ui/unoidl/unopage.cxx6
-rw-r--r--sdext/source/presenter/PresenterSlideSorter.cxx2
-rw-r--r--sfx2/source/appl/appserv.cxx2
-rw-r--r--sfx2/source/appl/sfxhelp.cxx8
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx2
-rw-r--r--sfx2/source/dialog/templdlg.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx4
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--starmath/source/dialog.cxx2
-rw-r--r--starmath/source/ooxmlimport.cxx6
-rw-r--r--stoc/source/defaultregistry/defaultregistry.cxx6
-rw-r--r--stoc/source/implementationregistration/implreg.cxx2
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx4
-rw-r--r--svl/source/misc/urihelper.cxx2
-rw-r--r--svl/source/numbers/zforfind.cxx2
-rw-r--r--svtools/source/control/inettbc.cxx2
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.cxx2
-rw-r--r--svtools/source/uno/popupmenucontrollerbase.cxx4
-rw-r--r--svx/source/gallery2/galmisc.cxx4
-rw-r--r--svx/source/svdraw/svdotext.cxx2
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx2
-rw-r--r--sw/source/core/doc/docfld.cxx2
-rw-r--r--sw/source/core/doc/doctxm.cxx2
-rw-r--r--sw/source/core/text/xmldump.cxx2
-rw-r--r--sw/source/core/tox/tox.cxx2
-rw-r--r--sw/source/core/tox/txmsrt.cxx4
-rw-r--r--sw/source/core/undo/undel.cxx2
-rw-r--r--sw/source/core/undo/undobj.cxx4
-rw-r--r--sw/source/core/unocore/unofield.cxx2
-rw-r--r--sw/source/filter/ascii/wrtasc.cxx2
-rw-r--r--sw/source/filter/html/htmlform.cxx4
-rw-r--r--sw/source/filter/html/htmlsect.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx4
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx2
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx2
-rw-r--r--sw/source/ui/vba/vbaoptions.cxx2
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx2
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx2
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx2
-rw-r--r--ucb/source/ucp/file/filglob.cxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydata.cxx8
-rw-r--r--ucb/source/ucp/package/pkgdatasupplier.cxx2
-rw-r--r--unodevtools/source/skeletonmaker/javatypemaker.cxx2
-rw-r--r--unodevtools/source/unodevtools/options.cxx8
-rw-r--r--unoidl/source/sourcetreeprovider.cxx2
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx2
-rw-r--r--unoxml/source/dom/characterdata.cxx10
-rw-r--r--vcl/source/app/IconThemeInfo.cxx2
-rw-r--r--vcl/source/edit/textundo.cxx4
-rw-r--r--vcl/source/gdi/textlayout.cxx2
-rw-r--r--vcl/source/image/ImplImageTree.cxx4
-rw-r--r--vcl/source/outdev/text.cxx4
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/unx/generic/app/geninst.cxx2
-rw-r--r--writerfilter/source/dmapper/SettingsTable.cxx4
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx4
-rw-r--r--xmlhelp/source/treeview/tvread.cxx2
-rw-r--r--xmloff/source/core/namespacemap.cxx6
-rw-r--r--xmloff/source/draw/shapeexport.cxx6
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx4
142 files changed, 581 insertions, 220 deletions
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@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ call_view(s1.copy(1, 2));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ call_view(s1.copy(1));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ ConstructWithView(s1.copy(1, 2));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ ConstructWithView(s1.copy(1));
+}
+void f1(OString s1)
+{
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ call_view(s1.copy(1, 2));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ call_view(s1.copy(1));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ ConstructWithView(s1.copy(1, 2));
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ ConstructWithView(s1.copy(1));
+}
+}
+
+namespace test2
+{
+void f3(OUString s1)
+{
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ OUString s2 = s1.copy(1, 2) + "xxx";
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ s2 = s1.copy(1) + "xxx";
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ s2 = "xxx" + s1.copy(1);
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ s2 += s1.copy(1);
+}
+void f3(OString s1)
+{
+ // expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ OString s2 = s1.copy(1, 2) + "xxx";
+ (void)s2;
+ // expected-error@+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@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
+ sal_Unicode x = s2.copy(1, 2)[12];
+ (void)x;
+ // expected-error@+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;
diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx
index d9933628a773..5ea4560e9907 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -72,7 +72,7 @@ SwASCWriter::SwASCWriter( const OUString& rFltNm )
break;
default:
- if( rFltNm.getLength() >= 4 && rFltNm.copy( 4 )=="_DLG" )
+ if( rFltNm.getLength() >= 4 && rFltNm.subView( 4 )==u"_DLG" )
{
// use the options
aNewOpts = GetAsciiOptions();
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 46b29ebf2e51..18c5def4ccf6 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -824,13 +824,13 @@ static void lcl_html_getEvents( const OUString& rOption, const OUString& rValue,
{
if( rOption.startsWithIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_sdevent ) )
{
- OUString aEvent = rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdevent ) ) +
+ OUString aEvent = OUString::Concat(rOption.subView( strlen( OOO_STRING_SVTOOLS_HTML_O_sdevent ) )) +
"-" + rValue;
rUnoMacroTable.push_back(aEvent);
}
else if( rOption.startsWithIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) )
{
- OUString aParam = rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) ) +
+ OUString aParam = OUString::Concat(rOption.subView( strlen( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) )) +
"-" + rValue;
rUnoMacroParamTable.push_back(aParam);
}
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index c9208357ceee..d68a22e2e389 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -302,11 +302,11 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
+ OUStringChar(sfx2::cTokenSeparator);
if( nPos2 == -1 )
{
- aURL += aHRef.copy( nPos+1 );
+ aURL += aHRef.subView( nPos+1 );
}
else
{
- aURL += aHRef.copy( nPos+1, nPos2 - (nPos+1) )
+ aURL += aHRef.subView( nPos+1, nPos2 - (nPos+1) )
+ OUStringChar(sfx2::cTokenSeparator)
+ rtl::Uri::decode( aHRef.copy( nPos2+1 ),
rtl_UriDecodeWithCharset,
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 0171c28b27d6..407c5182e997 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1755,7 +1755,7 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nCurrentPos,
rStr, nCurrentPos, g_pBreakIt->GetLocale(nLanguage),
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
{
- aSnippet = OUStringChar(rStr[nCurrentPos]) + aSnippet.copy(1);
+ aSnippet = OUStringChar(rStr[nCurrentPos]) + aSnippet.subView(1);
}
}
m_rExport.m_aCurrentCharPropStarts.pop();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index cc66c44952c0..fb26419025e0 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3179,11 +3179,11 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
+ "\\o (\\s\\up "
+ OUString::number(nHeight/2)
+ "("
- + pField->GetPar1().copy(0, nAbove)
+ + pField->GetPar1().subView(0, nAbove)
+ "), \\s\\do "
+ OUString::number(nHeight/5)
+ "("
- + pField->GetPar1().copy(nAbove)
+ + pField->GetPar1().subView(nAbove)
+ "))";
GetExport().OutputField(pField, ww::eEQ, sStr);
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a2b9289349b3..4a21a87b9a5c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4497,7 +4497,7 @@ OUString WW8PLCFx_Book::GetUniqueBookmarkName(const OUString &rSuggestedName)
sal_Int32 p = len - 1;
while (p > 0 && aRet[p] >= '0' && aRet[p] <= '9')
--p;
- aRet = aRet.copy(0, p+1) + OUString::number(nBookmarkId++);
+ aRet = aRet.subView(0, p+1) + OUString::number(nBookmarkId++);
i = 0; // start search from beginning
}
else
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index bff5619a4270..876f5e5bf27d 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -609,7 +609,7 @@ sal_Int32 SwCustomizeAddressBlockDialog::GetSelectedItem_Impl() const
for (int i = 0, nEntryCount = m_xAddressElementsLB->n_children(); i < nEntryCount; ++i)
{
const OUString sEntry = m_xAddressElementsLB->get_text(i);
- if( sEntry == sSelected.copy( 1, sSelected.getLength() - 2 ) )
+ if( sEntry == sSelected.subView( 1, sSelected.getLength() - 2 ) )
{
nRet = m_xAddressElementsLB->get_id(i).toInt32();
break;
diff --git a/sw/source/ui/vba/vbaoptions.cxx b/sw/source/ui/vba/vbaoptions.cxx
index dd3cb2227435..72fd56cdc7c2 100644
--- a/sw/source/ui/vba/vbaoptions.cxx
+++ b/sw/source/ui/vba/vbaoptions.cxx
@@ -103,7 +103,7 @@ void SwVbaOptions::setValueEvent( const uno::Any& value )
sal_Int32 nIndex = sOldPathUrl.lastIndexOf( ';' );
if( nIndex != -1 )
{
- sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ) + sNewPathUrl;
+ sNewPathUrl = sOldPathUrl.subView( 0, nIndex + 1 ) + sNewPathUrl;
}
xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) );
}
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 860a926a5076..3e96b2c9e807 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -436,7 +436,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName,
const sal_Int32 nMaxLen = 50;
if(pWrtShell->IsSelection() && aShortName.getLength() > nMaxLen)
{
- aShortName = aShortName.copy(0, nMaxLen) + " ...";
+ aShortName = OUString::Concat(aShortName.subView(0, nMaxLen)) + " ...";
}
OUString aTmp( SwResId(STR_NOGLOS));
aTmp = aTmp.replaceFirst("%1", aShortName);
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index bec2b148a58c..4b1e7c70836c 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -589,7 +589,7 @@ void SwAnnotationWin::CheckMetaText()
}
else if (sMeta.getLength() > 23)
{
- sMeta = sMeta.copy(0, 20) + "...";
+ sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
}
if ( mpMetadataAuthor->GetText() != sMeta )
{
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 5ee7e763fcb9..0ffe30e41044 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -327,7 +327,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
sText = pRefField->GetExpandedTextOfReferencedTextNode(*rSh.GetLayout());
if ( sText.getLength() > 80 )
{
- sText = sText.copy(0, 80) + "...";
+ sText = OUString::Concat(sText.subView(0, 80)) + "...";
}
}
else
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index 6c047877cded..f4e58d08ffcd 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -310,7 +310,7 @@ std::vector<OUString> & SwGlossaries::GetNameList()
SWUnoHelper::UCB_GetFileListOfFolder(m_PathArr[i], aFiles, &sExt);
for (const OUString& aTitle : aFiles)
{
- const OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() )
+ const OUString sName( aTitle.subView( 0, aTitle.getLength() - sExt.getLength() )
+ OUStringChar(GLOS_DELIM) + OUString::number( static_cast<sal_Int16>(i) ));
m_GlosArr.push_back(sName);
}
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 429af573ce84..4c5ea1249e87 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -178,7 +178,7 @@ namespace fileaccess {
{
sal_Int32 srcL = aOldPrefix.getLength();
- return aNewPrefix + old_Name.copy( srcL );
+ return aNewPrefix + old_Name.subView( srcL );
}
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index 07b5943f06ac..c0548cbe361b 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -277,7 +277,7 @@ bool HierarchyEntry::setData( const HierarchyEntryData& rData )
OSL_ENSURE( nPos != -1,
"HierarchyEntry::setData - Wrong path!" );
- aParentPath += m_aPath.copy( 0, nPos );
+ aParentPath += m_aPath.subView( 0, nPos );
bRoot = false;
}
@@ -510,7 +510,7 @@ bool HierarchyEntry::move(
OSL_ENSURE( nPos != -1, "HierarchyEntry::move - Wrong path!" );
- aOldParentPath += m_aPath.copy( 0, nPos );
+ aOldParentPath += m_aPath.subView( 0, nPos );
bOldRoot = false;
}
@@ -523,7 +523,7 @@ bool HierarchyEntry::move(
OSL_ENSURE( nPos != -1, "HierarchyEntry::move - Wrong path!" );
- aNewParentPath += aNewPath.copy( 0, nPos );
+ aNewParentPath += aNewPath.subView( 0, nPos );
bNewRoot = false;
}
@@ -771,7 +771,7 @@ bool HierarchyEntry::remove()
OSL_ENSURE( nPos != -1,
"HierarchyEntry::remove - Wrong path!" );
- aParentPath += m_aPath.copy( 0, nPos );
+ aParentPath += m_aPath.subView( 0, nPos );
bRoot = false;
}
diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx b/ucb/source/ucp/package/pkgdatasupplier.cxx
index 90e1b87a7bfd..4b097d021f59 100644
--- a/ucb/source/ucp/package/pkgdatasupplier.cxx
+++ b/ucb/source/ucp/package/pkgdatasupplier.cxx
@@ -436,7 +436,7 @@ OUString DataSupplier::assembleChildURL( const OUString& aName )
aURL += "/";
aURL += ::ucb_impl::urihelper::encodeSegment( aName ) +
- aContURL.copy( nParam );
+ aContURL.subView( nParam );
}
else
{
diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx
index ea373dac520e..be65870b56ad 100644
--- a/unodevtools/source/skeletonmaker/javatypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx
@@ -331,7 +331,7 @@ static void printSetPropertyMixinBody(
do
{
OString s(fieldtype.getToken(0, '<', nPos));
- OString t{ "((" + s.copy(s.lastIndexOf('/')+1) + ")" };
+ OString t{ OString::Concat("((") + s.subView(s.lastIndexOf('/')+1) + ")" };
if ( t == "((Optional)" ) {
optional=true;
diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx
index 43948067359e..98db9cae00ae 100644
--- a/unodevtools/source/unodevtools/options.cxx
+++ b/unodevtools/source/unodevtools/options.cxx
@@ -40,13 +40,13 @@ 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) )) {
// take next argument
++(*pnIndex);
rtl_getAppCommandArg(*pnIndex, &pValue->pData);
if (*pnIndex >= rtl_getAppCommandArgCount() ||
- pValue->copy(1) == dash)
+ pValue->subView(1) == dash)
{
throw CannotDumpException(
"incomplete option \"-" + aOpt + "\" given!");
@@ -70,8 +70,8 @@ bool readOption( const char * pOpt,
{
OUString aOpt = OUString::createFromAscii(pOpt);
- if((aArg.startsWith("-") && aOpt.equalsIgnoreAsciiCase(aArg.copy(1))) ||
- (aArg.startsWith("--") && aOpt.equalsIgnoreAsciiCase(aArg.copy(2))) )
+ if((aArg.startsWith("-") && aOpt.equalsIgnoreAsciiCase(aArg.subView(1))) ||
+ (aArg.startsWith("--") && aOpt.equalsIgnoreAsciiCase(aArg.subView(2))) )
{
++(*pnIndex);
SAL_INFO("unodevtools", "identified option --" << pOpt);
diff --git a/unoidl/source/sourcetreeprovider.cxx b/unoidl/source/sourcetreeprovider.cxx
index fd780f8dfd5e..7ec67db22062 100644
--- a/unoidl/source/sourcetreeprovider.cxx
+++ b/unoidl/source/sourcetreeprovider.cxx
@@ -89,7 +89,7 @@ bool exists(OUString const & uri, bool directory) {
return osl::DirectoryItem::get(uri, item) == osl::FileBase::E_None
&& item.getFileStatus(status) == osl::FileBase::E_None
&& (status.getFileType() == osl::FileStatus::Directory) == directory
- && getFileName(uri, status) == uri.copy(uri.lastIndexOf('/') + 1);
+ && getFileName(uri, status) == uri.subView(uri.lastIndexOf('/') + 1);
}
class Cursor: public MapCursor {
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index d8f406b7ae05..c63287efe114 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -258,7 +258,7 @@ static OUString lcl_createName(
sal_Int32 nOffset = rLeadingChars.lastIndexOf("/");
OUString aDirName;
if (-1 != nOffset)
- aDirName = aName + rLeadingChars.copy( 0, nOffset );
+ aDirName = aName + rLeadingChars.subView( 0, nOffset );
else
aDirName = aName;
TempDirCreatedObserver observer;
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
index ee85a76b4a68..d46ff5d7c587 100644
--- a/unoxml/source/dom/characterdata.cxx
+++ b/unoxml/source/dom/characterdata.cxx
@@ -98,7 +98,7 @@ namespace DOM
if ((offset+count) > tmp.getLength())
count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset) + tmp.copy(offset+count);
+ OUString tmp2 = OUString::Concat(tmp.subView(0, offset)) + tmp.subView(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
@@ -166,9 +166,9 @@ namespace DOM
throw e;
}
- OUString tmp2 = tmp.copy(0, offset) +
+ OUString tmp2 = tmp.subView(0, offset) +
arg +
- tmp.copy(offset);
+ tmp.subView(offset);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
@@ -203,9 +203,9 @@ namespace DOM
if ((offset+count) > tmp.getLength())
count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset) +
+ OUString tmp2 = tmp.subView(0, offset) +
arg +
- tmp.copy(offset+count);
+ tmp.subView(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
diff --git a/vcl/source/app/IconThemeInfo.cxx b/vcl/source/app/IconThemeInfo.cxx
index aa7a5cf7c1bd..877b7d570b0a 100644
--- a/vcl/source/app/IconThemeInfo.cxx
+++ b/vcl/source/app/IconThemeInfo.cxx
@@ -134,7 +134,7 @@ IconThemeInfo::ThemeIdToDisplayName(const OUString& themeId)
sal_Unicode firstLetter = aDisplayName[0];
if (rtl::isAsciiLowerCase(firstLetter))
{
- aDisplayName = OUStringChar(sal_Unicode(rtl::toAsciiUpperCase(firstLetter))) + aDisplayName.copy(1);
+ aDisplayName = OUStringChar(sal_Unicode(rtl::toAsciiUpperCase(firstLetter))) + aDisplayName.subView(1);
}
}
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index 2e57d0be2a37..284300e9ec10 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -50,9 +50,9 @@ void Shorten (OUString& rString)
iLast = nLen - 8; // not possible
// finally:
rString =
- rString.copy(0, iFirst + 1) +
+ OUString::Concat(rString.subView(0, iFirst + 1)) +
"..." +
- rString.copy(iLast);
+ rString.subView(iLast);
}
} // namespace
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index ea86aa47b049..0c8953e92f8d 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -203,7 +203,7 @@ namespace vcl
MetricVector aGlyphBounds;
m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, aGlyphBounds );
_pVector->insert( _pVector->end(), aGlyphBounds.begin(), aGlyphBounds.end() );
- *_pDisplayText += _rText.copy( _nStartIndex, _nLength );
+ *_pDisplayText += _rText.subView( _nStartIndex, _nLength );
return;
}
diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
index f08f1973c785..4d2906d9b779 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -92,7 +92,7 @@ OUString convertLcTo32Path(OUString const & rPath)
OUString sDir = rPath.copy(0, rPath.lastIndexOf('/'));
if (!sFile.isEmpty() && sFile.startsWith("lc_"))
{
- aResult = sDir + "/32/" + sFile.copy(3);
+ aResult = sDir + "/32/" + sFile.subView(3);
}
}
return aResult;
@@ -100,7 +100,7 @@ OUString convertLcTo32Path(OUString const & rPath)
OUString createPath(OUString const & name, sal_Int32 pos, OUString const & locale)
{
- return name.copy(0, pos + 1) + locale + name.copy(pos);
+ return name.subView(0, pos + 1) + locale + name.subView(pos);
}
OUString getIconCacheUrl(OUString const & sVariant, ImageRequestParameters const & rParameters)
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 0057fb4a2a14..adfcefbcd316 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -859,7 +859,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
{
GetGlyphBoundRects( rStartPt, rStr, nIndex, nLen, *pVector );
if( pDisplayText )
- *pDisplayText += rStr.copy( nIndex, nLen );
+ *pDisplayText += rStr.subView( nIndex, nLen );
}
}
@@ -2025,7 +2025,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
{
if ( nFirstContent > 4 )
nFirstContent = 4;
- OUString aFirstStr = aStr.copy( 0, nFirstContent ) + "...";
+ OUString aFirstStr = OUString::Concat(aStr.subView( 0, nFirstContent )) + "...";
OUString aTempStr = aFirstStr + aLastStr;
if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth )
aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d50444f1f3f4..3e9200df6d2e 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1623,7 +1623,7 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OString& rName)
VclBuilder::customMakeWidget pFunction = nullptr;
if (sal_Int32 nDelim = name.indexOf('-'); nDelim != -1)
{
- const OString aFunction("make" + name.copy(nDelim + 1));
+ const OString aFunction(OString::Concat("make") + name.subView(nDelim + 1));
const OUString sFunction(OStringToOUString(aFunction, RTL_TEXTENCODING_UTF8));
#ifndef DISABLE_DYNLOADING
diff --git a/vcl/unx/generic/app/geninst.cxx b/vcl/unx/generic/app/geninst.cxx
index c385ab57d587..0093f64376c6 100644
--- a/vcl/unx/generic/app/geninst.cxx
+++ b/vcl/unx/generic/app/geninst.cxx
@@ -68,7 +68,7 @@ OUString SalGenericInstance::getOSVersion()
if (nTooDetailed < 1 || nTooDetailed > 8)
aKernelVer = "Linux (misparsed version)";
else // "3.16.7-29-desktop ..."
- aKernelVer = "Linux " + aVers.copy(0, nTooDetailed);
+ aKernelVer = OUString::Concat("Linux ") + aVers.subView(0, nTooDetailed);
}
fclose( pVersion );
}
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index d9dc20d962c8..9cccf3ea1ba4 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -542,8 +542,8 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
sal_Int32 nDbo = sVal.lastIndexOf(".dbo.");
if ( nSpace > 0 && nSpace < nDbo - 1 )
{
- m_pImpl->m_sCurrentDatabaseDataSource = sVal.copy(nSpace + 1, nDbo - nSpace - 1) +
- sVal.copy(nDbo + 4, sVal.getLength() - nDbo - 5);
+ m_pImpl->m_sCurrentDatabaseDataSource = OUString::Concat(sVal.subView(nSpace + 1, nDbo - nSpace - 1)) +
+ sVal.subView(nDbo + 4, sVal.getLength() - nDbo - 5);
}
}
}
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 5353f6e82ac3..b422d74efef8 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1633,7 +1633,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
sal_Int32 nLastSlashInPath = rPath.lastIndexOf( '/', rPath.getLength() - 1 );
*o_pExtensionRegistryPath = xPackage->getURL();
- *o_pExtensionRegistryPath += rPath.copy( nLastSlashInPath);
+ *o_pExtensionRegistryPath += rPath.subView( nLastSlashInPath);
}
}
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index cb0d765c7ad5..6fa762de325e 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -298,7 +298,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
for( int r = 0 ; r < nResultCount ; ++r )
{
OUString aURL = aCompleteResultVector[r];
- OUString aResultStr = replWith + aURL.copy(replIdx);
+ OUString aResultStr = replWith + aURL.subView(replIdx);
m_aPath.push_back( aResultStr );
}
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index b43411df75ac..bb1a12bc8243 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -380,9 +380,9 @@ bool URLParameter::scheme()
m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6);
if( aLastStr == "DbPAR=" )
{
- m_aExpr = m_aExpr.copy( 0, 20 ) +
+ m_aExpr = OUString::Concat(m_aExpr.subView( 0, 20 )) +
"shared" +
- m_aExpr.copy( 20 ) +
+ m_aExpr.subView( 20 ) +
"shared";
}
}
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 08bbdf5dd1b4..83505b36608b 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -645,7 +645,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
ret = locale;
else if( ( ( idx = locale.indexOf( '-' ) ) != -1 ||
( idx = locale.indexOf( '_' ) ) != -1 ) &&
- osl::FileBase::E_None == osl::DirectoryItem::get( url + locale.copy( 0,idx ),
+ osl::FileBase::E_None == osl::DirectoryItem::get( url + locale.subView( 0,idx ),
aDirItem ) )
ret = locale.copy( 0,idx );
else
diff --git a/xmloff/source/core/namespacemap.cxx b/xmloff/source/core/namespacemap.cxx
index 3ff1d65bd1d9..6cd01efcd532 100644
--- a/xmloff/source/core/namespacemap.cxx
+++ b/xmloff/source/core/namespacemap.cxx
@@ -466,7 +466,7 @@ bool SvXMLNamespaceMap::NormalizeW3URI( OUString& rName )
{
const OUString& sURISuffix = GetXMLToken( 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 = GetXMLToken( XML_N_XFORMS_1_0 );
@@ -550,9 +550,9 @@ bool SvXMLNamespaceMap::NormalizeOasisURN( OUString& rName )
// replace [tcid] with current TCID and version with current version.
- rName = rName.copy( 0, nTCIdStart ) +
+ rName = rName.subView( 0, nTCIdStart ) +
GetXMLToken( XML_OPENDOCUMENT ) +
- rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) +
+ rName.subView( nTCIdEnd, nVersionStart-nTCIdEnd ) +
GetXMLToken( XML_1_0 );
return true;
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index da40af685b0b..32cf74b8a799 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2365,7 +2365,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
OUString newStreamURL = "vnd.sun.star.Package:";
if (sInternalURL[0] == '#')
{
- newStreamURL += sInternalURL.copy(1, sInternalURL.getLength() - 1);
+ newStreamURL += sInternalURL.subView(1, sInternalURL.getLength() - 1);
}
else
{
@@ -3784,8 +3784,8 @@ static void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< OUStr
nIndex = aStr.indexOf( '?', nIndex );
if ( nIndex != -1 )
{
- aStr = aStr.copy(0, nIndex + 1) + "f"
- + aStr.copy(nIndex + 1, aStr.getLength() - nIndex - 1);
+ aStr = OUString::Concat(aStr.subView(0, nIndex + 1)) + "f"
+ + aStr.subView(nIndex + 1, aStr.getLength() - nIndex - 1);
nIndex++;
}
} while( nIndex != -1 );
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index 9082528b05c9..b3e5dee8fc10 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1209,9 +1209,9 @@ void XMLEnhancedCustomShapeContext::endFastElement(sal_Int32 )
EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
if ( aHashIter != pH->end() )
nIndex = (*aHashIter).second;
- OUString aNew = rEquation.copy( 0, nIndexOf + 1 ) +
+ OUString aNew = rEquation.subView( 0, nIndexOf + 1 ) +
OUString::number( nIndex ) +
- rEquation.copy( nIndexOf + aEquationName.getLength() + 1 );
+ rEquation.subView( nIndexOf + aEquationName.getLength() + 1 );
rEquation = aNew;
}
nIndexOf++;