Related: tdf#122153 set more correct dialog parents
Change-Id: I32212113e3591bde81b47ea89df4977713a49700
Reviewed-on: https://gerrit.libreoffice.org/65283
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index e9887ca..ad9cca9 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -29,7 +29,6 @@
#include <comphelper/propertysequence.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1196,7 +1195,7 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc
aGuard.clear();
}
bool ODocumentDefinition::save(bool _bApprove)
bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::awt::XTopWindow>& rDialogParent)
{
// default handling: instantiate an interaction handler and let it handle the parameter request
if ( !m_bOpenInDesign )
@@ -1244,8 +1243,10 @@ bool ODocumentDefinition::save(bool _bApprove)
OInteractionAbort* pAbort = new OInteractionAbort;
pRequest->addContinuation(pAbort);
Reference<XWindow> xDialogParent(rDialogParent, UNO_QUERY);
// create the handler, let it handle the request
Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) );
Reference<XInteractionHandler2> xHandler(InteractionHandler::createWithParent(m_aContext, xDialogParent));
xHandler->handle(xRequest);
if ( pAbort->wasSelected() )
@@ -1293,7 +1294,7 @@ void ODocumentDefinition::saveAs()
if ( m_pImpl->m_aProps.aTitle.isEmpty() )
{
aGuard.clear();
save(false); // (sal_False) : we don't want an approve dialog
save(false, css::uno::Reference<css::awt::XTopWindow>()); // (sal_False) : we don't want an approve dialog
return;
}
}
@@ -1977,12 +1978,13 @@ bool ODocumentDefinition::prepareClose()
if ( isModified() )
{
Reference< XFrame > xFrame( xController->getFrame() );
Reference<XTopWindow> xTopWindow;
if ( xFrame.is() )
{
Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW );
xTopWindow = Reference<XTopWindow>(xFrame->getContainerWindow(), UNO_QUERY_THROW);
xTopWindow->toFront();
}
if ( !save( true ) )
if (!save(true, xTopWindow))
{
// revert suspension
xController->suspend(false);
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx
index b153b13..501433e 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -27,6 +27,7 @@
#include <comphelper/proparrhlp.hxx>
#include <apitools.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/embed/XStateChangeListener.hpp>
@@ -138,7 +139,7 @@ public:
css::uno::Reference< css::embed::XStorage >
getContainerStorage() const;
bool save(bool _bApprove);
bool save(bool _bApprove, const css::uno::Reference<css::awt::XTopWindow>& rDialogParent);
void saveAs();
void closeObject();
bool isModified();
diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx
index 9668c27..7a567de 100644
--- a/dbaccess/source/core/dataaccess/intercept.cxx
+++ b/dbaccess/source/core/dataaccess/intercept.cxx
@@ -104,7 +104,7 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu
if ( URL.Complete == m_aInterceptedURL[ DISPATCH_SAVE ] )
{
m_pContentHolder->save( false );
m_pContentHolder->save(false, css::uno::Reference<css::awt::XTopWindow>());
return;
}