[Libreoffice-commits] core.git: basctl/source basegfx/source basic/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 23 06:39:34 UTC 2018


 basctl/source/accessibility/accessibledialogwindow.cxx |    2 
 basctl/source/basicide/basicbox.cxx                    |    4 -
 basctl/source/basicide/baside2b.cxx                    |    3 -
 basctl/source/basicide/baside3.cxx                     |    2 
 basctl/source/basicide/basides1.cxx                    |    8 +--
 basctl/source/basicide/basobj3.cxx                     |    6 +-
 basctl/source/basicide/bastype2.cxx                    |   22 +++++-----
 basctl/source/basicide/bastype3.cxx                    |   14 +++---
 basctl/source/basicide/macrodlg.cxx                    |   24 +++++------
 basctl/source/basicide/moduldl2.cxx                    |    6 +-
 basctl/source/basicide/moduldlg.cxx                    |   36 ++++++++---------
 basctl/source/dlged/managelang.cxx                     |    2 
 basegfx/source/polygon/b2dpolygoncutandtouch.cxx       |    2 
 basegfx/source/polygon/b2dpolygontools.cxx             |    2 
 basegfx/source/polygon/b2dpolygontriangulator.cxx      |    4 -
 basegfx/source/polygon/b2dpolypolygoncutter.cxx        |   18 ++++----
 basegfx/source/polygon/b2dsvgpolypolygon.cxx           |    2 
 basegfx/source/polygon/b3dpolypolygontools.cxx         |    6 +-
 basic/source/classes/image.cxx                         |    2 
 basic/source/classes/sb.cxx                            |    2 
 basic/source/classes/sbunoobj.cxx                      |   18 ++++----
 basic/source/runtime/methods.cxx                       |   24 +++++------
 basic/source/runtime/methods1.cxx                      |   10 ++--
 basic/source/runtime/runtime.cxx                       |    2 
 24 files changed, 110 insertions(+), 111 deletions(-)

New commits:
commit 44688e498c9672f0a1759ead394f6d6e0f0ef5fd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 23 07:36:33 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 23 08:39:10 2018 +0200

    clang-tidy performance-unnecessary-copy-initialization in
    
    basctl..basic
    
    Change-Id: I4009282869cd8a2f269093564bd4fafccab80ec3
    Reviewed-on: https://gerrit.libreoffice.org/62212
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index 177c79a8eed0..3c5987a2cb28 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -180,7 +180,7 @@ bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc )
             const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
             if ( pSdrLayer )
             {
-                OUString aLayerName = pSdrLayer->GetName();
+                const OUString& aLayerName = pSdrLayer->GetName();
                 SdrView& rView = m_pDialogWindow->GetView();
                 if (rView.IsLayerVisible(aLayerName))
                 {
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index dd5eb2f36fdf..15fa69537a74 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -300,9 +300,9 @@ void LibBox::NotifyIDE()
     sal_Int32 nSelPos = GetSelectedEntryPos();
     if (LibEntry* pEntry = static_cast<LibEntry*>(GetEntryData(nSelPos)))
     {
-        ScriptDocument aDocument( pEntry->GetDocument() );
+        const ScriptDocument& aDocument( pEntry->GetDocument() );
         SfxUnoAnyItem aDocumentItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, uno::Any( aDocument.getDocumentOrNull() ) );
-        OUString aLibName = pEntry->GetLibName();
+        const OUString& aLibName = pEntry->GetLibName();
         SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
         if (SfxDispatcher* pDispatcher = GetDispatcher())
             pDispatcher->ExecuteList(
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 627c62eb0ec9..bc0e4c3b7ba1 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2485,8 +2485,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                             for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ )
                             {
                                 SbxVariable* pVar_ = pProps->Get( i );
-                                OUString aName( pVar_->GetName() );
-                                if( pItem->maMemberList[i] != aName )
+                                if( pItem->maMemberList[i] != pVar_->GetName() )
                                 {
                                     bObjChanged = true;
                                     break;
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 1e216698d1d9..8a88185516b7 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -983,7 +983,7 @@ bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const Script
                 bool bCopyResourcesForDialog = true;
                 if( bAddDialogLanguagesToLib )
                 {
-                    std::shared_ptr<LocalizationMgr> pCurMgr = pShell->GetCurLocalizationMgr();
+                    const std::shared_ptr<LocalizationMgr>& pCurMgr = pShell->GetCurLocalizationMgr();
 
                     lang::Locale aFirstLocale;
                     aFirstLocale = aOnlyInImportLanguages[0];
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 007269ec71ad..1159777d9037 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -416,7 +416,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
                     bool bRenameOk = false;
                     if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin.get()))
                     {
-                        OUString aLibName = pModWin->GetLibName();
+                        const OUString& aLibName = pModWin->GetLibName();
                         ScriptDocument aDocument( pWin->GetDocument() );
 
                         if (RenameModule(pModWin->GetFrameWeld(), aDocument, aLibName, aOldName, aNewName))
@@ -625,7 +625,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             const SfxStringItem* pDocumentItem = rReq.GetArg<SfxStringItem>(SID_BASICIDE_ARG_DOCUMENT);
             if ( pDocumentItem )
             {
-                OUString sDocumentCaption = pDocumentItem->GetValue();
+                const OUString& sDocumentCaption = pDocumentItem->GetValue();
                 if ( !sDocumentCaption.isEmpty() )
                     pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) );
             }
@@ -651,7 +651,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_BASICIDE_ARG_NAME);
             if ( pNameItem )
             {
-                OUString aName( pNameItem->GetValue() );
+                const OUString& aName( pNameItem->GetValue() );
                 OUString aModType( "Module" );
                 OUString aType( aModType );
                 const SfxStringItem* pTypeItem = rReq.GetArg<SfxStringItem>(SID_BASICIDE_ARG_TYPE);
@@ -1297,7 +1297,7 @@ VclPtr<ModulWindow> Shell::ShowActiveModuleWindow( StarBASIC const * pBasic )
             if (BasicManager* pBasMgr = FindBasicManager(pLib))
             {
                 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
-                OUString aLibName = pLib->GetName();
+                const OUString& aLibName = pLib->GetName();
                 pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), true );
                 DBG_ASSERT( pWin, "Error/Step-Hdl: Window was not created/found!" );
                 SetCurLib( aDocument, aLibName );
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 3ac49d89e2aa..4b4391bbcf95 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -110,8 +110,8 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName )
 
     if (aDocument.isValid())
     {
-        OUString aLibName = pBasic->GetName();
-        OUString aModName = pModule->GetName();
+        const OUString& aLibName = pBasic->GetName();
+        const OUString& aModName = pModule->GetName();
         OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aOUSource ) );
     }
 
@@ -378,7 +378,7 @@ long HandleBasicError( StarBASIC const * pBasic )
             OSL_ENSURE( aDocument.isValid(), "basctl::HandleBasicError: no document for the given BasicManager!" );
             if ( aDocument.isValid() )
             {
-                OUString aOULibName( pBasic->GetName() );
+                const OUString& aOULibName( pBasic->GetName() );
                 Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
                 if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
                 {
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 5997980df2ea..b3efc5d4209a 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -638,14 +638,14 @@ bool TreeListBox::ExpandingHdl()
     {
         SvTreeListEntry* pCurEntry = GetCurEntry();
         EntryDescriptor aDesc( GetEntryDescriptor( pCurEntry ) );
-        ScriptDocument aDocument( aDesc.GetDocument() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
         OSL_ENSURE( aDocument.isAlive(), "TreeListBox::ExpandingHdl: no document, or document is dead!" );
         if ( aDocument.isAlive() )
         {
-            OUString aLibName( aDesc.GetLibName() );
-            OUString aLibSubName( aDesc.GetLibSubName() );
-            OUString aName( aDesc.GetName() );
-            OUString aMethodName( aDesc.GetMethodName() );
+            const OUString& aLibName( aDesc.GetLibName() );
+            const OUString& aLibSubName( aDesc.GetLibSubName() );
+            const OUString& aName( aDesc.GetName() );
+            const OUString& aMethodName( aDesc.GetMethodName() );
 
             if ( !aLibName.isEmpty() && aLibSubName.isEmpty() && aName.isEmpty() && aMethodName.isEmpty() )
             {
@@ -672,11 +672,11 @@ bool TreeListBox::IsEntryProtected( SvTreeListEntry* pEntry )
     if ( pEntry && ( GetModel()->GetDepth( pEntry ) == 1 ) )
     {
         EntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
-        ScriptDocument aDocument( aDesc.GetDocument() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
         OSL_ENSURE( aDocument.isAlive(), "TreeListBox::IsEntryProtected: no document, or document is dead!" );
         if ( aDocument.isAlive() )
         {
-            OUString aOULibName( aDesc.GetLibName() );
+            const OUString& aOULibName( aDesc.GetLibName() );
             Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
             if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
             {
@@ -799,7 +799,7 @@ void TreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
     if ( pRootEntry )
     {
         pCurEntry = pRootEntry;
-        OUString aLibName( aDesc.GetLibName() );
+        const OUString& aLibName( aDesc.GetLibName() );
         if ( !aLibName.isEmpty() )
         {
             Expand( pRootEntry );
@@ -807,7 +807,7 @@ void TreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
             if ( pLibEntry )
             {
                 pCurEntry = pLibEntry;
-                OUString aLibSubName( aDesc.GetLibSubName() );
+                const OUString& aLibSubName( aDesc.GetLibSubName() );
                 if( !aLibSubName.isEmpty() )
                 {
                     Expand( pLibEntry );
@@ -817,7 +817,7 @@ void TreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
                         pCurEntry = pLibSubEntry;
                     }
                 }
-                OUString aName( aDesc.GetName() );
+                const OUString& aName( aDesc.GetName() );
                 if ( !aName.isEmpty() )
                 {
                     Expand( pCurEntry );
@@ -828,7 +828,7 @@ void TreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
                     if ( pEntry )
                     {
                         pCurEntry = pEntry;
-                        OUString aMethodName( aDesc.GetMethodName() );
+                        const OUString& aMethodName( aDesc.GetMethodName() );
                         if ( !aMethodName.isEmpty() )
                         {
                             Expand( pEntry );
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 2b8e3f79d8e3..ba00c2516488 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -41,7 +41,7 @@ typedef std::deque< SvTreeListEntry* > EntryArray;
 void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
 {
     EntryDescriptor aDesc = GetEntryDescriptor(pEntry);
-    ScriptDocument aDocument = aDesc.GetDocument();
+    const ScriptDocument& aDocument = aDesc.GetDocument();
     OSL_ENSURE( aDocument.isAlive(), "basctl::TreeListBox::RequestingChildren: invalid document!" );
     if ( !aDocument.isAlive() )
         return;
@@ -55,7 +55,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
     }
     else if ( eType == OBJ_TYPE_LIBRARY )
     {
-        OUString aOULibName( aDesc.GetLibName() );
+        const OUString& aOULibName( aDesc.GetLibName() );
 
         // check password
         bool bOK = true;
@@ -120,7 +120,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
             || eType == OBJ_TYPE_NORMAL_MODULES
             || eType == OBJ_TYPE_CLASS_MODULES )
     {
-        OUString aLibName( aDesc.GetLibName() );
+        const OUString& aLibName( aDesc.GetLibName() );
         ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
     }
     else {
@@ -369,11 +369,11 @@ bool TreeListBox::IsValidEntry( SvTreeListEntry* pEntry )
     bool bIsValid = false;
 
     EntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
-    ScriptDocument aDocument( aDesc.GetDocument() );
+    const ScriptDocument& aDocument( aDesc.GetDocument() );
     LibraryLocation eLocation( aDesc.GetLocation() );
-    OUString aLibName( aDesc.GetLibName() );
-    OUString aName( aDesc.GetName() );
-    OUString aMethodName( aDesc.GetMethodName() );
+    const OUString& aLibName( aDesc.GetLibName() );
+    const OUString& aName( aDesc.GetName() );
+    const OUString& aMethodName( aDesc.GetMethodName() );
     EntryType eType( aDesc.GetType() );
 
     switch ( eType )
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index ca0b9161de7d..25f94c59c12e 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -324,7 +324,7 @@ SbMethod* MacroChooser::CreateMacro()
     SbMethod* pMethod = nullptr;
     SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
     EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-    ScriptDocument aDocument( aDesc.GetDocument() );
+    const ScriptDocument& aDocument( aDesc.GetDocument() );
     OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" );
     if ( !aDocument.isAlive() )
         return nullptr;
@@ -403,8 +403,8 @@ void MacroChooser::CheckButtons()
     sal_uInt16 nDepth = pCurEntry ? m_pBasicBox->GetModel()->GetDepth( pCurEntry ) : 0;
     if ( nDepth == 1 || nDepth == 2 )
     {
-        ScriptDocument aDocument( aDesc.GetDocument() );
-        OUString aOULibName( aDesc.GetLibName() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
+        const OUString& aOULibName( aDesc.GetLibName() );
         Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
         Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
         if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
@@ -659,12 +659,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
     {
         SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
         EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-        ScriptDocument aDocument( aDesc.GetDocument() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
         DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
         if ( !aDocument.isAlive() )
             return;
         BasicManager* pBasMgr = aDocument.getBasicManager();
-        OUString aLib( aDesc.GetLibName() );
+        const OUString& aLib( aDesc.GetLibName() );
         OUString aMod( aDesc.GetName() );
         // extract the module name from the string like "Sheet1 (Example1)"
         if( aDesc.GetLibSubName() == IDEResId(RID_STR_DOCUMENT_OBJECTS) )
@@ -672,7 +672,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
             sal_Int32 nIndex = 0;
             aMod = aMod.getToken( 0, ' ', nIndex );
         }
-        OUString aSub( aDesc.GetMethodName() );
+        const OUString& aSub( aDesc.GetMethodName() );
         SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, OUString() );
         if (pButton == m_pEditButton)
         {
@@ -742,13 +742,13 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
     {
         SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
         EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-        ScriptDocument aDocument( aDesc.GetDocument() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
         DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
         if ( !aDocument.isAlive() )
             return;
         BasicManager* pBasMgr = aDocument.getBasicManager();
-        OUString aLib( aDesc.GetLibName() );
-        OUString aMod( aDesc.GetName() );
+        const OUString& aLib( aDesc.GetLibName() );
+        const OUString& aMod( aDesc.GetName() );
         OUString aSub( m_pMacroNameEdit->GetText() );
         SbMethod* pMethod = GetMacro();
         DBG_ASSERT( pBasMgr, "BasMgr?" );
@@ -769,15 +769,15 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
     {
         SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
         EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-        ScriptDocument aDocument( aDesc.GetDocument() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
         createLibImpl(GetFrameWeld(), aDocument, nullptr, m_pBasicBox);
     }
     else if (pButton == m_pNewModButton)
     {
         SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
         EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-        ScriptDocument aDocument( aDesc.GetDocument() );
-        OUString aLibName( aDesc.GetLibName() );
+        const ScriptDocument& aDocument( aDesc.GetDocument() );
+        const OUString& aLibName( aDesc.GetLibName() );
         createModImpl(GetFrameWeld(), aDocument, *m_pBasicBox, aLibName, OUString(), true);
     }
     else if (pButton == m_pOrganizeButton)
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index b446588a6b93..f1940c1c8b0c 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -706,7 +706,7 @@ void LibPage::InsertLib()
     Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     // file open dialog
     sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, pTabDlg ? pTabDlg->GetFrameWeld() : nullptr);
-    Reference <XFilePicker3> xFP = aDlg.GetFilePicker();
+    const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker();
 
     xFP->setTitle(IDEResId(RID_STR_APPENDLIBS));
 
@@ -1163,7 +1163,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
 {
     // file open dialog
     sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, pTabDlg ? pTabDlg->GetFrameWeld() : nullptr);
-    Reference <XFilePicker3> xFP = aDlg.GetFilePicker();
+    const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker();
 
     Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr) );
@@ -1374,7 +1374,7 @@ void LibPage::SetCurLib()
     DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( nSelPos ));
     if ( pEntry )
     {
-        ScriptDocument aDocument( pEntry->GetDocument() );
+        const ScriptDocument& aDocument( pEntry->GetDocument() );
         DBG_ASSERT( aDocument.isAlive(), "LibPage::SetCurLib: no document, or document is dead!" );
         if ( !aDocument.isAlive() )
             return;
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 7e28a20ddd17..e45d96d378b3 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -67,8 +67,8 @@ bool ExtTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
         if ( nDepth >= 2 )
         {
             EntryDescriptor aDesc = GetEntryDescriptor(pEntry);
-            ScriptDocument aDocument( aDesc.GetDocument() );
-            OUString aLibName( aDesc.GetLibName() );
+            const ScriptDocument& aDocument( aDesc.GetDocument() );
+            const OUString& aLibName( aDesc.GetLibName() );
             Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
             Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
             if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) ||
@@ -99,11 +99,11 @@ bool ExtTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewT
         return true;
 
     EntryDescriptor aDesc = GetEntryDescriptor(pEntry);
-    ScriptDocument aDocument( aDesc.GetDocument() );
+    const ScriptDocument& aDocument( aDesc.GetDocument() );
     DBG_ASSERT( aDocument.isValid(), "ExtTreeListBox::EditedEntry: no document!" );
     if ( !aDocument.isValid() )
         return false;
-    OUString aLibName( aDesc.GetLibName() );
+    const OUString& aLibName( aDesc.GetLibName() );
     EntryType eType = aDesc.GetType();
 
     bool bSuccess = eType == OBJ_TYPE_MODULE ?
@@ -144,8 +144,8 @@ DragDropMode ExtTreeListBox::NotifyStartDrag( TransferDataContainer&, SvTreeList
         {
             nMode_ = DragDropMode::CTRL_COPY;
             EntryDescriptor aDesc = GetEntryDescriptor(pEntry);
-            ScriptDocument aDocument( aDesc.GetDocument() );
-            OUString aLibName( aDesc.GetLibName() );
+            const ScriptDocument& aDocument( aDesc.GetDocument() );
+            const OUString& aLibName( aDesc.GetLibName() );
             // allow MOVE mode only for libraries, which are not readonly
             Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
             Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
@@ -194,13 +194,13 @@ bool ExtTreeListBox::NotifyAcceptDrop( SvTreeListEntry* pEntry )
     {
         // get source module/dialog name
         EntryDescriptor aSourceDesc = GetEntryDescriptor(pSelected);
-        OUString aSourceName = aSourceDesc.GetName();
+        const OUString& aSourceName = aSourceDesc.GetName();
         EntryType eSourceType = aSourceDesc.GetType();
 
         // get target shell and target library name
         EntryDescriptor aDestDesc = GetEntryDescriptor(pEntry);
         ScriptDocument const& rDestDoc = aDestDesc.GetDocument();
-        OUString aDestLibName = aDestDesc.GetLibName();
+        const OUString& aDestLibName = aDestDesc.GetLibName();
 
         // check if module library is not loaded, readonly or password protected
         Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
@@ -332,13 +332,13 @@ TriState ExtTreeListBox::NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeLi
     // get target shell and target library name
     EntryDescriptor aDestDesc = GetEntryDescriptor(rpNewParent);
     const ScriptDocument& rDestDoc( aDestDesc.GetDocument() );
-    OUString aDestLibName( aDestDesc.GetLibName() );
+    const OUString& aDestLibName( aDestDesc.GetLibName() );
 
     // get source shell, library name and module/dialog name
     EntryDescriptor aSourceDesc = GetEntryDescriptor(FirstSelected());
-    const ScriptDocument rSourceDoc( aSourceDesc.GetDocument() );
-    OUString aSourceLibName( aSourceDesc.GetLibName() );
-    OUString aSourceName( aSourceDesc.GetName() );
+    const ScriptDocument& rSourceDoc( aSourceDesc.GetDocument() );
+    const OUString& aSourceLibName( aSourceDesc.GetLibName() );
+    const OUString& aSourceName( aSourceDesc.GetName() );
     EntryType eType = aSourceDesc.GetType();
 
     // get dispatcher
@@ -626,9 +626,9 @@ void ObjectPage::CheckButtons()
     // enable/disable edit button
     SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
     EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry);
-    ScriptDocument aDocument( aDesc.GetDocument() );
-    OUString aLibName( aDesc.GetLibName() );
-    OUString aLibSubName( aDesc.GetLibSubName() );
+    const ScriptDocument& aDocument( aDesc.GetDocument() );
+    const OUString& aLibName( aDesc.GetLibName() );
+    const OUString& aLibSubName( aDesc.GetLibSubName() );
     bool bVBAEnabled = aDocument.isInVBAMode();
     BrowseMode nMode = m_pBasicBox->GetMode();
 
@@ -879,12 +879,12 @@ void ObjectPage::DeleteCurrent()
     SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry();
     DBG_ASSERT( pCurEntry, "No current entry!" );
     EntryDescriptor aDesc( m_pBasicBox->GetEntryDescriptor( pCurEntry ) );
-    ScriptDocument aDocument( aDesc.GetDocument() );
+    const ScriptDocument& aDocument( aDesc.GetDocument() );
     DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" );
     if ( !aDocument.isAlive() )
         return;
-    OUString aLibName( aDesc.GetLibName() );
-    OUString aName( aDesc.GetName() );
+    const OUString& aLibName( aDesc.GetLibName() );
+    const OUString& aName( aDesc.GetName() );
     EntryType eType = aDesc.GetType();
 
     if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule(aName, GetFrameWeld()) ) ||
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 757b98af872e..2339b5573e2c 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -91,7 +91,7 @@ void ManageLanguageDialog::Init()
 {
     // get current IDE
     Shell* pShell = GetShell();
-    OUString sLibName = pShell->GetCurLibName();
+    const OUString& sLibName = pShell->GetCurLibName();
     // set dialog title with library name
     OUString sText = GetText();
     sText = sText.replaceAll("$1", sLibName);
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index f34c7bb3a4a2..d878a2801125 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -991,7 +991,7 @@ namespace basegfx
 
                     for(sal_uInt32 m(0); m < nCountM; m++)
                     {
-                        const B2DPolygon aMask(rPolyMask.getB2DPolygon(m));
+                        const B2DPolygon& aMask(rPolyMask.getB2DPolygon(m));
                         const sal_uInt32 nCountB(aMask.count());
 
                         if(nCountB)
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 20b193d099bc..5c8eaa5792a6 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1451,7 +1451,7 @@ namespace basegfx
         bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance)
         {
             // force to non-bezier polygon
-            const B2DPolygon aCandidate(rCandidate.getDefaultAdaptiveSubdivision());
+            const B2DPolygon& aCandidate(rCandidate.getDefaultAdaptiveSubdivision());
             const sal_uInt32 nPointCount(aCandidate.count());
 
             if(nPointCount)
diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx
index a7041e2053fc..ed58d2f03d27 100644
--- a/basegfx/source/polygon/b2dpolygontriangulator.cxx
+++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx
@@ -220,7 +220,7 @@ namespace basegfx
             {
                 for(sal_uInt32 a(0); a < rCandidate.count(); a++)
                 {
-                    const B2DPolygon aPolygonCandidate(rCandidate.getB2DPolygon(a));
+                    const B2DPolygon& aPolygonCandidate(rCandidate.getB2DPolygon(a));
                     const sal_uInt32 nCount(aPolygonCandidate.count());
 
                     if(nCount > 2)
@@ -419,7 +419,7 @@ namespace basegfx
             if(aCandidate.count() == 1)
             {
                 // single polygon -> single polygon triangulation
-                const B2DPolygon aSinglePolygon(aCandidate.getB2DPolygon(0));
+                const B2DPolygon& aSinglePolygon(aCandidate.getB2DPolygon(0));
 
                 aRetval = triangulate(aSinglePolygon);
             }
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 4fd7bf369d85..d80c670fe04f 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -535,7 +535,7 @@ namespace basegfx
                         // count points
                         for(a = 0; a < nOriginalCount; a++)
                         {
-                            const B2DPolygon aCandidate(aGeometry.getB2DPolygon(a));
+                            const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
                             const sal_uInt32 nCandCount(aCandidate.count());
 
                             // If it's not a bezier curve, at least three points would be needed to have a
@@ -561,7 +561,7 @@ namespace basegfx
 
                             for(a = 0; a < nOriginalCount; a++)
                             {
-                                const B2DPolygon aCandidate(aGeometry.getB2DPolygon(a));
+                                const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
                                 const sal_uInt32 nCandCount(aCandidate.count());
 
                                 // use same condition as above, the data vector is
@@ -710,7 +710,7 @@ namespace basegfx
 
             for(sal_uInt32 a(0); a < rCandidate.count(); a++)
             {
-                const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a));
+                const B2DPolygon& aCandidate(rCandidate.getB2DPolygon(a));
 
                 if(utils::getOrientation(aCandidate) != B2VectorOrientation::Neutral)
                 {
@@ -749,7 +749,7 @@ namespace basegfx
 
                 for(a = 0; a < nCount; a++)
                 {
-                    const B2DPolygon aCand(aCandidate.getB2DPolygon(a));
+                    const B2DPolygon& aCand(aCandidate.getB2DPolygon(a));
                     StripHelper* pNewHelper = &(aHelpers[a]);
                     pNewHelper->maRange = utils::getRange(aCand);
                     pNewHelper->meOrinetation = utils::getOrientation(aCand);
@@ -760,12 +760,12 @@ namespace basegfx
 
                 for(a = 0; a < nCount - 1; a++)
                 {
-                    const B2DPolygon aCandA(aCandidate.getB2DPolygon(a));
+                    const B2DPolygon& aCandA(aCandidate.getB2DPolygon(a));
                     StripHelper& rHelperA = aHelpers[a];
 
                     for(b = a + 1; b < nCount; b++)
                     {
-                        const B2DPolygon aCandB(aCandidate.getB2DPolygon(b));
+                        const B2DPolygon& aCandB(aCandidate.getB2DPolygon(b));
                         StripHelper& rHelperB = aHelpers[b];
                         const bool bAInB(rHelperB.maRange.isInside(rHelperA.maRange) && utils::isInside(aCandB, aCandA, true));
 
@@ -829,7 +829,7 @@ namespace basegfx
 
                     for(a = 0; a < nCount; a++)
                     {
-                        const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a));
+                        const B2DPolygon& aCandidate(rCandidate.getB2DPolygon(a));
                         StripHelper* pNewHelper = &(aHelpers[a]);
                         pNewHelper->maRange = utils::getRange(aCandidate);
                         pNewHelper->meOrinetation = utils::getOrientation(aCandidate);
@@ -838,12 +838,12 @@ namespace basegfx
 
                     for(a = 0; a < nCount - 1; a++)
                     {
-                        const B2DPolygon aCandA(rCandidate.getB2DPolygon(a));
+                        const B2DPolygon& aCandA(rCandidate.getB2DPolygon(a));
                         StripHelper& rHelperA = aHelpers[a];
 
                         for(b = a + 1; b < nCount; b++)
                         {
-                            const B2DPolygon aCandB(rCandidate.getB2DPolygon(b));
+                            const B2DPolygon& aCandB(rCandidate.getB2DPolygon(b));
                             StripHelper& rHelperB = aHelpers[b];
                             const bool bAInB(rHelperB.maRange.isInside(rHelperA.maRange) && utils::isInside(aCandB, aCandA, true));
                             const bool bBInA(rHelperA.maRange.isInside(rHelperB.maRange) && utils::isInside(aCandA, aCandB, true));
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 2a195641d5f0..7906704e76e3 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -733,7 +733,7 @@ namespace basegfx
 
             for(sal_uInt32 i(0); i < nCount; i++)
             {
-                const B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(i));
+                const B2DPolygon& aPolygon(rPolyPolygon.getB2DPolygon(i));
                 const sal_uInt32 nPointCount(aPolygon.count());
 
                 if(nPointCount)
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index db0654df266b..abd7340d4b69 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -46,7 +46,7 @@ namespace basegfx
 
             for(sal_uInt32 a(0); a < nPolygonCount; a++)
             {
-                B3DPolygon aCandidate = rCandidate.getB3DPolygon(a);
+                const B3DPolygon& aCandidate = rCandidate.getB3DPolygon(a);
                 aRetval.expand(getRange(aCandidate));
             }
 
@@ -470,7 +470,7 @@ namespace basegfx
 
                 for(sal_uInt32 a(0); a < nPolygonCount; a++)
                 {
-                    const B3DPolygon aPolygon(rCandidate.getB3DPolygon(a));
+                    const B3DPolygon& aPolygon(rCandidate.getB3DPolygon(a));
                     const bool bInside(isInside(aPolygon, rPoint, false/*bWithBorder*/));
 
                     if(bInside)
@@ -550,7 +550,7 @@ namespace basegfx
 
                 for(sal_uInt32 a(0); a < nPolygonCount; a++)
                 {
-                    const basegfx::B3DPolygon aPoly(rPolyPolygonSource.getB3DPolygon(a));
+                    const basegfx::B3DPolygon& aPoly(rPolyPolygonSource.getB3DPolygon(a));
                     const sal_uInt32 nPointCount(aPoly.count());
 
                     if(nPointCount)
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 28667187513e..932a541bb57a 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -465,7 +465,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 
                     SbxProperty* pTypeElem = static_cast< SbxProperty* > ( pTypeMembers->Get(j) );
 
-                    OUString aElemName = pTypeElem->GetName();
+                    const OUString& aElemName = pTypeElem->GetName();
                     r.WriteUniOrByteString( aElemName, eCharSet );
 
                     SbxDataType dataType =   pTypeElem->GetType();
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 944836865545..23fedab3b08b 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -730,7 +730,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
                     SbxObject* pObj = dynamic_cast<SbxObject*>( pObjBase );
                     if( pObj != nullptr )
                     {
-                        OUString aObjClass = pObj->GetClassName();
+                        const OUString& aObjClass = pObj->GetClassName();
 
                         SbClassModuleObject* pClassModuleObj = dynamic_cast<SbClassModuleObject*>( pObjBase );
                         if( pClassModuleObj != nullptr )
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 3e9df83c4df7..9aa7725aca74 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -327,7 +327,7 @@ static OUString implGetExceptionMsg( const Any& _rCaughtException )
 static Any convertAny( const Any& rVal, const Type& aDestType )
 {
     Any aConvertedVal;
-    Reference< XTypeConverter > xConverter = getTypeConverter_Impl();
+    const Reference< XTypeConverter >& xConverter = getTypeConverter_Impl();
     try
     {
         aConvertedVal = xConverter->convertTo( rVal, aDestType );
@@ -1146,7 +1146,7 @@ static bool implGetTypeByName( const OUString& rName, Type& rRetType )
 {
     bool bSuccess = false;
 
-    Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+    const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
     if( xTypeAccess->hasByHierarchicalName( rName ) )
     {
         Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -2835,7 +2835,7 @@ static SbUnoObject* Impl_CreateUnoStruct( const OUString& aClassName )
 
     // search for the class
     Reference< XIdlClass > xClass;
-    Reference< XHierarchicalNameAccess > xHarryName =
+    const Reference< XHierarchicalNameAccess >& xHarryName =
         getCoreReflection_HierarchicalNameAccess_Impl();
     if( xHarryName.is() && xHarryName->hasByHierarchicalName( aClassName ) )
         xClass = xCoreReflection->forName( aClassName );
@@ -3294,7 +3294,7 @@ SbUnoClass* findUnoClass( const OUString& rName )
     // #105550 Check if module exists
     SbUnoClass* pUnoClass = nullptr;
 
-    Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+    const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
     if( xTypeAccess->hasByHierarchicalName( rName ) )
     {
         Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -3444,7 +3444,7 @@ SbUnoService* findUnoService( const OUString& rName )
 {
     SbUnoService* pSbUnoService = nullptr;
 
-    Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+    const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
     if( xTypeAccess->hasByHierarchicalName( rName ) )
     {
         Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -3691,7 +3691,7 @@ SbUnoSingleton* findUnoSingleton( const OUString& rName )
 {
     SbUnoSingleton* pSbUnoSingleton = nullptr;
 
-    Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+    const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
     if( xTypeAccess->hasByHierarchicalName( rName ) )
     {
         Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -4130,7 +4130,7 @@ void RTL_Impl_CreateUnoValue( SbxArray& rPar )
     }
 
     // Check the type
-    Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+    const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
     Any aRet;
     try
     {
@@ -4507,7 +4507,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
     for( sal_uInt16 i = 0 ; i < nCount ; ++i )
     {
         SbxVariable* pVar = pModIfaces->Get( i );
-        OUString aIfaceName = pVar->GetName();
+        const OUString& aIfaceName = pVar->GetName();
 
         if( !aIfaceName.isEmpty() )
         {
@@ -4778,7 +4778,7 @@ OUString SbUnoStructRefObject::Impl_DumpProperties()
             // Is it in Uno a sequence?
             SbxDataType eType = pVar->GetFullType();
 
-            OUString aName( pVar->GetName() );
+            const OUString& aName( pVar->GetName() );
             StructFieldInfo::iterator it = maFields.find( aName );
 
             if ( it != maFields.end() )
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 6225cb58e0f8..05ce540be4b1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -460,7 +460,7 @@ void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
 // Implementation of StepRENAME with UCB
 void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
 {
-    uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+    const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
     if( xSFI.is() )
     {
         try
@@ -508,7 +508,7 @@ void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool)
         OUString aDest = rPar.Get(2)->GetOUString();
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -543,7 +543,7 @@ void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool)
 
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 OUString aFullPath = getFullPath( aFileSpec );
@@ -604,7 +604,7 @@ void SbRtl_MkDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
 
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -700,7 +700,7 @@ void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
         OUString aPath = rPar.Get(1)->GetOUString();
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -774,7 +774,7 @@ void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)
         sal_Int32 nLen = 0;
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -2651,7 +2651,7 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool)
         }
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 if ( nParCount >= 2 )
@@ -2946,7 +2946,7 @@ void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
 
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -3025,7 +3025,7 @@ void SbRtl_FileDateTime(StarBASIC *, SbxArray & rPar, bool)
         Date aDate( Date::EMPTY );
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -4319,7 +4319,7 @@ void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool)
     if (SbStdPicture *pPicture = dynamic_cast<SbStdPicture*>(pObj))
     {
         SvFileStream aOStream( rPar.Get(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC );
-        Graphic aGraphic = pPicture->GetGraphic();
+        const Graphic& aGraphic = pPicture->GetGraphic();
         WriteGraphic( aOStream, aGraphic );
     }
 }
@@ -4467,7 +4467,7 @@ void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool)
 
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
@@ -4538,7 +4538,7 @@ void SbRtl_FileExists(StarBASIC *, SbxArray & rPar, bool)
 
         if( hasUno() )
         {
-            uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
             if( xSFI.is() )
             {
                 try
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 92cd189ca587..0c89f9125d86 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1671,7 +1671,7 @@ void SbRtl_MonthName(StarBASIC *, SbxArray & rPar, bool)
         return;
     }
 
-    Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+    const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
     if( !xCalendar.is() )
     {
         StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -1708,7 +1708,7 @@ void SbRtl_WeekdayName(StarBASIC *, SbxArray & rPar, bool)
         return;
     }
 
-    Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+    const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
     if( !xCalendar.is() )
     {
         StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -2042,7 +2042,7 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
                     }
                     if( nFirstDay == 0 )
                     {
-                        Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+                        const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
                         if( !xCalendar.is() )
                         {
                             StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -2292,7 +2292,7 @@ void SbRtl_FormatDateTime(StarBASIC *, SbxArray & rPar, bool)
         }
     }
 
-    Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+    const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
     if( !xCalendar.is() )
     {
         StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -3053,7 +3053,7 @@ sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam, sal_Int16 nFirstDay
         }
         if( nFirstDay == 0 )
         {
-            Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+            const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
             if( !xCalendar.is() )
             {
 #if HAVE_FEATURE_SCRIPTING
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index e2c1e2ef7920..7d881967c6df 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3155,7 +3155,7 @@ bool SbiRuntime::implIsClass( SbxObject const * pObj, const OUString& aClass )
             bRet = aClass.equalsIgnoreAsciiCase( "object" );
         if( !bRet )
         {
-            OUString aObjClass = pObj->GetClassName();
+            const OUString& aObjClass = pObj->GetClassName();
             SbModule* pClassMod = GetSbData()->pClassFac->FindClass( aObjClass );
             if( pClassMod && pClassMod->pClassData )
             {


More information about the Libreoffice-commits mailing list