summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-16 20:23:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-17 16:31:11 +0200
commitd30ab819b80e67119e17d3e4243cab88c508ebae (patch)
tree89ae80196607983dd43645917639e5779c5a9018
parentAccess2Base - access2base.py fix module class (diff)
downloadcore-d30ab819b80e67119e17d3e4243cab88c508ebae.tar.gz
core-d30ab819b80e67119e17d3e4243cab88c508ebae.zip
tdf#125340 transport preferred dialog parent down the migration dialog
Change-Id: Icb7bab35eac3ae08fb82d73f559ef161dd1820c3 Reviewed-on: https://gerrit.libreoffice.org/77606 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--connectivity/source/commontools/dbtools.cxx54
-rw-r--r--connectivity/source/commontools/parameters.cxx4
-rw-r--r--dbaccess/source/core/api/RowSet.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx42
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx6
-rw-r--r--dbaccess/source/core/inc/ModelImpl.hxx4
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx2
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx2
-rw-r--r--extensions/source/dbpilots/controlwizard.cxx2
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx4
-rw-r--r--extensions/source/propctrlr/formlinkdialog.cxx4
-rw-r--r--forms/source/component/DatabaseForm.cxx23
-rw-r--r--include/connectivity/dbtools.hxx12
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx2
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx2
-rw-r--r--svx/source/form/fmvwimp.cxx3
-rw-r--r--svx/source/form/tabwin.cxx2
17 files changed, 118 insertions, 52 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index d760a16a7fc6..75df94ec8ea1 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -22,12 +22,14 @@
#include <connectivity/ParameterCont.hxx>
#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
@@ -265,12 +267,25 @@ static Reference< XConnection > getConnection_allowException(
const OUString& _rsTitleOrPath,
const OUString& _rsUser,
const OUString& _rsPwd,
- const Reference< XComponentContext>& _rxContext)
+ const Reference< XComponentContext>& _rxContext,
+ const Reference< XWindow >& _rxParent)
{
Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, _rxContext) );
Reference<XConnection> xConnection;
if (xDataSource.is())
{
+
+ //set ParentWindow for dialog, but just for the duration of this
+ //call, undo at end of scope
+ Reference<XInitialization> xIni(xDataSource, UNO_QUERY);
+ if (xIni.is())
+ {
+ Sequence< Any > aArgs(1);
+ NamedValue aParam( "ParentWindow", makeAny(_rxParent) );
+ aArgs[0] <<= aParam;
+ xIni->initialize(aArgs);
+ }
+
// do it with interaction handler
if(_rsUser.isEmpty() || _rsPwd.isEmpty())
{
@@ -293,7 +308,7 @@ static Reference< XConnection > getConnection_allowException(
if (xConnectionCompletion.is())
{ // instantiate the default SDB interaction handler
Reference< XInteractionHandler > xHandler =
- InteractionHandler::createWithParent(_rxContext, nullptr);
+ InteractionHandler::createWithParent(_rxContext, _rxParent);
xConnection = xConnectionCompletion->connectWithCompletion(xHandler);
}
}
@@ -302,17 +317,27 @@ static Reference< XConnection > getConnection_allowException(
}
if(!xConnection.is()) // try to get one if not already have one, just to make sure
xConnection = xDataSource->getConnection(_rsUser, _rsPwd);
+
+ if (xIni.is())
+ {
+ Sequence< Any > aArgs(1);
+ NamedValue aParam( "ParentWindow", makeAny(Reference<XWindow>()) );
+ aArgs[0] <<= aParam;
+ xIni->initialize(aArgs);
+ }
+
}
return xConnection;
}
Reference< XConnection> getConnection_withFeedback(const OUString& _rDataSourceName,
- const OUString& _rUser, const OUString& _rPwd, const Reference< XComponentContext>& _rxContext)
+ const OUString& _rUser, const OUString& _rPwd, const Reference< XComponentContext>& _rxContext,
+ const Reference< XWindow >& _rxParent)
{
Reference< XConnection > xReturn;
try
{
- xReturn = getConnection_allowException(_rDataSourceName, _rUser, _rPwd, _rxContext);
+ xReturn = getConnection_allowException(_rDataSourceName, _rUser, _rPwd, _rxContext, _rxParent);
}
catch(SQLException&)
{
@@ -339,7 +364,7 @@ Reference< XConnection> getConnection(const Reference< XRowSet>& _rxRowSet)
// if connectRowset (which is deprecated) is removed, this function and one of its parameters are
// not needed anymore, the whole implementation can be moved into ensureRowSetConnection then)
static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext,
- bool _bAttachAutoDisposer )
+ bool _bAttachAutoDisposer, const Reference< XWindow >& _rxParent)
{
SharedConnection xConnection;
@@ -387,7 +412,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps))
xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd;
- xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, _rxContext );
+ xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, _rxContext, _rxParent );
}
else if (!sURL.isEmpty())
{ // the row set has no data source, but a connection url set
@@ -448,15 +473,15 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
return xConnection;
}
-Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext )
+Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, const Reference< XWindow >& _rxParent)
{
- SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxContext, true );
+ SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxContext, true, _rxParent );
return xConnection.getTyped();
}
-SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext>& _rxContext )
+SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext>& _rxContext, const Reference< XWindow >& _rxParent)
{
- return lcl_connectRowSet( _rxRowSet, _rxContext, false/*bUseAutoConnectionDisposer*/ );
+ return lcl_connectRowSet( _rxRowSet, _rxContext, false/*bUseAutoConnectionDisposer*/, _rxParent );
}
Reference< XNameAccess> getTableFields(const Reference< XConnection>& _rxConn,const OUString& _rName)
@@ -1195,12 +1220,12 @@ Reference< XDataSource> findDataSource(const Reference< XInterface >& _xParent)
return xDataSource;
}
-static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Reference< XPropertySet >& _rxRowSet, const Reference< XComponentContext >& _rxContext )
+static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Reference< XPropertySet >& _rxRowSet, const Reference< XComponentContext >& _rxContext, const Reference< XWindow >& _rxParent )
{
Reference< XSingleSelectQueryComposer > xComposer;
try
{
- Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxContext );
+ Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxContext, _rxParent );
if ( xConn.is() ) // implies _rxRowSet.is()
{
// build the statement the row set is based on (can't use the ActiveCommand property of the set
@@ -1244,12 +1269,13 @@ static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const
Reference< XSingleSelectQueryComposer > getCurrentSettingsComposer(
const Reference< XPropertySet>& _rxRowSetProps,
- const Reference< XComponentContext>& _rxContext)
+ const Reference< XComponentContext>& _rxContext,
+ const Reference< XWindow >& _rxParent)
{
Reference< XSingleSelectQueryComposer > xReturn;
try
{
- xReturn = getComposedRowSetStatement( _rxRowSetProps, _rxContext );
+ xReturn = getComposedRowSetStatement( _rxRowSetProps, _rxContext, _rxParent );
}
catch( const SQLException& )
{
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 3485ce29b81f..4502dbc0687e 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -136,7 +136,7 @@ namespace dbtools
try
{
// get a query composer for the 's settings
- m_xComposer.reset( getCurrentSettingsComposer( _rxComponent, m_xContext ), SharedQueryComposer::TakeOwnership );
+ m_xComposer.reset( getCurrentSettingsComposer( _rxComponent, m_xContext, nullptr ), SharedQueryComposer::TakeOwnership );
// see if the composer found parameters
Reference< XParametersSupplier > xParamSupp( m_xComposer, UNO_QUERY );
@@ -833,7 +833,7 @@ namespace dbtools
// re-create the parent composer all the time. Else, we'd have to bother with
// being a listener at its properties, its loaded state, and event the parent-relationship.
m_xParentComposer.reset(
- getCurrentSettingsComposer( xParent, m_xContext ),
+ getCurrentSettingsComposer( xParent, m_xContext, nullptr ),
SharedQueryComposer::TakeOwnership
);
xParentColSupp.set(m_xParentComposer, css::uno::UNO_QUERY);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 48597c9b2c00..c2cf6e568ac4 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1449,7 +1449,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl
calcConnection( _rxHandler );
m_bRebuildConnOnExecute = false;
- Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext );
+ Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext, nullptr );
Reference<XParametersSupplier> xParameters(xComposer, UNO_QUERY);
Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 49560988fc0f..e01583da6266 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -576,23 +576,22 @@ void ODatabaseSource::disposing()
m_pImpl.clear();
}
-namespace
+weld::Window* ODatabaseModelImpl::GetFrameWeld()
{
-#if ENABLE_FIREBIRD_SDBC
- weld::Window* GetFrameWeld(const Reference<XModel>& rModel)
- {
- if (!rModel.is())
- return nullptr;
- Reference<XController> xController(rModel->getCurrentController());
- if (!xController.is())
- return nullptr;
- Reference<XFrame> xFrame(xController->getFrame());
- if (!xFrame.is())
- return nullptr;
- Reference<css::awt::XWindow> xWindow(xFrame->getContainerWindow());
- return Application::GetFrameWeld(xWindow);
- }
-#endif
+ if (m_xDialogParent.is())
+ return Application::GetFrameWeld(m_xDialogParent);
+
+ Reference<XModel> xModel = getModel_noCreate();
+ if (!xModel.is())
+ return nullptr;
+ Reference<XController> xController(xModel->getCurrentController());
+ if (!xController.is())
+ return nullptr;
+ Reference<XFrame> xFrame(xController->getFrame());
+ if (!xFrame.is())
+ return nullptr;
+ Reference<css::awt::XWindow> xWindow(xFrame->getContainerWindow());
+ return Application::GetFrameWeld(xWindow);
}
Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString& _rUid, const OUString& _rPwd)
@@ -633,7 +632,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
&& (nOpenMode & css::embed::ElementModes::WRITE)
&& (!Application::IsHeadlessModeEnabled()))
{
- MigrationWarnDialog aWarnDlg(GetFrameWeld(m_pImpl->getModel_noCreate()));
+ MigrationWarnDialog aWarnDlg(m_pImpl->GetFrameWeld());
bNeedMigration = aWarnDlg.run() == RET_OK;
}
}
@@ -776,7 +775,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
m_pImpl->getDocumentSubStorageSupplier() );
dbahsql::HsqlImporter importer(xReturn,
xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE) );
- importer.importHsqlDatabase(GetFrameWeld(m_pImpl->getModel_noCreate()));
+ importer.importHsqlDatabase(m_pImpl->GetFrameWeld());
}
#endif
@@ -1398,6 +1397,13 @@ Reference< XOfficeDatabaseDocument > SAL_CALL ODatabaseSource::getDatabaseDocume
return Reference< XOfficeDatabaseDocument >( xModel, UNO_QUERY_THROW );
}
+void SAL_CALL ODatabaseSource::initialize( css::uno::Sequence< css::uno::Any > const & rArguments)
+{
+ ::comphelper::NamedValueCollection aProperties( rArguments );
+ if (aProperties.has("ParentWindow"))
+ aProperties.get("ParentWindow") >>= m_pImpl->m_xDialogParent;
+}
+
Reference< XInterface > ODatabaseSource::getThis() const
{
return *const_cast< ODatabaseSource* >( this );
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 815b662506fe..b9d8e8bbf407 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -68,6 +68,7 @@ typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo
, css::util::XFlushable
, css::util::XFlushListener
, css::sdb::XDocumentDataSource
+ , css::lang::XInitialization
> ODatabaseSource_Base;
class ODatabaseSource :public ModelDependentComponent // must be first
@@ -83,7 +84,7 @@ private:
using ODatabaseSource_Base::rBHelper;
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
OBookmarkContainer m_Bookmarks;
- ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
+ ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
private:
virtual ~ODatabaseSource() override;
@@ -183,6 +184,9 @@ public:
// XDocumentDataSource
virtual css::uno::Reference< css::sdb::XOfficeDatabaseDocument > SAL_CALL getDatabaseDocument() override;
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
protected:
// ModelDependentComponent overridables
virtual css::uno::Reference< css::uno::XInterface > getThis() const override;
diff --git a/dbaccess/source/core/inc/ModelImpl.hxx b/dbaccess/source/core/inc/ModelImpl.hxx
index 0ed9c8dfeece..e938cf830dca 100644
--- a/dbaccess/source/core/inc/ModelImpl.hxx
+++ b/dbaccess/source/core/inc/ModelImpl.hxx
@@ -215,6 +215,8 @@ public:
OSharedConnectionManager* m_pSharedConnectionManager;
css::uno::Reference< css::lang::XEventListener >
m_xSharedConnectionManager;
+ css::uno::Reference<css::awt::XWindow>
+ m_xDialogParent;
sal_uInt16 m_nControllerLockCount;
void reset();
@@ -449,6 +451,8 @@ public:
void unlockModify() { m_bModificationLock = false; }
bool isModifyLocked() const { return m_bModificationLock; }
+ weld::Window* GetFrameWeld();
+
private:
void impl_construct_nothrow();
css::uno::Reference< css::embed::XStorage > const &
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 9e8508231ea1..a55d2be0d2de 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -954,7 +954,7 @@ bool SbaGridControl::IsReadOnlyDB() const
if (xColumns.is())
{
Reference< XRowSet > xDataSource(xColumns->getParent(), UNO_QUERY);
- ::dbtools::ensureRowSetConnection( xDataSource, getContext() );
+ ::dbtools::ensureRowSetConnection( xDataSource, getContext(), nullptr );
Reference< XChild > xConn(::dbtools::getConnection(xDataSource),UNO_QUERY);
if (xConn.is())
{
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
index 3c983f5a0669..85dee7a7f86b 100644
--- a/dbaccess/source/ui/uno/composerdialogs.cxx
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -97,7 +97,7 @@ namespace dbaui
// fallback: if there is a connection and thus a row set, but no composer, create one
if ( xConnection.is() && !m_xComposer.is() )
- m_xComposer = ::dbtools::getCurrentSettingsComposer( Reference< XPropertySet >( m_xRowSet, UNO_QUERY ), m_aContext );
+ m_xComposer = ::dbtools::getCurrentSettingsComposer( Reference< XPropertySet >( m_xRowSet, UNO_QUERY ), m_aContext, rParent );
// the columns of the row set
Reference< XColumnsSupplier > xSuppColumns( m_xRowSet, UNO_QUERY );
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index 61a6735ed386..6589b2bb2f25 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -521,7 +521,7 @@ namespace dbp
Reference< XConnection > xConnection;
m_aContext.bEmbedded = ::dbtools::isEmbeddedInDatabase( m_aContext.xForm, xConnection );
if ( !m_aContext.bEmbedded )
- xConnection = ::dbtools::connectRowset( m_aContext.xRowSet, m_xContext );
+ xConnection = ::dbtools::connectRowset( m_aContext.xRowSet, m_xContext, nullptr );
// get the fields
if (xConnection.is())
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index e65f62ac8b2d..7a7672dfbd55 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2406,7 +2406,7 @@ namespace pcr
if ( xRowSetProps.is() )
{
weld::WaitObject aWaitCursor(impl_getDefaultDialogFrame_nothrow());
- m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_xContext );
+ m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_xContext, nullptr );
}
}
catch ( const SQLException& ) { aError = SQLExceptionInfo( ::cppu::getCaughtException() ); }
@@ -2620,7 +2620,7 @@ namespace pcr
return false;
// get a composer for the statement which the form is currently based on
- Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_xContext ) );
+ Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_xContext, nullptr ) );
OSL_ENSURE( xComposer.is(), "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: could not obtain a composer!" );
if ( !xComposer.is() )
return false;
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 4928562c793a..6f49294439fe 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -429,7 +429,7 @@ namespace pcr
_rxConnection.set(_rxFormProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
if ( !_rxConnection.is() )
- _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), m_xContext );
+ _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), m_xContext, nullptr );
}
@@ -451,7 +451,7 @@ namespace pcr
Reference< XPropertySet > xTable;
try
{
- Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, m_xContext ), UNO_QUERY );
+ Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, m_xContext, nullptr ), UNO_QUERY );
Reference< XNameAccess > xTables;
if ( xTablesInForm.is() )
xTables = xTablesInForm->getTables();
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 4f621a7d5e60..41e94e519762 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -2719,6 +2719,21 @@ void ODatabaseForm::stopSharingConnection( )
}
}
+namespace
+{
+ Reference<css::awt::XWindow> GetDialogParentWindow(const Reference<XModel>& rModel)
+ {
+ if (!rModel.is())
+ return nullptr;
+ Reference<XController> xController(rModel->getCurrentController());
+ if (!xController.is())
+ return nullptr;
+ Reference<XFrame> xFrame(xController->getFrame());
+ if (!xFrame.is())
+ return nullptr;
+ return xFrame->getContainerWindow();
+ }
+}
bool ODatabaseForm::implEnsureConnection()
{
@@ -2760,9 +2775,15 @@ bool ODatabaseForm::implEnsureConnection()
if (m_xAggregateSet.is())
{
+ //Dig out a suitable parent for any warning dialogs
+ Reference<css::awt::XWindow> m_xDialogParent;
+ Reference<XChild> xParent(m_xParent, UNO_QUERY);
+ if (xParent.is())
+ m_xDialogParent = GetDialogParentWindow(getXModel(xParent->getParent()));
+
Reference< XConnection > xConnection = connectRowset(
Reference<XRowSet> (m_xAggregate, UNO_QUERY),
- m_xContext
+ m_xContext, m_xDialogParent
);
return xConnection.is();
}
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
index baf1cb8ef8fa..f77d02181356 100644
--- a/include/connectivity/dbtools.hxx
+++ b/include/connectivity/dbtools.hxx
@@ -141,7 +141,8 @@ namespace dbtools
OOO_DLLPUBLIC_DBTOOLS
css::uno::Reference< css::sdbc::XConnection> connectRowset(
const css::uno::Reference< css::sdbc::XRowSet>& _rxRowSet,
- const css::uno::Reference< css::uno::XComponentContext>& _rxContext
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
);
/** ensures that a row set has a valid ActiveConnection, if possible
@@ -164,7 +165,8 @@ namespace dbtools
*/
OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection(
const css::uno::Reference< css::sdbc::XRowSet>& _rxRowSet,
- const css::uno::Reference< css::uno::XComponentContext>& _rxContext
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
);
/** returns the connection the RowSet is currently working with (which is the ActiveConnection property)
@@ -176,7 +178,8 @@ namespace dbtools
const OUString& _rDataSourceName,
const OUString& _rUser,
const OUString& _rPwd,
- const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent);
/** determines whether the given component is part of a document which is an embedded database
@@ -400,7 +403,8 @@ namespace dbtools
*/
OOO_DLLPUBLIC_DBTOOLS css::uno::Reference< css::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer(
const css::uno::Reference< css::beans::XPropertySet>& _rxRowSetProps,
- const css::uno::Reference< css::uno::XComponentContext>& _rxContext
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext,
+ const css::uno::Reference< css::awt::XWindow>& _rxParent
);
/** transfer and translate properties between two FormComponents
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 4a724dd490a5..86bdade20e35 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -1598,7 +1598,7 @@ bool GeometryHandler::impl_dialogFilter_nothrow( OUString& _out_rSelectedClause,
}
// get a composer for the statement which the form is currently based on
- uno::Reference< sdb::XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( xRowSetProp, m_xContext ) );
+ uno::Reference< sdb::XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( xRowSetProp, m_xContext, nullptr ) );
OSL_ENSURE( xComposer.is(), "GeometryHandler::impl_dialogFilter_nothrow: could not obtain a composer!" );
if ( !xComposer.is() )
return false;
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 6bdc11d34938..2375819bc196 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -267,7 +267,7 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
{
OUString sSignificantSource( sDatasource.isEmpty() ? sDatabaseLocation : sDatasource );
xConnection = getConnection_withFeedback(sSignificantSource, OUString(), OUString(),
- static_cast<FmGridControl*>(GetParent())->getContext() );
+ static_cast<FmGridControl*>(GetParent())->getContext(), nullptr );
}
catch(NoSuchElementException&)
{ // allowed, means sDatasource isn't a valid data source name ....
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 2e48c95e7950..4f1aad555560 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1166,7 +1166,8 @@ SdrObjectUniquePtr FmXFormView::implCreateFieldControl( const svx::ODataAccessDe
sDataSource,
OUString(),
OUString(),
- comphelper::getProcessComponentContext()
+ comphelper::getProcessComponentContext(),
+ nullptr
) );
}
catch (const SQLException&)
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index dd8296696964..8e91d42804d4 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -314,7 +314,7 @@ void FmFieldWin::UpdateContent(const css::uno::Reference< css::form::XForm > & x
// get the connection of the form
m_aConnection.reset(
- connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessComponentContext() ),
+ connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessComponentContext(), nullptr ),
SharedConnection::NoTakeOwnership
);
// TODO: When incompatible changes (such as extending the "virtualdbtools" interface by ensureRowSetConnection)