diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-16 20:23:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-17 16:31:11 +0200 |
commit | d30ab819b80e67119e17d3e4243cab88c508ebae (patch) | |
tree | 89ae80196607983dd43645917639e5779c5a9018 /dbaccess | |
parent | cd963fe2f8607dc829a529adfe3a8a7464835070 (diff) |
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>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 42 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/inc/ModelImpl.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/composerdialogs.cxx | 2 |
6 files changed, 36 insertions, 22 deletions
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 ); |