From 789055bc2acb4c71483fd60ea258d158bd5aec10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2016 16:39:03 +0200 Subject: clang-tidy performance-unnecessary-copy-initialization probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sd/source/core/CustomAnimationEffect.cxx | 7 +++---- sd/source/core/drawdoc2.cxx | 5 ++--- sd/source/filter/xml/sdtransform.cxx | 2 +- sd/source/ui/animations/SlideTransitionPane.cxx | 3 +-- sd/source/ui/app/sdmod1.cxx | 8 +++----- sd/source/ui/dlg/navigatr.cxx | 2 +- sd/source/ui/docshell/docshel4.cxx | 13 +++++-------- sd/source/ui/slideshow/slideshow.cxx | 6 ++---- .../ui/slidesorter/controller/SlideSorterController.cxx | 3 +-- sd/source/ui/slidesorter/view/SlideSorterView.cxx | 9 ++++----- sd/source/ui/unoidl/unocpres.cxx | 6 ++---- sd/source/ui/unoidl/unomodel.cxx | 6 ++---- sd/source/ui/unoidl/unoobj.cxx | 8 +++----- sd/source/ui/unoidl/unopage.cxx | 7 +++---- sd/source/ui/view/drviews3.cxx | 5 ++--- sd/source/ui/view/sdview.cxx | 3 +-- 16 files changed, 36 insertions(+), 57 deletions(-) (limited to 'sd') diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 9f3988e9d0b4..a0bbae746b29 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1732,17 +1732,16 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres } // check target, maybe we need to force it to text - Any aTarget( rTarget ); sal_Int16 nSubItem = ShapeAnimationSubType::AS_WHOLE; - if( aTarget.getValueType() == ::cppu::UnoType::get() ) + if( rTarget.getValueType() == ::cppu::UnoType::get() ) { nSubItem = ShapeAnimationSubType::ONLY_TEXT; } else if( pPreset->isTextOnly() ) { Reference< XShape > xShape; - aTarget >>= xShape; + rTarget >>= xShape; if( xShape.is() ) { // thats bad, we target a shape here but the effect is only for text @@ -1754,7 +1753,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres // now create effect from preset pEffect.reset( new CustomAnimationEffect( xNode ) ); pEffect->setEffectSequence( this ); - pEffect->setTarget( aTarget ); + pEffect->setTarget( rTarget ); pEffect->setTargetSubItem( nSubItem ); if( fDuration != -1.0 ) pEffect->setDuration( fDuration ); diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 6587a46f010d..fdc5c8fa229f 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -1368,7 +1368,6 @@ sal_uInt16 SdDrawDocument::InsertPageSet ( SdPage* pPreviousNotesPage; sal_uInt16 nStandardPageNum; sal_uInt16 nNotesPageNum; - OUString aStandardPageName(sStandardPageName); OUString aNotesPageName(sNotesPageName); // Gather some information about the standard page and the notes page @@ -1387,7 +1386,7 @@ sal_uInt16 SdDrawDocument::InsertPageSet ( nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; pPreviousNotesPage = static_cast( GetPage(nStandardPageNum - 1) ); nNotesPageNum = nStandardPageNum + 1; - aNotesPageName = aStandardPageName; + aNotesPageName = sStandardPageName; } OSL_ASSERT(nNotesPageNum==nStandardPageNum+1); @@ -1398,7 +1397,7 @@ sal_uInt16 SdDrawDocument::InsertPageSet ( SetupNewPage ( pPreviousStandardPage, pStandardPage, - aStandardPageName, + sStandardPageName, nInsertPosition, bIsPageBack, bIsPageObj); diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx index f87a333c3882..855e63dcde3a 100644 --- a/sd/source/filter/xml/sdtransform.cxx +++ b/sd/source/filter/xml/sdtransform.cxx @@ -283,7 +283,7 @@ bool SdTransformOOo2xDocument::getBulletState( const SfxItemSet& rSet, sal_uInt1 { if( ( rAttr.GetAttrLName( nItem ) == msEnableNumbering ) && ( rAttr.GetAttrNamespace( nItem ) == msTextNamespace ) ) { - const OUString sValue( rAttr.GetAttrValue( nItem ) ); + const OUString& sValue( rAttr.GetAttrValue( nItem ) ); rState = sValue.equals(msTrue); return true; } diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 3c4017905ccf..fb6057cfc4e0 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -1115,9 +1115,8 @@ IMPL_LINK_NOARG_TYPED(SlideTransitionPane, LateInitCallback, Timer *, void) const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList(); size_t nPresetOffset = 0; - for( const auto& aIter: rPresetList ) + for( const TransitionPresetPtr& pPreset: rPresetList ) { - TransitionPresetPtr pPreset = aIter; const OUString sLabel( pPreset->getSetLabel() ); if( !sLabel.isEmpty() ) { diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index c3606cae3f83..4d45f0a72165 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -567,14 +567,12 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) if( pPilotDlg->GetStartType() == ST_OPEN ) { - OUString aFileToOpen = aDocPath; - - DBG_ASSERT( !aFileToOpen.isEmpty(), "The autopilot should have asked for a file itself already!" ); - if (!aFileToOpen.isEmpty()) + DBG_ASSERT( !aDocPath.isEmpty(), "The autopilot should have asked for a file itself already!" ); + if (!aDocPath.isEmpty()) { css::uno::Sequence< css::beans::NamedValue > aPasswrd( pPilotDlg->GetPassword() ); - SfxStringItem aFile( SID_FILE_NAME, aFileToOpen ); + SfxStringItem aFile( SID_FILE_NAME, aDocPath ); SfxStringItem aReferer( SID_REFERER, OUString()); SfxUnoAnyItem aPassword( SID_ENCRYPTIONDATA, css::uno::makeAny(aPasswrd) ); diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 92c42153758d..bf796ac55d08 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -913,7 +913,7 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId, if( pInfo && pInfo->IsActive() ) { const SfxStringItem& rStateItem = dynamic_cast(*pItem); - OUString aPageName = rStateItem.GetValue(); + const OUString& aPageName = rStateItem.GetValue(); if( !pNavigatorWin->maTlbObjects->HasSelectedChildren( aPageName ) ) { diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index a2552e2ec565..3f74cc3cbfc2 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -678,14 +678,13 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark) sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND; SdrObject* pObj = nullptr; - OUString sBookmark( rBookmark ); const OUString sInteraction( "action?" ); - if ( sBookmark.match( sInteraction ) ) + if ( rBookmark.match( sInteraction ) ) { const OUString sJump( "jump=" ); - if ( sBookmark.match( sJump, sInteraction.getLength() ) ) + if ( rBookmark.match( sJump, sInteraction.getLength() ) ) { - OUString aDestination( sBookmark.copy( sInteraction.getLength() + sJump.getLength() ) ); + OUString aDestination( rBookmark.copy( sInteraction.getLength() + sJump.getLength() ) ); if ( aDestination.match( "firstslide" ) ) { nPageNumber = 1; @@ -711,15 +710,13 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark) } else { - OUString aBookmark( rBookmark ); - // Is the bookmark a page? - nPageNumber = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); + nPageNumber = mpDoc->GetPageByName( rBookmark, bIsMasterPage ); if (nPageNumber == SDRPAGE_NOTFOUND) { // Is the bookmark a object? - pObj = mpDoc->GetObj(aBookmark); + pObj = mpDoc->GetObj(rBookmark); if (pObj) { diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 32b389cfe92a..e879ade7672f 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -321,13 +321,11 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const } case ATTR_PRESENT_CUSTOMSHOW: { - OUString aShow; - if( aValue >>= aShow ) + OUString aShowName; + if( aValue >>= aShowName ) { bIllegalArgument = false; - const OUString aShowName( aShow ); - SdCustomShowList* pCustomShowList = mpDoc->GetCustomShowList(); if(pCustomShowList) { diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 703d0c5fed36..a9f691e35de7 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -864,11 +864,10 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString& if (pChild == nullptr || pChild->GetPage() == nullptr) return; - OUString sOldName (rsOldName); OUString sNewName (pChild->GetPage()->GetName()); pChild->FireAccessibleEvent( css::accessibility::AccessibleEventId::NAME_CHANGED, - makeAny(sOldName), + makeAny(rsOldName), makeAny(sNewName)); } diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index c361dd3a713a..edb97445ae7d 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -815,22 +815,21 @@ bool SlideSorterView::SetState ( const PageDescriptor::State eState, const bool bStateValue) { - model::SharedPageDescriptor pDescriptor (rpDescriptor); - if ( ! pDescriptor) + if ( ! rpDescriptor) return false; - const bool bModified (pDescriptor->SetState(eState, bStateValue)); + const bool bModified (rpDescriptor->SetState(eState, bStateValue)); if ( ! bModified) return false; // When the page object is not visible (i.e. not on the screen then // nothing has to be painted. - if (pDescriptor->HasState(PageDescriptor::ST_Visible)) + if (rpDescriptor->HasState(PageDescriptor::ST_Visible)) { // For most states a change of that state leads to visible // difference and we have to request a repaint. if (eState != PageDescriptor::ST_WasSelected) - RequestRepaint(pDescriptor); + RequestRepaint(rpDescriptor); } return bModified; diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx index 17450372efdd..d7835157dd78 100644 --- a/sd/source/ui/unoidl/unocpres.cxx +++ b/sd/source/ui/unoidl/unocpres.cxx @@ -467,19 +467,17 @@ sal_Bool SAL_CALL SdXCustomPresentationAccess::hasElements() return pList && !pList->empty(); } -SdCustomShow * SdXCustomPresentationAccess::getSdCustomShow( const OUString& Name ) const throw() +SdCustomShow * SdXCustomPresentationAccess::getSdCustomShow( const OUString& rName ) const throw() { sal_uInt32 nIdx = 0; SdCustomShowList* pList = GetCustomShowList(); const sal_uInt32 nCount = pList ? pList->size() : 0; - const OUString aName( Name ); - while( nIdx < nCount ) { SdCustomShow* pShow = (*pList)[nIdx]; - if( pShow->GetName() == aName ) + if( pShow->GetName() == rName ) return pShow; nIdx++; } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 9380a183852c..449b54a1a60b 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3370,15 +3370,13 @@ SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw(std::exc sal_uInt16 nPage; SdPage* pPage; - const OUString aName( rName ); - const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW; // standard pages for( nPage = 0; nPage < nMaxPages; nPage++ ) { pPage = static_cast(mpDoc->GetPage( nPage )); - if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) + if( (pPage->GetName() == rName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) return pPage; } @@ -3386,7 +3384,7 @@ SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw(std::exc for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) { pPage = static_cast(mpDoc->GetMasterPage( nPage )); - if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) + if( (pPage->GetName() == rName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) return pPage; } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index ff0768d2ed9b..9267fd83d6f4 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1421,11 +1421,9 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno } else { - OUString aMacro = aStrMacro; - - OUString aLibName = aMacro.getToken(0, '.'); - OUString aModulName = aMacro.getToken(1, '.'); - OUString aMacroName = aMacro.getToken(2, '.'); + OUString aLibName = aStrMacro.getToken(0, '.'); + OUString aModulName = aStrMacro.getToken(1, '.'); + OUString aMacroName = aStrMacro.getToken(2, '.'); OUStringBuffer sBuffer; sBuffer.append( aMacroName ); diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 83826053ddbe..d09b0566a853 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -3057,16 +3057,15 @@ void SAL_CALL SdMasterPage::setName( const OUString& rName ) { SdDrawDocument* pDoc = GetModel()->GetDoc(); bool bOutDummy; - OUString aNewName( rName ); // Slide Name has to be unique - if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND ) + if( pDoc && pDoc->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND ) return; // throw Exception ? - GetPage()->SetName( aNewName ); + GetPage()->SetName( rName ); if( pDoc ) - pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName ); + pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName ); // fake a mode change to repaint the page tab bar ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index bfe2c56465a7..6da4626265d7 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -829,9 +829,8 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) if( rFormat != aFormat ) { // put all items - SvxNumBulletItem aNumBulletItem(rNumBulletItem); - aNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat); - aEditAttr.Put( aNumBulletItem ); + rNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat); + aEditAttr.Put( rNumBulletItem ); aEditAttr.Put( aLRSpaceItem ); mpDrawView->SetAttributes( aEditAttr ); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index c569d19bee33..d10826382acb 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -400,7 +400,6 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected : (aTranslate.getY() + aScale.getY()) - fVerDist); // get font attributes; use normally scaled font - const basegfx::BColor aFontColor(aRGBColor); vcl::Font aVclFont; basegfx::B2DVector aTextSizeAttribute; @@ -436,7 +435,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected aDXArray, aFontAttribute, aLocale, - aFontColor)); + aRGBColor)); xRetval.push_back(xRef); } } -- cgit