From 5200a73627d13e2997f81b53f61e143e77e328ee Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 29 Apr 2022 11:06:33 +0200 Subject: use more string_view in various found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basctl/source/basicide/baside2b.cxx | 7 ++-- basic/source/comp/codegen.cxx | 15 +++---- basic/source/comp/scanner.cxx | 5 ++- basic/source/runtime/methods.cxx | 18 ++++---- .../controller/main/ChartController_Window.cxx | 5 ++- .../source/drivers/firebird/PreparedStatement.cxx | 2 +- connectivity/source/parse/sqlbison.y | 7 ++-- cpputools/source/unoexe/unoexe.cxx | 6 +-- cui/source/dialogs/AdditionsDialog.cxx | 4 +- cui/source/dialogs/hyphen.cxx | 8 ++-- cui/source/options/cfgchart.cxx | 15 +++---- dbaccess/source/filter/hsqldb/createparser.cxx | 7 ++-- dbaccess/source/filter/hsqldb/parseschema.cxx | 11 +++-- dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 2 +- .../source/ui/querydesign/SelectionBrowseBox.cxx | 8 ++-- .../deployment/registry/component/dp_component.cxx | 6 +-- .../source/deployment/registry/help/dp_help.cxx | 10 ++--- desktop/source/migration/migration.cxx | 4 +- .../source/migration/services/basicmigration.cxx | 2 +- .../migration/services/wordbookmigration.cxx | 2 +- editeng/source/editeng/impedit3.cxx | 4 +- editeng/source/misc/svxacorr.cxx | 6 +-- extensions/source/propctrlr/eventhandler.cxx | 6 +-- forms/source/richtext/richtextcontrol.cxx | 4 +- framework/source/jobs/jobdata.cxx | 2 +- framework/source/services/autorecovery.cxx | 5 ++- .../moduleuiconfigurationmanager.cxx | 17 ++++---- .../uiconfiguration/uiconfigurationmanager.cxx | 17 ++++---- .../source/uielement/recentfilesmenucontroller.cxx | 9 ++-- framework/source/uielement/toolbarmanager.cxx | 5 +-- .../source/nativenumber/nativenumbersupplier.cxx | 2 +- linguistic/source/misc.cxx | 7 ++-- lotuswordpro/source/filter/lwpfribmark.cxx | 4 +- lotuswordpro/source/filter/lwpmarker.cxx | 18 ++++---- package/source/zippackage/ZipPackage.cxx | 11 ++--- .../source/core/misc/conditionalexpression.cxx | 32 +++++++-------- .../source/filter/xml/xmlImportDocumentHandler.cxx | 6 +-- sax/source/fastparser/fastparser.cxx | 5 ++- sc/source/core/tool/address.cxx | 2 +- sc/source/core/tool/reffind.cxx | 2 +- sc/source/filter/excel/xecontent.cxx | 4 +- sc/source/filter/excel/xltools.cxx | 5 ++- sc/source/filter/xml/xmldrani.cxx | 9 ++-- sc/source/filter/xml/xmlsorti.cxx | 8 ++-- sd/source/core/stlsheet.cxx | 4 +- sd/source/ui/dlg/unchss.cxx | 2 +- sd/source/ui/func/futempl.cxx | 5 ++- sd/source/ui/unoidl/unomodel.cxx | 37 +++++++++-------- sd/source/ui/unoidl/unoobj.cxx | 8 ++-- sd/source/ui/unoidl/unopage.cxx | 12 +++--- sd/source/ui/view/sdview2.cxx | 2 +- sdext/source/presenter/PresenterController.cxx | 2 +- sfx2/source/view/classificationhelper.cxx | 4 +- starmath/source/mathml/import.cxx | 5 ++- stoc/source/javavm/javavm.cxx | 2 +- svgio/source/svgreader/svgtools.cxx | 13 +++--- svx/source/svdraw/svdotxat.cxx | 5 ++- svx/source/unodraw/unomod.cxx | 33 +++++++-------- svx/source/unodraw/unoprov.cxx | 10 ++--- sw/source/core/access/accpara.cxx | 8 ++-- sw/source/core/bastyp/calc.cxx | 12 +++--- .../doc/DocumentLinksAdministrationManager.cxx | 10 ++--- sw/source/core/table/swtable.cxx | 11 ++--- sw/source/core/tox/txmsrt.cxx | 6 +-- sw/source/core/txtnode/ndtxt.cxx | 4 +- sw/source/core/unocore/unochart.cxx | 6 +-- sw/source/filter/html/css1atr.cxx | 48 +++++++++++----------- sw/source/uibase/docvw/edtwin2.cxx | 18 ++++---- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uiview/viewport.cxx | 2 +- sw/source/uibase/uno/unotxdoc.cxx | 27 ++++++------ test/source/bootstrapfixture.cxx | 5 ++- tools/source/fsys/urlobj.cxx | 4 +- ucb/source/ucp/ext/ucpext_content.cxx | 6 +-- ucb/source/ucp/ext/ucpext_provider.cxx | 12 +++--- ucb/source/ucp/tdoc/tdoc_uri.hxx | 2 +- ucb/source/ucp/webdav-curl/CurlUri.cxx | 7 ++-- vcl/jsdialog/executor.cxx | 2 +- vcl/source/outdev/text.cxx | 2 +- vcl/source/pdf/PDFiumTools.cxx | 44 ++++++++++---------- vcl/unx/gtk3/gtkframe.cxx | 2 +- vcl/unx/gtk3/gtkinst.cxx | 2 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++++--- writerfilter/source/rtftok/rtfsdrimport.cxx | 20 ++++----- xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 6 +-- xmlhelp/source/treeview/tvread.cxx | 17 ++++---- xmlsecurity/source/helper/ooxmlsecexporter.cxx | 4 +- 87 files changed, 404 insertions(+), 377 deletions(-) diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 37bf5f59f57a..0315894b7d88 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -795,17 +796,17 @@ void EditorWindow::HandleProcedureCompletion() if( aCurrPortions.size() >= 3 ) {//at least 3 tokens: (sub|function) whitespace identifier... HighlightPortion& r = aCurrPortions.front(); - OUString sStr = aCurrLine.copy(r.nBegin, r.nEnd - r.nBegin); + std::u16string_view sStr = aCurrLine.subView(r.nBegin, r.nEnd - r.nBegin); if( r.tokenType == TokenType::Keywords ) { - if( sStr.equalsIgnoreAsciiCase("sub") || sStr.equalsIgnoreAsciiCase("function") ) + if( o3tl::equalsIgnoreAsciiCase(sStr, u"sub") || o3tl::equalsIgnoreAsciiCase(sStr, u"function") ) { pEditView->InsertText( sText );//append to the end GetEditView()->SetSelection(aSel); break; } - if( sStr.equalsIgnoreAsciiCase("end") ) + if( o3tl::equalsIgnoreAsciiCase(sStr, u"end") ) break; } } diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index e2f675a369de..9f2f4960bf9a 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include // nInc is the increment size of the buffers @@ -200,24 +201,24 @@ void SbiCodeGen::Save() if( nIfaceCount ) { int nPropPrefixFound = aProcName.indexOf("Property "); - OUString aPureProcName = aProcName; - OUString aPropPrefix; + std::u16string_view aPureProcName = aProcName; + std::u16string_view aPropPrefix; if( nPropPrefixFound == 0 ) { - aPropPrefix = aProcName.copy( 0, 13 ); // 13 == Len( "Property ?et " ) - aPureProcName = aProcName.copy( 13 ); + aPropPrefix = aProcName.subView( 0, 13 ); // 13 == Len( "Property ?et " ) + aPureProcName = aProcName.subView( 13 ); } for( int i = 0 ; i < nIfaceCount ; i++ ) { const OUString& rIfaceName = pParser->aIfaceVector[i]; - int nFound = aPureProcName.indexOf( rIfaceName ); - if( nFound == 0 && aPureProcName[rIfaceName.getLength()] == '_' ) + bool bFound = o3tl::starts_with(aPureProcName, rIfaceName ); + if( bFound && aPureProcName[rIfaceName.getLength()] == '_' ) { if( nPropPrefixFound == 0 ) { aIfaceProcName.append(aPropPrefix); } - aIfaceProcName.append(aPureProcName.subView(rIfaceName.getLength() + 1) ); + aIfaceProcName.append(aPureProcName.substr(rIfaceName.getLength() + 1) ); aIfaceName = rIfaceName; nPassCount = 2; break; diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index a0d9b9ab6c76..63d525939459 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -27,6 +27,7 @@ #include #include #include +#include SbiScanner::SbiScanner(const OUString& rBuf, StarBASIC* p) : aBuf(rBuf) @@ -160,8 +161,8 @@ void SbiScanner::scanGoto() if(n + 1 < aLine.getLength()) { - OUString aTemp = aLine.copy(n, 2); - if(aTemp.equalsIgnoreAsciiCase("to")) + std::u16string_view aTemp = aLine.subView(n, 2); + if(o3tl::equalsIgnoreAsciiCase(aTemp, u"to")) { aSym = "goto"; nLineIdx += n + 2 - nCol; diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 972038744dae..8cc49c2a5024 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1911,7 +1911,7 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) break; bool bUseTwoDigitYear = false; - OUString aYearStr, aMonthStr, aDayStr; + std::u16string_view aYearStr, aMonthStr, aDayStr; if (nLen == 6 || nLen == 8 || nLen == 9) { // ((Y)YY)YYMMDD @@ -1921,9 +1921,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) const sal_Int32 nMonthPos = (nLen == 8 ? 4 : (nLen == 6 ? 2 : 5)); if (nMonthPos == 2) bUseTwoDigitYear = true; - aYearStr = aStr.copy( 0, nMonthPos ); - aMonthStr = aStr.copy( nMonthPos, 2 ); - aDayStr = aStr.copy( nMonthPos + 2, 2 ); + aYearStr = aStr.subView( 0, nMonthPos ); + aMonthStr = aStr.subView( nMonthPos, 2 ); + aDayStr = aStr.subView( nMonthPos + 2, 2 ); } else { @@ -1934,9 +1934,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) if (aStr.indexOf('-', nMonthSep + 1) != nMonthSep + 3) break; - aYearStr = aStr.copy( 0, nMonthSep ); - aMonthStr = aStr.copy( nMonthSep + 1, 2 ); - aDayStr = aStr.copy( nMonthSep + 4, 2 ); + aYearStr = aStr.subView( 0, nMonthSep ); + aMonthStr = aStr.subView( nMonthSep + 1, 2 ); + aDayStr = aStr.subView( nMonthSep + 4, 2 ); if ( !comphelper::string::isdigitAsciiString(aYearStr) || !comphelper::string::isdigitAsciiString(aMonthStr) || !comphelper::string::isdigitAsciiString(aDayStr)) @@ -1944,8 +1944,8 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) } double dDate; - if (!implDateSerial( static_cast(nSign * aYearStr.toInt32()), - static_cast(aMonthStr.toInt32()), static_cast(aDayStr.toInt32()), + if (!implDateSerial( static_cast(nSign * o3tl::toInt32(aYearStr)), + static_cast(o3tl::toInt32(aMonthStr)), static_cast(o3tl::toInt32(aDayStr)), bUseTwoDigitYear, SbDateCorrection::None, dDate )) break; diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 8db4133ee93e..f5dd0bdfeb9e 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -85,6 +85,7 @@ #include #include #include +#include #include #include @@ -2086,8 +2087,8 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a sal_Int32 nStartPos = rCID.lastIndexOf('.'); nStartPos++; sal_Int32 nEndPos = rCID.getLength(); - OUString sDimensionIndex = rCID.copy(nStartPos, nEndPos - nStartPos); - sal_Int32 nDimensionIndex = sDimensionIndex.toInt32(); + std::u16string_view sDimensionIndex = rCID.subView(nStartPos, nEndPos - nStartPos); + sal_Int32 nDimensionIndex = o3tl::toInt32(sDimensionIndex); awt::Rectangle xRectangle { sal_Int32(aRectangle.Left()), diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 10f034ce15ce..9cd9157a7d6d 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -783,7 +783,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c sBuffer.append(sValue); if(sValue.indexOf('.') != -1) // there is a dot { - for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i loadComponent( Reference< XImplementationLoader > xLoader; - OUString aExt( rLocation.copy( nDot +1 ) ); + std::u16string_view aExt( rLocation.subView( nDot +1 ) ); - if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so") + if (aExt == u"dll" || aExt == u"exe" || aExt == u"dylib" || aExt == u"so") { createInstance( xLoader, xContext, "com.sun.star.loader.SharedLibrary" ); } - else if (aExt == "jar" || aExt == "class") + else if (aExt == u"jar" || aExt == u"class") { createInstance( xLoader, xContext, "com.sun.star.loader.Java" ); diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 65fe1b2e273c..c26a0d97456e 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -635,8 +635,8 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial if (additionInfo.sName.getLength() > maxExtensionNameLength) { - OUString sShortName = additionInfo.sName.copy(0, maxExtensionNameLength - 3); - sExtensionName = sShortName + "..."; + std::u16string_view sShortName = additionInfo.sName.subView(0, maxExtensionNameLength - 3); + sExtensionName = OUString::Concat(sShortName) + "..."; } else { diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 0535902d4447..7d7274612c3c 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -158,11 +158,11 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl() } // 2) remove all hyphenation positions from the start that are not considered by the core - const OUString aSearchRange( aTxt.copy( 0, nPos1 ) ); - sal_Int32 nPos2 = aSearchRange.lastIndexOf( '-' ); // the '-' position the core will use by default - if (nPos2 != -1 ) + const std::u16string_view aSearchRange( aTxt.subView( 0, nPos1 ) ); + size_t nPos2 = aSearchRange.rfind( '-' ); // the '-' position the core will use by default + if (nPos2 != std::u16string_view::npos ) { - OUString aLeft( aSearchRange.copy( 0, nPos2 ) ); + OUString aLeft( aSearchRange.substr( 0, nPos2 ) ); nPos = 0; while (nPos != -1) { diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index 063ecc0fb184..ab12dfabd647 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -115,14 +115,14 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex ) { OUString aName; - OUString sDefaultNamePrefix; - OUString sDefaultNamePostfix; + std::u16string_view sDefaultNamePrefix; + std::u16string_view sDefaultNamePostfix; OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) ); sal_Int32 nPos = aResName.indexOf( "$(ROW)" ); if( nPos != -1 ) { - sDefaultNamePrefix = aResName.copy( 0, nPos ); - sDefaultNamePostfix = aResName.copy( nPos + sizeof( "$(ROW)" ) - 1 ); + sDefaultNamePrefix = aResName.subView( 0, nPos ); + sDefaultNamePostfix = aResName.subView( nPos + sizeof( "$(ROW)" ) - 1 ); } else { @@ -203,13 +203,14 @@ bool SvxChartOptions::RetrieveOptions() // create strings for entry names OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) ); - OUString aPrefix, aPostfix, aName; + std::u16string_view aPrefix, aPostfix; + OUString aName; sal_Int32 nPos = aResName.indexOf( "$(ROW)" ); if( nPos != -1 ) { - aPrefix = aResName.copy( 0, nPos ); + aPrefix = aResName.subView( 0, nPos ); sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1; - aPostfix = aResName.copy( idx ); + aPostfix = aResName.subView( idx ); } else aPrefix = aResName; diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx index cfff560c0de5..360741ce0b28 100644 --- a/dbaccess/source/filter/hsqldb/createparser.cxx +++ b/dbaccess/source/filter/hsqldb/createparser.cxx @@ -251,9 +251,9 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart) // search next space to get the whole type name // eg: INTEGER, VARCHAR(10), DECIMAL(6,3) auto nNextSpace = sFromTypeName.indexOf(" "); - OUString sFullTypeName; + std::u16string_view sFullTypeName; if (nNextSpace > 0) - sFullTypeName = sFromTypeName.copy(0, nNextSpace); + sFullTypeName = sFromTypeName.subView(0, nNextSpace); // perhaps column type corresponds to the last info here else sFullTypeName = sFromTypeName; @@ -266,7 +266,8 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart) if (isPrimaryKey) m_PrimaryKeys.push_back(rColumnName); - const OUString sColumnWithoutName = sColumn.copy(sColumn.indexOf(typeParts.typeName)); + const std::u16string_view sColumnWithoutName + = sColumn.subView(sColumn.indexOf(typeParts.typeName)); ColumnDefinition aColDef(rColumnName, lcl_getDataTypeFromHsql(typeParts.typeName), std::move(typeParts.params), isPrimaryKey, diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index c3b7951a8219..b55340f2deb7 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -60,9 +60,14 @@ public: { assert(isIndexStatement()); - OUString sIndexPart = m_sql.copy(m_sql.indexOf("INDEX") + 5); - sal_Int32 nQuotePos = sIndexPart.indexOf("'") + 1; - OUString sIndexNums = sIndexPart.copy(nQuotePos, sIndexPart.lastIndexOf("'") - nQuotePos); + std::u16string_view sIndexPart = m_sql.subView(m_sql.indexOf("INDEX") + 5); + size_t nQuotePos = sIndexPart.find('\''); + if (nQuotePos == std::u16string_view::npos) + nQuotePos = 0; + else + ++nQuotePos; + std::u16string_view sIndexNums + = sIndexPart.substr(nQuotePos, sIndexPart.rfind('\'') - nQuotePos); std::vector sIndexes = string::split(sIndexNums, u' '); IndexVector indexes; diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index caac1d968779..15fa887f7a63 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -357,7 +357,7 @@ namespace dbaui int nPos(rBox.find_text(rBox.get_active_text())); if (nPos == -1) - return rBox.get_active_text().copy(0); + return rBox.get_active_text(); if ( m_xTextSeparator.get() != &rBox || nPos != (rBox.get_count()-1) ) return OUString( diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index cc2895d12c67..414d6bbdca89 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1054,7 +1054,7 @@ bool OSelectionBrowseBox::SaveModified() sal_Int32 nPos = rComboBox.get_active(); // these functions are only available in CORE OUString sFunctionName = rComboBox.get_text(nPos); - OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1); + std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1); bool bGroupBy = false; if ( sGroupFunctionName == sFunctionName ) // check if the function name is GROUP { @@ -2282,16 +2282,16 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con break; case BROW_FUNCTION_ROW: { - OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1); + std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1); pEntry->SetFunction(strNewText); // first reset this two member sal_Int32 nFunctionType = pEntry->GetFunctionType(); nFunctionType &= ~FKT_AGGREGATE; pEntry->SetFunctionType(nFunctionType); - if ( pEntry->IsGroupBy() && !sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) ) + if ( pEntry->IsGroupBy() && !o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) ) pEntry->SetGroupBy(false); - if ( sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) ) + if ( o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) ) pEntry->SetGroupBy(true); else if ( !strNewText.isEmpty() ) { diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 8bee3d4ee0b3..9cb4846c6ee8 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1304,10 +1304,10 @@ BackendImpl::ComponentPackageImpl::isRegistered_( { //try to match only the file name OUString thisUrl(getURL()); - OUString thisFileName(thisUrl.copy(thisUrl.lastIndexOf('/'))); + std::u16string_view thisFileName(thisUrl.subView(thisUrl.lastIndexOf('/'))); - OUString locationFileName(location.copy(location.lastIndexOf('/'))); - if (locationFileName.equalsIgnoreAsciiCase(thisFileName)) + std::u16string_view locationFileName(location.subView(location.lastIndexOf('/'))); + if (o3tl::equalsIgnoreAsciiCase(locationFileName, thisFileName)) bAmbiguousComponentName = true; } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 834f829ad35b..f039d27250d9 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #if HAVE_FEATURE_XMLHELP #include @@ -447,9 +448,8 @@ void BackendImpl::implProcessHelp( implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); // Copy to package (later: move?) - OUString aDestPath = aDestBasePath; - OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; + std::u16string_view aPureFolderName = aSubFolderURL.subView( nLenLangFolderURL ); + OUString aDestPath = aDestBasePath + aPureFolderName; xSFA->copy( aSubFolderURL, aDestPath ); } @@ -580,8 +580,8 @@ void BackendImpl::implCollectXhpFiles( const OUString& aDir, sal_Int32 nLastDot = aURL.lastIndexOf( '.' ); if( nLastDot != -1 ) { - OUString aExt = aURL.copy( nLastDot + 1 ); - if( aExt.equalsIgnoreAsciiCase( "xhp" ) ) + std::u16string_view aExt = aURL.subView( nLastDot + 1 ); + if( o3tl::equalsIgnoreAsciiCase( aExt, u"xhp" ) ) o_rXhpFileVector.push_back( aURL ); } } diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 0fbca8565634..25579a979dbc 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -839,9 +839,9 @@ std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules() aModuleInfo.sModuleShortName = sModuleShortName; sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); if (nIndex > 0) { - OUString sExtension(sToolbarName.copy(nIndex)); + std::u16string_view sExtension(sToolbarName.subView(nIndex)); OUString sToolbarResourceName(sToolbarName.copy(0, nIndex)); - if (!sToolbarResourceName.isEmpty() && sExtension == ".xml") + if (!sToolbarResourceName.isEmpty() && sExtension == u".xml") aModuleInfo.m_vToolbars.push_back(sToolbarResourceName); } } diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index 8076dada5cb0..94e8677de786 100644 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx @@ -108,7 +108,7 @@ namespace migration TStringVectorPtr aFileList = getFiles( m_sSourceDir ); for (auto const& elem : *aFileList) { - OUString sLocalName = elem.copy( m_sSourceDir.getLength() ); + std::u16string_view sLocalName = elem.subView( m_sSourceDir.getLength() ); OUString sTargetName = sTargetDir + sLocalName; INetURLObject aURL( sTargetName ); aURL.removeSegment(); diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index 83f687703e9f..a3fff8823925 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -138,7 +138,7 @@ static bool IsUserWordbook( const OUString& rFile ) { if (IsUserWordbook(elem) ) { - OUString sSourceLocalName = elem.copy( m_sSourceDir.getLength() ); + std::u16string_view sSourceLocalName = elem.subView( m_sSourceDir.getLength() ); OUString sTargetName = sTargetDir + sSourceLocalName; INetURLObject aURL( sTargetName ); aURL.removeSegment(); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 129c4d9f6a0e..83eb93066baf 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1971,8 +1971,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te { // TODO: handle all alternative hyphenations (see hyphen-1.2.8/tests/unicode.*) OUString aAlt( xHyphWord->getHyphenatedWord() ); - OUString aAltLeft(aAlt.copy(0, _nWordLen)); - OUString aAltRight(aAlt.copy(_nWordLen)); + std::u16string_view aAltLeft(aAlt.subView(0, _nWordLen)); + std::u16string_view aAltRight(aAlt.subView(_nWordLen)); bAltFullLeft = aWord.startsWith(aAltLeft); bAltFullRight = aWord.endsWith(aAltRight); nAltDelChar = aWord.getLength() - aAlt.getLength() + static_cast(!bAltFullLeft) + static_cast(!bAltFullRight); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index d969b09c0015..fba4bddce8c6 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -519,7 +519,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); for (OUString const & sSuffix : aSuffixes) { - OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1); + std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); if (sSuffix == sEnd) { @@ -2971,7 +2971,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p if (bWasWordDelim) rStt++; OUString left_pattern = rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard); // avoid double spaces before simple "word" replacement - left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().copy(1) : pFnd->GetLong(); + left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().subView(1) : pFnd->GetLong(); if( const SvxAutocorrWord* pNew = Insert( SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), left_pattern) ) ) return pNew; } @@ -3018,7 +3018,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p if ( !left_wildcard ) { sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength(); - aLong = pFnd->GetLong() + (siz > 0 ? rTxt.copy(nFndPos + sTmp.getLength(), siz) : ""); + aLong = pFnd->GetLong() + (siz > 0 ? rTxt.subView(nFndPos + sTmp.getLength(), siz) : u""); } else { OUStringBuffer buf; do { diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 5939110d0ede..41afc78cc494 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -237,11 +237,11 @@ namespace pcr sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' ); OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" ); - OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen ); - OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 ); + std::u16string_view sLocation = aScriptEvent.ScriptCode.subView( 0, nPrefixLen ); + std::u16string_view sMacroPath = aScriptEvent.ScriptCode.subView( nPrefixLen + 1 ); aScriptEvent.ScriptCode = - "vnd.sun.star.script:" + + OUString::Concat("vnd.sun.star.script:") + sMacroPath + "?language=Basic&location=" + sLocation; diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 85da65cb0824..408199dac0de 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -586,10 +586,10 @@ namespace frm } // is it a UNO slot? - OUString sUnoProtocolPrefix( ".uno:" ); + static constexpr std::u16string_view sUnoProtocolPrefix( u".uno:" ); if ( _rURL.Complete.startsWith( sUnoProtocolPrefix ) ) { - OUString sUnoSlotName = _rURL.Complete.copy( sUnoProtocolPrefix.getLength() ); + OUString sUnoSlotName = _rURL.Complete.copy( sUnoProtocolPrefix.size() ); SfxSlotId nSlotId = lcl_getSlotFromUnoName( SfxSlotPool::GetSlotPool(), sUnoSlotName ); if ( nSlotId > 0 ) { diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 974f2630fe84..aad2bfcd4118 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -460,7 +460,7 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const sal_Int32 nIndex = m_sContext.indexOf( rModuleIdent ); if ( nIndex >= 0 && ( nIndex+nModuleIdLen <= nContextLen )) { - OUString sContextModule = m_sContext.copy( nIndex, nModuleIdLen ); + std::u16string_view sContextModule = m_sContext.subView( nIndex, nModuleIdLen ); return sContextModule == rModuleIdent; } } diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 131c104dcba9..2ceffa8dceb7 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -1837,8 +1838,8 @@ void AutoRecovery::implts_readConfig() if (pItems[i].startsWith(sRECOVERY_ITEM_BASE_IDENTIFIER)) { - OUString sID = pItems[i].copy(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength()); - aInfo.ID = sID.toInt32(); + std::u16string_view sID = pItems[i].subView(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength()); + aInfo.ID = o3tl::toInt32(sID); /* SAFE */ { osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex); if (aInfo.ID > m_nIdPool) diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 65ff144913f9..8e1e4dbb2660 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -243,11 +244,11 @@ sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL ) if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { - OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); - sal_Int32 nIndex = aTmpStr.indexOf( '/' ); - if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex )) + std::u16string_view aTmpStr = aResourceURL.subView( RESOURCEURL_PREFIX_SIZE ); + size_t nIndex = aTmpStr.find( '/' ); + if (( nIndex > 0 ) && ( aTmpStr.size() > nIndex )) { - OUString aTypeStr( aTmpStr.copy( 0, nIndex )); + std::u16string_view aTypeStr( aTmpStr.substr( 0, nIndex )); for ( int i = 0; i < ui::UIElementType::COUNT; i++ ) { if ( aTypeStr == UIELEMENTTYPENAMES[i] ) @@ -375,11 +376,11 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, sal_Int32 nIndex = rElementName.lastIndexOf( '.' ); if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() )) { - OUString aExtension( rElementName.copy( nIndex+1 )); - OUString aUIElementName( rElementName.copy( 0, nIndex )); + std::u16string_view aExtension( rElementName.subView( nIndex+1 )); + std::u16string_view aUIElementName( rElementName.subView( 0, nIndex )); - if (!aUIElementName.isEmpty() && - ( aExtension.equalsIgnoreAsciiCase("xml"))) + if (!aUIElementName.empty() && + ( o3tl::equalsIgnoreAsciiCase(aExtension, u"xml"))) { aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; aUIElementData.aName = rElementName; diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index b3b443b99d5c..3e7cbd74b44f 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -220,11 +221,11 @@ sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL ) if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { - OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); - sal_Int32 nIndex = aTmpStr.indexOf( '/' ); - if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex )) + std::u16string_view aTmpStr = aResourceURL.subView( RESOURCEURL_PREFIX_SIZE ); + size_t nIndex = aTmpStr.find( '/' ); + if (( nIndex > 0 ) && ( aTmpStr.size() > nIndex )) { - OUString aTypeStr( aTmpStr.copy( 0, nIndex )); + std::u16string_view aTypeStr( aTmpStr.substr( 0, nIndex )); for ( int i = 0; i < UIElementType::COUNT; i++ ) { if ( aTypeStr == UIELEMENTTYPENAMES[i] ) @@ -300,11 +301,11 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy sal_Int32 nIndex = rElementName.lastIndexOf( '.' ); if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() )) { - OUString aExtension( rElementName.copy( nIndex+1 )); - OUString aUIElementName( rElementName.copy( 0, nIndex )); + std::u16string_view aExtension( rElementName.subView( nIndex+1 )); + std::u16string_view aUIElementName( rElementName.subView( 0, nIndex )); - if (!aUIElementName.isEmpty() && - ( aExtension.equalsIgnoreAsciiCase("xml"))) + if (!aUIElementName.empty() && + ( o3tl::equalsIgnoreAsciiCase(aExtension, u"xml"))) { aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; aUIElementData.aName = rElementName; diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 74c66e90b9d3..2fbad67becd9 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -31,6 +31,7 @@ #include #include #include +#include using namespace css; using namespace com::sun::star::uno; @@ -383,14 +384,14 @@ void SAL_CALL RecentFilesMenuController::dispatch( return; sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos ); - OUString aEntryArg; + std::u16string_view aEntryArg; if ( nAddArgs < 0 ) - aEntryArg = aURL.Complete.copy( nEntryPos ); + aEntryArg = aURL.Complete.subView( nEntryPos ); else - aEntryArg = aURL.Complete.copy( nEntryPos, nAddArgs-nEntryPos ); + aEntryArg = aURL.Complete.subView( nEntryPos, nAddArgs-nEntryPos ); - sal_Int32 nEntry = aEntryArg.toInt32(); + sal_Int32 nEntry = o3tl::toInt32(aEntryArg); executeEntry( nEntry ); } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 42d6163dcf8b..6c88c57d8b27 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -633,9 +633,8 @@ void ToolBarManager::Init() // set name for testtool, the useful part is after the last '/' sal_Int32 idx = m_aResourceName.lastIndexOf('/'); idx++; // will become 0 if '/' not found: use full string - OString aHelpIdAsString( ".HelpId:" ); - OUString aToolbarName = m_aResourceName.copy( idx ); - aHelpIdAsString += OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); + std::u16string_view aToolbarName = m_aResourceName.subView( idx ); + OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); m_pImpl->SetHelpId( aHelpIdAsString ); m_aAsyncUpdateControllersTimer.SetTimeout( 50 ); diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index 01f2382713db..59c38b39edde 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -693,7 +693,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum { case CAPITALIZE: return xCharClass->toTitle(aStr, 0, 1, aLocale) + - (aStr.getLength() > 1 ? aStr.copy(1) : OUString()); + (aStr.getLength() > 1 ? aStr.subView(1) : u""); case UPPER: return xCharClass->toUpper(aStr, 0, aStr.getLength(), aLocale); case LOWER: diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 411361d38d66..de2bc96860ee 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -521,7 +521,6 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( //! should at least work with the German words //! B-"u-c-k-er and Sc-hif-fah-rt - OUString aLeft, aRight; sal_Int16 nPos = GetOrigWordPos( rOrigWord, nChgPos ); // get words like Sc-hif-fah-rt to work correct @@ -529,12 +528,12 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( if (nChgPos > nHyphenationPos) --nPos; - aLeft = rOrigWord.copy( 0, nPos ); - aRight = rOrigWord.copy( nPos ); // FIXME: changes at the right side + std::u16string_view aLeft = rOrigWord.subView( 0, nPos ); + std::u16string_view aRight = rOrigWord.subView( nPos ); // FIXME: changes at the right side aOrigHyphenatedWord = aLeft + aRplc + aRight; - nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.getLength() + + nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.size() + rxHyphWord->getHyphenPos() - nChgPos); nOrigHyphenationPos = GetOrigWordPos( rOrigWord, nHyphenationPos ); } diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx index eba748865d10..f29d4f4c3aeb 100644 --- a/lotuswordpro/source/filter/lwpfribmark.cxx +++ b/lotuswordpro/source/filter/lwpfribmark.cxx @@ -373,8 +373,8 @@ void LwpFribField::RegisterTimeField(const LwpFieldMark* pFieldMark) if (index < 0) return; - OUString tag = sFormula.copy(0, index); - if (tag == "Now()" || tag == "CreateDate" || tag == "EditDate") + std::u16string_view tag = sFormula.subView(0, index); + if (tag == u"Now()" || tag == u"CreateDate" || tag == u"EditDate") RegisterDateTimeStyle(sFormula.copy(index + 1)); } } diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx index 86591fd8917e..e6b29c23c55c 100644 --- a/lotuswordpro/source/filter/lwpmarker.cxx +++ b/lotuswordpro/source/filter/lwpmarker.cxx @@ -429,27 +429,27 @@ bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula) return false; } - OUString tag = sFormula.copy(0,index); - if (tag == "Now()") + std::u16string_view tag = sFormula.subView(0,index); + if (tag == u"Now()") { type = DATETIME_NOW; formula = sFormula.copy(index+1); return true; } - else if (tag == "CreateDate") + else if (tag == u"CreateDate") { type = DATETIME_CREATE; formula = sFormula.copy(index+1); return true; } - else if (tag == "EditDate") + else if (tag == u"EditDate") { type = DATETIME_LASTEDIT; formula = sFormula.copy(index+1); return true; } - else if (tag == "YesterdaysDate" || tag == "TomorrowsDate" - || tag == "TodaysDate") + else if (tag == u"YesterdaysDate" || tag == u"TomorrowsDate" + || tag == u"TodaysDate") { type = DATETIME_SKIP; return true; @@ -476,14 +476,14 @@ bool LwpFieldMark::IsCrossRefField(sal_uInt8& nType, OUString& sMarkName) return false; } - OUString tag = sFormula.copy(0,index); - if (tag == "PageRef") + std::u16string_view tag = sFormula.subView(0,index); + if (tag == u"PageRef") { sMarkName = sFormula.copy(index+1); nType = CROSSREF_PAGE; return true; } - else if (tag == "ParaRef") + else if (tag == u"ParaRef") { sMarkName = sFormula.copy(index+1); nType = CROSSREF_PARANUMBER; diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index c134a9d94c5d..36dc397ca0cf 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -602,24 +603,24 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) if ( nParam >= 0 ) { m_aURL = aParamUrl.copy( 0, nParam ); - OUString aParam = aParamUrl.copy( nParam + 1 ); + std::u16string_view aParam = aParamUrl.subView( nParam + 1 ); sal_Int32 nIndex = 0; do { - OUString aCommand = aParam.getToken( 0, '&', nIndex ); - if ( aCommand == "repairpackage" ) + std::u16string_view aCommand = o3tl::getToken(aParam, 0, '&', nIndex ); + if ( aCommand == u"repairpackage" ) { m_bForceRecovery = true; break; } - else if ( aCommand == "purezip" ) + else if ( aCommand == u"purezip" ) { m_nFormat = embed::StorageFormats::ZIP; m_xRootFolder->setPackageFormat_Impl( m_nFormat ); break; } - else if ( aCommand == "ofopxml" ) + else if ( aCommand == u"ofopxml" ) { m_nFormat = embed::StorageFormats::OFOPXML; m_xRootFolder->setPackageFormat_Impl( m_nFormat ); diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx index 97284c8b0d64..d8f37efc9578 100644 --- a/reportdesign/source/core/misc/conditionalexpression.cxx +++ b/reportdesign/source/core/misc/conditionalexpression.cxx @@ -97,8 +97,8 @@ namespace rptui // must be identical if ( _rExpression.getLength() < nLHSIndex ) return false; - const OUString sExprPart1( _rExpression.copy( 0, nLHSIndex ) ); - const OUString sMatchExprPart1( sMatchExpression.copy( 0, nLHSIndex ) ); + const std::u16string_view sExprPart1( _rExpression.subView( 0, nLHSIndex ) ); + const std::u16string_view sMatchExprPart1( sMatchExpression.subView( 0, nLHSIndex ) ); if ( sExprPart1 != sMatchExprPart1 ) // the left-most expression parts do not match return false; @@ -107,11 +107,11 @@ namespace rptui // must be identical, too bool bHaveRHS( nRHSIndex != -1 ); sal_Int32 nRightMostIndex( bHaveRHS ? nRHSIndex : nLHSIndex ); - const OUString sMatchExprPart3( sMatchExpression.copy( nRightMostIndex + 2 ) ); - if ( _rExpression.getLength() < sMatchExprPart3.getLength() ) + const std::u16string_view sMatchExprPart3( sMatchExpression.subView( nRightMostIndex + 2 ) ); + if ( _rExpression.getLength() < static_cast(sMatchExprPart3.size()) ) // the expression is not even long enough to hold the right-most part of the match expression return false; - const OUString sExprPart3( _rExpression.copy( _rExpression.getLength() - sMatchExprPart3.getLength() ) ); + const std::u16string_view sExprPart3( _rExpression.subView( _rExpression.getLength() - sMatchExprPart3.size() ) ); if ( sExprPart3 != sMatchExprPart3 ) // the right-most expression parts do not match return false; @@ -119,28 +119,28 @@ namespace rptui // if we don't have an RHS, we're done if ( !bHaveRHS ) { - _out_rLHS = _rExpression.copy( sExprPart1.getLength(), _rExpression.getLength() - sExprPart1.getLength() - sExprPart3.getLength() ); + _out_rLHS = _rExpression.copy( sExprPart1.size(), _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() ); return true; } // strip the match expression by its right-most and left-most part, and by the placeholders $1 and $2 sal_Int32 nMatchExprPart2Start( nLHSIndex + sLHSPattern.getLength() ); - OUString sMatchExprPart2 = sMatchExpression.copy( + std::u16string_view sMatchExprPart2 = sMatchExpression.subView( nMatchExprPart2Start, - sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.getLength() - 2 + sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.size() - 2 ); // strip the expression by its left-most and right-most part - const OUString sExpression( _rExpression.copy( - sExprPart1.getLength(), - _rExpression.getLength() - sExprPart1.getLength() - sExprPart3.getLength() + const std::u16string_view sExpression( _rExpression.subView( + sExprPart1.size(), + _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() ) ); - sal_Int32 nPart2Index = sExpression.indexOf( sMatchExprPart2 ); - if ( nPart2Index == -1 ) + size_t nPart2Index = sExpression.find( sMatchExprPart2 ); + if ( nPart2Index == std::u16string_view::npos ) // the "middle" part of the match expression does not exist in the expression at all return false; - OSL_ENSURE( sExpression.indexOf( sMatchExprPart2, nPart2Index + 1 ) == -1, + OSL_ENSURE( sExpression.find( sMatchExprPart2, nPart2Index + 1 ) == std::u16string_view::npos, "ConditionalExpression::matchExpression: ambiguous matching!" ); // if this fires, then we're lost: The middle part exists two times in the expression, // so we cannot reliably determine what's the LHS and what's the RHS. @@ -154,8 +154,8 @@ namespace rptui // Here, at the latest, you can see that we need another mechanism, anyway, which does not // rely on those strange expression building/matching - _out_rLHS = sExpression.copy( 0, nPart2Index ); - _out_rRHS = sExpression.copy( nPart2Index + sMatchExprPart2.getLength() ); + _out_rLHS = sExpression.substr( 0, nPart2Index ); + _out_rRHS = sExpression.substr( nPart2Index + sMatchExprPart2.size() ); return true; } diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index 4e7fd13b47c7..fa0f29037320 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -247,14 +247,14 @@ void SAL_CALL ImportDocumentHandler::startElement(const OUString & _sName, const const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0; for(sal_Int16 i = 0; i < nLength; ++i) { - OUString sLocalName; + std::u16string_view sLocalName; const OUString sAttrName = _xAttrList->getNameByIndex( i ); const sal_Int32 nColonPos = sAttrName.indexOf( ':' ); if( -1 == nColonPos ) sLocalName = sAttrName; else - sLocalName = sAttrName.copy( nColonPos + 1 ); - if ( sLocalName == "data-source-has-labels" ) + sLocalName = sAttrName.subView( nColonPos + 1 ); + if ( sLocalName == u"data-source-has-labels" ) { const OUString sValue = _xAttrList->getValueByIndex( i ); bHasCategories = sValue == "both"; diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 2a4961737f9e..47f3da4a2ba6 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1651,9 +1652,9 @@ static bool NormalizeOasisURN( OUString& rName ) // :urn:oasis:names:tc:[^:]:xmlns.* nPos = nTCIdEnd + 1; - OUString sTmp( rName.copy( nPos ) ); + std::u16string_view sTmp( rName.subView( nPos ) ); const OUString& rXMLNS = XML_XMLNS; - if( !sTmp.startsWith( rXMLNS ) ) + if( !o3tl::starts_with(sTmp, rXMLNS ) ) return false; // :urn:oasis:names:tc:[^:]:xmlns:.* diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index a9c52ea0b2a0..c5c49bd65553 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2038,7 +2038,7 @@ template static void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCO { lcl_string_append(r.append("'["), aDocName); r.append("]"); - lcl_string_append(r, aTabName.copy(1)); + lcl_string_append(r, aTabName.subView(1)); } else { diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index dab144437955..00df3e2fdb5d 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -291,7 +291,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ) if (nSep >= 0) { OUString aRef = aExpr.copy(nSep+1); - OUString aExtDocNameTabName = aExpr.copy(0, nSep+1); + std::u16string_view aExtDocNameTabName = aExpr.subView(0, nSep+1); nResult = aAddr.Parse(aRef, mrDoc, aDetails); aAddr.SetTab(0); // force to first tab to avoid error on checking nFlags = lcl_NextFlags( nResult ); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 06439a8ab75d..358f306fbe2b 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -431,9 +431,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU if (nSepPos != -1) { - OUString aSheetName(aTextMark.copy(0, nSepPos)); + std::u16string_view aSheetName(aTextMark.subView(0, nSepPos)); - if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'') + if (aSheetName.find(' ') != std::u16string_view::npos && aSheetName[0] != '\'') { aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, u"'"); } diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index c08fd2beea8f..3a69e7da06a7 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -629,8 +630,8 @@ bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, cons { if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) ) { - OUString aLevel = rStyleName.copy(nNextChar); - sal_Int32 nLevel = aLevel.toInt32(); + std::u16string_view aLevel = rStyleName.subView(nNextChar); + sal_Int32 nLevel = o3tl::toInt32(aLevel); if (std::u16string_view(OUString::number(nLevel)) == aLevel && nLevel > 0 && nLevel <= EXC_STYLE_LEVELCOUNT) { diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index ee728b1550a4..5708c74d2fa3 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -683,12 +684,12 @@ ScXMLSortGroupsContext::ScXMLSortGroupsContext( ScXMLImport& rImport, const OUString &sValue = aIter.toString(); if (sValue.getLength() > 8) { - OUString sTemp = sValue.copy(0, 8); - if (sTemp == "UserList") + std::u16string_view sTemp = sValue.subView(0, 8); + if (sTemp == u"UserList") { pDatabaseRangeContext->SetSubTotalsEnabledUserList(true); - sTemp = sValue.copy(8); - pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast(sTemp.toInt32())); + sTemp = sValue.subView(8); + pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast(o3tl::toInt32(sTemp))); } else { diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx index 31c7fbb5a4b3..4d33341df002 100644 --- a/sc/source/filter/xml/xmlsorti.cxx +++ b/sc/source/filter/xml/xmlsorti.cxx @@ -173,12 +173,12 @@ void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, const OUSt aSortField.SortAscending = false; if (sDataType.getLength() > 8) { - OUString sTemp = sDataType.copy(0, 8); - if (sTemp == "UserList") + std::u16string_view sTemp = sDataType.subView(0, 8); + if (sTemp == u"UserList") { bEnabledUserList = true; - sTemp = sDataType.copy(8); - nUserListIndex = static_cast(sTemp.toInt32()); + sTemp = sDataType.subView(8); + nUserListIndex = static_cast(o3tl::toInt32(sTemp)); } else { diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index feff63dbf69a..48ae9b58c458 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -402,7 +402,7 @@ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const sal_Int32 nPos = aStyleName.indexOf(aOutlineStr); if (nPos >= 0) { - OUString aNumStr(aStyleName.copy(aOutlineStr.getLength())); + std::u16string_view aNumStr(aStyleName.subView(aOutlineStr.getLength())); aInternalName = STR_LAYOUT_OUTLINE + aNumStr; } } @@ -464,7 +464,7 @@ SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const sal_Int32 nPos = aStyleName.indexOf(aOutlineStr); if (nPos != -1) { - OUString aNumStr(aStyleName.copy(aOutlineStr.getLength())); + std::u16string_view aNumStr(aStyleName.subView(aOutlineStr.getLength())); aStyleName = SdResId(STR_PSEUDOSHEET_OUTLINE) + aNumStr; } } diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx index 5f17840d7963..7d963cddfb11 100644 --- a/sd/source/ui/dlg/unchss.cxx +++ b/sd/source/ui/dlg/unchss.cxx @@ -83,7 +83,7 @@ StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc, nPos = aName.indexOf(aOutlineStr); if (nPos != -1) { - OUString aNumStr(aName.copy(aOutlineStr.getLength())); + std::u16string_view aNumStr(aName.subView(aOutlineStr.getLength())); aName = STR_LAYOUT_OUTLINE + aNumStr; } } diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index 21f19f3e725f..2c0c22ecde09 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -336,8 +337,8 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { OUString aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE)); // determine number, mind the blank between name and number - OUString aNumStr(aName.copy(aOutlineStr.getLength() + 1)); - sal_uInt16 nLevel = static_cast(aNumStr.toInt32()); + std::u16string_view aNumStr(aName.subView(aOutlineStr.getLength() + 1)); + sal_uInt16 nLevel = static_cast(o3tl::toInt32(aNumStr)); switch (nLevel) { case 1: ePO = PresentationObjects::Outline_1; break; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 6fbcf5263118..c63d1362b10b 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -954,76 +955,76 @@ css::uno::Reference SdXImpressDocument::create( if( aServiceSpecifier.startsWith( "com.sun.star.presentation.") ) { - const OUString aType( aServiceSpecifier.copy(26) ); + const std::u16string_view aType( aServiceSpecifier.subView(26) ); rtl::Reference pShape; SdrObjKind nType = SdrObjKind::Text; // create a shape wrapper - if( aType.startsWith( "TitleTextShape" ) ) + if( o3tl::starts_with(aType, u"TitleTextShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "OutlinerShape" ) ) + else if( o3tl::starts_with(aType, u"OutlinerShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "SubtitleShape" ) ) + else if( o3tl::starts_with(aType, u"SubtitleShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "GraphicObjectShape" ) ) + else if( o3tl::starts_with(aType, u"GraphicObjectShape" ) ) { nType = SdrObjKind::Graphic; } - else if( aType.startsWith( "PageShape" ) ) + else if( o3tl::starts_with(aType, u"PageShape" ) ) { nType = SdrObjKind::Page; } - else if( aType.startsWith( "OLE2Shape" ) ) + else if( o3tl::starts_with(aType, u"OLE2Shape" ) ) { nType = SdrObjKind::OLE2; } - else if( aType.startsWith( "ChartShape" ) ) + else if( o3tl::starts_with(aType, u"ChartShape" ) ) { nType = SdrObjKind::OLE2; } - else if( aType.startsWith( "CalcShape" ) ) + else if( o3tl::starts_with(aType, u"CalcShape" ) ) { nType = SdrObjKind::OLE2; } - else if( aType.startsWith( "TableShape" ) ) + else if( o3tl::starts_with(aType, u"TableShape" ) ) { nType = SdrObjKind::Table; } - else if( aType.startsWith( "OrgChartShape" ) ) + else if( o3tl::starts_with(aType, u"OrgChartShape" ) ) { nType = SdrObjKind::OLE2; } - else if( aType.startsWith( "NotesShape" ) ) + else if( o3tl::starts_with(aType, u"NotesShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "HandoutShape" ) ) + else if( o3tl::starts_with(aType, u"HandoutShape" ) ) { nType = SdrObjKind::Page; } - else if( aType.startsWith( "FooterShape" ) ) + else if( o3tl::starts_with(aType, u"FooterShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "HeaderShape" ) ) + else if( o3tl::starts_with(aType, u"HeaderShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "SlideNumberShape" ) ) + else if( o3tl::starts_with(aType, u"SlideNumberShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "DateTimeShape" ) ) + else if( o3tl::starts_with(aType, u"DateTimeShape" ) ) { nType = SdrObjKind::Text; } - else if( aType.startsWith( "MediaShape" ) ) + else if( o3tl::starts_with(aType, u"MediaShape" ) ) { nType = SdrObjKind::Media; } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index a095dd4d8bad..29736f6a633e 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1278,8 +1278,8 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno sal_Int32 nPos = aStrBookmark.lastIndexOf( '#' ); if( nPos >= 0 ) { - OUString aURL( aStrBookmark.copy( 0, nPos+1 ) ); - aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) ); + OUString aURL = aStrBookmark.subView( 0, nPos+1 ) + + getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) ); aStrBookmark = aURL; } } @@ -1531,8 +1531,8 @@ uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName ) sal_Int32 nPos = aString.lastIndexOf( '#' ); if( nPos >= 0 ) { - OUString aURL( aString.copy( 0, nPos+1 ) ); - aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) ); + OUString aURL = aString.subView( 0, nPos+1 ) + + getPageApiNameFromUiName( aString.copy( nPos+1 ) ); aString = aURL; } pProperties->Name = gaStrBookmark; diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index bc042babe8d5..a2adb7a7f75d 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -74,6 +74,7 @@ #include #include #include +#include using ::com::sun::star::animations::XAnimationNode; using ::com::sun::star::animations::XAnimationNodeSupplier; @@ -2172,16 +2173,15 @@ OUString getUiNameFromPageApiNameImpl( const OUString& rApiName ) const OUString aDefPageName( sEmptyPageName ); if( rApiName.startsWith( aDefPageName ) ) { - OUString aNumber( rApiName.copy( aDefPageName.getLength() ) ); + std::u16string_view aNumber( rApiName.subView( aDefPageName.getLength() ) ); // create the page number - sal_Int32 nPageNumber = aNumber.toInt32(); + sal_Int32 nPageNumber = o3tl::toInt32(aNumber); // check if there are non number characters in the number part - const sal_Int32 nChars = aNumber.getLength(); - const sal_Unicode* pString = aNumber.getStr(); - sal_Int32 nChar; - for( nChar = 0; nChar < nChars; nChar++, pString++ ) + const size_t nChars = aNumber.size(); + const sal_Unicode* pString = aNumber.data(); + for( size_t nChar = 0; nChar < nChars; nChar++, pString++ ) { if((*pString < '0') || (*pString > '9')) { diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 3a40d4065d93..a5b3d44132b6 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -731,7 +731,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, sal_Int32 nIndex = aBookmark.indexOf( '#' ); if( nIndex != -1 ) { - const OUString aDocName( aBookmark.copy( 0, nIndex ) ); + const std::u16string_view aDocName( aBookmark.subView( 0, nIndex ) ); if (mpDocSh->GetMedium()->GetName() == aDocName || aDocName == mpDocSh->GetName()) { diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index 4ad52f3ac402..5b501dbfa7cd 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -372,7 +372,7 @@ void PresenterController::UpdatePaneTitles() // Get the placeholder ++nStartIndex; const sal_Int32 nEndIndex (sTemplate.indexOf('%', nStartIndex+1)); - const OUString sPlaceholder (sTemplate.copy(nStartIndex, nEndIndex-nStartIndex)); + const std::u16string_view sPlaceholder (sTemplate.subView(nStartIndex, nEndIndex-nStartIndex)); nIndex = nEndIndex+1; // Replace the placeholder with its current value. diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 457872bf9da2..12679c3b1cf6 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -385,10 +385,10 @@ void SfxClassificationHelper::Impl::parsePolicy() OUString aExtension(".xml"); if (aPath.endsWith(aExtension) && m_bUseLocalized) { - OUString aBase = aPath.copy(0, aPath.getLength() - aExtension.getLength()); + std::u16string_view aBase = aPath.subView(0, aPath.getLength() - aExtension.getLength()); const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); // Expected format is "_xx-XX.xml". - OUString aLocalized = aBase + "_" + rLanguageTag.getBcp47() + aExtension; + OUString aLocalized = OUString::Concat(aBase) + "_" + rLanguageTag.getBcp47() + aExtension; if (FStatHelper::IsDocument(aLocalized)) aPath = aLocalized; } diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 2e3e390c1785..ea3f63eee264 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -43,6 +43,7 @@ #include #include #include +#include // Our starmath tools #include @@ -840,8 +841,8 @@ SmLengthValue SmMLImportContext::handleLengthAttribute(const OUString& aAttribut } // Get value - OUString aValue = aAttribute.copy(0, nUnitPos); - double nValue = aValue.toDouble(); + std::u16string_view aValue = aAttribute.subView(0, nUnitPos); + double nValue = o3tl::toDouble(aValue); if (nValue == 0) { nUnit = SmLengthUnit::MlM; diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 7f0018350689..193184a60323 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -1275,7 +1275,7 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) for( auto& prop : Props) { sal_Int32 index= prop.indexOf( '='); - OUString propName= prop.copy( 0, index); + std::u16string_view propName= prop.subView( 0, index); OUString propValue= prop.copy( index + 1); if( propName == sFtpProxyHost) diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 38764729e33e..c6af0694fc83 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1323,20 +1324,20 @@ namespace svgio::svgreader if(rMimeType.startsWith("image")) { // image data - OUString aData(rCandidate.copy(nPos)); - static const char aStrBase64[] = "base64"; + std::u16string_view aData(rCandidate.subView(nPos)); + static constexpr std::u16string_view aStrBase64 = u"base64"; - if(aData.startsWith(aStrBase64)) + if(o3tl::starts_with(aData, aStrBase64)) { // base64 encoded - nPos = strlen(aStrBase64); - nLen = aData.getLength(); + nPos = aStrBase64.size(); + nLen = aData.size(); skip_char(aData, ' ', ',', nPos, nLen); if(nPos < nLen) { - rData = aData.copy(nPos); + rData = aData.substr(nPos); } } } diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index 2dc96ce1e0b2..65da2a851acf 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -445,9 +446,9 @@ void SdrTextObj::AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily fam SfxStyleFamily SdrTextObj::ReadFamilyFromStyleName(const OUString& styleName) { - OUString familyString = styleName.copy(styleName.getLength() - PADDING_LENGTH_FOR_STYLE_FAMILY); + std::u16string_view familyString = styleName.subView(styleName.getLength() - PADDING_LENGTH_FOR_STYLE_FAMILY); familyString = comphelper::string::stripEnd(familyString, PADDING_CHARACTER_FOR_STYLE_FAMILY); - sal_uInt16 nFam = static_cast(familyString.toInt32()); + sal_uInt16 nFam = static_cast(o3tl::toInt32(familyString)); assert(nFam != 0); return static_cast(nFam); } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 707c52b112da..b36eb09a5caa 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -378,65 +379,65 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c SvxShape* pShape = nullptr; SdrObjKind nType = SdrObjKind::Text; - OUString aTypeName = aServiceSpecifier.copy( aPackagePrefix.getLength() ); + std::u16string_view aTypeName = aServiceSpecifier.subView( aPackagePrefix.getLength() ); // create a shape wrapper - if( aTypeName.startsWith("TitleTextShape") ) + if( o3tl::starts_with(aTypeName, u"TitleTextShape") ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "OutlinerShape" ) ) + else if( o3tl::starts_with(aTypeName, u"OutlinerShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "SubtitleShape" ) ) + else if( o3tl::starts_with(aTypeName, u"SubtitleShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "GraphicObjectShape" ) ) + else if( o3tl::starts_with(aTypeName, u"GraphicObjectShape" ) ) { nType = SdrObjKind::Graphic; } - else if( aTypeName.startsWith( "PageShape" ) ) + else if( o3tl::starts_with(aTypeName, u"PageShape" ) ) { nType = SdrObjKind::Page; } - else if( aTypeName.startsWith( "OLE2Shape" ) ) + else if( o3tl::starts_with(aTypeName, u"OLE2Shape" ) ) { nType = SdrObjKind::OLE2; } - else if( aTypeName.startsWith( "ChartShape" ) ) + else if( o3tl::starts_with(aTypeName, u"ChartShape" ) ) { nType = SdrObjKind::OLE2; } - else if( aTypeName.startsWith( "OrgChartShape" ) ) + else if( o3tl::starts_with(aTypeName, u"OrgChartShape" ) ) { nType = SdrObjKind::OLE2; } - else if( aTypeName.startsWith( "NotesShape" ) ) + else if( o3tl::starts_with(aTypeName, u"NotesShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "HandoutShape" ) ) + else if( o3tl::starts_with(aTypeName, u"HandoutShape" ) ) { nType = SdrObjKind::Page; } - else if( aTypeName.startsWith( "FooterShape" ) ) + else if( o3tl::starts_with(aTypeName, u"FooterShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "HeaderShape" ) ) + else if( o3tl::starts_with(aTypeName, u"HeaderShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "SlideNumberShape" ) ) + else if( o3tl::starts_with(aTypeName, u"SlideNumberShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "DateTimeShape" ) ) + else if( o3tl::starts_with(aTypeName, u"DateTimeShape" ) ) { nType = SdrObjKind::Text; } - else if( aTypeName.startsWith( "TableShape" ) ) + else if( o3tl::starts_with(aTypeName, u"TableShape" ) ) { nType = SdrObjKind::Table; } diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index b209f23ac0d3..6bfb0432515b 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1665,14 +1665,14 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c } } - const OUString aShortString( rString.copy( 0, nLength ) ); + const std::u16string_view aShortString( rString.subView( 0, nLength ) ); for (int i = 0; i < nCount; ++i) { const OUString & aCompare = SvxResId(pSourceResIds[i]); if( aShortString == aCompare ) { - rString = rString.replaceAt( 0, aShortString.getLength(), OUString(pDestResIds[i]) ); + rString = rString.replaceAt( 0, aShortString.size(), OUString(pDestResIds[i]) ); return true; } else if( rString == aCompare ) @@ -1711,14 +1711,14 @@ static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSo } } - const OUString aShortString( rString.copy( 0, nLength ) ); + const std::u16string_view aShortString( rString.subView( 0, nLength ) ); for (int i = 0; i < nCount; ++i) { auto pCompare = pSourceResIds[i]; - if( aShortString == pCompare ) + if( aShortString == pCompare.asView() ) { - rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) ); + rString = rString.replaceAt( 0, aShortString.size(), SvxResId(pDestResIds[i]) ); return true; } else if( rString == pCompare ) diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index f8e3b5966f91..69c28dbbd09f 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -88,6 +88,7 @@ #include #include #include +#include #include #include @@ -3512,11 +3513,10 @@ sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel() sal_Int32 length = sValue.getLength(); if (length == 9 || length == 10) { - OUString headStr = sValue.copy(0, 7); - if (headStr == "Heading") + if (sValue.startsWith("Heading")) { - OUString intStr = sValue.copy(8); - sal_Int32 headingLevel = intStr.toInt32(); + std::u16string_view intStr = sValue.subView(8); + sal_Int32 headingLevel = o3tl::toInt32(intStr); return headingLevel; } } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 4132cbb1869b..4c6f2258dc57 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -713,9 +713,9 @@ SwCalcOper SwCalc::GetToken() } else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR ) { - OUString aName( m_sCommand.copy( nRealStt, + std::u16string_view aName( m_sCommand.subView( nRealStt, aRes.EndPos - nRealStt )); - if( 1 == aName.getLength() ) + if( 1 == aName.size() ) { bSetError = false; sal_Unicode ch = aName[0]; @@ -819,9 +819,9 @@ SwCalcOper SwCalc::GetToken() } else if( aRes.TokenType & KParseType::BOOLEAN ) { - OUString aName( m_sCommand.copy( nRealStt, + std::u16string_view aName( m_sCommand.subView( nRealStt, aRes.EndPos - nRealStt )); - if( !aName.isEmpty() ) + if( !aName.empty() ) { sal_Unicode ch = aName[0]; @@ -833,9 +833,9 @@ SwCalcOper SwCalc::GetToken() SwCalcOper eTmp2 = ('<' == ch) ? CALC_LEQ : CALC_GEQ; m_eCurrOper = ('<' == ch) ? CALC_LES : CALC_GRE; - if( 2 == aName.getLength() && '=' == aName[1] ) + if( 2 == aName.size() && '=' == aName[1] ) m_eCurrOper = eTmp2; - else if( 1 != aName.getLength() ) + else if( 1 != aName.size() ) bSetError = true; } } diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index c010a7c9aa49..175b50caba8e 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -461,12 +461,12 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS { bool bContinue = false; OUString sName( sItem.copy( 0, nPos ) ); - OUString sCmp( sItem.copy( nPos + 1 )); + std::u16string_view sCmp( sItem.subView( nPos + 1 )); sItem = rCC.lowercase( sItem ); FindItem aPara( sName ); - if( sCmp == "table" ) + if( sCmp == u"table" ) { sName = rCC.lowercase( sName ); for( const SwFrameFormat* pFormat : *m_rDoc.GetTableFrameFormats() ) @@ -481,7 +481,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS return true; } } - else if( sCmp == "frame" ) + else if( sCmp == u"frame" ) { const SwFlyFrameFormat* pFlyFormat = m_rDoc.FindFlyByName( sName ); if( pFlyFormat ) @@ -498,12 +498,12 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS } } } - else if( sCmp == "region" ) + else if( sCmp == u"region" ) { sItem = sName; // Is being dealt with further down! bContinue = true; } - else if( sCmp == "outline" ) + else if( sCmp == u"outline" ) { SwPosition aPos( SwNodeIndex( m_rDoc.GetNodes() )); if (m_rDoc.GotoOutline(aPos, sName, nullptr)) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 8d033cf28ab0..7b9f6b030970 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #ifdef DBG_UTIL @@ -1266,11 +1267,11 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, } // return the pointer of the box specified. -static bool lcl_IsValidRowName( const OUString& rStr ) +static bool lcl_IsValidRowName( std::u16string_view rStr ) { bool bIsValid = true; - sal_Int32 nLen = rStr.getLength(); - for( sal_Int32 i = 0; i < nLen && bIsValid; ++i ) + size_t nLen = rStr.size(); + for( size_t i = 0; i < nLen && bIsValid; ++i ) { const sal_Unicode cChar = rStr[i]; if (cChar < '0' || cChar > '9') @@ -1328,10 +1329,10 @@ sal_uInt16 SwTable::GetBoxNum( OUString& rStr, bool bFirstPart, else { nRet = 0; - const OUString aText( rStr.copy( 0, nPos ) ); + const std::u16string_view aText( rStr.subView( 0, nPos ) ); if ( !bPerformValidCheck || lcl_IsValidRowName( aText ) ) { - nRet = o3tl::narrowing(aText.toInt32()); + nRet = o3tl::narrowing(o3tl::toInt32(aText)); } rStr = rStr.copy( nPos+1 ); } diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index cabbad160e9d..b0195ff8d718 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -883,12 +883,12 @@ void SwTOXAuthority::FillText(SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt1 // Convert URL to a relative one if requested. SwDoc* pDoc = static_cast(m_rField.GetField()->GetTyp())->GetDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); - OUString aBaseURL = pDocShell->getDocumentBaseURL(); - OUString aBaseURIScheme; + const OUString aBaseURL = pDocShell->getDocumentBaseURL(); + std::u16string_view aBaseURIScheme; sal_Int32 nSep = aBaseURL.indexOf(':'); if (nSep != -1) { - aBaseURIScheme = aBaseURL.copy(0, nSep); + aBaseURIScheme = aBaseURL.subView(0, nSep); } uno::Reference xUriReferenceFactory diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 68223f742796..591a75431cc9 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3708,9 +3708,9 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, u""); Update( rStart, nLen - 1, true ); - OUString aTmpText( sInserted.copy(1) ); + std::u16string_view aTmpText( sInserted.subView(1) ); m_Text = m_Text.replaceAt(rStart.GetIndex(), 0, aTmpText); - Update( rStart, aTmpText.getLength() ); + Update( rStart, aTmpText.size() ); } else { diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 84da9ee071b4..edaa628c68f4 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1984,16 +1984,16 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel( if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9')) { OUString aRplc; - OUString aNew; + std::u16string_view aNew; if (bUseCol) { aRplc = "%COLUMNLETTER"; - aNew = aCellName.copy(0, pBuf - aCellName.getStr()); + aNew = aCellName.subView(0, pBuf - aCellName.getStr()); } else { aRplc = "%ROWNUMBER"; - aNew = OUString(pBuf, (aCellName.getStr() + nLen) - pBuf); + aNew = std::u16string_view(pBuf, (aCellName.getStr() + nLen) - pBuf); } aText = aText.replaceFirst( aRplc, aNew ); } diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 040914222d77..41912dac4881 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -1224,16 +1224,16 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector, if( SwHTMLWriter::HasScriptDependentItems( rItemSet, bHasClass ) ) { bScriptDependent = true; - OUString aSelector( rSelector ); + std::u16string_view aSelector( rSelector ); - OUString aPseudo; + std::u16string_view aPseudo; if( bCheckForPseudo ) { - sal_Int32 nPos = aSelector.lastIndexOf( ':' ); - if( nPos >= 0 ) + size_t nPos = aSelector.rfind( ':' ); + if( nPos != std::u16string_view::npos ) { - aPseudo = aSelector.copy( nPos ); - aSelector =aSelector.copy( 0, nPos ); + aPseudo = aSelector.substr( nPos ); + aSelector =aSelector.substr( 0, nPos ); } } @@ -1257,21 +1257,21 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector, aScriptItemSet( *rItemSet.GetPool() ); aScriptItemSet.Put( rItemSet ); - OUString aNewSelector = aSelector + ".western" + aPseudo; + OUString aNewSelector = OUString::Concat(aSelector) + ".western" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, false ); } - aNewSelector = aSelector + ".cjk" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + ".cjk" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, false ); } - aNewSelector = aSelector + ".ctl" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + ".ctl" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); @@ -1283,21 +1283,21 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector, // If there are script dependencies and we are derived from a tag, // when we have to export a style dependent class for all // scripts - OUString aNewSelector = aSelector + "-western" + aPseudo; + OUString aNewSelector = OUString::Concat(aSelector) + "-western" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, false ); } - aNewSelector = aSelector + "-cjk" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + "-cjk" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, false ); } - aNewSelector = aSelector + "-ctl" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + "-ctl" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, &aNewSelector ); @@ -1329,14 +1329,14 @@ static void OutCSS1DropCapRule( if( (bHasScriptDependencies && bHasClass) || (pDCCharFormat && SwHTMLWriter::HasScriptDependentItems( pDCCharFormat->GetAttrSet(), false ) ) ) { - OUString aSelector( rSelector ); + std::u16string_view aSelector( rSelector ); - OUString aPseudo; - sal_Int32 nPos = aSelector.lastIndexOf( ':' ); - if( nPos >= 0 ) + std::u16string_view aPseudo; + size_t nPos = aSelector.rfind( ':' ); + if( nPos != std::u16string_view::npos ) { - aPseudo = aSelector.copy( nPos ); - aSelector = aSelector.copy( 0, nPos ); + aPseudo = aSelector.substr( nPos ); + aSelector = aSelector.substr( 0, nPos ); } if( !bHasClass ) @@ -1358,21 +1358,21 @@ static void OutCSS1DropCapRule( if( pDCCharFormat ) aScriptItemSet.Set( pDCCharFormat->GetAttrSet() ); - OUString aNewSelector = aSelector + ".western" + aPseudo; + OUString aNewSelector = OUString::Concat(aSelector) + ".western" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet ); } - aNewSelector = aSelector + ".cjk" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + ".cjk" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet ); } - aNewSelector = aSelector + ".ctl" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + ".ctl" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); @@ -1384,21 +1384,21 @@ static void OutCSS1DropCapRule( // If there are script dependencies and we are derived from a tag, // when we have to export a style dependent class for all // scripts - OUString aNewSelector = aSelector + "-western" + aPseudo; + OUString aNewSelector = OUString::Concat(aSelector) + "-western" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop ); } - aNewSelector = aSelector + "-cjk" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + "-cjk" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop ); } - aNewSelector = aSelector + "-ctl" + aPseudo; + aNewSelector = OUString::Concat(aSelector) + "-ctl" + aPseudo; { SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP, &aNewSelector ); diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index b16455db07b0..a7aeb028c45e 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -179,15 +179,15 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) sal_Int32 nFound = sText.indexOf(cMarkSeparator); if( nFound != -1 && (++nFound) < sText.getLength() ) { - OUString sSuffix( sText.copy(nFound) ); - if( sSuffix == "table" || - sSuffix == "frame" || - sSuffix == "region" || - sSuffix == "outline" || - sSuffix == "text" || - sSuffix == "graphic" || - sSuffix == "ole" || - sSuffix == "drawingobject" ) + std::u16string_view sSuffix( sText.subView(nFound) ); + if( sSuffix == u"table" || + sSuffix == u"frame" || + sSuffix == u"region" || + sSuffix == u"outline" || + sSuffix == u"text" || + sSuffix == u"graphic" || + sSuffix == u"ole" || + sSuffix == u"drawingobject" ) sText = sText.copy( 0, nFound - 1); } // #i104300# diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index a9f13a02b2df..910fea4e1bf2 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2180,7 +2180,7 @@ auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName) return std::optional>(); } sal_uInt16 const indexType(rName[second + 1]); - OUString const indexName(rName.copy(second + 2)); + std::u16string_view const indexName(rName.subView(second + 2)); SwTOXType const* pType(nullptr); switch (indexType) { diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 1edfa5d52c26..af80d856daed 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -723,7 +723,7 @@ IMPL_LINK( SwView, ScrollHdl, ScrollBar *, p, void ) { sPageStr += " - "; sal_Int32 nChunkLen = std::min(aCnt.sStr.getLength(), 80); - OUString sChunk = aCnt.sStr.copy(0, nChunkLen); + std::u16string_view sChunk = aCnt.sStr.subView(0, nChunkLen); sPageStr = sChunk + sPageStr; sPageStr = sPageStr.replace('\t', ' '); sPageStr = sPageStr.replace(0x0a, ' '); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index b9cb5cab3db7..a5ce16dc8642 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -4007,7 +4007,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName) OUString sSuffix(m_sLinkSuffix); if(sParam.getLength() > sSuffix.getLength() ) { - OUString sCmp = sParam.copy(sParam.getLength() - sSuffix.getLength(), + std::u16string_view sCmp = sParam.subView(sParam.getLength() - sSuffix.getLength(), sSuffix.getLength()); if(sCmp == sSuffix) { @@ -4128,7 +4128,7 @@ sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName) OUString sParam(rName); if(sParam.getLength() > m_sLinkSuffix.getLength() ) { - OUString sCmp = sParam.copy(sParam.getLength() - m_sLinkSuffix.getLength(), + std::u16string_view sCmp = sParam.subView(sParam.getLength() - m_sLinkSuffix.getLength(), m_sLinkSuffix.getLength()); if(sCmp == m_sLinkSuffix) { @@ -4205,29 +4205,28 @@ void SwXLinkNameAccessWrapper::setPropertyValue( throw UnknownPropertyException(rPropName); } -static Any lcl_GetDisplayBitmap(const OUString& _sLinkSuffix) +static Any lcl_GetDisplayBitmap(std::u16string_view sLinkSuffix) { Any aRet; - OUString sLinkSuffix = _sLinkSuffix; - if(!sLinkSuffix.isEmpty()) - sLinkSuffix = sLinkSuffix.copy(1); + if(!sLinkSuffix.empty()) + sLinkSuffix = sLinkSuffix.substr(1); OUString sImgId; - if(sLinkSuffix == "outline") + if(sLinkSuffix == u"outline") sImgId = RID_BMP_NAVI_OUTLINE; - else if(sLinkSuffix == "table") + else if(sLinkSuffix == u"table") sImgId = RID_BMP_NAVI_TABLE; - else if(sLinkSuffix == "frame") + else if(sLinkSuffix == u"frame") sImgId = RID_BMP_NAVI_FRAME; - else if(sLinkSuffix == "graphic") + else if(sLinkSuffix == u"graphic") sImgId = RID_BMP_NAVI_GRAPHIC; - else if(sLinkSuffix == "ole") + else if(sLinkSuffix == u"ole") sImgId = RID_BMP_NAVI_OLE; - else if(sLinkSuffix.isEmpty()) + else if(sLinkSuffix.empty()) sImgId = RID_BMP_NAVI_BOOKMARK; - else if(sLinkSuffix == "region") + else if(sLinkSuffix == u"region") sImgId = RID_BMP_NAVI_REGION; - else if(sLinkSuffix == "drawingobject") + else if(sLinkSuffix == u"drawingobject") sImgId = RID_BMP_NAVI_DRAWOBJECT; if (!sImgId.isEmpty()) diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index be273f0a1955..d9048b39465d 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -223,8 +224,8 @@ void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFor else { sal_Int32 nStartOfNumber = nIndex + std::strlen("Grand total of errors in submitted package: "); - OUString aNumber = aContentOUString.copy(nStartOfNumber); - sal_Int32 nErrors = aNumber.toInt32(); + std::u16string_view aNumber = aContentOUString.subView(nStartOfNumber); + sal_Int32 nErrors = o3tl::toInt32(aNumber); OString aMsg = "validation error in OOXML export: Errors: " + OString::number(nErrors); if(nErrors) { diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 4d7a73999e7f..6b776ef38f31 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -646,10 +646,10 @@ std::unique_ptr INetURLObject::getData() const else if (sURLPath.matchIgnoreAsciiCase(";base64,", nCharactersSkipped)) { nCharactersSkipped += strlen(";base64,"); - OUString sBase64Data = sURLPath.copy( nCharactersSkipped ); + std::u16string_view sBase64Data = sURLPath.subView( nCharactersSkipped ); css::uno::Sequence< sal_Int8 > aDecodedData; if (comphelper::Base64::decodeSomeChars(aDecodedData, sBase64Data) - == sBase64Data.getLength()) + == static_cast(sBase64Data.size())) { return memoryStream( aDecodedData.getArray(), aDecodedData.getLength()); diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index 6bcfedd37c78..8dd120080133 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -119,9 +119,9 @@ namespace ucb::ucp::ext } else { - const OUString sRelativeURL( sURL.copy( ContentProvider::getRootURL().getLength() ) ); - const sal_Int32 nSepPos = sRelativeURL.indexOf( '/' ); - if ( ( nSepPos == -1 ) || ( nSepPos == sRelativeURL.getLength() - 1 ) ) + const std::u16string_view sRelativeURL( sURL.subView( ContentProvider::getRootURL().getLength() ) ); + const size_t nSepPos = sRelativeURL.find( '/' ); + if ( ( nSepPos == std::u16string_view::npos ) || ( nSepPos == sRelativeURL.size() - 1 ) ) { m_eExtContentType = E_EXTENSION_ROOT; } diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx index eac919e4099b..765ea7856517 100644 --- a/ucb/source/ucp/ext/ucpext_provider.cxx +++ b/ucb/source/ucp/ext/ucpext_provider.cxx @@ -80,11 +80,11 @@ namespace ucb::ucp::ext namespace { - void lcl_ensureAndTransfer( OUString& io_rIdentifierFragment, OUStringBuffer& o_rNormalization, const sal_Unicode i_nLeadingChar ) + void lcl_ensureAndTransfer( std::u16string_view& io_rIdentifierFragment, OUStringBuffer& o_rNormalization, const sal_Unicode i_nLeadingChar ) { - if ( ( io_rIdentifierFragment.isEmpty() ) || ( io_rIdentifierFragment[0] != i_nLeadingChar ) ) + if ( ( io_rIdentifierFragment.empty() ) || ( io_rIdentifierFragment[0] != i_nLeadingChar ) ) throw IllegalIdentifierException(); - io_rIdentifierFragment = io_rIdentifierFragment.copy( 1 ); + io_rIdentifierFragment = io_rIdentifierFragment.substr( 1 ); o_rNormalization.append( i_nLeadingChar ); } } @@ -105,14 +105,14 @@ namespace ucb::ucp::ext aComposer.append( sIdentifier.copy( 0, sScheme.getLength() ).toAsciiLowerCase() ); // one : is required after the scheme - OUString sRemaining( sIdentifier.copy( sScheme.getLength() ) ); + std::u16string_view sRemaining( sIdentifier.subView( sScheme.getLength() ) ); lcl_ensureAndTransfer( sRemaining, aComposer, ':' ); // and at least one / lcl_ensureAndTransfer( sRemaining, aComposer, '/' ); // the normalized form requires one additional /, but we also accept identifiers which don't have it - if ( sRemaining.isEmpty() ) + if ( sRemaining.empty() ) { // the root content is a special case, it requires / aComposer.append( "//" ); @@ -128,7 +128,7 @@ namespace ucb::ucp::ext { lcl_ensureAndTransfer( sRemaining, aComposer, '/' ); // by now, we moved "vnd.sun.star.extension://" from the URL to aComposer - if ( sRemaining.isEmpty() ) + if ( sRemaining.empty() ) { // again, it's the root content, but one / is missing aComposer.append( '/' ); diff --git a/ucb/source/ucp/tdoc/tdoc_uri.hxx b/ucb/source/ucp/tdoc/tdoc_uri.hxx index d54bac37c267..8a459c0aef12 100644 --- a/ucb/source/ucp/tdoc/tdoc_uri.hxx +++ b/ucb/source/ucp/tdoc/tdoc_uri.hxx @@ -99,7 +99,7 @@ inline bool Uri::isDocument() const { init(); return ( ( !m_aDocId.isEmpty() ) /* not root */ - && ( m_aPath.copy( m_aDocId.getLength() + 1 ).getLength() < 2 ) ); + && ( m_aPath.subView( m_aDocId.getLength() + 1 ).size() < 2 ) ); } } // namespace tdoc_ucp diff --git a/ucb/source/ucp/webdav-curl/CurlUri.cxx b/ucb/source/ucp/webdav-curl/CurlUri.cxx index fcd3b652063c..4dba6ac221b7 100644 --- a/ucb/source/ucp/webdav-curl/CurlUri.cxx +++ b/ucb/source/ucp/webdav-curl/CurlUri.cxx @@ -246,7 +246,7 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef) CURLUcode uc; if (indexFragment != -1) { - OUString const fragment(rRelativeRef.copy(indexFragment + 1)); + std::u16string_view const fragment(rRelativeRef.subView(indexFragment + 1)); indexEnd = indexFragment; OString const utf8Fragment(OUStringToOString(fragment, RTL_TEXTENCODING_UTF8)); uc = curl_url_set(pUrl.get(), CURLUPART_FRAGMENT, utf8Fragment.getStr(), 0); @@ -262,7 +262,8 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef) } if (indexQuery != -1 && (indexFragment == -1 || indexQuery < indexFragment)) { - OUString const query(rRelativeRef.copy(indexQuery + 1, indexEnd - indexQuery - 1)); + std::u16string_view const query( + rRelativeRef.subView(indexQuery + 1, indexEnd - indexQuery - 1)); indexEnd = indexQuery; OString const utf8Query(OUStringToOString(query, RTL_TEXTENCODING_UTF8)); uc = curl_url_set(pUrl.get(), CURLUPART_QUERY, utf8Query.getStr(), 0); @@ -276,7 +277,7 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef) SAL_WARN("ucb.ucp.webdav.curl", "curl_url_set failed: " << uc); throw DAVException(DAVException::DAV_INVALID_ARG); } - OUString const path(rRelativeRef.copy(0, indexEnd)); + std::u16string_view const path(rRelativeRef.subView(0, indexEnd)); OString const utf8Path(OUStringToOString(path, RTL_TEXTENCODING_UTF8)); uc = curl_url_set(pUrl.get(), CURLUPART_PATH, utf8Path.getStr(), 0); if (uc != CURLUE_OK) diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index cda6a05a52d6..409c58ff2d49 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -92,7 +92,7 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM int separatorPos = rData["data"].indexOf(';'); if (separatorPos > 0) { - OUString entryPos = rData["data"].copy(0, separatorPos); + std::u16string_view entryPos = rData["data"].subView(0, separatorPos); OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US); int pos = std::atoi(posString.getStr()); pCombobox->set_active(pos); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 7d3662d0604d..cdf7a360a6ca 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2150,7 +2150,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, if ( nFirstContent < nLastContent ) { - OUString aTempLastStr = aStr.copy( nLastContent ); + std::u16string_view aTempLastStr = aStr.subView( nLastContent ); aTempStr = aFirstStr + aTempLastStr; if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth ) diff --git a/vcl/source/pdf/PDFiumTools.cxx b/vcl/source/pdf/PDFiumTools.cxx index 4fe465426201..28fa53b837e1 100644 --- a/vcl/source/pdf/PDFiumTools.cxx +++ b/vcl/source/pdf/PDFiumTools.cxx @@ -17,45 +17,45 @@ OUString convertPdfDateToISO8601(OUString const& rInput) if (rInput.getLength() < 6) return {}; - OUString prefix = rInput.copy(0, 2); - if (prefix != "D:") + std::u16string_view prefix = rInput.subView(0, 2); + if (prefix != u"D:") return {}; - OUString sYear = rInput.copy(2, 4); + std::u16string_view sYear = rInput.subView(2, 4); - OUString sMonth("01"); + std::u16string_view sMonth(u"01"); if (rInput.getLength() >= 8) - sMonth = rInput.copy(6, 2); + sMonth = rInput.subView(6, 2); - OUString sDay("01"); + std::u16string_view sDay(u"01"); if (rInput.getLength() >= 10) - sDay = rInput.copy(8, 2); + sDay = rInput.subView(8, 2); - OUString sHours("00"); + std::u16string_view sHours(u"00"); if (rInput.getLength() >= 12) - sHours = rInput.copy(10, 2); + sHours = rInput.subView(10, 2); - OUString sMinutes("00"); + std::u16string_view sMinutes(u"00"); if (rInput.getLength() >= 14) - sMinutes = rInput.copy(12, 2); + sMinutes = rInput.subView(12, 2); - OUString sSeconds("00"); + std::u16string_view sSeconds(u"00"); if (rInput.getLength() >= 16) - sSeconds = rInput.copy(14, 2); + sSeconds = rInput.subView(14, 2); OUString sTimeZoneMark("Z"); if (rInput.getLength() >= 17) - sTimeZoneMark = rInput.copy(16, 1); + sTimeZoneMark = rInput.subView(16, 1); - OUString sTimeZoneHours("00"); - OUString sTimeZoneMinutes("00"); + std::u16string_view sTimeZoneHours(u"00"); + std::u16string_view sTimeZoneMinutes(u"00"); if ((sTimeZoneMark == "+" || sTimeZoneMark == "-") && rInput.getLength() >= 22) { - OUString sTimeZoneSeparator = rInput.copy(19, 1); - if (sTimeZoneSeparator == "'") + std::u16string_view sTimeZoneSeparator = rInput.subView(19, 1); + if (sTimeZoneSeparator == u"'") { - sTimeZoneHours = rInput.copy(17, 2); - sTimeZoneMinutes = rInput.copy(20, 2); + sTimeZoneHours = rInput.subView(17, 2); + sTimeZoneMinutes = rInput.subView(20, 2); } } @@ -65,8 +65,8 @@ OUString convertPdfDateToISO8601(OUString const& rInput) else if (sTimeZoneMark == "Z") sTimeZoneString = sTimeZoneMark; - return sYear + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":" + sSeconds - + sTimeZoneString; + return OUString::Concat(sYear) + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":" + + sSeconds + sTimeZoneString; } } // end vcl::pdf diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 0a2ad6dc0df3..91594957d66b 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -5609,7 +5609,7 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon pThis->m_pFrame->CallCallback(SalEvent::SurroundingTextRequest, &aEvt); OString sUTF = OUStringToOString(aEvt.maText, RTL_TEXTENCODING_UTF8); - OUString sCursorText(aEvt.maText.copy(0, aEvt.mnStart)); + std::u16string_view sCursorText(aEvt.maText.subView(0, aEvt.mnStart)); gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(), OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength()); return true; diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index ca8c893d3915..d499cf0168f9 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17946,7 +17946,7 @@ public: if (nCursorIndex != -1) { OString sUTF = OUStringToOString(sSurroundingText, RTL_TEXTENCODING_UTF8); - OUString sCursorText(sSurroundingText.copy(0, nCursorIndex)); + std::u16string_view sCursorText(sSurroundingText.subView(0, nCursorIndex)); gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(), OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength()); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b59b9eac066f..d6fe9acc67da 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5488,13 +5488,15 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext) if (nEnd <= nIndex) return; - OUString sRubyParts = rCommand.copy(nIndex+1,nEnd-nIndex-1); + std::u16string_view sRubyParts = rCommand.subView(nIndex+1,nEnd-nIndex-1); nIndex = 0; - OUString sPart1 = sRubyParts.getToken(0, ',', nIndex); - OUString sPart2 = sRubyParts.getToken(0, ',', nIndex); - if ((nIndex = sPart1.indexOf('(')) != -1 && (nEnd = sPart1.lastIndexOf(')'))!=-1 && nEnd > nIndex) + std::u16string_view sPart1 = o3tl::getToken(sRubyParts, 0, ',', nIndex); + std::u16string_view sPart2 = o3tl::getToken(sRubyParts, 0, ',', nIndex); + size_t nIndex2 = 0; + size_t nEnd2 = 0; + if ((nIndex2 = sPart1.find('(')) != std::u16string_view::npos && (nEnd2 = sPart1.rfind(')')) != std::u16string_view::npos && nEnd2 > nIndex2) { - aInfo.sRubyText = sPart1.copy(nIndex+1,nEnd-nIndex-1); + aInfo.sRubyText = sPart1.substr(nIndex2+1,nEnd2-nIndex2-1); } PropertyMapPtr pRubyContext(new PropertyMap()); @@ -5518,7 +5520,7 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext) if ( aInfo.nRubyAlign == NS_ooxml::LN_Value_ST_RubyAlign_rightVertical ) pCharContext->Insert(PROP_RUBY_POSITION, uno::makeAny(css::text::RubyPosition::INTER_CHARACTER)); pCharContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle)); - appendTextPortion(sPart2, pCharContext); + appendTextPortion(OUString(sPart2), pCharContext); } diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index aa35c03351db..44bbc725137c 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -488,15 +488,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int32 nCharIndex = 0; // Character index do { - OUString aToken = rProperty.second.getToken(0, ';', nCharIndex); + std::u16string_view aToken = o3tl::getToken(rProperty.second, 0, ';', nCharIndex); if (!nSize) - nSize = aToken.toInt32(); + nSize = o3tl::toInt32(aToken); else if (!nCount) - nCount = aToken.toInt32(); - else if (aToken.getLength()) + nCount = o3tl::toInt32(aToken); + else if (!aToken.empty()) { // The coordinates are in an (x,y) form. - aToken = aToken.copy(1, aToken.getLength() - 2); + aToken = aToken.substr(1, aToken.size() - 2); sal_Int32 nI = 0; sal_Int32 nX = o3tl::toInt32(o3tl::getToken(aToken, 0, ',', nI)); sal_Int32 nY @@ -835,15 +835,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int32 nCharIndex = 0; // Character index do { - OUString aToken = rProperty.second.getToken(0, ';', nCharIndex); + std::u16string_view aToken = o3tl::getToken(rProperty.second, 0, ';', nCharIndex); if (!nSize) - nSize = aToken.toInt32(); + nSize = o3tl::toInt32(aToken); else if (!nCount) - nCount = aToken.toInt32(); - else if (aToken.getLength()) + nCount = o3tl::toInt32(aToken); + else if (!aToken.empty()) { // The coordinates are in an (x,y) form. - aToken = aToken.copy(1, aToken.getLength() - 2); + aToken = aToken.substr(1, aToken.size() - 2); sal_Int32 nI = 0; sal_Int32 nX = o3tl::toInt32(o3tl::getToken(aToken, 0, ',', nI)); sal_Int32 nY diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 5eb9e6420b00..493618621c46 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -380,9 +380,9 @@ bool URLParameter::scheme() if( m_aExpr.startsWith("vnd.sun.star.help:///") ) { sal_Int32 nLen = m_aExpr.getLength(); - OUString aLastStr = - m_aExpr.copy(sal::static_int_cast(nLen) - 6); - if( aLastStr == "DbPAR=" ) + std::u16string_view aLastStr = + m_aExpr.subView(sal::static_int_cast(nLen) - 6); + if( aLastStr == u"DbPAR=" ) { m_aExpr = OUString::Concat(m_aExpr.subView( 0, 20 )) + "shared" + diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index d7dd36714dea..60e207d109ea 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -500,8 +501,8 @@ TVChildTarget::SearchAndInsert(std::unique_ptr p, TVDom* tvDom) Any SAL_CALL TVChildTarget::getByName( const OUString& aName ) { - OUString num( aName.copy( 2, aName.getLength()-4 ) ); - sal_Int32 idx = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) ); + sal_Int32 idx = o3tl::toInt32(num) - 1; if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) ) throw NoSuchElementException(); @@ -523,8 +524,8 @@ TVChildTarget::getElementNames( ) sal_Bool SAL_CALL TVChildTarget::hasByName( const OUString& aName ) { - OUString num( aName.copy( 2, aName.getLength()-4 ) ); - sal_Int32 idx = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) ); + sal_Int32 idx = o3tl::toInt32(num) - 1; if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) ) return false; @@ -540,8 +541,8 @@ TVChildTarget::getByHierarchicalName( const OUString& aName ) if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( aName.copy( 2, idx-4 ) ); - sal_Int32 pref = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, idx-4 ) ); + sal_Int32 pref = o3tl::toInt32(num) - 1; if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) ) throw NoSuchElementException(); @@ -559,8 +560,8 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName ) if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( aName.copy( 2, idx-4 ) ); - sal_Int32 pref = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, idx-4 ) ); + sal_Int32 pref = o3tl::toInt32(num) - 1; if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) ) return false; diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx index cac2196a3e28..2294af680010 100644 --- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx +++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx @@ -330,8 +330,8 @@ void OOXMLSecExporter::Impl::writePackageObjectSignatureProperties() sal_Int32 nCommaPos = m_aSignatureTimeValue.indexOf(','); if (nCommaPos != -1) { - m_aSignatureTimeValue = m_aSignatureTimeValue.copy(0, nCommaPos); - m_aSignatureTimeValue += "Z"; + m_aSignatureTimeValue + = OUString::Concat(m_aSignatureTimeValue.subView(0, nCommaPos)) + "Z"; } } m_xDocumentHandler->characters(m_aSignatureTimeValue); -- cgit