Kaydet (Commit) ea77c319 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

tdf#119245 Set a parent for OParameterDialog

Change-Id: I5a7f4b43027a72f049e12c06cd583c6545b028f5
Reviewed-on: https://gerrit.libreoffice.org/58952
Tested-by: Jenkins
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst 775dfaee
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <CollectionView.hxx> #include <CollectionView.hxx>
#include <UITools.hxx> #include <UITools.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <toolkit/helper/vclunohelper.hxx>
extern "C" void createRegistryInfo_OInteractionHandler() extern "C" void createRegistryInfo_OInteractionHandler()
{ {
...@@ -63,6 +65,12 @@ namespace dbaui ...@@ -63,6 +65,12 @@ namespace dbaui
"BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" ); "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 ) sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest )
{ {
return impl_handle_throw( i_rRequest ); return impl_handle_throw( i_rRequest );
...@@ -124,7 +132,7 @@ namespace dbaui ...@@ -124,7 +132,7 @@ namespace dbaui
xParamCallback.set(_rContinuations[nParamPos], UNO_QUERY); xParamCallback.set(_rContinuations[nParamPos], UNO_QUERY);
OSL_ENSURE(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); 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(); sal_Int16 nResult = aDlg->Execute();
try try
{ {
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <apitools.hxx> #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/lang/XServiceInfo.hpp>
#include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/task/XInteractionHandler2.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -45,6 +47,7 @@ namespace dbaui ...@@ -45,6 +47,7 @@ namespace dbaui
// BasicInteractionHandler // BasicInteractionHandler
typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo
, css::lang::XInitialization
, css::task::XInteractionHandler2 , css::task::XInteractionHandler2
> BasicInteractionHandler_Base; > BasicInteractionHandler_Base;
/** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for /** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for
...@@ -61,6 +64,7 @@ namespace dbaui ...@@ -61,6 +64,7 @@ namespace dbaui
class BasicInteractionHandler class BasicInteractionHandler
:public BasicInteractionHandler_Base :public BasicInteractionHandler_Base
{ {
css::uno::Reference< css::awt::XWindow > m_xParentWindow;
const css::uno::Reference< css::uno::XComponentContext > const css::uno::Reference< css::uno::XComponentContext >
m_xContext; m_xContext;
const bool m_bFallbackToGeneric; const bool m_bFallbackToGeneric;
...@@ -71,6 +75,9 @@ namespace dbaui ...@@ -71,6 +75,9 @@ namespace dbaui
const bool i_bFallbackToGeneric const bool i_bFallbackToGeneric
); );
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArgs ) override;
// XInteractionHandler2 // XInteractionHandler2
virtual sal_Bool SAL_CALL handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override; virtual sal_Bool SAL_CALL handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
......
...@@ -4204,7 +4204,8 @@ bool FormController::ensureInteractionHandler() ...@@ -4204,7 +4204,8 @@ bool FormController::ensureInteractionHandler()
return false; return false;
m_bAttemptedHandlerCreation = true; m_bAttemptedHandlerCreation = true;
m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext, nullptr); m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext,
VCLUnoHelper::GetInterface(getDialogParentWindow()));
return m_xInteractionHandler.is(); return m_xInteractionHandler.is();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment