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(-)

New commits:
commit 3b16dfd80f632beffdc75fbde0e5d3248c5d4b1a
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Nov 8 15:56:01 2019 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Nov 8 17:26:46 2019 +0100

    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 <sberg...@redhat.com>

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<beans::PropertyValue>& rDe
 
 }
 
-void LoadEnv::initializeLoading(const OUString& sURL, const 
uno::Sequence<beans::PropertyValue>& lMediaDescriptor,
+void LoadEnv::startLoading(const OUString& sURL, const 
uno::Sequence<beans::PropertyValue>& lMediaDescriptor,
         const uno::Reference<frame::XFrame>& xBaseFrame, const OUString& 
sTarget,
         sal_Int32 nSearchFlags, LoadEnvFeatures eFeature)
 {
@@ -258,7 +257,7 @@ void LoadEnv::initializeLoading(const OUString& sURL, const 
uno::Sequence<beans:
     // the load request. We take over the result then!
     m_eContentType = LoadEnv::classifyContent(aRealURL, lMediaDescriptor);
     if (m_eContentType == E_UNSUPPORTED_CONTENT)
-        throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, "from 
LoadEnv::initializeLoading");
+        throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, "from 
LoadEnv::startLoading");
 
     // make URL part of the MediaDescriptor
     // It doesn't matter if it is already an item of it.
@@ -293,6 +292,8 @@ void LoadEnv::initializeLoading(const OUString& sURL, const 
uno::Sequence<beans:
         
!m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(),
 false);
 
     initializeUIDefaults(m_xContext, m_lMediaDescriptor, bUIMode, 
&m_pQuietInteraction);
+
+    start();
 }
 
 void LoadEnv::initializeUIDefaults( const css::uno::Reference< 
css::uno::XComponentContext >& 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
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to