summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-16 20:23:50 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-08-29 09:40:09 +0200
commita7035eb87aef491b52fae83675dd4d1a9877de4a (patch)
tree37d6ee480beb5128deadaa23b479a5ed22ee4b89 /dbaccess
parent456f25b164c2cf79f3a5120023c998a2cfcde019 (diff)
tdf#125340 transport preferred dialog parent down the migration dialog
Change-Id: Icb7bab35eac3ae08fb82d73f559ef161dd1820c3 Reviewed-on: https://gerrit.libreoffice.org/77638 Tested-by: Jenkins Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'dbaccess')
-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
6 files changed, 36 insertions, 22 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index b2b9430f562e..228542cd7c4b 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1454,7 +1454,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 d2afd8cc78aa..f25a11bfdf91 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;
}
}
@@ -777,7 +776,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
@@ -1399,6 +1398,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 c41a4e395c67..5e3a99ca8028 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -983,7 +983,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 );