summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-28 17:56:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-29 16:42:33 +0100
commit042033f1e6da22616cb76c8d950c20c9efecbad5 (patch)
tree26b3f1f42d067506f44550b410f3fb9640616a5b /cui
parentccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff)
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/qa/unit/cui-dialogs-test.cxx2
-rw-r--r--cui/qa/unit/cui-dialogs-test_2.cxx2
-rw-r--r--cui/qa/unit/cui-dialogs-test_3.cxx2
-rw-r--r--cui/qa/unit/cui-dialogs-test_4.cxx2
-rw-r--r--cui/source/customize/cfg.cxx4
-rw-r--r--cui/source/customize/cfgutil.cxx9
-rw-r--r--cui/source/dialogs/SignatureLineDialogBase.cxx4
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx4
-rw-r--r--cui/source/dialogs/postdlg.cxx4
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx10
-rw-r--r--cui/source/dialogs/scriptdlg.cxx13
-rw-r--r--cui/source/inc/SignatureLineDialogBase.hxx6
-rw-r--r--cui/source/inc/cfg.hxx3
-rw-r--r--cui/source/inc/cfgutil.hxx6
-rw-r--r--cui/source/inc/cuigaldlg.hxx4
-rw-r--r--cui/source/inc/postdlg.hxx6
-rw-r--r--cui/source/options/optsave.cxx16
17 files changed, 58 insertions, 39 deletions
diff --git a/cui/qa/unit/cui-dialogs-test.cxx b/cui/qa/unit/cui-dialogs-test.cxx
index 85f6b5f55bbf..f4f73facbaa6 100644
--- a/cui/qa/unit/cui-dialogs-test.cxx
+++ b/cui/qa/unit/cui-dialogs-test.cxx
@@ -91,7 +91,7 @@ void CuiDialogsTest::openAnyDialog()
initialize();
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("cui/qa/unit/data/cui-dialogs-test.txt");
+ processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest);
diff --git a/cui/qa/unit/cui-dialogs-test_2.cxx b/cui/qa/unit/cui-dialogs-test_2.cxx
index 2f9b07f7d465..5d98650fd84a 100644
--- a/cui/qa/unit/cui-dialogs-test_2.cxx
+++ b/cui/qa/unit/cui-dialogs-test_2.cxx
@@ -48,7 +48,7 @@ VclPtr<VclAbstractDialog> CuiDialogsTest2::createDialogByID(sal_uInt32 /*nID*/)
void CuiDialogsTest2::openAnyDialog()
{
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("cui/qa/unit/data/cui-dialogs-test_2.txt");
+ processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_2.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest2);
diff --git a/cui/qa/unit/cui-dialogs-test_3.cxx b/cui/qa/unit/cui-dialogs-test_3.cxx
index 9c3a09a8d240..ebd194885415 100644
--- a/cui/qa/unit/cui-dialogs-test_3.cxx
+++ b/cui/qa/unit/cui-dialogs-test_3.cxx
@@ -48,7 +48,7 @@ VclPtr<VclAbstractDialog> CuiDialogsTest3::createDialogByID(sal_uInt32 /*nID*/)
void CuiDialogsTest3::openAnyDialog()
{
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("cui/qa/unit/data/cui-dialogs-test_3.txt");
+ processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_3.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest3);
diff --git a/cui/qa/unit/cui-dialogs-test_4.cxx b/cui/qa/unit/cui-dialogs-test_4.cxx
index 11820389968c..157ffa8b3765 100644
--- a/cui/qa/unit/cui-dialogs-test_4.cxx
+++ b/cui/qa/unit/cui-dialogs-test_4.cxx
@@ -48,7 +48,7 @@ VclPtr<VclAbstractDialog> CuiDialogsTest4::createDialogByID(sal_uInt32 /*nID*/)
void CuiDialogsTest4::openAnyDialog()
{
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("cui/qa/unit/data/cui-dialogs-test_4.txt");
+ processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_4.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest4);
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 3d786af57553..0988fca71feb 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1355,13 +1355,13 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry const * pToSelect )
}
void SvxConfigPage::AddSubMenusToUI(
- const OUString& rBaseTitle, SvxConfigEntry const * pParentData )
+ std::u16string_view rBaseTitle, SvxConfigEntry const * pParentData )
{
for (auto const& entryData : *pParentData->GetEntries())
{
if (entryData->IsPopup())
{
- OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
+ OUString subMenuTitle = OUString::Concat(rBaseTitle) + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
m_xTopLevelListBox->append(sId, subMenuTitle);
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index e538bc25bcee..6c81c18fb573 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -76,9 +76,10 @@ const char CMDURL_FPART_ONLY [] = "FamilyName:string=";
const OUStringLiteral STYLEPROP_UINAME = u"DisplayName";
-OUString SfxStylesInfo_Impl::generateCommand(const OUString& sFamily, const OUString& sStyle)
+OUString SfxStylesInfo_Impl::generateCommand(
+ std::u16string_view sFamily, std::u16string_view sStyle)
{
- return ".uno:StyleApply?Style:string="
+ return OUString::Concat(".uno:StyleApply?Style:string=")
+ sStyle
+ "&FamilyName:string="
+ sFamily;
@@ -999,10 +1000,10 @@ void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
pItem->GetQualifiedName() );
}
-void CuiConfigGroupListBox::SelectMacro( const OUString& rBasic,
+void CuiConfigGroupListBox::SelectMacro( std::u16string_view rBasic,
const OUString& rMacro )
{
- const OUString aBasicName(rBasic + " " + xImp->m_sMacros);
+ const OUString aBasicName(OUString::Concat(rBasic) + " " + xImp->m_sMacros);
sal_Int32 nIdx {rMacro.lastIndexOf('.')};
const OUString aMethod( rMacro.copy(nIdx+1) );
OUString aLib;
diff --git a/cui/source/dialogs/SignatureLineDialogBase.cxx b/cui/source/dialogs/SignatureLineDialogBase.cxx
index d824e85e8e3e..4e591124bc44 100644
--- a/cui/source/dialogs/SignatureLineDialogBase.cxx
+++ b/cui/source/dialogs/SignatureLineDialogBase.cxx
@@ -32,9 +32,9 @@ short SignatureLineDialogBase::run()
return nRet;
}
-OUString SignatureLineDialogBase::getCDataString(const OUString& rString)
+OUString SignatureLineDialogBase::getCDataString(std::u16string_view rString)
{
- return "<![CDATA[" + rString + "]]>";
+ return OUString::Concat("<![CDATA[") + rString + "]]>";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 76abb324b583..eae624c7e0db 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -645,12 +645,12 @@ std::unique_ptr<SfxTabPage> TPGalleryThemeProperties::Create(weld::Container* pP
return std::make_unique<TPGalleryThemeProperties>(pPage, pController, *rSet);
}
-OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, const OUString& _rExtension )
+OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, std::u16string_view _rExtension )
{
OUString sRet = _rDisplayText;
if ( sRet.indexOf( "(*.*)" ) == -1 )
{
- sRet += " (" + _rExtension + ")";
+ sRet += OUString::Concat(" (") + _rExtension + ")";
}
return sRet;
}
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index b96c1dd85fbf..fe9f2e065bf3 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -110,9 +110,9 @@ SvxPostItDialog::~SvxPostItDialog()
{
}
-void SvxPostItDialog::ShowLastAuthor(const OUString& rAuthor, const OUString& rDate)
+void SvxPostItDialog::ShowLastAuthor(std::u16string_view rAuthor, std::u16string_view rDate)
{
- OUString sTxt = rAuthor + ", " + rDate;
+ OUString sTxt = OUString::Concat(rAuthor) + ", " + rDate;
m_xLastEditFT->set_label( sTxt );
}
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index 676dda6bca55..fd378f7686f1 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -49,7 +49,7 @@ using namespace com::sun::star;
namespace
{
- OUString lcl_genRandom( const OUString &rId )
+ OUString lcl_genRandom( std::u16string_view rId )
{
//FIXME: plus timestamp
unsigned int nRand = comphelper::rng::uniform_uint_distribution(0, 0xFFFF);
@@ -62,7 +62,7 @@ namespace
OUString aTempl("<alt id=\"%1\">"
" " //FIXME real dialog title or something
"</alt>");
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("alt_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"alt_id") );
return aTempl;
}
@@ -73,7 +73,7 @@ namespace
" width=\"%3cm\" height=\"%4cm\">"
"%5"
"</image>");
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("img_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"img_id") );
aTempl = aTempl.replaceFirst( "%2", rScreenshotId );
aTempl = aTempl.replaceFirst( "%3", OUString::number( rSize.Width() ) );
aTempl = aTempl.replaceFirst( "%4", OUString::number( rSize.Height() ) );
@@ -86,7 +86,7 @@ namespace
{
OUString aTempl( "<paragraph id=\"%1\" role=\"paragraph\">%2"
"</paragraph>" SAL_NEWLINE_STRING );
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("par_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"par_id") );
aTempl = aTempl.replaceFirst( "%2", lcl_Image(rScreenshotId, rSize) );
return aTempl;
@@ -98,7 +98,7 @@ namespace
"<bookmark branch=\"hid/%2\" id=\"%3\" localize=\"false\"/>" SAL_NEWLINE_STRING;
aTempl = aTempl.replaceFirst( "%1", rWidgetId );
aTempl = aTempl.replaceFirst( "%2", rWidgetId );
- aTempl = aTempl.replaceFirst( "%3", lcl_genRandom("bm_id") );
+ aTempl = aTempl.replaceFirst( "%3", lcl_genRandom(u"bm_id") );
return aTempl;
}
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index cb7d8776dcbd..824aaa0c81d8 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <memory>
+#include <string_view>
#include <utility>
#include <sfx2/objsh.hxx>
@@ -1106,8 +1107,8 @@ OUString FormatErrorString(
const OUString& language,
const OUString& script,
const OUString& line,
- const OUString& type,
- const OUString& message )
+ std::u16string_view type,
+ std::u16string_view message )
{
OUString result = unformatted.copy( 0 );
@@ -1115,12 +1116,12 @@ OUString FormatErrorString(
result = ReplaceString(result, "%SCRIPTNAME", script );
result = ReplaceString(result, "%LINENUMBER", line );
- if ( !type.isEmpty() )
+ if ( !type.empty() )
{
result += "\n\n" + CuiResId(RID_SVXSTR_ERROR_TYPE_LABEL) + " " + type;
}
- if ( !message.isEmpty() )
+ if ( !message.empty() )
{
result += "\n\n" + CuiResId(RID_SVXSTR_ERROR_MESSAGE_LABEL) + " " + message;
}
@@ -1164,7 +1165,7 @@ OUString GetErrorMessage(
}
return FormatErrorString(
- unformatted, language, script, line, "", message );
+ unformatted, language, script, line, u"", message );
}
OUString GetErrorMessage(
@@ -1243,7 +1244,7 @@ OUString GetErrorMessage(
message = sError.Message;
}
return FormatErrorString(
- unformatted, language, script, OUString(), OUString(), message );
+ unformatted, language, script, OUString(), std::u16string_view(), message );
}
OUString GetErrorMessage( const css::uno::Any& aException )
diff --git a/cui/source/inc/SignatureLineDialogBase.hxx b/cui/source/inc/SignatureLineDialogBase.hxx
index 2fe0e95d1fec..3cc645819be8 100644
--- a/cui/source/inc/SignatureLineDialogBase.hxx
+++ b/cui/source/inc/SignatureLineDialogBase.hxx
@@ -8,6 +8,10 @@
*/
#pragma once
+#include <sal/config.h>
+
+#include <string_view>
+
#include <vcl/weld.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -24,7 +28,7 @@ public:
protected:
css::uno::Reference<css::frame::XModel> m_xModel;
virtual void Apply() = 0;
- static OUString getCDataString(const OUString& rString);
+ static OUString getCDataString(std::u16string_view rString);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 4fd7fb801ebc..32e19e3bd774 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -34,6 +34,7 @@
#include <sfx2/tabdlg.hxx>
#include <memory>
+#include <string_view>
#include <vector>
#include "cfgutil.hxx"
@@ -446,7 +447,7 @@ protected:
int AppendEntry(SvxConfigEntry* pNewEntryData,
int nTarget);
- void AddSubMenusToUI( const OUString& rBaseTitle,
+ void AddSubMenusToUI( std::u16string_view rBaseTitle,
SvxConfigEntry const * pParentData );
void InsertEntryIntoUI(SvxConfigEntry* pNewEntryData,
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 8187d5e14314..bd4e8e8e2d76 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -20,6 +20,8 @@
#include <vector>
#include <memory>
+#include <string_view>
+
#include <rtl/ustring.hxx>
#include <com/sun/star/frame/DispatchInformation.hpp>
@@ -70,7 +72,7 @@ public:
std::vector< SfxStyleInfo_Impl > getStyleFamilies() const;
std::vector< SfxStyleInfo_Impl > getStyles(const OUString& sFamily);
- static OUString generateCommand(const OUString& sFamily, const OUString& sStyle);
+ static OUString generateCommand(std::u16string_view sFamily, std::u16string_view sStyle);
};
enum class SfxCfgKind
@@ -223,7 +225,7 @@ public:
{ m_pFunctionListBox = pBox; }
void GroupSelected();
void SelectMacro(const SfxMacroInfoItem*);
- void SelectMacro(const OUString&, const OUString&);
+ void SelectMacro(std::u16string_view, const OUString&);
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index c89acbfc1294..4a20724ffd81 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -30,6 +30,8 @@
#include <com/sun/star/media/XPlayer.hpp>
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <svtools/dialogclosedlistener.hxx>
+
+#include <string_view>
#include <vector>
class GalleryTheme;
@@ -241,7 +243,7 @@ class TPGalleryThemeProperties : public SfxTabPage
virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
- static OUString addExtension( const OUString&, const OUString& );
+ static OUString addExtension( const OUString&, std::u16string_view );
void FillFilterList();
void SearchFiles();
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 206dbdb181bf..b294fbcc77df 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -18,6 +18,10 @@
*/
#pragma once
+#include <sal/config.h>
+
+#include <string_view>
+
#include <sfx2/basedlgs.hxx>
// class SvxPostItDialog -------------------------------------------------
@@ -57,7 +61,7 @@ public:
{
m_xEditED->set_text(rTxt);
}
- void ShowLastAuthor(const OUString& rAuthor, const OUString& rDate);
+ void ShowLastAuthor(std::u16string_view rAuthor, std::u16string_view rDate);
void DontChangeAuthor()
{
m_xAuthorBtn->set_sensitive(false);
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 74b6f408d249..f2d54205db5c 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include "optsave.hxx"
@@ -44,7 +48,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace comphelper;
-#define CFG_PAGE_AND_GROUP "General", "LoadSave"
+#define CFG_PAGE_AND_GROUP u"General", u"LoadSave"
struct SvxSaveTabPage_Impl
@@ -191,13 +195,13 @@ void SvxSaveTabPage::DetectHiddenControls()
{
SvtOptionsDialogOptions aOptionsDlgOpt;
- if ( aOptionsDlgOpt.IsOptionHidden( "Backup", CFG_PAGE_AND_GROUP ) )
+ if ( aOptionsDlgOpt.IsOptionHidden( u"Backup", CFG_PAGE_AND_GROUP ) )
{
// hide controls of "Backup"
m_xBackupCB->hide();
}
- if ( aOptionsDlgOpt.IsOptionHidden( "AutoSave", CFG_PAGE_AND_GROUP ) )
+ if ( aOptionsDlgOpt.IsOptionHidden( u"AutoSave", CFG_PAGE_AND_GROUP ) )
{
// hide controls of "AutoSave"
m_xAutoSaveCB->hide();
@@ -205,7 +209,7 @@ void SvxSaveTabPage::DetectHiddenControls()
m_xMinuteFT->hide();
}
- if ( aOptionsDlgOpt.IsOptionHidden( "UserAutoSave", CFG_PAGE_AND_GROUP ) )
+ if ( aOptionsDlgOpt.IsOptionHidden( u"UserAutoSave", CFG_PAGE_AND_GROUP ) )
{
// hide controls of "UserAutoSave"
m_xUserAutoSaveCB->hide();
@@ -485,7 +489,7 @@ IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Button&, rBox, void)
}
}
-static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, const OUString& rExtension)
+static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension)
{
OUString sName;
const PropertyValue* pPropVal = rProperties.getConstArray();
@@ -498,7 +502,7 @@ static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, con
OUString sUIName;
if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
{
- if (!rExtension.isEmpty())
+ if (!rExtension.empty())
{
return sUIName + " (" + rExtension + ")";
}