diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-23 10:38:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-24 11:55:01 +0200 |
commit | f8e06f7b77a6286d2c41bbc76f06a768c76cd87a (patch) | |
tree | 0aa5836b7dcdba477f0dfca47b24a5f9aa8bd952 /dbaccess | |
parent | b85ff98383942360901b8242cf77366782400426 (diff) |
weld AdvancedSettingsDialog
make run virtual and fold executes into it, so GenericUnoDialog
can call run on tabdialogs to do the right thing, and allows
Start_Impl to be private again
Change-Id: Ic457edfbdc7457f4c49d4e8ad679903f38ad9b42
Reviewed-on: https://gerrit.libreoffice.org/62227
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
24 files changed, 137 insertions, 101 deletions
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 8baf8a5693ba..2e660ccb204d 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -931,7 +931,7 @@ void OGenericUnoController::clearView() void OGenericUnoController::showError(const SQLExceptionInfo& _rInfo) { - ::dbaui::showError(_rInfo,getView(),getORB()); + ::dbtools::showError(_rInfo,VCLUnoHelper::GetInterface(getView()),getORB()); } Reference< XLayoutManager > OGenericUnoController::getLayoutManager(const Reference< XFrame >& _xFrame) diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 4726dd8c58f6..01603fa72e8e 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1445,7 +1445,7 @@ IMPL_LINK_NOARG(SbaGridControl, AsynchDropEvent, void*, void) if (m_pMasterListener) m_pMasterListener->AfterDrop(); Show(); - ::dbaui::showError( ::dbtools::SQLExceptionInfo(e), this, getContext() ); + ::dbtools::showError( ::dbtools::SQLExceptionInfo(e), VCLUnoHelper::GetInterface(this), getContext() ); } catch(const Exception& ) { diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx index 44b575c4fa6b..b8e88925d7fd 100644 --- a/dbaccess/source/ui/control/TableGrantCtrl.cxx +++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx @@ -242,7 +242,7 @@ bool OTableGrantControl::SaveModified() catch(SQLException& e) { bErg = false; - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xContext); + ::dbtools::showError(::dbtools::SQLExceptionInfo(e),VCLUnoHelper::GetInterface(GetParent()),m_xContext); } if(bErg && Controller().is()) Controller()->ClearModified(); @@ -302,7 +302,7 @@ void OTableGrantControl::fillPrivilege(sal_Int32 _nRow) const } catch(SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xContext); + ::dbtools::showError(::dbtools::SQLExceptionInfo(e),VCLUnoHelper::GetInterface(GetParent()),m_xContext); } catch(Exception& ) { diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 6c75204f17d4..81fda93c625e 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -201,7 +201,7 @@ IMPL_LINK_NOARG(OCollectionView, NewFolder_Click, Button*, void) } catch( const SQLException& ) { - showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), this, m_xContext ); + showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), VCLUnoHelper::GetInterface(this), m_xContext ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index c8d99ff45878..20f814313551 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -133,9 +133,9 @@ namespace } // ODbDataSourceAdministrationHelper -ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Reference< XComponentContext >& _xORB, vcl::Window* _pParent,IItemSetHelper* _pItemSetHelper) +ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Reference< XComponentContext >& _xORB, weld::Window* pParent, weld::Window* pTopParent, IItemSetHelper* _pItemSetHelper) : m_xContext(_xORB) - , m_pParent(_pParent) + , m_pParent(pParent) , m_pItemSetHelper(_pItemSetHelper) { /// initialize the property translation map @@ -200,8 +200,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer } catch(const Exception&) { - vcl::Window* pTopParent = _pParent->GetParent(); - ShowServiceNotAvailableError(pTopParent ? pTopParent->GetFrameWeld() : nullptr, "com.sun.star.sdb.DatabaseContext", true); + ShowServiceNotAvailableError(pTopParent, "com.sun.star.sdb.DatabaseContext", true); } } @@ -352,7 +351,7 @@ std::pair< Reference<XConnection>,bool> ODbDataSourceAdministrationHelper::creat SQLExceptionInfo aErrorInfo; try { - WaitObject aWaitCursor(m_pParent); + weld::WaitObject aWaitCursor(m_pParent); aRet.first = getDriver()->connect(getConnectionURL(), aConnectionParams); aRet.second = true; } @@ -360,7 +359,7 @@ std::pair< Reference<XConnection>,bool> ODbDataSourceAdministrationHelper::creat catch (const SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); } catch (const SQLException& e) { aErrorInfo = SQLExceptionInfo(e); } - showError(aErrorInfo,m_pParent,getORB()); + showError(aErrorInfo,m_pParent->GetXWindow(),getORB()); } if ( aRet.first.is() ) successfullyConnected();// notify the admindlg to save the password diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx index 2912619bdd5d..559db0e6f10e 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx @@ -35,9 +35,8 @@ #include <svl/itemset.hxx> #include <com/sun/star/frame/XModel.hpp> #include <svl/poolitem.hxx> -#include <vcl/vclptr.hxx> +#include <vcl/weld.hxx> -namespace vcl { class Window; } namespace dbaui { namespace DataSourceInfoConverter @@ -67,13 +66,13 @@ namespace dbaui MapInt2String m_aDirectPropTranslator; /// translating property id's into names (direct properties of a data source) MapInt2String m_aIndirectPropTranslator; /// translating property id's into names (indirect properties of a data source) - VclPtr<vcl::Window> m_pParent; + weld::Window* m_pParent; IItemSetHelper* m_pItemSetHelper; public: - ODbDataSourceAdministrationHelper(const css::uno::Reference< css::uno::XComponentContext >& _xORB - ,vcl::Window* _pParent - ,IItemSetHelper* _pItemSetHelper); + ODbDataSourceAdministrationHelper(const css::uno::Reference< css::uno::XComponentContext >& _xORB, + weld::Window* pParent, weld::Window* pTopParent, + IItemSetHelper* _pItemSetHelper); /** translate the current dialog SfxItems into driver relevant PropertyValues @see successfullyConnected diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx index a724f3e16482..873028b4ec81 100644 --- a/dbaccess/source/ui/dlg/RelationDlg.cxx +++ b/dbaccess/source/ui/dlg/RelationDlg.cxx @@ -199,8 +199,8 @@ IMPL_LINK_NOARG( ORelationDialog, OKClickHdl, Button*, void ) } catch( const SQLException& ) { - ::dbaui::showError( SQLExceptionInfo( ::cppu::getCaughtException() ), - this, + ::dbtools::showError( SQLExceptionInfo( ::cppu::getCaughtException() ), + VCLUnoHelper::GetInterface(this), static_cast<OJoinTableView*>(GetParent())->getDesignView()->getController().getORB()); } catch( const Exception& ) diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx index 8c74ed4a2669..b332f0018de6 100644 --- a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx +++ b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx @@ -38,7 +38,7 @@ OTableSubscriptionDialog::OTableSubscriptionDialog(vcl::Window* pParent ,const css::uno::Any& _aDataSourceName) : SfxSingleTabDialog(pParent, _pItems, "TablesFilterDialog", "dbaccess/ui/tablesfilterdialog.ui") - , m_pImpl( new ODbDataSourceAdministrationHelper( _rxORB, pParent, this ) ) + , m_pImpl( new ODbDataSourceAdministrationHelper( _rxORB, GetFrameWeld(), pParent ? pParent->GetFrameWeld() : nullptr, this ) ) , m_bStopExecution(false) { m_pImpl->setDataSourceOrName(_aDataSourceName); diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index 74a1db8723f1..c35e2033c52d 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -203,7 +203,7 @@ IMPL_LINK( OUserAdmin, UserHdl, Button *, pButton, void ) { SfxPasswordDialog aPwdDlg(GetFrameWeld()); aPwdDlg.ShowExtras(SfxShowExtras::ALL); - if (aPwdDlg.execute()) + if (aPwdDlg.run()) { Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY); Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor(); @@ -259,7 +259,7 @@ IMPL_LINK( OUserAdmin, UserHdl, Button *, pButton, void ) } catch(const SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e), this, m_xORB); + ::dbtools::showError(::dbtools::SQLExceptionInfo(e), VCLUnoHelper::GetInterface(this), m_xORB); } catch(Exception& ) { @@ -316,7 +316,7 @@ void OUserAdmin::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) } catch(const SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e), this, m_xORB); + ::dbtools::showError(::dbtools::SQLExceptionInfo(e), VCLUnoHelper::GetInterface(this), m_xORB); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx index a818462196e4..48bc536df9dd 100644 --- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx +++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx @@ -56,7 +56,7 @@ namespace dbaui , m_xConnection(_xConnection) , m_bOwnConnection(!_xConnection.is()) { - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,_pParent,this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,GetFrameWeld(),_pParent ? _pParent->GetFrameWeld() : nullptr, this)); m_pImpl->setDataSourceOrName(_aDataSourceName); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); m_pImpl->translateProperties(xDatasource, *_pItems); @@ -107,7 +107,7 @@ namespace dbaui } catch(const SQLException&) { - ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), GetParent(), getORB() ); + ::dbtools::showError(::dbtools::SQLExceptionInfo(::cppu::getCaughtException()), VCLUnoHelper::GetInterface(GetParent()), getORB()); return RET_CANCEL; } catch(const Exception&) diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 10393c427b88..696c0fe78c52 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -343,19 +343,17 @@ namespace dbaui } // AdvancedSettingsDialog - AdvancedSettingsDialog::AdvancedSettingsDialog( vcl::Window* _pParent, SfxItemSet* _pItems, + AdvancedSettingsDialog::AdvancedSettingsDialog(weld::Window* pParent, SfxItemSet* _pItems, const Reference< XComponentContext >& _rxContext, const Any& _aDataSourceName ) - : SfxTabDialog(_pParent, "AdvancedSettingsDialog", - "dbaccess/ui/advancedsettingsdialog.ui", _pItems) + : SfxTabDialogController(pParent, "dbaccess/ui/advancedsettingsdialog.ui", "AdvancedSettingsDialog", _pItems) { - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext,_pParent,this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext, m_xDialog.get(), pParent, this)); m_pImpl->setDataSourceOrName(_aDataSourceName); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); m_pImpl->translateProperties(xDatasource, *_pItems); SetInputSet(_pItems); // propagate this set as our new input set and reset the example set - delete m_pExampleSet; - m_pExampleSet = new SfxItemSet(*GetInputSetImpl()); + m_xExampleSet.reset(new SfxItemSet(*GetInputSetImpl())); const OUString eType = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(*_pItems); @@ -380,14 +378,7 @@ namespace dbaui AdvancedSettingsDialog::~AdvancedSettingsDialog() { - disposeOnce(); - } - - void AdvancedSettingsDialog::dispose() - { SetInputSet(nullptr); - DELETEZ(m_pExampleSet); - SfxTabDialog::dispose(); } bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const OUString& _sURL ) @@ -397,38 +388,33 @@ namespace dbaui return rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting(); } - short AdvancedSettingsDialog::Execute() + short AdvancedSettingsDialog::Ok() { - short nRet = SfxTabDialog::Execute(); + short nRet = SfxTabDialogController::Ok(); if ( nRet == RET_OK ) { - m_pExampleSet->Put(*GetOutputItemSet()); - m_pImpl->saveChanges(*m_pExampleSet); + m_xExampleSet->Put(*GetOutputItemSet()); + m_pImpl->saveChanges(*m_xExampleSet); } return nRet; } - void AdvancedSettingsDialog::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage) + void AdvancedSettingsDialog::PageCreated(const OString& rId, SfxTabPage& _rPage) { // register ourself as modified listener static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( getORB() ); static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this); - - vcl::Window *pWin = GetViewWindow(); - if(pWin) - pWin->Invalidate(); - - SfxTabDialog::PageCreated(_nId, _rPage); + SfxTabDialogController::PageCreated(rId, _rPage); } const SfxItemSet* AdvancedSettingsDialog::getOutputSet() const { - return m_pExampleSet; + return m_xExampleSet.get(); } SfxItemSet* AdvancedSettingsDialog::getWriteOutputSet() { - return m_pExampleSet; + return m_xExampleSet.get(); } std::pair< Reference< XConnection >, bool > AdvancedSettingsDialog::createConnection() @@ -458,7 +444,7 @@ namespace dbaui void AdvancedSettingsDialog::setTitle(const OUString& _sTitle) { - SetText(_sTitle); + m_xDialog->set_title(_sTitle); } void AdvancedSettingsDialog::enableConfirmSettings( bool ) {} diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 431dcc9d8e08..d267f7efa08c 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -53,7 +53,7 @@ ODbAdminDialog::ODbAdminDialog(vcl::Window* _pParent "dbaccess/ui/admindialog.ui", _pItems) , m_bUIEnabled(true) { - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext,this,this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext,GetFrameWeld(), _pParent ? _pParent->GetFrameWeld() : nullptr, this)); // add the initial tab page m_nMainPageID = AddTabPage("advanced", OConnectionTabPage::Create, nullptr); diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index 603adbec9142..2eb084e4dddc 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -69,7 +69,7 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent ) :OWizardMachine(_pParent, WizardButtonFlags::NEXT | WizardButtonFlags::PREVIOUS | WizardButtonFlags::FINISH | WizardButtonFlags::CANCEL | WizardButtonFlags::HELP ) { - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,this,this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,GetFrameWeld(), _pParent ? _pParent->GetFrameWeld() : nullptr, this)); m_pImpl->setDataSourceOrName(_aDataSourceName); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); m_pOutSet.reset(new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() )); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 8d2581487e42..17565955523b 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -135,7 +135,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(vcl::Window* _pParent OSL_ENSURE(m_pCollection, "ODbTypeWizDialogSetup::ODbTypeWizDialogSetup : really need a DSN type collection !"); - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,this,this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,GetFrameWeld(),_pParent ? _pParent->GetFrameWeld() : nullptr, this)); m_pImpl->setDataSourceOrName(_aDataSourceName); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); m_pOutSet.reset( new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() ) ); diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx index 95b25438be29..e5c549214005 100644 --- a/dbaccess/source/ui/dlg/dlgsave.cxx +++ b/dbaccess/source/ui/dlg/dlgsave.cxx @@ -298,7 +298,7 @@ IMPL_LINK(OSaveAsDlg, ButtonClickHdl, Button *, pButton, void) if ( m_pImpl->m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) ) EndDialog( RET_OK ); - showError( aNameError, this, m_xContext ); + showError( aNameError, VCLUnoHelper::GetInterface(this), m_xContext ); m_pImpl->m_pTitle->GrabFocus(); } } diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 30f94d19f973..5494f2600a36 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -221,7 +221,7 @@ namespace dbaui } catch(SQLException& e) { - ::dbaui::showError(SQLExceptionInfo(e),_pParent,_rxContext); + ::dbtools::showError(SQLExceptionInfo(e),VCLUnoHelper::GetInterface(_pParent),_rxContext); } catch(Exception&) { @@ -345,7 +345,7 @@ namespace dbaui updateToolbox(); if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xContext); + showError(aExceptionInfo, VCLUnoHelper::GetInterface(this), m_xContext); else { m_pUnique->SaveValue(); @@ -445,7 +445,7 @@ namespace dbaui catch(SQLException& e) { aExceptionInfo = SQLExceptionInfo(e); } if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xContext); + showError(aExceptionInfo, VCLUnoHelper::GetInterface(this), m_xContext); else if (bSuccess && _bRemoveFromCollection) { SvTreeList* pModel = m_pIndexList->GetModel(); @@ -526,7 +526,7 @@ namespace dbaui catch(SQLException& e) { aExceptionInfo = SQLExceptionInfo(e); } if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xContext); + showError(aExceptionInfo, VCLUnoHelper::GetInterface(this), m_xContext); else m_pIndexList->SetEntryText(pSelected, aResetPos->sName); diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 0c4ae7a85e64..6c7a7b546ea5 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -23,6 +23,7 @@ #include <comphelper/stl_types.hxx> #include "TypeInfo.hxx" #include <editeng/svxenum.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <vcl/taskpanelist.hxx> #include <connectivity/dbtools.hxx> @@ -46,6 +47,7 @@ namespace com { namespace sun { namespace star { namespace awt { struct FontDescriptor; + class XWindow; } namespace sdbc { @@ -103,15 +105,6 @@ namespace dbaui css::uno::Reference< css::lang::XEventListener> const & _rEvtLst, css::uno::Reference< css::sdbc::XConnection>& _rOUTConnection ); - /** creates a error dialog which displays the SQLExceptionInfo. Also it supports a "more" button where detailed information are available - @param _rInfo the error which should be shown, if the info is not valid no error dialog will appear - @param _pParent the parent of the error dialog - @param _rxContext need to create the dialog - */ - void showError( const ::dbtools::SQLExceptionInfo& _rInfo, - vcl::Window* _pParent, - const css::uno::Reference< css::uno::XComponentContext >& _rxContext); - /** fills a map and a vector with localized type names @param _rxConnection the connection to access the metadata @param _rsTypeNames a list of localized type names separated with ';' diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx index 459e46d19260..f2d6e68cd60d 100644 --- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx +++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx @@ -21,9 +21,7 @@ #define INCLUDED_DBACCESS_SOURCE_UI_INC_ADVANCEDSETTINGSDLG_HXX #include "IItemSetHelper.hxx" - #include <sfx2/tabdlg.hxx> - #include <memory> namespace dbaui @@ -33,23 +31,23 @@ namespace dbaui class ODbDataSourceAdministrationHelper; /** implements the advanced page dlg of the data source properties. */ - class AdvancedSettingsDialog :public SfxTabDialog - ,public IItemSetHelper - ,public IDatabaseSettingsDialog + class AdvancedSettingsDialog : public SfxTabDialogController + , public IItemSetHelper + , public IDatabaseSettingsDialog { std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl; protected: - virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage) override; + virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override; + virtual short Ok() override; public: - AdvancedSettingsDialog( vcl::Window* _pParent - ,SfxItemSet* _pItems - ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB - ,const css::uno::Any& _aDataSourceName); + AdvancedSettingsDialog(weld::Window* pParent, + SfxItemSet* _pItems, + const css::uno::Reference< css::uno::XComponentContext >& _rxORB, + const css::uno::Any& _aDataSourceName); virtual ~AdvancedSettingsDialog() override; - virtual void dispose() override; /// determines whether or not the given data source type has any advanced setting static bool doesHaveAnyAdvancedSettings( const OUString& _sURL ); @@ -57,8 +55,6 @@ namespace dbaui virtual const SfxItemSet* getOutputSet() const override; virtual SfxItemSet* getWriteOutputSet() override; - virtual short Execute() override; - // forwards to ODbDataSourceAdministrationHelper virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override; virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override; diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 0fb7b3c47d04..e2f87ec2d979 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -729,7 +729,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe } catch( const SQLException&) { - ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), aWizard.get(), m_xContext ); + ::dbtools::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), VCLUnoHelper::GetInterface(aWizard.get()), m_xContext ); bError = true; } catch( const Exception& ) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 78e1347d5161..0f9b8dddbe47 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -66,6 +66,7 @@ #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontRelief.hpp> #include <com/sun/star/awt/FontWidth.hpp> +#include <com/sun/star/awt/XWindow.hpp> #include <TypeInfo.hxx> #include <FieldDescriptions.hxx> #include <comphelper/stl_types.hxx> @@ -257,7 +258,7 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName, } else { - showError( aSQLError, _pErrorMessageParent, _rxContext ); + showError( aSQLError, VCLUnoHelper::GetInterface(_pErrorMessageParent), _rxContext ); } } @@ -281,12 +282,6 @@ Reference< XInterface > getDataSourceOrModel(const Reference< XInterface >& _xOb return xRet; } -void showError(const SQLExceptionInfo& _rInfo, vcl::Window* _pParent,const Reference< XComponentContext >& _rxContext) -{ - OSL_ENSURE(_pParent,"showError: Parent window must be NOT NULL!"); - ::dbtools::showError(_rInfo,VCLUnoHelper::GetInterface(_pParent), _rxContext); -} - TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, sal_Int32 _nType, const OUString& _sTypeName, @@ -846,7 +841,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, { // want the dialog to be destroyed before our set SbaSbAttrDlg aDlg(_pParent->GetFrameWeld(), pFormatDescriptor.get(), _pFormatter, _bHasFormat); - if (RET_OK == aDlg.execute()) + if (RET_OK == aDlg.run()) { // ItemSet->UNO // UNO-properties diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index fc01797a3134..f1c8dd1c0032 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -197,7 +197,7 @@ namespace dbaui } else { - showError( aInfo, m_pErrorMessageParent, m_xContext ); + showError(aInfo, VCLUnoHelper::GetInterface(m_pErrorMessageParent), m_xContext); } } return xConnection; diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 5e46b34afbca..51fd3d9ea4f5 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -289,14 +289,14 @@ TTableWindowData::value_type OJoinTableView::createTableWindowData(const OUStrin } catch ( const SQLException& ) { - ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), - pParent, pParent->getController().getORB() ); + ::dbtools::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), + VCLUnoHelper::GetInterface(pParent), pParent->getController().getORB() ); } catch( const WrappedTargetException& e ) { SQLException aSql; if ( e.TargetException >>= aSql ) - ::dbaui::showError( ::dbtools::SQLExceptionInfo( aSql ), pParent, pParent->getController().getORB() ); + ::dbtools::showError( ::dbtools::SQLExceptionInfo( aSql ), VCLUnoHelper::GetInterface(pParent), pParent->getController().getORB() ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx index 1631456520a4..be42039bbe41 100644 --- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx @@ -125,7 +125,8 @@ namespace dbaui svt::OGenericUnoDialog::Dialog OAdvancedSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(VCLUnoHelper::GetWindow(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(o3tl::make_unique<AdvancedSettingsDialog>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), + m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/uiconfig/ui/advancedsettingsdialog.ui b/dbaccess/uiconfig/ui/advancedsettingsdialog.ui index ac20202d657e..a94e7718d285 100644 --- a/dbaccess/uiconfig/ui/advancedsettingsdialog.ui +++ b/dbaccess/uiconfig/ui/advancedsettingsdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="dba"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="AdvancedSettingsDialog"> @@ -7,7 +7,11 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="advancedsettingsdialog|AdvancedSettingsDialog">Advanced Settings</property> <property name="resizable">False</property> + <property name="modal">True</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -18,6 +22,20 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="no_show_all">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> <property name="visible">True</property> @@ -30,7 +48,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -44,7 +62,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -58,7 +76,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> <property name="secondary">True</property> </packing> </child> @@ -73,7 +91,7 @@ <child> <object class="GtkNotebook" id="tabcontrol"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="scrollable">True</property> @@ -85,6 +103,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -104,6 +146,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -131,6 +197,7 @@ </object> </child> <action-widgets> + <action-widget response="0">reset</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> |