filter/source/t602/t602filter.cxx | 4 ++-- sc/source/ui/drawfunc/fuins2.cxx | 5 +---- sc/source/ui/view/cellsh1.cxx | 5 ++--- sd/source/ui/func/fuhhconv.cxx | 5 ++--- svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx | 9 ++++----- svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx | 2 -- sw/source/uibase/shells/annotsh.cxx | 5 ++--- sw/source/uibase/table/chartins.cxx | 6 ++---- sw/source/uibase/uiview/viewling.cxx | 4 +--- 9 files changed, 16 insertions(+), 29 deletions(-)
New commits: commit 9b09f64173fa8c9fe1f4bbed6ab018141407321b Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jan 27 09:45:42 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Jan 27 12:20:28 2025 +0100 Resolves: cool#10952 use existing ComponentContext instead of unnecessarily bootstrapping an entirely new one See: https://github.com/CollaboraOnline/online/issues/10952 Change-Id: I625c539eb7272e152ee84a568f235751128bd96a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180776 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 85c7fa0ba773..94c52f52bb0a 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -21,7 +21,6 @@ #include <strings.hrc> #include <cppuhelper/factory.hxx> -#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -30,6 +29,7 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> #include <osl/diagnose.h> #include <rtl/ref.hxx> #include <rtl/character.hxx> @@ -883,7 +883,7 @@ bool T602ImportFilterDialog::OptionsDlg() any <<= _obj;\ _cont->insertByName( _nam, any ); - Reference < XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext(); + Reference < XComponentContext > rComponentContext = ::comphelper::getProcessComponentContext(); Reference < XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager(); Reference < XInterface > rInstance = rServiceManager->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, rComponentContext ); diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index a44532a05907..cc373117bfa2 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -57,7 +57,6 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> -#include <cppuhelper/bootstrap.hxx> #include <svtools/dialogclosedlistener.hxx> #include <officecfg/Office/Common.hxx> @@ -628,9 +627,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV rViewShell.ActivateObject(pObj.get(), embed::EmbedVerbs::MS_OLEVERB_SHOW); //open wizard - //@todo get context from calc if that has one - uno::Reference< uno::XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if(xContext.is()) { uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index e45afab83c00..f94f19ac7c48 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -27,6 +27,7 @@ #include <basic/sberrors.hxx> #include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> #include <svl/stritem.hxx> #include <svl/numformat.hxx> @@ -95,7 +96,6 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/bootstrap.hxx> #include <o3tl/string_view.hxx> #include <memory> @@ -2004,8 +2004,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_CHINESE_CONVERSION: { //open ChineseTranslationDialog - Reference< XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if(xContext.is()) { Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); diff --git a/sd/source/ui/func/fuhhconv.cxx b/sd/source/ui/func/fuhhconv.cxx index 95908e2e72b0..be40d46eea63 100644 --- a/sd/source/ui/func/fuhhconv.cxx +++ b/sd/source/ui/func/fuhhconv.cxx @@ -24,8 +24,8 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> -#include <cppuhelper/bootstrap.hxx> #include <svl/style.hxx> #include <editeng/eeitem.hxx> #include <editeng/langitem.hxx> @@ -187,8 +187,7 @@ void FuHangulHanjaConversion::ConvertStyles( LanguageType nTargetLanguage, const void FuHangulHanjaConversion::StartChineseConversion() { //open ChineseTranslationDialog - Reference< XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if(!xContext.is()) return; diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx index d2abde7d9675..4f3be7e3cd5e 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx @@ -19,7 +19,6 @@ #include "chinese_dictionarydialog.hxx" -#include <cppuhelper/bootstrap.hxx> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/linguistic2/ConversionDictionaryType.hpp> #include <com/sun/star/linguistic2/ConversionPropertyType.hpp> @@ -27,6 +26,7 @@ #include <com/sun/star/linguistic2/XConversionPropertyType.hpp> #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/lang/Locale.hpp> +#include <comphelper/processfactory.hxx> #include <o3tl/safeint.hxx> #include <unotools/lingucfg.hxx> #include <unotools/linguprops.hxx> @@ -326,11 +326,10 @@ ChineseDictionaryDialog::ChineseDictionaryDialog(weld::Window* pParent) Reference< linguistic2::XConversionDictionary > xDictionary_To_Traditional; //get dictionaries { - if(!m_xContext.is()) - m_xContext.set( ::cppu::defaultBootstrap_InitialComponentContext() ); - if(m_xContext.is()) + css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + if (xContext.is()) { - Reference< linguistic2::XConversionDictionaryList > xDictionaryList = linguistic2::ConversionDictionaryList::create(m_xContext); + Reference< linguistic2::XConversionDictionaryList > xDictionaryList = linguistic2::ConversionDictionaryList::create(xContext); Reference< container::XNameContainer > xContainer( xDictionaryList->getDictionaryContainer() ); if(xContainer.is()) { diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx index 87aae3dc4543..626dc1f1f971 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx @@ -141,8 +141,6 @@ private: private: sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption - css::uno::Reference<css::uno::XComponentContext> m_xContext; - std::unique_ptr<weld::RadioButton> m_xRB_To_Simplified; std::unique_ptr<weld::RadioButton> m_xRB_To_Traditional; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 7e8430897fb6..a0f889e69406 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -96,8 +96,8 @@ #include <swabstdlg.hxx> #include <comphelper/string.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> -#include <cppuhelper/bootstrap.hxx> #include <langhelper.hxx> @@ -1361,8 +1361,7 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq) case SID_CHINESE_CONVERSION: { //open ChineseTranslationDialog - Reference< XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if(xContext.is()) { Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index cb10778be9bb..f7290820da35 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -36,7 +36,7 @@ #include <cmdid.h> #include <anchoredobject.hxx> -#include <cppuhelper/bootstrap.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> @@ -159,9 +159,7 @@ SwInsertChart::SwInsertChart( const Link<css::ui::dialogs::DialogClosedEvent*, v xChartModel.set( SwTableFUNC( &rWrtShell ).InsertChart( xDataProvider, xDataProvider.is(), aRangeString, &pFlyFrameFormat )); //open wizard - //@todo get context from writer if that has one - uno::Reference< uno::XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if( !(xContext.is() && xChartModel.is() && xDataProvider.is())) return; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 34a579b21fcd..ef7c2dfbc77c 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -76,7 +76,6 @@ #include <vcl/unohelp.hxx> #include <rtl/ustring.hxx> -#include <cppuhelper/bootstrap.hxx> #include <svtools/langtab.hxx> #include <editeng/editerr.hxx> @@ -107,8 +106,7 @@ void SwView::ExecLingu(SfxRequest &rReq) case SID_CHINESE_CONVERSION: { //open ChineseTranslationDialog - Reference< XComponentContext > xContext( - ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); if(xContext.is()) { Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
