summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-09-22 20:01:38 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-09-22 21:14:15 +0200
commitea29e9936a3e628f95ca4ae1d5816adfce87318f (patch)
tree85a322466328e68c98ad2fe6f0231225724dd9c4 /sfx2/source
parent8f2f2a8d131eef60164c0586fb73b69fd950f15d (diff)
Extend loplugin:stringviewparam to starts/endsWith: sfx2
Change-Id: Icac2c5877059208ed348aa824071803e415f374f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122482 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/sfxhelp.cxx13
-rw-r--r--sfx2/source/doc/graphhelp.cxx13
-rw-r--r--sfx2/source/doc/graphhelp.hxx3
-rw-r--r--sfx2/source/view/classificationhelper.cxx7
4 files changed, 21 insertions, 15 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index b9c7f4b6d47d..5f0b3f7f60ff 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -23,6 +23,7 @@
#include <string_view>
#include <algorithm>
#include <cassert>
+#include <cstddef>
#ifdef MACOSX
#include <premac.h>
#include <Foundation/NSString.h>
@@ -50,6 +51,7 @@
#include <unotools/pathoptions.hxx>
#include <rtl/byteseq.hxx>
#include <rtl/ustring.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <osl/process.h>
#include <osl/file.hxx>
@@ -443,7 +445,7 @@ namespace
}
}
-OUString SfxHelp::GetHelpModuleName_Impl(const OUString& rHelpID)
+OUString SfxHelp::GetHelpModuleName_Impl(std::u16string_view rHelpID)
{
OUString aFactoryShortName;
@@ -452,11 +454,12 @@ OUString SfxHelp::GetHelpModuleName_Impl(const OUString& rHelpID)
//otherwise unknown. Cosmetic, same help is shown in any case because its
//in the shared section, but title bar would state "Writer" when context is
//expected to be "Calc"
- OUString sRemainder;
- if (rHelpID.startsWith("modules/", &sRemainder))
+ std::u16string_view sRemainder;
+ if (o3tl::starts_with(rHelpID, u"modules/", &sRemainder))
{
- sal_Int32 nEndModule = sRemainder.indexOf('/');
- aFactoryShortName = nEndModule != -1 ? sRemainder.copy(0, nEndModule) : sRemainder;
+ std::size_t nEndModule = sRemainder.find(u'/');
+ aFactoryShortName = nEndModule != std::u16string_view::npos
+ ? sRemainder.substr(0, nEndModule) : sRemainder;
}
if (aFactoryShortName.isEmpty())
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index cc1299c01b1c..6371d10112e4 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -39,6 +39,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <o3tl/string_view.hxx>
#include "graphhelp.hxx"
#include <bitmaps.hlst>
@@ -235,27 +236,27 @@ bool GraphicHelper::getThumbnailReplacement_Impl(std::u16string_view rResID, con
}
// static
-OUString GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( const OUString& aFactoryShortName )
+OUString GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( std::u16string_view aFactoryShortName )
{
OUString sResult;
- if ( aFactoryShortName == "scalc" )
+ if ( aFactoryShortName == u"scalc" )
{
sResult = BMP_128X128_CALC_DOC;
}
- else if ( aFactoryShortName == "sdraw" )
+ else if ( aFactoryShortName == u"sdraw" )
{
sResult = BMP_128X128_DRAW_DOC;
}
- else if ( aFactoryShortName == "simpress" )
+ else if ( aFactoryShortName == u"simpress" )
{
sResult = BMP_128X128_IMPRESS_DOC;
}
- else if ( aFactoryShortName == "smath" )
+ else if ( aFactoryShortName == u"smath" )
{
sResult = BMP_128X128_MATH_DOC;
}
- else if ( aFactoryShortName == "swriter" || aFactoryShortName.startsWith("swriter/") )
+ else if ( aFactoryShortName == u"swriter" || o3tl::starts_with(aFactoryShortName, u"swriter/") )
{
sResult = BMP_128X128_WRITER_DOC;
}
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index bfaf3e223d90..e0129c917b1e 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -57,7 +57,8 @@ public:
GDIMetaFile const * pMetaFile,
const css::uno::Reference< css::io::XStream >& xStream );
- static OUString getThumbnailReplacementIDByFactoryName_Impl(const OUString& aFactoryShortName);
+ static OUString getThumbnailReplacementIDByFactoryName_Impl(
+ std::u16string_view aFactoryShortName);
static bool getThumbnailReplacement_Impl(
std::u16string_view rResID,
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index ef864760381e..629ceeaef560 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -41,6 +41,7 @@
#include <vcl/weld.hxx>
#include <svl/fstathelper.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
using namespace com::sun::star;
@@ -888,11 +889,11 @@ void SfxClassificationHelper::UpdateInfobar(SfxViewFrame& rViewFrame)
}
}
-SfxClassificationPolicyType SfxClassificationHelper::stringToPolicyType(const OUString& rType)
+SfxClassificationPolicyType SfxClassificationHelper::stringToPolicyType(std::u16string_view rType)
{
- if (rType.startsWith(PROP_PREFIX_EXPORTCONTROL()))
+ if (o3tl::starts_with(rType, PROP_PREFIX_EXPORTCONTROL()))
return SfxClassificationPolicyType::ExportControl;
- else if (rType.startsWith(PROP_PREFIX_NATIONALSECURITY()))
+ else if (o3tl::starts_with(rType, PROP_PREFIX_NATIONALSECURITY()))
return SfxClassificationPolicyType::NationalSecurity;
else
return SfxClassificationPolicyType::IntellectualProperty;