diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 14:33:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 19:02:00 +0200 |
commit | 1aced94715b73cc0de2ab91963a4f2a2102d845a (patch) | |
tree | e87ae3df4d0ec9940bdaaf99ec045981070c250e /sfx2 | |
parent | d2572dc9d6c7cda9d6e08e46c42048e12e4f04e0 (diff) |
use more string_view in sfx2
Change-Id: I36db3d26a576adeb4d2427c28320096d5464f565
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132964
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/bastyp/sfxhtml.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 21 |
3 files changed, 18 insertions, 17 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 5cc448b2ccc3..a3c3a6ae1f73 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -121,12 +121,12 @@ bool GetPosSizeFromString( std::u16string_view rStr, Point& rPos, Size& rSize ) return rSize.Width() >= 0 && rSize.Height() >= 0; } -bool GetSplitSizeFromString( const OUString& rStr, Size& rSize ) +bool GetSplitSizeFromString( std::u16string_view rStr, Size& rSize ) { - sal_Int32 nIndex = rStr.indexOf( ',' ); - if ( nIndex != -1 ) + size_t nIndex = rStr.find( ',' ); + if ( nIndex != std::u16string_view::npos ) { - OUString aStr = rStr.copy( nIndex+1 ); + std::u16string_view aStr = rStr.substr( nIndex+1 ); sal_Int32 nCount = comphelper::string::getTokenCount(aStr, ';'); if ( nCount != 2 ) diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 9116ae8efa32..efaab39ff881 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -314,10 +314,10 @@ const OUString& SfxHTMLParser::GetScriptTypeString( } double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm, - LanguageType& eNumLang, const OUString& aValStr, const OUString& aNumStr, + LanguageType& eNumLang, const OUString& aValStr, std::u16string_view aNumStr, SvNumberFormatter& rFormatter ) { - LanguageType eParseLang(aNumStr.toInt32()); + LanguageType eParseLang(o3tl::toInt32(aNumStr)); sal_uInt32 nParseForm = rFormatter.GetFormatForLanguageIfBuiltIn( 0, eParseLang ); double fVal; (void)rFormatter.IsNumberFormat(aValStr, nParseForm, fVal); @@ -325,7 +325,7 @@ double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm, { sal_Int32 nIdx {0}; eNumLang = LanguageType(o3tl::toInt32(o3tl::getToken(aNumStr, 1, ';', nIdx ))); - OUString aFormat( aNumStr.copy( nIdx ) ); + OUString aFormat( aNumStr.substr( nIdx ) ); sal_Int32 nCheckPos; SvNumFormatType nType; if ( eNumLang != LANGUAGE_SYSTEM ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index bd0329fb2ac3..f45124849241 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -62,6 +62,7 @@ #include <tools/stream.hxx> #include <tools/urlobj.hxx> #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> using namespace com::sun::star; using ::com::sun::star::beans::PropertyValue; @@ -141,7 +142,7 @@ private: ) const; static sal_uInt16 impl_findSlotParam( - const OUString& i_rFactoryURL + std::u16string_view i_rFactoryURL ); static SfxObjectShellRef impl_findObjectShell( @@ -444,20 +445,20 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal } -sal_uInt16 SfxFrameLoader_Impl::impl_findSlotParam( const OUString& i_rFactoryURL ) +sal_uInt16 SfxFrameLoader_Impl::impl_findSlotParam( std::u16string_view i_rFactoryURL ) { - OUString sSlotParam; - const sal_Int32 nParamPos = i_rFactoryURL.indexOf( '?' ); - if ( nParamPos >= 0 ) + std::u16string_view sSlotParam; + const size_t nParamPos = i_rFactoryURL.find( '?' ); + if ( nParamPos != std::u16string_view::npos ) { // currently only the "slot" parameter is supported - const sal_Int32 nSlotPos = i_rFactoryURL.indexOf( "slot=", nParamPos ); - if ( nSlotPos > 0 ) - sSlotParam = i_rFactoryURL.copy( nSlotPos + 5 ); + const size_t nSlotPos = i_rFactoryURL.find( u"slot=", nParamPos ); + if ( nSlotPos > 0 && nSlotPos != std::u16string_view::npos ) + sSlotParam = i_rFactoryURL.substr( nSlotPos + 5 ); } - if ( !sSlotParam.isEmpty() ) - return sal_uInt16( sSlotParam.toInt32() ); + if ( !sSlotParam.empty() ) + return sal_uInt16( o3tl::toInt32(sSlotParam) ); return 0; } |