From ed0b12f4eadf1f2242f06cbd56804f75376274b1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Nov 2024 12:00:27 +0200 Subject: [PATCH] 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 Tested-by: Jenkins --- avmedia/source/viewer/mediawindow_impl.cxx | 2 +- basctl/source/basicide/baside3.cxx | 6 +++--- basctl/source/basicide/basides3.cxx | 2 +- basctl/source/basicide/bastype2.cxx | 2 +- basctl/source/basicide/doceventnotifier.cxx | 2 +- basctl/source/basicide/moduldl2.cxx | 6 +++--- basctl/source/basicide/moduldlg.cxx | 2 +- basctl/source/basicide/scriptdocument.cxx | 6 +++--- basctl/source/dlged/dlged.cxx | 8 ++++---- basctl/source/dlged/dlgedclip.cxx | 2 +- basctl/source/dlged/dlgedfac.cxx | 2 +- basctl/source/dlged/propbrw.cxx | 2 +- basic/source/basmgr/basicmanagerrepository.cxx | 2 +- basic/source/classes/eventatt.cxx | 4 ++-- basic/source/classes/sbunoobj.cxx | 14 +++++++------- basic/source/classes/sbxmod.cxx | 2 +- basic/source/runtime/iosys.cxx | 2 +- basic/source/runtime/methods.cxx | 4 ++-- basic/source/uno/dlgcont.cxx | 2 +- chart2/source/tools/StatisticsHelper.cxx | 2 +- comphelper/source/misc/accessibletexthelper.cxx | 2 +- comphelper/source/misc/backupfilehelper.cxx | 8 ++++---- comphelper/source/misc/dispatchcommand.cxx | 4 ++-- .../source/drivers/firebird/Connection.cxx | 2 +- .../customize/CustomNotebookbarGenerator.cxx | 2 +- .../customize/SvxNotebookbarConfigPage.cxx | 3 ++- cui/source/customize/cfg.cxx | 16 ++++++++-------- cui/source/dialogs/QrCodeGenDialog.cxx | 2 +- cui/source/dialogs/SignSignatureLineDialog.cxx | 2 +- cui/source/dialogs/cuigaldlg.cxx | 2 +- cui/source/dialogs/hldocntp.cxx | 2 +- cui/source/dialogs/insdlg.cxx | 2 +- cui/source/dialogs/multipat.cxx | 4 ++-- cui/source/dialogs/scriptdlg.cxx | 2 +- cui/source/dialogs/tipofthedaydlg.cxx | 2 +- cui/source/dialogs/toolbarmodedlg.cxx | 6 +++--- cui/source/options/certpath.cxx | 4 ++-- cui/source/options/connpooloptions.cxx | 2 +- cui/source/options/dbregisterednamesconfig.cxx | 2 +- cui/source/options/doclinkdialog.cxx | 2 +- cui/source/options/optaboutconfig.cxx | 3 ++- cui/source/options/optcolor.cxx | 2 +- cui/source/options/optgdlg.cxx | 2 +- cui/source/options/optjava.cxx | 4 ++-- cui/source/options/optlingu.cxx | 4 ++-- cui/source/options/optpath.cxx | 6 +++--- cui/source/options/optupdt.cxx | 6 +++--- cui/source/options/sdbcdriverenum.cxx | 2 +- cui/source/options/treeopt.cxx | 4 ++-- dbaccess/source/filter/hsqldb/parseschema.cxx | 2 +- dbaccess/source/ui/control/dbtreelistbox.cxx | 2 +- dbaccess/source/ui/control/opendoccontrols.cxx | 2 +- dbaccess/source/ui/dlg/ConnectionHelper.cxx | 2 +- desktop/source/app/app.cxx | 16 ++++++++-------- desktop/source/app/appinit.cxx | 2 +- desktop/source/app/check_ext_deps.cxx | 4 ++-- desktop/source/app/dispatchwatcher.cxx | 4 ++-- desktop/source/deployment/gui/dp_gui_service.cxx | 2 +- .../deployment/gui/dp_gui_updatedialog.cxx | 2 +- .../deployment/misc/dp_descriptioninfoset.cxx | 2 +- desktop/source/migration/migration.cxx | 4 ++-- .../source/primitive2d/controlprimitive2d.cxx | 2 +- .../source/primitive2d/textbreakuphelper.cxx | 2 +- .../processor2d/vclmetafileprocessor2d.cxx | 2 +- editeng/source/editeng/impedit3.cxx | 4 ++-- editeng/source/items/numitem.cxx | 2 +- editeng/source/misc/svxacorr.cxx | 8 ++++---- editeng/source/misc/unolingu.cxx | 4 ++-- editeng/source/xml/xmltxtexp.cxx | 2 +- editeng/source/xml/xmltxtimp.cxx | 2 +- extensions/source/abpilot/datasourcehandling.cxx | 2 +- extensions/source/bibliography/bibbeam.cxx | 2 +- extensions/source/bibliography/bibconfig.cxx | 2 +- extensions/source/bibliography/datman.cxx | 6 +++--- extensions/source/bibliography/framectr.cxx | 2 +- extensions/source/propctrlr/browserline.cxx | 2 +- filter/source/msfilter/msdffimp.cxx | 2 +- filter/source/svg/svgexport.cxx | 4 ++-- forms/source/xforms/computedexpression.cxx | 2 +- forms/source/xforms/submission/replace.cxx | 2 +- fpicker/source/office/fileview.cxx | 4 ++-- fpicker/source/office/foldertree.cxx | 2 +- fpicker/source/office/fpsmartcontent.cxx | 4 ++-- .../source/fwe/classes/framelistanalyzer.cxx | 4 ++-- framework/source/fwe/xml/menudocumenthandler.cxx | 2 +- framework/source/loadenv/loadenv.cxx | 2 +- .../source/uielement/thesaurusmenucontroller.cxx | 2 +- .../uielement/toolbarmodemenucontroller.cxx | 2 +- .../transliteration/transliteration_body.cxx | 2 +- .../source/hyphenator/hyphen/hyphenimp.cxx | 2 +- .../source/thesaurus/libnth/nthesimp.cxx | 2 +- linguistic/source/convdic.cxx | 4 ++-- linguistic/source/dicimp.cxx | 6 +++--- linguistic/source/dlistimp.cxx | 2 +- linguistic/source/gciterator.cxx | 6 +++--- linguistic/source/hyphdsp.cxx | 6 +++--- linguistic/source/lngsvcmgr.cxx | 12 ++++++------ linguistic/source/misc.cxx | 4 ++-- linguistic/source/misc2.cxx | 2 +- linguistic/source/spelldsp.cxx | 4 ++-- linguistic/source/thesdsp.cxx | 2 +- oox/source/drawingml/diagram/diagramhelper.cxx | 2 +- sc/source/core/tool/addincol.cxx | 4 ++-- sc/source/filter/excel/excel.cxx | 4 ++-- sc/source/filter/excel/excimp8.cxx | 2 +- sc/source/filter/excel/xichart.cxx | 2 +- sc/source/filter/excel/xltoolbar.cxx | 2 +- sc/source/filter/xml/xmlwrap.cxx | 4 ++-- sc/source/ui/docshell/docsh.cxx | 4 ++-- sc/source/ui/docshell/docsh8.cxx | 2 +- sc/source/ui/docshell/tablink.cxx | 2 +- sc/source/ui/miscdlgs/solverutil.cxx | 4 ++-- sc/source/ui/optdlg/tpcalc.cxx | 2 +- sc/source/ui/unoobj/chart2uno.cxx | 2 +- sc/source/ui/vba/vbaworksheet.cxx | 2 +- sd/source/core/CustomAnimationEffect.cxx | 12 ++++++------ sd/source/core/CustomAnimationPreset.cxx | 4 ++-- sd/source/core/TransitionPreset.cxx | 2 +- sd/source/core/drawdoc.cxx | 4 ++-- sd/source/core/drawdoc4.cxx | 2 +- sd/source/filter/grf/sdgrffilter.cxx | 2 +- sd/source/filter/ppt/pptinanimations.cxx | 4 ++-- sd/source/filter/sdpptwrp.cxx | 4 ++-- sd/source/filter/xml/sdxmlwrp.cxx | 4 ++-- sd/source/ui/dlg/PhotoAlbumDialog.cxx | 2 +- sd/source/ui/dlg/TemplateScanner.cxx | 2 +- sd/source/ui/dlg/sdtreelb.cxx | 2 +- sd/source/ui/dlg/tpoption.cxx | 2 +- .../configuration/ResourceFactoryManager.cxx | 2 +- .../ui/framework/configuration/ResourceId.cxx | 2 +- .../ui/framework/module/ModuleController.cxx | 2 +- sd/source/ui/slideshow/slideshowimpl.cxx | 4 ++-- sd/source/ui/view/ViewShellBase.cxx | 4 ++-- sd/source/ui/view/drviews2.cxx | 2 +- sd/source/ui/view/drviewsa.cxx | 2 +- sd/source/ui/view/drviewsk.cxx | 2 +- sfx2/source/appl/app.cxx | 2 +- sfx2/source/appl/appinit.cxx | 2 +- sfx2/source/appl/appmisc.cxx | 2 +- sfx2/source/appl/appserv.cxx | 14 +++++++------- sfx2/source/appl/newhelp.cxx | 2 +- sfx2/source/appl/sfxhelp.cxx | 2 +- sfx2/source/bastyp/helper.cxx | 4 ++-- sfx2/source/control/dispatch.cxx | 2 +- sfx2/source/control/templatelocalview.cxx | 2 +- sfx2/source/control/thumbnailview.cxx | 2 +- sfx2/source/dialog/dockwin.cxx | 2 +- sfx2/source/dialog/mailmodel.cxx | 4 ++-- sfx2/source/doc/docfac.cxx | 2 +- sfx2/source/doc/docfile.cxx | 4 ++-- sfx2/source/doc/doctempl.cxx | 2 +- sfx2/source/doc/doctemplates.cxx | 4 ++-- sfx2/source/doc/graphhelp.cxx | 2 +- sfx2/source/doc/objserv.cxx | 2 +- sfx2/source/doc/objstor.cxx | 4 ++-- sfx2/source/doc/objxtor.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 6 +++--- sfx2/source/doc/templatedlg.cxx | 2 +- .../source/notebookbar/NotebookbarTabControl.cxx | 8 ++++---- sfx2/source/notebookbar/SfxNotebookBar.cxx | 4 ++-- sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 2 +- sfx2/source/sidebar/ControllerFactory.cxx | 2 +- sfx2/source/sidebar/ResourceManager.cxx | 2 +- sfx2/source/sidebar/SidebarController.cxx | 2 +- sfx2/source/sidebar/Tools.cxx | 6 +++--- sfx2/source/view/classificationhelper.cxx | 2 +- sfx2/source/view/frame2.cxx | 2 +- sfx2/source/view/ipclient.cxx | 2 +- sfx2/source/view/lokhelper.cxx | 4 ++-- sfx2/source/view/viewfrm.cxx | 6 +++--- sfx2/source/view/viewsh.cxx | 4 ++-- starmath/source/mathml/export.cxx | 6 ++++-- starmath/source/mathml/import.cxx | 6 ++++-- starmath/source/mathml/mathmlexport.cxx | 3 ++- starmath/source/mathml/mathmlimport.cxx | 6 ++++-- svl/source/config/itemholder2.cxx | 2 +- svtools/source/config/itemholder2.cxx | 2 +- svtools/source/control/inettbc.cxx | 2 +- svtools/source/dialogs/ServerDetailsControls.cxx | 4 ++-- svtools/source/dialogs/colrdlg.cxx | 4 ++-- svtools/source/misc/imagemgr.cxx | 2 +- svtools/source/misc/templatefoldercache.cxx | 2 +- svx/source/core/graphichelper.cxx | 2 +- .../customshapes/EnhancedCustomShapeFontWork.cxx | 2 +- svx/source/dialog/SafeModeDialog.cxx | 2 +- svx/source/dialog/SvxNumOptionsTabPageHelper.cxx | 2 +- svx/source/dialog/rubydialog.cxx | 2 +- svx/source/dialog/signaturelinehelper.cxx | 3 ++- svx/source/form/fmdmod.cxx | 2 +- svx/source/form/fmpgeimp.cxx | 2 +- svx/source/form/fmshimp.cxx | 2 +- svx/source/form/fmundo.cxx | 2 +- svx/source/form/fmvwimp.cxx | 2 +- svx/source/form/navigatortree.cxx | 4 ++-- svx/source/items/pageitem.cxx | 2 +- .../contact/viewobjectcontactofunocontrol.cxx | 2 +- svx/source/sidebar/nbdtmg.cxx | 4 ++-- svx/source/svdraw/svdoashp.cxx | 2 +- svx/source/svdraw/svdotextpathdecomposition.cxx | 2 +- svx/source/svdraw/svdouno.cxx | 2 +- svx/source/tbxctrls/PaletteManager.cxx | 2 +- svx/source/tbxctrls/fontworkgallery.cxx | 2 +- svx/source/unodraw/unoshtxt.cxx | 2 +- svx/source/xml/xmlexport.cxx | 4 ++-- svx/source/xml/xmlxtexp.cxx | 2 +- svx/source/xml/xmlxtimp.cxx | 2 +- sw/source/core/bastyp/checkit.cxx | 2 +- sw/source/core/bastyp/init.cxx | 2 +- sw/source/core/doc/docnew.cxx | 2 +- sw/source/core/doc/rdfhelper.cxx | 14 +++++++------- sw/source/core/edit/edfldexp.cxx | 3 ++- sw/source/core/fields/macrofld.cxx | 2 +- sw/source/core/swg/SwXMLTextBlocks1.cxx | 14 +++++++------- sw/source/core/tox/toxhlp.cxx | 2 +- sw/source/filter/rtf/swparrtf.cxx | 3 ++- sw/source/filter/ww8/wrtww8.cxx | 2 +- sw/source/filter/ww8/ww8par.cxx | 4 ++-- sw/source/filter/ww8/ww8toolbar.cxx | 4 ++-- sw/source/filter/xml/swxml.cxx | 4 ++-- sw/source/filter/xml/wrtxml.cxx | 2 +- sw/source/filter/xml/xmlimp.cxx | 2 +- sw/source/ui/chrdlg/drpcps.cxx | 2 +- sw/source/ui/config/mailconfigpage.cxx | 2 +- sw/source/ui/dbui/addresslistdialog.cxx | 4 ++-- sw/source/ui/dbui/dbinsdlg.cxx | 2 +- sw/source/ui/envelp/mailmrge.cxx | 2 +- sw/source/ui/fldui/changedb.cxx | 2 +- sw/source/ui/index/swuiidxmrk.cxx | 4 ++-- sw/source/ui/table/autoformatpreview.cxx | 3 ++- sw/source/ui/vba/vbatemplate.cxx | 2 +- sw/source/uibase/app/docsh.cxx | 2 +- sw/source/uibase/app/docsh2.cxx | 4 ++-- .../uibase/config/StoredChapterNumbering.cxx | 4 ++-- sw/source/uibase/dbui/dbmgr.cxx | 16 ++++++++-------- sw/source/uibase/dbui/dbtree.cxx | 2 +- sw/source/uibase/dbui/mailmergehelper.cxx | 2 +- sw/source/uibase/fldui/fldmgr.cxx | 4 ++-- sw/source/uibase/misc/numberingtypelistbox.cxx | 3 ++- sw/source/uibase/shells/drwtxtsh.cxx | 2 +- sw/source/uibase/uiview/view.cxx | 2 +- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uiview/viewling.cxx | 4 ++-- sw/source/uibase/uno/dlelstnr.cxx | 2 +- test/source/sheet/xdocumentauditing.cxx | 3 ++- toolkit/source/awt/animatedimagespeer.cxx | 2 +- toolkit/source/awt/vclxwindows.cxx | 2 +- toolkit/source/controls/filectrl.cxx | 2 +- .../controls/table/cellvalueconversion.cxx | 2 +- toolkit/source/controls/unocontrols.cxx | 2 +- toolkit/source/helper/tkresmgr.cxx | 3 ++- toolkit/source/helper/vclunohelper.cxx | 2 +- ucb/source/ucp/cmis/auth_provider.cxx | 4 ++-- unotest/source/cpp/macros_test.cxx | 5 +++-- unotools/source/config/fontcfg.cxx | 2 +- unotools/source/config/itemholder1.cxx | 2 +- unotools/source/config/lingucfg.cxx | 2 +- unotools/source/config/moduleoptions.cxx | 2 +- unotools/source/config/pathoptions.cxx | 4 ++-- unotools/source/i18n/textsearch.cxx | 2 +- unotools/source/ucbhelper/ucblockbytes.cxx | 2 -- vbahelper/source/vbahelper/vbahelper.cxx | 2 +- vbahelper/source/vbahelper/vbashape.cxx | 4 ++-- vcl/inc/vclstatuslistener.hxx | 2 +- vcl/source/app/unohelp.cxx | 2 +- vcl/source/app/weldutils.cxx | 2 +- vcl/source/bitmap/BitmapTools.cxx | 2 +- vcl/source/control/managedmenubutton.cxx | 2 +- vcl/source/control/throbber.cxx | 2 +- vcl/source/filter/FilterConfigCache.cxx | 2 +- vcl/source/filter/FilterConfigItem.cxx | 2 +- vcl/source/filter/graphicfilter.cxx | 2 +- vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 2 +- vcl/source/gdi/gdimtf.cxx | 2 +- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- vcl/source/gdi/pdfwriter_impl2.cxx | 2 +- vcl/source/gdi/print3.cxx | 2 +- vcl/source/gdi/vectorgraphicdata.cxx | 4 ++-- vcl/source/outdev/outdev.cxx | 2 +- vcl/source/printer/Options.cxx | 2 +- vcl/source/text/textlayout.cxx | 2 +- vcl/source/treelist/transfer.cxx | 6 +++--- vcl/source/treelist/transfer2.cxx | 2 +- vcl/source/window/dialog.cxx | 6 +++--- vcl/source/window/window.cxx | 2 +- vcl/unx/generic/dtrans/X11_selection.cxx | 2 +- vcl/unx/gtk3/gtkframe.cxx | 4 ++-- xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 2 +- xmloff/source/chart/SchXMLExport.cxx | 2 +- xmloff/source/chart/SchXMLImport.cxx | 2 +- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 2 +- xmloff/source/chart/SchXMLSeries2Context.cxx | 2 +- xmloff/source/chart/SchXMLTools.cxx | 2 +- xmloff/source/core/DomBuilderContext.cxx | 2 +- xmloff/source/core/RDFaExportHelper.cxx | 2 +- xmloff/source/draw/animationimport.cxx | 2 +- xmloff/source/draw/shapeexport.cxx | 2 +- xmloff/source/meta/xmlversion.cxx | 4 ++-- xmloff/source/transform/EventOASISTContext.cxx | 2 +- xmloff/source/transform/OOo2Oasis.cxx | 2 +- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 2 +- .../source/dialogs/certificatechooser.cxx | 2 +- .../source/dialogs/digitalsignaturesdialog.cxx | 2 +- xmlsecurity/source/dialogs/macrosecurity.cxx | 2 +- .../xmlsec/nss/securityenvironment_nssimpl.cxx | 2 +- 304 files changed, 481 insertions(+), 466 deletions(-) diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 48476a687d34..4bada4d23ec1 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -184,7 +184,7 @@ uno::Reference MediaWindowImpl::createPlayer(const OUString& rUR // currently there isn't anything else, throw any mime type to the media players //if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); const OUString sToolkitName = Application::GetToolkitName(); if (sToolkitName == "gtk4") xPlayer = createPlayer(rURL, u"com.sun.star.comp.avmedia.Manager_Gtk"_ustr, xContext); 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 xContext(comphelper::getProcessComponentContext()); + const Reference& 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 xContext(::comphelper::getProcessComponentContext()); + const Reference& 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 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 xContext( ::comphelper::getProcessComponentContext() ); + const Reference& 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 & 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 xDialogSFact = [] { uno::Reference 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[] = diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 7912c2a723d6..260369cbab21 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -306,7 +306,7 @@ namespace basic // global constants // StarDesktop - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); pBasicManager->SetGlobalUNOConstant( u"StarDesktop"_ustr, css::uno::Any( Desktop::create(xContext))); // (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo) diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 2dbb00aa76ff..2e5142b21fc7 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -79,7 +79,7 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere } else { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< provider::XScriptProviderFactory > xFactory = provider::theMasterScriptProviderFactory::get( xContext ); @@ -405,7 +405,7 @@ css::uno::Reference< css::container::XNameContainer > implFindDialogLibForDialog void RTL_Impl_CreateUnoDialog( SbxArray& rPar ) { - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // We need at least 1 parameter if (rPar.Count() < 2) diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 521c09e273b5..5b1947b4f013 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -189,7 +189,7 @@ static Reference< XHierarchicalNameAccess > const & getTypeProvider_Impl() // Do we have already CoreReflection; if not obtain it if( !xAccess.is() ) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( xContext.is() ) { @@ -215,7 +215,7 @@ static Reference< XTypeConverter > const & getTypeConverter_Impl() // Do we have already CoreReflection; if not obtain it if( !xTypeConverter.is() ) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( xContext.is() ) { @@ -236,7 +236,7 @@ SbUnoObject* createOLEObject_Impl( const OUString& aType ) { static const Reference xOLEFactory = [] { Reference xFactory; - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( xContext.is() ) { Reference xSMgr = xContext->getServiceManager(); @@ -2388,7 +2388,7 @@ void SbUnoObject::doIntrospection() if( !bNeedIntrospection ) return; - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); if (!xContext.is()) return; @@ -4030,7 +4030,7 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool) return; // get the AllListenerAdapterService - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // search the class Reference< XIdlClass > xClass = xCoreReflection->forName( aListenerClassName ); @@ -4374,7 +4374,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const OUStrin { Reference< XInterface > xRet; - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); @@ -4486,7 +4486,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP // For now: Take first interface that allows to instantiate COM wrapper // TODO: Check if support for multiple interfaces is needed - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); Reference< XSingleServiceFactory > xComImplementsFactory diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 77eb427e5b49..a8ecb3a6df1a 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2596,7 +2596,7 @@ void SbUserFormModule::InitObject() Reference< script::vba::XVBACompatibility > xVBACompat( getVBACompatibility( m_xModel ), uno::UNO_SET_THROW ); xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::INITIALIZE_USERFORM, GetName() ); uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW ); - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); OUString sDialogUrl( u"vnd.sun.star.script:"_ustr ); OUString sProjectName( u"Standard"_ustr ); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index ac404d0b53e4..250149f807c9 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -132,7 +132,7 @@ void SbiStream::MapError() bool hasUno() { static const bool bRetVal = [] { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); if( !xContext.is() ) { // No service manager at all diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index de36b63f4356..6e5774b187d1 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1441,7 +1441,7 @@ void SbRtl_StrComp(StarBASIC *, SbxArray & rPar, bool) ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get(); if( !pTransliterationWrapper ) { - uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); GetSbData()->pTransliterationWrapper.reset( new ::utl::TransliterationWrapper( xContext, TransliterationFlags::IGNORE_CASE | @@ -4084,7 +4084,7 @@ void SbRtl_StrConv(StarBASIC *, SbxArray & rPar, bool) OUString aStr = rPar.Get(1)->GetOUString(); if (!aStr.isEmpty() && !aTranslitSet.empty()) { - uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); for (auto transliterationFlag : aTranslitSet) { diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 48cdfd36d628..f2466dabebc7 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -125,7 +125,7 @@ bool SfxDialogLibraryContainer::isLibraryElementValid(const Any& rElement) const static bool writeOasis2OOoLibraryElement( const Reference< XInputStream >& xInput, const Reference< XOutputStream >& xOutput ) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< lang::XMultiComponentFactory > xSMgr( diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx index 260c40eef2ca..e853f1ce49d1 100644 --- a/chart2/source/tools/StatisticsHelper.cxx +++ b/chart2/source/tools/StatisticsHelper.cxx @@ -121,7 +121,7 @@ void lcl_addSequenceToDataSource( const OUString & rRole ) { Reference< chart2::data::XDataSink > xSink( xDataSource, uno::UNO_QUERY ); - Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( ! xSink.is() ) return; diff --git a/comphelper/source/misc/accessibletexthelper.cxx b/comphelper/source/misc/accessibletexthelper.cxx index 02cd77fc766d..4a8bb3f3da78 100644 --- a/comphelper/source/misc/accessibletexthelper.cxx +++ b/comphelper/source/misc/accessibletexthelper.cxx @@ -59,7 +59,7 @@ namespace comphelper { if ( !m_xBreakIter.is() ) { - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_xBreakIter = i18n::BreakIterator::create(xContext); } diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 2422479ecc07..9710eaa3d66f 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -384,7 +384,7 @@ namespace // create content from current extension configuration uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< deployment::XExtensionManager > m_xExtensionManager = deployment::ExtensionManager::get(xContext); try @@ -505,7 +505,7 @@ namespace { if (DirectoryHelper::fileExists(aPath)) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< xml::dom::XDocumentBuilder > xBuilder(xml::dom::DocumentBuilder::create(xContext)); uno::Reference< xml::dom::XDocument > aDocument = xBuilder->parseURI(aPath); @@ -607,7 +607,7 @@ namespace if (!DirectoryHelper::fileExists(rUnoPackagReg)) return; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< xml::dom::XDocumentBuilder > xBuilder = xml::dom::DocumentBuilder::create(xContext); uno::Reference< xml::dom::XDocument > aDocument = xBuilder->parseURI(rUnoPackagReg); @@ -1879,7 +1879,7 @@ namespace comphelper if (!DirectoryHelper::fileExists(aRegistryModifications)) return; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< XDocumentBuilder > xBuilder = DocumentBuilder::create(xContext); uno::Reference< XDocument > xDocument = xBuilder->parseURI(aRegistryModifications); uno::Reference< XElement > xRootElement = xDocument->getDocumentElement(); diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx index d7b723c72574..6fa212ab7f05 100644 --- a/comphelper/source/misc/dispatchcommand.cxx +++ b/comphelper/source/misc/dispatchcommand.cxx @@ -39,7 +39,7 @@ bool dispatchCommand(const OUString& rCommand, const uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xParser = util::URLTransformer::create(xContext); xParser->parseStrict(aCommandURL); @@ -66,7 +66,7 @@ bool dispatchCommand(const OUString& rCommand, const uno::Reference& rArguments, const uno::Reference& rListener) { // Target where we will execute the .uno: command - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xDesktop = frame::Desktop::create(xContext); uno::Reference xFrame(xDesktop->getActiveFrame()); diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 202c56d7316a..d81c3625d5fa 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -921,7 +921,7 @@ void Connection::storeDatabase() Reference xDBStream( m_xEmbeddedStorage->openStreamElement(our_sFBKLocation, ElementModes::WRITE)); using namespace ::comphelper; - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference xInputStream; if (!xContext.is()) return; diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx index e1851a72506a..7b26d36a68b8 100644 --- a/cui/source/customize/CustomNotebookbarGenerator.cxx +++ b/cui/source/customize/CustomNotebookbarGenerator.cxx @@ -216,7 +216,7 @@ void CustomNotebookbarGenerator::getFileNameAndAppName(OUString& sAppName, if (!pFrame) return; - const auto xContext = comphelper::getProcessComponentContext(); + const auto& xContext = comphelper::getProcessComponentContext(); utl::OConfigurationTreeRoot aRoot(xContext, u"org.openoffice.Office.UI.ToolbarMode/"_ustr, false); const Reference& xFrame = pFrame->GetFrame().GetFrameInterface(); diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index 68d53b680a41..f04815570cf2 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -196,7 +196,8 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId const weld::TreeIter& rIter) { css::uno::Reference m_xCommandToLabelMap; - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext + = ::comphelper::getProcessComponentContext(); uno::Reference xNameAccess( css::frame::theUICommandDescription::get(xContext)); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 04db1bf78dca..feae0442ef90 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -302,7 +302,7 @@ SaveInData::SaveInData( bReadOnly = xDocPersistence->isReadOnly(); } - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< container::XNameAccess > xNameAccess( css::frame::theUICommandDescription::get(xContext) ); @@ -603,7 +603,7 @@ void MenuSaveInData::Apply( uno::Reference< container::XIndexContainer > const & rMenuBar, uno::Reference< lang::XSingleComponentFactory >& rFactory ) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); for (auto const& entryData : *GetEntries()) { @@ -630,7 +630,7 @@ void SaveInData::ApplyMenu( uno::Reference< lang::XSingleComponentFactory >& rFactory, SvxConfigEntry* pMenuData ) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); for (auto const& entry : *pMenuData->GetEntries()) { @@ -702,7 +702,7 @@ ContextMenuSaveInData::ContextMenuSaveInData( const OUString& aModuleId, bool bIsDocConfig ) : SaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bIsDocConfig ) { - css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); css::uno::Reference< css::container::XNameAccess > xConfig( css::ui::theWindowStateConfiguration::get( xContext ) ); xConfig->getByName( aModuleId ) >>= m_xPersistentWindowState; } @@ -1279,7 +1279,7 @@ OUString SvxConfigPage::GetFrameWithDefaultAndIdentify( uno::Reference< frame::X OUString sModuleID; try { - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( @@ -1974,7 +1974,7 @@ ToolbarSaveInData::ToolbarSaveInData( m_aDescriptorContainer ( ITEM_DESCRIPTOR_CONTAINER ) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); // Initialize the m_xPersistentWindowState variable which is used // to get the default properties of system toolbars such as name uno::Reference< container::XNameAccess > xPWSS = css::ui::theWindowStateConfiguration::get( xContext ); @@ -2413,7 +2413,7 @@ void ToolbarSaveInData::ApplyToolbar( uno::Reference< lang::XSingleComponentFactory >& rFactory, SvxConfigEntry const * pToolbarData ) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); for (auto const& entry : *pToolbarData->GetEntries()) { @@ -2742,7 +2742,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow, Size aSize(m_xTbSymbol->CalcWindowSizePixel(Size(m_nExpectedSize, m_nExpectedSize), 11, 5)); m_xTbSymbol->set_size_request(aSize.Width(), aSize.Height()); - uno::Reference< uno::XComponentContext > xComponentContext = + const uno::Reference< uno::XComponentContext >& xComponentContext = ::comphelper::getProcessComponentContext(); m_xGraphProvider.set( graphic::GraphicProvider::create( xComponentContext ) ); diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index 6fdf6c130319..12d1e4847397 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -317,7 +317,7 @@ void QrCodeGenDialog::Apply() SvMemoryStream aSvgStream(4096, 4096); aSvgStream.WriteOString(aSvgImage); Reference xInputStream(new utl::OSeekableInputStreamWrapper(aSvgStream)); - Reference xContext(comphelper::getProcessComponentContext()); + const Reference& xContext(comphelper::getProcessComponentContext()); Reference xProvider = css::graphic::GraphicProvider::create(xContext); Sequence aMediaProperties{ comphelper::makePropertyValue(u"InputStream"_ustr, diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx index 183fb04c82fb..a58e9298054d 100644 --- a/cui/source/dialogs/SignSignatureLineDialog.cxx +++ b/cui/source/dialogs/SignSignatureLineDialog.cxx @@ -119,7 +119,7 @@ SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Referenc IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void) { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); sfx2::FileDialogHelper aHelper(TemplateDescription::FILEOPEN_PREVIEW, FileDialogFlags::NONE, m_xDialog.get()); aHelper.SetContext(sfx2::FileDialogHelper::SignatureLine); diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 15f4e08ba2d3..1bf026e7d865 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -801,7 +801,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void) try { // setup folder picker - css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString aDlgPathName( SvtPathOptions().GetGraphicPath() ); diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index bf10d1df85b1..6fcc0ac9d7c6 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -383,7 +383,7 @@ void SvxHyperlinkNewDocTp::DoApply() IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void) { DisableClose( true ); - uno::Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, mpDialog->getDialog()); OUString aStrURL; diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index 814732173598..41d50c17b336 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -287,7 +287,7 @@ short SvInsertOleDlg::run() if ( !aFileName.isEmpty() ) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler2 > xInteraction( task::InteractionHandler::createWithParent(xContext, nullptr) ); diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 383c2ee1ab0b..abd8d56411fb 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -87,7 +87,7 @@ void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId) IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void) { - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); if ( xFolderPicker->execute() != ExecutableDialogResults::OK ) @@ -117,7 +117,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void) { - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); if ( xFolderPicker->execute() != ExecutableDialogResults::OK ) diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 017f1178be8b..bdde6fbeaef1 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -123,7 +123,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language ) deleteAllTree(); Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext > xCtx( + const Reference< XComponentContext >& xCtx( comphelper::getProcessComponentContext() ); Sequence< Reference< browse::XBrowseNode > > children; diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx index 22b669ccae75..86b84c688e8b 100644 --- a/cui/source/dialogs/tipofthedaydlg.cxx +++ b/cui/source/dialogs/tipofthedaydlg.cxx @@ -174,7 +174,7 @@ void TipOfTheDayDialog::UpdateTip() { css::util::URL aCommandURL; aCommandURL.Complete = sLink; - const css::uno::Reference xContext + const css::uno::Reference& xContext = comphelper::getProcessComponentContext(); const css::uno::Reference xParser = css::util::URLTransformer::create(xContext); diff --git a/cui/source/dialogs/toolbarmodedlg.cxx b/cui/source/dialogs/toolbarmodedlg.cxx index 25cd4a7b9ac0..1d91a8b6f5cc 100644 --- a/cui/source/dialogs/toolbarmodedlg.cxx +++ b/cui/source/dialogs/toolbarmodedlg.cxx @@ -35,7 +35,7 @@ static OUString GetCurrentApp() if (SfxViewFrame* pViewFrame = SfxViewFrame::Current()) { const auto xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface(); - const auto xContext = comphelper::getProcessComponentContext(); + const auto& xContext = comphelper::getProcessComponentContext(); const auto xModuleManager = css::frame::ModuleManager::create(xContext); switch (vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xCurrentFrame))) { @@ -69,7 +69,7 @@ static OUString GetCurrentMode() OUString sResult; if (SfxViewFrame::Current()) { - const auto xContext = comphelper::getProcessComponentContext(); + const auto& xContext = comphelper::getProcessComponentContext(); const utl::OConfigurationTreeRoot aAppNode( xContext, "org.openoffice.Office.UI.ToolbarMode/Applications/" + GetCurrentApp(), true); if (aAppNode.isValid()) @@ -190,7 +190,7 @@ IMPL_LINK(ToolbarmodeDialog, OnApplyClick, weld::Button&, rButton, void) OUString sCurrentApp = GetCurrentApp(); if (SfxViewFrame::Current()) { - const auto xContext = comphelper::getProcessComponentContext(); + const auto& xContext = comphelper::getProcessComponentContext(); const utl::OConfigurationTreeRoot aAppNode( xContext, u"org.openoffice.Office.UI.ToolbarMode/Applications/"_ustr, true); if (sCurrentApp != "Writer") diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index ed24e4904af2..0a0a10e0ea6f 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -50,7 +50,7 @@ void CertPathDialog::Init() try { - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xCipherContextSupplier = xml::crypto::NSSInitializer::create(xContext); OUString sActivePath = xCipherContextSupplier->getNSSPath(); @@ -138,7 +138,7 @@ bool CertPathDialog::isActiveServicePath() const try { - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xCipherContextSupplier = xml::crypto::NSSInitializer::create(xContext); if (!xCipherContextSupplier->getIsNSSinitialized()) diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx index 32c5cd7033e0..779adb27218f 100644 --- a/cui/source/options/connpooloptions.cxx +++ b/cui/source/options/connpooloptions.cxx @@ -73,7 +73,7 @@ namespace offapp }; m_xDriverList->set_column_fixed_widths(aWidths); - css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference < css::uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); m_xEnablePooling->connect_toggled( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx index 9c087d2823d0..737170a17f8a 100644 --- a/cui/source/options/dbregisterednamesconfig.cxx +++ b/cui/source/options/dbregisterednamesconfig.cxx @@ -39,7 +39,7 @@ namespace svx try { - Reference xContext( ::comphelper::getProcessComponentContext() ); + const Reference& xContext( ::comphelper::getProcessComponentContext() ); Reference< XDatabaseContext > xRegistrations( DatabaseContext::create(xContext) ); diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx index 4d4c17c2a409..76d8126a9b50 100644 --- a/cui/source/options/doclinkdialog.cxx +++ b/cui/source/options/doclinkdialog.cxx @@ -57,7 +57,7 @@ namespace svx m_xURL->DisableHistory(); m_xURL->SetFilter(u"*.odb"); - css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference < css::uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); m_xName->connect_changed( LINK(this, ODocumentLinkDialog, OnEntryModified) ); diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 1dd1874c820e..9480b2de5e8f 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -703,7 +703,8 @@ void CuiAboutConfigTabPage::FillItems(const Reference& xNameAccess, Reference CuiAboutConfigTabPage::getConfigAccess(const OUString& sNodePath, bool bUpdate) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + ::comphelper::getProcessComponentContext()); uno::Reference xConfigProvider( css::configuration::theDefaultProvider::get(xContext)); diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index b2c6b5a1e49b..9f5397411286 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -464,7 +464,7 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(weld::Window* pTopLevel, weld::Co , m_xWidget1(m_xBuilder->weld_widget(u"docboundaries"_ustr)) , m_xWidget2(m_xBuilder->weld_widget(u"docboundaries_lb"_ustr)) { - css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference < css::uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); CreateEntries(); diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 6b84062337a4..6550b52fef66 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1451,7 +1451,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) // tell quickstarter to stop being a veto listener - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext()); css::office::Quickstart::createAndSetVeto(xContext, false, false, false/*DisableVeto*/); } diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 323fb34d3b6b..f8cb0657d393 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -160,7 +160,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, weld::Button&, void) { try { - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString sWorkFolder = SvtPathOptions().GetWorkPath(); @@ -873,7 +873,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void) { - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); OUString sOldFolder; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 7381c4d190e3..15a0842e386a 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -524,7 +524,7 @@ static void lcl_MergeDisplayArray( SvxLinguData_Impl::SvxLinguData_Impl() : nDisplayServices (0) { - uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); xLinguSrvcMgr = LinguServiceManager::create(xContext); const Locale& rCurrentLocale = Application::GetSettings().GetUILanguageTag().getLocale(); @@ -1609,7 +1609,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r if (m_xLanguageLB->get_active_id() != eSysLang) m_xLanguageLB->set_active(0); - css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference < css::uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); m_xLanguageLB->connect_changed( LINK( this, SvxEditModulesDlg, LangSelectListBoxHdl_Impl )); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 6357989e5fb9..949627151b8e 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -543,7 +543,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void) { try { - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); INetURLObject aURL( sWritable, INetProtocol::File ); @@ -608,7 +608,7 @@ void SvxPathTabPage::GetPathList( // load PathSettings service if necessary if ( !pImpl->m_xPathSettings.is() ) { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); pImpl->m_xPathSettings = css::util::thePathSettings::get( xContext ); } @@ -666,7 +666,7 @@ void SvxPathTabPage::SetPathList( // load PathSettings service if necessary if ( !pImpl->m_xPathSettings.is() ) { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); pImpl->m_xPathSettings = css::util::thePathSettings::get( xContext ); } diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 9b8a416dead3..2db1bcb52aaa 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -91,7 +91,7 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(weld::Container* pPage, weld::Dia + "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47()); - uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference < uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext ); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); @@ -444,7 +444,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Toggleable&, IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, weld::Button&, void) { - uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference < uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString aURL; @@ -464,7 +464,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, weld::Button&, void) { - uno::Reference < uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference < uno::XComponentContext>& xContext( ::comphelper::getProcessComponentContext() ); try { diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx index 0ddd7f8f9f08..0efb1a353504 100644 --- a/cui/source/options/sdbcdriverenum.cxx +++ b/cui/source/options/sdbcdriverenum.cxx @@ -50,7 +50,7 @@ namespace offapp { try { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XDriverManager2 > xEnumAccess = DriverManager::create( xContext ); Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration(); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index d531e0a59d68..15a6b2803021 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1621,7 +1621,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) bool bSaveSpellCheck = false; const SfxPoolItem* pItem = nullptr; - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XLinguProperties > xProp = LinguProperties::create( xContext ); if ( const SfxHyphenRegionItem* pHyphenItem = rSet.GetItemIfSet(SID_ATTR_HYPHENREGION, false ) ) { @@ -2271,7 +2271,7 @@ OUString OfaTreeOptionsDialog::GetModuleIdentifier( const Reference< XFrame >& r { OUString sModule; Reference < XFrame > xCurrentFrame( rFrame ); - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext); if ( !xCurrentFrame.is() ) diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 8dbeef741575..a2edb611a07c 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -127,7 +127,7 @@ void SchemaParser::parseSchema() Reference xStream(m_rStorage->openStreamElement(SCHEMA_FILENAME, ElementModes::READ)); - Reference rContext = comphelper::getProcessComponentContext(); + const Reference& rContext = comphelper::getProcessComponentContext(); Reference xTextInput = TextInputStream::create(rContext); xTextInput->setEncoding(u"UTF-8"_ustr); xTextInput->setInputStream(xStream->getInputStream()); diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index f6153be992d8..c0ebd91ef87a 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -381,7 +381,7 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) css::uno::Any(comphelper::makePropertyValue( u"IsContextMenu"_ustr, true )) }; - css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); css::uno::Reference xMenuController (xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext), css::uno::UNO_QUERY); diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index 0c8dfa901c5b..58f12c9e01a0 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -59,7 +59,7 @@ namespace dbaui do { // Retrieve popup menu labels - Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); if ( !xContext.is() ) break; diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index c7bbaf22b88d..54da4c0cf7b0 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -274,7 +274,7 @@ namespace dbaui if (eType == ::dbaccess::DST_THUNDERBIRD) profileType = MozillaProductType_Thunderbird; - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); Reference xMozillaBootstrap = MozillaBootstrap::create(xContext); // collect all Mozilla Profiles diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e6a2feca09ff..c38fd40944ee 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -964,7 +964,7 @@ void handleCrashReport() #if !defined ANDROID void handleSafeMode() { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::frame::XSynchronousDispatch > xSafeModeUI( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.svx.SafeModeUI"_ustr, xContext), @@ -1033,7 +1033,7 @@ bool impl_callRecoveryUI(bool bEmergencySave , static constexpr OUStringLiteral COMMAND_EMERGENCYSAVE = u"vnd.sun.star.autorecovery:/doEmergencySave"; static constexpr OUStringLiteral COMMAND_RECOVERY = u"vnd.sun.star.autorecovery:/doAutoRecovery"; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); g_xRecoveryUI.set( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.svx.RecoveryUI"_ustr, xContext), @@ -1375,7 +1375,7 @@ int Desktop::Main() recordTime(startT, "SetSplashScreenProgress(20): time = "); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XRestartManager > xRestartManager( OfficeRestartManager::get(xContext) ); @@ -2338,7 +2338,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) case ApplicationEvent::Type::Appear: if ( !GetCommandLineArgs().IsInvisible() && !impl_bringToFrontRecoveryUI() ) { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); // find active task - the active task is always a visible task Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); @@ -2427,7 +2427,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // NOTICE: The quickstart service must be initialized inside the "main thread", so we use the // application events to do this (they are executed inside main thread)!!! // Don't start quickstart service if the user specified "--invisible" on the command line! - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::office::Quickstart::createStart(xContext, true/*Quickstart*/); } break; @@ -2437,7 +2437,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // The user will try it again, in case nothing happens .-) try { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); @@ -2512,7 +2512,7 @@ void Desktop::OpenSplashScreen() aSplashService = "com.sun.star.office.PipeSplashScreen"; Sequence< Any > aSeq{ Any(true) /* bVisible */, Any(aAppName) }; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_rSplashScreen.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aSplashService, aSeq, xContext), UNO_QUERY); @@ -2583,7 +2583,7 @@ void Desktop::ShowBackingComponent(Desktop * progress) { return; } - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); if (progress != nullptr) { diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 6c7637f32f9e..a9d70d3da45a 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -228,7 +228,7 @@ void Desktop::createAcceptor(const OUString& aAcceptString) } Sequence< Any > aSeq{ Any(aAcceptString), Any(bAccept) }; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference rAcceptor( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.office.Acceptor"_ustr, xContext), UNO_QUERY ); diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 52047e0230fb..90446384f311 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -381,7 +381,7 @@ bool Desktop::CheckExtensionDependencies() return false; } - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext()); bool bDependenciesValid = impl_checkDependencies( xContext ); @@ -402,7 +402,7 @@ bool Desktop::CheckExtensionDependencies() void Desktop::SynchronizeExtensionRepositories(bool bCleanedExtensionCache, Desktop* pDesktop) { - uno::Reference< uno::XComponentContext > context( + const uno::Reference< uno::XComponentContext >& context( comphelper::getProcessComponentContext()); uno::Reference< ucb::XCommandEnvironment > silent( new SilentCommandEnv(context, pDesktop)); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 2f5524ae2d68..faf830ffae3c 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -102,7 +102,7 @@ std::shared_ptr impl_lookupExportFilterForUrl( std::u16string_v ":eflags=" + OUString::number(static_cast(SFX_FILTER_NOTINSTALLED)); - const Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); const Reference< XContainerQuery > xFilterFactory( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.document.FilterFactory"_ustr, xContext ), UNO_QUERY_THROW ); @@ -134,7 +134,7 @@ std::shared_ptr impl_getExportFilterFromUrl( { try { - const Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); const Reference< document::XTypeDetection > xTypeDetector( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.document.TypeDetection"_ustr, xContext ), UNO_QUERY_THROW ); diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 896c181f5807..23733bd349aa 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -74,7 +74,7 @@ int MyApp::Main() void MyApp::DeInit() { - css::uno::Reference< css::uno::XComponentContext > context( + const css::uno::Reference< css::uno::XComponentContext >& context( comphelper::getProcessComponentContext()); dp_misc::disposeBridges(context); css::uno::Reference< css::lang::XComponent >( diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 5d22ca840585..9117fdfd1048 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -619,7 +619,7 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, util::URL aURL; xNameAccess->getByName(u"URL"_ustr) >>= aURL.Complete; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < util::XURLTransformer > xTransformer = util::URLTransformer::create(xContext); xTransformer->parseStrict(aURL); diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 0da83782f1f9..73000af5ddb6 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -296,7 +296,7 @@ namespace dp_misc { DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL) { Reference< css::xml::dom::XNode > root; - Reference context( + const Reference& context( comphelper::getProcessComponentContext()); try { root = diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index c5ecbdd7dd02..439265546ae7 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -201,7 +201,7 @@ bool MigrationImpl::doMigration() OUString aOldCfgDataPath = m_aInfo.userdata + "/user/config/soffice.cfg/modules/" + i.sModuleShortName; uno::Sequence< uno::Any > lArgs {uno::Any(aOldCfgDataPath), uno::Any(embed::ElementModes::READ)}; - uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(comphelper::getProcessComponentContext()); uno::Reference< lang::XSingleServiceFactory > xStorageFactory(embed::FileSystemStorageFactory::create(xContext)); uno::Reference< embed::XStorage > xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); uno::Reference< ui::XUIConfigurationManager2 > xOldCfgManager = ui::UIConfigurationManager::create(xContext); @@ -868,7 +868,7 @@ void MigrationImpl::runServices() // and execute the migration job uno::Reference< XJob > xMigrationJob; - uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(comphelper::getProcessComponentContext()); for (auto const& rMigration : *m_vrMigrations) { if( !rMigration.service.isEmpty()) { diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 733ccbaad014..28d5b5d1d1c2 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d if(aUnoControlTypeName.isEmpty()) return; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< awt::XControl > xXControl( xContext->getServiceManager()->createInstanceWithContext(aUnoControlTypeName, xContext), uno::UNO_QUERY); diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx index 792a77e78195..121e44ec8759 100644 --- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx +++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx @@ -199,7 +199,7 @@ namespace drawinglayer::primitive2d if(!xBreakIterator.is()) { - css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); xBreakIterator = css::i18n::BreakIterator::create(xContext); } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 5d8c73b9d028..86e2a6237aee 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1502,7 +1502,7 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( // support for TEXT_ MetaFile actions only for decorated texts if (!gxBreakIterator.get() || !gxBreakIterator.get()->get()) { - uno::Reference xContext( + const uno::Reference& xContext( ::comphelper::getProcessComponentContext()); gxBreakIterator.set(i18n::BreakIterator::create(xContext)); } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 12289ba018ca..f74d7664d305 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4737,7 +4737,7 @@ Reference < i18n::XBreakIterator > const & ImpEditEngine::ImplGetBreakIterator() { if (!mxBI.is()) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); mxBI = i18n::BreakIterator::create(xContext); } return mxBI; @@ -4747,7 +4747,7 @@ Reference < i18n::XExtendedInputSequenceChecker > const & ImpEditEngine::ImplGet { if (!mxISC.is()) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); mxISC = i18n::InputSequenceChecker::create(xContext); } return mxISC; diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index cd4a2e93146d..8f9f52966041 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -75,7 +75,7 @@ static void lcl_getFormatter(css::uno::Reference try { - Reference xContext( ::comphelper::getProcessComponentContext() ); + const Reference& xContext( ::comphelper::getProcessComponentContext() ); Reference xRet = text::DefaultNumberingProvider::create(xContext); _xFormatter.set(xRet, UNO_QUERY); } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 0c3540051e49..1453f9f91921 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2350,7 +2350,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( } else { - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; @@ -2423,7 +2423,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( xStrm->SetProperty( u"MediaType"_ustr, Any(u"text/xml"_ustr) ); - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); @@ -2464,7 +2464,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() { uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ ); uno::Reference < io::XStream > xStrm = xStg->openStreamElement( pXMLImplAutocorr_ListStr, embed::ElementModes::READ ); - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; aParserInput.sSystemId = pXMLImplAutocorr_ListStr; @@ -2763,7 +2763,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) refList->SetBufferSize( 8192 ); refList->SetProperty( u"MediaType"_ustr, Any(u"text/xml"_ustr) ); - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index bb256e0bba60..aa21b592edbe 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -56,7 +56,7 @@ using namespace ::com::sun::star::linguistic2; static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create(xContext); return xRes; } @@ -402,7 +402,7 @@ LinguMgrExitLstnr::LinguMgrExitLstnr() // add object to frame::Desktop EventListeners in order to properly call // the AtExit function at application exit. - uno::Reference< XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< XComponentContext >& xContext = getProcessComponentContext(); xDesktop = Desktop::create( xContext ); xDesktop->addEventListener( this ); } diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 083e868bd34d..feab612a9d9d 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -291,7 +291,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& do { // create service factory - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); // create document handler uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext ); diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index 8e32d8f62045..ba2c8ba5002d 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -162,7 +162,7 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection { do { - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); xml::sax::InputSource aParserInput; aParserInput.aInputStream = new utl::OInputStreamWrapper(rStream); diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 82013fecea3d..f48124eda8d1 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -346,7 +346,7 @@ namespace abp { // Embed. OUString aStreamRelPath = u"EmbeddedDatabase"_ustr; - auto xContext(comphelper::getProcessComponentContext()); + const auto& xContext(comphelper::getProcessComponentContext()); auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(aOwnURL); assert(xUri.is()); xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)->createVndSunStarPkgUrlReference(xUri); diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx index 0fa2a4b1ec7d..e6694f557910 100644 --- a/extensions/source/bibliography/bibbeam.cxx +++ b/extensions/source/bibliography/bibbeam.cxx @@ -125,7 +125,7 @@ namespace bib if( !m_xControlContainer.is()) return; - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); if ( !m_xGridModel.is()) return; diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 499ab41aeeea..47244a595763 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -283,7 +283,7 @@ const Sequence& DBChangeDialogConfig_Impl::GetDataSourceNames() { if(!aSourceNames.hasElements()) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference xDBContext = DatabaseContext::create(xContext); aSourceNames = xDBContext->getElementNames(); } diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 5ad672660aea..f3a521983fda 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -81,7 +81,7 @@ static Reference< XConnection > getConnection(const OUString& _rURL) // first get the sdb::DataSource corresponding to the url Reference< XDataSource > xDataSource; // is it a favorite title ? - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference< XDatabaseContext > xNamingContext = DatabaseContext::create(xContext); if (xNamingContext->hasByName(_rURL)) { @@ -1198,7 +1198,7 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel( else aInstanceName += getControlName(nFormatKey); - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< XInterface > xObject = xContext->getServiceManager()->createInstanceWithContext(aInstanceName, xContext); xModel.set( xObject, UNO_QUERY ); Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); @@ -1364,7 +1364,7 @@ uno::Reference< form::runtime::XFormController > const & BibDataManager::GetForm { if(!m_xFormCtrl.is()) { - Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); m_xFormCtrl = form::runtime::FormController::create(xContext); m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY)); m_xFormDispatch.set( m_xFormCtrl, UNO_QUERY); diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index c547fa99f33d..8a5ce26e7e74 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -444,7 +444,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { try { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); // create the dialog object uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(xContext, m_xDatMan->getParser(), diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index 8e7d3e0699e6..702c29898fa7 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -311,7 +311,7 @@ namespace pcr Reference xGraphic; try { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) ); Sequence aMediaProperties{ comphelper::makePropertyValue(u"URL"_ustr, rImageURL) }; diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 043f8bb2f0b3..d39fc7c2ddda 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -2774,7 +2774,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem ( new ::comphelper::SequenceInputStream( aXMLDataSeq ) ); try { - css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); css::uno::Reference< css::embed::XStorage > xStorage ( ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xContext, true ) ); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 492a36b8c707..f7b30e5b446e 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -666,7 +666,7 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOStm) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ; + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ) ; bool bRet = false; // Instead of writing to rxOStm directly, we write here in case we need // to compress the output later @@ -790,7 +790,7 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOSt bool SVGFilter::implExportWriterOrCalc( const Reference< XOutputStream >& rxOStm ) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ; + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ) ; bool bRet = false; if( rxOStm.is() ) diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx index add8d4350ac7..4b9b43065acd 100644 --- a/forms/source/xforms/computedexpression.cxx +++ b/forms/source/xforms/computedexpression.cxx @@ -153,7 +153,7 @@ Reference ComputedExpression::_getXPathAPI(const xforms::EvaluationCo Reference xXPath( XPathAPI::create( comphelper::getProcessComponentContext() ) ); // register xforms extension# - Reference< XComponentContext > aComponentContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& aComponentContext = comphelper::getProcessComponentContext(); Reference< XXPathExtension > aExtension = XPathExtension::createWithModel(aComponentContext, aContext.mxModel, aContext.mxContextNode); xXPath->registerExtensionInstance(aExtension); diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 631d75a06a7e..14924db31ee6 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -50,7 +50,7 @@ CSubmission::SubmissionResult CSubmission::replace(std::u16string_view aReplace, return CSubmission::UNKNOWN_ERROR; try { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); if (o3tl::equalsIgnoreAsciiCase(aReplace, u"all") || o3tl::equalsIgnoreAsciiCase(aReplace, u"document")) { Reference< XComponentLoader > xLoader; diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index da874eb51d86..b7eb966e2b58 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -442,7 +442,7 @@ ViewTabListBox_Impl::ViewTabListBox_Impl(std::unique_ptr xTreeVi maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT ); maResetQuickSearch.SetInvokeHandler( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) ); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler( InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW); @@ -798,7 +798,7 @@ SvtFileView::SvtFileView(weld::Window* pTopLevel, if ( bShowType ) nFlags |= FileViewFlags::SHOW_TYPE; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler( InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW); Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); diff --git a/fpicker/source/office/foldertree.cxx b/fpicker/source/office/foldertree.cxx index b658970b5f41..a3947ee8f0a1 100644 --- a/fpicker/source/office/foldertree.cxx +++ b/fpicker/source/office/foldertree.cxx @@ -27,7 +27,7 @@ FolderTree::FolderTree(std::unique_ptr xTreeView, weld::Window* m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 24, m_xTreeView->get_height_rows(7)); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler( InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW); m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index 36f581232daf..b5bf362619c5 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -75,7 +75,7 @@ namespace svt void SmartContent::enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::EInterceptedInteractions eInterceptions) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler( InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW ); @@ -90,7 +90,7 @@ namespace svt { m_xOwnInteraction.clear(); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler( InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 64f11a7674ed..ba2a63675ba4 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -113,7 +113,7 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); OUString sModule = xModuleMgr->identify(m_xReferenceFrame); m_bReferenceIsBacking = sModule == "com.sun.star.frame.StartModule"; @@ -184,7 +184,7 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); OUString sModule = xModuleMgr->identify(xFrame); if (sModule == "com.sun.star.frame.StartModule") diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 87e4a7fb2e81..72a81bc774db 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -331,7 +331,7 @@ void SAL_CALL OReadMenuBarHandler::startElement( m_bMenuMode = true; // Container must be factory to create sub container - Reference< XComponentContext > xComponentContext( + const Reference< XComponentContext >& xComponentContext( comphelper::getProcessComponentContext() ); Reference< XIndexContainer > xSubItemContainer; diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 8644415d015a..994d2f7306cd 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -614,7 +614,7 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString& } // following operations can work on an internal type name only :-( - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::document::XTypeDetection > xDetect( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.document.TypeDetection"_ustr, xContext), diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx index 6d1edf6cc1d6..f1564d5bf767 100644 --- a/framework/source/uielement/thesaurusmenucontroller.cxx +++ b/framework/source/uielement/thesaurusmenucontroller.cxx @@ -95,7 +95,7 @@ void ThesaurusMenuController::fillPopupMenu() { try { - css::uno::Reference xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference& xContext(::comphelper::getProcessComponentContext()); css::uno::Reference xProvider(css::graphic::GraphicProvider::create(xContext)); xGraphic = xProvider->queryGraphic({ comphelper::makePropertyValue(u"URL"_ustr, aSynonymsImageUrl) }); } diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx index 1b6c9964b698..4abf30394e68 100644 --- a/framework/source/uielement/toolbarmodemenucontroller.cxx +++ b/framework/source/uielement/toolbarmodemenucontroller.cxx @@ -84,7 +84,7 @@ void ToolbarModeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > SolarMutexGuard aSolarMutexGuard; resetPopupMenu( rPopupMenu ); - const Reference xContext (::comphelper::getProcessComponentContext() ); + const Reference& xContext (::comphelper::getProcessComponentContext() ); const Reference xModuleManager = frame::ModuleManager::create( xContext ); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame)); diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 36c5ccc72f46..6cca7b51320a 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -244,7 +244,7 @@ static OUString transliterate_titlecase_Impl( OUString aRes; if (!aText.isEmpty()) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); rtl::Reference< CharacterClassificationImpl > xCharClassImpl( new CharacterClassificationImpl( xContext ) ); // because xCharClassImpl.toTitle does not handle ligatures or Beta but will raise diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index f2e311b1a432..cc35bf3aa84d 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -71,7 +71,7 @@ using namespace linguistic; static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ; return xRes; } diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index e20c0fc74d7e..448a7eea6118 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -61,7 +61,7 @@ using namespace linguistic; static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ; return xRes; } diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index ac1f7436e572..db5474246e20 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -68,7 +68,7 @@ static void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport return; DBG_ASSERT(!INetURLObject( rMainURL ).HasError(), "invalid URL"); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // get xInputStream stream uno::Reference< io::XInputStream > xIn; @@ -207,7 +207,7 @@ void ConvDic::Save() return; DBG_ASSERT(!INetURLObject( aMainURL ).HasError(), "invalid URL"); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // get XOutputStream stream uno::Reference< io::XStream > xStream; diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 6bcda95bbc10..9c243c794933 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -88,7 +88,7 @@ const sal_Int16 DIC_VERSION_7 = 7; static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ; return xRes; } @@ -273,7 +273,7 @@ ErrCode DictionaryNeo::loadEntries(const OUString &rMainURL) if (rMainURL.isEmpty()) return ERRCODE_NONE; - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // get XInputStream stream uno::Reference< io::XInputStream > xStream; @@ -407,7 +407,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL) return ERRCODE_NONE; DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL"); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // get XOutputStream stream uno::Reference xStream; diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index fe8b2e2a878c..dd436233de04 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -761,7 +761,7 @@ static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& return false; // get stream to be used - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // get XInputStream stream uno::Reference< io::XInputStream > xStream; diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 36bcdcc72119..ab6d665af771 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -564,7 +564,7 @@ uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarC { try { - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< linguistic2::XProofreader > xGC( xContext->getServiceManager()->createInstanceWithContext(aSvcImplName, xContext), uno::UNO_QUERY_THROW ); @@ -883,7 +883,7 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence( if (!m_xBreakIterator.is()) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_xBreakIterator = i18n::BreakIterator::create(xContext); } sal_Int32 nTextLen = rText.getLength(); @@ -1095,7 +1095,7 @@ uno::Reference< util::XChangesBatch > const & GrammarCheckingIterator::GetUpdate try { // get configuration provider - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = configuration::theDefaultProvider::get( xContext ); diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index 677fe74f9ff4..ee45990351bc 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -345,7 +345,7 @@ Reference< XHyphenatedWord > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument @@ -477,7 +477,7 @@ Reference< XHyphenatedWord > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument @@ -599,7 +599,7 @@ Reference< XPossibleHyphens > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 71eae948e3a4..607a60cb281f 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -70,7 +70,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales( { uno::Sequence< lang::Locale > aRes; - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( rSvcImplNames.hasElements() ) { std::set< LanguageType > aLanguages; @@ -417,7 +417,7 @@ LngSvcMgr::LngSvcMgr() aUpdateIdle.SetInvokeHandler(LINK(this, LngSvcMgr, updateAndBroadcast)); // request to be notified if an extension has been added/removed - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext(comphelper::getProcessComponentContext()); uno::Reference xExtensionManager; try { @@ -935,7 +935,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl() pAvailSpellSvcs.emplace(); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY ); uno::Reference< container::XEnumeration > xEnum; @@ -989,7 +989,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl() pAvailGrammarSvcs.emplace(); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY ); uno::Reference< container::XEnumeration > xEnum; @@ -1047,7 +1047,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl() return; pAvailHyphSvcs.emplace(); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY ); uno::Reference< container::XEnumeration > xEnum; @@ -1099,7 +1099,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl() pAvailThesSvcs.emplace(); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY ); uno::Reference< container::XEnumeration > xEnum; diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 87e9fa397b9b..088cde001f20 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -672,7 +672,7 @@ uno::Reference< XLinguProperties > GetLinguProperties() uno::Reference< XSearchableDictionaryList > GetDictionaryList() { - uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< XSearchableDictionaryList > xRef; try { @@ -705,7 +705,7 @@ AppExitListener::AppExitListener() { // add object to Desktop EventListeners in order to properly call // the AtExit function at application exit. - uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); try { diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx index 86a81e5a1f06..6464a0cbce74 100644 --- a/linguistic/source/misc2.cxx +++ b/linguistic/source/misc2.cxx @@ -86,7 +86,7 @@ static std::vector< OUString > GetMultiPaths_Impl( OUString aWritablePath; bool bSuccess = true; - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); try { OUString aInternal( OUString::Concat(rPathPrefix) + "_internal" ); diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 32bdb21803d1..612ed2bc04a8 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -341,7 +341,7 @@ bool SpellCheckerDispatcher::isValid_Impl( const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray(); Reference< XSpellChecker > *pRef = pEntry->aSvcRefs .getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument @@ -522,7 +522,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray(); Reference< XSpellChecker > *pRef = pEntry->aSvcRefs .getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index f4c21bfdf524..ced14c22a6d2 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -144,7 +144,7 @@ Sequence< Reference< XMeaning > > SAL_CALL const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray(); Reference< XThesaurus > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // build service initialization argument diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx index 37fe97e3cbd7..327524b655fa 100644 --- a/oox/source/drawingml/diagram/diagramhelper.cxx +++ b/oox/source/drawingml/diagram/diagramhelper.cxx @@ -100,7 +100,7 @@ void AdvancedDiagramHelper::reLayout(SdrObjGroup& rTarget) // here. XShape creation may be isolated in the future. SdrModel& rModel(rTarget.getSdrModelFromSdrObject()); uno::Reference< uno::XInterface > const & rUnoModel(rModel.getUnoModel()); - css::uno::Reference xContext(comphelper::getProcessComponentContext()); + const css::uno::Reference& xContext(comphelper::getProcessComponentContext()); rtl::Reference xFilter(new oox::shape::ShapeFilterBase(xContext)); // set oox::Theme at Filter. All LineStyle/FillStyle/Colors/Attributes diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index b36f1cd07743..385f61509e8e 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -804,7 +804,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference& //TODO: pass XIntrospection to ReadFromAddIn - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xIntro = beans::theIntrospection::get( xContext ); uno::Any aObject; @@ -1086,7 +1086,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xIntro = beans::theIntrospection::get(xContext); uno::Any aObject; diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 1bd34e27e43d..aae72134bf0d 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -87,7 +87,7 @@ static rtl::Reference lcl_DRMDecrypt(const SfxMedium& rMedium, const // We have DRM encrypted storage. We should try to decrypt it first, if we can uno::Sequence< uno::Any > aArguments; - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference< packages::XPackageEncryption > xPackageEncryption( xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.oox.crypto.DRMDataSpace"_ustr, aArguments, xComponentContext), uno::UNO_QUERY); @@ -276,7 +276,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, if (sCryptoType.getLength()) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Sequence aArguments{ uno::Any(beans::NamedValue(u"Binary"_ustr, uno::Any(true))) }; xPackageEncryption.set( diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 9330189c5de9..248e4589971e 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -350,7 +350,7 @@ void ImportExcel8::ReadBasic() } try { - uno::Reference< uno::XComponentContext > aCtx( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& aCtx( ::comphelper::getProcessComponentContext() ); SfxMedium& rMedium = GetMedium(); uno::Reference< io::XInputStream > xIn = rMedium.GetInputStream(); oox::ole::OleStorage root( aCtx, xIn, false ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 096f872fe7b2..06505c35fad3 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -2364,7 +2364,7 @@ bool XclImpChType::HasCategoryLabels() const Reference< XCoordinateSystem > XclImpChType::CreateCoordSystem( bool b3dChart ) const { // create the coordinate system object - Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< XCoordinateSystem > xCoordSystem; if( maTypeInfo.mbPolarCoordSystem ) { diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index 8e56abde5733..33de884957b1 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -418,7 +418,7 @@ void ScCTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh ) if(rCTB.empty()) return; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( ui::theModuleUIConfigurationManagerSupplier::get(xContext) ); for ( auto& rItem : rCTB ) diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 2bab3ae9a43e..86ff69d0ec2d 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -281,7 +281,7 @@ ErrCodeMsg ScXMLImportWrapper::ImportFromComponent(const uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; if (pMedium) @@ -722,7 +722,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly) if (pDrawLayer) pDrawLayer->setLock(bOldLock); - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext(comphelper::getProcessComponentContext()); uno::Reference xWriter = xml::sax::Writer::create(xContext); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 4b502120e369..d3e184eb2029 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -841,7 +841,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) try { - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), @@ -3211,7 +3211,7 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType ) { using namespace ::com::sun::star::ui; - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); if (!xContext.is()) return; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 1ae715a12276..6df8ec07d8e8 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -113,7 +113,7 @@ namespace aURL.removeSegment(); aURL.removeFinalSlash(); OUString aPath = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); _rDrvMgr.set( sdbc::DriverManager::create( xContext ) ); diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index f6d3182e1759..f77c49e64677 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -474,7 +474,7 @@ SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::share if (pInteractionParent) { - css::uno::Reference xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = comphelper::getProcessComponentContext(); css::uno::Reference xIHdl(css::task::InteractionHandler::createWithParent(xContext, pInteractionParent->GetXWindow()), css::uno::UNO_QUERY_THROW); pSet->Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, css::uno::Any(xIHdl))); diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx index 7b3ac25c9ada..4c88057ec60f 100644 --- a/sc/source/ui/miscdlgs/solverutil.cxx +++ b/sc/source/ui/miscdlgs/solverutil.cxx @@ -42,7 +42,7 @@ void ScSolverUtil::GetImplementations( uno::Sequence& rImplNames, rImplNames.realloc(0); // clear rDescriptions.realloc(0); - uno::Reference xCtx( + const uno::Reference& xCtx( comphelper::getProcessComponentContext() ); uno::Reference xEnAc( @@ -99,7 +99,7 @@ uno::Reference ScSolverUtil::GetSolver( std::u16string_view rImp { uno::Reference xSolver; - uno::Reference xCtx( + const uno::Reference& xCtx( comphelper::getProcessComponentContext() ); uno::Reference xEnAc( diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 2a47d28c5e1d..f5f49989e537 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -72,7 +72,7 @@ ScTpCalcOptions::ScTpCalcOptions(weld::Container* pPage, weld::DialogController* Init(); SetExchangeSupport(); - css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const css::uno::Reference < css::uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, u"*"_ustr); } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 4df7c3562b9c..8c4a0c5efa00 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1037,7 +1037,7 @@ uno::Reference< chart2::data::XLabeledDataSequence > lcl_createLabeledDataSequen { try { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); if ( xContext.is() ) { xResult.set( chart2::data::LabeledDataSequence::create(xContext), uno::UNO_QUERY_THROW ); diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 74c06b3603b3..26835553af2d 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -128,7 +128,7 @@ openNewDoc(const OUString& aSheetName ) uno::Reference xModel; try { - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference xComponentLoader = frame::Desktop::create(xContext); diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 4122b08548f9..c0db269932d4 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -301,7 +301,7 @@ sal_Int32 CustomAnimationEffect::getNumberOfSubitems( const Any& aTarget, sal_In if( xShape.is() ) { // TODO/LATER: Optimize this, don't create a break iterator each time - Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference < i18n::XBreakIterator > xBI = i18n::BreakIterator::create(xContext); Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW ); @@ -944,7 +944,7 @@ Reference< XAnimationNode > CustomAnimationEffect::createAfterEffectNode() const { DBG_ASSERT( mbHasAfterEffect, "sd::CustomAnimationEffect::createAfterEffectNode(), this node has no after effect!" ); - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XAnimate > xAnimate; if( maDimColor.hasValue() ) @@ -1005,7 +1005,7 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType ) { sal_Int16 nTargetSubItem = mnTargetSubItem; - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XTimeContainer > xNewContainer; if(nIterateType) { @@ -1450,7 +1450,7 @@ void CustomAnimationEffect::createAudio( const css::uno::Any& rSource ) try { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XAudio > xAudio( Audio::create( xContext ) ); xAudio->setSource( rSource ); xAudio->setVolume( 1.0 ); @@ -1545,7 +1545,7 @@ void CustomAnimationEffect::setStopAudio() if( mxAudio.is() ) removeAudio(); - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XCommand > xCommand( Command::create( xContext ) ); xCommand->setCommand( EffectCommands::STOPAUDIO ); @@ -2016,7 +2016,7 @@ void stl_process_after_effect_node_func(AfterEffectNode const & rNode) } else // nextClick { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); // insert the aftereffect in the next group Reference< XTimeContainer > xClickContainer( xContainer->getParent(), UNO_QUERY_THROW ); diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index 15be0c4aa5d0..b20dc5e8357f 100644 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -243,7 +243,7 @@ void CustomAnimationPresets::importEffects() { try { - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiServiceFactory > xServiceFactory( xContext->getServiceManager(), UNO_QUERY_THROW ); @@ -299,7 +299,7 @@ void CustomAnimationPresets::importResources() try { // Get service factory - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiServiceFactory > xConfigProvider = configuration::theDefaultProvider::get( xContext ); diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx index c1fe6821ae8a..cef009df9b34 100644 --- a/sd/source/core/TransitionPreset.cxx +++ b/sd/source/core/TransitionPreset.cxx @@ -340,7 +340,7 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList ) try { - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiServiceFactory > xServiceFactory( xContext->getServiceManager(), UNO_QUERY_THROW ); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 7bce90338b38..178b85265241 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -1125,7 +1125,7 @@ void SdDrawDocument::InitLayoutVector() if (comphelper::IsFuzzing()) return; - const Reference xContext( + const Reference& xContext( ::comphelper::getProcessComponentContext() ); // get file list from configuration @@ -1163,7 +1163,7 @@ void SdDrawDocument::InitObjectVector() if (comphelper::IsFuzzing()) return; - const Reference xContext( + const Reference& xContext( ::comphelper::getProcessComponentContext() ); // get file list from configuration diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 733d826123cd..f696c09ae95f 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -629,7 +629,7 @@ void SdDrawDocument::CreateDefaultCellStyles() if (comphelper::IsFuzzing()) return; - Reference xContext(comphelper::getProcessComponentContext()); + const Reference& xContext(comphelper::getProcessComponentContext()); Reference xImporter(xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.Draw.XMLOasisStylesImporter"_ustr, { Any(comphelper::makePropertyValue(u"OrganizerMode"_ustr, true)) }, xContext), UNO_QUERY); diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 91737b1727ff..ea437dfb2ee0 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -225,7 +225,7 @@ bool SdGRFFilter::Export() // SJ: todo: error handling, the GraphicExportFilter does not support proper errorhandling bool bRet = false; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( xContext ); SdPage* pPage = nullptr; diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 76f9310da1bc..416ba2e9efdd 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -211,7 +211,7 @@ Reference< XAnimationNode > AnimationImporter::createNode( const Atom* pAtom, co Reference< XAnimationNode > xNode; if( pServiceName ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); const OUString aServiceName( OUString::createFromAscii(pServiceName) ); Reference< XInterface > xFac( xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext) ); xNode.set(xFac , UNO_QUERY ); @@ -921,7 +921,7 @@ int AnimationImporter::importTimeContainer( const Atom* pAtom, const Reference< { if( pChildAtom->hasChildAtom( DFF_msofbtAnimCommand ) ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XAnimationNode > xChildNode( Command::create(xContext), UNO_QUERY_THROW ); nNodes += importAnimationNodeContainer( pChildAtom, xChildNode ); Reference< XTimeContainer > xParentContainer( xNode, UNO_QUERY ); diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index a6369fb22875..5e2dd042152f 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -87,7 +87,7 @@ static rtl::Reference lcl_DRMDecrypt(const SfxMedium& rMedium, const // We have DRM encrypted storage. We should try to decrypt it first, if we can Sequence< Any > aArguments; - Reference xComponentContext(comphelper::getProcessComponentContext()); + const Reference& xComponentContext(comphelper::getProcessComponentContext()); Reference< css::packages::XPackageEncryption > xPackageEncryption( xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.oox.crypto.DRMDataSpace"_ustr, aArguments, xComponentContext), UNO_QUERY); @@ -223,7 +223,7 @@ bool SdPPTFilter::Export() if (sCryptoType.getLength()) { - Reference xComponentContext(comphelper::getProcessComponentContext()); + const Reference& xComponentContext(comphelper::getProcessComponentContext()); Sequence aArguments{ Any(NamedValue(u"Binary"_ustr, Any(true))) }; xPackageEncryption.set( diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index a72830eb6c07..a26a4e65155d 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -445,7 +445,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) ErrCodeMsg nRet = ERRCODE_NONE; // Get service factory - Reference< uno::XComponentContext > rxContext = + const Reference< uno::XComponentContext >& rxContext = comphelper::getProcessComponentContext(); SdDrawDocument* pDoc = mrDocShell.GetDoc(); @@ -754,7 +754,7 @@ bool SdXMLFilter::Export() return false; } - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext ); diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index dc7d43378fdf..aeee531d4885 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -97,7 +97,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, weld::Button&, void) Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages(); rtl::Reference< SdXImpressDocument > xShapeFactory( m_pDoc->getUnoModel() ); - Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const Reference< XComponentContext >& xContext(::comphelper::getProcessComponentContext()); Reference< graphic::XGraphicProvider> xProvider(graphic::GraphicProvider::create(xContext)); // determine if to use Captions (use TitleObject) and choose the correct AutoLayout diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index 46dbc2b07052..d8c1528d769c 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -121,7 +121,7 @@ TemplateScanner::~TemplateScanner() TemplateScanner::State TemplateScanner::GetTemplateRoot() { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference xTemplates = frame::DocumentTemplates::create(xContext); mxTemplateRoot = xTemplates->getContent(); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 69001315e936..5c5bc8513863 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -691,7 +691,7 @@ void SdPageObjsTLV::AddShapeToTransferable ( try { // Get a component enumeration from the desktop and search it for documents. - uno::Reference xContext( ::comphelper::getProcessComponentContext()); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext()); uno::Reference xDesktop = frame::Desktop::create(xContext); diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 29cd8dba742f..361c34fb20a4 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -806,7 +806,7 @@ void SdTpOptionsMisc::UpdateCompatibilityControls() try { // Get a component enumeration from the desktop and search it for documents. - Reference xContext( ::comphelper::getProcessComponentContext()); + const Reference& xContext( ::comphelper::getProcessComponentContext()); do { Reference xDesktop = frame::Desktop::create(xContext); diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx index fd07caeda493..4ce9afd2c6b8 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx @@ -42,7 +42,7 @@ ResourceFactoryManager::ResourceFactoryManager (const rtl::Reference<::sd::DrawC : mxControllerManager(rxManager) { // Create the URL transformer. - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext(::comphelper::getProcessComponentContext()); mxURLTransformer = util::URLTransformer::create(xContext); } diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx index 97e412507689..c36c2c9018a9 100644 --- a/sd/source/ui/framework/configuration/ResourceId.cxx +++ b/sd/source/ui/framework/configuration/ResourceId.cxx @@ -469,7 +469,7 @@ void ResourceId::ParseResourceURL() if ( ! xURLTransformer.is()) { // Create the URL transformer. - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext(::comphelper::getProcessComponentContext()); xURLTransformer.set(util::URLTransformer::create(xContext)); mxURLTransformerWeak = xURLTransformer; SdGlobalResourceContainer::Instance().AddResource( diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index 8a60b16b3482..4afbefe19642 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -139,7 +139,7 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) return; // Create a new instance of the factory. - Reference xContext = + const Reference& xContext = ::comphelper::getProcessComponentContext(); // Create the factory service. diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 696c81bf4974..8562688be5a7 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2481,7 +2481,7 @@ Reference< XSlideShow > SlideshowImpl::createSlideShow() try { - Reference< uno::XComponentContext > xContext = + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); xShow.set( presentation::SlideShow::create(xContext), UNO_SET_THROW ); @@ -2782,7 +2782,7 @@ void SlideshowImpl::setAutoSaveState( bool bOn) { try { - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< util::XURLTransformer > xParser(util::URLTransformer::create(xContext)); util::URL aURL; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 1053cbd0fa76..9b9c2be46db6 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1293,7 +1293,7 @@ void ViewShellBase::Implementation::SetPaneVisibility ( if (!pDrawController) return; - const Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference xPaneId (ResourceId::create( xContext, rsPaneURL)); @@ -1363,7 +1363,7 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) if ( ! xConfiguration.is()) throw RuntimeException(); - const Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); SfxWhichIter aSetIterator (rSet); sal_uInt16 nItemId (aSetIterator.FirstWhich()); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 16d765e1bd3f..9cf299d69b9f 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3504,7 +3504,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_PRESENTATION_MINIMIZER: { - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext(::comphelper::getProcessComponentContext()); Reference xParser(util::URLTransformer::create(xContext)); Reference xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY); if (xProvider.is()) diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index f057488e591d..2779e27f7adc 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -349,7 +349,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) mnLockCount = 0; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); try { diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx index 9f0f171abda0..1aaa2039ffd6 100644 --- a/sd/source/ui/view/drviewsk.cxx +++ b/sd/source/ui/view/drviewsk.cxx @@ -88,7 +88,7 @@ const uno::Reference & DrawViewShell::getXSlideShowIns { try { - auto xContext = ::comphelper::getProcessComponentContext(); + const auto& xContext = ::comphelper::getProcessComponentContext(); mxSlideShow.set(presentation::SlideShow::create(xContext), uno::UNO_SET_THROW); } catch (uno::Exception&) diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 3f3191a29a1f..3000c06e4dd0 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -449,7 +449,7 @@ bool SfxApplication::IsXScriptURL( const OUString& rScriptURL ) #if !HAVE_FEATURE_SCRIPTING (void) rScriptURL; #else - css::uno::Reference< css::uno::XComponentContext > xContext = + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::uri::XUriReferenceFactory > diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 3704a31ea994..76f9b0fc75c6 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -92,7 +92,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a pApp->Get_Impl()->mxAppDispatch->ReleaseAll(); pApp->Get_Impl()->mxAppDispatch.clear(); - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::document::XDocumentEventListener > xGlobalBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW); css::document::DocumentEvent aEvent2; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 7e11a74b5464..0e84d5d1e90d 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -160,7 +160,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid // UNO dance to render from drawinglayer - uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); try { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 4313d834b08c..ef91f54e70e0 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -327,7 +327,7 @@ namespace if (nRet == RET_OK) { sfx2::SafeMode::putFlag(); - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); css::task::OfficeRestartManager::get(xContext)->requestRestart( css::uno::Reference< css::task::XInteractionHandler >()); } @@ -947,7 +947,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } OUString aNewName(pModeName->GetValue()); - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); // Get information about current frame and module @@ -1280,7 +1280,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if (SfxViewFrame* pViewFrame = SfxViewFrame::Current()) { Reference xCurrentFrame; - uno::Reference xContext + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface(); const Reference xModuleManager @@ -1723,7 +1723,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) // which conflicts, at the latest, with the framework's concept of loading into _blank frames. // So, since we know that our frame loader can handle it, we skip the generic framework loader // mechanism, and the type detection (which doesn't know about the Basic IDE). - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XSynchronousFrameLoader > xLoader( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.office.FrameLoader"_ustr, xContext), UNO_QUERY_THROW ); @@ -1940,7 +1940,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) return; } - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName(); @@ -1960,7 +1960,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case FN_BUSINESS_CARD : case FN_XFORMS_INIT : { - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext ); OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName(); @@ -1980,7 +1980,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { try { - Reference< uno::XComponentContext > xORB = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xORB = ::comphelper::getProcessComponentContext(); Reference< ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::AddressBookSourcePilot::createWithParent(xORB, nullptr); xDialog->execute(); } diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index c41e53457679..bceff30d1edc 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1685,7 +1685,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox() { sCurrentFactory = SfxHelp::GetCurrentModuleIdentifier(); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); const OUString sPath { PATH_OFFICE_FACTORIES + sCurrentFactory }; // Attention: This check boy knows two states: diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index de9c54d90e5b..8aff36378f97 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -384,7 +384,7 @@ static OUString getDefaultModule_Impl() static OUString getCurrentModuleIdentifier_Impl() { OUString sIdentifier; - Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference < XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext); Reference < XDesktop2 > xDesktop = Desktop::create(xContext); Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 7dceffda6338..9412fac45ad9 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -103,7 +103,7 @@ std::vector< OUString > SfxContentHelper::GetHelpTreeViewContents( const OUStrin vector< OUString > aProperties; try { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler( task::InteractionHandler::createWithParent(xContext, nullptr), uno::UNO_QUERY_THROW ); @@ -161,7 +161,7 @@ OUString SfxContentHelper::GetActiveHelpString( const OUString& rURL ) OUStringBuffer aRet; try { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler( task::InteractionHandler::createWithParent(xContext, nullptr), uno::UNO_QUERY_THROW ); ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() ); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 4d8008abf9c4..f29294872577 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1883,7 +1883,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c css::uno::Any(comphelper::makePropertyValue( u"IsContextMenu"_ustr, true )) }; - css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XPopupMenuController > xPopupController( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext ), css::uno::UNO_QUERY ); diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index ca165c99e9c6..898a068314a7 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -898,7 +898,7 @@ void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pItem) bool TemplateLocalView::IsInternalTemplate(const OUString& rPath) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::util::XPathSettings > xPathSettings = css::util::thePathSettings::get(xContext); uno::Sequence aInternalTemplateDirs; uno::Any aAny = xPathSettings->getPropertyValue(u"Template_internal"_ustr); diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 8156d841d10f..0f573670412b 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -66,7 +66,7 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) // Load the thumbnail from a template document. uno::Reference xIStream; - uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); try { uno::Reference xStorageFactory = embed::StorageFactory::create(xContext); diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index b78a648ce8de..e074049338c8 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -127,7 +127,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd , SfxChildWinInfo* pInfo ) : SfxChildWindow( pParentWnd , nId ) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); VclPtr pTitleDockWindow = VclPtr::Create( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK); diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index d421400255cd..23101a56a633 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -242,7 +242,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( bool bSendAsPDF = ( rType == PDF_DOCUMENT_TYPE ); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); if (!xContext.is()) return eRet; @@ -662,7 +662,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: SendMailResult eResult = SEND_MAIL_ERROR; if ( !maAttachedDocuments.empty() ) { - css::uno::Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference < XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< XSimpleMailClientSupplier > xSimpleMailClientSupplier; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 6101f2185302..3887e153eb6c 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -305,7 +305,7 @@ OUString SfxObjectFactory::GetModuleName() const { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext)); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 8ad182f836e7..bf68f92e70fb 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1756,7 +1756,7 @@ SfxMedium::TryEncryptedInnerPackage(uno::Reference const xStora // either this throws due to wrong password or IO error, or returns stream assert(xDecryptedInnerPackage.is()); // need a seekable stream => copy - Reference const xContext(::comphelper::getProcessComponentContext()); + Reference const& xContext(::comphelper::getProcessComponentContext()); uno::Reference const xDecryptedInnerPackageStream( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.comp.MemoryStream"_ustr, xContext), @@ -3262,7 +3262,7 @@ SfxMedium::GetInteractionHandler( bool bGetAlways ) return pImpl->xInteraction; // create default handler and cache it! - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); pImpl->xInteraction.set( task::InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW ); return pImpl->xInteraction; diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 5003cb478a3b..94ab4c527338 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1561,7 +1561,7 @@ bool SfxDocTemplate_Impl::Construct( ) if ( mbConstructed ) return true; - uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); mxInfo.set(document::DocumentProperties::create(xContext), UNO_QUERY); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index c8082a9eb13b..0a20cd28f524 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -402,7 +402,7 @@ public: void SfxDocTplService::init_Impl() { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference < task::XInteractionHandler > xInteractionHandler( task::InteractionHandler::createWithParent(xContext, nullptr), uno::UNO_QUERY_THROW ); maCmdEnv = new TplTaskEnvironment( xInteractionHandler ); @@ -1717,7 +1717,7 @@ sal_Bool SfxDocTplService::storeTemplate( const OUString& rGroupName, try { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); // get document service name uno::Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) ); diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 08eb18a635a6..d070439812fe 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -199,7 +199,7 @@ bool GraphicHelper::getThumbnailReplacement_Impl(std::u16string_view rResID, con bool bResult = false; if (!rResID.empty() && xStream.is()) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); try { uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext)); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 190b87ef2e1b..4791daf42692 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1067,7 +1067,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if (xCtrl.is()) xParentWindow = xCtrl->getFrame()->getContainerWindow(); - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler2 > xInteract( task::InteractionHandler::createWithParent(xContext, xParentWindow) ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 7a9f94da4337..4b72ef1d18fc 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -137,7 +137,7 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >& if (!xModel.is()) return; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XGlobalEventBroadcaster > xModelCollection = css::frame::theGlobalEventBroadcaster::get(xContext); try @@ -1479,7 +1479,7 @@ bool SfxObjectShell::SaveTo_Impl // tdf#41063, tdf#135244: prevent jumping to cursor at any temporary modification auto aViewGuard(LockAllViews()); - uno::Reference const xContext( + uno::Reference const& xContext( ::comphelper::getProcessComponentContext()); std::shared_ptr pFilter = rMedium.GetFilter(); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index fb6e012eb398..e7f62a14dca2 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -726,7 +726,7 @@ namespace try { Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY ); - const Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); _rxContainer.set ( _bScript ? DocumentScriptLibraryContainer::create( diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a42d0d937f37..8ad7620c8d60 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -284,7 +284,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument return nullptr; } - const Reference xContext( + const Reference& xContext( ::comphelper::getProcessComponentContext()); const Reference xModel( m_pObjectShell->GetModel()); @@ -3715,7 +3715,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage Reference< embed::XStorage > xOOo1ConfigStorage = getDocumentSubStorage( u"Configurations"_ustr, embed::ElementModes::READ ); if ( xOOo1ConfigStorage.is() ) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); std::vector< Reference< container::XIndexContainer > > rToolbars; bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars( @@ -4016,7 +4016,7 @@ Reference< frame::XTitle > SfxBaseModel::impl_getTitleHelper () if ( ! m_pData->m_xTitleHelper.is ()) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< frame::XUntitledNumbers > xDesktop( frame::Desktop::create(xContext), UNO_QUERY_THROW); m_pData->m_xTitleHelper = new ::framework::TitleHelper(xContext, Reference< frame::XModel >(this), xDesktop); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index e32445fcbcfa..95b193d0979d 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -989,7 +989,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego void SfxTemplateManagerDlg::OnTemplateExport() { - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext(comphelper::getProcessComponentContext()); uno::Reference xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); xFolderPicker->setDisplayDirectory(SvtPathOptions().GetWorkPath()); diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index 565fb3d4413e..1f4714e0cad8 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -57,7 +57,7 @@ public: { if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); const Reference xModuleManager = ModuleManager::create( xContext ); Reference xFrame = pViewFrm->GetFrame().GetFrameInterface(); OUString aModuleName = xModuleManager->identify( xFrame ); @@ -99,7 +99,7 @@ public: { if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); const Reference xModuleManager = ModuleManager::create( xContext ); Reference xFrame = pViewFrm->GetFrame().GetFrameInterface(); OUString aModuleName = xModuleManager->identify( xFrame ); @@ -260,7 +260,7 @@ void NotebookbarTabControl::StateChanged(StateChangedType nStateChange) pToolBox->Clear(); - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); const Reference xModuleManager = ModuleManager::create( xContext ); m_xFrame = pViewFrm->GetFrame().GetFrameInterface(); OUString aModuleName = xModuleManager->identify( m_xFrame ); @@ -338,7 +338,7 @@ IMPL_LINK(NotebookbarTabControl, OpenNotebookbarPopupMenu, NotebookBar*, pNotebo Any(comphelper::makePropertyValue(u"Value"_ustr, u"notebookbar"_ustr)), Any(comphelper::makePropertyValue(u"Frame"_ustr, m_xFrame)) }; - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference xPopupController( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext), UNO_QUERY); diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index a33780d1b3ed..4e6188f1c89a 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -442,7 +442,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, if (IsActive()) { - css::uno::Reference xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = comphelper::getProcessComponentContext(); const Reference xModuleManager = frame::ModuleManager::create( xContext ); OUString aModuleName = xModuleManager->identify( xFrame ); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( aModuleName ); @@ -572,7 +572,7 @@ void SfxNotebookBar::ShowMenubar(bool bShow) Reference xFrame; vcl::EnumContext::Application eCurrentApp = vcl::EnumContext::Application::NONE; - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); const Reference xModuleManager = frame::ModuleManager::create( xContext ); if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx index 4c1cf2c16a6d..c7c7a787e6d4 100644 --- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -111,7 +111,7 @@ OUString ContextChangeBroadcaster::GetModuleName (const css::uno::Reference xContext (::comphelper::getProcessComponentContext() ); + const Reference& xContext (::comphelper::getProcessComponentContext() ); const Reference xModuleManager = frame::ModuleManager::create( xContext ); return xModuleManager->identify(rxFrame); } diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index cc453c53cd7e..b32df56dfebd 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -194,7 +194,7 @@ Reference ControllerFactory::CreateToolBarController( { try { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference xFactory = frame::theToolbarControllerFactory::get( xContext ); OUString sModuleName (Tools::GetModuleName(rxController)); diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 0ea442e7a91f..93e55d5a0b10 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -724,7 +724,7 @@ utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode (const OUStr { try { - const Reference xContext(comphelper::getProcessComponentContext()); + const Reference& xContext(comphelper::getProcessComponentContext()); const Reference xModuleAccess = frame::ModuleManager::create(xContext); const comphelper::NamedValueCollection aModuleProperties(xModuleAccess->getByName(rsModuleName)); const OUString sWindowStateRef(aModuleProperties.getOrDefault( diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 1bd463a55933..11c3150b8c33 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1008,7 +1008,7 @@ Reference SidebarController::CreateUIElement ( { try { - const Reference xComponentContext (::comphelper::getProcessComponentContext() ); + const Reference& xComponentContext (::comphelper::getProcessComponentContext() ); const Reference xUIElementFactory = ui::theUIElementFactoryManager::get( xComponentContext ); diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index 52170b01291a..cef0c18b76d6 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -58,7 +58,7 @@ css::uno::Reference Tools::GetImage( else { - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext(::comphelper::getProcessComponentContext()); Reference xProvider(graphic::GraphicProvider::create(xContext)); ::comphelper::NamedValueCollection aMediaProperties; aMediaProperties.put(u"URL"_ustr, rsURL); @@ -73,7 +73,7 @@ util::URL Tools::GetURL (const OUString& rsCommand) util::URL aURL; aURL.Complete = rsCommand; - const Reference xComponentContext (::comphelper::getProcessComponentContext()); + const Reference& xComponentContext (::comphelper::getProcessComponentContext()); const Reference xParser = util::URLTransformer::create( xComponentContext ); xParser->parseStrict(aURL); @@ -97,7 +97,7 @@ OUString Tools::GetModuleName ( try { - const Reference xComponentContext (::comphelper::getProcessComponentContext()); + const Reference& xComponentContext (::comphelper::getProcessComponentContext()); const Reference xModuleManager = frame::ModuleManager::create( xComponentContext ); return xModuleManager->identify(rxController); } diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 4a90ba44d863..b74f2486d2a9 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -378,7 +378,7 @@ SfxClassificationHelper::Impl::Impl(uno::Reference xComponentContext = comphelper::getProcessComponentContext(); + const uno::Reference& xComponentContext = comphelper::getProcessComponentContext(); SvtPathOptions aOptions; OUString aPath = aOptions.GetClassificationPath(); diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index da803ba3ac16..78f897dd2373 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -225,7 +225,7 @@ SfxFrame* SfxFrame::CreateHidden( SfxObjectShell const & rDoc, vcl::Window& rWin try { // create and initialize new top level frame for this window - Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference < XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference < XDesktop2 > xDesktop = Desktop::create( xContext ); Reference < XFrame2 > xFrame = Frame::create( xContext ); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 141332b99d0a..6ad66b0c9ed2 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -233,7 +233,7 @@ void SAL_CALL SfxInPlaceClient_Impl::saveObject() uno::Reference< frame::XFrame > xFrame; uno::Reference< task::XStatusIndicator > xStatusIndicator; uno::Reference< frame::XModel > xModel( m_xObject->getComponent(), uno::UNO_QUERY ); - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); if ( xModel.is() ) { diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index ebee96a33952..b1d7d13249a5 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -902,7 +902,7 @@ std::string extractKey(const std::string & privateKey) css::uno::Reference SfxLokHelper::getSigningCertificate(const std::string& rCert, const std::string& rKey) { - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); if (!xSecurityContext.is()) @@ -959,7 +959,7 @@ uno::Reference SfxLokHelper::addCertificate( void SfxLokHelper::addCertificates(const std::vector& rCerts) { - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext = comphelper::getProcessComponentContext(); uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); if (!xSecurityContext.is()) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index bf82f4cf85f1..3758e41cde7c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2789,7 +2789,7 @@ void SfxViewFrame::ExecView_Impl */ static bool impl_maxOpenDocCountReached() { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); std::optional x(officecfg::Office::Common::Misc::MaxOpenDocuments::get()); // NIL means: count of allowed documents = infinite ! if (!x) @@ -3070,7 +3070,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro ) OUString aModuleName; OUString aMacroName; OUString aLocation; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::uri::XUriReferenceFactory > xFactory = css::uri::UriReferenceFactory::create( xContext ); Reference< css::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); @@ -3270,7 +3270,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) else if ( rReq.GetSlot() == SID_RECORDMACRO ) { // enable recording - css::uno::Reference< css::uno::XComponentContext > xContext( + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext()); xRecorder = css::frame::DispatchRecorder::create( xContext ); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index f598c66cfc13..ae443cd72e30 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1973,7 +1973,7 @@ static OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::fram { try { - css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext()); + const css::uno::Reference< css::uno::XComponentContext >& xContext (::comphelper::getProcessComponentContext()); css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext)); OUString sModule = xModuleManager->identify(xFrame); @@ -3123,7 +3123,7 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) if (comphelper::LibreOfficeKit::isActive()) { // Get the module name. - css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext()); + const css::uno::Reference< css::uno::XComponentContext >& xContext (::comphelper::getProcessComponentContext()); css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext)); OUString sModule = xModuleManager->identify(rFrame.GetFrame().GetFrameInterface()); diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 2f76dc3a796e..80d9b4f79762 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -69,7 +69,8 @@ using namespace ::xmloff::token; bool SmMLExportWrapper::Export(SfxMedium& rMedium) { bool bRet = true; - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); // Check all fine SAL_WARN_IF(m_xModel == nullptr, "starmath", "Missing model"); @@ -224,7 +225,8 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) { - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); // Check all fine m_pElementTree = nullptr; diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 8c057066ad00..aac7d768472b 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -75,7 +75,8 @@ SmMlElement* SmMLImportWrapper::getElementTree() ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) { // Fetch context - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); if (!xContext.is()) { SAL_WARN("starmath", "Failed to fetch model while file input"); @@ -284,7 +285,8 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) { // Fetch context - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); if (!xContext.is()) { SAL_WARN("starmath", "Failed to fetch model while file input"); diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 9044c8ee0c90..380a7071ce16 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -91,7 +91,8 @@ sal_uInt32 ConvertMathToMathML(std::u16string_view rText, sal_Int32 nIndex = 0) bool SmXMLExportWrapper::Export(SfxMedium& rMedium) { bool bRet = true; - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); //Get model uno::Reference xModelComp = xModel; diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index 91bc834a27b0..0ac32397e099 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -96,7 +96,8 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) { ErrCode nError = ERRCODE_SFX_DOLOADFAILED; - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); OSL_ENSURE(m_xModel.is(), "XMLReader::Read: got no model"); @@ -2633,7 +2634,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportMML(SvStream& rStream) uno::Reference xModel(xDocSh->GetModel()); uno::Reference xInfoSet; - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); uno::Reference xStream(new utl::OSeekableInputStreamWrapper(rStream)); //SetLoading hack because the document properties will be re-initted diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index 4dc321cdce10..99102db96358 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -33,7 +33,7 @@ ItemHolder2::ItemHolder2() { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::lang::XComponent > xCfg( css::configuration::theDefaultProvider::get(xContext), css::uno::UNO_QUERY_THROW ); xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); } diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index adb287425df6..f7eb8b808739 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -37,7 +37,7 @@ ItemHolder2::ItemHolder2() { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::lang::XComponent > xCfg( css::configuration::theDefaultProvider::get( xContext ), css::uno::UNO_QUERY_THROW ); diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index aa6269c9a21d..27d423c738ec 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -459,7 +459,7 @@ void SvtMatchContext_Impl::doExecute() bool folder = false; if (aURLObject.hasFinalSlash()) { try { - css::uno::Reference< css::uno::XComponentContext > + const css::uno::Reference< css::uno::XComponentContext >& ctx(comphelper::getProcessComponentContext()); css::uno::Reference< css::ucb::XUniversalContentBroker > ucb( diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 055cb60324f0..d4651945cbb0 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -281,7 +281,7 @@ CmisDetailsContainer::CmisDetailsContainer(PlaceEditDialog* pParentDialog, OUStr m_sBinding(std::move( sBinding )), m_xParentDialog(pParentDialog->getDialog()->GetXWindow()) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = InteractionHandler::createWithParent(xContext, m_xParentDialog); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); @@ -394,7 +394,7 @@ void CmisDetailsContainer::selectRepository( ) IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XPasswordContainer2 > xMasterPasswd = PasswordContainer::create( xContext ); diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index 4de8ed7377bc..aeb4771ec386 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -63,7 +63,7 @@ short SvColorDialog::Execute(weld::Window* pParent) short ret = 0; try { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference xParent; if (pParent) @@ -107,7 +107,7 @@ void SvColorDialog::ExecuteAsync(weld::Window* pParent, const std::function xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference xParent; if (pParent) diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 92de98d54659..b64cfb8081f4 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -230,7 +230,7 @@ static OUString GetImageExtensionByFactory_Impl( const OUString& rURL ) try { // get the TypeDetection service to access all registered types - css::uno::Reference < css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference < css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference < css::document::XTypeDetection > xTypeDetector( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.document.TypeDetection"_ustr, xContext), css::uno::UNO_QUERY ); diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 57279a92b08d..14f801f2a2fd 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -755,7 +755,7 @@ namespace svt std::lock_guard aGuard( m_aMutex ); if ( !m_xOfficeInstDirs.is() ) { - uno::Reference< uno::XComponentContext > xCtx( + const uno::Reference< uno::XComponentContext >& xCtx( comphelper::getProcessComponentContext() ); m_xOfficeInstDirs = util::theOfficeInstallationDirectories::get(xCtx); } diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 8e73d20ee164..4d93ca19142a 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -341,7 +341,7 @@ void GraphicHelper::SaveShapeAsGraphicToPath( const uno::Reference& xShape, const OUString& aExportMimeType, const OUString& sPath) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); uno::Reference xGraphStream; if (xGraphStream.is()) diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 03ddf6e7ed3e..791b5b9e22bb 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -1134,7 +1134,7 @@ Reference < i18n::XBreakIterator > const & EnhancedCustomShapeFontWork::GetBreak { if ( !mxBreakIterator.is() ) { - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); mxBreakIterator = i18n::BreakIterator::create(xContext); } return mxBreakIterator; diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index 6a144db7faac..f713a4db6779 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -254,7 +254,7 @@ IMPL_LINK(SafeModeDialog, DialogBtnHdl, weld::Button&, rBtn, void) { sfx2::SafeMode::putRestartFlag(); m_xDialog->response(RET_CLOSE); - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); css::task::OfficeRestartManager::get(xContext)->requestRestart( css::uno::Reference< css::task::XInteractionHandler >()); } diff --git a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx index 0236c88353db..1c3614de3a7d 100644 --- a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx +++ b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx @@ -30,7 +30,7 @@ using namespace css::style; Reference SvxNumOptionsTabPageHelper::GetNumberingProvider() { - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext(::comphelper::getProcessComponentContext()); Reference xRet = text::DefaultNumberingProvider::create(xContext); return xRet; } diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 8f19b1598a6f..72147410ba8e 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -311,7 +311,7 @@ SvxRubyData_Impl::SvxRubyData_Impl() : bHasSelectionChanged(false) , bDisposing(false) { - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); xBreak = css::i18n::BreakIterator::create(xContext); } diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index f2f8259237d2..52fb02c80e87 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -115,7 +115,8 @@ uno::Reference importSVG(std::u16string_view rSVG) SvMemoryStream aSvgStream(4096, 4096); aSvgStream.WriteOString(OUStringToOString(rSVG, RTL_TEXTENCODING_UTF8)); uno::Reference xInputStream(new utl::OSeekableInputStreamWrapper(aSvgStream)); - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); uno::Reference xProvider = graphic::GraphicProvider::create(xContext); diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index 87c13e44e608..1c5468f49f3c 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -37,7 +37,7 @@ using namespace ::svxform; if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) ) { - css::uno::Reference xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = comphelper::getProcessComponentContext(); xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext); } else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" ) diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index bc0e8e604389..3669b7fd986d 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -306,7 +306,7 @@ const Reference< css::form::XForms >& FmFormPageImpl::getForms( bool _bForceCrea { m_bAttemptedFormCreation = true; - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); m_xForms = css::form::Forms::create( xContext ); if ( m_aFormsCreationHdl.IsSet() ) diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 7f3e8f5a7956..99e43e908ac3 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1093,7 +1093,7 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference< XControlModel> xNewModel( xContext->getServiceManager()->createInstanceWithContext(sNewName, xContext), UNO_QUERY ); if (!xNewModel.is()) return false; diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 08a9692837e4..50b295e3d190 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -113,7 +113,7 @@ private: try { - css::uno::Reference context( + const css::uno::Reference& context( comphelper::getProcessComponentContext()); Reference< XScriptListener > const xScriptListener( context->getServiceManager()->createInstanceWithContext( diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 5e9ad0db0812..7cb66b974c75 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1060,7 +1060,7 @@ IMPL_LINK_NOARG( FmXFormView, OnStartControlWizard, void*, void ) Reference< XExecutableDialog > xWizard; try { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); xWizard.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii(pWizardAsciiName), aWizardArgs.getWrappedPropertyValues(), xContext ), UNO_QUERY); } catch (const Exception&) diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 81402c608fd7..09f9e7e6ebfd 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1280,7 +1280,7 @@ namespace svxform // create new form - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference< XForm > xNewForm(xContext->getServiceManager()->createInstanceWithContext(FM_SUN_COMPONENT_FORM, xContext), UNO_QUERY); if (!xNewForm.is()) return; @@ -1342,7 +1342,7 @@ namespace svxform Reference xParentForm(pParentFormData->GetFormIface()); // create new component - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); Reference xNewComponent( xContext->getServiceManager()->createInstanceWithContext(rServiceName, xContext), UNO_QUERY); if (!xNewComponent.is()) return nullptr; diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index e273f26d6876..15d650bbddb5 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -109,7 +109,7 @@ namespace sal_uInt32 n = SvxNumberingTypeTable::FindIndex(eNumType); if (n != RESARRAY_INDEX_NOTFOUND) return SvxNumberingTypeTable::GetString(n); - css::uno::Reference xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = comphelper::getProcessComponentContext(); css::uno::Reference xDefNum = css::text::DefaultNumberingProvider::create(xContext); css::uno::Reference xInfo(xDefNum, css::uno::UNO_QUERY); if (!xInfo.is()) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index f0cf6ee551b3..b6f8a92bbae3 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1091,7 +1091,7 @@ namespace sdr::contact { { const OUString& sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); _out_rControl = Reference( xContext->getServiceManager()->createInstanceWithContext(sControlServiceName, xContext), UNO_QUERY_THROW ); // tdf#150886 for calc/writer/impress make forms ignore the platform theme diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 1600c043db0f..03c0d4260d8a 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -419,7 +419,7 @@ NumberingTypeMgr& NumberingTypeMgr::GetInstance() void NumberingTypeMgr::Init() { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference xDefNum = DefaultNumberingProvider::create( xContext ); Sequence< Sequence< PropertyValue > > aNumberings; @@ -588,7 +588,7 @@ OutlineTypeMgr& OutlineTypeMgr::GetInstance() void OutlineTypeMgr::Init() { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference xDefNum = DefaultNumberingProvider::create( xContext ); Sequence > aOutlineAccess; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 1ee318ae3283..2f5e6a21a03e 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -378,7 +378,7 @@ uno::Reference const & SdrObjCustomShape::GetCustom if ( !aXShape ) return mxCustomShapeEngine; - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); OUString aEngine(GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue()); static constexpr OUStringLiteral sEnhancedCustomShapeEngine = u"com.sun.star.drawing.EnhancedCustomShapeEngine"; diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index cc14d78c47ac..b33d00880aca 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -236,7 +236,7 @@ namespace mrShadowDecomposition(rShadowDecomposition) { // prepare BreakIterator - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); mxBreak = i18n::BreakIterator::create(xContext); } diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 070b85fbdacd..2ad32b32391b 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -371,7 +371,7 @@ void SdrUnoObj::CreateUnoControlModel(const OUString& rModelName) aUnoControlModelTypeName = rModelName; uno::Reference< awt::XControlModel > xModel; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); if (!aUnoControlModelTypeName.isEmpty() ) { xModel.set(xContext->getServiceManager()->createInstanceWithContext( diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 894d38808f84..426da02c94d8 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -444,7 +444,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC using namespace css::beans; using namespace css::util; - Reference xContext(comphelper::getProcessComponentContext()); + const Reference& xContext(comphelper::getProcessComponentContext()); Reference xDesktop = Desktop::create(xContext); Reference xFrame(xDesktop->getCurrentFrame()); Reference xDispatchProvider(xFrame, UNO_QUERY); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 7cbf3479f4b5..746afd8a0400 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -195,7 +195,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork() pPage->GetObj(0)->CloneSdrObject( bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView())); - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); css::uno::Reference xModuleManager = css::frame::ModuleManager::create(xContext); OUString aModuleIdentifier = xModuleManager->identify(mxFrame); diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 9637cb99cd73..18995bb03467 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -507,7 +507,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() { if ( !m_xLinguServiceManager.is() ) { - css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); m_xLinguServiceManager.set(css::linguistic2::LinguServiceManager::create(xContext)); } diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index f3ba564ce03f..53babc43fad8 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -62,7 +62,7 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::ReferencesetUnoModel( pDrawingModel ); } - uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext>& xContext( ::comphelper::getProcessComponentContext() ); if( bDocRet ) { @@ -163,7 +163,7 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference xContext = comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); if ( xTargetModel.is() ) xTargetModel->lockControllers(); diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index c78e92c70d2d..d06afda8208b 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -214,7 +214,7 @@ bool SvxXMLXTableExportComponent::save( try { - uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext>& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext ); diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index a2ce48ddc713..a2d97359fe9a 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -427,7 +427,7 @@ bool SvxXMLXTableImport::load( const OUString &rPath, const OUString &rReferer, try { - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); xml::sax::InputSource aParserInput; comphelper::LifecycleProxy aNasty; diff --git a/sw/source/core/bastyp/checkit.cxx b/sw/source/core/bastyp/checkit.cxx index f6e00314dbe0..2d45d2958958 100644 --- a/sw/source/core/bastyp/checkit.cxx +++ b/sw/source/core/bastyp/checkit.cxx @@ -26,7 +26,7 @@ using namespace ::com::sun::star::i18n; SwCheckIt::SwCheckIt() { - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); xCheck = InputSequenceChecker::create(xContext); } diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index bd69f9689cbc..c823eccd94e6 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -634,7 +634,7 @@ namespace public: TransWrp() { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_xTransWrp.reset(new ::utl::TransliterationWrapper( xContext, TransliterationFlags::IGNORE_CASE | diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 104fc5bf6221..95e3f351621b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -127,7 +127,7 @@ constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME = u"Character style"; { if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker()) { - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); try { m_xGCIterator = sw::proofreadingiterator::get( xContext ); diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx index bb5615bec265..c6904aa50cdc 100644 --- a/sw/source/core/doc/rdfhelper.cxx +++ b/sw/source/core/doc/rdfhelper.cxx @@ -46,7 +46,7 @@ SwRDFHelper::getGraphNames(const rtl::Reference& xModel, { try { - uno::Reference xComponentContext( + const uno::Reference& xComponentContext( comphelper::getProcessComponentContext()); // rdf::URI::create may fail with type: com.sun.star.uno.DeploymentException // message: component context fails to supply service com.sun.star.rdf.URI of type com.sun.star.rdf.XURI @@ -101,7 +101,7 @@ void SwRDFHelper::addStatement(const rtl::Reference& xModel, const css::uno::Reference& xSubject, const OUString& rKey, const OUString& rValue) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); uno::Reference xDocumentMetadataAccess(xModel); const uno::Sequence< uno::Reference > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType); @@ -121,7 +121,7 @@ void SwRDFHelper::addStatement(const rtl::Reference& xModel, bool SwRDFHelper::hasMetadataGraph(const rtl::Reference& xModel, const OUString& rType) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); uno::Reference xDocumentMetadataAccess(xModel); return getGraphNames(xDocumentMetadataAccess, xType).hasElements(); @@ -132,7 +132,7 @@ void SwRDFHelper::removeStatement(const rtl::Reference& xModel, const css::uno::Reference& xSubject, const OUString& rKey, const OUString& rValue) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); uno::Reference xDocumentMetadataAccess(xModel); const uno::Sequence< uno::Reference > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType); @@ -149,7 +149,7 @@ void SwRDFHelper::clearStatements(const rtl::Reference& xModel, const OUString& rType, const css::uno::Reference& xSubject) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); const uno::Sequence< uno::Reference > aGraphNames = getGraphNames(xModel, xType); if (!aGraphNames.hasElements()) @@ -183,7 +183,7 @@ void SwRDFHelper::addTextNodeStatement(const OUString& rType, const OUString& rP void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); rtl::Reference xModel(rTextNode.GetDoc().GetDocShell()->GetBaseModel()); uno::Reference xDocumentMetadataAccess(xModel); @@ -201,7 +201,7 @@ void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTe void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rOldValue, const OUString& rNewValue) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xType = rdf::URI::create(xComponentContext, rType); rtl::Reference xModel(rTextNode.GetDoc().GetDocShell()->GetBaseModel()); uno::Reference xDocumentMetadataAccess(xModel); diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx index 3247d0500523..36c17763db92 100644 --- a/sw/source/core/edit/edfldexp.cxx +++ b/sw/source/core/edit/edfldexp.cxx @@ -31,7 +31,8 @@ using namespace com::sun::star; bool SwEditShell::IsFieldDataSourceAvailable(OUString& rUsedDataSource) const { const SwFieldTypes* pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes(); - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + ::comphelper::getProcessComponentContext()); uno::Reference xDBContext = sdb::DatabaseContext::create(xContext); std::vector vFields; for (const auto& pFieldType : *pFieldTypes) diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index 244edae398d1..42ac1d8a7101 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -209,7 +209,7 @@ bool SwMacroField::isScriptURL( const OUString& str ) { try { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xFactory = uri::UriReferenceFactory::create(xContext); uno::Reference xUrl(xFactory->parse(str), uno::UNO_QUERY); return xUrl.is(); diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 3821138022ed..f5964fe0938d 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -104,7 +104,7 @@ ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) m_xRoot = m_xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ ); uno::Reference < io::XStream > xStream = m_xRoot->openStreamElement( aStreamName, embed::ElementModes::READ ); - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; @@ -193,7 +193,7 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, aParserInput.aInputStream = xDocStream->getInputStream(); // get service factory - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); // create descriptor and reference to it. Either @@ -286,7 +286,7 @@ ErrCode SwXMLTextBlocks::GetBlockText( std::u16string_view rShort, OUString& rTe } uno::Reference < io::XStream > xContents = m_xRoot->openStreamElement( aStreamName, embed::ElementModes::READ ); - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; @@ -346,7 +346,7 @@ ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, */ OUString aStreamName = rPackageName + ".xml"; - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); @@ -408,7 +408,7 @@ void SwXMLTextBlocks::ReadInfo() if ( !m_xBlkRoot.is() || !m_xBlkRoot->hasByName( sDocName ) || !m_xBlkRoot->isStreamElement( sDocName ) ) return; - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; @@ -441,7 +441,7 @@ void SwXMLTextBlocks::WriteInfo() if ( !(m_xBlkRoot.is() || ERRCODE_NONE == OpenFile ( false )) ) return; - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); @@ -492,7 +492,7 @@ ErrCode SwXMLTextBlocks::SetMacroTable( // start XML autotext event export ErrCode nRes = ERRCODE_NONE; - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); // Get model diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx index e1729aaede3e..edfbd1b70233 100644 --- a/sw/source/core/tox/toxhlp.cxx +++ b/sw/source/core/tox/toxhlp.cxx @@ -26,7 +26,7 @@ using namespace ::com::sun::star; IndexEntrySupplierWrapper::IndexEntrySupplierWrapper() { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); try { m_xIES = i18n::IndexEntrySupplier::create(xContext); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index b126eb6b23ef..1e057ca319b1 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -237,7 +237,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestPDFExportRTF(SvStream& rStream) = css::frame::Desktop::create(comphelper::getProcessComponentContext()); uno::Reference xTargetFrame = xDesktop->findFrame(u"_blank"_ustr, 0); - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + comphelper::getProcessComponentContext()); uno::Reference xModel( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.text.TextDocument"_ustr, xContext), diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b809a47acbdd..4687bbaa2e7f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3821,7 +3821,7 @@ ErrCodeMsg SwWW8Writer::WriteStorage() if (sCryptoType.getLength()) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Sequence aArguments{ uno::Any(beans::NamedValue(u"Binary"_ustr, uno::Any(true))) }; xPackageEncryption.set( diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index caa6b750d5fe..3fc0cf802657 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5028,7 +5028,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) try { rtl::Reference const xModel(m_rDoc.GetDocShell()->GetBaseModel()); - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); const uno::Reference xBaseURI(sfx2::createBaseURI(xComponentContext, static_cast(xModel.get()), m_sBaseURL)); uno::Reference xHandler; @@ -6436,7 +6436,7 @@ ErrCode WW8Reader::DecryptDRMPackage() { // We have DRM encrypted storage. We should try to decrypt it first, if we can uno::Sequence< uno::Any > aArguments; - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); uno::Reference< packages::XPackageEncryption > xPackageEncryption( xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.oox.crypto.DRMDataSpace"_ustr, aArguments, xComponentContext), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index 0ce3db3582fa..3d863213e997 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -193,7 +193,7 @@ bool SwCTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh ) css::uno::Reference xCfgMgr; if (!comphelper::IsFuzzing()) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( ui::theModuleUIConfigurationManagerSupplier::get(xContext) ); xCfgMgr = xAppCfgSupp->getUIConfigurationManager(u"com.sun.star.text.TextDocument"_ustr); } @@ -291,7 +291,7 @@ bool Customization::ImportMenu( SwCTBWrapper& rWrapper, CustomToolBarImportHelpe } uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW ); - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW ); // create the popup menu diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index da564863f9f6..e66af9c1a064 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -471,7 +471,7 @@ ErrCodeMsg XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, SAL_INFO_IF(rBaseURL.isEmpty(), "sw.filter", "sw::XMLReader: no base URL"); // Get service factory - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference xGraphicStorageHandler; @@ -982,7 +982,7 @@ ErrCodeMsg XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, size_t XMLReader::GetSectionList( SfxMedium& rMedium, std::vector& rStrings) const { - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference < embed::XStorage > xStg2; if( ( xStg2 = rMedium.GetStorage() ).is() ) diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 36d941c25369..6dae1b99f12b 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -100,7 +100,7 @@ ErrCodeMsg SwXMLWriter::Write_(const SfxItemSet* pMediumItemSet) } // Get service factory - uno::Reference< uno::XComponentContext > xContext = + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); // Get data sink ... diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 94b94cc4eb23..e6eccbbcdf27 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1836,7 +1836,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestPDFExportFODT(SvStream &rStream) uno::Reference xDesktop = css::frame::Desktop::create(comphelper::getProcessComponentContext()); uno::Reference xTargetFrame = xDesktop->findFrame(u"_blank"_ustr, 0); - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext(comphelper::getProcessComponentContext()); uno::Reference xModel(xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.text.TextDocument"_ustr, xContext), uno::UNO_QUERY_THROW); diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 323c3d833128..f5e4f1a6caa2 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -359,7 +359,7 @@ void SwDropCapsPict::CheckScript() maScriptChanges.clear(); if( !m_xBreak.is() ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_xBreak = css::i18n::BreakIterator::create(xContext); } sal_Int16 nScript = m_xBreak->getScriptType( maText, 0 ); diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 01fc8f54be9a..1079bdc93c55 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -312,7 +312,7 @@ IMPL_LINK_NOARG(SwTestAccountSettingsDialog, TestHdl, void*, void) void SwTestAccountSettingsDialog::Test() { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); OUString sException; diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index d4e6f40be4bc..02280ef58135 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -158,7 +158,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) m_xListLB->make_sorted(); m_xOK->connect_clicked(LINK(this, SwAddressListDialog, OKHdl_Impl)); - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); m_xDBContext = DatabaseContext::create(xContext); SwMailMergeConfigItem& rConfigItem = m_pAddressPage->GetWizard()->GetConfigItem(); @@ -481,7 +481,7 @@ void SwAddressListDialog::DetectTablesAndQueries( m_xDBContext->getByName(m_aDBData.sDataSource) >>= xComplConnection; pUserData->xSource.set(xComplConnection, UNO_QUERY); - uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< XInteractionHandler > xHandler = InteractionHandler::createWithParent(xContext, nullptr); pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) ); } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 296b8b4b6b15..4a8dff5bee90 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1193,7 +1193,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence& rSelection, // for adding as fields -> insert a "NextField" after // every data set SwDBFormatData aDBFormatData; - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); aDBFormatData.xFormatter.set(util::NumberFormatter::create(xContext), UNO_QUERY_THROW) ; Reference xSourceProps(xSource, UNO_QUERY); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 9d22415ecec6..4893d1df86db 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -559,7 +559,7 @@ OUString SwMailMergeDlg::GetTargetURL() const IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl, weld::Button&, void) { - uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < XFolderPicker2 > xFP = sfx2::createFolderPicker(xContext, m_xDialog.get()); xFP->setDisplayDirectory( GetURLfromPath() ); if( xFP->execute() == RET_OK ) { diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index 169e8c269fda..b277fc176c5e 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -75,7 +75,7 @@ SwChangeDBDlg::SwChangeDBDlg(SwView const & rVw) // initialise database listboxes void SwChangeDBDlg::FillDBPopup() { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference xDBContext = DatabaseContext::create(xContext); const SwDBData& rDBData = m_pSh->GetDBData(); m_xAvailDBTLB->Select(rDBData.sDataSource, rDBData.sCommand, u""); diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index a61c662c9327..fffd03a46c5e 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -174,7 +174,7 @@ SwIndexMarkPane::SwIndexMarkPane(std::shared_ptr xDialog, weld::Bu if (SvtCJKOptions::IsCJKFontEnabled()) { - uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); m_xExtendedIndexEntrySupplier = i18n::IndexEntrySupplier::create(xContext); @@ -1406,7 +1406,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, ChangeSourceHdl, weld::Toggleable&, void) { if(!m_bBibAccessInitialized) { - uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext(); m_xBibAccess = frame::Bibliography::create( xContext ); uno::Reference< beans::XPropertySet > xPropSet(m_xBibAccess, uno::UNO_QUERY); OUString uPropName(u"BibliographyDataFieldNames"_ustr); diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx index 08ec0e27d3d5..2f728d9bba7c 100644 --- a/sw/source/ui/table/autoformatpreview.cxx +++ b/sw/source/ui/table/autoformatpreview.cxx @@ -55,7 +55,8 @@ AutoFormatPreview::AutoFormatPreview() , maStringSouth(SwResId(STR_SOUTH)) , maStringSum(SwResId(STR_SUM)) { - uno::Reference xContext = comphelper::getProcessComponentContext(); + const uno::Reference& xContext + = comphelper::getProcessComponentContext(); m_xBreak = i18n::BreakIterator::create(xContext); mxNumFormat.reset(new SvNumberFormatter(xContext, LANGUAGE_SYSTEM)); diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx index 10e529ffc1e6..25a0e256cac8 100644 --- a/sw/source/ui/vba/vbatemplate.cxx +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -83,7 +83,7 @@ SwVbaTemplate::getPath() uno::Any SAL_CALL SwVbaTemplate::AutoTextEntries( const uno::Any& index ) { - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< text::XAutoTextContainer2 > xAutoTextContainer = text::AutoTextContainer::create( xContext ); // the default template is "Normal.dot" in Word. diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 53977e38bd10..63a2c8f08a9e 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -446,7 +446,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) if (!aURL.isEmpty()) { - auto xContext(comphelper::getProcessComponentContext()); + const auto& xContext(comphelper::getProcessComponentContext()); auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(aURL); assert(xUri.is()); xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 0beb039d01d0..a252737fa8a4 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -774,7 +774,7 @@ void SwDocShell::Execute(SfxRequest& rReq) ErrCodeMsg eErr = aWrt.Write( xWrt ); if( !eErr.IgnoreWarning() ) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); @@ -832,7 +832,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pStrm->Seek( STREAM_SEEK_TO_BEGIN ); if ( nWhich == FN_OUTLINE_TO_IMPRESS ) { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 1aefb38bc359..6772aa4bcaa0 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -386,7 +386,7 @@ public: void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, SvStream & rStream, OUString const& rFileName) { - uno::Reference const xContext( + uno::Reference const& xContext( ::comphelper::getProcessComponentContext()); uno::Reference const xOutStream( @@ -434,7 +434,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, void ImportStoredChapterNumberingRules(SwChapterNumRules & rRules, SvStream & rStream, OUString const& rFileName) { - uno::Reference const xContext( + uno::Reference const& xContext( ::comphelper::getProcessComponentContext()); uno::Reference const xInStream( diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index a651b20b8520..79193c08eff5 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -139,7 +139,7 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pD // Construct vnd.sun.star.pkg:// URL OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, std::u16string_view rStreamRelPath) { - auto xContext(comphelper::getProcessComponentContext()); + const auto& xContext(comphelper::getProcessComponentContext()); auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL); assert(xUri.is()); xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) @@ -243,7 +243,7 @@ public: SwDataSourceRemovedListener::SwDataSourceRemovedListener(SwDBManager& rDBManager) : m_pDBManager(&rDBManager) { - uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + const uno::Reference& xComponentContext(comphelper::getProcessComponentContext()); m_xDatabaseContext = sdb::DatabaseContext::create(xComponentContext); m_xDatabaseContext->addDatabaseRegistrationsListener(this); } @@ -324,7 +324,7 @@ struct SwDBManager::SwDBManager_Impl static void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference const & xSource) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); rParam.xFormatter = util::NumberFormatter::create(xContext); uno::Reference xSourceProps( (xSource.is() @@ -1883,7 +1883,7 @@ uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rD uno::Reference& rxSource, const SwView *pView) { uno::Reference< sdbc::XConnection> xConnection; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); try { uno::Reference xComplConnection(dbtools::getDataSource(rDataSource, xContext), uno::UNO_QUERY); @@ -2537,7 +2537,7 @@ const SwDBData& SwDBManager::GetAddressDBName() uno::Sequence SwDBManager::GetExistingDatabaseNames() { - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference xDBContext = sdb::DatabaseContext::create(xContext); return xDBContext->getElementNames(); } @@ -2696,7 +2696,7 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference try { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); uno::Reference xDBContext = sdb::DatabaseContext::create(xContext); OUString sNewName = rURL.getName( @@ -2825,7 +2825,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShel if( DBConnURIType::FLAT == type ) { - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < sdb::XTextConnectionSettings > xSettingsDlg = sdb::TextConnectionSettings::create(xContext); if( xSettingsDlg->execute() ) aSettings.set( uno::Reference < beans::XPropertySet >( xSettingsDlg, uno::UNO_QUERY_THROW ) ); @@ -3045,7 +3045,7 @@ void SwDBManager::InsertText(SwWrtShell& rSh, OSL_FAIL("PropertyValues missing or unset"); return; } - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference xSource; uno::Reference xChild(xConnection, uno::UNO_QUERY); if(xChild.is()) diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index d53124e9128d..1ef07a224e8c 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -110,7 +110,7 @@ bool SwDBTreeList_Impl::HasContext() { if(!m_xDatabaseContext.is()) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); m_xDatabaseContext = DatabaseContext::create(xContext); m_xDatabaseContext->addContainerListener( this ); } diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index fb7baca39a12..b45c2789187c 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -95,7 +95,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer( weld::Window* pDialogParentWindow ) { uno::Reference< mail::XSmtpService > xSmtpServer; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); try { uno::Reference< mail::XMailServiceProvider > xMailServiceProvider( diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index c23c8eb8c93c..74ac10c03e78 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1874,7 +1874,7 @@ void SwFieldMgr::SetMacroPath(const OUString& rPath) // try to set sMacroName member variable by parsing the macro path // using the new URI parsing services - Reference< XComponentContext > xContext = + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< uri::XUriReferenceFactory > @@ -1921,7 +1921,7 @@ Reference const & SwFieldMgr::GetNumberingInfo() const { if(!m_xNumberingInfo.is()) { - Reference xContext( ::comphelper::getProcessComponentContext() ); + const Reference& xContext( ::comphelper::getProcessComponentContext() ); Reference xDefNum = text::DefaultNumberingProvider::create(xContext); const_cast(this)->m_xNumberingInfo.set(xDefNum, UNO_QUERY); } diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index 5f4c45bb8dfc..a53215bc3149 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -38,7 +38,8 @@ SwNumberingTypeListBox::SwNumberingTypeListBox(std::unique_ptr p : m_xWidget(std::move(pWidget)) , m_xImpl(new SwNumberingTypeListBox_Impl) { - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext( + ::comphelper::getProcessComponentContext()); uno::Reference xDefNum = text::DefaultNumberingProvider::create(xContext); m_xImpl->xInfo.set(xDefNum, uno::UNO_QUERY); diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index fb5191131e5a..0b50fe3b94b0 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -284,7 +284,7 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest const &rReq) case SID_CHINESE_CONVERSION: { //open ChineseTranslationDialog - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); if (!xContext.is()) return; diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 0db453927af2..dfca448da361 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -2028,7 +2028,7 @@ OUString SwView::GetDataSourceName() const bool SwView::IsDataSourceAvailable(const OUString sDataSourceName) { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XDatabaseContext> xDatabaseContext = DatabaseContext::create(xContext); return xDatabaseContext->hasByName(sDataSourceName); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 0df8e979a356..f9acb11ba4ec 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2970,7 +2970,7 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if(!GetWrtShell().IsAnyDatabaseFieldInDoc()) { //check availability of data sources (except biblio source) - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference xDBContext = DatabaseContext::create(xContext); bool bCallAddressPilot = false; if ( lcl_NeedAdditionalDataSource( xDBContext ) ) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 1089d1cc4f10..b3ec59e5768f 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -245,7 +245,7 @@ void SwView::StartTextConversion( const bool bOther = !bSelection && !(m_pWrtShell->GetFrameType(nullptr,true) & FrameTypeFlags::BODY); { - const uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); SwHHCWrapper aWrap( this, xContext, nSourceLang, nTargetLang, pTargetFont, nOptions, bIsInteractive, @@ -821,7 +821,7 @@ void SwView::ExecSmartTagPopup( const Point& rPt ) css::uno::Any(comphelper::makePropertyValue( u"CommandURL"_ustr, u".uno:OpenSmartTagMenuOnCursor"_ustr )) }; - css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XPopupMenuController > xPopupController( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"com.sun.star.comp.svx.SmartTagMenuController"_ustr, aArgs, xContext ), css::uno::UNO_QUERY ); diff --git a/sw/source/uibase/uno/dlelstnr.cxx b/sw/source/uibase/uno/dlelstnr.cxx index 41551540101b..64c9a693bc47 100644 --- a/sw/source/uibase/uno/dlelstnr.cxx +++ b/sw/source/uibase/uno/dlelstnr.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star::linguistic2::LinguServiceEventFlags; SwLinguServiceEventListener::SwLinguServiceEventListener() { - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); try { m_xDesktop = frame::Desktop::create(xContext); diff --git a/test/source/sheet/xdocumentauditing.cxx b/test/source/sheet/xdocumentauditing.cxx index cec7b1c58e23..b0261bb61de2 100644 --- a/test/source/sheet/xdocumentauditing.cxx +++ b/test/source/sheet/xdocumentauditing.cxx @@ -44,7 +44,8 @@ namespace apitest void XDocumentAuditing::dispatch(const uno::Reference& xFrame, const uno::Sequence& rArguments) { - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext + = ::comphelper::getProcessComponentContext(); uno::Reference xDispatchHelper(frame::DispatchHelper::create(xContext), UNO_SET_THROW); CPPUNIT_ASSERT(xDispatchHelper.is()); diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index 166d5bc679ee..8c4be5b324c2 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -371,7 +371,7 @@ namespace toolkit try { // collect the image sizes of the different image sets - const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); const Reference< XGraphicProvider > xGraphicProvider( css::graphic::GraphicProvider::create(xContext) ); const bool isHighContrast = pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode(); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index c5f4ededd2e6..2fbd88e5b6ff 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2036,7 +2036,7 @@ namespace try { - Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XGraphicProvider > xProvider(graphic::GraphicProvider::create(xContext)); ::comphelper::NamedValueCollection aMediaProperties; aMediaProperties.put( u"URL"_ustr, i_rImageURL ); diff --git a/toolkit/source/controls/filectrl.cxx b/toolkit/source/controls/filectrl.cxx index e71991607919..6e0e3efd4cbf 100644 --- a/toolkit/source/controls/filectrl.cxx +++ b/toolkit/source/controls/filectrl.cxx @@ -203,7 +203,7 @@ IMPL_LINK_NOARG(FileControl, ButtonHdl, Button*, void) { try { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference < dialogs::XFilePicker3 > xFilePicker = dialogs::FilePicker::createWithMode( xContext, dialogs::TemplateDescription::FILEOPEN_SIMPLE ); // transform the system notation text into a file URL OUString sSystemNotation = GetText(), sFileURL; diff --git a/toolkit/source/controls/table/cellvalueconversion.cxx b/toolkit/source/controls/table/cellvalueconversion.cxx index 4c74d6f960a9..735fb57f7e5d 100644 --- a/toolkit/source/controls/table/cellvalueconversion.cxx +++ b/toolkit/source/controls/table/cellvalueconversion.cxx @@ -247,7 +247,7 @@ bool CellValueConversion::ensureNumberFormatter() try { - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); // a number formatter Reference const xFormatter(NumberFormatter::create(xContext), UNO_QUERY_THROW); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index e3a73822a155..2fff360fc88b 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -74,7 +74,7 @@ ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL, OUString const & try { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); xGraphic = xProvider->queryGraphic({ comphelper::makePropertyValue(u"URL"_ustr, _rURL) }); } diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx index b46ab3f1343b..e27408185885 100644 --- a/toolkit/source/helper/tkresmgr.cxx +++ b/toolkit/source/helper/tkresmgr.cxx @@ -39,7 +39,8 @@ Image TkResMgr::getImageFromURL(const OUString& i_rImageURL) try { - Reference xContext(::comphelper::getProcessComponentContext()); + const Reference& xContext( + ::comphelper::getProcessComponentContext()); Reference xProvider(graphic::GraphicProvider::create(xContext)); ::comphelper::NamedValueCollection aMediaProperties; aMediaProperties.put(u"URL"_ustr, i_rImageURL); diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 0e5da47ccc72..6976b8c0db5a 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -54,7 +54,7 @@ using namespace ::com::sun::star; uno::Reference< css::awt::XToolkit> VCLUnoHelper::CreateToolkit() { - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); uno::Reference< awt::XToolkit> xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); return xToolkit; } diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx index b2f1b199fb77..3123ae64d430 100644 --- a/ucb/source/ucp/cmis/auth_provider.cxx +++ b/ucb/source/ucp/cmis/auth_provider.cxx @@ -103,7 +103,7 @@ namespace cmis } } - uno::Reference xContext + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xMasterPasswd = task::PasswordContainer::create(xContext); @@ -133,7 +133,7 @@ namespace cmis if (xEnv.is()) { uno::Reference xIH = xEnv->getInteractionHandler(); - uno::Reference xContext + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xMasterPasswd = task::PasswordContainer::create(xContext); diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 245ef13e5e8d..83df09259d45 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -87,7 +87,8 @@ MacrosTest::dispatchCommand(const uno::Reference& xComponent, uno::Reference xFrame(xController->getFrame(), uno::UNO_QUERY); CPPUNIT_ASSERT(xFrame.is()); - uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const uno::Reference& xContext + = ::comphelper::getProcessComponentContext(); uno::Reference xDispatchHelper(frame::DispatchHelper::create(xContext)); CPPUNIT_ASSERT(xDispatchHelper.is()); @@ -100,7 +101,7 @@ MacrosTest::dispatchCommand(const uno::Reference& xComponent, std::unique_ptr MacrosTest::parseExportStream(const OUString& url, const OUString& rStreamName) { - uno::Reference xComponentContext + const uno::Reference& xComponentContext = comphelper::getProcessComponentContext(); uno::Reference const xZipNames( packages::zip::ZipFileAccess::createWithURL(xComponentContext, url)); diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 398925353a6f..c24e3710aeea 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -306,7 +306,7 @@ FontSubstConfiguration::FontSubstConfiguration() : try { // get service provider - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); // create configuration hierarchical access name m_xConfigProvider = theDefaultProvider::get( xContext ); Sequence aArgs(comphelper::InitAnyPropertySequence( diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index 3ef7a28d1156..b2ec421b6caa 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -39,7 +39,7 @@ ItemHolder1::ItemHolder1() { try { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::lang::XComponent > xCfg( css::configuration::theDefaultProvider::get( xContext ), css::uno::UNO_QUERY_THROW ); diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index a276478c1510..5e4aee967e0b 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1115,7 +1115,7 @@ uno::Reference< util::XChangesBatch > const & SvtLinguConfig::GetMainUpdateAcces try { // get configuration provider - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = configuration::theDefaultProvider::get( xContext ); diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index e2e1f28e08d1..4ffb97839100 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -996,7 +996,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(std::u SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString& sURL , const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor) { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::container::XNameAccess > xFilterCfg; css::uno::Reference< css::container::XNameAccess > xTypeCfg; diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index a7283a49928e..5447056f8457 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -212,7 +212,7 @@ const OUString& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath ) else if (ePath == SvtPathOptions::Paths::Palette || ePath == SvtPathOptions::Paths::IconSet) { - auto ctx = comphelper::getProcessComponentContext(); + const auto& ctx = comphelper::getProcessComponentContext(); OUStringBuffer buf(aPathValue.getLength()*2); for (sal_Int32 i = 0;;) { @@ -367,7 +367,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const SvtPathOptions_Impl::SvtPathOptions_Impl() { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); // Create necessary services Reference< XPathSettings > xPathSettings = thePathSettings::get(xContext); diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx index 5958240cda44..95d02d863e54 100644 --- a/unotools/source/i18n/textsearch.cxx +++ b/unotools/source/i18n/textsearch.cxx @@ -106,7 +106,7 @@ Reference TextSearch::getXTextSearch( const i18nutil::SearchOption if ( lcl_Equals(theCachedTextSearch.Options, rPara) ) return theCachedTextSearch.xTextSearch; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); theCachedTextSearch.xTextSearch.set( ::TextSearch2::create(xContext) ); theCachedTextSearch.xTextSearch->setOptions2( rPara.toUnoSearchOptions2() ); theCachedTextSearch.Options = rPara; diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 6403204bc595..c69487117e00 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -1015,9 +1015,7 @@ bool UcbLockBytes::setInputStreamImpl( std::unique_lock& /*rGuard*/, m_xSeekable.set( rxInputStream, UNO_QUERY ); if( !m_xSeekable.is() && rxInputStream.is() ) { - Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext(); rtl::Reference< utl::TempFileFastService > rxTempOut( new utl::TempFileFastService ); - ::comphelper::OStorageHelper::CopyInputToOutput( rxInputStream, rxTempOut ); m_xInputStream.set( rxTempOut ); m_xSeekable.set( rxTempOut ); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 6905cca88978..285d8d64d790 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -143,7 +143,7 @@ dispatchRequests (const uno::Reference< frame::XModel>& xModel, const OUString & uno::Reference xDispatchProvider (xFrame,uno::UNO_QUERY_THROW); try { - uno::Reference xContext( + const uno::Reference& xContext( comphelper::getProcessComponentContext() ); uno::Reference xParser( util::URLTransformer::create(xContext) ); xParser->parseStrict (url); diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx index 183d3bb9a984..db0942fd29cf 100644 --- a/vbahelper/source/vbahelper/vbashape.cxx +++ b/vbahelper/source/vbahelper/vbashape.cxx @@ -393,7 +393,7 @@ ScVbaShape::TextFrame() uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW ); if( xServiceInfo->supportsService( u"com.sun.star.sheet.SpreadsheetDocument"_ustr ) ) { - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< uno::XInterface > xTextFrame = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"ooo.vba.excel.TextFrame"_ustr , { uno::Any(getParent()), uno::Any(m_xShape) }, xContext ); return uno::Any( xTextFrame ); } @@ -727,7 +727,7 @@ ScVbaShape::WrapFormat() uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW ); if( xServiceInfo->supportsService( u"com.sun.star.text.TextDocument"_ustr )) { - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< uno::XInterface > xWrapFormat = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( u"ooo.vba.word.WrapFormat"_ustr ,{ uno::Any(getParent()), uno::Any(m_xShape) }, xContext ); return uno::Any( xWrapFormat ); } diff --git a/vcl/inc/vclstatuslistener.hxx b/vcl/inc/vclstatuslistener.hxx index bea222ef83dd..38d4b2f86b8a 100644 --- a/vcl/inc/vclstatuslistener.hxx +++ b/vcl/inc/vclstatuslistener.hxx @@ -48,7 +48,7 @@ VclStatusListener::VclStatusListener(T* widget, const css::uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = ::comphelper::getProcessComponentContext(); maCommandURL.Complete = aCommand; css::uno::Reference xParser = css::util::URLTransformer::create(xContext); xParser->parseStrict(maCommandURL); diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index 89b526c91ffa..ed9f62a5df20 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -36,7 +36,7 @@ using namespace ::com::sun::star; uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator() { - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); return i18n::BreakIterator::create(xContext); } diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 2bd03eaead81..9cc759dcdf12 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -492,7 +492,7 @@ PatternFormatter::~PatternFormatter() WidgetStatusListener::WidgetStatusListener(weld::Widget* widget, const OUString& aCommand) : mWidget(widget) { - css::uno::Reference xContext + const css::uno::Reference& xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference xDesktop = css::frame::Desktop::create(xContext); diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 75462f0a8999..01a8ff3385d7 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -71,7 +71,7 @@ BitmapEx loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags) void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScalingFactor) { - uno::Reference xContext(comphelper::getProcessComponentContext()); + const uno::Reference& xContext(comphelper::getProcessComponentContext()); const uno::Reference xSvgParser = graphic::SvgTools::create(xContext); std::size_t nSize = rStream.remainingSize(); diff --git a/vcl/source/control/managedmenubutton.cxx b/vcl/source/control/managedmenubutton.cxx index cdd0e5345c90..62be691c1e70 100644 --- a/vcl/source/control/managedmenubutton.cxx +++ b/vcl/source/control/managedmenubutton.cxx @@ -56,7 +56,7 @@ void ManagedMenuButton::PrepareExecute() m_xPopupMenu = GetPopupMenu()->CreateMenuInterface(); // FIXME: get the frame from the parent VclBuilder. - css::uno::Reference xContext(comphelper::getProcessComponentContext()); + const css::uno::Reference& xContext(comphelper::getProcessComponentContext()); css::uno::Reference xDesktop(css::frame::theDesktop::get(xContext)); css::uno::Reference xFrame(xDesktop->getActiveFrame()); if (!xFrame.is()) diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index 01913d0023e1..9daf031b0599 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.cxx @@ -70,7 +70,7 @@ namespace { ::std::vector< Image > aImages; - const Reference< css::uno::XComponentContext > aContext( ::comphelper::getProcessComponentContext() ); + const Reference< css::uno::XComponentContext >& aContext( ::comphelper::getProcessComponentContext() ); const Reference< XGraphicProvider > xGraphicProvider( css::graphic::GraphicProvider::create(aContext) ); ::std::vector< OUString > aImageURLs( Throbber::getDefaultImageURLs( i_imageSet ) ); diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index fbaceecdbc75..4ea3ebb859e4 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -89,7 +89,7 @@ OUString FilterConfigCache::FilterConfigCacheEntry::GetShortName() */ static Reference< XInterface > openConfig(const char* sPackage) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XInterface > xCfg; try diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 8fefa8cb6d4c..c3e508cd8665 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -99,7 +99,7 @@ void FilterConfigItem::ImpInitTree( std::u16string_view rSubTree ) { bModified = false; - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< XMultiServiceFactory > xCfgProv = theDefaultProvider::get( xContext ); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 97303ac8b07e..cab6032d187c 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1709,7 +1709,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, std::u16string_vi // do the normal GDIMetaFile export instead try { - css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); css::uno::Reference< css::xml::sax::XDocumentHandler > xSaxWriter( css::xml::sax::Writer::create( xContext ), css::uno::UNO_QUERY_THROW); diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index fd1205c9d4e9..e3a09aa7c4ca 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -519,7 +519,7 @@ void munchDrawCommands(std::vector> const& rDr { SvFileStream aFileStream(rWidgetDraw.msSource, StreamMode::READ); - uno::Reference xContext( + const uno::Reference& xContext( comphelper::getProcessComponentContext()); const uno::Reference xSvgParser = graphic::SvgTools::create(xContext); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 3e8ebc0380b8..bde951e0fd67 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -419,7 +419,7 @@ bool GDIMetaFile::ImplPlayWithRenderer(OutputDevice& rOut, const Point& rPos, Si uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY ); if( xBitmapCanvas.is() ) { - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const uno::Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); uno::Reference< rendering::XMtfRenderer > xMtfRenderer = rendering::MtfRenderer::createWithBitmapCanvas( xContext, xBitmapCanvas ); xBitmapCanvas->clear(); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 06b596a1df41..16a2c420d3a7 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10682,7 +10682,7 @@ void PDFWriterImpl::setLinkURL( sal_Int32 nLinkId, const OUString& rURL ) if (!m_xTrans.is()) { - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); m_xTrans = util::URLTransformer::create(xContext); } diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 95f8f6f72c0e..a06dbdb291d5 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -210,7 +210,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz { uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( *pStrm ); uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) ); uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 7b78c3a3cdce..73b70a37ded8 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -256,7 +256,7 @@ static OUString queryFile( Printer const * pPrinter ) { OUString aResult; - css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); css::uno::Reference< css::ui::dialogs::XFilePicker3 > xFilePicker = css::ui::dialogs::FilePicker::createWithMode(xContext, css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION); try diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx index 8b9b2b7522d9..953c0b66c822 100644 --- a/vcl/source/gdi/vectorgraphicdata.cxx +++ b/vcl/source/gdi/vectorgraphicdata.cxx @@ -63,7 +63,7 @@ BitmapEx convertPrimitive2DSequenceToBitmapEx( // create XPrimitive2DRenderer try { - uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(::comphelper::getProcessComponentContext()); const uno::Reference< graphic::XPrimitive2DRenderer > xPrimitive2DRenderer = graphic::Primitive2DTools::create(xContext); uno::Sequence< beans::PropertyValue > aViewParameters = { @@ -221,7 +221,7 @@ void VectorGraphicData::ensureSequenceAndRange() maRange.reset(); // create Vector Graphic Data interpreter - uno::Reference xContext(::comphelper::getProcessComponentContext()); + const uno::Reference& xContext(::comphelper::getProcessComponentContext()); switch (getType()) { diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 954231cf3946..ce2a3940dc8a 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -791,7 +791,7 @@ com::sun::star::uno::Reference< css::rendering::XCanvas > OutputDevice::ImplGetC GetSystemGfxDataAny() }; - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); static tools::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( css::rendering::CanvasFactory::create( xContext ) ); diff --git a/vcl/source/printer/Options.cxx b/vcl/source/printer/Options.cxx index fbf7a069d518..7ead9d6e77e0 100644 --- a/vcl/source/printer/Options.cxx +++ b/vcl/source/printer/Options.cxx @@ -42,7 +42,7 @@ void Options::ReadFromConfig(bool i_bFile) try { // get service provider - css::uno::Reference xContext( + const css::uno::Reference& xContext( comphelper::getProcessComponentContext()); // create configuration hierarchical access name try diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx index 5621a9d4c1f6..b8fe73d67bd6 100644 --- a/vcl/source/text/textlayout.cxx +++ b/vcl/source/text/textlayout.cxx @@ -411,7 +411,7 @@ namespace vcl if (bHyphenate) { // get service provider - css::uno::Reference xContext(comphelper::getProcessComponentContext()); + const css::uno::Reference& xContext(comphelper::getProcessComponentContext()); css::uno::Reference xLinguMgr = css::linguistic2::LinguServiceManager::create(xContext); xHyph = xLinguMgr->getHyphenator(); } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 150f3ccbfb57..af119397e0a8 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -193,7 +193,7 @@ static OUString ImplGetParameterString( const TransferableObjectDescriptor& rObj static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, const DataFlavorEx& rFlavorEx ) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); try { @@ -1232,7 +1232,7 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor { try { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext ); DataFlavorEx aFlavorEx; static constexpr OUString aCharsetStr( u"charset"_ustr ); @@ -2218,7 +2218,7 @@ TransferableDataHelper TransferableDataHelper::CreateFromPrimarySelection() bool TransferableDataHelper::IsEqual( const css::datatransfer::DataFlavor& rInternalFlavor, const css::datatransfer::DataFlavor& rRequestFlavor ) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); bool bRet = false; try diff --git a/vcl/source/treelist/transfer2.cxx b/vcl/source/treelist/transfer2.cxx index a3cf6ac577ca..ce2c2073ba79 100644 --- a/vcl/source/treelist/transfer2.cxx +++ b/vcl/source/treelist/transfer2.cxx @@ -507,7 +507,7 @@ Reference GetSystemPrimarySelection() Reference xSelection; try { - Reference xContext(comphelper::getProcessComponentContext()); + const Reference& xContext(comphelper::getProcessComponentContext()); #if USING_X11 // A hack, making the primary selection available as an instance // of the SystemClipboard service on X11: diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 7a6c45eedd91..ed51851aaa49 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -624,7 +624,7 @@ void Dialog::dispose() mpActionArea.clear(); mpContentArea.clear(); - css::uno::Reference< css::uno::XComponentContext > xContext( + const css::uno::Reference< css::uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); css::uno::Reference xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW); css::document::DocumentEvent aObject; @@ -1014,7 +1014,7 @@ bool Dialog::ImplStartExecute() // FIXME: no layouting, workaround some clipping issues ImplAdjustNWFSizes(); - css::uno::Reference< css::uno::XComponentContext > xContext( + const css::uno::Reference< css::uno::XComponentContext >& xContext( comphelper::getProcessComponentContext()); bool bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get()); ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE; @@ -1645,7 +1645,7 @@ void Dialog::Activate() { if (GetType() == WindowType::MODELESSDIALOG) { - css::uno::Reference< css::uno::XComponentContext > xContext( + const css::uno::Reference< css::uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); css::uno::Reference xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW); css::document::DocumentEvent aObject; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8cde4c668112..bf8a84eeebfd 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3743,7 +3743,7 @@ Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSp GetSystemGfxDataAny() }; - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); // Create canvas instance with window handle diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index bde65c2936dc..e802f70da07e 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -3764,7 +3764,7 @@ void SelectionManager::run( void* pThis ) timeval aLast; gettimeofday( &aLast, nullptr ); - css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const css::uno::Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); This->m_xDesktop.set( Desktop::create(xContext) ); This->m_xDesktop->addTerminateListener(This); diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 87a05a95e0cd..42243c60e965 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -1471,7 +1471,7 @@ static void session_client_response(GDBusProxy* client_proxy) // unset documents "modify" flag so they won't veto closing static void clear_modify_and_terminate() { - css::uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xDesktop(frame::Desktop::create(xContext)); uno::Reference xComponents = xDesktop->getComponents()->createEnumeration(); while (xComponents->hasMoreElements()) @@ -1490,7 +1490,7 @@ static void session_client_signal(GDBusProxy* client_proxy, const char*, const c if (g_str_equal (signal_name, "QueryEndSession")) { - css::uno::Reference xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xDesktop(frame::Desktop::create(xContext)); bool bModified = false; diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index bdbce90d2175..439a2bcce421 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -802,7 +802,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, if( bAddExtensionPath ) { - Reference< XComponentContext > xContext( + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionRegistryPath, xContext ); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 5d3b1693f6f2..a1fac7424cf2 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -441,7 +441,7 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen Reference< chart2::data::XDataSource > lcl_createDataSource( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData ) { - Reference< uno::XComponentContext > xContext( + const Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< chart2::data::XDataSink > xSink( xContext->getServiceManager()->createInstanceWithContext( diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index fb9682dd9411..6f98df5da718 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -177,7 +177,7 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries( xDoc->getFirstDiagram(), uno::UNO_QUERY_THROW ); Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - Reference< uno::XComponentContext > xContext( + const Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); if( nCoordinateSystemIndex < aCooSysSeq.getLength()) diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index b4eb49345ae1..4ace40238e47 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -1026,7 +1026,7 @@ static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocume xSeqProp->setPropertyValue(u"Role"_ustr, uno::Any( aRole )); - Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< chart2::data::XLabeledDataSequence > xLabelSeq( chart2::data::LabeledDataSequence::create(xContext), uno::UNO_QUERY_THROW ); diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 62f7a8336155..7022fb6db9ce 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -1221,7 +1221,7 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri Sequence< Reference> xLabels(nLabelCount); auto pxLabels = xLabels.getArray(); - Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); for( size_t j = 0; j < nLabelCount; ++j ) { Reference< chart2::XDataPointCustomLabelField > xCustomLabel = chart2::DataPointCustomLabelField::create(xContext); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index dd5d2c1bbf0c..c71867a25613 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -339,7 +339,7 @@ XMLTokenEnum getTokenByChartType( Reference< chart2::data::XLabeledDataSequence2 > GetNewLabeledDataSequence() { - Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext() ); Reference< chart2::data::XLabeledDataSequence2 > xResult = chart2::data::LabeledDataSequence::create(xContext); return xResult; } diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx index 81e0e211002d..83090f9bbc36 100644 --- a/xmloff/source/core/DomBuilderContext.cxx +++ b/xmloff/source/core/DomBuilderContext.cxx @@ -229,7 +229,7 @@ void DomBuilderContext::characters( const OUString& rCharacters ) static Reference lcl_createDomInstance() { - Reference xContext = comphelper::getProcessComponentContext(); + const Reference& xContext = comphelper::getProcessComponentContext(); SAL_WARN_IF( !xContext.is(), "xmloff", "can't get service factory" ); Reference xBuilder( DocumentBuilder::create(xContext) ); diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 3e575869b476..c5a250be702d 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -69,7 +69,7 @@ getRelativeReference(SvXMLExport const& rExport, OUString const& rURI) rExport.GetModel(), uno::UNO_QUERY_THROW ); OUString const baseURI( xModelURI->getStringValue() ); - uno::Reference xContext( comphelper::getProcessComponentContext() ); + const uno::Reference& xContext( comphelper::getProcessComponentContext() ); uno::Reference const xUriFactory = uri::UriReferenceFactory::create( xContext ); diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 608e23cbc225..35358e6b6143 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -510,7 +510,7 @@ AnimationNodeContext::AnimationNodeContext( if( pServiceName ) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); mxNode.set( xContext->getServiceManager()->createInstanceWithContext(OUString::createFromAscii(pServiceName), xContext), diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 1551c418be2d..5af74d7fc93a 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -235,7 +235,7 @@ uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement { aEngine = "com.sun.star.drawing.EnhancedCustomShapeEngine"; } - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); if ( !aEngine.isEmpty() ) { diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index c4db4450ba35..85ace1eaa4b2 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -307,7 +307,7 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt return; // get the services needed for writing the xml data - Reference< uno::XComponentContext > xContext = + const Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< XWriter > xWriter = Writer::create(xContext); @@ -351,7 +351,7 @@ uno::Sequence< util::RevisionTag > SAL_CALL XMLVersionListPersistence::load( con try { if ( xRoot.is() && xRoot->hasByName( sDocName ) && xRoot->isStreamElement( sDocName ) ) { - Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< uno::XComponentContext >& xContext = comphelper::getProcessComponentContext(); InputSource aParserInput; diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx index b98d4077dd20..7982d2b3bc63 100644 --- a/xmloff/source/transform/EventOASISTContext.cxx +++ b/xmloff/source/transform/EventOASISTContext.cxx @@ -127,7 +127,7 @@ static bool ParseURL( const OUString& rAttrValue, OUString* pName, OUString* pLocation ) { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::uri::XUriReferenceFactory > xFactory = css::uri::UriReferenceFactory::create(xContext); diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index bf0a71494908..cbec872376cd 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1704,7 +1704,7 @@ void OOo2OasisTransformer::Initialize( Reference< XInterface > xFilter; if( !m_aSubServiceName.isEmpty() ) { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); // get filter component xFilter = xContext->getServiceManager()->createInstanceWithArgumentsAndContext(m_aSubServiceName, rArguments, xContext); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 385a706f8654..6ffb6e736247 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -730,7 +730,7 @@ void ElementDescriptor::readImageOrGraphicAttr(OUString const & rAttrName) Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY ); if ( xDocStorage.is() ) { - Reference xContext = ::comphelper::getProcessComponentContext(); + const Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xGraphicStorageHandler; xGraphicStorageHandler.set(document::GraphicStorageHandler::createWithStorage(xContext, xDocStorage->getDocumentStorage())); if (xGraphicStorageHandler.is()) diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 163efb04e943..89fef57d032d 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -315,7 +315,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch) seqLoadedCertsLabels.push_back(XsResId(STR_LOADED_CERTS_X509_MSCRYPT)); #else // _WIN32 // Should be the last one for optimal formatting, because of the appended path. - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); OUString nssPath = xml::crypto::NSSInitializer::create(xContext)->getNSSPath(); seqLoadedCertsLabels.push_back(XsResId(STR_LOADED_CERTS_X509_NSS_NEWLINE) + nssPath); #endif // _WIN32 diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 2442ab51a7c1..c7193e4c1b8f 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -605,7 +605,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void) if (!sExecutable.isEmpty()) { - uno::Reference xContext + const uno::Reference& xContext = ::comphelper::getProcessComponentContext(); uno::Reference xSystemShell( css::system::SystemShellExecute::create(xContext)); diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 03b078fcedae..cd21d68e32e8 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -299,7 +299,7 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, AddLocPBHdl, weld::Button&, void) { try { - uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference < uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_pDlg->getDialog()); short nRet = xFolderPicker->execute(); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 699284a56366..152657af292f 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -95,7 +95,7 @@ struct UsageDescription static char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < task::XInteractionHandler2 > xInteractionHandler( task::InteractionHandler::createWithParent(xContext, nullptr) );