include/sfx2/childwin.hxx | 2 +- include/sfx2/sfxhtml.hxx | 2 +- sfx2/source/appl/childwin.cxx | 8 ++++---- sfx2/source/bastyp/sfxhtml.cxx | 6 +++--- sfx2/source/view/frmload.cxx | 21 +++++++++++---------- 5 files changed, 20 insertions(+), 19 deletions(-)
New commits: commit 1aced94715b73cc0de2ab91963a4f2a2102d845a Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Apr 13 14:33:56 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Apr 13 19:02:00 2022 +0200 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.gran...@collabora.co.uk> diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index ccfb32235e77..68ad6ff509f9 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -228,7 +228,7 @@ const int nCloseResponseToJustHide = -42; bool GetPosSizeFromString( std::u16string_view rStr, Point& rPos, Size& rSize ); -bool GetSplitSizeFromString( const OUString& rStr, Size& rSize ); +bool GetSplitSizeFromString( std::u16string_view rStr, Size& rSize ); #endif diff --git a/include/sfx2/sfxhtml.hxx b/include/sfx2/sfxhtml.hxx index ff7ee4bfb96e..af22df207b83 100644 --- a/include/sfx2/sfxhtml.hxx +++ b/include/sfx2/sfxhtml.hxx @@ -68,7 +68,7 @@ public: // <TD SDVAL="..." SDNUM="..."> static double GetTableDataOptionsValNum( sal_uInt32& nNumForm, LanguageType& eNumLang, const OUString& aValStr, - const OUString& aNumStr, SvNumberFormatter& rFormatter ); + std::u16string_view aNumStr, SvNumberFormatter& rFormatter ); protected: // Start a file download. This is done asynchronously or synchronously. 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; }