[Libreoffice-commits] core.git: framework/source

Caolán McNamara caolanm at redhat.com
Wed Mar 21 14:48:51 UTC 2018


 framework/source/inc/loadenv/loadenv.hxx |    5 ++++
 framework/source/loadenv/loadenv.cxx     |   37 ++++++++++++++++++++++++++++---
 2 files changed, 39 insertions(+), 3 deletions(-)

New commits:
commit 754f6e2fe0d329e12e9e083d4fccc4086d9b4d04
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 21 13:14:51 2018 +0000

    tdf#115683 there are other cases of dialogs before document load
    
    Change-Id: I97ddbb528927fecb66072b42baa90272de2af39a
    Reviewed-on: https://gerrit.libreoffice.org/51704
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx
index ca8999f889a9..90f9c7ac89f5 100644
--- a/framework/source/inc/loadenv/loadenv.hxx
+++ b/framework/source/inc/loadenv/loadenv.hxx
@@ -547,6 +547,11 @@ private:
      */
     void impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& xFrame,
                          const css::util::URL&                            aURL  );
+
+    /** @short  determine if this loader has an interactive dialog shown before
+                loading the document.
+     */
+    bool impl_filterHasInteractiveDialog() const;
 };
 
 } // namespace framework
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index c915f80827bb..381f2f287f0c 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -963,6 +963,38 @@ bool LoadEnv::impl_furtherDocsAllowed()
     return bAllowed;
 }
 
+bool LoadEnv::impl_filterHasInteractiveDialog() const
+{
+    //show the frame now so it can be the parent for any message dialogs shown during import
+
+    //unless (tdf#114648) an Interactive case such as the new database wizard
+    if (m_aURL.Arguments == "Interactive")
+       return true;
+
+    // unless (tdf#116277) its the labels/business cards slave frame
+    if (m_aURL.Arguments.indexOf("slot=") != -1)
+        return true;
+
+    OUString sFilter = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_FILTERNAME(), OUString());
+    if (sFilter.isEmpty())
+        return false;
+
+    // unless (tdf#115683) the filter has a UIComponent
+    OUString sUIComponent;
+    css::uno::Reference<css::container::XNameAccess> xFilterCont(m_xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_FILTERFACTORY, m_xContext),
+                                                                 css::uno::UNO_QUERY_THROW);
+    try
+    {
+        ::comphelper::SequenceAsHashMap lFilterProps(xFilterCont->getByName(sFilter));
+        sUIComponent = lFilterProps.getUnpackedValueOrDefault("UIComponent", OUString());
+    }
+    catch(const css::container::NoSuchElementException&)
+    {
+    }
+
+    return !sUIComponent.isEmpty();
+}
+
 bool LoadEnv::impl_loadContent()
 {
     // SAFE -> -----------------------------------
@@ -1076,9 +1108,8 @@ bool LoadEnv::impl_loadContent()
                 {"Parent", uno::Any(xWindow)}
             }));
             xHandler->initialize(aArguments);
-            //show the frame now, unless (tdf#116277) its the labels/business cards slave frame
-            //or (tdf#114648) an Interactive case such as the new database wizard
-            if (m_aURL.Arguments != "Interactive" && m_aURL.Arguments.indexOf("slot=") == -1)
+            //show the frame as early as possible to make it the parent of any message dialogs
+            if (!impl_filterHasInteractiveDialog())
                 impl_makeFrameWindowVisible(xWindow, false);
         }
     }


More information about the Libreoffice-commits mailing list