sfx2/source/appl/sfxhelp.cxx | 2 +- sfx2/source/bastyp/fltfnc.cxx | 2 +- sfx2/source/dialog/dinfdlg.cxx | 2 +- sfx2/source/dialog/filedlghelper.cxx | 4 ++-- sfx2/source/doc/SfxDocumentMetaData.cxx | 2 +- sfx2/source/doc/SfxRedactionHelper.cxx | 2 +- sfx2/source/doc/docfile.cxx | 2 +- sfx2/source/doc/doctemplates.cxx | 2 +- sfx2/source/doc/objstor.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 2 +- sfx2/source/notebookbar/SfxNotebookBar.cxx | 4 ++-- sfx2/source/view/viewfrm.cxx | 2 +- sw/source/core/access/AccessibilityCheck.cxx | 2 +- sw/source/core/crsr/crstrvl.cxx | 2 +- sw/source/core/doc/doclay.cxx | 2 +- sw/source/core/doc/rdfhelper.cxx | 2 +- sw/source/core/edit/edfcol.cxx | 2 +- sw/source/core/edit/edlingu.cxx | 2 +- sw/source/core/tox/txmsrt.cxx | 2 +- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/core/unocore/unosett.cxx | 6 +++--- sw/source/core/unocore/unotext.cxx | 4 ++-- sw/source/filter/ww8/docxattributeoutput.cxx | 12 ++++++------ sw/source/filter/ww8/docxexport.cxx | 4 ++-- sw/source/filter/ww8/docxsdrexport.cxx | 4 ++-- sw/source/filter/ww8/wrtw8esh.cxx | 4 ++-- sw/source/filter/ww8/wrtww8.cxx | 4 ++-- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/filter/xml/xmltbli.cxx | 2 +- sw/source/ui/chrdlg/drpcps.cxx | 2 +- sw/source/ui/dbui/mmlayoutpage.cxx | 4 ++-- sw/source/ui/index/cnttab.cxx | 2 +- sw/source/ui/misc/glossary.cxx | 4 ++-- sw/source/uibase/app/apphdl.cxx | 2 +- sw/source/uibase/dbui/mailmergehelper.cxx | 2 +- sw/source/uibase/lingu/olmenu.cxx | 8 ++++---- sw/source/uibase/misc/redlndlg.cxx | 4 ++-- sw/source/uibase/shells/frmsh.cxx | 2 +- sw/source/uibase/shells/textsh1.cxx | 2 +- sw/source/uibase/sidebar/CommentsPanel.cxx | 2 +- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uno/unoatxt.cxx | 4 ++-- sw/source/uibase/utlui/gloslst.cxx | 2 +- sw/source/uibase/wrtsh/wrtsh1.cxx | 2 +- sw/source/uibase/wrtsh/wrtsh3.cxx | 2 +- sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx | 2 +- sw/source/writerfilter/dmapper/NumberingManager.cxx | 2 +- sw/source/writerfilter/dmapper/PropertyMap.cxx | 9 ++++----- 48 files changed, 72 insertions(+), 73 deletions(-)
New commits: commit 4ba5a6ccf44d02c1711b059bcf6667a18ee3b574 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Nov 11 22:06:00 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 12 09:03:13 2024 +0100 clang-tidy: performance-unnecessary-copy-initialization in sw Change-Id: I64342ae8c10738e276702e8ab2c0c0954be25752 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index db35a312a6d2..d5942666487c 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -2480,7 +2480,7 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, SdrObject* pObject) { if (pObject->GetTitle().isEmpty() && pObject->GetDescription().isEmpty()) { - OUString sName = pObject->GetName(); + const OUString& sName = pObject->GetName(); OUString sIssueText = SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", sName); auto pIssue = lclAddIssue(m_aIssueCollection, sIssueText, sfx::AccessibilityIssueID::NO_ALT_SHAPE); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index d3fe6b1b9bd2..dcdfc4118851 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -846,7 +846,7 @@ bool SwCursorShell::GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote) bool SwCursorShell::GotoFormatContentControl(const SwFormatContentControl& rContentControl) { - std::shared_ptr<SwContentControl> pContentControl = rContentControl.GetContentControl(); + const std::shared_ptr<SwContentControl>& pContentControl = rContentControl.GetContentControl(); const SwTextContentControl* pTextContentControl = pContentControl->GetTextAttr(); if (!pTextContentControl) return false; diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index bfe18a2411d0..00c6d8080286 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1289,7 +1289,7 @@ static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32 static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32 nNmLen, const SdrObject& rObj, const OUString& rCmpName) { - OUString sName = rObj.GetName(); + const OUString& sName = rObj.GetName(); lcl_collectUsedNums(rSetFlags, nNmLen, sName, rCmpName); // tdf#122487 take groups into account, iterate and recurse through their // contents for name collision check diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx index c6904aa50cdc..5d6c573821da 100644 --- a/sw/source/core/doc/rdfhelper.cxx +++ b/sw/source/core/doc/rdfhelper.cxx @@ -191,7 +191,7 @@ void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTe if (!aGraphNames.hasElements()) return; - uno::Reference<rdf::XURI> xGraphName = aGraphNames[0]; + const uno::Reference<rdf::XURI>& xGraphName = aGraphNames[0]; uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName); uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index f3efc8a03015..44125de5c46c 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -971,7 +971,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); std::vector<OUString> aPageStyles = lcl_getUsedPageStyles(this); - OUString aPageStyleString = aPageStyles.back(); + const OUString& aPageStyleString = aPageStyles.back(); uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(aPageStyleString), uno::UNO_QUERY); bool bHeaderIsOn = false; diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 8b73d588048e..4cd4227296bc 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -573,7 +573,7 @@ bool SwEditShell::HasLastSentenceGotGrammarChecked() bool bTextWasGrammarChecked = false; if (g_pSpellIter) { - svx::SpellPortions aLastPortions( g_pSpellIter->GetLastPortions() ); + const svx::SpellPortions& aLastPortions( g_pSpellIter->GetLastPortions() ); for (size_t i = 0; i < aLastPortions.size() && !bTextWasGrammarChecked; ++i) { // bIsGrammarError is also true if the text was only checked but no diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 127dfb34dd2d..c2bc4ab4cd05 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -340,7 +340,7 @@ bool SwTOXIndex::sort_lt(const SwTOXSortTabBase& rCmpBase) OSL_ENSURE(pTextMark, "pTextMark == 0, No keyword"); const TextAndReading aMyTaR(GetText()); - const TextAndReading aOtherTaR(rCmpBase.GetText()); + const TextAndReading& aOtherTaR(rCmpBase.GetText()); bool bRet = GetLevel() == rCmpBase.GetLevel() && pTOXIntl->IsLess( aMyTaR, GetLocale(), diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index e8fa1b248da4..a0a8c8c2ed98 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3530,7 +3530,7 @@ OUString SwTextNode::GetExpandText(SwRootFrame const*const pLayout, } ModelToViewHelper aConversionMap(*this, pLayout, eMode); - const OUString aExpandText = aConversionMap.getViewText(); + const OUString& aExpandText = aConversionMap.getViewText(); const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx ); sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen; const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd ); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 9c3ada9f2d6e..3784c55284d7 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1458,7 +1458,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat nINT16 = cBullet; aPropertyValues.push_back(comphelper::makePropertyValue(u"BulletId"_ustr, nINT16)); - std::optional<vcl::Font> pFont = rFormat.GetBulletFont(); + const std::optional<vcl::Font>& pFont = rFormat.GetBulletFont(); //BulletChar aUString = OUString(&cBullet, 1); @@ -1630,14 +1630,14 @@ uno::Any SwXNumberingRules::GetPropertyForNumFormat( //BulletFontName if (rPropName == u"BulletFontName"_ustr) { - std::optional<vcl::Font> pFont = rFormat.GetBulletFont(); + const std::optional<vcl::Font>& pFont = rFormat.GetBulletFont(); return uno::Any(pFont ? pFont->GetFamilyName() : OUString()); } //BulletFont if (rPropName == UNO_NAME_BULLET_FONT) { - if (std::optional<vcl::Font> pFont = rFormat.GetBulletFont()) + if (const std::optional<vcl::Font>& pFont = rFormat.GetBulletFont()) { awt::FontDescriptor aDesc; SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc ); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 2c4e11dbc139..0f932b244a9b 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1824,8 +1824,8 @@ void SwXText::ConvertCell( u"rCell needs to contain 2 elements"_ustr, uno::Reference< text::XTextCopy >( this ), sal_Int16( 2 ) ); } - const uno::Reference<text::XTextRange> xStartRange = rCell[0]; - const uno::Reference<text::XTextRange> xEndRange = rCell[1]; + const uno::Reference<text::XTextRange>& xStartRange = rCell[0]; + const uno::Reference<text::XTextRange>& xEndRange = rCell[1]; SwUnoInternalPaM aStartCellPam(*m_pDoc); SwUnoInternalPaM aEndCellPam(*m_pDoc); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 24ceb1a6e0f4..519cba272263 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2215,7 +2215,7 @@ void DocxAttributeOutput::DoWriteMoveRangeTagStart(std::u16string_view bookmarkN SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); - const DateTime aDateTime = pRedlineData->GetTimeStamp(); + const DateTime& aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); @@ -2492,7 +2492,7 @@ void DocxAttributeOutput::WriteFFData( const FieldInfos& rInfos ) } else if ( rInfos.eType == ww::eFORMCHECKBOX ) { - const OUString sName = params.getName(); + const OUString& sName = params.getName(); bool bChecked = false; const sw::mark::CheckboxFieldmark* pCheckboxFm = dynamic_cast<const sw::mark::CheckboxFieldmark*>(&rFieldmark); @@ -4095,7 +4095,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) OString aId( OString::number( pRedlineData->GetSeqNo() ) ); const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); - const DateTime aDateTime = pRedlineData->GetTimeStamp(); + const DateTime& aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); @@ -4255,7 +4255,7 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData * pRedlineData, bool ? "Author" + OUString::number( GetExport().GetInfoID(rAuthor) ) : rAuthor, RTL_TEXTENCODING_UTF8 ) ); - const DateTime aDateTime = pRedlineData->GetTimeStamp(); + const DateTime& aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); bool bMoved = pRedlineData->IsMoved() && @@ -7902,7 +7902,7 @@ void DocxAttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap ) void DocxAttributeOutput::CharColor(const SvxColorItem& rColorItem) { const Color aColor = rColorItem.getColor(); - const model::ComplexColor aComplexColor = rColorItem.getComplexColor(); + const model::ComplexColor& aComplexColor = rColorItem.getComplexColor(); OString aColorString = msfilter::util::ConvertColor(aColor); @@ -9786,7 +9786,7 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad // LO does linear gradients top to bottom, while MSO does bottom to top. // LO does axial gradients inner to outer, while MSO does outer to inner. // Conclusion: swap start and end colors. - const OString sColor1 = sEndColor; // LO end color is MSO start color + const OString& sColor1 = sEndColor; // LO end color is MSO start color OString sColor2 = sStartColor; // LO start color is MSO end color switch (rGradient.GetGradientStyle()) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 438743ab0b0f..63f53bf34dd5 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1723,8 +1723,8 @@ void DocxExport::WriteCustomXml() for (sal_Int32 j = 0; j < customXmlDomlist.getLength(); j++) { - uno::Reference<xml::dom::XDocument> customXmlDom = customXmlDomlist[j]; - uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j]; + const uno::Reference<xml::dom::XDocument>& customXmlDom = customXmlDomlist[j]; + const uno::Reference<xml::dom::XDocument>& customXmlDomProps = customXmlDomPropslist[j]; if (customXmlDom.is()) { m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 3a495ae4083b..4bfd56ae0fc8 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -719,7 +719,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons { // Frame objects have a restricted shadow and no further effects. They have border instead of // stroke. LO includes shadow and border in the object size, but Word not. - SvxShadowItem aShadowItem = pFrameFormat->GetShadow(); + const SvxShadowItem& aShadowItem = pFrameFormat->GetShadow(); if (aShadowItem.GetLocation() != SvxShadowLocation::NONE) { sal_Int32 nShadowWidth(aShadowItem.GetWidth()); @@ -1435,7 +1435,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo pDocPrAttrList->add(XML_hidden, OString::number(1)); pFS->startElementNS(XML_wp, XML_docPr, pDocPrAttrList); - OUString sHyperlink = pSdrObject->getHyperlink(); + const OUString& sHyperlink = pSdrObject->getHyperlink(); if (!sHyperlink.isEmpty()) { OUString sRelId = m_pImpl->getExport().GetFilter().addRelation( diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 69707aa46c24..db3a6b9674a9 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -185,8 +185,8 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFo SvMemoryStream tmpStrm; OUString tmpTextMark; - OUString rUrl = pINetFormatArg->GetURL(); - OUString rTarFrame = pINetFormatArg->GetTargetFrameName(); + const OUString& rUrl = pINetFormatArg->GetURL(); + const OUString& rTarFrame = pINetFormatArg->GetTargetFrameName(); sal_uInt32 nFlags = 0; INetURLObject aUrlObj( rUrl ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 4687bbaa2e7f..d436a61d00d7 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -4387,7 +4387,7 @@ void WW8Export::WriteFormData( const ::sw::mark::Fieldmark& rFieldmark ) slen += 4; // for num of list items const int items = aListItems.size(); for( int i = 0; i < items; i++ ) { - OUString item = aListItems[i]; + const OUString& item = aListItems[i]; slen += 2 * item.getLength() + 2; } } @@ -4417,7 +4417,7 @@ void WW8Export::WriteFormData( const ::sw::mark::Fieldmark& rFieldmark ) const int items=aListItems.size(); m_pDataStrm->WriteUInt32( items ); for(int i=0;i<items;i++) { - OUString item=aListItems[i]; + const OUString& item=aListItems[i]; SwWW8Writer::WriteString_xstz( *m_pDataStrm, item, false ); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 3fc0cf802657..871a116a4e2b 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3310,7 +3310,7 @@ void SwWW8ImplReader::emulateMSWordAddTextToParagraph(const OUString& rAddString return; } - uno::Reference<i18n::XBreakIterator> xBI(g_pBreakIt->GetBreakIter()); + const uno::Reference<i18n::XBreakIterator>& xBI(g_pBreakIt->GetBreakIter()); assert(xBI.is()); sal_Int16 nScript = lcl_getScriptType(xBI, rAddString, 0); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 7a2bbb59cf39..93840a1d27c5 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1872,7 +1872,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( } // Share formats! - const OUString sStyleName = pCell->GetStyleName(); + const OUString& sStyleName = pCell->GetStyleName(); bool bModifyLocked; bool bNew; SwTableBoxFormat *pBoxFormat2 = GetSharedBoxFormat( diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index f5e4f1a6caa2..34cfb701ddc9 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -543,7 +543,7 @@ bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet) void SwDropCapsPage::Reset(const SfxItemSet *rSet) { // Characters, lines, gap and text - SwFormatDrop aFormatDrop( rSet->Get(RES_PARATR_DROP) ); + const SwFormatDrop& aFormatDrop( rSet->Get(RES_PARATR_DROP) ); if (aFormatDrop.GetLines() > 1) { m_xDropCapsField->set_value(aFormatDrop.GetChars()); diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index a0c5195e7ef4..e4fc8b02b1fd 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -298,7 +298,7 @@ SwFrameFormat* SwMailMergeLayoutPage::InsertAddressFrame( bool bIncludeCountry = rConfigItem.IsIncludeCountry(); bool bHideEmptyParagraphs = rConfigItem.IsHideEmptyParagraphs(); - const OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); + const OUString& rExcludeCountry = rConfigItem.GetExcludeCountry(); bool bSpecialReplacementForCountry = (!bIncludeCountry || !rExcludeCountry.isEmpty()); const std::vector<std::pair<OUString, int>>& rHeaders = rConfigItem.GetDefaultAddressHeaders(); @@ -495,7 +495,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting(static_cast<SwMailMergeConfigItem::Gender>(eGender)); if( nCurrent >= 0 && nCurrent < aEntries.getLength()) { - const OUString sGreeting = aEntries[nCurrent]; + const OUString& sGreeting = aEntries[nCurrent]; OUString sCondition; OUString sHideParagraphsExpression; switch(eGender) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 56b9c1f07068..905b4aeaa984 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1457,7 +1457,7 @@ void SwTOXSelectTabPage::LanguageHdl(const weld::ComboBox* pBox) sal_Int32 nEnd = aSeq.getLength(); for( sal_Int32 nCnt = 0; nCnt < nEnd; ++nCnt ) { - const OUString sAlg(aSeq[ nCnt ]); + const OUString& sAlg(aSeq[ nCnt ]); const OUString sUINm = m_pIndexRes->GetTranslation( sAlg ); m_xSortAlgorithmLB->append(sAlg, sUINm); if( sAlg == sOldString ) diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 85d6d52eb68b..476dac604edc 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -363,7 +363,7 @@ namespace OUString getCurrentGlossary() { - const OUString sTemp{ ::GetCurrGlosGroup() }; + const OUString& sTemp{ ::GetCurrGlosGroup() }; // the zeroth path is not being recorded! if (o3tl::starts_with(o3tl::getToken(sTemp, 1, GLOS_DELIM), u"0")) @@ -756,7 +756,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl, weld::Button&, void) { Init(); //if new groups were created - select one of them - const OUString sNewGroup = aDlg.GetCreatedGroupName(); + const OUString& sNewGroup = aDlg.GetCreatedGroupName(); std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator(); bool bEntry = m_xCategoryBox->get_iter_first(*xEntry); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 717d9bf6a9bf..1aff41216524 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -283,7 +283,7 @@ std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const S GetWrtShell().GetAllUsedDB(aDBNameList, &aAllDBNames); if (!aDBNameList.empty()) { - OUString sDBName(aDBNameList[0]); + const OUString& sDBName(aDBNameList[0]); SwDBData aDBData; sal_Int32 nIdx{ 0 }; aDBData.sDataSource = sDBName.getToken(0, DB_DELIM, nIdx); diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index b45c2789187c..00932257d595 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -201,7 +201,7 @@ OUString SwAddressPreview::FillData( const std::vector<std::pair<OUString, int>>& rDefHeaders = rConfigItem.GetDefaultAddressHeaders(); bool bIncludeCountry = rConfigItem.IsIncludeCountry(); - const OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); + const OUString& rExcludeCountry = rConfigItem.GetExcludeCountry(); bool bSpecialReplacementForCountry = (!bIncludeCountry || !rExcludeCountry.isEmpty()); OUString sCountryColumn; if( bSpecialReplacementForCountry ) diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index e0398265c4b8..0c737246317c 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -103,10 +103,10 @@ void SwSpellPopup::fillLangPopupMenu( // set of languages to be displayed in the sub menus std::set< OUString > aLangItems; - OUString aCurLang( aSeq[0] ); + const OUString& aCurLang( aSeq[0] ); SvtScriptType nScriptType = static_cast<SvtScriptType>(aSeq[1].toInt32()); - OUString aKeyboardLang( aSeq[2] ); - OUString aGuessedTextLang( aSeq[3] ); + const OUString& aKeyboardLang( aSeq[2] ); + const OUString& aGuessedTextLang( aSeq[3] ); if (!aCurLang.isEmpty() && LANGUAGE_DONTKNOW != SvtLanguageTable::GetLanguageType( aCurLang )) @@ -257,7 +257,7 @@ SwSpellPopup::SwSpellPopup( sal_uInt16 nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { - const OUString aEntry = aSuggestions[ i ]; + const OUString& aEntry = aSuggestions[ i ]; m_xPopupMenu->InsertItem(nItemId, aEntry, MenuItemBits::NONE, {}, i); m_xPopupMenu->SetHelpId(nItemId, HID_LINGU_REPLACE); if (!aSuggestionImageUrl.isEmpty()) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 9c09948c05f8..6c1e9a854d18 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -766,11 +766,11 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa pData->bDisabled = true; OUString sImage(GetActionImage(rRedln, nStack)); - OUString sAuthor = rRedln.GetAuthorString(nStack); + const OUString& sAuthor = rRedln.GetAuthorString(nStack); pData->aDateTime = rRedln.GetTimeStamp(nStack); pData->eType = rRedln.GetType(nStack); OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime); - OUString sComment = rRedln.GetComment(nStack); + const OUString& sComment = rRedln.GetComment(nStack); std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator()); OUString sId(weld::toId(pData.get())); diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 612f68383fc9..d1790ed10bdf 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -809,7 +809,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) default: break; } - SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient()); + const SwFormatHoriOrient& aHOrient(aMgr.GetHoriOrient()); if (nHoriOrient != -1) rSet.Put(SfxBoolItem(nWhich, nHoriOrient == aHOrient.GetHoriOrient())); } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 12a7b4c4b7ee..645d3d3f7d93 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -269,7 +269,7 @@ static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell& rWrtSh, std: // The old item is for unknown reasons back in the set again. if( !bSelectionPut && (pSelectionItem = aTmpSet.GetItemIfSet(FN_PARAM_SELECTION, false)) ) { - OUString sInsert = pSelectionItem->GetValue(); + const OUString& sInsert = pSelectionItem->GetValue(); bInsert = !sInsert.isEmpty(); if(bInsert) { diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx b/sw/source/uibase/sidebar/CommentsPanel.cxx index 0910db3a49cb..66a8cf9eef20 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.cxx +++ b/sw/source/uibase/sidebar/CommentsPanel.cxx @@ -587,7 +587,7 @@ void CommentsPanel::setResolvedStatus(sw::annotation::SwAnnotationWin* pAnnotati void CommentsPanel::editComment(SwPostItField* pPostItField, Comment* pComment) { - OUString sText = pPostItField->GetText(); + const OUString& sText = pPostItField->GetText(); pComment->SetCommentText(sText); pComment->mxTextView->set_text(sText); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index f9acb11ba4ec..e630fc1c8325 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -3050,7 +3050,7 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) rSh.GetAllUsedDB( aDBNameList, &aAllDBNames ); if(!aDBNameList.empty()) { - OUString sDBName(aDBNameList[0]); + const OUString& sDBName(aDBNameList[0]); sal_Int32 nIdx {0}; aData.sDataSource = sDBName.getToken(0, DB_DELIM, nIdx); aData.sCommand = sDBName.getToken(0, DB_DELIM, nIdx); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 809b9d388f65..c0e02e17f77e 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -246,8 +246,8 @@ void SwXAutoTextGroup::renameByName(const OUString& aElementName, const sal_uInt16 nIdx = pGlosGroup->GetIndex( aElementName); if(USHRT_MAX == nIdx) throw lang::IllegalArgumentException(); - OUString aNewShort(aNewElementName); - OUString aNewName(aNewElementTitle); + const OUString& aNewShort(aNewElementName); + const OUString& aNewName(aNewElementTitle); sal_uInt16 nOldLongIdx = pGlosGroup->GetLongIndex( aNewShort ); sal_uInt16 nOldIdx = pGlosGroup->GetIndex( aNewName ); diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 08a9c23b431c..3d288b6ead1f 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -284,7 +284,7 @@ void SwGlossaryList::Update() &sExt, &aDateTimeArr ); for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles ) { - const OUString aTitle = aFiles[ nFiles ]; + const OUString& aTitle = aFiles[ nFiles ]; ::DateTime& rDT = aDateTimeArr[ nFiles ]; OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() )); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 20e44c8a930d..0e980c9f262d 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -623,7 +623,7 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame if ( SotExchange::IsChart( aCLSID ) ) { - uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = xRef.GetObject(); + const uno::Reference< embed::XEmbeddedObject >& xEmbeddedObj = xRef.GetObject(); if ( xEmbeddedObj.is() ) { bool bDisableDataTableDialog = false; diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index 55ba862216b7..36c12ebee17c 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -96,7 +96,7 @@ bool SwWrtShell::GotoField( const SwFormatField& rField ) bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentControl, bool bOnlyRefresh) { - std::shared_ptr<SwContentControl> pContentControl = rContentControl.GetContentControl(); + const std::shared_ptr<SwContentControl>& pContentControl = rContentControl.GetContentControl(); if (IsFrameSelected() && pContentControl && pContentControl->GetPicture()) { // A frame is already selected, and its anchor is inside a picture content control. diff --git a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx index 1a5fe534292e..afd6af78ee47 100644 --- a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx @@ -987,7 +987,7 @@ static bool lcl_emptyRow(std::vector<RowSequence_t>& rTableRanges, sal_Int32 nRo return false; } - const RowSequence_t rRowSeq = rTableRanges[nRow]; + const RowSequence_t& rRowSeq = rTableRanges[nRow]; if (!rRowSeq.hasElements()) { SAL_WARN("writerfilter.dmapper", "m_aCellProperties not in sync with rTableRanges?"); diff --git a/sw/source/writerfilter/dmapper/NumberingManager.cxx b/sw/source/writerfilter/dmapper/NumberingManager.cxx index d5d81d47b94b..dbbb9d9d3799 100644 --- a/sw/source/writerfilter/dmapper/NumberingManager.cxx +++ b/sw/source/writerfilter/dmapper/NumberingManager.cxx @@ -469,7 +469,7 @@ uno::Sequence<uno::Sequence<beans::PropertyValue>> ListDef::GetMergedPropertyVal sal_Int32 nAbstractCount = aAbstract.getLength( ); for ( sal_Int32 i = 0; i < nThisCount && i < nAbstractCount; i++ ) { - uno::Sequence< beans::PropertyValue > level = aThis[i]; + const uno::Sequence< beans::PropertyValue >& level = aThis[i]; if (level.hasElements() && GetLevel(i)->HasValues()) { // If the element contains something, merge it, but ignore stub overrides. diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx b/sw/source/writerfilter/dmapper/PropertyMap.cxx index 447999e0a908..66df3296a8bf 100644 --- a/sw/source/writerfilter/dmapper/PropertyMap.cxx +++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx @@ -517,11 +517,10 @@ rtl::Reference<SwXPageStyle> SectionPropertyMap::GetPageStyle(DomainMapper_Impl& // removes the content - all the paragraphs of an input XText void SectionPropertyMap::removeXTextContent(uno::Reference<text::XText> const& rxText) { - uno::Reference<text::XText> xText(rxText); - if (!xText.is()) + if (!rxText.is()) return; - xText->setString(OUString()); - uno::Reference<text::XParagraphAppend> const xAppend(xText, uno::UNO_QUERY_THROW); + rxText->setString(OUString()); + uno::Reference<text::XParagraphAppend> const xAppend(rxText, uno::UNO_QUERY_THROW); uno::Reference<lang::XComponent> const xParagraph(xAppend->finishParagraph(uno::Sequence<beans::PropertyValue>()), uno::UNO_QUERY_THROW); xParagraph->dispose(); } @@ -1445,7 +1444,7 @@ void BeforeConvertToTextFrame(const std::deque<StoredRedline>& rFramedRedlines, void AfterConvertToTextFrame(DomainMapper_Impl& rDM_Impl, const std::deque<StoredRedline>& rFramedRedlines, std::vector<sal_Int32>& redPos, std::vector<sal_Int32>& redLen, std::vector<OUString>& redCell, std::vector<OUString>& redTable) { - rtl::Reference<SwXTextDocument> xTextDocument(rDM_Impl.GetTextDocument()); + const rtl::Reference<SwXTextDocument>& xTextDocument(rDM_Impl.GetTextDocument()); rtl::Reference<SwXTextTables> xTables = xTextDocument->getSwTextTables(); for( size_t i = 0; i < rFramedRedlines.size(); i++) { commit 41ab82d5dbfd04eca6437dc072e0cef15b5d1ae9 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Nov 11 22:05:07 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 12 09:03:02 2024 +0100 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.gran...@collabora.co.uk> 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)))