sw/inc/dbmgr.hxx | 13 +++++++------ sw/source/ui/dbui/dbinsdlg.cxx | 2 +- sw/source/uibase/dbui/dbmgr.cxx | 15 +++++++++------ sw/source/uibase/dbui/mmconfigitem.cxx | 2 +- sw/source/uibase/shells/textsh2.cxx | 9 ++++++--- 5 files changed, 24 insertions(+), 17 deletions(-)
New commits: commit eb99f1174950e7a9752830264fc393d533d61891 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Nov 22 10:37:13 2018 +0000 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Tue Nov 27 12:43:19 2018 +0100 Resolves: tdf#121607 set parent for password dialogs Change-Id: I02210a61d103aed4a181b0e907ea2fd141e5f587 Reviewed-on: https://gerrit.libreoffice.org/63792 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 03e8c2f7ecc9..435fd3d55e82 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -390,7 +390,8 @@ public: static css::uno::Reference< css::sdbc::XConnection> GetConnection(const OUString& rDataSource, - css::uno::Reference< css::sdbc::XDataSource>& rxSource); + css::uno::Reference< css::sdbc::XDataSource>& rxSource, + SwView* pView); static css::uno::Reference< css::sdbcx::XColumnsSupplier> GetColumnSupplier(css::uno::Reference< css::sdbc::XConnection> const & xConnection, @@ -448,11 +449,11 @@ public: */ static css::uno::Reference< css::sdbc::XResultSet> - createCursor( const OUString& _sDataSourceName, - const OUString& _sCommand, - sal_Int32 _nCommandType, - const css::uno::Reference< css::sdbc::XConnection>& _xConnection - ); + createCursor(const OUString& _sDataSourceName, + const OUString& _sCommand, + sal_Int32 _nCommandType, + const css::uno::Reference< css::sdbc::XConnection>& _xConnection, + SwView* pView); void setEmbeddedName(const OUString& rEmbeddedName, SwDocShell& rDocShell); const OUString& getEmbeddedName() const; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 9a6db02f582b..2ae1858fecd9 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -964,7 +964,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, // we don't have a cursor, so we have to create our own RowSet if ( !xResultSet.is() ) { - xResultSet = SwDBManager::createCursor(aDBData.sDataSource,aDBData.sCommand,aDBData.nCommandType,xConnection); + xResultSet = SwDBManager::createCursor(aDBData.sDataSource,aDBData.sCommand,aDBData.nCommandType,xConnection,pView); bDisposeResultSet = xResultSet.is(); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 77e8297f8892..156219bb440b 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1974,7 +1974,7 @@ sal_Int32 SwDBManager::GetColumnType( const OUString& rDBName, } uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rDataSource, - uno::Reference<sdbc::XDataSource>& rxSource) + uno::Reference<sdbc::XDataSource>& rxSource, SwView *pView) { uno::Reference< sdbc::XConnection> xConnection; uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -1984,7 +1984,8 @@ uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rD if ( xComplConnection.is() ) { rxSource.set(xComplConnection, uno::UNO_QUERY); - uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr), uno::UNO_QUERY_THROW ); + weld::Window* pWindow = pView ? pView->GetFrameWeld() : nullptr; + uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(xContext, pWindow ? pWindow->GetXWindow() : nullptr), uno::UNO_QUERY_THROW ); xConnection = xComplConnection->connectWithCompletion( xHandler ); } } @@ -2466,7 +2467,8 @@ uno::Reference< sdbc::XConnection> const & SwDBManager::RegisterConnection(OUStr uno::Reference< sdbc::XDataSource> xSource; if(!pFound->xConnection.is()) { - pFound->xConnection = SwDBManager::GetConnection(rDataSource, xSource ); + SwView* pView = (m_pDoc && m_pDoc->GetDocShell()) ? m_pDoc->GetDocShell()->GetView() : nullptr; + pFound->xConnection = SwDBManager::GetConnection(rDataSource, xSource, pView); try { uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY); @@ -3236,8 +3238,8 @@ uno::Reference<sdbc::XDataSource> SwDBManager::getDataSourceAsParent(const uno:: uno::Reference<sdbc::XResultSet> SwDBManager::createCursor(const OUString& _sDataSourceName, const OUString& _sCommand, sal_Int32 _nCommandType, - const uno::Reference<sdbc::XConnection>& _xConnection - ) + const uno::Reference<sdbc::XConnection>& _xConnection, + SwView* pView) { uno::Reference<sdbc::XResultSet> xResultSet; try @@ -3258,7 +3260,8 @@ uno::Reference<sdbc::XResultSet> SwDBManager::createCursor(const OUString& _sDat if ( xRowSet.is() ) { - uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(comphelper::getComponentContext(xMgr), nullptr), uno::UNO_QUERY_THROW ); + 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 ); xRowSet->executeWithCompletion(xHandler); } xResultSet.set(xRowSet, uno::UNO_QUERY); diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index e1a66d04a86e..42751b273708 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -866,7 +866,7 @@ Reference< XResultSet> const & SwMailMergeConfigItem::GetResultSet() const if(!m_pImpl->m_xConnection.is() && !m_pImpl->m_aDBData.sDataSource.isEmpty()) { m_pImpl->m_xConnection.reset( - SwDBManager::GetConnection( m_pImpl->m_aDBData.sDataSource, m_pImpl->m_xSource ), + SwDBManager::GetConnection(m_pImpl->m_aDBData.sDataSource, m_pImpl->m_xSource, m_pSourceView), SharedConnection::TakeOwnership ); } diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx index 2dc0dc528e89..612a257e94c0 100644 --- a/sw/source/uibase/shells/textsh2.cxx +++ b/sw/source/uibase/shells/textsh2.cxx @@ -116,7 +116,8 @@ void SwTextShell::ExecDB(SfxRequest const &rReq) if ( !xConnection.is() ) { Reference<XDataSource> xSource; - xConnection = SwDBManager::GetConnection(sSourceArg, xSource); + SwView &rSwView = GetView(); + xConnection = SwDBManager::GetConnection(sSourceArg, xSource, &rSwView); } if(!xConnection.is()) return ; @@ -155,7 +156,8 @@ void SwTextShell::ExecDB(SfxRequest const &rReq) bool bDisposeResultSet = false; if ( !xCursor.is() ) { - xCursor = SwDBManager::createCursor(sSourceArg,sCommandArg,nCommandTypeArg,xConnection); + SwView &rSwView = GetView(); + xCursor = SwDBManager::createCursor(sSourceArg,sCommandArg,nCommandTypeArg,xConnection,&rSwView); bDisposeResultSet = xCursor.is(); } @@ -233,7 +235,8 @@ IMPL_LINK( SwBaseShell, InsertDBTextHdl, void*, p, void ) if ( !xConnection.is() ) { - xConnection = SwDBManager::GetConnection(pDBStruct->aDBData.sDataSource, xSource); + SwView &rSwView = GetView(); + xConnection = SwDBManager::GetConnection(pDBStruct->aDBData.sDataSource, xSource, &rSwView); bDispose = true; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits