diff options
85 files changed, 359 insertions, 322 deletions
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 6489d88d8339..23185e0ee847 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -184,13 +184,13 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any if( comphelper::string::getTokenCount(aMacro, '.') == 3 ) { sal_Int32 nLast = 0; - OUString aFullLibName = aMacro.getToken( 0, '.', nLast ); + std::u16string_view aFullLibName = o3tl::getToken(aMacro, 0, '.', nLast ); - sal_Int32 nIndex = aFullLibName.indexOf( ':' ); - if (nIndex >= 0) + size_t nIndex = aFullLibName.find( ':' ); + if (nIndex != std::u16string_view::npos) { - aLocation = aFullLibName.copy( 0, nIndex ); - aLibName = aFullLibName.copy( nIndex + 1 ); + aLocation = aFullLibName.substr( 0, nIndex ); + aLibName = aFullLibName.substr( nIndex + 1 ); } aMacro = aMacro.copy( nLast ); diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx index 206446a81d0c..f36ca6431c8e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx @@ -33,6 +33,7 @@ #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <typelib/typedescription.h> +#include <o3tl/string_view.hxx> #include "rtti.hxx" #include "share.hxx" @@ -118,8 +119,8 @@ std::type_info * RTTI::getRTTI(typelib_TypeDescription const & pTypeDescr) sal_Int32 index = 0; do { - OUString token( unoName.getToken( 0, '.', index ) ); - buf.append( token.getLength() ); + std::u16string_view token( o3tl::getToken(unoName, 0, '.', index ) ); + buf.append( static_cast<sal_Int32>(token.size()) ); OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) ); buf.append( c_token ); } diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index afc3b907828d..c5cea4c5b6cd 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/frame/CommandGroup.hpp> #include <o3tl/unsafe_downcast.hxx> +#include <o3tl/string_view.hxx> #include <vcl/svapp.hxx> #include <svl/itempool.hxx> #include <editeng/eeitem.hxx> @@ -534,8 +535,8 @@ bool DrawCommandDispatch::parseCommandURL( const OUString& rCommandURL, sal_uInt OUString aType; sal_Int32 nIndex = std::min(sal_Int32(1), rCommandURL.getLength()); - OUString aToken = rCommandURL.getToken( 0, '.', nIndex ); - if ( nIndex == -1 || aToken.isEmpty() ) + std::u16string_view aToken = o3tl::getToken(rCommandURL, 0, '.', nIndex ); + if ( nIndex == -1 || aToken.empty() ) { aBaseCommand = rCommandURL; SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand ); diff --git a/comphelper/source/misc/servicedecl.cxx b/comphelper/source/misc/servicedecl.cxx index 2b16539d1a55..60143d9b6684 100644 --- a/comphelper/source/misc/servicedecl.cxx +++ b/comphelper/source/misc/servicedecl.cxx @@ -23,6 +23,7 @@ #include <rtl/string.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/sequence.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <cassert> #include <vector> diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx index d1170fdd972b..99327f27eeb5 100644 --- a/connectivity/source/commontools/AutoRetrievingBase.cxx +++ b/connectivity/source/commontools/AutoRetrievingBase.cxx @@ -20,6 +20,7 @@ #include <AutoRetrievingBase.hxx> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> namespace connectivity { @@ -39,7 +40,7 @@ namespace connectivity { // we need a table name sal_Int32 nIntoIndex = sStmt.indexOf("INTO ") + 5; while (nIntoIndex<sStmt.getLength() && sStmt[nIntoIndex]==' ') ++nIntoIndex; - const OUString sTableName = sStmt.getToken(0, ' ', nIntoIndex); + const std::u16string_view sTableName = o3tl::getToken(sStmt, 0, ' ', nIntoIndex); return m_sGeneratedValueStatement.replaceAt(nTableIndex, strlen(sTable), sTableName); } return m_sGeneratedValueStatement; diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index dd7342419d61..bd6be38d7bc2 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -265,8 +265,8 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirs if (bNumeric && cThousandDelimiter) { // Is the delimiter correct? - const OUString aValue = aField2.getToken(0,cDecimalDelimiter); - for( sal_Int32 j = aValue.getLength() - 4; j >= 0; j -= 4) + const std::u16string_view aValue = o3tl::getToken(aField2, 0, cDecimalDelimiter); + for( sal_Int32 j = static_cast<sal_Int32>(aValue.size()) - 4; j >= 0; j -= 4) { const sal_Unicode c = aValue[j]; // just digits, decimal- and thousands-delimiter? diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index fd1f81253fa9..7da57d1b675c 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -2086,45 +2086,45 @@ namespace OUString nameB; a[0 /*TYPE_NAME*/] >>= nameA; b[0 /*TYPE_NAME*/] >>= nameB; - OUString nsA, tnA, nsB, tnB; + std::u16string_view nsA, tnA, nsB, tnB; // parse typename into schema and typename sal_Int32 nIndex=0; - nsA = nameA.getToken(0, '.', nIndex); + nsA = o3tl::getToken(nameA, 0, '.', nIndex); if (nIndex<0) { tnA = nsA; - nsA.clear(); + nsA = std::u16string_view(); } else { - tnA = nameA.getToken(0, '.', nIndex); + tnA = o3tl::getToken(nameA, 0, '.', nIndex); assert(nIndex < 0); } nIndex=0; - nsB = nameB.getToken(0, '.', nIndex); + nsB = o3tl::getToken(nameB, 0, '.', nIndex); if (nIndex<0) { tnB = nsB; - nsB.clear(); + nsB = std::u16string_view(); } else { - tnB = nameB.getToken(0, '.', nIndex); + tnB = o3tl::getToken(nameB, 0, '.', nIndex); assert(nIndex < 0); } const int ns_comp = compare_schema(nsA, nsB); if(ns_comp == 0) { - if(nsA.isEmpty()) + if(nsA.empty()) { - assert(nsB.isEmpty()); + assert(nsB.empty()); // within each type category, sort privileged choice first - if( tnA == "int4" || tnA == "varchar" || tnA == "char" || tnA == "text") + if( tnA == u"int4" || tnA == u"varchar" || tnA == u"char" || tnA == u"text") return true; - if( tnB == "int4" || tnB == "varchar" || tnB == "char" || tnB == "text") + if( tnB == u"int4" || tnB == u"varchar" || tnB == u"char" || tnB == u"text") return false; } return nameA.compareTo( nameB ) < 0; diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 8c0a902b782d..12167739da8d 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -1829,7 +1829,7 @@ void cppuhelper::ServiceManager::preloadImplementations() { OUString aDisable(pDisable, strlen(pDisable), RTL_TEXTENCODING_UTF8); for (sal_Int32 i = 0; i >= 0; ) { - OUString tok = aDisable.getToken(0, ' ', i); + OUString tok( aDisable.getToken(0, ' ', i) ); tok = tok.trim(); if (!tok.isEmpty()) aDisabled.push_back(tok); diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index b270c62c5cb4..56e830e7ee26 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -39,6 +39,7 @@ #include <sal/log.hxx> #include <uno/environment.hxx> #include <uno/mapping.hxx> +#include <o3tl/string_view.hxx> #include "loadsharedlibcomponentfactory.hxx" diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx index c601d051ea11..9fb71562160a 100644 --- a/cui/source/customize/CustomNotebookbarGenerator.cxx +++ b/cui/source/customize/CustomNotebookbarGenerator.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/frame/ModuleManager.hpp> #include <unotools/confignode.hxx> #include <libxml/parser.h> +#include <o3tl/string_view.hxx> #define aUIPropertiesCount 3 @@ -187,7 +188,7 @@ void CustomNotebookbarGenerator::modifyCustomizedUIFile(const Sequence<OUString> for (sal_Int32 aIndex = 0; aIndex < aUIPropertiesCount; aIndex++) { sal_Int32 nPos = aIndex; - OUString sToken = aValue.getToken(nPos, ',', nPos); + std::u16string_view sToken = o3tl::getToken(aValue, nPos, ',', nPos); aProperties[aIndex] = OUStringToOString(sToken, RTL_TEXTENCODING_UTF8); } xmlDocPtr doc = notebookbarXMLParser(sCustomizedUIPath, aProperties[0], aProperties[1], diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index 9c80960c669e..99c15b8f3ca9 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -482,7 +482,7 @@ static void EditRegistryFile(std::u16string_view sUIItemId, const OUString& sSet for (int nIdx = 0; nIdx < aOldEntries.getLength(); nIdx++) { sal_Int32 rPos = 0; - OUString sFirstValue = aOldEntries[nIdx].getToken(rPos, ',', rPos); + std::u16string_view sFirstValue = o3tl::getToken(aOldEntries[nIdx], rPos, ',', rPos); if (sFirstValue == sUIItemId) { aOldEntries.getArray()[nIdx] = sSetEntry; diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index f7c2ac340c64..eacae26399aa 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -50,6 +50,7 @@ #include <comphelper/SetFlagContextHelper.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/processfactory.hxx> +#include <o3tl/string_view.hxx> #include <svtools/imagemgr.hxx> #include <tools/urlobj.hxx> @@ -1048,7 +1049,7 @@ void SvxScriptOrgDialog::RestorePreviousSelection() sal_Int32 nIndex = 0; while (nIndex != -1) { - OUString aTmp( aStoredEntry.getToken( 0, ';', nIndex ) ); + std::u16string_view aTmp( o3tl::getToken(aStoredEntry, 0, ';', nIndex ) ); bool bTmpEntry; if (!xEntry) diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 6cd26a097a6c..314a039afb3e 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -8,6 +8,7 @@ */ #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include "optaboutconfig.hxx" #include <comphelper/processfactory.hxx> diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 4d9359534f06..18c3e32a1deb 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -363,7 +363,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void) do { bool bFound = false; - const OUString sOnePath = aOldPath.getToken( 0, MULTIPATH_DELIMITER, nOldPos ); + const std::u16string_view sOnePath = o3tl::getToken(aOldPath, 0, MULTIPATH_DELIMITER, nOldPos ); if ( !sInternal.isEmpty() ) { sal_Int32 nInternalPos = 0; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index ebdb55ad06da..215e59b38a58 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -53,6 +53,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <svx/svxids.hrc> +#include <o3tl/string_view.hxx> #include <algorithm> #include <memory> @@ -899,7 +900,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi return; OUString aPath = SvtPathOptions().GetGalleryPath(); - OUString aPathToken = aPath.getToken( 1 , SEARCHPATH_DELIMITER ); + std::u16string_view aPathToken = o3tl::getToken(aPath, 1 , SEARCHPATH_DELIMITER ); OUString aUserImageURL = aFileDialog.GetPath(); @@ -910,7 +911,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi else if (nPos<aUserImageURL.getLength()) aFileName = aUserImageURL.copy(nPos); - OUString aUserGalleryURL = aPathToken + "/" + aFileName; + OUString aUserGalleryURL = OUString::Concat(aPathToken) + "/" + aFileName; INetURLObject aURL( aUserImageURL ); DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 0af1f29c3702..3cc758acdb28 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -852,10 +852,10 @@ IMPL_LINK_NOARG( OApplicationController, OnAsyncDrop, void*, void ) std::vector< OUString> aList; sal_Int32 nIndex = 0; OUString sName = xContent->getIdentifier()->getContentIdentifier(); - OUString sErase = sName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part + std::u16string_view sErase = o3tl::getToken(sName,0,'/',nIndex); // we don't want to have the "private:forms" part if ( nIndex != -1 ) { - aList.push_back(sName.copy(sErase.getLength() + 1)); + aList.push_back(sName.copy(sErase.size() + 1)); deleteObjects( m_aAsyncDrop.nType, aList, false ); } } diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 3e0e3afa2b4b..c2917a6300e0 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -312,7 +312,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont, Color &_rTextColor) while( nPos != -1 ) { // list of fonts, VCL: semicolon as separator, HTML: comma - OUString aFName = rFace.getToken( 0, ',', nPos ); + std::u16string_view aFName = o3tl::getToken(rFace, 0, ',', nPos ); aFName = comphelper::string::strip(aFName, ' '); if( !aFontName.isEmpty() ) aFontName.append(";"); diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 2b557f7507f9..fb6b0bfcb804 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <comphelper/string.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <rtl/bootstrap.hxx> diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index b885bbd310c2..13e490f87b7f 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -428,7 +428,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) // handle empty strings. while( nIdx>=0 && nIdx<aText.getLength() ) { - OUString aStr = aText.getToken( 0, '\x0A', nIdx ); + std::u16string_view aStr = o3tl::getToken(aText, 0, '\x0A', nIdx ); sal_Int16 nCurDepth; if( nPos ) @@ -445,11 +445,11 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) ( GetOutlinerMode() == OutlinerMode::OutlineView ) ) { // Extract Tabs - sal_Int32 nTabs = 0; - while ( ( nTabs < aStr.getLength() ) && ( aStr[nTabs] == '\t' ) ) + size_t nTabs = 0; + while ( ( nTabs < aStr.size() ) && ( aStr[nTabs] == '\t' ) ) nTabs++; if ( nTabs ) - aStr = aStr.copy(nTabs); + aStr = aStr.substr(nTabs); // Keep depth? (see Outliner::Insert) if( !(pPara->nFlags & ParaFlag::HOLDDEPTH) ) @@ -463,13 +463,13 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) if( nPos ) // not with the first paragraph { pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nInsPos ); - pEditEngine->InsertParagraph( nInsPos, aStr ); + pEditEngine->InsertParagraph( nInsPos, OUString(aStr) ); ParagraphInsertedHdl(pPara); } else { nInsPos--; - pEditEngine->SetText( nInsPos, aStr ); + pEditEngine->SetText( nInsPos, OUString(aStr) ); } ImplInitDepth( nInsPos, nCurDepth, false ); nInsPos++; diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 546b16e054ee..82c08e007276 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -52,6 +52,7 @@ #include "bibconfig.hxx" #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -174,7 +175,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString m_pBibMod = OpenBibModul(); - OUString aPartName = rURL.getToken( 1, '/' ); + std::u16string_view aPartName = o3tl::getToken(rURL, 1, '/' ); Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY); if(xPrSet.is()) { @@ -182,7 +183,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString aTitle <<= BibResId(RID_BIB_STR_FRAME_TITLE); xPrSet->setPropertyValue("Title", aTitle); } - if(aPartName == "View" || aPartName == "View1") + if(aPartName == u"View" || aPartName == u"View1") { loadView(rFrame, rListener); } diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 5bbf1c44735f..03f72587e1b2 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -19,6 +19,7 @@ #include "eschesdo.hxx" #include <o3tl/any.hxx> +#include <o3tl/string_view.hxx> #include <svx/svdxcgv.hxx> #include <svx/svdomedia.hxx> #include <svx/xflftrit.hxx> @@ -929,16 +930,16 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart, if ( !bIsMapped && comphelper::string::getTokenCount(aArrowStartName, ' ') == 2 ) { sal_Int32 nIdx{ 0 }; - OUString aArrowName( aArrowStartName.getToken( 0, ' ', nIdx ) ); - if ( aArrowName == "msArrowEnd" ) + std::u16string_view aArrowName( o3tl::getToken(aArrowStartName, 0, ' ', nIdx ) ); + if ( aArrowName == u"msArrowEnd" ) reLineEnd = ESCHER_LineArrowEnd; - else if ( aArrowName == "msArrowOpenEnd" ) + else if ( aArrowName == u"msArrowOpenEnd" ) reLineEnd = ESCHER_LineArrowOpenEnd; - else if ( aArrowName == "msArrowStealthEnd" ) + else if ( aArrowName == u"msArrowStealthEnd" ) reLineEnd = ESCHER_LineArrowStealthEnd; - else if ( aArrowName == "msArrowDiamondEnd" ) + else if ( aArrowName == u"msArrowDiamondEnd" ) reLineEnd = ESCHER_LineArrowDiamondEnd; - else if ( aArrowName == "msArrowOvalEnd" ) + else if ( aArrowName == u"msArrowOvalEnd" ) reLineEnd = ESCHER_LineArrowOvalEnd; else nIdx = -1; @@ -946,8 +947,8 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart, // now we have the arrow, and try to determine the arrow size; if ( nIdx>0 ) { - OUString aArrowSize( aArrowStartName.getToken( 0, ' ', nIdx ) ); - sal_Int32 nArrowSize = aArrowSize.toInt32(); + std::u16string_view aArrowSize = o3tl::getToken(aArrowStartName, 0, ' ', nIdx ); + sal_Int32 nArrowSize = o3tl::toInt32(aArrowSize); rnArrowWidth = ( nArrowSize - 1 ) / 3; rnArrowLength = nArrowSize - ( rnArrowWidth * 3 ) - 1; } diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 7747c9a0ecd1..a01db3452b10 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -10,6 +10,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/lang/Locale.hpp> #include <rtl/ustring.hxx> +#include <comphelper/string.hxx> #include <unotools/fontcvt.hxx> #include <unotools/fontdefs.hxx> #include <vcl/BitmapPalette.hxx> @@ -485,10 +486,10 @@ bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* pFrom, sal_Int32* pTo, sal const OUString sParams( GetResult() ); sal_Int32 nIndex = 0; - const OUString sStart( sParams.getToken(0, '-', nIndex) ); + const std::u16string_view sStart = o3tl::getToken(sParams, 0, '-', nIndex); if (nIndex>=0) { - nStart = sStart.toInt32(); + nStart = o3tl::toInt32(sStart); nEnd = o3tl::toInt32(sParams.subView(nIndex)); } } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 44a3fdca23ab..a7addbb10121 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -2267,10 +2267,10 @@ void SvtFileDialog::appendDefaultExtension(OUString& rFileName, { if (nPos+1<aType.getLength() && aType[nPos]=='*') // take care of a leading * ++nPos; - const OUString aExt(aType.getToken( 0, FILEDIALOG_DEF_EXTSEP, nPos )); - if (aExt.isEmpty()) + const std::u16string_view aExt(o3tl::getToken(aType, 0, FILEDIALOG_DEF_EXTSEP, nPos )); + if (aExt.empty()) continue; - if (aTemp.endsWith(aExt)) + if (o3tl::ends_with(aTemp, aExt)) return; } while (nPos>=0); diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index b2117081c1b1..971b3b935d36 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -51,6 +51,7 @@ #include <svtools/acceleratorexecute.hxx> #include <sal/log.hxx> #include <rtl/ustrbuf.hxx> +#include <o3tl/string_view.hxx> constexpr OUStringLiteral PRESET_DEFAULT = u"default"; constexpr OUStringLiteral TARGET_CURRENT = u"current"; @@ -1009,8 +1010,8 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css: css::awt::KeyEvent aKeyEvent; sal_Int32 nIndex = 0; - OUString sKeyCommand = sKey.getToken(0, '_', nIndex); - aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode("KEY_" + sKeyCommand); + std::u16string_view sKeyCommand = o3tl::getToken(sKey, 0, '_', nIndex); + aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode(OUString::Concat("KEY_") + sKeyCommand); const sal_Int32 nToken = 4; bool bValid = true; @@ -1020,20 +1021,20 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css: if (nIndex < 0) break; - OUString sToken = sKey.getToken(0, '_', nIndex); - if (sToken.isEmpty()) + std::u16string_view sToken = o3tl::getToken(sKey, 0, '_', nIndex); + if (sToken.empty()) { bValid = false; break; } - if ( sToken == "SHIFT" ) + if ( sToken == u"SHIFT" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT; - else if ( sToken == "MOD1" ) + else if ( sToken == u"MOD1" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1; - else if ( sToken == "MOD2" ) + else if ( sToken == u"MOD2" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2; - else if ( sToken == "MOD3" ) + else if ( sToken == u"MOD3" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3; else { @@ -1219,11 +1220,10 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const OUString& sPrimarySe } css::awt::KeyEvent aKeyEvent; - OUString sKeyIdentifier; sal_Int32 nIndex = 0; - sKeyIdentifier = sKey.getToken(0, '_', nIndex); - aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode("KEY_"+sKeyIdentifier); + std::u16string_view sKeyIdentifier = o3tl::getToken(sKey, 0, '_', nIndex); + aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode(OUString::Concat("KEY_") + sKeyIdentifier); const int nToken = 4; for (sal_Int32 i = 0; i < nToken; ++i) @@ -1231,14 +1231,14 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const OUString& sPrimarySe if ( nIndex < 0 ) break; - OUString sToken = sKey.getToken(0, '_', nIndex); - if ( sToken == "SHIFT" ) + std::u16string_view sToken = o3tl::getToken(sKey, 0, '_', nIndex); + if ( sToken == u"SHIFT" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT; - else if ( sToken == "MOD1" ) + else if ( sToken == u"MOD1" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1; - else if ( sToken == "MOD2" ) + else if ( sToken == u"MOD2" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2; - else if ( sToken == "MOD3" ) + else if ( sToken == u"MOD3" ) aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3; } diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index ac7a10b90142..eb7e72affabe 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/compbase.hxx> +#include <comphelper/string.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/propertysequence.hxx> @@ -636,11 +637,11 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU if ( a >>= aString ) { sal_Int32 nToken( 0 ); - OUString aXStr = aString.getToken( 0, ',', nToken ); + std::u16string_view aXStr = o3tl::getToken(aString, 0, ',', nToken ); if ( nToken > 0 ) { css::awt::Point aPos; - aPos.X = aXStr.toInt32(); + aPos.X = o3tl::toInt32(aXStr); aPos.Y = o3tl::toInt32(o3tl::getToken(aString, 0, ',', nToken )); if ( i == PROPERTY_POS ) @@ -668,11 +669,11 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU if ( a >>= aString ) { sal_Int32 nToken( 0 ); - OUString aStr = aString.getToken( 0, ',', nToken ); + std::u16string_view aStr = o3tl::getToken(aString, 0, ',', nToken ); if ( nToken > 0 ) { css::awt::Size aSize; - aSize.Width = aStr.toInt32(); + aSize.Width = o3tl::toInt32(aStr); aSize.Height = o3tl::toInt32(o3tl::getToken(aString, 0, ',', nToken )); if ( i == PROPERTY_SIZE ) { @@ -829,11 +830,11 @@ ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowStat if ( a >>= aString ) { sal_Int32 nToken( 0 ); - OUString aXStr = aString.getToken( 0, ',', nToken ); + std::u16string_view aXStr = o3tl::getToken(aString, 0, ',', nToken ); if ( nToken > 0 ) { css::awt::Point aPos; - aPos.X = aXStr.toInt32(); + aPos.X = o3tl::toInt32(aXStr); aPos.Y = o3tl::toInt32(o3tl::getToken(aString, 0, ',', nToken )); if ( i == PROPERTY_POS ) @@ -858,11 +859,11 @@ ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowStat if ( a >>= aString ) { sal_Int32 nToken( 0 ); - OUString aStr = aString.getToken( 0, ',', nToken ); + std::u16string_view aStr = o3tl::getToken(aString, 0, ',', nToken ); if ( nToken > 0 ) { css::awt::Size aSize; - aSize.Width = aStr.toInt32(); + aSize.Width = o3tl::toInt32(aStr); aSize.Height = o3tl::toInt32(o3tl::getToken(aString, 0, ',', nToken )); if ( i == PROPERTY_SIZE ) { diff --git a/framework/source/uielement/styletoolbarcontroller.cxx b/framework/source/uielement/styletoolbarcontroller.cxx index 05af487ff48f..f9f2b7b3108b 100644 --- a/framework/source/uielement/styletoolbarcontroller.cxx +++ b/framework/source/uielement/styletoolbarcontroller.cxx @@ -13,6 +13,7 @@ #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/status/Template.hpp> @@ -92,21 +93,21 @@ StyleDispatcher::StyleDispatcher( const css::uno::Reference< css::frame::XFrame sal_Int32 nIndex = 0; do { - OUString aParam = aParams.getToken( 0, '&', nIndex ); + std::u16string_view aParam = o3tl::getToken(aParams, 0, '&', nIndex ); sal_Int32 nParamIndex = 0; - OUString aParamName = aParam.getToken( 0, '=', nParamIndex ); + std::u16string_view aParamName = o3tl::getToken(aParam, 0, '=', nParamIndex ); if ( nParamIndex < 0 ) break; - if ( aParamName == "Style:string" ) + if ( aParamName == u"Style:string" ) { - OUString aValue = aParam.getToken( 0, '=', nParamIndex ); + std::u16string_view aValue = o3tl::getToken(aParam, 0, '=', nParamIndex ); aStyleName = INetURLObject::decode( aValue, INetURLObject::DecodeMechanism::WithCharset ); } - else if ( aParamName == "FamilyName:string" ) + else if ( aParamName == u"FamilyName:string" ) { - aFamilyName = aParam.getToken( 0, '=', nParamIndex ); + aFamilyName = o3tl::getToken(aParam, 0, '=', nParamIndex ); } } while ( nIndex >= 0 ); diff --git a/helpcompiler/source/HelpIndexer.cxx b/helpcompiler/source/HelpIndexer.cxx index ad8bd9f4e6df..38ddd06472bd 100644 --- a/helpcompiler/source/HelpIndexer.cxx +++ b/helpcompiler/source/HelpIndexer.cxx @@ -14,6 +14,7 @@ #include <o3tl/runtimetooustring.hxx> #include <osl/file.hxx> #include <osl/thread.h> +#include <o3tl/string_view.hxx> #include <memory> #include "LuceneHelper.hxx" @@ -76,8 +77,8 @@ bool HelpIndexer::indexDocuments() try { - OUString sLang = d_lang.getToken(0, '-'); - bool bUseCJK = sLang == "ja" || sLang == "ko" || sLang == "zh"; + std::u16string_view sLang = o3tl::getToken(d_lang, 0, '-'); + bool bUseCJK = sLang == u"ja" || sLang == u"ko" || sLang == u"zh"; // Construct the analyzer appropriate for the given language std::unique_ptr<lucene::analysis::Analyzer> analyzer; diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx index 013e0995a941..69e19185e67c 100644 --- a/idlc/source/astdeclaration.cxx +++ b/idlc/source/astdeclaration.cxx @@ -20,6 +20,7 @@ #include <astdeclaration.hxx> #include <astscope.hxx> #include <rtl/strbuf.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <o3tl/string_view.hxx> diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 0d06ea59cdbe..5aec2091234f 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -263,24 +263,24 @@ sal_Int32 compileFile(const OString * pathname) if ( pOptions->isValid("-D") ) { - OString token, dOpt = pOptions->getOption("-D"); + OString dOpt = pOptions->getOption("-D"); sal_Int32 nIndex = 0; do { - token = dOpt.getToken( 0, ' ', nIndex ); - if (token.getLength()) + std::string_view token = o3tl::getToken(dOpt, 0, ' ', nIndex ); + if (token.size()) lCppArgs.push_back("-D" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } if ( pOptions->isValid("-I") ) { - OString token, incOpt = pOptions->getOption("-I"); + OString incOpt = pOptions->getOption("-I"); sal_Int32 nIndex = 0; do { - token = incOpt.getToken( 0, ' ', nIndex ); - if (token.getLength()) + std::string_view token = o3tl::getToken(incOpt, 0, ' ', nIndex ); + if (token.size()) lCppArgs.push_back("-I" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index 732647c9e715..2592fe0dee27 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -51,10 +51,10 @@ static bool checkOutputPath(const OString& completeName) return true; sal_Int32 nIndex = 0; - OString token(sysPathName.getToken(0, SEPARATOR, nIndex)); - if (token.startsWith("..") - || (token.getLength() >= 2 && token[1] == ':') - || token.startsWith(".")) + std::string_view token(o3tl::getToken(sysPathName, 0, SEPARATOR, nIndex)); + if (o3tl::starts_with(token, "..") + || (token.size() >= 2 && token[1] == ':') + || o3tl::starts_with(token, ".")) { buffer.append(token); buffer.append(SEPARATOR); diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 9f020777d54d..0fd06cc9fb3c 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <osl/file.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/string_view.hxx> #ifdef _WIN32 # if !defined WIN32_LEAN_AND_MEAN @@ -266,7 +267,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) #ifdef _WIN32 OString incpath = convertIncPathtoShortWindowsPath(param.getToken(0, ';', k)); #else - OString incpath = param.getToken(0, ';', k); + std::string_view incpath = o3tl::getToken(param, 0, ';', k); #endif buffer.append(incpath); // buffer.append("\""); diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l index e7fff5ee31e6..aaf74a564677 100644 --- a/idlc/source/scanner.l +++ b/idlc/source/scanner.l @@ -30,6 +30,7 @@ #include <string.h> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <rtl/character.hxx> #if defined _MSC_VER @@ -411,7 +412,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); BEGIN( INITIAL ); } @@ -444,7 +445,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); if ( (nIndex = docu.indexOf("/*")) >= 0 || (nIndex = docu.indexOf("///")) >= 0 ) { @@ -461,7 +462,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); if ( docu.indexOf("/*") >= 0 || docu.indexOf("//") >= 0 ) { diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx index 3e8acd674626..9a39f2131940 100644 --- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx +++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <rtl/byteseq.hxx> #include <jvmfwk/framework.hxx> +#include <o3tl/string_view.hxx> static bool hasOption(char const * szOption, int argc, char** argv); @@ -118,7 +119,7 @@ OString getLD_LIBRARY_PATH(const rtl::ByteSequence & vendorData) OUString sData(chars, len / 2); //the runtime lib is on the first line sal_Int32 index = 0; - OUString aToken = sData.getToken( 1, '\n', index); + std::u16string_view aToken = o3tl::getToken(sData, 1, '\n', index); OString paths = OUStringToOString(aToken, osl_getThreadTextEncoding()); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index b596e18cf480..ce297512482c 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -1043,7 +1043,7 @@ void addJavaInfosFromPath( sal_Int32 nIndex = 0; do { - OUString usToken = usAllPath.getToken( 0, SAL_PATHSEPARATOR, nIndex ); + OUString usToken( usAllPath.getToken( 0, SAL_PATHSEPARATOR, nIndex ) ); OUString usTokenUrl; if(File::getFileURLFromSystemPath(usToken, usTokenUrl) == File::E_None) { diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index aa0126b22822..9d6689fe8251 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -27,6 +27,7 @@ #include <iostream> #include <memory> #include <rtl/strbuf.hxx> +#include <o3tl/string_view.hxx> #include <helper.hxx> #include <export.hxx> diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx index 3038d5a3edad..f0ab84026174 100644 --- a/lingucomponent/source/lingutil/lingutil.cxx +++ b/lingucomponent/source/lingutil/lingutil.cxx @@ -207,7 +207,7 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy sal_Int32 nIndex = 0; do { - OUString aSystem = aSearchPath.getToken(0, ':', nIndex); + OUString aSystem( aSearchPath.getToken(0, ':', nIndex) ); OUString aCWD; OUString aRelative; OUString aAbsolute; diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index d2ec8b9b95ef..a3573b395204 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -2586,13 +2586,13 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) { for (;;) { - OUString sLine( data.getToken( 0, '\n', nLineIdx ) ); + std::u16string_view sLine( o3tl::getToken(data, 0, '\n', nLineIdx ) ); if (nLineIdx<0) break; // skip last line - if ( !sLine.isEmpty() ) + if ( !sLine.empty() ) { - OUString displayValue = sLine.getToken( 1, '>' ); + OUString displayValue( o3tl::getToken(sLine, 1, '>' ) ); if ( displayValue.getLength() ) { // Really we should be using a proper html parser @@ -2602,7 +2602,7 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) displayValue = displayValue.replaceAll( """, "\"" ); displayValue = displayValue.replaceAll( "&", "&" ); listValues.push_back( displayValue ); - if( sLine.indexOf( "OPTION SELECTED" ) != -1 ) + if( sLine.find( u"OPTION SELECTED" ) != std::u16string_view::npos ) selectedIndices.push_back( static_cast< sal_Int16 >( listValues.size() ) - 1 ); } } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index ecc23746d7ed..31fbbade4256 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -881,12 +881,12 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes sal_Int32 nIndex = 0; do { - OUString aToken = maTypeModel.maAdjustments.getToken(0, ',', nIndex); + std::u16string_view aToken = o3tl::getToken(maTypeModel.maAdjustments, 0, ',', nIndex); drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue; - if (aToken.isEmpty()) + if (aToken.empty()) aAdjustmentValue.State = css::beans::PropertyState::PropertyState_DEFAULT_VALUE; else - aAdjustmentValue.Value <<= aToken.toInt32(); + aAdjustmentValue.Value <<= o3tl::toInt32(aToken); aAdjustmentValues.push_back(aAdjustmentValue); } while (nIndex >= 0); diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index a2216564cf55..7472b549e52e 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -44,6 +44,7 @@ #include <vcl/svapp.hxx> #include <osl/diagnose.h> #include <tools/color.hxx> +#include <o3tl/string_view.hxx> #define DEFAULT_LINE_WIDTH 2 @@ -1351,7 +1352,7 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor if ( Reference<XFormattedField>(_xReportElement,uno::UNO_QUERY).is() ) { OUString sFieldData = _xReportElement->getDataField(); - static const char s_sPageNumber[] = "PageNumber()"; + static const sal_Unicode s_sPageNumber[] = u"PageNumber()"; static const char s_sReportPrefix[] = "rpt:"; sFieldData = sFieldData.copy(strlen(s_sReportPrefix)); sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber); @@ -1360,9 +1361,9 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor sal_Int32 nIndex = 0; do { - OUString sToken = sFieldData.getToken( 0, '&', nIndex ); - sToken = sToken.trim(); - if ( !sToken.isEmpty() ) + std::u16string_view sToken = o3tl::getToken(sFieldData, 0, '&', nIndex ); + sToken = o3tl::trim(sToken); + if ( !sToken.empty() ) { if ( sToken == s_sPageNumber ) { @@ -1370,7 +1371,7 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, false, false); Characters("1"); } - else if ( sToken == "PageCount()" ) + else if ( sToken == u"PageCount()" ) { SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, false, false); Characters("1"); @@ -1378,11 +1379,11 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor else { - if ( sToken.startsWith("\"") && sToken.endsWith("\"") ) - sToken = sToken.copy(1,sToken.getLength()-2); + if ( o3tl::starts_with(sToken, u"\"") && o3tl::ends_with(sToken, u"\"") ) + sToken = sToken.substr(1, sToken.size() - 2); bool bPrevCharIsSpace = false; - GetTextParagraphExport()->exportCharacterData(sToken, bPrevCharIsSpace); + GetTextParagraphExport()->exportCharacterData(OUString(sToken), bPrevCharIsSpace); } } } diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index edb50cff04dd..249a27229d15 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -28,6 +28,7 @@ #include "xmlEnums.hxx" #include <com/sun/star/report/GroupOn.hpp> #include <com/sun/star/report/KeepTogether.hpp> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <tools/diagnose_ex.h> @@ -104,19 +105,19 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport OUString sExpression = sCompleteFormula.getToken(1,'['); sExpression = sExpression.getToken(0,']'); sal_Int32 nIndex = 0; - const OUString sFormula = sCompleteFormula.getToken(0,'(',nIndex); + const std::u16string_view sFormula = o3tl::getToken(sCompleteFormula, 0,'(',nIndex); ::sal_Int16 nGroupOn = report::GroupOn::DEFAULT; - if ( sFormula == "rpt:LEFT") + if ( sFormula == u"rpt:LEFT") { nGroupOn = report::GroupOn::PREFIX_CHARACTERS; - OUString sInterval = sCompleteFormula.getToken(1,';',nIndex); - sInterval = sInterval.getToken(0,')'); - m_xGroup->setGroupInterval(sInterval.toInt32()); + std::u16string_view sInterval = o3tl::getToken(sCompleteFormula, 1,';',nIndex); + sInterval = o3tl::getToken(sInterval, 0,')'); + m_xGroup->setGroupInterval(o3tl::toInt32(sInterval)); } - else if ( sFormula == "rpt:YEAR") + else if ( sFormula == u"rpt:YEAR") nGroupOn = report::GroupOn::YEAR; - else if ( sFormula == "rpt:MONTH") + else if ( sFormula == u"rpt:MONTH") { nGroupOn = report::GroupOn::MONTH; } @@ -125,15 +126,15 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport { nGroupOn = report::GroupOn::QUARTAL; } - else if ( sFormula == "rpt:WEEK") + else if ( sFormula == u"rpt:WEEK") nGroupOn = report::GroupOn::WEEK; - else if ( sFormula == "rpt:DAY") + else if ( sFormula == u"rpt:DAY") nGroupOn = report::GroupOn::DAY; - else if ( sFormula == "rpt:HOUR") + else if ( sFormula == u"rpt:HOUR") nGroupOn = report::GroupOn::HOUR; - else if ( sFormula == "rpt:MINUTE") + else if ( sFormula == u"rpt:MINUTE") nGroupOn = report::GroupOn::MINUTE; - else if ( sFormula == "rpt:INT") + else if ( sFormula == u"rpt:INT") { nGroupOn = report::GroupOn::INTERVAL; _rImport.removeFunction(sExpression); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 4935ac250074..6fad529c3b9a 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -1353,34 +1353,34 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > { URL aUrl = getURLForId(_nId); sal_Int32 nIndex = 1; - OUString sType = aUrl.Complete.getToken(0,'.',nIndex); - if ( nIndex == -1 || sType.isEmpty() ) + std::u16string_view sType = o3tl::getToken(aUrl.Complete, 0,'.',nIndex); + if ( nIndex == -1 || sType.empty() ) { switch(_nId) { case SID_DRAWTBX_CS_SYMBOL: - sType = "smiley"; + sType = u"smiley"; break; case SID_DRAWTBX_CS_ARROW: - sType = "left-right-arrow"; + sType = u"left-right-arrow"; break; case SID_DRAWTBX_CS_FLOWCHART: - sType = "flowchart-internal-storage"; + sType = u"flowchart-internal-storage"; break; case SID_DRAWTBX_CS_CALLOUT: - sType = "round-rectangular-callout"; + sType = u"round-rectangular-callout"; break; case SID_DRAWTBX_CS_STAR: - sType = "star5"; + sType = u"star5"; break; default: - sType = "diamond"; + sType = u"diamond"; } } else - sType = aUrl.Complete.getToken(0,'.',nIndex); + sType = o3tl::getToken(aUrl.Complete, 0,'.',nIndex); - getDesignView()->SetInsertObj( SdrObjKind::CustomShape ,sType); + getDesignView()->SetInsertObj( SdrObjKind::CustomShape, OUString(sType)); createDefaultControl(aArgs); } InvalidateAll(); diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx index f19037c9953f..0b7d79eeb62e 100644 --- a/sc/source/core/tool/ddelink.cxx +++ b/sc/source/core/tool/ddelink.cxx @@ -25,6 +25,7 @@ #include <sfx2/bindings.hxx> #include <svl/numformat.hxx> #include <svl/sharedstringpool.hxx> +#include <o3tl/string_view.hxx> #include <ddelink.hxx> #include <brdcst.hxx> @@ -137,14 +138,13 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( if (nLen && aLinkStr[nLen-1] == '\n') aLinkStr = aLinkStr.copy(0, nLen-1); - OUString aLine; SCSIZE nCols = 1; // empty string -> an empty line SCSIZE nRows = 1; if (!aLinkStr.isEmpty()) { nRows = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLinkStr, '\n')); - aLine = aLinkStr.getToken( 0, '\n' ); - if (!aLine.isEmpty()) + std::u16string_view aLine = o3tl::getToken(aLinkStr, 0, '\n' ); + if (!aLine.empty()) nCols = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLine, '\t')); } @@ -174,13 +174,12 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( else if ( nMode == SC_DDE_ENGLISH ) nStdFormat = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US); - OUString aEntry; for (SCSIZE nR=0; nR<nRows; nR++) { - aLine = aLinkStr.getToken( static_cast<sal_Int32>(nR), '\n' ); + std::u16string_view aLine = o3tl::getToken(aLinkStr, static_cast<sal_Int32>(nR), '\n' ); for (SCSIZE nC=0; nC<nCols; nC++) { - aEntry = aLine.getToken( static_cast<sal_Int32>(nC), '\t' ); + OUString aEntry( o3tl::getToken(aLine, static_cast<sal_Int32>(nC), '\t' ) ); sal_uInt32 nIndex = nStdFormat; double fVal = double(); if ( nMode != SC_DDE_TEXT && pFormatter->IsNumberFormat( aEntry, nIndex, fVal ) ) diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 358f306fbe2b..f116e0e497f0 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1761,8 +1761,8 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : sal_Int32 nStringIx = 0; for(;;) { - const OUString aToken( aString.getToken( 0, '\n', nStringIx ) ); - if (aToken.indexOf(",") != -1) + const std::u16string_view aToken( o3tl::getToken(aString, 0, '\n', nStringIx ) ); + if (aToken.find(',') != std::u16string_view::npos) { sListBuf.append('"'); sListBuf.append(aToken); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 0129cd9d1b3c..d6dbb6f8f729 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1428,7 +1428,7 @@ void ScHTMLLayoutParser::FontOn( HtmlImportInfo* pInfo ) { // Font list, VCL uses the semicolon as separator // HTML uses the comma - OUString aFName = rFace.getToken( 0, ',', nPos ); + std::u16string_view aFName = o3tl::getToken(rFace, 0, ',', nPos ); aFName = comphelper::string::strip(aFName, ' '); if( !aFontName.isEmpty() ) aFontName.append(";"); diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 5d3d4501ca73..f4a9330b437a 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -291,16 +291,16 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) sal_Int32 nIndex = 0; while( nIndex >= 0 ) { - OUString aColSpanToken = aColSpansText.getToken( 0, ' ', nIndex ); - sal_Int32 nSepPos = aColSpanToken.indexOf( ':' ); - if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) ) + std::u16string_view aColSpanToken = o3tl::getToken(aColSpansText, 0, ' ', nIndex ); + size_t nSepPos = aColSpanToken.find( ':' ); + if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.size()) ) { // OOXML uses 1-based integer column indexes, row model expects 0-based colspans - const sal_Int32 nCol1 = o3tl::toInt32(aColSpanToken.subView( 0, nSepPos )) - 1; + const sal_Int32 nCol1 = o3tl::toInt32(aColSpanToken.substr( 0, nSepPos )) - 1; const bool bValid1 = mrAddressConv.checkCol( nCol1, true); if (bValid1) { - const sal_Int32 nCol2 = o3tl::toInt32(aColSpanToken.subView( nSepPos + 1 )) - 1; + const sal_Int32 nCol2 = o3tl::toInt32(aColSpanToken.substr( nSepPos + 1 )) - 1; mrAddressConv.checkCol( nCol2, true); aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, nMaxCol ))); } diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 66904fe65fdb..9abf05c6b0ec 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -139,8 +139,8 @@ void ScShareDocumentDlg::UpdateView() // parse the edit time string of the format "DD.MM.YYYY hh:mm" OUString aDateTimeStr = aUsersData[i][LockFileComponent::EDITTIME]; sal_Int32 nIndex = 0; - OUString aDateStr = aDateTimeStr.getToken( 0, ' ', nIndex ); - OUString aTimeStr = aDateTimeStr.getToken( 0, ' ', nIndex ); + std::u16string_view aDateStr = o3tl::getToken(aDateTimeStr, 0, ' ', nIndex ); + std::u16string_view aTimeStr = o3tl::getToken(aDateTimeStr, 0, ' ', nIndex ); nIndex = 0; sal_uInt16 nDay = sal::static_int_cast< sal_uInt16 >( o3tl::toInt32(o3tl::getToken(aDateStr, 0, '.', nIndex )) ); sal_uInt16 nMonth = sal::static_int_cast< sal_uInt16 >( o3tl::toInt32(o3tl::getToken(aDateStr, 0, '.', nIndex )) ); diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index 094a3bd4ce64..99afd919bea7 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -21,6 +21,7 @@ #include <ooo/vba/excel/XlColorIndex.hpp> #include <ooo/vba/excel/XlUnderlineStyle.hpp> #include <svl/itemset.hxx> +#include <o3tl/string_view.hxx> #include "excelvbahelper.hxx" #include "vbafont.hxx" #include "vbapalette.hxx" @@ -134,14 +135,14 @@ ScVbaFont::setFontStyle( const uno::Any& aValue ) for (sal_Int32 nIdx{ 0 }; nIdx>=0; ) { - const OUString aToken{ aStyles.getToken( 0, ' ', nIdx ) }; - if (aToken.equalsIgnoreAsciiCase("Bold")) + const std::u16string_view aToken{ o3tl::getToken(aStyles, 0, ' ', nIdx ) }; + if (o3tl::equalsIgnoreAsciiCase(aToken, u"Bold")) { bBold = true; if (bItalic) break; } - else if (aToken.equalsIgnoreAsciiCase("Italic")) + else if (o3tl::equalsIgnoreAsciiCase(aToken, u"Italic")) { bItalic = true; if (bBold) diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 516aa04f5477..714a759ed7c4 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -43,6 +43,7 @@ #include <vcl/TypeSerializer.hxx> #include <osl/thread.h> #include <o3tl/unit_conversion.hxx> +#include <o3tl/string_view.hxx> #include <comphelper/automationinvokedzone.hxx> #include <comphelper/lok.hxx> @@ -732,8 +733,8 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r if (!aDataStr.isEmpty()) { nRows = comphelper::string::getTokenCount(aDataStr, '\n'); - OUString aLine = aDataStr.getToken( 0, '\n' ); - if (!aLine.isEmpty()) + std::u16string_view aLine = o3tl::getToken(aDataStr, 0, '\n' ); + if (!aLine.empty()) nCols = comphelper::string::getTokenCount(aLine, '\t'); } } diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 8b38891b2878..ff49054dde0b 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -855,13 +855,13 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con sal_Int32 nIndex = 0; while( (nElements--) && (nIndex >= 0) ) { - const OUString aToken( aString.getToken( 0, ';', nIndex ) ); + const std::u16string_view aToken( o3tl::getToken(aString, 0, ';', nIndex ) ); - sal_Int32 nPos = aToken.indexOf( ',' ); - if( nPos >= 0 ) + size_t nPos = aToken.find( ',' ); + if( nPos != std::u16string_view::npos ) { - pValues->Time = o3tl::toDouble(aToken.subView( 0, nPos )); - pValues->Progress = o3tl::toDouble(aToken.subView( nPos+1 )); + pValues->Time = o3tl::toDouble(aToken.substr( 0, nPos )); + pValues->Progress = o3tl::toDouble(aToken.substr( nPos+1 )); } pValues++; } diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 38a4fa5ee1eb..160c64a662eb 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -21,6 +21,7 @@ #include <DrawDocShell.hxx> #include <svx/svdpagv.hxx> #include <svx/svxdlg.hxx> +#include <o3tl/string_view.hxx> #include <helpids.h> #include <ViewShell.hxx> @@ -315,32 +316,32 @@ bool DrawDocShell::IsNewPageNameValid( OUString & rInOutPageName, bool bResetStr rInOutPageName.getLength() > aStrPage.getLength()) { sal_Int32 nIdx{ aStrPage.getLength() }; - OUString sRemainder = rInOutPageName.getToken(0, ' ', nIdx); - if (sRemainder[0] >= '0' && sRemainder[0] <= '9') + std::u16string_view sRemainder = o3tl::getToken(rInOutPageName, 0, ' ', nIdx); + if (!sRemainder.empty() && sRemainder[0] >= '0' && sRemainder[0] <= '9') { // check for arabic numbering - sal_Int32 nIndex = 1; + size_t nIndex = 1; // skip all following numbers - while (nIndex < sRemainder.getLength() && + while (nIndex < sRemainder.size() && sRemainder[nIndex] >= '0' && sRemainder[nIndex] <= '9') { nIndex++; } // EOL? Reserved name! - if (nIndex >= sRemainder.getLength()) + if (nIndex >= sRemainder.size()) { bIsStandardName = true; } } - else if (sRemainder.getLength() == 1 && + else if (sRemainder.size() == 1 && rtl::isAsciiLowerCase(sRemainder[0])) { // lower case, single character: reserved bIsStandardName = true; } - else if (sRemainder.getLength() == 1 && + else if (sRemainder.size() == 1 && rtl::isAsciiUpperCase(sRemainder[0])) { // upper case, single character: reserved @@ -355,15 +356,15 @@ bool DrawDocShell::IsNewPageNameValid( OUString & rInOutPageName, bool bResetStr if (sReserved.indexOf(sRemainder[0]) == -1) sReserved = sReserved.toAsciiUpperCase(); - sal_Int32 nIndex = 0; - while (nIndex < sRemainder.getLength() && + size_t nIndex = 0; + while (nIndex < sRemainder.size() && sReserved.indexOf(sRemainder[nIndex]) != -1) { nIndex++; } // EOL? Reserved name! - if (nIndex >= sRemainder.getLength()) + if (nIndex >= sRemainder.size()) { bIsStandardName = true; } diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index 6d5f8ee121ce..dbf34213ff24 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -20,6 +20,7 @@ #include "FullScreenPane.hxx" #include <vcl/vclevent.hxx> #include <vcl/wrkwin.hxx> +#include <o3tl/string_view.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -211,11 +212,11 @@ void FullScreenPane::ExtractArguments ( const util::URL aURL = rxPaneId->getFullResourceURL(); for (sal_Int32 nIndex{ 0 }; nIndex >= 0; ) { - const OUString aToken = aURL.Arguments.getToken(0, '&', nIndex); - OUString sValue; - if (aToken.startsWith("ScreenNumber=", &sValue)) + const std::u16string_view aToken = o3tl::getToken(aURL.Arguments, 0, '&', nIndex); + std::u16string_view sValue; + if (o3tl::starts_with(aToken, u"ScreenNumber=", &sValue)) { - rnScreenNumberReturnValue = sValue.toInt32(); + rnScreenNumberReturnValue = o3tl::toInt32(sValue); } } } diff --git a/sd/source/ui/func/fuexecuteinteraction.cxx b/sd/source/ui/func/fuexecuteinteraction.cxx index 47093da78020..d1956fcf5603 100644 --- a/sd/source/ui/func/fuexecuteinteraction.cxx +++ b/sd/source/ui/func/fuexecuteinteraction.cxx @@ -33,6 +33,7 @@ #include <svl/stritem.hxx> #include <svl/urihelper.hxx> #include <tools/urlobj.hxx> +#include <o3tl/string_view.hxx> #include <DrawViewShell.hxx> #include <GraphicDocShell.hxx> @@ -216,11 +217,11 @@ void FuExecuteInteraction::DoExecute(SfxRequest&) // "Macroname.Modulname.Libname.Documentname" or // "Macroname.Modulname.Libname.Applicationname" sal_Int32 nIdx{ 0 }; - const OUString aMacroName = aMacro.getToken(0, '.', nIdx); - const OUString aModulName = aMacro.getToken(0, '.', nIdx); + const std::u16string_view aMacroName = o3tl::getToken(aMacro, 0, '.', nIdx); + const std::u16string_view aModulName = o3tl::getToken(aMacro, 0, '.', nIdx); // Currently the "Call" method only resolves modulename+macroname - mpDocSh->GetBasic()->Call(aModulName + "." + aMacroName); + mpDocSh->GetBasic()->Call(OUString::Concat(aModulName) + "." + aMacroName); } } break; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 5948a87f186d..b896fbb4ebbf 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1528,12 +1528,12 @@ void SlideshowImpl::click( const Reference< XShape >& xShape ) // "Macroname.Modulname.Libname.Documentname" or // "Macroname.Modulname.Libname.Applicationname" sal_Int32 nIdx{ 0 }; - const OUString aMacroName = aMacro.getToken(0, '.', nIdx); - const OUString aModulName = aMacro.getToken(0, '.', nIdx); + const std::u16string_view aMacroName = o3tl::getToken(aMacro, 0, '.', nIdx); + const std::u16string_view aModulName = o3tl::getToken(aMacro, 0, '.', nIdx); // todo: is the limitation still given that only // Modulname+Macroname can be used here? - OUString aExecMacro = aModulName + "." + aMacroName; + OUString aExecMacro = OUString::Concat(aModulName) + "." + aMacroName; mpDocSh->GetBasic()->Call(aExecMacro); } } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 29736f6a633e..6ed6729f9a75 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1349,17 +1349,12 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno else { sal_Int32 nIdx{ 0 }; - const OUString aLibName = aStrMacro.getToken(0, '.', nIdx); - const OUString aModulName = aStrMacro.getToken(0, '.', nIdx); - const OUString aMacroName = aStrMacro.getToken(0, '.', nIdx); - - OUStringBuffer sBuffer; - sBuffer.append( aMacroName ); - sBuffer.append( '.' ); - sBuffer.append( aModulName ); - sBuffer.append( '.' ); - sBuffer.append( aLibName ); - sBuffer.append( '.' ); + const std::u16string_view aLibName = o3tl::getToken(aStrMacro, 0, '.', nIdx); + const std::u16string_view aModulName = o3tl::getToken(aStrMacro, 0, '.', nIdx); + const std::u16string_view aMacroName = o3tl::getToken(aStrMacro, 0, '.', nIdx); + + OUStringBuffer sBuffer( + OUString::Concat(aMacroName) + OUStringChar('.') + aModulName + OUStringChar('.') + aLibName + OUStringChar('.') ); if ( aStrLibrary == "StarOffice" ) { @@ -1464,11 +1459,11 @@ uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName ) // "Macroname.Modulname.Libname.Documentname" or // "Macroname.Modulname.Libname.Applicationname" sal_Int32 nIdx{ 0 }; - const OUString aMacroName = aMacro.getToken(0, '.', nIdx); - const OUString aModulName = aMacro.getToken(0, '.', nIdx); - const OUString aLibName = aMacro.getToken(0, '.', nIdx); + const std::u16string_view aMacroName = o3tl::getToken(aMacro, 0, '.', nIdx); + const std::u16string_view aModulName = o3tl::getToken(aMacro, 0, '.', nIdx); + const std::u16string_view aLibName = o3tl::getToken(aMacro, 0, '.', nIdx); - OUString sBuffer = aLibName + + OUString sBuffer = OUString::Concat(aLibName) + "." + aModulName + "." + diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 8618126e0b5f..701369f378c7 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1341,7 +1341,7 @@ void SfxHelpIndexWindow_Impl::Initialize() { sal_Int32 nIdx = 0; OUString aTitle = rRow.getToken( 0, '\t', nIdx ); // token 0 - OUString aURL = rRow.getToken( 1, '\t', nIdx ); // token 2 + std::u16string_view aURL = o3tl::getToken(rRow, 1, '\t', nIdx ); // token 2 OUString aFactory(INetURLObject(aURL).GetHost()); m_xActiveLB->append(aFactory, aTitle); } @@ -2262,7 +2262,7 @@ void SfxHelpWindow_Impl::LoadConfig() DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" ); sal_Int32 nIdx = 0; nIndexSize = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx )); - aUserData.getToken(0, ';', nIdx); // ignore nTextSize + o3tl::getToken(aUserData, 0, ';', nIdx); // ignore nTextSize sal_Int32 nOldWidth = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx )); sal_Int32 nOldHeight = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx )); aWinSize = Size(nOldWidth, nOldHeight); @@ -2327,18 +2327,18 @@ IMPL_LINK_NOARG(SfxHelpWindow_Impl, OpenHdl, LinkParamNone*, void) sHelpURL = aEntry; else { - OUString aId; + std::u16string_view aId; OUString aAnchor('#'); if ( comphelper::string::getTokenCount(aEntry, '#') == 2 ) { sal_Int32 nIdx{ 0 }; - aId = aEntry.getToken( 0, '#', nIdx ); + aId = o3tl::getToken(aEntry, 0, '#', nIdx ); aAnchor += o3tl::getToken(aEntry, 0, '#', nIdx ); } else aId = aEntry; - sHelpURL = SfxHelpWindow_Impl::buildHelpURL(xIndexWin->GetFactory(), OUStringConcatenation("/" + aId), aAnchor); + sHelpURL = SfxHelpWindow_Impl::buildHelpURL(xIndexWin->GetFactory(), OUStringConcatenation(OUString::Concat("/") + aId), aAnchor); } loadHelpContent(sHelpURL); diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index 25b92d390e2c..b38346d702a7 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -311,7 +311,7 @@ INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL) { INetContentType eTypeID = CONTENT_TYPE_UNKNOWN; sal_Int32 nIdx{ 0 }; - OUString aToken = rURL.getToken(0, ':', nIdx); + OUString aToken( rURL.getToken(0, ':', nIdx) ); if (!aToken.isEmpty()) { if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_FILE)) diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 2ad876b110f1..5a5e2c6c006c 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -34,6 +34,7 @@ #include <mutex> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -255,12 +256,12 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) for(sal_Int32 j = 0;pDispIter != pDispEnd;++pDispIter,++j) { sal_Int32 nIndex = 0; - pDispIter->getToken(0,'/',nIndex); - OUString sName = pDispIter->copy(nIndex); - sName = sName.copy(0,sName.lastIndexOf(sDisplayName)); + o3tl::getToken(*pDispIter, 0, '/', nIndex); + std::u16string_view sName = pDispIter->subView(nIndex); + sName = sName.substr(0, sName.rfind(sDisplayName)); OUString sCurrentDisplayName; aDisplayNamesValue[j] >>= sCurrentDisplayName; - aDisplayNameMap.emplace(sName,sCurrentDisplayName); + aDisplayNameMap.emplace(OUString(sName),sCurrentDisplayName); } } @@ -338,7 +339,7 @@ void ExtendedColorConfig_Impl::FillComponentColors(const uno::Sequence < OUStrin if ( aConfigValues.find(*pColorIter) == aConfigValues.end() ) { sal_Int32 nIndex = 0; - pColorIter->getToken(2,'/',nIndex); + o3tl::getToken(*pColorIter, 2, '/', nIndex); OUString sName(pColorIter->copy(nIndex)),sDisplayName; OUString sTemp = sName.copy(0,sName.lastIndexOf(sColor)); diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index e4e933128485..66f786dc190f 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -378,9 +378,9 @@ static SvImageId GetImageId_Impl( if ( rObject.GetProtocol() == INetProtocol::PrivSoffice ) { - OUString aURLPath = sURL.copy( strlen(URL_PREFIX_PRIV_SOFFICE) ); - OUString aType = aURLPath.getToken( 0, '/' ); - if ( aType == "factory" ) + std::u16string_view aURLPath = sURL.subView( strlen(URL_PREFIX_PRIV_SOFFICE) ); + std::u16string_view aType = o3tl::getToken(aURLPath, 0, '/' ); + if ( aType == u"factory" ) { // detect an image id for our "private:factory" urls aExt = GetImageExtensionByFactory_Impl( sURL ); @@ -388,7 +388,7 @@ static SvImageId GetImageId_Impl( nImage = GetImageId_Impl( aExt ); return nImage; } - else if ( aType == "image" ) + else if ( aType == u"image" ) nImage = static_cast<SvImageId>(o3tl::toInt32(o3tl::getToken(aURLPath, 1, '/' ))); } else @@ -758,8 +758,8 @@ OUString SvFileInformationManager::GetDescription_Impl( const INetURLObject& rOb if ( rObject.GetProtocol() == INetProtocol::PrivSoffice ) { OUString aURLPath = sURL.copy( strlen(URL_PREFIX_PRIV_SOFFICE) ); - OUString aType = aURLPath.getToken( 0, '/' ); - if ( aType == "factory" ) + std::u16string_view aType = o3tl::getToken(aURLPath, 0, '/' ); + if ( aType == u"factory" ) { sDescription = GetDescriptionByFactory_Impl( aURLPath.copy( aURLPath.indexOf( '/' ) + 1 ) ); bDetected = true; diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 8ecd1a4c7de6..e337f79d7288 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -21,6 +21,7 @@ #include <fmprop.hxx> #include <fmvwimp.hxx> #include <fmpgeimp.hxx> +#include <o3tl/string_view.hxx> #include <svx/fmview.hxx> #include <svx/fmpage.hxx> #include <svx/svdovirt.hxx> @@ -424,8 +425,8 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > sal_Int32 nTokIndex = 0; do { - OUString aToken = sAccessPath.getToken( 0, '\\', nTokIndex ); - sal_uInt16 nIndex = static_cast<sal_uInt16>(aToken.toInt32()); + std::u16string_view aToken = o3tl::getToken(sAccessPath, 0, '\\', nTokIndex ); + sal_uInt16 nIndex = static_cast<sal_uInt16>(o3tl::toInt32(aToken)); // get the DSS of the source form (we have to find an equivalent for) DBG_ASSERT(nIndex<xSourceContainer->getCount(), "FmFormObj::ensureModelEnv : invalid access path !"); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index a7d3af37439d..f9df32cd233b 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -640,19 +640,19 @@ static SwTextNode* lcl_FindOutlineNum(const SwOutlineNodes& rOutlNds, // (Number followed by a period, with 5 repetitions) // i.e.: "1.1.", "1.", "1.1.1." sal_Int32 nPos = 0; - OUString sNum = rName.getToken( 0, '.', nPos ); + std::u16string_view sNum = o3tl::getToken(rName, 0, '.', nPos ); if( -1 == nPos ) return nullptr; // invalid number! sal_uInt16 nLevelVal[ MAXLEVEL ]; // numbers of all levels memset( nLevelVal, 0, MAXLEVEL * sizeof( nLevelVal[0] )); int nLevel = 0; - OUString sName( rName ); + std::u16string_view sName( rName ); while( -1 != nPos ) { sal_uInt16 nVal = 0; - for( sal_Int32 n = 0; n < sNum.getLength(); ++n ) + for( size_t n = 0; n < sNum.size(); ++n ) { const sal_Unicode c {sNum[ n ]}; if( '0' <= c && c <= '9' ) @@ -669,9 +669,9 @@ static SwTextNode* lcl_FindOutlineNum(const SwOutlineNodes& rOutlNds, if( MAXLEVEL > nLevel ) nLevelVal[ nLevel++ ] = nVal; - sName = sName.copy( nPos ); + sName = sName.substr( nPos ); nPos = 0; - sNum = sName.getToken( 0, '.', nPos ); + sNum = o3tl::getToken(sName, 0, '.', nPos ); // #i4533# without this check all parts delimited by a dot are treated as outline numbers if(!comphelper::string::isdigitAsciiString(sNum)) break; @@ -752,8 +752,8 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con while(!sExpandedText.isEmpty()) { sal_Int32 nPos = 0; - OUString sTempNum = sExpandedText.getToken(0, '.', nPos); - if( sTempNum.isEmpty() || -1 == nPos || + std::u16string_view sTempNum = o3tl::getToken(sExpandedText, 0, '.', nPos); + if( sTempNum.empty() || -1 == nPos || !comphelper::string::isdigitAsciiString(sTempNum)) break; sExpandedText = sExpandedText.copy(nPos); diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index f4983fb7277b..53fc36d38297 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -851,9 +851,9 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos) sal_Int32 nIdx{ 0 }; eRet.sCharStyleName = sToken.getToken( 0, ',', nIdx ); - OUString sTmp( sToken.getToken( 0, ',', nIdx )); - if( !sTmp.isEmpty() ) - eRet.nPoolId = o3tl::narrowing<sal_uInt16>(sTmp.toInt32()); + std::u16string_view sTmp( o3tl::getToken(sToken, 0, ',', nIdx )); + if( !sTmp.empty() ) + eRet.nPoolId = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sTmp)); switch( eTokenType ) { @@ -861,12 +861,12 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos) case TOKEN_CHAPTER_INFO: //i53420 case TOKEN_ENTRY_NO: - sTmp = sToken.getToken( 0, ',', nIdx ); // token 2 - if( !sTmp.isEmpty() ) - eRet.nChapterFormat = o3tl::narrowing<sal_uInt16>(sTmp.toInt32()); - sTmp = sToken.getToken( 0, ',', nIdx ); // token 3 - if( !sTmp.isEmpty() ) - eRet.nOutlineLevel = o3tl::narrowing<sal_uInt16>(sTmp.toInt32()); //the maximum outline level to examine + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 2 + if( !sTmp.empty() ) + eRet.nChapterFormat = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sTmp)); + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 3 + if( !sTmp.empty() ) + eRet.nOutlineLevel = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sTmp)); //the maximum outline level to examine break; case TOKEN_TEXT: @@ -886,21 +886,21 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos) break; case TOKEN_TAB_STOP: - sTmp = sToken.getToken( 0, ',', nIdx ); // token 2 - if( !sTmp.isEmpty() ) - eRet.nTabStopPosition = sTmp.toInt32(); + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 2 + if( !sTmp.empty() ) + eRet.nTabStopPosition = o3tl::toInt32(sTmp); - sTmp = sToken.getToken( 0, ',', nIdx ); // token 3 - if( !sTmp.isEmpty() ) - eRet.eTabAlign = static_cast<SvxTabAdjust>(sTmp.toInt32()); + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 3 + if( !sTmp.empty() ) + eRet.eTabAlign = static_cast<SvxTabAdjust>(o3tl::toInt32(sTmp)); - sTmp = sToken.getToken( 0, ',', nIdx ); // token 4 - if( !sTmp.isEmpty() ) + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 4 + if( !sTmp.empty() ) eRet.cTabFillChar = sTmp[0]; - sTmp = sToken.getToken( 0, ',', nIdx ); // token 5 - if( !sTmp.isEmpty() ) - eRet.bWithTab = 0 != sTmp.toInt32(); + sTmp = o3tl::getToken(sToken, 0, ',', nIdx ); // token 5 + if( !sTmp.empty() ) + eRet.bWithTab = 0 != o3tl::toInt32(sTmp); break; case TOKEN_AUTHORITY: diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index e45f2b7db018..024c3c13727b 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -27,6 +27,7 @@ #include <vcl/svapp.hxx> #include <tools/UnitConversion.hxx> +#include <o3tl/string_view.hxx> #include <tools/diagnose_ex.h> #include <vcl/unohelp.hxx> #include <svtools/htmlkywd.hxx> @@ -753,9 +754,9 @@ static bool lcl_html_setEvents( for( const auto &rStr : rUnoMacroTable ) { sal_Int32 nIndex = 0; - if( rStr.getToken( 0, '-', nIndex ).isEmpty() || -1 == nIndex ) + if( o3tl::getToken(rStr, 0, '-', nIndex ).empty() || -1 == nIndex ) continue; - if( rStr.getToken( 0, '-', nIndex ).isEmpty() || -1 == nIndex ) + if( o3tl::getToken(rStr, 0, '-', nIndex ).empty() || -1 == nIndex ) continue; if( nIndex < rStr.getLength() ) nEvents++; diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index e0b20ef4168e..50278e160483 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> @@ -1258,14 +1259,14 @@ bool CSS1Expression::GetColor( Color &rColor ) const sal_Int32 nPos = 4; // start after "rgb(" for ( int nCol = 0; nCol < 3 && nPos > 0; ++nCol ) { - const OUString aNumber = aValue.getToken(0, ',', nPos); + const std::u16string_view aNumber = o3tl::getToken(aValue, 0, ',', nPos); - sal_Int32 nNumber = aNumber.toInt32(); + sal_Int32 nNumber = o3tl::toInt32(aNumber); if( nNumber<0 ) { nNumber = 0; } - else if( aNumber.indexOf('%') >= 0 ) + else if( aNumber.find('%') != std::u16string_view::npos ) { if( nNumber > 100 ) nNumber = 100; diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 1fec0f8612d5..a3276c72cedb 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/XFilePicker3.hpp> #include <tools/urlobj.hxx> +#include <o3tl/string_view.hxx> #include <strings.hrc> #include <map> @@ -262,13 +263,13 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( sal_Int32 nIndex = 0; do { - const OUString sHeader = sLine.getToken( 0, '\t', nIndex ); - OSL_ENSURE(sHeader.getLength() > 2 && - sHeader.startsWith("\"") && sHeader.endsWith("\""), + const std::u16string_view sHeader = o3tl::getToken(sLine, 0, '\t', nIndex ); + OSL_ENSURE(sHeader.size() > 2 && + o3tl::starts_with(sHeader, u"\"") && o3tl::ends_with(sHeader, u"\""), "Wrong format of header"); - if(sHeader.getLength() > 2) + if(sHeader.size() > 2) { - m_pCSVData->aDBColumnHeaders.push_back( sHeader.copy(1, sHeader.getLength() -2)); + m_pCSVData->aDBColumnHeaders.push_back( OUString(sHeader.substr(1, sHeader.size() -2))); } } while (nIndex > 0); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index f87bd7513136..b13b641090ad 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -232,9 +232,9 @@ void SectRepr::SetFile( std::u16string_view rFile ) OUString sNewFile( INetURLObject::decode( rFile, INetURLObject::DecodeMechanism::Unambiguous )); const OUString sOldFileName( m_SectionData.GetLinkFileName() ); - const OUString sSub( sOldFileName.getToken( 2, sfx2::cTokenSeparator ) ); + const std::u16string_view sSub( o3tl::getToken(sOldFileName, 2, sfx2::cTokenSeparator ) ); - if( !rFile.empty() || !sSub.isEmpty() ) + if( !rFile.empty() || !sSub.empty() ) { sNewFile += OUStringChar(sfx2::cTokenSeparator); if( !rFile.empty() ) // Filter only with FileName @@ -245,7 +245,7 @@ void SectRepr::SetFile( std::u16string_view rFile ) m_SectionData.SetLinkFileName( sNewFile ); - if( !rFile.empty() || !sSub.isEmpty() ) + if( !rFile.empty() || !sSub.empty() ) { m_SectionData.SetType( SectionType::FileLink ); } @@ -260,13 +260,13 @@ void SectRepr::SetFilter( std::u16string_view rFilter ) OUString sNewFile; const OUString sOldFileName( m_SectionData.GetLinkFileName() ); sal_Int32 nIdx{ 0 }; - const OUString sFile( sOldFileName.getToken( 0, sfx2::cTokenSeparator, nIdx ) ); // token 0 - const OUString sSub( sOldFileName.getToken( 1, sfx2::cTokenSeparator, nIdx ) ); // token 2 + const std::u16string_view sFile( o3tl::getToken(sOldFileName, 0, sfx2::cTokenSeparator, nIdx ) ); // token 0 + const std::u16string_view sSub( o3tl::getToken(sOldFileName, 1, sfx2::cTokenSeparator, nIdx ) ); // token 2 - if( !sFile.isEmpty() ) + if( !sFile.empty() ) sNewFile = sFile + OUStringChar(sfx2::cTokenSeparator) + rFilter + OUStringChar(sfx2::cTokenSeparator) + sSub; - else if( !sSub.isEmpty() ) + else if( !sSub.empty() ) sNewFile = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator) + sSub; m_SectionData.SetLinkFileName( sNewFile ); @@ -282,16 +282,16 @@ void SectRepr::SetSubRegion(std::u16string_view rSubRegion) OUString sNewFile; sal_Int32 n(0); const OUString sLinkFileName(m_SectionData.GetLinkFileName()); - const OUString sOldFileName( sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n ) ); - const OUString sFilter( sLinkFileName.getToken( 0, sfx2::cTokenSeparator, n ) ); + const std::u16string_view sOldFileName( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) ); + const std::u16string_view sFilter( o3tl::getToken(sLinkFileName, 0, sfx2::cTokenSeparator, n ) ); - if( !rSubRegion.empty() || !sOldFileName.isEmpty() ) + if( !rSubRegion.empty() || !sOldFileName.empty() ) sNewFile = sOldFileName + OUStringChar(sfx2::cTokenSeparator) + sFilter + OUStringChar(sfx2::cTokenSeparator) + rSubRegion; m_SectionData.SetLinkFileName( sNewFile ); - if( !rSubRegion.empty() || !sOldFileName.isEmpty() ) + if( !rSubRegion.empty() || !sOldFileName.empty() ) { m_SectionData.SetType( SectionType::FileLink ); } diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index af34366b2d36..13621af7066e 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -160,8 +160,8 @@ void SwFieldVarPage::Reset(const SfxItemSet* ) sal_Int32 nIdx{ 0 }; if(!IsRefresh() && o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { - OUString sVal = sUserData.getToken(0, ';', nIdx); - sal_uInt16 nVal = o3tl::narrowing<sal_uInt16>(sVal.toInt32()); + std::u16string_view sVal = o3tl::getToken(sUserData, 0, ';', nIdx); + sal_uInt16 nVal = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sVal)); if (USHRT_MAX != nVal) { for (sal_Int32 i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; i++) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 4c2e769ac889..3d1becdd5871 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3833,11 +3833,11 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) pToInsert->sPrimKey = sLine.getToken(0, ';', nSttPos ); pToInsert->sSecKey = sLine.getToken(0, ';', nSttPos ); - OUString sStr = sLine.getToken(0, ';', nSttPos ); - pToInsert->bCase = !sStr.isEmpty() && sStr != "0"; + std::u16string_view sStr = o3tl::getToken(sLine, 0, ';', nSttPos ); + pToInsert->bCase = !sStr.empty() && sStr != u"0"; - sStr = sLine.getToken(0, ';', nSttPos ); - pToInsert->bWord = !sStr.isEmpty() && sStr != "0"; + sStr = o3tl::getToken(sLine, 0, ';', nSttPos ); + pToInsert->bWord = !sStr.empty() && sStr != u"0"; m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert)); pToInsert = nullptr; diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 216d4a137b13..3846bdb3e1c5 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -117,8 +117,8 @@ void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, bool bApi, bool bAlwaysCre break; } } - const OUString sPath = sGroup.getToken(1, GLOS_DELIM); - sal_uInt16 nComparePath = o3tl::narrowing<sal_uInt16>(sPath.toInt32()); + const std::u16string_view sPath = o3tl::getToken(sGroup, 1, GLOS_DELIM); + sal_uInt16 nComparePath = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sPath)); if(nCurrentPath == nComparePath && o3tl::getToken(sGroup, 0, GLOS_DELIM) == sCurBase) bPathEqual = true; diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index b676b028f018..317179e570c2 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -18,6 +18,7 @@ */ #include <o3tl/any.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <editeng/paperinf.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -57,34 +58,34 @@ OUString MakeSender() sal_Int32 nSttPos = 0; bool bLastLength = true; do { - OUString sToken = sSenderToken.getToken( 0, ';', nSttPos ); - if (sToken == "COMPANY") + std::u16string_view sToken = o3tl::getToken(sSenderToken, 0, ';', nSttPos ); + if (sToken == u"COMPANY") { sal_Int32 nOldLen = sRet.getLength(); sRet.append(rUserOpt.GetCompany()); bLastLength = sRet.getLength() != nOldLen; } - else if (sToken == "CR") + else if (sToken == u"CR") { if(bLastLength) sRet.append(NEXTLINE); bLastLength = true; } - else if (sToken == "FIRSTNAME") + else if (sToken == u"FIRSTNAME") sRet.append(rUserOpt.GetFirstName()); - else if (sToken == "LASTNAME") + else if (sToken == u"LASTNAME") sRet.append(rUserOpt.GetLastName()); - else if (sToken == "ADDRESS") + else if (sToken == u"ADDRESS") sRet.append(rUserOpt.GetStreet()); - else if (sToken == "COUNTRY") + else if (sToken == u"COUNTRY") sRet.append(rUserOpt.GetCountry()); - else if (sToken == "POSTALCODE") + else if (sToken == u"POSTALCODE") sRet.append(rUserOpt.GetZip()); - else if (sToken == "CITY") + else if (sToken == u"CITY") sRet.append(rUserOpt.GetCity()); - else if (sToken == "STATEPROV") + else if (sToken == u"STATEPROV") sRet.append(rUserOpt.GetState()); - else if (!sToken.isEmpty()) //spaces + else if (!sToken.empty()) //spaces sRet.append(sToken); } while (nSttPos>=0); return sRet.makeStringAndClear(); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index be7b4291e0bd..28f080af3e1b 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -175,8 +175,8 @@ std::unique_ptr<SwTextBlocks> SwGlossaries::GetGroupDoc(const OUString &rName, // so that groups remain there later (without access). bool SwGlossaries::NewGroupDoc(OUString& rGroupName, const OUString& rTitle) { - const OUString sNewPath(rGroupName.getToken(1, GLOS_DELIM)); - sal_uInt16 nNewPath = o3tl::narrowing<sal_uInt16>(sNewPath.toInt32()); + const std::u16string_view sNewPath(o3tl::getToken(rGroupName, 1, GLOS_DELIM)); + sal_uInt16 nNewPath = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sNewPath)); if (static_cast<size_t>(nNewPath) >= m_PathArr.size()) return false; const OUString sNewFilePath(m_PathArr[nNewPath]); diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 65ca88fd0077..3feb575e47aa 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -317,7 +317,7 @@ void SwGlossaryList::Update() // for the current subpath. if( nGroupPath == nPath ) { - OUString sCompareGroup = pGroup->sName.getToken(0, GLOS_DELIM); + std::u16string_view sCompareGroup = o3tl::getToken(pGroup->sName, 0, GLOS_DELIM); bool bFound = std::any_of(aFoundGroupNames.begin(), aFoundGroupNames.end(), [&sCompareGroup](const OUString& rGroupName) { return sCompareGroup == rGroupName; }); diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index 0f4c6aa5f947..c0db73db46b9 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -20,7 +20,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <awt/vclxprinter.hxx> #include <cppuhelper/supportsservice.hxx> - +#include <comphelper/string.hxx> #include <vcl/print.hxx> #include <vcl/jobset.hxx> diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 8e6feef618ab..c1a53627060b 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/util/theMacroExpander.hpp> #include <o3tl/enumarray.hxx> +#include <o3tl/string_view.hxx> #include "itemholder1.hxx" @@ -740,7 +741,7 @@ bool SvtPathOptions::SearchFile( OUString& rIniFile, SvtPathOptions::Paths ePath sal_Int32 nIniIndex = 0; do { - OUString aToken = aIniFile.getToken( 0, '/', nIniIndex ); + std::u16string_view aToken = o3tl::getToken(aIniFile, 0, '/', nIniIndex ); aObj.insertName(aToken); } while ( nIniIndex >= 0 ); @@ -799,7 +800,7 @@ bool SvtPathOptions::SearchFile( OUString& rIniFile, SvtPathOptions::Paths ePath do { bool bIsURL = true; - OUString aPathToken = aPath.getToken( 0, SEARCHPATH_DELIMITER, nPathIndex ); + OUString aPathToken( aPath.getToken( 0, SEARCHPATH_DELIMITER, nPathIndex ) ); INetURLObject aObj( aPathToken ); if ( aObj.HasError() ) { @@ -819,7 +820,7 @@ bool SvtPathOptions::SearchFile( OUString& rIniFile, SvtPathOptions::Paths ePath sal_Int32 nIniIndex = 0; do { - OUString aToken = aIniFile.getToken( 0, '/', nIniIndex ); + std::u16string_view aToken = o3tl::getToken(aIniFile, 0, '/', nIniIndex ); aObj.insertName(aToken); } while ( nIniIndex >= 0 ); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 50882532edc9..15e088d7f3c6 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -371,8 +371,8 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) while ( nIndex >= 0 ) { sal_Int32 nPrevIndex = nIndex; - OUString aToken = aText.getToken( 0, m_cMultiSep, nIndex ); - sal_Int32 nTokenLen = aToken.getLength(); + std::u16string_view aToken = o3tl::getToken(aText, 0, m_cMultiSep, nIndex ); + sal_Int32 nTokenLen = aToken.size(); aToken = comphelper::string::strip(aToken, ' '); sal_Int32 nP = m_pImplLB->GetEntryList().FindEntry( aToken ); if ((nP != LISTBOX_ENTRY_NOTFOUND) && (!m_pImplLB->GetEntryList().IsEntryPosSelected(nP))) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index bb511a34b8b0..7bcc11266719 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -61,6 +61,7 @@ #include <i18nlangtag/languagetag.hxx> #include <vcl/unohelp2.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <officecfg/Office/Common.hxx> #include <tools/json_writer.hxx> @@ -2838,8 +2839,8 @@ void Edit::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rD mpDDInfo->bIsStringSupported = std::any_of(rFlavors.begin(), rFlavors.end(), [](const css::datatransfer::DataFlavor& rFlavor) { sal_Int32 nIndex = 0; - const OUString aMimetype = rFlavor.MimeType.getToken( 0, ';', nIndex ); - return aMimetype == "text/plain"; + const std::u16string_view aMimetype = o3tl::getToken(rFlavor.MimeType, 0, ';', nIndex ); + return aMimetype == u"text/plain"; }); } diff --git a/vcl/unx/generic/app/geninst.cxx b/vcl/unx/generic/app/geninst.cxx index 705a30e86933..191d87ca76b7 100644 --- a/vcl/unx/generic/app/geninst.cxx +++ b/vcl/unx/generic/app/geninst.cxx @@ -31,6 +31,7 @@ #include <vcl/opengl/OpenGLContext.hxx> #endif #include <unx/geninst.h> +#include <o3tl/string_view.hxx> // SalYieldMutex @@ -61,13 +62,13 @@ OUString SalGenericInstance::getOSVersion() { aKernelVer = OUString::createFromAscii( aVerBuffer ); // "Linux version 3.16.7-29-desktop ..." - OUString aVers = aKernelVer.getToken( 2, ' ' ); + std::u16string_view aVers = o3tl::getToken(aKernelVer, 2, ' ' ); // "3.16.7-29-desktop ..." - sal_Int32 nTooDetailed = aVers.indexOf( '.', 2); + size_t nTooDetailed = aVers.find( '.', 2); if (nTooDetailed < 1 || nTooDetailed > 8) aKernelVer = "Linux (misparsed version)"; else // "3.16.7-29-desktop ..." - aKernelVer = OUString::Concat("Linux ") + aVers.subView(0, nTooDetailed); + aKernelVer = OUString::Concat("Linux ") + aVers.substr(0, nTooDetailed); } fclose( pVersion ); } diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index ccdb8bed0f52..37384c7b58d5 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -29,6 +29,7 @@ #include <osl/process.h> #include <sal/macros.h> #include <sal/log.hxx> +#include <comphelper/string.hxx> #include <configsettings.hxx> #include <o3tl/string_view.hxx> diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 4370f01901ca..d35b496bf265 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1325,20 +1325,20 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > sal_Int32 nIndex = 0; if( o3tl::getToken(pFlavors->MimeType, 0, ';', nIndex ) == u"text/plain" ) { - OUString aToken(pFlavors->MimeType.getToken( 0, ';', nIndex )); + std::u16string_view aToken(o3tl::getToken(pFlavors->MimeType, 0, ';', nIndex )); // omit text/plain;charset=unicode since it is not well defined - if( aToken == "charset=unicode" ) + if( aToken == u"charset=unicode" ) { pAtoms++; continue; } bHaveText = true; - if( aToken == "charset=utf-16" ) + if( aToken == u"charset=utf-16" ) { bHaveUTF16 = true; pFlavors->DataType = cppu::UnoType<OUString>::get(); } - else if( aToken == "charset=utf-8" ) + else if( aToken == u"charset=utf-8" ) { aUTF8Type = *pAtoms; } diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 29f4b16b54b1..a0f00106013f 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -26,6 +26,7 @@ #include <unx/cupsmgr.hxx> +#include <o3tl/string_view.hxx> #include <osl/thread.h> #include <osl/file.h> #include <osl/conditn.hxx> @@ -811,12 +812,12 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi sal_Int32 nIndex = 0; do { - OUString aToken = aInfo.m_aAuthInfoRequired.getToken(0, ',', nIndex); - if (aToken == "domain") + std::u16string_view aToken = o3tl::getToken(aInfo.m_aAuthInfoRequired, 0, ',', nIndex); + if (aToken == u"domain") bDomain = true; - else if (aToken == "username") + else if (aToken == u"username") bUser = true; - else if (aToken == "password") + else if (aToken == u"password") bPass = true; } while (nIndex >= 0); diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 183f429e909c..2b62563f56b7 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -45,6 +45,7 @@ #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> #include <tools/urlobj.hxx> #include <unotools/ucbhelper.hxx> #include <o3tl/string_view.hxx> @@ -787,13 +788,13 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() { if( aSelectedFiles[nIndex].indexOf('.') > 0 ) { - OUString sExtension; + std::u16string_view sExtension; nTokenIndex = 0; do - sExtension = aSelectedFiles[nIndex].getToken( 0, '.', nTokenIndex ); + sExtension = o3tl::getToken(aSelectedFiles[nIndex], 0, '.', nTokenIndex ); while( nTokenIndex >= 0 ); - if( sExtension.getLength() >= 3 ) // 3 = typical/minimum extension length + if( sExtension.size() >= 3 ) // 3 = typical/minimum extension length { OUString aNewFilter; OUString aOldFilter = getCurrentFilter(); @@ -801,7 +802,7 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() if ( m_pFilterVector) for (auto const& filter : *m_pFilterVector) { - if( lcl_matchFilter( filter.getFilter(), "*." + sExtension ) ) + if( lcl_matchFilter( filter.getFilter(), OUString::Concat("*.") + sExtension ) ) { if( aNewFilter.isEmpty() ) aNewFilter = filter.getTitle(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index d499cf0168f9..a2439b683923 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -678,8 +678,8 @@ std::vector<css::datatransfer::DataFlavor> GtkTransferable::getTransferDataFlavo if (o3tl::getToken(aFlavor.MimeType, 0, ';', nIndex) == u"text/plain") { bHaveText = true; - OUString aToken(aFlavor.MimeType.getToken(0, ';', nIndex)); - if (aToken == "charset=utf-16") + std::u16string_view aToken(o3tl::getToken(aFlavor.MimeType, 0, ';', nIndex)); + if (aToken == u"charset=utf-16") { bHaveUTF16 = true; aFlavor.DataType = cppu::UnoType<OUString>::get(); @@ -1421,8 +1421,8 @@ std::vector<GtkTargetEntry> VclToGtkHelper::FormatsToGtk(const css::uno::Sequenc if (o3tl::getToken(rFlavor.MimeType, 0, ';', nIndex) == u"text/plain") { bHaveText = true; - OUString aToken(rFlavor.MimeType.getToken(0, ';', nIndex)); - if (aToken == "charset=utf-8") + std::u16string_view aToken(o3tl::getToken(rFlavor.MimeType, 0, ';', nIndex)); + if (aToken == u"charset=utf-8") { bHaveUTF8 = true; } diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index 619c24b20797..f561d60bdb70 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -20,6 +20,7 @@ #include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <tools/stream.hxx> +#include <o3tl/string_view.hxx> #include <window.h> #include <strings.hrc> @@ -74,7 +75,7 @@ namespace { MenuAndId decode_command(const gchar *action_name) { - OString sCommand(action_name); + std::string_view sCommand(action_name); sal_Int32 nIndex = 0; std::string_view sWindow = o3tl::getToken(sCommand, 0, '-', nIndex); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5d5320163c6f..9537c5a65786 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5863,7 +5863,7 @@ void DomainMapper_Impl::handleToc else { sal_Int32 nIndex = 0; - sValue.getToken( 0, '-', nIndex ); + o3tl::getToken(sValue, 0, '-', nIndex ); nMaxLevel = static_cast<sal_Int16>(nIndex != -1 ? o3tl::toInt32(sValue.subView(nIndex)) : 0); } } diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 4d99737f56f1..6e5e7f068b01 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -33,6 +33,7 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/namespacemap.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -987,9 +988,9 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( if( xLabel.is() ) { aRange = xLabel->getSourceRangeRepresentation(); - OUString aSecondToken = aRange.getToken(1, ' '); - if( !aSecondToken.isEmpty() ) - aUsageMap[aSecondToken.toInt32()] = true; + std::u16string_view aSecondToken = o3tl::getToken(aRange, 1, ' '); + if( !aSecondToken.empty() ) + aUsageMap[o3tl::toInt32(aSecondToken)] = true; } } diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index c39d8f77f3cc..20bf6d5a2386 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -27,6 +27,7 @@ #include <xmloff/xmltoken.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/XOutputStream.hpp> |