summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/preventduplicateinteraction.hxx4
-rw-r--r--sfx2/source/appl/preventduplicateinteraction.cxx17
2 files changed, 19 insertions, 2 deletions
diff --git a/sfx2/inc/preventduplicateinteraction.hxx b/sfx2/inc/preventduplicateinteraction.hxx
index 9e31a5bcc829..5e1db5043aec 100644
--- a/sfx2/inc/preventduplicateinteraction.hxx
+++ b/sfx2/inc/preventduplicateinteraction.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/TerminationVetoException.hpp>
#include <com/sun/star/frame/XTerminateListener2.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/task/XInteractionHandler2.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
@@ -160,7 +161,7 @@ struct ThreadHelpBase2
};
class PreventDuplicateInteraction : private ThreadHelpBase2
- ,public ::cppu::WeakImplHelper< css::task::XInteractionHandler2 >
+ , public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2>
{
// structs, types etc.
@@ -220,6 +221,7 @@ class PreventDuplicateInteraction : private ThreadHelpBase2
// uno interface
public:
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
/**
@interface XInteractionHandler
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();