summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-11-08 12:00:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-11-08 15:23:52 +0100
commited0b12f4eadf1f2242f06cbd56804f75376274b1 (patch)
tree7028abd9cf514c74bd1b795cc6398b0bb433f319 /sw
parent5ff283e3b841230a45715e48a251c3c4216d1cec (diff)
no need to take a copy of the getProcessComponentContext return value
we can just take a "const &". (found by running clang-tidy with the performance-unnecessary-copy-initialization warning) Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/bastyp/checkit.cxx2
-rw-r--r--sw/source/core/bastyp/init.cxx2
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/doc/rdfhelper.cxx14
-rw-r--r--sw/source/core/edit/edfldexp.cxx3
-rw-r--r--sw/source/core/fields/macrofld.cxx2
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx14
-rw-r--r--sw/source/core/tox/toxhlp.cxx2
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx4
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx4
-rw-r--r--sw/source/filter/xml/swxml.cxx4
-rw-r--r--sw/source/filter/xml/wrtxml.cxx2
-rw-r--r--sw/source/filter/xml/xmlimp.cxx2
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx2
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx2
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx4
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx2
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx2
-rw-r--r--sw/source/ui/fldui/changedb.cxx2
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx4
-rw-r--r--sw/source/ui/table/autoformatpreview.cxx3
-rw-r--r--sw/source/ui/vba/vbatemplate.cxx2
-rw-r--r--sw/source/uibase/app/docsh.cxx2
-rw-r--r--sw/source/uibase/app/docsh2.cxx4
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx4
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx16
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx2
-rw-r--r--sw/source/uibase/dbui/mailmergehelper.cxx2
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx4
-rw-r--r--sw/source/uibase/misc/numberingtypelistbox.cxx3
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx2
-rw-r--r--sw/source/uibase/uiview/view.cxx2
-rw-r--r--sw/source/uibase/uiview/view2.cxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx4
-rw-r--r--sw/source/uibase/uno/dlelstnr.cxx2
37 files changed, 69 insertions, 65 deletions
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<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ const Reference<XComponentContext>& 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<SwXTextDocument>& xModel,
{
try
{
- uno::Reference<uno::XComponentContext> xComponentContext(
+ const uno::Reference<uno::XComponentContext>& 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<SwXTextDocument>& xModel,
const css::uno::Reference<css::rdf::XResource>& xSubject,
const OUString& rKey, const OUString& rValue)
{
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(xModel);
const uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType);
@@ -121,7 +121,7 @@ void SwRDFHelper::addStatement(const rtl::Reference<SwXTextDocument>& xModel,
bool SwRDFHelper::hasMetadataGraph(const rtl::Reference<SwXTextDocument>& xModel, const OUString& rType)
{
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(xModel);
return getGraphNames(xDocumentMetadataAccess, xType).hasElements();
@@ -132,7 +132,7 @@ void SwRDFHelper::removeStatement(const rtl::Reference<SwXTextDocument>& xModel,
const css::uno::Reference<css::rdf::XResource>& xSubject,
const OUString& rKey, const OUString& rValue)
{
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(xModel);
const uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType);
@@ -149,7 +149,7 @@ void SwRDFHelper::clearStatements(const rtl::Reference<SwXTextDocument>& xModel,
const OUString& rType,
const css::uno::Reference<css::rdf::XResource>& xSubject)
{
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
const uno::Sequence< uno::Reference<rdf::XURI> > 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
rtl::Reference<SwXTextDocument> xModel(rTextNode.GetDoc().GetDocShell()->GetBaseModel());
uno::Reference<rdf::XDocumentMetadataAccess> 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
rtl::Reference<SwXTextDocument> xModel(rTextNode.GetDoc().GetDocShell()->GetBaseModel());
uno::Reference<rdf::XDocumentMetadataAccess> 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<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xContext(
+ ::comphelper::getProcessComponentContext());
uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
std::vector<SwFormatField*> 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<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ const uno::Reference<uno::XComponentContext>& xContext = ::comphelper::getProcessComponentContext();
uno::Reference<uri::XUriReferenceFactory> xFactory = uri::UriReferenceFactory::create(xContext);
uno::Reference<uri::XVndSunStarScriptUrl> 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<css::frame::XFrame> xTargetFrame = xDesktop->findFrame(u"_blank"_ustr, 0);
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xContext(
+ comphelper::getProcessComponentContext());
uno::Reference<css::frame::XModel2> 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Sequence<uno::Any> 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<SwXTextDocument> const xModel(m_rDoc.GetDocShell()->GetBaseModel());
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
const uno::Reference<rdf::XURI> xBaseURI(sfx2::createBaseURI(xComponentContext, static_cast<SfxBaseModel*>(xModel.get()), m_sBaseURL));
uno::Reference<task::XInteractionHandler> 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& 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<css::ui::XUIConfigurationManager> 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<document::XGraphicStorageHandler> xGraphicStorageHandler;
@@ -982,7 +982,7 @@ ErrCodeMsg XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM,
size_t XMLReader::GetSectionList( SfxMedium& rMedium,
std::vector<OUString>& 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<css::frame::XDesktop2> xDesktop = css::frame::Desktop::create(comphelper::getProcessComponentContext());
uno::Reference<css::frame::XFrame> xTargetFrame = xDesktop->findFrame(u"_blank"_ustr, 0);
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xContext(comphelper::getProcessComponentContext());
uno::Reference<css::frame::XModel2> 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<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ const uno::Reference<uno::XComponentContext>& 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<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ const uno::Reference<XComponentContext>& 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<Any>& 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<XPropertySet> 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<XDatabaseContext> 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<weld::Dialog> 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<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ const uno::Reference<uno::XComponentContext>& 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<uno::XComponentContext> const xContext(
+ uno::Reference<uno::XComponentContext> const& xContext(
::comphelper::getProcessComponentContext());
uno::Reference<io::XOutputStream> const xOutStream(
@@ -434,7 +434,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules,
void ImportStoredChapterNumberingRules(SwChapterNumRules & rRules,
SvStream & rStream, OUString const& rFileName)
{
- uno::Reference<uno::XComponentContext> const xContext(
+ uno::Reference<uno::XComponentContext> const& xContext(
::comphelper::getProcessComponentContext());
uno::Reference<io::XInputStream> 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& 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<sdbc::XDataSource> const & xSource)
{
- uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ const uno::Reference<uno::XComponentContext>& xContext = ::comphelper::getProcessComponentContext();
rParam.xFormatter = util::NumberFormatter::create(xContext);
uno::Reference<beans::XPropertySet> xSourceProps(
(xSource.is()
@@ -1883,7 +1883,7 @@ uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rD
uno::Reference<sdbc::XDataSource>& 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<sdb::XCompletedConnection> xComplConnection(dbtools::getDataSource(rDataSource, xContext), uno::UNO_QUERY);
@@ -2537,7 +2537,7 @@ const SwDBData& SwDBManager::GetAddressDBName()
uno::Sequence<OUString> SwDBManager::GetExistingDatabaseNames()
{
- uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ const uno::Reference<uno::XComponentContext>& xContext( ::comphelper::getProcessComponentContext() );
uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
return xDBContext->getElementNames();
}
@@ -2696,7 +2696,7 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference
try
{
- uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xContext(::comphelper::getProcessComponentContext());
uno::Reference<sdb::XDatabaseContext> 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<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ const uno::Reference<uno::XComponentContext>& 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<sdbc::XDataSource> xSource;
uno::Reference<container::XChild> 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<XNumberingTypeInfo> const & SwFieldMgr::GetNumberingInfo() const
{
if(!m_xNumberingInfo.is())
{
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ const Reference<XComponentContext>& xContext( ::comphelper::getProcessComponentContext() );
Reference<XDefaultNumberingProvider> xDefNum = text::DefaultNumberingProvider::create(xContext);
const_cast<SwFieldMgr*>(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<weld::ComboBox> p
: m_xWidget(std::move(pWidget))
, m_xImpl(new SwNumberingTypeListBox_Impl)
{
- uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
+ const uno::Reference<uno::XComponentContext>& xContext(
+ ::comphelper::getProcessComponentContext());
uno::Reference<text::XDefaultNumberingProvider> 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<XComponentContext> xContext = comphelper::getProcessComponentContext();
+ const Reference<XComponentContext>& 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<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ const uno::Reference<XComponentContext>& xContext( ::comphelper::getProcessComponentContext() );
uno::Reference<XDatabaseContext> 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);