summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-23 14:05:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-24 09:55:17 +0100
commit6f31670783b3445a8073bd49fe4c041b655e91b3 (patch)
tree3cbfc77e7f9e8191c6eaded7f92633f9808ba414 /framework
parent99534540df148513fc0bb9622b7285e10b285ccb (diff)
set new document window as parent for dialogs during load
and exit typedetection early and completely if application quits while detecting During typedetection, before loading proper, we have the hidden window as parent so warnings are not modal to existing windows and they are cancelled on exit. Once we do have a window, then reinit interaction handler to have that window as the parent for any further dialogs. Change-Id: I5c6711557266bf7d1eb9291f1c454cbfaf766886 Reviewed-on: https://gerrit.libreoffice.org/45148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/loadenv/loadenv.cxx36
1 files changed, 29 insertions, 7 deletions
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 3bfd87e3244c..6ad9498f776f 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -28,6 +28,7 @@
#include <services.h>
#include <comphelper/interaction.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/propertysequence.hxx>
#include <framework/interaction.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/configuration.hxx>
@@ -55,6 +56,7 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -1044,15 +1046,35 @@ bool LoadEnv::impl_loadContent()
bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false);
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >());
- if (!bHidden && !bMinimized && !bPreview && !xProgress.is())
+ if (!bHidden && !bMinimized && !bPreview)
{
- // Note: it's an optional interface!
- css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY);
- if (xProgressFactory.is())
+ if (!xProgress.is())
{
- xProgress = xProgressFactory->createStatusIndicator();
- if (xProgress.is())
- m_lMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress;
+ // Note: it's an optional interface!
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY);
+ if (xProgressFactory.is())
+ {
+ xProgress = xProgressFactory->createStatusIndicator();
+ if (xProgress.is())
+ m_lMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress;
+ }
+ }
+
+ // Now that we have a target window into which we can load, reinit the interaction handler to have this
+ // window as its parent for modal dialogs and ensure the window is visible
+ css::uno::Reference< css::task::XInteractionHandler > xInteraction = m_lMediaDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_INTERACTIONHANDLER(),
+ css::uno::Reference< css::task::XInteractionHandler >());
+ css::uno::Reference<css::lang::XInitialization> xHandler(xInteraction, css::uno::UNO_QUERY);
+ if (xHandler.is())
+ {
+ css::uno::Reference<css::awt::XWindow> xWindow = xTargetFrame->getContainerWindow();
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {"Parent", uno::Any(xWindow)}
+ }));
+ xHandler->initialize(aArguments);
+ impl_makeFrameWindowVisible(xWindow, false);
}
}