diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-08 12:00:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-08 15:23:52 +0100 |
commit | ed0b12f4eadf1f2242f06cbd56804f75376274b1 (patch) | |
tree | 7028abd9cf514c74bd1b795cc6398b0bb433f319 /basctl | |
parent | 5ff283e3b841230a45715e48a251c3c4216d1cec (diff) |
no need to take a copy of the getProcessComponentContext return value
we can just take a "const &".
(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)
Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/basides3.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/bastype2.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/doceventnotifier.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/moduldlg.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 6 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 8 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedclip.cxx | 2 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedfac.cxx | 2 | ||||
-rw-r--r-- | basctl/source/dlged/propbrw.cxx | 2 |
11 files changed, 20 insertions, 20 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 2d41616751ae..a4d845d0878c 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -619,7 +619,7 @@ void DialogWindow::SaveDialog() OUString aSelectedFileURL = xFP->getSelectedFiles()[0]; - Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); + const Reference<uno::XComponentContext>& xContext(comphelper::getProcessComponentContext()); Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) ); Reference< XOutputStream > xOutput; @@ -785,7 +785,7 @@ bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const { bool bDone = false; - Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext()); + const Reference<uno::XComponentContext>& xContext(::comphelper::getProcessComponentContext()); sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, pWin); aDlg.SetContext(sfx2::FileDialogHelper::BasicImportDialog); @@ -1117,7 +1117,7 @@ void DialogWindow::StoreData() if( xDialogModel.is() ) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() ); xLib->replaceByName( GetName(), Any( xISP ) ); diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index cb3a6a0e4dff..2c9ba2bc1099 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -72,7 +72,7 @@ VclPtr<DialogWindow> Shell::CreateDlgWin( const ScriptDocument& rDocument, const if ( xISP.is() ) { // create dialog model - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< container::XNameContainer > xDialogModel( xContext->getServiceManager()->createInstanceWithContext ( u"com.sun.star.awt.UnoControlDialogModel"_ustr, xContext ), UNO_QUERY ); Reference< XInputStream > xInput( xISP->createInputStream() ); diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index e8148394e755..75d21f3c41c1 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -659,7 +659,7 @@ OUString SbTreeListBox::GetRootEntryBitmaps(const ScriptDocument& rDocument) if ( rDocument.isDocument() ) { OUString sFactoryURL; - Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + const Reference<uno::XComponentContext>& xContext( ::comphelper::getProcessComponentContext() ); Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) ); try { diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index dfaa9eb13930..abee782c09fe 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -197,7 +197,7 @@ namespace basctl xBroadcaster.set( m_xModel, UNO_QUERY_THROW ); else { - Reference< css::uno::XComponentContext > aContext( + const Reference< css::uno::XComponentContext >& aContext( comphelper::getProcessComponentContext() ); xBroadcaster = theGlobalEventBroadcaster::get(aContext); } diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index d8b24af7f9e3..5b3d49547dc7 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -565,7 +565,7 @@ void LibPage::NewLib() void LibPage::InsertLib() { - Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); // file open dialog sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog()); aDlg.SetContext(sfx2::FileDialogHelper::BasicInsertLib); @@ -1018,7 +1018,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) aDlg.SetContext(sfx2::FileDialogHelper::BasicExportPackage); const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker(); - Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr) ); Reference< XSimpleFileAccess3 > xSFA = SimpleFileAccess::create(xContext); @@ -1116,7 +1116,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) void LibPage::ExportAsBasic( const OUString& aLibName ) { // Folder picker - Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_pDialog->getDialog()); Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr) ); diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 81f6d768374f..3909f696708e 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -159,7 +159,7 @@ void Shell::CopyDialogResources( return; // create dialog model - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< container::XNameContainer > xDialogModel( xContext->getServiceManager()->createInstanceWithContext ( u"com.sun.star.awt.UnoControlDialogModel"_ustr, xContext ), UNO_QUERY ); Reference< io::XInputStream > xInput( io_xISP->createInputStream() ); diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 5d2dc915c6df..00ef24a1b279 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -597,7 +597,7 @@ namespace basctl if ( _eType == E_DIALOGS ) { // create dialog model - Reference< XComponentContext > aContext( + const Reference< XComponentContext >& aContext( comphelper::getProcessComponentContext() ); Reference< XNameContainer > xDialogModel; if ( _rxExistingDialogModel.is() ) @@ -733,7 +733,7 @@ namespace basctl return false; // create new dialog model - Reference< XComponentContext > aContext( + const Reference< XComponentContext >& aContext( comphelper::getProcessComponentContext() ); Reference< XNameContainer > xDialogModel( aContext->getServiceManager()->createInstanceWithContext( @@ -915,7 +915,7 @@ namespace basctl if ( !xLibContainer->hasByName( _rLibName ) || !xLibContainer->isLibraryLink( _rLibName ) ) return false; OUString aFileURL; - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XUriReferenceFactory > xUriFac = UriReferenceFactory::create(xContext); OUString aLinkURL( xLibContainer->getLibraryLinkURL( _rLibName ) ); diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 7d5b34b2d344..a2a58116b1c8 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -89,7 +89,7 @@ DlgEdHint::~DlgEdHint() void DlgEditor::ShowDialog() { - uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); // create a dialog uno::Reference< awt::XUnoControlDialog > xDlg = awt::UnoControlDialog::create( xContext ); @@ -415,7 +415,7 @@ Reference< util::XNumberFormatsSupplier > const & DlgEditor::GetNumberFormatsSup { if ( !m_xSupplier.is() ) { - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< util::XNumberFormatsSupplier > xSupplier( util::NumberFormatsSupplier::createWithDefaultLocale(xContext) ); ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); @@ -696,7 +696,7 @@ void DlgEditor::Copy() } // export clipboard dialog model to xml - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument ); Reference< XInputStream > xStream( xISP->createInputStream() ); @@ -825,7 +825,7 @@ void DlgEditor::Paste() return; // create clipboard dialog model from xml - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< container::XNameContainer > xClipDialogModel( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.awt.UnoControlDialogModel"_ustr, xContext ), uno::UNO_QUERY ); diff --git a/basctl/source/dlged/dlgedclip.cxx b/basctl/source/dlged/dlgedclip.cxx index 264e42c835b4..e10733af229b 100644 --- a/basctl/source/dlged/dlgedclip.cxx +++ b/basctl/source/dlged/dlgedclip.cxx @@ -43,7 +43,7 @@ DlgEdTransferableImpl::~DlgEdTransferableImpl() bool DlgEdTransferableImpl::compareDataFlavors( const DataFlavor& lFlavor, const DataFlavor& rFlavor ) { // compare mime content types - Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); Reference< datatransfer::XMimeContentTypeFactory > xMCntTypeFactory = MimeContentTypeFactory::create(xContext); diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 3fc4ef3a2966..72107f383626 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -49,7 +49,7 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, rtl::Referenc { static const uno::Reference<lang::XMultiServiceFactory> xDialogSFact = [] { uno::Reference<lang::XMultiServiceFactory> xFact; - uno::Reference< uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext>& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< container::XNameContainer > xC( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.awt.UnoControlDialogModel"_ustr, xContext ), uno::UNO_QUERY ); if (xC.is()) xFact.set(xC, uno::UNO_QUERY); diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 0a23093ecf71..c16e65a7d167 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -135,7 +135,7 @@ void PropBrw::ImplReCreateController() try { - Reference< XComponentContext > xOwnContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xOwnContext = comphelper::getProcessComponentContext(); // a ComponentContext for the ::cppu::ContextEntry_Init aHandlerContextInfo[] = |