From 0879fd8ea4920c51dab59a35b8df204f19796fad Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Nov 2024 12:36:55 +0200 Subject: clang-tidy: performance-unnecessary-copy-initialization in cui Change-Id: Idbce2978dee6c485e50dc6ceccf67d7d3722bb17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176375 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/dialogs/cuihyperdlg.cxx | 2 +- cui/source/dialogs/screenshotannotationdlg.cxx | 2 +- cui/source/options/optdict.cxx | 7 +++---- cui/source/options/optgdlg.cxx | 4 ++-- cui/source/options/optpath.cxx | 2 +- cui/source/tabpages/border.cxx | 2 +- cui/source/tabpages/numfmt.cxx | 2 +- cui/source/tabpages/numpages.cxx | 2 +- cui/source/tabpages/tparea.cxx | 4 ++-- cui/source/tabpages/tpbitmap.cxx | 4 ++-- cui/source/tabpages/tpcolor.cxx | 2 +- cui/source/tabpages/tphatch.cxx | 8 ++++---- cui/source/tabpages/tppattern.cxx | 2 +- 13 files changed, 21 insertions(+), 22 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 2270ab330f0b..428ed342a3ac 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -238,7 +238,7 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem ) { OUString sPageId(u"internet"_ustr); - OUString aStrURL(pItem->GetURL()); + const OUString& aStrURL(pItem->GetURL()); INetURLObject aURL(aStrURL); INetProtocol eProtocolTyp = aURL.GetProtocol(); diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index c321931f8f49..4fc295f84286 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -305,7 +305,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&, if (!files.hasElements()) return; - OUString aConfirmedName = files[0]; + const OUString& aConfirmedName = files[0]; if (aConfirmedName.isEmpty()) return; diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 2a3b089c8762..f383280e5bc9 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -600,7 +600,6 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) { int nEntry = m_pWordsLB->get_selected_index(); OUString aNewWord(fixSpace(m_xWordED->get_text())); - OUString sEntry(aNewWord); OUString aReplaceStr(fixSpace(m_xReplaceED->get_text())); DictionaryError nAddRes = DictionaryError::UNKNOWN; @@ -632,21 +631,21 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) if (DictionaryError::NONE != nAddRes) SvxDicError(m_xDialog.get(), nAddRes); - if (DictionaryError::NONE == nAddRes && !sEntry.isEmpty()) + if (DictionaryError::NONE == nAddRes && !aNewWord.isEmpty()) { // insert new entry in list-box etc... m_pWordsLB->freeze(); if (nEntry != -1) // entry selected in m_pWordsLB ie action = modify entry { - m_pWordsLB->set_text(nEntry, sEntry); + m_pWordsLB->set_text(nEntry, aNewWord); if (!aReplaceStr.isEmpty()) m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } else { nEntry = GetLBInsertPos(aNewWord); - m_pWordsLB->insert_text(nEntry, sEntry); + m_pWordsLB->insert_text(nEntry, aNewWord); if(!aReplaceStr.isEmpty()) m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 6cfc67c9496b..6ca5847d22cf 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -144,7 +144,7 @@ bool lcl_HasSystemFilePicker() try { - OUString aFileService = impl_SystemFileOpenServiceName(); + const OUString& aFileService = impl_SystemFileOpenServiceName(); Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService ); if ( xEnum.is() && xEnum->hasMoreElements() ) bRet = true; @@ -1134,7 +1134,7 @@ static Sequence< OUString > seqInstalledLanguages; static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper ) { - Sequence< OUString > aDateAcceptancePatterns = rLocaleWrapper.getDateAcceptancePatterns(); + const Sequence< OUString >& aDateAcceptancePatterns = rLocaleWrapper.getDateAcceptancePatterns(); sal_Int32 nPatterns = aDateAcceptancePatterns.getLength(); OUStringBuffer aBuf( nPatterns * 6 ); // 6 := length of Y-M-D; SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern"); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 5eb31909fc22..d11aab9e7eaf 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -572,7 +572,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void) try { sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); - uno::Reference xFilePicker = aHelper.GetFilePicker(); + const uno::Reference& xFilePicker = aHelper.GetFilePicker(); xFilePicker->appendFilter(OUString(), u"*.xml"_ustr); if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK) { diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 330f8f77aa17..eba8bdc23fe4 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1231,7 +1231,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void) { - NamedColor aNamedColor = rColorBox.GetSelectedEntry(); + const NamedColor& aNamedColor = rColorBox.GetSelectedEntry(); m_aFrameSel.SetColorToSelection(aNamedColor.m_aColor, aNamedColor.getComplexColor()); } diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index d078e82f9f85..ab05111e7b95 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -1016,7 +1016,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl { if(bUpdateEdit) { - OUString aFormat=aEntryList[nFmtLbSelPos]; + const OUString& aFormat=aEntryList[nFmtLbSelPos]; m_xEdFormat->set_text(aFormat); m_xFtComment->set_label(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); } diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 240711ffca10..c2309176784f 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -593,7 +593,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl { SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ]; - Reference xLevel = aOutlineAccess[nItem]; + const Reference& xLevel = aOutlineAccess[nItem]; for(sal_Int32 nLevel = 0; nLevel < SVX_MAX_NUM; nLevel++) { // use the last locale-defined level for all remaining levels. diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index dc9b0e4ea542..efd8dfacce78 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -169,7 +169,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) drawing::FillStyle eXFS = drawing::FillStyle_NONE; if( rSet.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::INVALID ) { - XFillStyleItem aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ); + const XFillStyleItem& aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ); eXFS = aFillStyleItem.GetValue(); m_rXFSet.Put( aFillStyleItem ); } @@ -179,7 +179,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) default: case drawing::FillStyle_NONE: { - XFillUseSlideBackgroundItem aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); + const XFillUseSlideBackgroundItem& aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); if (aBckItem.GetValue()) SelectFillType(*m_xBtnUseBackground); else diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 9dadae520bd5..9ed75da8d3c8 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -149,7 +149,7 @@ void SvxBitmapTabPage::Construct() void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) { - XFillBitmapItem aItem( rSet.Get(XATTR_FILLBITMAP) ); + const XFillBitmapItem& aItem( rSet.Get(XATTR_FILLBITMAP) ); sal_Int32 nPos( 0 ); if ( !aItem.isPattern() ) @@ -278,7 +278,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) double fTmpHeight((OutputDevice::LogicToLogic(static_cast(m_fObjectHeight), mePoolUnit, MapUnit::Map100thMM )) / fUIScale); m_fObjectHeight = fTmpHeight; - XFillBitmapItem aItem( rAttrs->Get(XATTR_FILLBITMAP) ); + const XFillBitmapItem& aItem( rAttrs->Get(XATTR_FILLBITMAP) ); if(!aItem.isPattern()) { diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 8a84b1a99bca..ef8f208205e7 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -265,7 +265,7 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) if ( nState >= SfxItemState::DEFAULT ) { - XFillColorItem aColorItem( rSet->Get( XATTR_FILLCOLOR ) ); + const XFillColorItem& aColorItem( rSet->Get( XATTR_FILLCOLOR ) ); m_aPreviousColor = aColorItem.GetColorValue(); aNewColor = aColorItem.GetColorValue(); } diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 343e9fac7708..bfa6d2fa417a 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -172,13 +172,13 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) ChangeHatchHdl_Impl(); } - XFillBackgroundItem aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); + const XFillBackgroundItem& aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); m_rXFSet.Put( aBckItem ); if (aBckItem.GetValue()) { m_xCbBackgroundColor->set_state(TRISTATE_TRUE); - XFillColorItem aColorItem( rSet.Get(XATTR_FILLCOLOR) ); + const XFillColorItem& aColorItem( rSet.Get(XATTR_FILLCOLOR) ); Color aColor(aColorItem.GetColorValue()); m_xLbBackgroundColor->SelectEntry(aColor); m_xLbBackgroundColor->set_sensitive(true); @@ -254,11 +254,11 @@ void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) { ChangeHatchHdl_Impl(); - XFillColorItem aColItem( rSet->Get(XATTR_FILLCOLOR) ); + const XFillColorItem& aColItem( rSet->Get(XATTR_FILLCOLOR) ); m_xLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); m_rXFSet.Put( aColItem ); - XFillBackgroundItem aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); + const XFillBackgroundItem& aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); if(aBckItem.GetValue()) m_xCbBackgroundColor->set_state(TRISTATE_TRUE); else diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 6128ae946184..481248e29278 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -160,7 +160,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - XFillBitmapItem aItem( rSet.Get( XATTR_FILLBITMAP ) ); + const XFillBitmapItem& aItem( rSet.Get( XATTR_FILLBITMAP ) ); if ( aItem.isPattern() ) { -- cgit