diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-04 11:14:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-05 12:57:00 +0200 |
commit | 9f1701d01d9f664828356976d8592492f85b30f5 (patch) | |
tree | a91eaef0674591af87b06096fdd186283559a8de /sd | |
parent | b8bb44161aeb6e00526a38343b63e678ce7d4a1a (diff) |
use more o3tl::getToken
found by inspecting call sites of OUString::getToken
Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/ppt/pptinanimations.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel2.cxx | 21 | ||||
-rw-r--r-- | sd/source/ui/framework/factories/FullScreenPane.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/func/fuexecuteinteraction.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 25 |
6 files changed, 38 insertions, 40 deletions
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 + "." + |