Related: tdf#121810 pass suitable message dialog parent around

Change-Id: I1a27d82ef94f1052171f7a3f6c5c80c0ec66b547
Reviewed-on: https://gerrit.libreoffice.org/64408
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/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index b653396..f970b9e 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -756,7 +756,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
                m_pImpl->getDocumentSubStorageSupplier() );
        dbahsql::HsqlImporter importer(xReturn,
                xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE) );
        importer.importHsqlDatabase();
        importer.importHsqlDatabase(GetFrameWeld(m_pImpl->getModel_noCreate()));
    }
#endif

diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx
index 7a01045..49d6f97 100644
--- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx
+++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx
@@ -36,6 +36,8 @@
#include <connectivity/dbexception.hxx>
#include <comphelper/processfactory.hxx>

#include <vcl/weld.hxx>

#include "hsqlimport.hxx"
#include "parseschema.hxx"
#include "rowinputbinary.hxx"
@@ -293,7 +295,7 @@ void HsqlImporter::parseTableRows(const IndexVector& rIndexes,
    xInput->closeInput();
}

void HsqlImporter::importHsqlDatabase()
void HsqlImporter::importHsqlDatabase(weld::Window* pParent)
{
    assert(m_xStorage);

@@ -370,7 +372,8 @@ void HsqlImporter::importHsqlDatabase()
    if (pException)
    {
        SAL_WARN("dbaccess", "Error during migration");
        dbtools::showError(dbtools::SQLExceptionInfo{ *pException }, nullptr,
        dbtools::showError(dbtools::SQLExceptionInfo{ *pException },
                           pParent ? pParent->GetXWindow() : nullptr,
                           ::comphelper::getProcessComponentContext());
    }
}
diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.hxx b/dbaccess/source/filter/hsqldb/hsqlimport.hxx
index 12d0489..c4f4d1f 100644
--- a/dbaccess/source/filter/hsqldb/hsqlimport.hxx
+++ b/dbaccess/source/filter/hsqldb/hsqlimport.hxx
@@ -17,6 +17,11 @@
#include "hsqlbinarynode.hxx"
#include "columndef.hxx"

namespace weld
{
class Window;
}

namespace dbahsql
{
class SAL_DLLPUBLIC_EXPORT HsqlImporter
@@ -49,7 +54,7 @@ public:
    /**
     * Migrate a HSQL database to another.
     */
    void importHsqlDatabase();
    void importHsqlDatabase(weld::Window* pParent);
};
}

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 97063bb..d968221 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -3208,7 +3208,7 @@ uno::Reference<sdbc::XResultSet> SwDBManager::createCursor(const OUString& _sDat
                if ( xRowSet.is() )
                {
                    weld::Window* pWindow = pView ? pView->GetFrameWeld() : nullptr;
                    uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(comphelper::getComponentContext(xMgr), pView ? pWindow->GetXWindow() : nullptr), uno::UNO_QUERY_THROW );
                    uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(comphelper::getComponentContext(xMgr), pWindow ? pWindow->GetXWindow() : nullptr), uno::UNO_QUERY_THROW );
                    xRowSet->executeWithCompletion(xHandler);
                }
                xResultSet.set(xRowSet, uno::UNO_QUERY);