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 e64fab3fa8f82fc3a0bedbf204a59884e80ecf11 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Nov 22 10:37:13 2018 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Nov 22 14:29:52 2018 +0100 Resolves: tdf#121607 set parent for password dialogs Change-Id: I02210a61d103aed4a181b0e907ea2fd141e5f587 Reviewed-on: https://gerrit.libreoffice.org/63791 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index c4abf4920b49..8ca9302b1c17 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -386,7 +386,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, @@ -444,11 +445,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 278f0d7178ec..30591ea474e8 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -959,7 +959,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 71ee070be572..97063bb78db2 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1931,7 +1931,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() ); @@ -1941,7 +1941,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 ); } } @@ -2420,7 +2421,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); @@ -3183,8 +3185,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 @@ -3205,7 +3207,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 154d6ec4d9a5..9a3cb5b7d26c 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -863,7 +863,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 7a0afc797764..e5369fa3cef2 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