diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-14 11:48:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-14 21:13:00 +0200 |
commit | 4475483b92da89f6ab7fa503c6db920b7b50d1b7 (patch) | |
tree | fb881733ddaba22fff30e2246c9b860068969da0 /sd/source/ui | |
parent | 003e2873e4463974e59e1f909f9250cde743851f (diff) |
use more string_view in sd
Change-Id: I301f3d8a6634df8be5fdd42649c0c265da8f9099
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133004
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 21 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/unopage.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsh.cxx | 2 |
6 files changed, 20 insertions, 19 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 6150321ca33a..6fe599e44197 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -72,6 +72,7 @@ #include <sdhtmlfilter.hxx> #include <sdpdffilter.hxx> #include <framework/FrameworkHelper.hxx> +#include <o3tl/string_view.hxx> #include <sfx2/zoomitem.hxx> @@ -698,7 +699,7 @@ SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool() return mpDoc->GetStyleSheetPool(); } -void DrawDocShell::GotoBookmark(const OUString& rBookmark) +void DrawDocShell::GotoBookmark(std::u16string_view rBookmark) { auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ); if (!pDrawViewShell) @@ -710,28 +711,28 @@ void DrawDocShell::GotoBookmark(const OUString& rBookmark) sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND; SdrObject* pObj = nullptr; - static const OUStringLiteral sInteraction( u"action?" ); - if ( rBookmark.match( sInteraction ) ) + static constexpr std::u16string_view sInteraction( u"action?" ); + if ( o3tl::starts_with(rBookmark, sInteraction ) ) { - static const OUStringLiteral sJump( u"jump=" ); - if ( rBookmark.match( sJump, sInteraction.getLength() ) ) + static constexpr std::u16string_view sJump( u"jump=" ); + if ( o3tl::starts_with(rBookmark.substr( sInteraction.size() ), sJump ) ) { - OUString aDestination( rBookmark.copy( sInteraction.getLength() + sJump.getLength() ) ); - if ( aDestination.match( "firstslide" ) ) + std::u16string_view aDestination( rBookmark.substr( sInteraction.size() + sJump.size() ) ); + if ( o3tl::starts_with(aDestination, u"firstslide" ) ) { nPageNumber = 1; } - else if ( aDestination.match( "lastslide" ) ) + else if ( o3tl::starts_with(aDestination, u"lastslide" ) ) { nPageNumber = mpDoc->GetPageCount() - 2; } - else if ( aDestination.match( "previousslide" ) ) + else if ( o3tl::starts_with(aDestination, u"previousslide" ) ) { SdPage* pPage = pDrawViewShell->GetActualPage(); nPageNumber = pPage->GetPageNum(); nPageNumber = nPageNumber > 2 ? nPageNumber - 2 : SDRPAGE_NOTFOUND; } - else if ( aDestination.match( "nextslide" ) ) + else if ( o3tl::starts_with(aDestination, u"nextslide" ) ) { SdPage* pPage = pDrawViewShell->GetActualPage(); nPageNumber = pPage->GetPageNum() + 2; diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index 5f15ffe9922f..15fa5ebd41ad 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -124,7 +124,7 @@ public: void Disconnect(sd::ViewShell const * pViewSh); void UpdateTablePointers(); - void GotoBookmark(const OUString& rBookmark); + void GotoBookmark(std::u16string_view rBookmark); BitmapEx GetPagePreviewBitmap(SdPage* pPage); diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 44bb83d44979..c56a0f33e604 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -253,7 +253,7 @@ public: bool IsSelected(sal_uInt16 nPage); bool IsVisible(sal_uInt16 nPage); - void GotoBookmark(const OUString& rBookmark); + void GotoBookmark(std::u16string_view rBookmark); //Realize multi-selection of objects, If object is marked, the //corresponding entry is set true, else the corresponding entry is set //false. diff --git a/sd/source/ui/inc/unopage.hxx b/sd/source/ui/inc/unopage.hxx index 993a6634cc68..af09e5982c65 100644 --- a/sd/source/ui/inc/unopage.hxx +++ b/sd/source/ui/inc/unopage.hxx @@ -70,7 +70,7 @@ protected: virtual void getBackground( css::uno::Any& rValue ); OUString getBookmarkURL() const; - void setBookmarkURL( OUString const & rURL ); + void setBookmarkURL( std::u16string_view rURL ); void SetLeftBorder( sal_Int32 nValue ); void SetRightBorder( sal_Int32 nValue ); diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index d5576855f923..bc042babe8d5 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -1553,17 +1553,17 @@ OUString SdGenericDrawPage::getBookmarkURL() const return aRet.makeStringAndClear(); } -void SdGenericDrawPage::setBookmarkURL( OUString const & rURL ) +void SdGenericDrawPage::setBookmarkURL( std::u16string_view rURL ) { if( !SvxFmDrawPage::mpPage ) return; - sal_Int32 nIndex = rURL.indexOf( '#' ); - if( nIndex == -1 ) + size_t nIndex = rURL.find( '#' ); + if( nIndex == std::u16string_view::npos ) return; - const OUString aFileName( rURL.copy( 0, nIndex ) ); - const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) ); + const OUString aFileName( rURL.substr( 0, nIndex ) ); + const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( OUString(rURL.substr( nIndex+1 )) ) ); if( !aFileName.isEmpty() && !aBookmarkName.isEmpty() ) { diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx index 418ebadf0dfb..c0e09a4787de 100644 --- a/sd/source/ui/view/drviewsh.cxx +++ b/sd/source/ui/view/drviewsh.cxx @@ -29,7 +29,7 @@ namespace sd { -void DrawViewShell::GotoBookmark(const OUString& rBookmark) +void DrawViewShell::GotoBookmark(std::u16string_view rBookmark) { ::sd::DrawDocShell* pDocSh = GetDocSh(); if( pDocSh ) |