From 65d52af42f329bbe7c5e7d6ac617320f7faa4760 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Nov 2024 22:05:22 +0200 Subject: clang-tidy: performance-unnecessary-copy-initialization in svx Change-Id: I80bdcae1db64f7693600178d86c122c5875369b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176440 Tested-by: Jenkins Reviewed-by: Noel Grandin --- slideshow/source/engine/smilfunctionparser.cxx | 4 ++-- svtools/source/misc/embedhlp.cxx | 2 +- svx/source/core/graphichelper.cxx | 2 +- svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx | 2 +- svx/source/dialog/framelinkarray.cxx | 2 +- svx/source/dialog/grfflt.cxx | 2 +- svx/source/fmcomp/gridcell.cxx | 2 +- svx/source/form/datanavi.cxx | 2 +- svx/source/form/fmpgeimp.cxx | 4 ++-- svx/source/form/fmvwimp.cxx | 4 ++-- svx/source/form/navigatortree.cxx | 4 ++-- svx/source/form/navigatortreemodel.cxx | 4 ++-- svx/source/gallery2/galleryfilestorage.cxx | 2 +- svx/source/items/numfmtsh.cxx | 2 +- svx/source/sdr/misc/ImageMapInfo.cxx | 2 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 2 +- svx/source/sidebar/nbdtmg.cxx | 2 +- svx/source/svdraw/sdrhittesthelper.cxx | 2 +- svx/source/svdraw/svdmrkv.cxx | 2 +- svx/source/svdraw/svdouno.cxx | 2 +- svx/source/table/tablecontroller.cxx | 2 +- svx/source/table/viewcontactoftableobj.cxx | 2 +- svx/source/tbxctrls/tbcontrl.cxx | 2 +- svx/source/unodraw/unoshap4.cxx | 2 +- 24 files changed, 29 insertions(+), 29 deletions(-) diff --git a/slideshow/source/engine/smilfunctionparser.cxx b/slideshow/source/engine/smilfunctionparser.cxx index 6482be4a2316..5d8fce43b197 100644 --- a/slideshow/source/engine/smilfunctionparser.cxx +++ b/slideshow/source/engine/smilfunctionparser.cxx @@ -535,7 +535,7 @@ namespace slideshow::internal // static parser context, because the actual // Spirit parser is also a static object - ParserContextSharedPtr pContext = getParserContext(); + const ParserContextSharedPtr& pContext = getParserContext(); pContext->maShapeBounds = rRelativeShapeBounds; pContext->mbParseAnimationFunction = false; // parse with '$' disabled @@ -578,7 +578,7 @@ namespace slideshow::internal // static parser context, because the actual // Spirit parser is also a static object - ParserContextSharedPtr pContext = getParserContext(); + const ParserContextSharedPtr& pContext = getParserContext(); pContext->maShapeBounds = rRelativeShapeBounds; pContext->mbParseAnimationFunction = true; // parse with '$' enabled diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 78b5909f1602..b3a291936aed 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -853,7 +853,7 @@ void EmbeddedObjectRef::SetGraphicToContainer( const Graphic& rGraphic, SvMemoryStream aStream; aStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); - auto pGfxLink = rGraphic.GetSharedGfxLink(); + const auto& pGfxLink = rGraphic.GetSharedGfxLink(); if (pGfxLink && pGfxLink->IsNative()) { if (pGfxLink->ExportNative(aStream)) diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 4d93ca19142a..37a6da704ccc 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -125,7 +125,7 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic& OUString GraphicHelper::GetImageType(const Graphic& rGraphic) { - auto pGfxLink = rGraphic.GetSharedGfxLink(); + const auto& pGfxLink = rGraphic.GetSharedGfxLink(); if (pGfxLink) { auto iter = constGfxTypeToString.find(pGfxLink->GetType()); diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index c9d644ca08ec..9414d1acba0e 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -1137,7 +1137,7 @@ std::shared_ptr const & FunctionParser::parseFunction( std::u16s // static parser context, because the actual // Spirit parser is also a static object - ParserContextSharedPtr pContext = getParserContext(); + const ParserContextSharedPtr& pContext = getParserContext(); pContext->mpCustoShape = &rCustoShape; ExpressionGrammar aExpressionGrammer( pContext ); diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index fbdc727ebf10..02332d5e6de8 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -1277,7 +1277,7 @@ static void HelperClipLine( if(aResultPP.count() > 0) { - const basegfx::B2DPolygon aResultP(aResultPP.getB2DPolygon(0)); + const basegfx::B2DPolygon& aResultP(aResultPP.getB2DPolygon(0)); if(aResultP.count() > 0) { diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx index ebf650d3f088..d460840fa94e 100644 --- a/svx/source/dialog/grfflt.cxx +++ b/svx/source/dialog/grfflt.cxx @@ -41,7 +41,7 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const & rReq, const GraphicObject& rInputObject, const std::function& f) { - Graphic aInputGraphic = rInputObject.GetGraphic(); + const Graphic& aInputGraphic = rInputObject.GetGraphic(); if( aInputGraphic.GetType() != GraphicType::Bitmap ) return; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index dae6b27a0e44..49f87218cebd 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -527,7 +527,7 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn ) ,m_pPainter( nullptr ) ,m_pWindow( nullptr ) { - Reference< XPropertySet > xColModelProps = _rColumn.getModel(); + const Reference< XPropertySet >& xColModelProps = _rColumn.getModel(); if ( !xColModelProps.is() ) return; diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index e0ce5ee2ae7e..1831f0255dc7 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -415,7 +415,7 @@ namespace svxform { try { - Reference< css::xforms::XSubmission > xNewSubmission = aDlg.GetNewSubmission(); + const Reference< css::xforms::XSubmission >& xNewSubmission = aDlg.GetNewSubmission(); Reference< XSet > xSubmissions = xModel->getSubmissions(); xSubmissions->insert( Any( xNewSubmission ) ); AddEntry(xNewSubmission, m_xScratchIter.get()); diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 3669b7fd986d..d715f9a50c3e 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -236,7 +236,7 @@ namespace void lcl_insertFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map ) { // the control model - Reference< XControlModel > xControlModel = _object.GetUnoControlModel(); + const Reference< XControlModel >& xControlModel = _object.GetUnoControlModel(); OSL_ENSURE( xControlModel.is(), "lcl_insertFormObject_throw: suspicious: no control model!" ); if ( !xControlModel.is() ) return; @@ -252,7 +252,7 @@ namespace void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map ) { // the control model - Reference< XControlModel > xControlModel = _object.GetUnoControlModel(); + const Reference< XControlModel >& xControlModel = _object.GetUnoControlModel(); OSL_ENSURE( xControlModel.is(), "lcl_removeFormObject: suspicious: no control model!" ); if ( !xControlModel.is() ) { diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 7cb66b974c75..204bc81fef44 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1536,8 +1536,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int // calculate the positions, respecting the settings of the target device ::Size aTextSize( _rOutDev.GetTextWidth(sFieldName + _rFieldPostfix), _rOutDev.GetTextHeight() ); - MapMode eTargetMode( _rOutDev.GetMapMode() ), - eSourceMode( MapUnit::Map100thMM ); + const MapMode & eTargetMode( _rOutDev.GetMapMode() ); + MapMode eSourceMode( MapUnit::Map100thMM ); // text width is at least 4 centimeters // text height is always half a centimeter diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 09f9e7e6ebfd..c5befb5497f6 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1912,7 +1912,7 @@ namespace svxform { if (pEntryData == nullptr) return false; - Reference< XPropertySet > xProperties( pEntryData->GetPropertySet() ); + const Reference< XPropertySet >& xProperties( pEntryData->GetPropertySet() ); if (::comphelper::hasProperty(FM_PROP_CLASSID, xProperties)) { Any aClassID = xProperties->getPropertyValue( FM_PROP_CLASSID ); @@ -2002,7 +2002,7 @@ namespace svxform // find and select appropriate SdrObj FmFormView* pFormView = pFormShell->GetFormView(); - Reference< XFormComponent > xFormComponent( pControlData->GetFormComponent()); + const Reference< XFormComponent >& xFormComponent( pControlData->GetFormComponent()); SdrPageView* pPageView = pFormView->GetSdrPageView(); SdrPage* pPage = pPageView->GetPage(); diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx index 0a0e014842f6..4a57171c89eb 100644 --- a/svx/source/form/navigatortreemodel.cxx +++ b/svx/source/form/navigatortreemodel.cxx @@ -456,7 +456,7 @@ namespace svxform // unregister as PropertyChangeListener - Reference< XPropertySet > xSet( pFormData->GetPropertySet() ); + const Reference< XPropertySet >& xSet( pFormData->GetPropertySet() ); if ( xSet.is() ) xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList ); } @@ -471,7 +471,7 @@ namespace svxform // unregister as PropertyChangeListener - Reference< XPropertySet > xSet( pControlData->GetPropertySet() ); + const Reference< XPropertySet >& xSet( pControlData->GetPropertySet() ); if (xSet.is()) xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList); } diff --git a/svx/source/gallery2/galleryfilestorage.cxx b/svx/source/gallery2/galleryfilestorage.cxx index 12aa9d42f7c9..5295492ca3be 100644 --- a/svx/source/gallery2/galleryfilestorage.cxx +++ b/svx/source/gallery2/galleryfilestorage.cxx @@ -499,7 +499,7 @@ SgaObjectBmp GalleryFileStorage::insertGraphic(const Graphic& rGraphic, const Gf if (ConvertDataFormat::SVM == nExportFormat) { - GDIMetaFile aMtf(rGraphic.GetGDIMetaFile()); + const GDIMetaFile& aMtf(rGraphic.GetGDIMetaFile()); SvmWriter aWriter(*pOStm); aWriter.Write(aMtf); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 740429aa6995..28dbbb8268cb 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -983,7 +983,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys(std::vector& rL for (size_t i = 0, nPos = nOldListCount; i < aWSStringsDtor.size(); ++i) { bool bFlag = true; - OUString aInsStr(aWSStringsDtor[i]); + const OUString& aInsStr(aWSStringsDtor[i]); size_t j; for (j = 0; j < aList.size(); ++j) { diff --git a/svx/source/sdr/misc/ImageMapInfo.cxx b/svx/source/sdr/misc/ImageMapInfo.cxx index ac141d253d8b..44e7f0eda6d2 100644 --- a/svx/source/sdr/misc/ImageMapInfo.cxx +++ b/svx/source/sdr/misc/ImageMapInfo.cxx @@ -62,7 +62,7 @@ IMapObject* SvxIMapInfo::GetHitIMapObject(const SdrObject* pObj, const Point& rW if (pCmpWnd) { - MapMode aWndMode = pCmpWnd->GetMapMode(); + const MapMode& aWndMode = pCmpWnd->GetMapMode(); aRelPoint = pCmpWnd->LogicToLogic(rWinPoint, &aWndMode, &aMap100); aRect = pCmpWnd->LogicToLogic(pObj->GetLogicRect(), &aWndMode, &aMap100); } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index bf6cdb7c4571..185f691e3889 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -452,7 +452,7 @@ namespace drawinglayer::primitive2d if(drawing::FillStyle_NONE == eStyle) { - XFillUseSlideBackgroundItem aBckItem(rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); + const XFillUseSlideBackgroundItem& aBckItem(rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); const bool bSlideBackgroundFill(aBckItem.GetValue()); if(bSlideBackgroundFill) diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 03c0d4260d8a..a2eb811c4ffd 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -309,7 +309,7 @@ void BulletsTypeMgr::ReplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uIn SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); sal_UCS4 cChar = aFmt.GetBulletChar(); - std::optional pFont = aFmt.GetBulletFont(); + const std::optional& pFont = aFmt.GetBulletFont(); pActualBullets[nIndex]->cBulletChar = cChar; if ( pFont ) diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx index 9dc3b9118f07..94aad39e9b03 100644 --- a/svx/source/svdraw/sdrhittesthelper.cxx +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -136,7 +136,7 @@ bool ViewObjectContactPrimitiveHit( // get primitive sequence sdr::contact::DisplayInfo aDisplayInfo; // have to make a copy of this container here, because it might be changed underneath us - const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVOC.getPrimitive2DSequence(aDisplayInfo)); + const drawinglayer::primitive2d::Primitive2DContainer& aSequence(rVOC.getPrimitive2DSequence(aDisplayInfo)); if(!aSequence.empty()) { diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 0c8e1c2f74bc..057bf20b9c0e 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1060,7 +1060,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S const basegfx::B2DPolyPolygon aPolyPolygon(pO->TakeXorPoly()); if (aPolyPolygon.count() == 1) { - const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0); + const basegfx::B2DPolygon& aPolygon = aPolyPolygon.getB2DPolygon(0); if (sal_uInt32 nPolySize = aPolygon.count()) { const OutputDevice* pOut = this->GetFirstOutputDevice(); diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 2ad32b32391b..bdf950ad3c6d 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -154,7 +154,7 @@ SdrUnoObj::SdrUnoObj( SdrModel& rSdrModel, SdrUnoObj const & rSource) aUnoControlTypeName = rSource.aUnoControlTypeName; // copy the uno control model - const uno::Reference< awt::XControlModel > xSourceControlModel = rSource.GetUnoControlModel(); + const uno::Reference< awt::XControlModel >& xSourceControlModel = rSource.GetUnoControlModel(); if ( xSourceControlModel.is() ) { try diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 3e8f155eeac4..22b3ab5c406d 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2857,7 +2857,7 @@ bool SvxTableController::PasteObject( SdrTableObj const * pPasteTableObj ) if( !pPasteTableObj ) return false; - rtl::Reference< TableModel > xPasteTable( pPasteTableObj->getUnoTable() ); + const rtl::Reference< TableModel >& xPasteTable( pPasteTableObj->getUnoTable() ); if( !xPasteTable.is() ) return false; diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 7d7babba6618..8daf466983ea 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -193,7 +193,7 @@ namespace sdr::contact bool const isTaggedPDF, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) { - const rtl::Reference< table::TableModel > xTable = rTableObj.getUnoTable(); + const rtl::Reference< table::TableModel >& xTable = rTableObj.getUnoTable(); if(xTable.is()) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index bcce38e0a52b..12dd0f39fff0 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2186,7 +2186,7 @@ ColorWindow::~ColorWindow() NamedColor ColorWindow::GetSelectEntryColor(ValueSet const * pColorSet) { Color aColor = pColorSet->GetItemColor(pColorSet->GetSelectedItemId()); - OUString sColorName = pColorSet->GetItemText(pColorSet->GetSelectedItemId()); + const OUString& sColorName = pColorSet->GetItemText(pColorSet->GetSelectedItemId()); return { aColor, sColorName }; } diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 4607482cc532..54ba90c804eb 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -1071,7 +1071,7 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr case OWN_ATTR_VALUE_GRAPHIC: #if HAVE_FEATURE_AVMEDIA { - Graphic aGraphic = aItem.getGraphic(); + const Graphic& aGraphic = aItem.getGraphic(); if (!aGraphic.IsNone()) { rValue <<= aGraphic.GetXGraphic(); -- cgit v1.2.3