summaryrefslogtreecommitdiff
path: root/sfx2
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 /sfx2
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 'sfx2')
-rw-r--r--sfx2/inc/guisaveas.hxx6
-rw-r--r--sfx2/qa/cppunit/test_misc.cxx8
-rw-r--r--sfx2/qa/unit/sfx2-dialogs-test.cxx2
-rw-r--r--sfx2/source/appl/linkmgr2.cxx4
-rw-r--r--sfx2/source/doc/graphhelp.cxx6
-rw-r--r--sfx2/source/doc/graphhelp.hxx6
-rw-r--r--sfx2/source/doc/guisaveas.cxx25
-rw-r--r--sfx2/source/doc/objmisc.cxx4
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx6
-rw-r--r--sfx2/source/view/ipclient.cxx2
-rw-r--r--sfx2/source/view/lokhelper.cxx10
-rw-r--r--sfx2/source/view/viewfrm.cxx4
12 files changed, 48 insertions, 35 deletions
diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index a62c5fc3822e..c19f78e3fdf1 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_SFX2_INC_GUISAVEAS_HXX
#define INCLUDED_SFX2_INC_GUISAVEAS_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -53,7 +57,7 @@ public:
bool GUIStoreModel(
const css::uno::Reference< css::frame::XModel >& xModel,
- const OUString& aSlotName,
+ std::u16string_view aSlotName,
css::uno::Sequence< css::beans::PropertyValue >& aArgsSequence,
bool bPreselectPassword,
SignatureState nDocumentSignatureState );
diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx
index 99c5aa40a696..f6039b0e68d8 100644
--- a/sfx2/qa/cppunit/test_misc.cxx
+++ b/sfx2/qa/cppunit/test_misc.cxx
@@ -74,7 +74,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata)
uno::Reference<document::XDocumentProperties> const xProps(
::com::sun::star::document::DocumentProperties::create(m_xContext));
- OUString const url(m_directories.getURLFromSrc("/sfx2/qa/complex/sfx2/testdocuments/CUSTOM.odt"));
+ OUString const url(m_directories.getURLFromSrc(u"/sfx2/qa/complex/sfx2/testdocuments/CUSTOM.odt"));
xProps->loadFromMedium(url, uno::Sequence<beans::PropertyValue>());
CPPUNIT_ASSERT_EQUAL(OUString(""), xProps->getAuthor());
uno::Sequence<beans::PropertyValue> mimeArgs({
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata)
CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail)
{
// Load a document.
- const OUString aURL(m_directories.getURLFromSrc("/sfx2/qa/cppunit/misc/hello.odt"));
+ const OUString aURL(m_directories.getURLFromSrc(u"/sfx2/qa/cppunit/misc/hello.odt"));
uno::Reference<lang::XComponent> xComponent
= loadFromDesktop(aURL, "com.sun.star.text.TextDocument");
CPPUNIT_ASSERT(xComponent.is());
@@ -152,8 +152,8 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail)
CPPUNIT_TEST_FIXTURE(MiscTest, testHardLinks)
{
#ifndef _WIN32
- OUString aSourceDir = m_directories.getURLFromSrc("/sfx2/qa/cppunit/misc/");
- OUString aTargetDir = m_directories.getURLFromWorkdir("/CppunitTest/sfx2_misc.test.user/");
+ OUString aSourceDir = m_directories.getURLFromSrc(u"/sfx2/qa/cppunit/misc/");
+ OUString aTargetDir = m_directories.getURLFromWorkdir(u"/CppunitTest/sfx2_misc.test.user/");
const OUString aURL(aTargetDir + "hello.odt");
osl::File::copy(aSourceDir + "hello.odt", aURL);
OUString aTargetPath;
diff --git a/sfx2/qa/unit/sfx2-dialogs-test.cxx b/sfx2/qa/unit/sfx2-dialogs-test.cxx
index 5b73388198ca..6e23237bc39b 100644
--- a/sfx2/qa/unit/sfx2-dialogs-test.cxx
+++ b/sfx2/qa/unit/sfx2-dialogs-test.cxx
@@ -48,7 +48,7 @@ VclPtr<VclAbstractDialog> Sfx2DialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void Sfx2DialogsTest::openAnyDialog()
{
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("sfx2/qa/unit/data/sfx2-dialogs-test.txt");
+ processDialogBatchFile(u"sfx2/qa/unit/data/sfx2-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Sfx2DialogsTest);
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index befb7510f82a..49043fb076c7 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -187,7 +187,7 @@ bool LinkManager::InsertLink( SvBaseLink * pLink,
void LinkManager::InsertDDELink( SvBaseLink * pLink,
const OUString& rServer,
const OUString& rTopic,
- const OUString& rItem )
+ std::u16string_view rItem )
{
if( !isClientType( pLink->GetObjType() ) )
return;
@@ -375,7 +375,7 @@ void LinkManager::RemoveServer( SvLinkSource* pObj )
}
void MakeLnkName( OUString& rName, const OUString* pType, const OUString& rFile,
- const OUString& rLink, const OUString* pFilter )
+ std::u16string_view rLink, const OUString* pFilter )
{
if( pType )
{
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 6e7789122a3b..cc1299c01b1c 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -198,16 +198,16 @@ bool GraphicHelper::getThumbnailFormatFromGDI_Impl(GDIMetaFile const * pMetaFile
}
// static
-bool GraphicHelper::getThumbnailReplacement_Impl(const OUString& rResID, const uno::Reference< io::XStream >& xStream )
+bool GraphicHelper::getThumbnailReplacement_Impl(std::u16string_view rResID, const uno::Reference< io::XStream >& xStream )
{
bool bResult = false;
- if (!rResID.isEmpty() && xStream.is())
+ if (!rResID.empty() && xStream.is())
{
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
try
{
uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext));
- const OUString aURL{"private:graphicrepository/" + rResID};
+ const OUString aURL{OUString::Concat("private:graphicrepository/") + rResID};
uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
aMediaProps[0].Name = "URL";
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index 3f6f66d3e447..bfaf3e223d90 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_SFX2_SOURCE_DOC_GRAPHHELP_HXX
#define INCLUDED_SFX2_SOURCE_DOC_GRAPHHELP_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/io/XStream.hpp>
#include <rtl/ustring.hxx>
@@ -56,7 +60,7 @@ public:
static OUString getThumbnailReplacementIDByFactoryName_Impl(const OUString& aFactoryShortName);
static bool getThumbnailReplacement_Impl(
- const OUString& rResID,
+ std::u16string_view rResID,
const css::uno::Reference< css::io::XStream >& xStream );
};
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index ad94a17e4231..18a3bd42b907 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -76,6 +76,7 @@
#include <alienwarn.hxx>
#include <memory>
+#include <string_view>
#include <officecfg/Office/Common.hxx>
@@ -147,28 +148,28 @@ sal_uInt16 getSlotIDFromMode( sal_Int16 nStoreMode )
}
-sal_Int16 getStoreModeFromSlotName( const OUString& aSlotName )
+sal_Int16 getStoreModeFromSlotName( std::u16string_view aSlotName )
{
sal_Int16 nResult = 0;
- if ( aSlotName == "ExportTo" )
+ if ( aSlotName == u"ExportTo" )
nResult = EXPORT_REQUESTED;
- else if ( aSlotName == "ExportToPDF" )
+ else if ( aSlotName == u"ExportToPDF" )
nResult = EXPORT_REQUESTED | PDFEXPORT_REQUESTED;
- else if ( aSlotName == "ExportDirectToPDF" )
+ else if ( aSlotName == u"ExportDirectToPDF" )
nResult = EXPORT_REQUESTED | PDFEXPORT_REQUESTED | PDFDIRECTEXPORT_REQUESTED;
- else if ( aSlotName == "ExportToEPUB" )
+ else if ( aSlotName == u"ExportToEPUB" )
nResult = EXPORT_REQUESTED | EPUBEXPORT_REQUESTED;
- else if ( aSlotName == "ExportDirectToEPUB" )
+ else if ( aSlotName == u"ExportDirectToEPUB" )
nResult = EXPORT_REQUESTED | EPUBEXPORT_REQUESTED | EPUBDIRECTEXPORT_REQUESTED;
- else if ( aSlotName == "Save" )
+ else if ( aSlotName == u"Save" )
nResult = SAVE_REQUESTED;
- else if ( aSlotName == "SaveAs" )
+ else if ( aSlotName == u"SaveAs" )
nResult = SAVEAS_REQUESTED;
- else if ( aSlotName == "SaveAsRemote" )
+ else if ( aSlotName == u"SaveAsRemote" )
nResult = SAVEASREMOTE_REQUESTED;
else
throw task::ErrorCodeIOException(
- ("getStoreModeFromSlotName(\"" + aSlotName
+ (OUString::Concat("getStoreModeFromSlotName(\"") + aSlotName
+ "): ERRCODE_IO_INVALIDPARAMETER"),
uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_INVALIDPARAMETER) );
@@ -1293,7 +1294,7 @@ namespace
void LaunchPDFViewer(const INetURLObject& rURL)
{
// Launch PDF viewer
- FilterConfigItem aItem( "Office.Common/Filter/PDF/Export/" );
+ FilterConfigItem aItem( u"Office.Common/Filter/PDF/Export/" );
bool aViewPDF = aItem.ReadBool( "ViewPDFAfterExport", false );
if ( aViewPDF )
@@ -1305,7 +1306,7 @@ namespace
}
bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xModel,
- const OUString& aSlotName,
+ std::u16string_view aSlotName,
uno::Sequence< beans::PropertyValue >& aArgsSequence,
bool bPreselectPassword,
SignatureState nDocumentSignatureState )
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index d59d334bd55b..81fcb4027535 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1841,7 +1841,7 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
return bResult;
}
-bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMessage)
+bool SfxObjectShell::IsContinueImportOnFilterExceptions(std::u16string_view aErrMessage)
{
if (mbContinueImportOnFilterExceptions == undefined)
{
@@ -1849,7 +1849,7 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess
{
// Ask the user to try to continue or abort loading
OUString aMessage = SfxResId(STR_QMSG_ERROR_OPENING_FILE);
- if (!aErrMessage.isEmpty())
+ if (!aErrMessage.empty())
aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_DETAILS) + aErrMessage;
aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_CONTINUE);
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index f2690c9e04b7..115db13c872f 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -314,7 +314,7 @@ void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName)
rBindings.Update();
}
-bool SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile,
+bool SfxNotebookBar::StateMethod(SfxBindings& rBindings, std::u16string_view rUIFile,
bool bReloadNotebookbar)
{
SfxFrame& rFrame = rBindings.GetDispatcher_Impl()->GetFrame()->GetFrame();
@@ -324,7 +324,7 @@ bool SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile
bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
const Reference<css::frame::XFrame>& xFrame,
- const OUString& rUIFile, bool bReloadNotebookbar)
+ std::u16string_view rUIFile, bool bReloadNotebookbar)
{
if (!pSysWindow)
{
@@ -553,7 +553,7 @@ void SfxNotebookBar::ToggleMenubar()
}
}
-void SfxNotebookBar::ReloadNotebookBar(const OUString& sUIPath)
+void SfxNotebookBar::ReloadNotebookBar(std::u16string_view sUIPath)
{
if (SfxNotebookBar::IsActive())
{
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index fbba1febc5c1..5b4ba3fdf3dd 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -901,7 +901,7 @@ ErrCode SfxInPlaceClient::DoVerb( tools::Long nVerb )
aDispatchArgs[0].Value <<= true;
aHelper.GUIStoreModel( xEmbModel,
- "SaveAs",
+ u"SaveAs",
aDispatchArgs,
false,
SignatureState::NOSIGNATURES );
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 44af64e02016..42e0d60b3382 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <sfx2/lokhelper.hxx>
#include <com/sun/star/frame/Desktop.hpp>
@@ -331,7 +335,7 @@ static OString lcl_generateJSON(const SfxViewShell* pView, const boost::property
return OString(aString.c_str(), aString.size()).trim();
}
-static inline OString lcl_generateJSON(const SfxViewShell* pView, const OString& rKey,
+static inline OString lcl_generateJSON(const SfxViewShell* pView, std::string_view rKey,
const OString& rPayload)
{
assert(pView != nullptr && "pView must be valid");
@@ -341,7 +345,7 @@ static inline OString lcl_generateJSON(const SfxViewShell* pView, const OString&
}
void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView,
- int nType, const OString& rKey, const OString& rPayload)
+ int nType, std::string_view rKey, const OString& rPayload)
{
assert(pThisView != nullptr && "pThisView must be valid");
if (DisableCallbacks::disabled())
@@ -361,7 +365,7 @@ void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell c
pOtherView->libreOfficeKitViewCallback(nType, lcl_generateJSON(pThisView, rTree).getStr());
}
-void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, const OString& rKey,
+void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, std::string_view rKey,
const OString& rPayload)
{
assert(pThisView != nullptr && "pThisView must be valid");
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 70894ffc5439..fd073fb253e1 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -830,7 +830,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
UpdateDocument_Impl();
if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument")
- sfx2::SfxNotebookBar::ReloadNotebookBar("modules/swriter/ui/");
+ sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/");
try
{
@@ -1424,7 +1424,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument")
- sfx2::SfxNotebookBar::ReloadNotebookBar("modules/swriter/ui/");
+ sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/");
if (SfxClassificationHelper::IsClassified(m_xObjSh->getDocProperties()))
{