diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-11 22:05:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-12 09:03:02 +0100 |
commit | 41ab82d5dbfd04eca6437dc072e0cef15b5d1ae9 (patch) | |
tree | 96b2239c97abb505b2367e7b77bc135d9a8da37b | |
parent | 65d52af42f329bbe7c5e7d6ac617320f7faa4760 (diff) |
clang-tidy: performance-unnecessary-copy-initialization in sfx2
Change-Id: If818f7b10eb81f8921b5d90fe0c2db4d4ad97ed6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176439
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/SfxRedactionHelper.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
12 files changed, 14 insertions, 14 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8aff36378f97..f64023d2e18c 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -265,7 +265,7 @@ static OUString const & HelpLocaleString() void AppendConfigToken( OUStringBuffer& rURL, bool bQuestionMark ) { - OUString aLocaleStr = HelpLocaleString(); + const OUString& aLocaleStr = HelpLocaleString(); // query part exists? if ( bQuestionMark ) diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 4309c1bc50c2..f32a7ef36847 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -153,7 +153,7 @@ std::shared_ptr<const SfxFilter> SfxFilterContainer::GetDefaultFilter_Impl( std: return nullptr; // For the following code we need some additional information. - OUString sServiceName = aOpt.GetFactoryName(eFactory); + const OUString& sServiceName = aOpt.GetFactoryName(eFactory); OUString sDefaultFilter = aOpt.GetFactoryDefaultFilter(eFactory); // Try to get the default filter. Don't forget to verify it. diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index b42e8261194c..05ef79f5dda6 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1205,7 +1205,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) // Check for cmis properties where otherwise unavailable if ( rInfoItem.isCmisDocument( ) ) { - const uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties(); + const uno::Sequence< document::CmisProperty >& aCmisProps = rInfoItem.GetCmisProperties(); for ( const auto& rCmisProp : aCmisProps ) { if ( rCmisProp.Id == "cmis:contentStreamLength" && diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 3162c13b1481..9ada2fe6c2a2 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -707,7 +707,7 @@ IMPL_LINK_NOARG(FileDialogHelper_Impl, TimeOutHdl_Impl, Timer *, void) if ( mbShowPreview && ( aPathSeq.getLength() == 1 ) ) { - OUString aURL = aPathSeq[0]; + const OUString& aURL = aPathSeq[0]; if ( ERRCODE_NONE == getGraphic( aURL, maGraphic ) ) { @@ -1558,7 +1558,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList, if ( ( aValue >>= bPassWord ) && bPassWord ) { // ask for a password - OUString aDocName(rpURLList[0]); + const OUString& aDocName(rpURLList[0]); // TODO: tdf#158839 problem: Also asks for a password if CHECKBOX_GPGENCRYPTION && CHECKBOX_PASSWORD // are checked. But only encrypts using GPG and discards the password. ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, &*rpSet, GetFrameInterface()); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index ea8d924c9d5a..9d10e990edd3 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -2148,7 +2148,7 @@ void SAL_CALL SfxDocumentMetaData::initialize( const css::uno::Sequence< css::un css::uno::Reference<css::xml::dom::XDocument> xDoc; for (sal_Int32 i = 0; i < aArguments.getLength(); ++i) { - const css::uno::Any any = aArguments[i]; + const css::uno::Any& any = aArguments[i]; if (!(any >>= xDoc)) { throw css::lang::IllegalArgumentException( u"SfxDocumentMetaData::initialize: argument must be XDocument"_ustr, diff --git a/sfx2/source/doc/SfxRedactionHelper.cxx b/sfx2/source/doc/SfxRedactionHelper.cxx index 159f4e453ceb..e61224cf81aa 100644 --- a/sfx2/source/doc/SfxRedactionHelper.cxx +++ b/sfx2/source/doc/SfxRedactionHelper.cxx @@ -224,7 +224,7 @@ void SfxRedactionHelper::addPagesToDraw( for (sal_Int32 nPage = 0; nPage < nPages; ++nPage) { - GDIMetaFile rGDIMetaFile = aMetaFiles[nPage]; + const GDIMetaFile& rGDIMetaFile = aMetaFiles[nPage]; Graphic aGraphic(rGDIMetaFile); sal_Int32 nPageHeight(aPageSizes[nPage].Height()); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 4823e0bb0ec2..5b6c805cfcd1 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1421,7 +1421,7 @@ SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand(bool bLoading, bool bN if ((aContentToLock.getPropertyValue(u"DAV:lockdiscovery"_ustr) >>= aLocks) && aLocks.hasElements()) { // got at least a lock, show the owner of the first lock returned - css::ucb::Lock aLock = aLocks[0]; + const css::ucb::Lock& aLock = aLocks[0]; OUString aOwner; if (aLock.Owner >>= aOwner) { diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 0a20cd28f524..153870f483f0 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1779,7 +1779,7 @@ sal_Bool SfxDocTplService::storeTemplate( const OUString& rGroupName, throw uno::RuntimeException(); const OUString aMediaType {aTypeProps.getUnpackedValueOrDefault(u"MediaType"_ustr, OUString() )}; - const OUString aExt {aAllExt[0]}; + const OUString& aExt {aAllExt[0]}; if ( aMediaType.isEmpty() || aExt.isEmpty() ) throw uno::RuntimeException(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 4b72ef1d18fc..fcee218a687a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3683,7 +3683,7 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) // calling SwStyleNameMapper::GetTextUINameArray, which uses // SvtSysLocale().GetUILanguageTag() to do the mapping, saving indirectly depends // on the UI language. This is an unfortunate dependency. Here we use the loader's language. - const LanguageTag viewLanguage = comphelper::LibreOfficeKit::getLanguageTag(); + const LanguageTag& viewLanguage = comphelper::LibreOfficeKit::getLanguageTag(); const LanguageTag loadLanguage = SfxLokHelper::getLoadLanguage(); // Use the default language for saving and restore later if necessary. diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8ad7620c8d60..92a34e9fb8d8 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3729,7 +3729,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage const OUString sId(OUString::number( i + 1 )); const OUString aCustomTbxName = "private:resource/toolbar/custom_OOo1x_" + sId; - Reference< container::XIndexContainer > xToolbar = rToolbars[i]; + const Reference< container::XIndexContainer >& xToolbar = rToolbars[i]; ConvertSlotsToCommands( pObjShell, xToolbar ); if ( !xNewUIConfMan->hasSettings( aCustomTbxName )) { diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 4e6188f1c89a..79557592a1c8 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -117,7 +117,7 @@ static void NotebookbarAddonValues( for (int nIdx = 0; nIdx < aAddonsItems.GetAddonsNotebookBarCount(); nIdx++) { - const css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> aExtension + const css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>& aExtension = aAddonsItems.GetAddonsNotebookBarPart(nIdx); for (const css::uno::Sequence<css::beans::PropertyValue>& rExtensionVal : aExtension) { @@ -557,7 +557,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, void SfxNotebookBar::RemoveListeners(SystemWindow const * pSysWindow) { - if (auto pNotebookBar = pSysWindow->GetNotebookBar()) + if (const auto& pNotebookBar = pSysWindow->GetNotebookBar()) { pNotebookBar->SetupListener(false); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 3758e41cde7c..99826bb65af9 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1664,7 +1664,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) bool bIsBaseFormOpen = false; const auto xCurrentFrame = GetFrame().GetFrameInterface(); - const auto xContext = comphelper::getProcessComponentContext(); + const auto& xContext = comphelper::getProcessComponentContext(); const auto xModuleManager = css::frame::ModuleManager::create(xContext); switch (vcl::EnumContext::GetApplicationEnum( vcl::CommandInfoProvider::GetModuleIdentifier(xCurrentFrame))) |