summaryrefslogtreecommitdiff
path: root/sfx2/source
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 /sfx2/source
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 'sfx2/source')
-rw-r--r--sfx2/source/appl/preventduplicateinteraction.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/sfx2/source/appl/preventduplicateinteraction.cxx b/sfx2/source/appl/preventduplicateinteraction.cxx
index 009754cae517..ffe89813c0db 100644
--- a/sfx2/source/appl/preventduplicateinteraction.cxx
+++ b/sfx2/source/appl/preventduplicateinteraction.cxx
@@ -42,6 +42,7 @@ void PreventDuplicateInteraction::setHandler(const css::uno::Reference< css::tas
{
// SAFE ->
::osl::ResettableMutexGuard aLock(m_aLock);
+ m_xWarningDialogsParent.reset();
m_xHandler = xHandler;
aLock.clear();
// <- SAFE
@@ -54,6 +55,8 @@ void PreventDuplicateInteraction::useDefaultUUIHandler()
aLock.clear();
// <- SAFE
+ //if we use the default handler, set the parent to a window belonging to this object so that the dialogs
+ //don't block unrelated windows.
m_xWarningDialogsParent.reset(new WarningDialogsParentScope(m_xContext));
css::uno::Reference<css::task::XInteractionHandler> xHandler(css::task::InteractionHandler::createWithParent(
m_xContext, m_xWarningDialogsParent->GetDialogParent()), css::uno::UNO_QUERY_THROW);
@@ -74,7 +77,7 @@ css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::u
if ( !xHandler.is() )
return css::uno::Any();
}
- return ::cppu::WeakImplHelper< css::task::XInteractionHandler2 >::queryInterface( aType );
+ return ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2>::queryInterface(aType);
}
void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
@@ -230,6 +233,18 @@ bool PreventDuplicateInteraction::getInteractionInfo(const css::uno::Type&
return false;
}
+void SAL_CALL PreventDuplicateInteraction::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
+{
+ // If we're re-initialized to set a specific new window as a parent then drop our temporary
+ // dialog parent
+ css::uno::Reference<css::lang::XInitialization> xHandler(m_xHandler, css::uno::UNO_QUERY);
+ if (xHandler.is())
+ {
+ m_xWarningDialogsParent.reset();
+ xHandler->initialize(rArguments);
+ }
+}
+
IMPL_STATIC_LINK_NOARG(WarningDialogsParent, TerminateDesktop, void*, void)
{
css::frame::Desktop::create(comphelper::getProcessComponentContext())->terminate();