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 --- svx/source/core/extedit.cxx | 2 +- svx/source/core/graphichelper.cxx | 3 +-- svx/source/dialog/fntctrl.cxx | 4 ++-- svx/source/engine3d/dragmt3d.cxx | 10 +++++----- svx/source/engine3d/helperhittest3d.cxx | 2 +- svx/source/engine3d/helperminimaldepth3d.cxx | 2 +- svx/source/engine3d/obj3d.cxx | 4 ++-- svx/source/engine3d/scene3d.cxx | 2 +- svx/source/engine3d/view3d.cxx | 5 ----- svx/source/fmcomp/dbaexchange.cxx | 3 +-- svx/source/fmcomp/fmgridif.cxx | 5 ++--- svx/source/form/navigatortree.cxx | 2 +- svx/source/gallery2/galbrws1.cxx | 3 +-- svx/source/gallery2/galbrws2.cxx | 2 +- svx/source/gallery2/gallery1.cxx | 4 +--- svx/source/gallery2/galmisc.cxx | 8 ++++---- svx/source/gallery2/galtheme.cxx | 3 +-- svx/source/sdr/contact/viewcontactofe3dscene.cxx | 6 +++--- .../sdr/contact/viewobjectcontactofunocontrol.cxx | 6 +++--- svx/source/svdraw/svdedtv1.cxx | 5 ++--- svx/source/svdraw/svdmodel.cxx | 2 +- svx/source/svdraw/svdoashp.cxx | 17 +++++++---------- svx/source/svdraw/svdomedia.cxx | 2 +- svx/source/svdraw/svdtrans.cxx | 2 +- svx/source/tbxctrls/PaletteManager.cxx | 2 +- svx/source/tbxctrls/lboxctrl.cxx | 2 +- svx/source/tbxctrls/tbunocontroller.cxx | 3 +-- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 9 +++------ svx/source/unodraw/UnoGraphicExporter.cxx | 6 ++---- svx/source/unodraw/unomod.cxx | 5 ++--- svx/source/unodraw/unomtabl.cxx | 22 +++++++++------------- svx/source/unodraw/unoshape.cxx | 3 +-- svx/source/xml/xmlgrhlp.cxx | 16 +++++++--------- svx/source/xoutdev/_xoutbmp.cxx | 2 +- 34 files changed, 72 insertions(+), 102 deletions(-) (limited to 'svx') diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx index 1267671a9e0f..d3b16b65a356 100644 --- a/svx/source/core/extedit.cxx +++ b/svx/source/core/extedit.cxx @@ -103,7 +103,7 @@ void ExternalToolEditThread::execute() void ExternalToolEdit::Edit(GraphicObject const*const pGraphicObject) { //Get the graphic from the GraphicObject - const Graphic aGraphic = pGraphicObject->GetGraphic(); + const Graphic& aGraphic = pGraphicObject->GetGraphic(); //get the Preferred File Extension for this graphic OUString fExtension; diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 954766e30a2f..abfbaa01995e 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -105,12 +105,11 @@ OUString GraphicHelper::ExportGraphic( const Graphic& rGraphic, const OUString& aPath.SetSmartURL( sGraphicsPath ); // fish out the graphic's name - OUString aName = rGraphicName; aDialogHelper.SetTitle( SVX_RESSTR(RID_SVXSTR_EXPORT_GRAPHIC_TITLE)); aDialogHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) ); INetURLObject aURL; - aURL.SetSmartURL( aName ); + aURL.SetSmartURL( rGraphicName ); aDialogHelper.SetFileName( aURL.GetName() ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 3a451f40169b..897fe70532ef 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -945,7 +945,7 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack if( GetWhich( rSet, SID_CHAR_DLG_PREVIEW_STRING, nWhich ) ) { const SfxStringItem& rItem = static_cast( rSet.Get( nWhich ) ); - OUString aString = rItem.GetValue(); + const OUString& aString = rItem.GetValue(); if( !aString.isEmpty() ) SetPreviewText( aString ); else @@ -1180,7 +1180,7 @@ void SvxFontPrevWindow::Init(const SfxItemSet& rSet) if (ISITEMSET) { const SfxStringItem& rItem = static_cast( rSet.Get( nWhich ) ); - OUString aString = rItem.GetValue(); + const OUString& aString = rItem.GetValue(); if( !aString.isEmpty() ) SetPreviewText( aString ); else diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 1f6150ada67d..6083bd7441b4 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -226,7 +226,7 @@ void E3dDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(nPlyCnt) { const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation()); const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform); @@ -267,7 +267,7 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView, if(pScene) { const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) { @@ -389,7 +389,7 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) // Transformation in eye coordinates, there rotate then and back const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); aInverseOrientation.invert(); @@ -506,7 +506,7 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) { E3dDragMethodUnit& rCandidate = maGrp[nOb]; const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); // move coor from 2d world to 3d Eye basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y())); @@ -580,7 +580,7 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) // transform from 2D world view to 3D eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y())); basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y())); diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 62bcafb99971..d0f1376fc719 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -133,7 +133,7 @@ E3dScene* fillViewInformation3DForCompoundObject(drawinglayer::geometry::ViewInf else { // build new ViewInformation containing all transforms for the candidate - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D( aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix, diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index 19db8ee885f4..acc655f2cbf1 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -161,7 +161,7 @@ double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject) { // get ViewInformation3D from scene using VC const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); // the scene's object transformation is already part of aViewInfo3D.getObjectTransformation() // for historical reasons (see ViewContactOfE3dScene::createViewInformation3D for more info) diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 91fa02ca747a..4777944069e0 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -333,7 +333,7 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti { // transform pos from 2D world to 3D eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y()); basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); @@ -395,7 +395,7 @@ void E3dObject::NbcMove(const Size& rSize) // BoundVolume from 3d world to 3d eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); basegfx::B3DRange aEyeVol(pScene->GetBoundVolume()); aEyeVol.transform(aViewInfo3D.getOrientation()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 869c0d5b26ff..8075e70fe6a7 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -237,7 +237,7 @@ E3dScene::~E3dScene() basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const { const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe()); basegfx::B2DPolyPolygon aRetval(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon, diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 7eac614b28be..9deb51d57111 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -501,11 +501,6 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDs if(pSrcScene && pDstScene) { - const sdr::contact::ViewContactOfE3dScene& rVCSceneDst = static_cast< sdr::contact::ViewContactOfE3dScene& >(pDstScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3DDst(rVCSceneDst.getViewInformation3D()); - const sdr::contact::ViewContactOfE3dScene& rVCSceneSrc = static_cast< sdr::contact::ViewContactOfE3dScene& >(pSrcScene->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D aViewInfo3DSrc(rVCSceneSrc.getViewInformation3D()); - for(size_t i = 0; i < pSrcScene->GetSubList()->GetObjCount(); ++i) { E3dCompoundObject* pCompoundObj = dynamic_cast< E3dCompoundObject* >(pSrcScene->GetSubList()->GetObj(i)); diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index bd7ba5a4ec05..d166af11b394 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -568,7 +568,6 @@ namespace svx // extract the single values from the sequence OUString sObjectName; - OUString sDatasourceName = _rDatasource; sObjectName = _rCommand; // for compatibility: create a string which can be used for the SotClipboardFormatId::SBA_DATAEXCHANGE format @@ -583,7 +582,7 @@ namespace svx const sal_Unicode cQueryMark = '0'; // build the descriptor string - m_sCompatibleObjectDescription += sDatasourceName; + m_sCompatibleObjectDescription += _rDatasource; m_sCompatibleObjectDescription += sSeparator; m_sCompatibleObjectDescription += bTreatAsStatement ? OUString() : sObjectName; m_sCompatibleObjectDescription += sSeparator; diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 299c7331f4ad..91846cf73e1a 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1714,10 +1714,9 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount())) return; - Reference< XPropertySet > xSet(evt.Element, css::uno::UNO_QUERY); - addColumnListeners(xSet); + Reference< XPropertySet > xNewColumn(evt.Element, css::uno::UNO_QUERY); + addColumnListeners(xNewColumn); - Reference< XPropertySet > xNewColumn(xSet); OUString aName = ::comphelper::getString(xNewColumn->getPropertyValue(FM_PROP_LABEL)); Any aWidth = xNewColumn->getPropertyValue(FM_PROP_WIDTH); sal_Int32 nWidth = 0; diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 854289b31cec..f95131ffc442 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -960,7 +960,7 @@ namespace svxform // because i want to select all targets (and only them) SelectAll(false); - Sequence< Reference< XInterface > > aControls = _rData.hiddenControls(); + const Sequence< Reference< XInterface > >& aControls = _rData.hiddenControls(); sal_Int32 nCount = aControls.getLength(); const Reference< XInterface >* pControls = aControls.getConstArray(); diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 610ac8eb87f6..b193f7f1fc5c 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -290,7 +290,6 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(Dialog* pDialog, bool bCreat if( !mpExchangeData->aEditedTitle.isEmpty() && aName != mpExchangeData->aEditedTitle ) { - const OUString aOldName( aName ); OUString aTitle( mpExchangeData->aEditedTitle ); sal_uInt16 nCount = 0; @@ -301,7 +300,7 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(Dialog* pDialog, bool bCreat aTitle += OUString::number( nCount ); } - mpGallery->RenameTheme( aOldName, aTitle ); + mpGallery->RenameTheme( aName, aTitle ); } if ( bCreateNew ) diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index fecc083650bc..d9e7ca056dba 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -1239,7 +1239,7 @@ OUString GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObje { OUString aRet; - INetURLObject aURL(rObj.GetURL()); + const INetURLObject& aURL(rObj.GetURL()); if( nItemTextFlags & GALLERY_ITEM_THEMENAME ) { diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 94e51e36e81e..f86971271b8d 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -532,12 +532,10 @@ void Gallery::RenameTheme( const OUString& rOldName, const OUString& rNewName ) if( pThm ) { - const OUString aOldName( rOldName ); - pThemeEntry->SetName( rNewName ); pThm->ImplWrite(); - Broadcast( GalleryHint( GalleryHintType::THEME_RENAMED, aOldName, pThm->GetName() ) ); + Broadcast( GalleryHint( GalleryHintType::THEME_RENAMED, rOldName, pThm->GetName() ) ); ReleaseTheme( pThm, aListener ); } } diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index e9ebccda2bd3..8b6d25c51f10 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -273,16 +273,16 @@ bool CreateDir( const INetURLObject& rURL ) try { uno::Reference< ucb::XCommandEnvironment > aCmdEnv; - INetURLObject aNewFolderURL( rURL ); - INetURLObject aParentURL( aNewFolderURL ); aParentURL.removeSegment(); + INetURLObject aParentURL( rURL ); + aParentURL.removeSegment(); ::ucbhelper::Content aParent( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() ); uno::Sequence< OUString > aProps( 1 ); uno::Sequence< uno::Any > aValues( 1 ); aProps[0] = "Title"; - aValues[0] = uno::makeAny( OUString( aNewFolderURL.GetName() ) ); + aValues[0] = uno::makeAny( OUString( rURL.GetName() ) ); - ::ucbhelper::Content aContent( aNewFolderURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() ); + ::ucbhelper::Content aContent( rURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() ); bRet = aParent.insertNewContent( "application/vnd.sun.staroffice.fsys-folder", aProps, aValues, aContent ); } catch( const ucb::ContentCreationException& ) diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index a9e1acacac0f..795134c3b027 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -743,8 +743,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, bo } } - INetURLObject aPathURL( rURL ); - pRet = new GalleryThemeEntry( false, aPathURL, aThemeName, + pRet = new GalleryThemeEntry( false, rURL, aThemeName, bReadOnly, false, nThemeId, bThemeNameFromResource ); } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 3f6206d8a8ad..902cf3a0782b 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -174,9 +174,9 @@ void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rCo { // calculate orientation from VRP, VPN and VUV const B3dCamera& rSceneCamera = GetE3dScene().GetCameraSet(); - const basegfx::B3DPoint aVRP(rSceneCamera.GetVRP()); - const basegfx::B3DVector aVPN(rSceneCamera.GetVPN()); - const basegfx::B3DVector aVUV(rSceneCamera.GetVUV()); + const basegfx::B3DPoint& aVRP(rSceneCamera.GetVRP()); + const basegfx::B3DVector& aVPN(rSceneCamera.GetVPN()); + const basegfx::B3DVector& aVUV(rSceneCamera.GetVUV()); aOrientation.orientation(aVRP, aVPN, aVUV); } diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 9565e59053c9..baaf6ae6798e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -856,7 +856,7 @@ namespace sdr { namespace contact { #endif ::basegfx::B2DHomMatrix aScaleNormalization; - MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); + const MapMode& aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() ); m_aZoomLevelNormalization *= aScaleNormalization; @@ -1090,7 +1090,7 @@ namespace sdr { namespace contact { { _out_rControl.clear(); - Reference< XControlModel > xControlModel( _rUnoObject.GetUnoControlModel() ); + const Reference< XControlModel >& xControlModel( _rUnoObject.GetUnoControlModel() ); DBG_ASSERT( xControlModel.is(), "ViewObjectContactOfUnoControl_Impl::createControlForDevice: no control model at the SdrUnoObject!?" ); if ( !xControlModel.is() ) return false; @@ -1098,7 +1098,7 @@ namespace sdr { namespace contact { bool bSuccess = false; try { - const OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); + const OUString& sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); _out_rControl = Reference( xContext->getServiceManager()->createInstanceWithContext(sControlServiceName, xContext), UNO_QUERY_THROW ); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 47544bb0d3fd..38d52217aff5 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -680,15 +680,14 @@ void SdrEditView::DistortMarkedObj(const Rectangle& rRef, const XPolygon& rDisto AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); Rectangle aRefRect(rRef); - XPolygon aRefPoly(rDistortedRect); const SdrObjList* pOL=pO->GetSubList(); if (bNoContortion || pOL==nullptr) { - ImpDistortObj(pO,aRefRect,aRefPoly,bNoContortion); + ImpDistortObj(pO,aRefRect,rDistortedRect,bNoContortion); } else { SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS); while (aIter.IsMore()) { SdrObject* pO1=aIter.Next(); - ImpDistortObj(pO1,aRefRect,aRefPoly,bNoContortion); + ImpDistortObj(pO1,aRefRect,rDistortedRect,bNoContortion); } } } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 2511e5dd7a68..ffa16dc62dc5 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -1313,7 +1313,7 @@ void SdrModel::TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars, sal_I // if necessary, add separators before every third digit if( nVorKomma > 3 ) { - OUString aThoSep( rLoc.getNumThousandSep() ); + const OUString& aThoSep( rLoc.getNumThousandSep() ); if ( !aThoSep.isEmpty() ) { sal_Unicode cTho( aThoSep[0] ); diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 8b6bd6492246..d21cd0b10813 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1557,25 +1557,22 @@ void SdrObjCustomShape::Resize( const Point& rRef, const Fraction& xFact, const void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact ) { - Fraction xFact( rxFact ); - Fraction yFact( ryFact ); - // taking care of handles that should not been changed Rectangle aOld( maRect ); std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() ); - SdrTextObj::NbcResize( rRef, xFact, yFact ); + SdrTextObj::NbcResize( rRef, rxFact, ryFact ); - if ( ( xFact.GetNumerator() != xFact.GetDenominator() ) - || ( yFact.GetNumerator()!= yFact.GetDenominator() ) ) + if ( ( rxFact.GetNumerator() != rxFact.GetDenominator() ) + || ( ryFact.GetNumerator()!= ryFact.GetDenominator() ) ) { - if ( ( ( xFact.GetNumerator() < 0 ) && ( xFact.GetDenominator() > 0 ) ) || - ( ( xFact.GetNumerator() > 0 ) && ( xFact.GetDenominator() < 0 ) ) ) + if ( ( ( rxFact.GetNumerator() < 0 ) && ( rxFact.GetDenominator() > 0 ) ) || + ( ( rxFact.GetNumerator() > 0 ) && ( rxFact.GetDenominator() < 0 ) ) ) { SetMirroredX( !IsMirroredX() ); } - if ( ( ( yFact.GetNumerator() < 0 ) && ( yFact.GetDenominator() > 0 ) ) || - ( ( yFact.GetNumerator() > 0 ) && ( yFact.GetDenominator() < 0 ) ) ) + if ( ( ( ryFact.GetNumerator() < 0 ) && ( ryFact.GetDenominator() > 0 ) ) || + ( ( ryFact.GetNumerator() > 0 ) && ( ryFact.GetDenominator() < 0 ) ) ) { SetMirroredY( !IsMirroredY() ); } diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 2f36bfd460a2..ada1c4aaa57f 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -425,7 +425,7 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper ( rNewProperties.getURL() != getURL() )) { m_xImpl->m_xCachedSnapshot.clear(); - OUString const url(rNewProperties.getURL()); + OUString const& url(rNewProperties.getURL()); if (url.startsWithIgnoreAsciiCase("vnd.sun.star.Package:")) { if ( !m_xImpl->m_pTempFile diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx index c14ede928427..414de974842b 100644 --- a/svx/source/svdraw/svdtrans.cxx +++ b/svx/source/svdraw/svdtrans.cxx @@ -853,7 +853,7 @@ void SdrFormatter::TakeStr(long nVal, OUString& rStr) const // add in thousands separator (if necessary) if( nForComma > 3 ) { - OUString aThoSep( rLoc.getNumThousandSep() ); + const OUString& aThoSep( rLoc.getNumThousandSep() ); if ( aThoSep.getLength() > 0 ) { sal_Unicode cTho( aThoSep[0] ); diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 535134f344de..4acf2e469be0 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -227,7 +227,7 @@ void PaletteManager::SetColorSelectFunction(const std::function(pState); ToolBox& rBox = GetToolBox(); - OUString aQuickHelpText = rItem.GetValue(); + const OUString& aQuickHelpText = rItem.GetValue(); rBox.SetQuickHelpText( GetId(), aQuickHelpText ); } SvxListBoxControl::StateChanged( nSID, eState, pState ); diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 692cefdfebdc..f0e32a7af069 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -380,11 +380,10 @@ throw (css::uno::RuntimeException, std::exception) } uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWindow( - const uno::Reference< awt::XWindow >& Parent ) + const uno::Reference< awt::XWindow >& xParent ) throw (css::uno::RuntimeException, std::exception) { uno::Reference< awt::XWindow > xItemWindow; - uno::Reference< awt::XWindow > xParent( Parent ); vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent ); if ( pParent ) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index cec62ab16da9..f050ca6487e7 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -465,11 +465,10 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } -css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) +css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) throw ( css::uno::RuntimeException, std::exception ) { css::uno::Reference< css::awt::XWindow > xItemWindow; - css::uno::Reference< css::awt::XWindow > xParent( Parent ); vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent ); if ( pParent ) { @@ -684,11 +683,10 @@ void SAL_CALL MatchCaseToolboxController::initialize( const css::uno::Sequence< SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } -css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) +css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) throw ( css::uno::RuntimeException, std::exception ) { css::uno::Reference< css::awt::XWindow > xItemWindow; - css::uno::Reference< css::awt::XWindow > xParent( Parent ); vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent ); if ( pParent ) { @@ -777,11 +775,10 @@ void SAL_CALL SearchFormattedToolboxController::initialize( const css::uno::Sequ SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } -css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) +css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) throw ( css::uno::RuntimeException, std::exception ) { css::uno::Reference< css::awt::XWindow > xItemWindow; - css::uno::Reference< css::awt::XWindow > xParent( Parent ); vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent ); if ( pParent ) { diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index e6b74d32cdda..735c6a5de16e 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1216,16 +1216,14 @@ Sequence< OUString > SAL_CALL GraphicExporter::getSupportedServiceNames( ) } // XMimeTypeInfo -sal_Bool SAL_CALL GraphicExporter::supportsMimeType( const OUString& MimeTypeName ) throw (RuntimeException, std::exception) +sal_Bool SAL_CALL GraphicExporter::supportsMimeType( const OUString& rMimeTypeName ) throw (RuntimeException, std::exception) { - const OUString aMimeTypeName( MimeTypeName ); - GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); sal_uInt16 nCount = rFilter.GetExportFormatCount(); sal_uInt16 nFilter; for( nFilter = 0; nFilter < nCount; nFilter++ ) { - if( aMimeTypeName == rFilter.GetExportFormatMediaType( nFilter ) ) + if( rMimeTypeName == rFilter.GetExportFormatMediaType( nFilter ) ) { return sal_True; } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 456ae108c559..7aa925377f91 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -418,14 +418,13 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c uno::Reference< uno::XInterface > xRet; - const OUString aType( aServiceSpecifier ); const OUString aPackagePrefix( "com.sun.star.presentation." ); - if( aType.startsWith( aPackagePrefix ) ) + if( aServiceSpecifier.startsWith( aPackagePrefix ) ) { SvxShape* pShape = nullptr; sal_uInt16 nType = OBJ_TEXT; - OUString aTypeName = aType.copy( aPackagePrefix.getLength() ); + OUString aTypeName = aServiceSpecifier.copy( aPackagePrefix.getLength() ); // create a shape wrapper if( aTypeName.startsWith("TitleTextShape") ) { diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index aea0bd644884..70997655e0f6 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -191,17 +191,15 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName ) return; } - OUString Name = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); + OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - const OUString aSearchName( Name ); - while( aIter != aEnd ) { const NameOrIndex *pItem = static_cast(&((*aIter)->Get( XATTR_LINEEND ) )); - if( pItem->GetName() == aSearchName ) + if( pItem->GetName() == aName ) { delete (*aIter); maItemSetVector.erase( aIter ); @@ -210,7 +208,7 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName ) ++aIter; } - if( !hasByName( Name ) ) + if( !hasByName( aName ) ) throw container::NoSuchElementException(); } @@ -220,27 +218,25 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const { SolarMutexGuard aGuard; - OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); + const OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - const OUString aSearchName( aName ); - while( aIter != aEnd ) { const NameOrIndex *pItem = static_cast(&((*aIter)->Get( XATTR_LINEEND ) )); - if( pItem->GetName() == aSearchName ) + if( pItem->GetName() == aName ) { XLineEndItem aEndMarker; - aEndMarker.SetName( aSearchName ); + aEndMarker.SetName( aName ); if( !aEndMarker.PutValue( aElement, 0 ) ) throw lang::IllegalArgumentException(); (*aIter)->Put( aEndMarker, XATTR_LINEEND ); XLineStartItem aStartMarker; - aStartMarker.SetName( aSearchName ); + aStartMarker.SetName( aName ); aStartMarker.PutValue( aElement, 0 ); (*aIter)->Put( aStartMarker, XATTR_LINESTART ); @@ -257,7 +253,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { NameOrIndex *pItem = const_cast(static_cast(mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate))); - if( pItem && pItem->GetName() == aSearchName ) + if( pItem && pItem->GetName() == aName ) { pItem->PutValue( aElement, 0 ); bFound = true; @@ -269,7 +265,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { NameOrIndex *pItem = const_cast(static_cast(mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate))); - if( pItem && pItem->GetName() == aSearchName ) + if( pItem && pItem->GetName() == aName ) { pItem->PutValue( aElement, 0 ); bFound = true; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 5df66bbd6469..51cfdcae1f7c 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1577,13 +1577,12 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, const SfxItemPool* pPool = rSet.GetPool(); - const OUString aSearchName( aName ); const sal_uInt32 nCount = pPool->GetItemCount2((sal_uInt16)nWID); for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { const NameOrIndex* pItem = static_cast(pPool->GetItem2((sal_uInt16)nWID, nSurrogate)); - if( pItem && ( pItem->GetName() == aSearchName ) ) + if( pItem && ( pItem->GetName() == aName ) ) { rSet.Put( *pItem ); return true; diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 25299ca7c9dc..7afceb1fe8b2 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -622,20 +622,19 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt32 nInsertPos, OUString& rRequestedFileName ) { - OUString aURLString( rURLStr ); OUString aPictureStorageName, aPictureStreamName; - if( ( maURLSet.find( aURLString ) != maURLSet.end() ) ) + if( ( maURLSet.find( rURLStr ) != maURLSet.end() ) ) { for (URLPairVector::const_iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() ); aIter != aEnd ; ++aIter) { - if( aURLString == (*aIter).first ) + if( rURLStr == (*aIter).first ) { maGrfURLs[ nInsertPos ].second = (*aIter).second; break; } } } - else if( ImplGetStreamNames( aURLString, aPictureStorageName, aPictureStreamName ) ) + else if( ImplGetStreamNames( rURLStr, aPictureStorageName, aPictureStreamName ) ) { URLPair& rURLPair = maGrfURLs[ nInsertPos ]; @@ -657,12 +656,11 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt } else { - const OUString aGraphicObjectId( aPictureStreamName ); - const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US)); + const OString aAsciiObjectID(OUStringToOString(aPictureStreamName, RTL_TEXTENCODING_ASCII_US)); const GraphicObject aGrfObject( aAsciiObjectID ); if( aGrfObject.GetType() != GRAPHIC_NONE ) { - OUString aStreamName( aGraphicObjectId ); + OUString aStreamName( aPictureStreamName ); Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); const GfxLink aGfxLink( aGraphic.GetLink() ); OUString aExtension; @@ -744,7 +742,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt aStreamName += aExtension; if( mbDirect && !aStreamName.isEmpty() ) - ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId, bUseGfxLink ); + ImplWriteGraphic( aPictureStorageName, aStreamName, aPictureStreamName, bUseGfxLink ); rURLPair.second = sPictures; rURLPair.second += aStreamName; @@ -760,7 +758,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt #endif } - maURLSet.insert( aURLString ); + maURLSet.insert( rURLStr ); } } diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 923d67babfe6..0e7aeceef7e8 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -145,7 +145,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam } // #i121128# use shortcut to write SVG data in original form (if possible) - const SvgDataPtr aSvgDataPtr(rGraphic.getSvgData()); + const SvgDataPtr& aSvgDataPtr(rGraphic.getSvgData()); if(aSvgDataPtr.get() && aSvgDataPtr->getSvgDataArrayLength() -- cgit