summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-25 08:14:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-30 12:32:14 +0100
commit8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch)
treedd45d452202998297b8562743ea6345462304d04 /sfx2
parentd05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff)
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/recentdocsview.hxx2
-rw-r--r--sfx2/source/appl/newhelp.cxx6
-rw-r--r--sfx2/source/appl/newhelp.hxx6
-rw-r--r--sfx2/source/control/charwin.cxx2
-rw-r--r--sfx2/source/control/recentdocsview.cxx18
-rw-r--r--sfx2/source/control/templatedlglocalview.cxx2
-rw-r--r--sfx2/source/control/templatelocalview.cxx20
-rw-r--r--sfx2/source/control/templatesearchview.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx20
-rw-r--r--sfx2/source/dialog/infobar.cxx14
-rw-r--r--sfx2/source/doc/doctemplates.cxx6
-rw-r--r--sfx2/source/doc/sfxmodelfactory.cxx4
-rw-r--r--sfx2/source/inc/sfxurlrelocator.hxx2
-rw-r--r--sfx2/source/inc/templatesearchview.hxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx16
-rw-r--r--sfx2/source/view/lokhelper.cxx8
16 files changed, 65 insertions, 65 deletions
diff --git a/sfx2/inc/recentdocsview.hxx b/sfx2/inc/recentdocsview.hxx
index c8db9bc3c043..77c350d40b83 100644
--- a/sfx2/inc/recentdocsview.hxx
+++ b/sfx2/inc/recentdocsview.hxx
@@ -63,7 +63,7 @@ public:
void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
- static bool typeMatchesExtension(ApplicationType type, const OUString &rExt);
+ static bool typeMatchesExtension(ApplicationType type, std::u16string_view rExt);
static BitmapEx getDefaultThumbnail(const OUString &rURL);
ApplicationType mnFileTypes;
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index ecca2f806228..a01f5d6a6bdc 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1095,7 +1095,7 @@ static void GetBookmarkEntry_Impl
}
}
-void BookmarksTabPage_Impl::DoAction(const OString& rAction)
+void BookmarksTabPage_Impl::DoAction(std::string_view rAction)
{
if (rAction == "display")
aDoubleClickHdl.Call(nullptr);
@@ -1379,7 +1379,7 @@ void SfxHelpIndexWindow_Impl::SetActiveFactory()
}
}
-HelpTabPage_Impl* SfxHelpIndexWindow_Impl::GetPage(const OString& rName)
+HelpTabPage_Impl* SfxHelpIndexWindow_Impl::GetPage(std::string_view rName)
{
HelpTabPage_Impl* pPage = nullptr;
@@ -2542,7 +2542,7 @@ void SfxHelpWindow_Impl::SetHelpURL( const OUString& rURL )
SetFactory( aObj.GetHost() );
}
-void SfxHelpWindow_Impl::DoAction(const OString& rActionId)
+void SfxHelpWindow_Impl::DoAction(std::string_view rActionId)
{
if (rActionId == "index")
{
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index d12f38e29ccf..f803bffc15a2 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -199,7 +199,7 @@ private:
DECL_LINK(CommandHdl, const CommandEvent&, bool);
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
- void DoAction(const OString& rAction);
+ void DoAction(std::string_view rAction);
public:
BookmarksTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow_Impl* pIdxWin);
@@ -241,7 +241,7 @@ private:
void Initialize();
void SetActiveFactory();
- HelpTabPage_Impl* GetPage(const OString&);
+ HelpTabPage_Impl* GetPage(std::string_view );
inline ContentTabPage_Impl* GetContentPage();
inline IndexTabPage_Impl* GetIndexPage();
@@ -468,7 +468,7 @@ public:
void SetFactory( const OUString& rFactory );
void SetHelpURL( const OUString& rURL );
- void DoAction(const OString& rAction);
+ void DoAction(std::string_view rAction);
void CloseWindow();
weld::Container* GetContainer() { return m_xHelpTextWindow.get(); }
diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx
index 6e404c7257d7..f62cb1c368f4 100644
--- a/sfx2/source/control/charwin.cxx
+++ b/sfx2/source/control/charwin.cxx
@@ -120,7 +120,7 @@ void SvxCharView::createContextMenu()
Invalidate();
}
-void SvxCharView::ContextMenuSelect(const OString& rMenuId)
+void SvxCharView::ContextMenuSelect(std::string_view rMenuId)
{
if (rMenuId == "clearchar")
maClearClickHdl.Call(this);
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 958785a12394..e1b086583220 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -155,33 +155,33 @@ RecentDocsView::~RecentDocsView()
}
}
-bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &rExt)
+bool RecentDocsView::typeMatchesExtension(ApplicationType type, std::u16string_view rExt)
{
bool bRet = false;
- if (rExt == "odt" || rExt == "fodt" || rExt == "doc" || rExt == "docx" ||
- rExt == "rtf" || rExt == "txt" || rExt == "odm" || rExt == "otm")
+ if (rExt == u"odt" || rExt == u"fodt" || rExt == u"doc" || rExt == u"docx" ||
+ rExt == u"rtf" || rExt == u"txt" || rExt == u"odm" || rExt == u"otm")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_WRITER);
}
- else if (rExt == "ods" || rExt == "fods" || rExt == "xls" || rExt == "xlsx")
+ else if (rExt == u"ods" || rExt == u"fods" || rExt == u"xls" || rExt == u"xlsx")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_CALC);
}
- else if (rExt == "odp" || rExt == "fodp" || rExt == "pps" || rExt == "ppt" ||
- rExt == "pptx")
+ else if (rExt == u"odp" || rExt == u"fodp" || rExt == u"pps" || rExt == u"ppt" ||
+ rExt == u"pptx")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_IMPRESS);
}
- else if (rExt == "odg" || rExt == "fodg")
+ else if (rExt == u"odg" || rExt == u"fodg")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_DRAW);
}
- else if (rExt == "odb")
+ else if (rExt == u"odb")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_DATABASE);
}
- else if (rExt == "odf")
+ else if (rExt == u"odf")
{
bRet = static_cast<bool>(type & ApplicationType::TYPE_MATH);
}
diff --git a/sfx2/source/control/templatedlglocalview.cxx b/sfx2/source/control/templatedlglocalview.cxx
index 1a50f09e2816..3e60830e5bd9 100644
--- a/sfx2/source/control/templatedlglocalview.cxx
+++ b/sfx2/source/control/templatedlglocalview.cxx
@@ -92,7 +92,7 @@ void TemplateDlgLocalView::createContextMenu(const bool bIsDefault)
mxTreeView.get(), tools::Rectangle(maPosition, Size(1, 1))));
}
-void TemplateDlgLocalView::ContextMenuSelectHdl(const OString& rIdent)
+void TemplateDlgLocalView::ContextMenuSelectHdl(std::string_view rIdent)
{
if (rIdent == "open")
maOpenTemplateHdl.Call(maSelectedItem);
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 67481d7600e9..d077b46a2f33 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -29,28 +29,28 @@
using namespace ::com::sun::star;
-bool ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION filter, const OUString &rExt)
+bool ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION filter, std::u16string_view rExt)
{
- bool bRet = rExt == "ott" || rExt == "stw" || rExt == "oth" || rExt == "dot" || rExt == "dotx" || rExt == "otm"
- || rExt == "ots" || rExt == "stc" || rExt == "xlt" || rExt == "xltm" || rExt == "xltx"
- || rExt == "otp" || rExt == "sti" || rExt == "pot" || rExt == "potm" || rExt == "potx"
- || rExt == "otg" || rExt == "std";
+ bool bRet = rExt == u"ott" || rExt == u"stw" || rExt == u"oth" || rExt == u"dot" || rExt == u"dotx" || rExt == u"otm"
+ || rExt == u"ots" || rExt == u"stc" || rExt == u"xlt" || rExt == u"xltm" || rExt == u"xltx"
+ || rExt == u"otp" || rExt == u"sti" || rExt == u"pot" || rExt == u"potm" || rExt == u"potx"
+ || rExt == u"otg" || rExt == u"std";
if (filter == FILTER_APPLICATION::WRITER)
{
- bRet = rExt == "ott" || rExt == "stw" || rExt == "oth" || rExt == "dot" || rExt == "dotx" || rExt == "otm";
+ bRet = rExt == u"ott" || rExt == u"stw" || rExt == u"oth" || rExt == u"dot" || rExt == u"dotx" || rExt == u"otm";
}
else if (filter == FILTER_APPLICATION::CALC)
{
- bRet = rExt == "ots" || rExt == "stc" || rExt == "xlt" || rExt == "xltm" || rExt == "xltx";
+ bRet = rExt == u"ots" || rExt == u"stc" || rExt == u"xlt" || rExt == u"xltm" || rExt == u"xltx";
}
else if (filter == FILTER_APPLICATION::IMPRESS)
{
- bRet = rExt == "otp" || rExt == "sti" || rExt == "pot" || rExt == "potm" || rExt == "potx";
+ bRet = rExt == u"otp" || rExt == u"sti" || rExt == u"pot" || rExt == u"potm" || rExt == u"potx";
}
else if (filter == FILTER_APPLICATION::DRAW)
{
- bRet = rExt == "otg" || rExt == "std";
+ bRet = rExt == u"otg" || rExt == u"std";
}
return bRet;
@@ -220,7 +220,7 @@ void TemplateLocalView::createContextMenu(const bool bIsDefault)
Invalidate();
}
-void TemplateLocalView::ContextMenuSelectHdl(const OString& rIdent)
+void TemplateLocalView::ContextMenuSelectHdl(std::string_view rIdent)
{
if (rIdent == "open")
maOpenTemplateHdl.Call(maSelectedItem);
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index e986d6bde41c..e1d2f8083fac 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -155,7 +155,7 @@ void TemplateSearchView::createContextMenu(const bool bIsDefault)
ContextMenuSelectHdl(mxContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(maPosition, Size(1,1))));
}
-void TemplateSearchView::ContextMenuSelectHdl(const OString& rIdent)
+void TemplateSearchView::ContextMenuSelectHdl(std::string_view rIdent)
{
if (rIdent == MNI_OPEN)
maOpenTemplateHdl.Call(maSelectedItem);
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 7c86ca18b98d..9c442d01e837 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -110,16 +110,16 @@ namespace sfx2
namespace
{
- bool lclSupportsOOXMLEncryption(const OUString& aFilterName)
- {
- return aFilterName == "Calc MS Excel 2007 XML"
- || aFilterName == "MS Word 2007 XML"
- || aFilterName == "Impress MS PowerPoint 2007 XML"
- || aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay"
- || aFilterName == "Calc Office Open XML"
- || aFilterName == "Impress Office Open XML"
- || aFilterName == "Impress Office Open XML AutoPlay"
- || aFilterName == "Office Open XML Text";
+ bool lclSupportsOOXMLEncryption(std::u16string_view aFilterName)
+ {
+ return aFilterName == u"Calc MS Excel 2007 XML"
+ || aFilterName == u"MS Word 2007 XML"
+ || aFilterName == u"Impress MS PowerPoint 2007 XML"
+ || aFilterName == u"Impress MS PowerPoint 2007 XML AutoPlay"
+ || aFilterName == u"Calc Office Open XML"
+ || aFilterName == u"Impress Office Open XML"
+ || aFilterName == u"Impress Office Open XML AutoPlay"
+ || aFilterName == u"Office Open XML Text";
}
}
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index d46eb8f01440..915f33660e1d 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -427,19 +427,19 @@ void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const& pI
m_pChildWin->Update();
}
-bool SfxInfoBarContainerWindow::isInfobarEnabled(const OUString& sId)
+bool SfxInfoBarContainerWindow::isInfobarEnabled(std::u16string_view sId)
{
- if (sId == "readonly")
+ if (sId == u"readonly")
return officecfg::Office::UI::Infobar::Enabled::Readonly::get();
- if (sId == "signature")
+ if (sId == u"signature")
return officecfg::Office::UI::Infobar::Enabled::Signature::get();
- if (sId == "donate")
+ if (sId == u"donate")
return officecfg::Office::UI::Infobar::Enabled::Donate::get();
- if (sId == "getinvolved")
+ if (sId == u"getinvolved")
return officecfg::Office::UI::Infobar::Enabled::GetInvolved::get();
- if (sId == "hyphenationmissing")
+ if (sId == u"hyphenationmissing")
return officecfg::Office::UI::Infobar::Enabled::HyphenationMissing::get();
- if (sId == "whatsnew")
+ if (sId == u"whatsnew")
return officecfg::Office::UI::Infobar::Enabled::WhatsNew::get();
return true;
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 7c06fc7ac34c..4c1e99bde06d 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -99,11 +99,11 @@
#define TYPE_FSYS_FOLDER "application/vnd.sun.staroffice.fsys-folder"
#define TYPE_FSYS_FILE "application/vnd.sun.staroffice.fsys-file"
-#define PROPERTY_DIRLIST "DirectoryList"
+#define PROPERTY_DIRLIST u"DirectoryList"
#define PROPERTY_NEEDSUPDATE "NeedsUpdate"
#define PROPERTY_TYPE "TypeDescription"
-#define TARGET_DIR_URL "TargetDirURL"
+#define TARGET_DIR_URL u"TargetDirURL"
#define COMMAND_DELETE "delete"
#define STANDARD_FOLDER "standard"
@@ -2667,7 +2667,7 @@ DocTemplates_EntryData_Impl::DocTemplates_EntryData_Impl( const OUString& rTitle
// static
bool SfxURLRelocator_Impl::propertyCanContainOfficeDir(
- const OUString & rPropName )
+ std::u16string_view rPropName )
{
// Note: TargetURL is handled by UCB itself (because it is a property
// with a predefined semantic). Additional Core properties introduced
diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx
index 556b3f00f5bf..dab70f396006 100644
--- a/sfx2/source/doc/sfxmodelfactory.cxx
+++ b/sfx2/source/doc/sfxmodelfactory.cxx
@@ -57,9 +57,9 @@ namespace sfx2
{
struct IsSpecialArgument
{
- static bool isSpecialArgumentName( const OUString& _rValueName )
+ static bool isSpecialArgumentName( std::u16string_view _rValueName )
{
- return _rValueName == "EmbeddedObject" || _rValueName == "EmbeddedScriptSupport" || _rValueName == "DocumentRecoverySupport";
+ return _rValueName == u"EmbeddedObject" || _rValueName == u"EmbeddedScriptSupport" || _rValueName == u"DocumentRecoverySupport";
}
bool operator()( const Any& _rArgument ) const
diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx
index 1d5b26bece4d..0384f9a70782 100644
--- a/sfx2/source/inc/sfxurlrelocator.hxx
+++ b/sfx2/source/inc/sfxurlrelocator.hxx
@@ -35,7 +35,7 @@ class SfxURLRelocator_Impl
css::uno::Reference< css::util::XMacroExpander > mxMacroExpander;
public:
- static bool propertyCanContainOfficeDir( const OUString & rPropName );
+ static bool propertyCanContainOfficeDir( std::u16string_view rPropName );
void initOfficeInstDirs();
void makeRelocatableURL( OUString & rURL );
void makeAbsoluteURL( OUString & rURL );
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index caf9adca3c75..8f02f206b296 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -27,7 +27,7 @@ public:
void setOpenTemplateHdl (const Link<ThumbnailViewItem*, void> &rLink);
- void ContextMenuSelectHdl(const OString& rIdent);
+ void ContextMenuSelectHdl(std::string_view rIdent);
void setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink);
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 5367292a8615..5b8b64fcae24 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -71,27 +71,27 @@ namespace
const sal_Int32 gnWidthCloseThreshold (70);
const sal_Int32 gnWidthOpenThreshold (40);
- std::string UnoNameFromDeckId(const OUString& rsDeckId, bool isImpress = false)
+ std::string UnoNameFromDeckId(std::u16string_view rsDeckId, bool isImpress = false)
{
- if (rsDeckId == "SdCustomAnimationDeck")
+ if (rsDeckId == u"SdCustomAnimationDeck")
return ".uno:CustomAnimation";
- if (rsDeckId == "PropertyDeck")
+ if (rsDeckId == u"PropertyDeck")
return isImpress ? ".uno:ModifyPage" : ".uno:Sidebar";
- if (rsDeckId == "SdLayoutsDeck")
+ if (rsDeckId == u"SdLayoutsDeck")
return ".uno:ModifyPage";
- if (rsDeckId == "SdSlideTransitionDeck")
+ if (rsDeckId == u"SdSlideTransitionDeck")
return ".uno:SlideChangeWindow";
- if (rsDeckId == "SdAllMasterPagesDeck")
+ if (rsDeckId == u"SdAllMasterPagesDeck")
return ".uno:MasterSlidesPanel";
- if (rsDeckId == "SdMasterPagesDeck")
+ if (rsDeckId == u"SdMasterPagesDeck")
return ".uno:MasterSlidesPanel";
- if (rsDeckId == "GalleryDeck")
+ if (rsDeckId == u"GalleryDeck")
return ".uno:Gallery";
return "";
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index f86b69a8af29..59fd331aa7da 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -293,13 +293,13 @@ LOKDeviceFormFactor SfxLokHelper::getDeviceFormFactor()
return g_deviceFormFactor;
}
-void SfxLokHelper::setDeviceFormFactor(const OUString& rDeviceFormFactor)
+void SfxLokHelper::setDeviceFormFactor(std::u16string_view rDeviceFormFactor)
{
- if (rDeviceFormFactor == "desktop")
+ if (rDeviceFormFactor == u"desktop")
g_deviceFormFactor = LOKDeviceFormFactor::DESKTOP;
- else if (rDeviceFormFactor == "tablet")
+ else if (rDeviceFormFactor == u"tablet")
g_deviceFormFactor = LOKDeviceFormFactor::TABLET;
- else if (rDeviceFormFactor == "mobile")
+ else if (rDeviceFormFactor == u"mobile")
g_deviceFormFactor = LOKDeviceFormFactor::MOBILE;
else
g_deviceFormFactor = LOKDeviceFormFactor::UNKNOWN;