From 3b16dfd80f632beffdc75fbde0e5d3248c5d4b1a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 8 Nov 2019 15:56:01 +0100 Subject: Combine LoadEnv's initializeLoading and startLoading ...as they are only ever called directly one after the other. Rename the original initializeLoading to startLoading, and rename the original startLoading to private start (called at the end of the original initializeLoading). Change-Id: I5271387450324cc26743195329c4f401cf3aa0f9 Reviewed-on: https://gerrit.libreoffice.org/82308 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- framework/source/dispatch/loaddispatcher.cxx | 3 +- framework/source/inc/loadenv/loadenv.hxx | 41 ++++++++++------------------ framework/source/loadenv/loadenv.cxx | 13 +++++---- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/framework/source/dispatch/loaddispatcher.cxx b/framework/source/dispatch/loaddispatcher.cxx index 07ee5adf9798..eb6f5e1ae32a 100644 --- a/framework/source/dispatch/loaddispatcher.cxx +++ b/framework/source/dispatch/loaddispatcher.cxx @@ -102,8 +102,7 @@ css::uno::Any LoadDispatcher::impl_dispatch( const css::util::URL& rURL, css::uno::Reference< css::lang::XComponent > xComponent; try { - m_aLoader.initializeLoading( rURL.Complete, lArguments, xBaseFrame, m_sTarget, m_nSearchFlags, LoadEnvFeatures::AllowContentHandler | LoadEnvFeatures::WorkWithUI); - m_aLoader.startLoading(); + m_aLoader.startLoading( rURL.Complete, lArguments, xBaseFrame, m_sTarget, m_nSearchFlags, LoadEnvFeatures::AllowContentHandler | LoadEnvFeatures::WorkWithUI); m_aLoader.waitWhileLoading(); // wait for ever! xComponent = m_aLoader.getTargetComponent(); diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 5b149f72ec0d..44ba54dfcac6 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -221,16 +221,26 @@ public: sal_Int32 nFlags , const css::uno::Sequence< css::beans::PropertyValue >& lArgs ); - /** @short set some changeable parameters for a new load request. + /** @short start loading of a resource @descr The parameter for targeting, the content description, and some environment specifier (UI, dispatch functionality) - can be set here ... BEFORE the real load process is started - by calling startLoading(). Of course a still running load request + can be set here. Of course a still running load request will be detected here and a suitable exception will be thrown. Such constellation can be detected outside by using provided synchronisation methods or callbacks. + There is no direct return value possible here. Because it depends + from the usage of this instance! E.g. for loading a "visible component" + a frame with a controller/model inside can be possible. For loading + of a "non visible component" only an information about a successfully start + can be provided. + Further it can't be guaranteed, that the internal process runs synchronous. + that's why we prefer using of specialized methods afterwards e.g. to: + - wait till the internal job will be finished + and get the results + - or to let it run without any further control from outside. + @param sURL points to the resource, which should be loaded. @@ -258,35 +268,13 @@ public: @throw A RuntimeException in case any internal process indicates, that the whole runtime can't be used any longer. */ - void initializeLoading(const OUString& sURL , + void startLoading(const OUString& sURL , const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor, const css::uno::Reference< css::frame::XFrame >& xBaseFrame , const OUString& sTarget , sal_Int32 nSearchFlags , LoadEnvFeatures eFeature = LoadEnvFeatures::NONE); - /** @short start loading of the resource represented by this loadenv instance. - - @descr There is no direct return value possible here. Because it depends - from the usage of this instance! E.g. for loading a "visible component" - a frame with a controller/model inside can be possible. For loading - of a "non visible component" only an information about a successfully start - can be provided. - Further it can't be guaranteed, that the internal process runs synchronous. - that's why we prefer using of specialized methods afterwards e.g. to: - - wait till the internal job will be finished - and get the results - - or to let it run without any further control from outside. - - @throw A LoadEnvException if start of the load process failed (because - another is still in progress!). - The reason, a suitable message and ID will be given here immediately. - - @throw A RuntimeException in case any internal process indicates, that - the whole runtime can't be used any longer. - */ - void startLoading(); - /** @short wait for an already running load request (started by calling startLoading() before). @@ -375,6 +363,7 @@ public: void impl_reactForLoadingState(); private: + void start(); /** @short tries to detect the type and the filter of the specified content. diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index e0b0fd7a4687..cb5b5aaf45db 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -162,13 +162,12 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const if (aDescriptor.get("Hidden") == uno::Any(true) || Application::IsHeadlessModeEnabled()) loadEnvFeatures = LoadEnvFeatures::NONE; - aEnv.initializeLoading(sURL, + aEnv.startLoading(sURL, lArgs, css::uno::Reference< css::frame::XFrame >(xLoader, css::uno::UNO_QUERY), sTarget, nSearchFlags, loadEnvFeatures); - aEnv.startLoading(); aEnv.waitWhileLoading(); // wait for ever! xComponent = aEnv.getTargetComponent(); @@ -226,7 +225,7 @@ utl::MediaDescriptor addModelArgs(const uno::Sequence& rDe } -void LoadEnv::initializeLoading(const OUString& sURL, const uno::Sequence& lMediaDescriptor, +void LoadEnv::startLoading(const OUString& sURL, const uno::Sequence& lMediaDescriptor, const uno::Reference& xBaseFrame, const OUString& sTarget, sal_Int32 nSearchFlags, LoadEnvFeatures eFeature) { @@ -258,7 +257,7 @@ void LoadEnv::initializeLoading(const OUString& sURL, const uno::Sequence& i_rxContext, @@ -346,7 +347,7 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XCompon io_lMediaDescriptor[utl::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; } -void LoadEnv::startLoading() +void LoadEnv::start() { // SAFE -> { @@ -360,7 +361,7 @@ void LoadEnv::startLoading() // check "classifyContent()" failed before ... if (m_eContentType == E_UNSUPPORTED_CONTENT) throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, - "from LoadEnv::startLoading"); + "from LoadEnv::start"); } // <- SAFE -- cgit