diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-25 08:14:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-30 12:32:14 +0100 |
commit | 8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch) | |
tree | dd45d452202998297b8562743ea6345462304d04 /cui | |
parent | d05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (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 'cui')
-rw-r--r-- | cui/source/customize/SvxConfigPageHelper.cxx | 28 | ||||
-rw-r--r-- | cui/source/customize/SvxNotebookbarConfigPage.cxx | 28 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 4 | ||||
-rw-r--r-- | cui/source/inc/SvxConfigPageHelper.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 4 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 8 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 16 |
7 files changed, 45 insertions, 45 deletions
diff --git a/cui/source/customize/SvxConfigPageHelper.cxx b/cui/source/customize/SvxConfigPageHelper.cxx index 468441a6d7cc..527754d5cf5f 100644 --- a/cui/source/customize/SvxConfigPageHelper.cxx +++ b/cui/source/customize/SvxConfigPageHelper.cxx @@ -201,32 +201,32 @@ OUString SvxConfigPageHelper::generateCustomURL(SvxEntries* entries) return url; } -OUString SvxConfigPageHelper::GetModuleName(const OUString& aModuleId) +OUString SvxConfigPageHelper::GetModuleName(std::u16string_view aModuleId) { - if (aModuleId == "com.sun.star.text.TextDocument" - || aModuleId == "com.sun.star.text.GlobalDocument") + if (aModuleId == u"com.sun.star.text.TextDocument" + || aModuleId == u"com.sun.star.text.GlobalDocument") return "Writer"; - else if (aModuleId == "com.sun.star.text.WebDocument") + else if (aModuleId == u"com.sun.star.text.WebDocument") return "Writer/Web"; - else if (aModuleId == "com.sun.star.drawing.DrawingDocument") + else if (aModuleId == u"com.sun.star.drawing.DrawingDocument") return "Draw"; - else if (aModuleId == "com.sun.star.presentation.PresentationDocument") + else if (aModuleId == u"com.sun.star.presentation.PresentationDocument") return "Impress"; - else if (aModuleId == "com.sun.star.sheet.SpreadsheetDocument") + else if (aModuleId == u"com.sun.star.sheet.SpreadsheetDocument") return "Calc"; - else if (aModuleId == "com.sun.star.script.BasicIDE") + else if (aModuleId == u"com.sun.star.script.BasicIDE") return "Basic"; - else if (aModuleId == "com.sun.star.formula.FormulaProperties") + else if (aModuleId == u"com.sun.star.formula.FormulaProperties") return "Math"; - else if (aModuleId == "com.sun.star.sdb.RelationDesign") + else if (aModuleId == u"com.sun.star.sdb.RelationDesign") return "Relation Design"; - else if (aModuleId == "com.sun.star.sdb.QueryDesign") + else if (aModuleId == u"com.sun.star.sdb.QueryDesign") return "Query Design"; - else if (aModuleId == "com.sun.star.sdb.TableDesign") + else if (aModuleId == u"com.sun.star.sdb.TableDesign") return "Table Design"; - else if (aModuleId == "com.sun.star.sdb.DataSourceBrowser") + else if (aModuleId == u"com.sun.star.sdb.DataSourceBrowser") return "Data Source Browser"; - else if (aModuleId == "com.sun.star.sdb.DatabaseDocument") + else if (aModuleId == u"com.sun.star.sdb.DatabaseDocument") return "Database"; return OUString(); diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index b3dd97f1d43d..7e93dae121af 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -49,12 +49,12 @@ namespace container = com::sun::star::container; namespace beans = com::sun::star::beans; namespace graphic = com::sun::star::graphic; -static bool isCategoryAvailable(const OUString& sClassId, std::u16string_view sUIItemId, +static bool isCategoryAvailable(std::u16string_view sClassId, std::u16string_view sUIItemId, std::u16string_view sActiveCategory, bool& isCategory) { if (sUIItemId == sActiveCategory) return true; - else if ((sClassId == "GtkMenu" || sClassId == "GtkGrid") && sUIItemId != sActiveCategory) + else if ((sClassId == u"GtkMenu" || sClassId == u"GtkGrid") && sUIItemId != sActiveCategory) { isCategory = false; return false; @@ -67,29 +67,29 @@ static OUString charToString(const char* cString) return OUString(cString, strlen(cString), RTL_TEXTENCODING_UTF8); } -static OUString getFileName(const OUString& aFileName) +static OUString getFileName(std::u16string_view aFileName) { - if (aFileName == "notebookbar.ui") + if (aFileName == u"notebookbar.ui") return "Tabbed"; - else if (aFileName == "notebookbar_compact.ui") + else if (aFileName == u"notebookbar_compact.ui") return "TabbedCompact"; - else if (aFileName == "notebookbar_groupedbar_full.ui") + else if (aFileName == u"notebookbar_groupedbar_full.ui") return "Groupedbar"; - else if (aFileName == "notebookbar_groupedbar_compact.ui") + else if (aFileName == u"notebookbar_groupedbar_compact.ui") return "GroupedbarCompact"; else return "None"; } -static OUString getModuleId(const OUString& sModuleName) +static OUString getModuleId(std::u16string_view sModuleName) { - if (sModuleName == "Writer") + if (sModuleName == u"Writer") return "com.sun.star.text.TextDocument"; - else if (sModuleName == "Draw") + else if (sModuleName == u"Draw") return "com.sun.star.drawing.DrawingDocument"; - else if (sModuleName == "Impress") + else if (sModuleName == u"Impress") return "com.sun.star.presentation.PresentationDocument"; - else if (sModuleName == "Calc") + else if (sModuleName == u"Calc") return "com.sun.star.sheet.SpreadsheetDocument"; else return "None"; @@ -195,7 +195,7 @@ short SvxNotebookbarConfigPage::QueryReset() return nValue; } -void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, +void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId, const OUString& sUIItemId, const OUString& sUIItemCommand, weld::TreeView& rTreeView, @@ -227,7 +227,7 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, OUString aName = SvxConfigPageHelper::stripHotKey(aLabel); - if (sClassId == "GtkSeparatorMenuItem" || sClassId == "GtkSeparator") + if (sClassId == u"GtkSeparatorMenuItem" || sClassId == u"GtkSeparator") { rTreeView.set_text(rIter, "--------------------------------------------", 0); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 87753e844bba..3d786af57553 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -157,9 +157,9 @@ void printEntries(SvxEntries* entries) #endif bool -SvxConfigPage::CanConfig( const OUString& aModuleId ) +SvxConfigPage::CanConfig( std::u16string_view aModuleId ) { - return aModuleId != "com.sun.star.script.BasicIDE" && aModuleId != "com.sun.star.frame.Bibliography"; + return aModuleId != u"com.sun.star.script.BasicIDE" && aModuleId != u"com.sun.star.frame.Bibliography"; } static std::unique_ptr<SfxTabPage> CreateSvxMenuConfigPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet ) diff --git a/cui/source/inc/SvxConfigPageHelper.hxx b/cui/source/inc/SvxConfigPageHelper.hxx index 9a53af2651aa..025c4aad18c0 100644 --- a/cui/source/inc/SvxConfigPageHelper.hxx +++ b/cui/source/inc/SvxConfigPageHelper.hxx @@ -49,7 +49,7 @@ public: */ static OUString generateCustomURL(SvxEntries* entries); - static OUString GetModuleName(const OUString& aModuleId); + static OUString GetModuleName(std::u16string_view aModuleId); static OUString GetUIModuleName(const OUString& aModuleId, const css::uno::Reference<css::frame::XModuleManager2>& rModuleManager); diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 5f023e046310..0bc2085178d2 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -456,7 +456,7 @@ protected: weld::TreeView& rTreeView, weld::TreeIter& rIter, bool bMenu = false); - void InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, const OUString& sUIItemId, + void InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId, const OUString& sUIItemId, const OUString& sUIItemCommand, weld::TreeView& rTreeView, const weld::TreeIter& rIter); @@ -469,7 +469,7 @@ public: virtual ~SvxConfigPage() override; - static bool CanConfig( const OUString& rModuleId ); + static bool CanConfig( std::u16string_view rModuleId ); SaveInData* GetSaveInData() { return pCurrentSaveInData; } const OUString& GetAppName() const { return m_sAppName; } diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 1b646fc51043..865f56e16840 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -67,10 +67,10 @@ using namespace css::uno; using namespace css::linguistic2; using namespace css::beans; -const char cSpell[] = SN_SPELLCHECKER; -const char cGrammar[] = SN_GRAMMARCHECKER; -const char cHyph[] = SN_HYPHENATOR; -const char cThes[] = SN_THESAURUS; +constexpr OUStringLiteral cSpell(SN_SPELLCHECKER); +constexpr OUStringLiteral cGrammar(SN_GRAMMARCHECKER); +constexpr OUStringLiteral cHyph(SN_HYPHENATOR); +constexpr OUStringLiteral cThes(SN_THESAURUS); // static ---------------------------------------------------------------- diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 6f63828c173f..e098040e7c7c 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -171,7 +171,7 @@ static void setGroupName( std::u16string_view rModule, const OUString& rGroupNam } } -static OUString getGroupName( const OUString& rModule, bool bForced ) +static OUString getGroupName( std::u16string_view rModule, bool bForced ) { OUString sGroupName; for (const ModuleToGroupNameMap_Impl& rEntry : ModuleMap) @@ -185,19 +185,19 @@ static OUString getGroupName( const OUString& rModule, bool bForced ) if ( sGroupName.isEmpty() && bForced ) { - if ( rModule == "Writer" ) + if ( rModule == u"Writer" ) sGroupName = CuiResId(SID_SW_EDITOPTIONS_RES[0].first); - else if ( rModule == "WriterWeb" ) + else if ( rModule == u"WriterWeb" ) sGroupName = CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first); - else if ( rModule == "Calc" ) + else if ( rModule == u"Calc" ) sGroupName = CuiResId(SID_SC_EDITOPTIONS_RES[0].first); - else if ( rModule == "Impress" ) + else if ( rModule == u"Impress" ) sGroupName = CuiResId(SID_SD_EDITOPTIONS_RES[0].first); - else if ( rModule == "Draw" ) + else if ( rModule == u"Draw" ) sGroupName = CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first); - else if ( rModule == "Math" ) + else if ( rModule == u"Math" ) sGroupName = CuiResId(SID_SM_EDITOPTIONS_RES[0].first); - else if ( rModule == "Base" ) + else if ( rModule == u"Base" ) sGroupName = CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first); } return sGroupName; |