summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-22 10:37:13 +0000
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2018-11-27 12:43:19 +0100
commiteb99f1174950e7a9752830264fc393d533d61891 (patch)
tree7dc116259b616b4c76c2bc13c4843740e2f2300e /sw/source
parentcbf3e0d241f9fa3a9ffddd52acdbe03958be83da (diff)
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+LibreOffice@googlemail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx15
-rw-r--r--sw/source/uibase/dbui/mmconfigitem.cxx2
-rw-r--r--sw/source/uibase/shells/textsh2.cxx9
4 files changed, 17 insertions, 11 deletions
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;
}