summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2018-08-14 02:28:54 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2018-08-14 10:29:39 +0200
commitea77c31944c7ca8896e5e58f3f57d9a9cbe9b6bb (patch)
tree2fcb02758e6a085e447536bf868fd2b3826a7039
parent775dfaee0f5f9c304cc55f2fdea8126db192a38a (diff)
tdf#119245 Set a parent for OParameterDialog
Change-Id: I5a7f4b43027a72f049e12c06cd583c6545b028f5 Reviewed-on: https://gerrit.libreoffice.org/58952 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.cxx10
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.hxx7
-rw-r--r--svx/source/form/formcontroller.cxx3
3 files changed, 18 insertions, 2 deletions
diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx
index 930dd4bb1386..b8c6ad061e18 100644
--- a/dbaccess/source/ui/uno/dbinteraction.cxx
+++ b/dbaccess/source/ui/uno/dbinteraction.cxx
@@ -37,6 +37,8 @@
#include <CollectionView.hxx>
#include <UITools.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
extern "C" void createRegistryInfo_OInteractionHandler()
{
@@ -63,6 +65,12 @@ namespace dbaui
"BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" );
}
+ void SAL_CALL BasicInteractionHandler::initialize(const Sequence<Any>& rArgs)
+ {
+ comphelper::SequenceAsHashMap aMap(rArgs);
+ m_xParentWindow.set(aMap.getValue("Parent"), UNO_QUERY);
+ }
+
sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest )
{
return impl_handle_throw( i_rRequest );
@@ -124,7 +132,7 @@ namespace dbaui
xParamCallback.set(_rContinuations[nParamPos], UNO_QUERY);
OSL_ENSURE(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s");
- ScopedVclPtrInstance< OParameterDialog > aDlg(nullptr, _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext);
+ ScopedVclPtrInstance< OParameterDialog > aDlg(VCLUnoHelper::GetWindow(m_xParentWindow), _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext);
sal_Int16 nResult = aDlg->Execute();
try
{
diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx
index 9bc5f365799a..e0c510cbc11a 100644
--- a/dbaccess/source/ui/uno/dbinteraction.hxx
+++ b/dbaccess/source/ui/uno/dbinteraction.hxx
@@ -24,6 +24,8 @@
#include <apitools.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/task/XInteractionHandler2.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -45,6 +47,7 @@ namespace dbaui
// BasicInteractionHandler
typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo
+ , css::lang::XInitialization
, css::task::XInteractionHandler2
> BasicInteractionHandler_Base;
/** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for
@@ -61,6 +64,7 @@ namespace dbaui
class BasicInteractionHandler
:public BasicInteractionHandler_Base
{
+ css::uno::Reference< css::awt::XWindow > m_xParentWindow;
const css::uno::Reference< css::uno::XComponentContext >
m_xContext;
const bool m_bFallbackToGeneric;
@@ -71,6 +75,9 @@ namespace dbaui
const bool i_bFallbackToGeneric
);
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
// XInteractionHandler2
virtual sal_Bool SAL_CALL handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 179fc9d85ea5..01f30d5266e8 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -4204,7 +4204,8 @@ bool FormController::ensureInteractionHandler()
return false;
m_bAttemptedHandlerCreation = true;
- m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext, nullptr);
+ m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext,
+ VCLUnoHelper::GetInterface(getDialogParentWindow()));
return m_xInteractionHandler.is();
}