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 2608fa7cbe8b3ca6d66fce03e6c592a905103e33 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Jan 27 09:45:42 2025 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jan 27 14:20:23 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/+/180775 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index d97bc3d5e5de..ba3fdb67d55b 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> @@ -885,7 +885,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("com.sun.star.awt.UnoControlDialogModel", rComponentContext ); diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 4d34208b7ec6..de420da65d1c 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 f0f7a4d713da..d1484ca9b07a 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> @@ -1996,8 +1996,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 a312439bb646..90377d34006f 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 4ff5aadc8792..e72a88fce159 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 fc05f397693d..53931f34706d 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx @@ -138,8 +138,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 4d87aacd451e..91f751f0d74b 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -94,8 +94,8 @@ #include <swabstdlg.hxx> #include <comphelper/string.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> -#include <cppuhelper/bootstrap.hxx> #include <langhelper.hxx> @@ -1313,8 +1313,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 74bc534df966..3d31580c7e25 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 289f63e5bb7f..6d8fa417b17e 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -75,7 +75,6 @@ #include <vcl/svapp.hxx> #include <rtl/ustring.hxx> -#include <cppuhelper/bootstrap.hxx> #include <svtools/langtab.hxx> #include <editeng/editerr.hxx> @@ -106,8 +105,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() );