From ea77c31944c7ca8896e5e58f3f57d9a9cbe9b6bb Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Tue, 14 Aug 2018 02:28:54 +0300 Subject: tdf#119245 Set a parent for OParameterDialog Change-Id: I5a7f4b43027a72f049e12c06cd583c6545b028f5 Reviewed-on: https://gerrit.libreoffice.org/58952 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- dbaccess/source/ui/uno/dbinteraction.cxx | 10 +++++++++- dbaccess/source/ui/uno/dbinteraction.hxx | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'dbaccess') 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 #include #include +#include +#include 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& 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 +#include +#include #include #include #include @@ -45,6 +47,7 @@ namespace dbaui // BasicInteractionHandler typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo + , css::lang::XInitialization , css::task::XInteractionHandler2 > BasicInteractionHandler_Base; /** implements an XInteractionHandler 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; -- cgit