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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-11-11 22:05:22 +02:00
parent 2c3fc08d11
commit 65d52af42f
24 changed files with 29 additions and 29 deletions

View file

@ -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

View file

@ -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))

View file

@ -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());

View file

@ -1137,7 +1137,7 @@ std::shared_ptr<ExpressionNode> 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 );

View file

@ -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)
{

View file

@ -41,7 +41,7 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const & rReq,
const GraphicObject& rInputObject,
const std::function<void(const Graphic&)>& f)
{
Graphic aInputGraphic = rInputObject.GetGraphic();
const Graphic& aInputGraphic = rInputObject.GetGraphic();
if( aInputGraphic.GetType() != GraphicType::Bitmap )
return;

View file

@ -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;

View file

@ -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());

View file

@ -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() )
{

View file

@ -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

View file

@ -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();

View file

@ -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);
}

View file

@ -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);

View file

@ -983,7 +983,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys(std::vector<OUString>& 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)
{

View file

@ -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);
}

View file

@ -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)

View file

@ -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<vcl::Font> pFont = aFmt.GetBulletFont();
const std::optional<vcl::Font>& pFont = aFmt.GetBulletFont();
pActualBullets[nIndex]->cBulletChar = cChar;
if ( pFont )

View file

@ -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())
{

View file

@ -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();

View file

@ -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

View file

@ -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;

View file

@ -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())
{

View file

@ -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 };
}

View file

@ -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();