diff options
45 files changed, 228 insertions, 185 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx index c0563986ea91..78497a0d8a1b 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx @@ -33,10 +33,10 @@ ChartTypeUnoDlg::~ChartTypeUnoDlg() { // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within an dtor, // so this virtual-method-call the base class does not work, we're already dead then... - if (m_pDialog) + if (m_aDialog) { ::osl::MutexGuard aGuard(m_aMutex); - if (m_pDialog) + if (m_aDialog) destroyDialog(); } } @@ -67,9 +67,9 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue) else ChartTypeUnoDlg_BASE::implInitialize(_rValue); } -VclPtr<Dialog> ChartTypeUnoDlg::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog ChartTypeUnoDlg::createDialog(vcl::Window* _pParent) { - return VclPtr<ChartTypeDialog>::Create( _pParent, m_xChartModel ); + return svt::OGenericUnoDialog::Dialog(VclPtr<ChartTypeDialog>::Create(_pParent, m_xChartModel)); } uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() { diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx index 76f7a15d790c..81c28734ba6f 100644 --- a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx +++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx @@ -41,7 +41,7 @@ private: // OGenericUnoDialog overridables virtual void implInitialize(const css::uno::Any& _rValue) override; - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; // XTypeProvider virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override; diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx index fccd12968016..a445b2bff175 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx @@ -32,10 +32,10 @@ namespace dbmm { // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within an dtor, // so this virtual-method-call the base class does not work, we're already dead then... - if ( m_pDialog ) + if (m_aDialog) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pDialog ) + if (m_aDialog) destroyDialog(); } } @@ -45,9 +45,9 @@ namespace dbmm return *(new MacroMigrationDialogService( _rxContext ) ); } - VclPtr<Dialog> MacroMigrationDialogService::createDialog( vcl::Window* _pParent ) + svt::OGenericUnoDialog::Dialog MacroMigrationDialogService::createDialog(vcl::Window* _pParent) { - return VclPtr<MacroMigrationDialog>::Create( _pParent, m_aContext, m_xDocument ); + return svt::OGenericUnoDialog::Dialog(VclPtr<MacroMigrationDialog>::Create(_pParent, m_aContext, m_xDocument)); } Sequence< sal_Int8 > SAL_CALL MacroMigrationDialogService::getImplementationId() diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.hxx b/dbaccess/source/ext/macromigration/macromigrationwizard.hxx index 886239cde4de..85adc818e048 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.hxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.hxx @@ -87,7 +87,7 @@ namespace dbmm virtual ~MacroMigrationDialogService() override; protected: - virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; private: Reference< XOfficeDatabaseDocument > m_xDocument; diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx index 6a38537ab82f..ae3b2a8f116b 100644 --- a/dbaccess/source/ui/inc/unosqlmessage.hxx +++ b/dbaccess/source/ui/inc/unosqlmessage.hxx @@ -69,8 +69,8 @@ private: // (overwriting these three, because we have some special handling for our property) virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue) override; -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx index 8a2bd3e88a84..8f1d34334555 100644 --- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx @@ -65,7 +65,7 @@ namespace dbaui virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; protected: // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XComponentContext >& _rxORB) @@ -120,9 +120,10 @@ namespace dbaui describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); } - VclPtr<Dialog> OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent) + + svt::OGenericUnoDialog::Dialog OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection); + return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx index fa119a03fd2c..e9f007905ff9 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx @@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo() return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> ODBTypeWizDialog::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog ODBTypeWizDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection); + return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx index a13e569b1f87..6be18eba68df 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx @@ -54,8 +54,8 @@ public: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; private: -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx index 9005e8acb918..645736285d8e 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx @@ -104,16 +104,16 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo( return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent) { - return VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection); + return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); } void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult) { if ( _nExecutionResult == RET_OK ) { - const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog.get() ); + const ODbTypeWizDialogSetup* pDialog = static_cast<ODbTypeWizDialogSetup*>(m_aDialog.m_xVclDialog.get()); m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened(); m_bStartTableWizard = pDialog->IsTableWizardToBeStarted(); } diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx index 9c8be2e76b8c..d70aac205b57 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx @@ -56,8 +56,8 @@ public: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; private: -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void executedDialog(sal_Int16 _nExecutionResult) override; }; diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx index dc3462871a0d..4a6ef4cf6c3c 100644 --- a/dbaccess/source/ui/uno/TableFilterDlg.cxx +++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx @@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo() return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> OTableFilterDialog::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog OTableFilterDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection); + return svt::OGenericUnoDialog::Dialog(VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/TableFilterDlg.hxx b/dbaccess/source/ui/uno/TableFilterDlg.hxx index 3faf9dde83a1..3a8d9b7f3f6e 100644 --- a/dbaccess/source/ui/uno/TableFilterDlg.hxx +++ b/dbaccess/source/ui/uno/TableFilterDlg.hxx @@ -55,8 +55,8 @@ public: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; private: -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx index ce7be4598215..f2aa0681e68b 100644 --- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx @@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo() return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> OUserSettingsDialog::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog OUserSettingsDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection); + return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.hxx b/dbaccess/source/ui/uno/UserSettingsDlg.hxx index 931d1c77a701..b7b7cc66e469 100644 --- a/dbaccess/source/ui/uno/UserSettingsDlg.hxx +++ b/dbaccess/source/ui/uno/UserSettingsDlg.hxx @@ -55,8 +55,8 @@ public: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; private: -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx index e5ac2b416a4b..c58afd44919e 100644 --- a/dbaccess/source/ui/uno/admindlg.cxx +++ b/dbaccess/source/ui/uno/admindlg.cxx @@ -91,7 +91,7 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent) { VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems, m_aContext); @@ -99,7 +99,7 @@ VclPtr<Dialog> ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent) if ( m_aInitialSelection.hasValue() ) pDialog->selectDataSource(m_aInitialSelection); - return pDialog; + return svt::OGenericUnoDialog::Dialog(pDialog); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/admindlg.hxx b/dbaccess/source/ui/uno/admindlg.hxx index 38b2bf632c3e..e0e80e8586ae 100644 --- a/dbaccess/source/ui/uno/admindlg.hxx +++ b/dbaccess/source/ui/uno/admindlg.hxx @@ -54,8 +54,8 @@ public: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; private: -// OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx index 0af4b19d97ee..b0613c60580c 100644 --- a/dbaccess/source/ui/uno/composerdialogs.cxx +++ b/dbaccess/source/ui/uno/composerdialogs.cxx @@ -76,7 +76,7 @@ namespace dbaui IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ComposerDialog ) - VclPtr<Dialog> ComposerDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog ComposerDialog::createDialog(vcl::Window* _pParent) { // obtain all the objects needed for the dialog Reference< XConnection > xConnection; @@ -117,10 +117,12 @@ namespace dbaui } if ( !xConnection.is() || !xColumns.is() || !m_xComposer.is() ) + { // can't create the dialog if I have improper settings - return nullptr; + return svt::OGenericUnoDialog::Dialog(nullptr); + } - return createComposerDialog( _pParent, xConnection, xColumns ); + return svt::OGenericUnoDialog::Dialog(createComposerDialog(_pParent, xConnection, xColumns)); } // RowsetFilterDialog @@ -167,8 +169,8 @@ namespace dbaui { ComposerDialog::executedDialog( _nExecutionResult ); - if ( _nExecutionResult && m_pDialog ) - static_cast< DlgFilterCrit* >( m_pDialog.get() )->BuildWherePart(); + if ( _nExecutionResult && m_aDialog ) + static_cast< DlgFilterCrit* >( m_aDialog.m_xVclDialog.get() )->BuildWherePart(); } // RowsetOrderDialog @@ -211,13 +213,13 @@ namespace dbaui { ComposerDialog::executedDialog( _nExecutionResult ); - if ( !m_pDialog ) + if ( !m_aDialog ) return; if ( _nExecutionResult ) - static_cast< DlgOrderCrit* >( m_pDialog.get() )->BuildOrderPart(); + static_cast< DlgOrderCrit* >( m_aDialog.m_xVclDialog.get() )->BuildOrderPart(); else if ( m_xComposer.is() ) - m_xComposer->setOrder( static_cast< DlgOrderCrit* >( m_pDialog.get() )->GetOrignalOrder() ); + m_xComposer->setOrder( static_cast< DlgOrderCrit* >( m_aDialog.m_xVclDialog.get() )->GetOrignalOrder() ); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx index 7647a1f4d5b6..f850b021a797 100644 --- a/dbaccess/source/ui/uno/composerdialogs.hxx +++ b/dbaccess/source/ui/uno/composerdialogs.hxx @@ -60,7 +60,7 @@ namespace dbaui protected: // own overridables - virtual VclPtr<Dialog> createComposerDialog( + virtual VclPtr<::Dialog> createComposerDialog( vcl::Window* _pParent, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::container::XNameAccess >& _rxColumns @@ -68,7 +68,7 @@ namespace dbaui private: // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; // RowsetFilterDialog @@ -89,7 +89,7 @@ namespace dbaui protected: // own overridables - virtual VclPtr<Dialog> createComposerDialog( + virtual VclPtr<::Dialog> createComposerDialog( vcl::Window* _pParent, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::container::XNameAccess >& _rxColumns @@ -119,7 +119,7 @@ namespace dbaui protected: // own overridables - virtual VclPtr<Dialog> createComposerDialog( + virtual VclPtr<::Dialog> createComposerDialog( vcl::Window* _pParent, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::container::XNameAccess >& _rxColumns diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index b714f93ae3c8..076ceb4c0726 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -192,7 +192,7 @@ namespace dbaui virtual ~CopyTableWizard() override; // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void executedDialog( sal_Int16 _nExecutionResult ) override; private: @@ -546,7 +546,7 @@ void SAL_CALL CopyTableWizard::setTitle( const OUString& _rTitle ) OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() { - OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog.get() ); + OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >(m_aDialog.m_xVclDialog.get()); if ( !pWizard ) throw DisposedException( OUString(), *this ); return *pWizard; @@ -1508,7 +1508,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) return new ::cppu::OPropertyArrayHelper( aProps ); } -VclPtr<Dialog> CopyTableWizard::createDialog( vcl::Window* _pParent ) +svt::OGenericUnoDialog::Dialog CopyTableWizard::createDialog( vcl::Window* _pParent ) { OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" ); // this should have been prevented in ::execute already @@ -1526,7 +1526,7 @@ VclPtr<Dialog> CopyTableWizard::createDialog( vcl::Window* _pParent ) impl_attributesToDialog_nothrow( *pWizard ); - return pWizard; + return svt::OGenericUnoDialog::Dialog(pWizard); } void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult ) diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx index 609ad0362747..62ca64e0cb7b 100644 --- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx +++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx @@ -105,7 +105,7 @@ namespace dbaui protected: // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; using OTextConnectionSettingsDialog_BASE::getFastPropertyValue; }; @@ -202,9 +202,9 @@ namespace dbaui return new ::cppu::OPropertyArrayHelper( aProps ); } - VclPtr<Dialog> OTextConnectionSettingsDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog OTextConnectionSettingsDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<TextConnectionSettingsDialog>::Create( _pParent, *m_pDatasourceItems ); + return svt::OGenericUnoDialog::Dialog(VclPtr<TextConnectionSettingsDialog>::Create(_pParent, *m_pDatasourceItems)); } void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx index 56723e7a1f95..39ed8a9a5aa5 100644 --- a/dbaccess/source/ui/uno/unoDirectSql.cxx +++ b/dbaccess/source/ui/uno/unoDirectSql.cxx @@ -77,7 +77,7 @@ namespace dbaui IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog ) - VclPtr<Dialog> ODirectSQLDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog ODirectSQLDialog::createDialog(vcl::Window* _pParent) { // obtain all the objects needed for the dialog Reference< XConnection > xConnection = m_xActiveConnection; @@ -94,12 +94,15 @@ namespace dbaui DBG_UNHANDLED_EXCEPTION(); } } - if ( !xConnection.is() ) + if (!xConnection.is()) + { // can't create the dialog if I have improper settings - return nullptr; + return svt::OGenericUnoDialog::Dialog(nullptr); + } - return VclPtr<DirectSQLDialog>::Create( _pParent, xConnection ); + return svt::OGenericUnoDialog::Dialog(VclPtr<DirectSQLDialog>::Create(_pParent, xConnection)); } + void ODirectSQLDialog::implInitialize(const Any& _rValue) { PropertyValue aProperty; diff --git a/dbaccess/source/ui/uno/unoDirectSql.hxx b/dbaccess/source/ui/uno/unoDirectSql.hxx index c0e2a63b914a..d616888e92ff 100644 --- a/dbaccess/source/ui/uno/unoDirectSql.hxx +++ b/dbaccess/source/ui/uno/unoDirectSql.hxx @@ -61,7 +61,7 @@ namespace dbaui protected: // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void implInitialize(const css::uno::Any& _rValue) override; }; diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx index a1aaca3ef8c5..51abc7e5a208 100644 --- a/dbaccess/source/ui/uno/unoadmin.cxx +++ b/dbaccess/source/ui/uno/unoadmin.cxx @@ -51,10 +51,10 @@ ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XC ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() { - if (m_pDialog) + if (m_aDialog) { ::osl::MutexGuard aGuard(m_aMutex); - if (m_pDialog) + if (m_aDialog) { destroyDialog(); ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults); diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx index a9f9791cc316..7b8158855535 100644 --- a/dbaccess/source/ui/uno/unosqlmessage.cxx +++ b/dbaccess/source/ui/uno/unosqlmessage.cxx @@ -143,13 +143,13 @@ Reference<XPropertySetInfo> SAL_CALL OSQLMessageDialog::getPropertySetInfo() return new ::cppu::OPropertyArrayHelper(aProps); } -VclPtr<Dialog> OSQLMessageDialog::createDialog(vcl::Window* _pParent) +svt::OGenericUnoDialog::Dialog OSQLMessageDialog::createDialog(vcl::Window* _pParent) { if ( m_aException.hasValue() ) - return VclPtr<OSQLMessageBox>::Create( _pParent, SQLExceptionInfo( m_aException ), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, m_sHelpURL ); + return svt::OGenericUnoDialog::Dialog(VclPtr<OSQLMessageBox>::Create(_pParent, SQLExceptionInfo(m_aException), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, m_sHelpURL)); OSL_FAIL("OSQLMessageDialog::createDialog : You should use the SQLException property to specify the error to display!"); - return VclPtr<OSQLMessageBox>::Create(_pParent, SQLException()); + return svt::OGenericUnoDialog::Dialog(VclPtr<OSQLMessageBox>::Create(_pParent, SQLException())); } } // namespace dbaui diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index dee2c9d0a231..28f7924db0f4 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -111,9 +111,9 @@ namespace abp } } - VclPtr<Dialog> OABSPilotUno::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog OABSPilotUno::createDialog(vcl::Window* _pParent) { - return VclPtr<OAddressBookSourcePilot>::Create(_pParent, m_aContext ); + return svt::OGenericUnoDialog::Dialog(VclPtr<OAddressBookSourcePilot>::Create(_pParent, m_aContext)); } @@ -136,7 +136,7 @@ namespace abp { if ( _nExecutionResult == RET_OK ) { - const AddressSettings& aSettings = static_cast<OAddressBookSourcePilot*>(m_pDialog.get())->getSettings(); + const AddressSettings& aSettings = static_cast<OAddressBookSourcePilot*>(m_aDialog.m_xVclDialog.get())->getSettings(); m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName; } } diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx index 5bf30a9e0c13..01f3bad92e55 100644 --- a/extensions/source/abpilot/unodialogabp.hxx +++ b/extensions/source/abpilot/unodialogabp.hxx @@ -71,7 +71,7 @@ namespace abp using svt::OGenericUnoDialog::execute; // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void executedDialog(sal_Int16 _nExecutionResult) override; }; diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx index 49bbf19ec1a4..fe8b7058f70b 100644 --- a/extensions/source/dbpilots/unoautopilot.hxx +++ b/extensions/source/dbpilots/unoautopilot.hxx @@ -103,10 +103,10 @@ namespace dbp } private: - // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override { - return VclPtr<TYPE>::Create(_pParent, m_xObjectModel, m_aContext); + return svt::OGenericUnoDialog::Dialog(VclPtr<TYPE>::Create(_pParent, m_xObjectModel, m_aContext)); } virtual void implInitialize(const css::uno::Any& _rValue) override diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index 31f49eb29df7..e6af23a138a6 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -97,11 +97,10 @@ namespace pcr return new ::cppu::OPropertyArrayHelper(aProps); } - - VclPtr<Dialog> MasterDetailLinkDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog MasterDetailLinkDialog::createDialog(vcl::Window* _pParent) { - return VclPtr<FormLinkDialog>::Create(_pParent,m_xDetail,m_xMaster, m_aContext - ,m_sExplanation,m_sDetailLabel,m_sMasterLabel); + return svt::OGenericUnoDialog::Dialog(VclPtr<FormLinkDialog>::Create(_pParent,m_xDetail,m_xMaster, m_aContext + ,m_sExplanation,m_sDetailLabel,m_sMasterLabel)); } void MasterDetailLinkDialog::implInitialize(const Any& _rValue) diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx index e23fac7b4958..939f6287f64d 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx @@ -58,7 +58,7 @@ namespace pcr virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void implInitialize(const css::uno::Any& _rValue) override; css::uno::Reference< css::beans::XPropertySet> m_xDetail; diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 53d3f7fcf432..a9cf32d93ab4 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -53,10 +53,10 @@ namespace pcr OControlFontDialog::~OControlFontDialog() { - if (m_pDialog) + if (m_aDialog) { ::osl::MutexGuard aGuard(m_aMutex); - if (m_pDialog) + if (m_aDialog) { destroyDialog(); ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); @@ -138,8 +138,7 @@ namespace pcr return new ::cppu::OPropertyArrayHelper(aProps); } - - VclPtr<Dialog> OControlFontDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog OControlFontDialog::createDialog(vcl::Window* _pParent) { ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); @@ -150,15 +149,15 @@ namespace pcr // sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first // execute) will be re-used upon the second execute, and thus it won't be initialized correctly. - return VclPtr<ControlCharacterDialog>::Create(_pParent, *m_pFontItems); + return svt::OGenericUnoDialog::Dialog(VclPtr<ControlCharacterDialog>::Create(_pParent, *m_pFontItems)); } void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult) { - OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!"); - if (m_pDialog && (RET_OK == _nExecutionResult) && m_xControlModel.is()) + OSL_ENSURE(m_aDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!"); + if (m_aDialog && (RET_OK == _nExecutionResult) && m_xControlModel.is()) { - const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_pDialog.get())->GetOutputItemSet(); + const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_aDialog.m_xVclDialog.get())->GetOutputItemSet(); if (pOutput) ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel ); } diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx index 576614baa1cb..980441320064 100644 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ b/extensions/source/propctrlr/controlfontdialog.hxx @@ -79,8 +79,8 @@ namespace pcr virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; protected: - // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void executedDialog(sal_Int16 _nExecutionResult) override; }; diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index c2b1d6f08396..2d6cd48e0bb2 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -58,18 +58,16 @@ namespace pcr &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() ); } - OTabOrderDialog::~OTabOrderDialog() { - if ( m_pDialog ) + if (m_aDialog) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pDialog ) + if (m_aDialog) destroyDialog(); } } - Sequence<sal_Int8> SAL_CALL OTabOrderDialog::getImplementationId( ) { return css::uno::Sequence<sal_Int8>(); @@ -129,10 +127,9 @@ namespace pcr return new ::cppu::OPropertyArrayHelper( aProps ); } - - VclPtr<Dialog> OTabOrderDialog::createDialog( vcl::Window* _pParent ) + svt::OGenericUnoDialog::Dialog OTabOrderDialog::createDialog( vcl::Window* _pParent ) { - return VclPtr<TabOrderDialog>::Create( _pParent, m_xTabbingModel, m_xControlContext, m_aContext ); + return svt::OGenericUnoDialog::Dialog(VclPtr<TabOrderDialog>::Create( _pParent, m_xTabbingModel, m_xControlContext, m_aContext)); } void OTabOrderDialog::initialize( const Sequence< Any >& aArguments ) diff --git a/extensions/source/propctrlr/pcrunodialogs.hxx b/extensions/source/propctrlr/pcrunodialogs.hxx index 1eb7375abba5..48d85f9be880 100644 --- a/extensions/source/propctrlr/pcrunodialogs.hxx +++ b/extensions/source/propctrlr/pcrunodialogs.hxx @@ -77,8 +77,8 @@ namespace pcr virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; protected: - // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + // OGenericUnoDialog overridables + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; }; diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index aabf1bf9c91b..4116900ee29b 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -117,9 +117,9 @@ Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames() } -VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent ) +svt::OGenericUnoDialog::Dialog SWFDialog::createDialog( vcl::Window* pParent ) { - VclPtr<Dialog> pRet; + VclPtr<::Dialog> pRet; if (mxSrcDoc.is()) { @@ -146,14 +146,14 @@ VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent ) pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) ); } - return pRet; + return svt::OGenericUnoDialog::Dialog(pRet); } void SWFDialog::executedDialog( sal_Int16 nExecutionResult ) { - if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpSWFDialog* >( m_pDialog.get() )->GetFilterData(); + if (nExecutionResult && m_aDialog) + maFilterData = static_cast< ImpSWFDialog* >(m_aDialog.m_xVclDialog.get())->GetFilterData(); destroyDialog(); } diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx index e75d8ba08a87..c444ddf02328 100644 --- a/filter/source/flash/swfdialog.hxx +++ b/filter/source/flash/swfdialog.hxx @@ -50,7 +50,7 @@ private: virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual OUString SAL_CALL getImplementationName() override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog( vcl::Window* pParent ) override; virtual void executedDialog( sal_Int16 nExecutionResult ) override; virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index fcd66f01a56b..f66eb343e0c5 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -83,19 +83,17 @@ Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames() return PDFDialog_getSupportedServiceNames(); } - -VclPtr<Dialog> PDFDialog::createDialog( vcl::Window* pParent ) +svt::OGenericUnoDialog::Dialog PDFDialog::createDialog( vcl::Window* pParent ) { if( mxSrcDoc.is() ) - return VclPtr<ImpPDFTabDialog>::Create( pParent, maFilterData, mxSrcDoc ); - return VclPtr<Dialog>(); + return svt::OGenericUnoDialog::Dialog(VclPtr<ImpPDFTabDialog>::Create(pParent, maFilterData, mxSrcDoc)); + return svt::OGenericUnoDialog::Dialog(VclPtr<::Dialog>()); } - void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) { - if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog.get() )->GetFilterData(); + if (nExecutionResult && m_aDialog) + maFilterData = static_cast< ImpPDFTabDialog* >( m_aDialog.m_xVclDialog.get() )->GetFilterData(); destroyDialog(); } diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx index 671db03ed6fa..ce6a2a0f407d 100644 --- a/filter/source/pdf/pdfdialog.hxx +++ b/filter/source/pdf/pdfdialog.hxx @@ -43,7 +43,7 @@ private: virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual OUString SAL_CALL getImplementationName() override; virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* pParent) override; virtual void executedDialog( sal_Int16 nExecutionResult ) override; virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx index ddf3693c37df..71138a7d5291 100644 --- a/filter/source/svg/svgdialog.cxx +++ b/filter/source/svg/svgdialog.cxx @@ -115,20 +115,18 @@ Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames() return SVGDialog_getSupportedServiceNames(); } - -VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent ) +svt::OGenericUnoDialog::Dialog SVGDialog::createDialog( vcl::Window* pParent ) { if( mxSrcDoc.is() ) - return VclPtr<ImpSVGDialog>::Create( pParent, maFilterData ); + return svt::OGenericUnoDialog::Dialog(VclPtr<ImpSVGDialog>::Create( pParent, maFilterData )); else - return VclPtr<Dialog>(); + return svt::OGenericUnoDialog::Dialog(VclPtr<::Dialog>()); } - void SVGDialog::executedDialog( sal_Int16 nExecutionResult ) { - if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpSVGDialog* >( m_pDialog.get() )->GetFilterData(); + if (nExecutionResult && m_aDialog) + maFilterData = static_cast< ImpSVGDialog* >(m_aDialog.m_xVclDialog.get())->GetFilterData(); destroyDialog(); } diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx index ed4bcbee343f..9016f0427ba4 100644 --- a/filter/source/svg/svgdialog.hxx +++ b/filter/source/svg/svgdialog.hxx @@ -49,7 +49,7 @@ private: virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual OUString SAL_CALL getImplementationName() override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) override; + virtual svt::OGenericUnoDialog::Dialog createDialog( vcl::Window* pParent ) override; virtual void executedDialog( sal_Int16 nExecutionResult ) override; virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx index a5ec54f4cf79..89d10a124540 100644 --- a/include/svtools/genericunodialog.hxx +++ b/include/svtools/genericunodialog.hxx @@ -38,10 +38,10 @@ #include <comphelper/propertycontainer.hxx> #include <comphelper/broadcasthelper.hxx> #include <tools/link.hxx> +#include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> +#include <vcl/weld.hxx> -class Dialog; -namespace vcl { class Window; } class VclWindowEvent; @@ -55,7 +55,6 @@ namespace svt #define UNODIALOG_PROPERTY_TITLE "Title" #define UNODIALOG_PROPERTY_PARENT "ParentWindow" - typedef cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, css::lang::XServiceInfo, css::lang::XInitialization > OGenericUnoDialogBase; @@ -67,8 +66,58 @@ namespace svt ,public ::comphelper::OMutexAndBroadcastHelper ,public ::comphelper::OPropertyContainer { + public: + struct Dialog + { + VclPtr<::Dialog> m_xVclDialog; + std::unique_ptr<weld::DialogController> m_xWeldDialog; + + Dialog() + { + } + + Dialog(const VclPtr<::Dialog>& rVclDialog) + : m_xVclDialog(rVclDialog) + { + } + + Dialog(weld::DialogController* pWeldDialog) + : m_xWeldDialog(pWeldDialog) + { + } + + explicit operator bool() const + { + return m_xVclDialog || m_xWeldDialog; + } + + void set_title(const OUString& rTitle) + { + if (m_xWeldDialog) + m_xWeldDialog->set_title(rTitle); + else if (m_xVclDialog) + m_xVclDialog->SetText(rTitle); + } + + OString get_help_id() const + { + if (m_xWeldDialog) + return m_xWeldDialog->get_help_id(); + else if (m_xVclDialog) + return m_xVclDialog->GetHelpId(); + return OString(); + } + + void set_help_id(const OString& rHelpId) + { + if (m_xWeldDialog) + return m_xWeldDialog->set_help_id(rHelpId); + else if (m_xVclDialog) + return m_xVclDialog->SetHelpId(rHelpId); + } + }; protected: - VclPtr<Dialog> m_pDialog; /// the dialog to execute + OGenericUnoDialog::Dialog m_aDialog; /// the dialog to execute bool m_bExecuting : 1; /// we're currently executing the dialog bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet bool m_bInitialized : 1; /// has "initialize" been called? @@ -118,7 +167,7 @@ namespace svt but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog). @param pParent the parent window for the new dialog */ - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) = 0; + virtual OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) = 0; /// called to destroy the dialog used. deletes m_pDialog and resets it to NULL void destroyDialog(); diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index e9817e217fac..ef1af102dbd6 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -71,7 +71,7 @@ namespace { protected: // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void implInitialize(const css::uno::Any& _rValue) override; @@ -132,8 +132,8 @@ namespace { OGenericUnoDialog::executedDialog(_nExecutionResult); if ( _nExecutionResult ) - if ( m_pDialog ) - static_cast< AddressBookSourceDialog* >( m_pDialog.get() )->getFieldMapping( m_aAliases ); + if ( m_aDialog ) + static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases ); } void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) @@ -199,12 +199,12 @@ namespace { } - VclPtr<Dialog> OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent) { if ( m_xDataSource.is() && !m_sTable.isEmpty() ) - return VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); + return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases)); else - return VclPtr<AddressBookSourceDialog>::Create( _pParent, m_aContext ); + return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext)); } } diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index f6446e76ec62..c28af0833a45 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -47,7 +47,6 @@ namespace svt OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxContext) :OPropertyContainer(GetBroadcastHelper()) - ,m_pDialog(nullptr) ,m_bExecuting(false) ,m_bTitleAmbiguous(true) ,m_bInitialized( false ) @@ -63,11 +62,11 @@ OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxCo OGenericUnoDialog::~OGenericUnoDialog() { - if ( m_pDialog ) + if (m_aDialog) { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pDialog ) + if (m_aDialog) destroyDialog(); } } @@ -113,8 +112,8 @@ void OGenericUnoDialog::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, con // from now on m_sTitle is valid m_bTitleAmbiguous = false; - if (m_pDialog) - m_pDialog->SetText(m_sTitle); + if (m_aDialog) + m_aDialog.set_title(m_sTitle); } } @@ -162,7 +161,7 @@ void SAL_CALL OGenericUnoDialog::setTitle( const OUString& _rTitle ) bool OGenericUnoDialog::impl_ensureDialog_lck() { - if ( m_pDialog ) + if (m_aDialog) return true; // get the parameters for the dialog from the current settings @@ -176,30 +175,32 @@ bool OGenericUnoDialog::impl_ensureDialog_lck() // the title OUString sTitle = m_sTitle; - VclPtr<Dialog> pDialog = createDialog( pParent ); - OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" ); - if ( !pDialog ) + OGenericUnoDialog::Dialog aDialog(createDialog(pParent)); + OSL_ENSURE(aDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!"); + if (!aDialog) return false; // do some initialisations - if ( !m_bTitleAmbiguous ) - pDialog->SetText( sTitle ); + if (!m_bTitleAmbiguous) + aDialog.set_title(sTitle); - // be notified when the dialog is killed by somebody else #i65958# - pDialog->AddEventListener( LINK( this, OGenericUnoDialog, OnDialogDying ) ); + if (aDialog.m_xVclDialog) + { + // be notified when the dialog is killed by somebody else #i65958# + aDialog.m_xVclDialog->AddEventListener(LINK(this, OGenericUnoDialog, OnDialogDying)); + } - m_pDialog = pDialog; + m_aDialog = std::move(aDialog); return true; } - -sal_Int16 SAL_CALL OGenericUnoDialog::execute( ) +sal_Int16 SAL_CALL OGenericUnoDialog::execute() { // both creation and execution of the dialog must be guarded with the SolarMutex, so be generous here SolarMutexGuard aSolarGuard; - Dialog* pDialogToExecute = nullptr; + ::Dialog* pVclDialogToExecute = nullptr; // create the dialog, if necessary { UnoDialogEntryGuard aGuard( *this ); @@ -215,13 +216,15 @@ sal_Int16 SAL_CALL OGenericUnoDialog::execute( ) if ( !impl_ensureDialog_lck() ) return 0; - pDialogToExecute = m_pDialog; + pVclDialogToExecute = m_aDialog.m_xVclDialog; } // start execution sal_Int16 nReturn(0); - if ( pDialogToExecute ) - nReturn = pDialogToExecute->Execute(); + if (pVclDialogToExecute) + nReturn = pVclDialogToExecute->Execute(); + else if (m_aDialog.m_xWeldDialog) + nReturn = m_aDialog.m_xWeldDialog->run(); { ::osl::MutexGuard aGuard(m_aMutex); @@ -275,15 +278,16 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments ) void OGenericUnoDialog::destroyDialog() { SolarMutexGuard aSolarGuard; - m_pDialog.disposeAndClear(); + m_aDialog.m_xVclDialog.disposeAndClear(); + m_aDialog.m_xWeldDialog.reset(); } IMPL_LINK( OGenericUnoDialog, OnDialogDying, VclWindowEvent&, _rEvent, void ) { - OSL_ENSURE( _rEvent.GetWindow() == m_pDialog, "OGenericUnoDialog::OnDialogDying: where does this come from?" ); + OSL_ENSURE( _rEvent.GetWindow() == m_aDialog.m_xVclDialog, "OGenericUnoDialog::OnDialogDying: where does this come from?" ); if ( _rEvent.GetId() == VclEventId::ObjectDying ) - m_pDialog = nullptr; + m_aDialog.m_xVclDialog = nullptr; } diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 9906d34e5ffe..103b39c9aff1 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -130,7 +130,7 @@ namespace { virtual ~Wizard() override; protected: - virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; + virtual OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; private: css::uno::Sequence< css::uno::Sequence< sal_Int16 > > m_aWizardSteps; @@ -157,12 +157,12 @@ namespace { Wizard::~Wizard() { - if ( m_pDialog ) + if (m_aDialog) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pDialog ) + if (m_aDialog) { - m_sHelpURL = lcl_getHelpURL( m_pDialog->GetHelpId() ); + m_sHelpURL = lcl_getHelpURL(m_aDialog.get_help_id()); destroyDialog(); } } @@ -251,12 +251,12 @@ namespace { return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); } - VclPtr<Dialog> Wizard::createDialog( vcl::Window* i_pParent ) + svt::OGenericUnoDialog::Dialog Wizard::createDialog( vcl::Window* i_pParent ) { VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps ); pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) ); pDialog->setTitleBase( m_sTitle ); - return pDialog.get(); + return OGenericUnoDialog::Dialog(pDialog); } OUString SAL_CALL Wizard::getImplementationName() @@ -297,10 +297,10 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pDialog ) + if (!m_aDialog) return m_sHelpURL; - return lcl_getHelpURL( m_pDialog->GetHelpId() ); + return lcl_getHelpURL(m_aDialog.get_help_id()); } @@ -309,10 +309,10 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pDialog ) + if (!m_aDialog) m_sHelpURL = i_HelpURL; else - m_pDialog->SetHelpId( lcl_getHelpId( i_HelpURL ) ); + m_aDialog.set_help_id(lcl_getHelpId(i_HelpURL)); } @@ -321,8 +321,8 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr ); - return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY ); + ENSURE_OR_RETURN( m_aDialog.m_xVclDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr ); + return Reference< XWindow >( m_aDialog.m_xVclDialog->GetComponentInterface(), UNO_QUERY ); } @@ -331,7 +331,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); @@ -343,7 +343,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); @@ -355,7 +355,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); return pWizardImpl->travelNext(); @@ -367,7 +367,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); return pWizardImpl->travelPrevious(); @@ -379,7 +379,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); if ( !pWizardImpl->knowsPage( i_PageID ) ) @@ -397,7 +397,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); pWizardImpl->updateTravelUI(); @@ -409,7 +409,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); return pWizardImpl->advanceTo( i_PageId ); @@ -421,7 +421,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); return pWizardImpl->goBackTo( i_PageId ); @@ -433,7 +433,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); return pWizardImpl->getCurrentWizardPage(); @@ -448,7 +448,7 @@ namespace { if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) throw NoSuchElementException( OUString(), *this ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); pWizardImpl->activatePath( i_PathIndex, i_Final ); diff --git a/svx/source/form/xfm_addcondition.cxx b/svx/source/form/xfm_addcondition.cxx index a16ad62628b0..4d6b8f579acd 100644 --- a/svx/source/form/xfm_addcondition.cxx +++ b/svx/source/form/xfm_addcondition.cxx @@ -125,13 +125,11 @@ namespace svxform return createPropertySetInfo( getInfoHelper() ); } - ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper() { return *getArrayHelper(); } - ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const { Sequence< Property > aProperties; @@ -139,25 +137,20 @@ namespace svxform return new ::cppu::OPropertyArrayHelper( aProperties ); } - - VclPtr<Dialog> OAddConditionDialog::createDialog(vcl::Window* _pParent) + svt::OGenericUnoDialog::Dialog OAddConditionDialog::createDialog(vcl::Window* _pParent) { if ( !m_xBinding.is() || m_sFacetName.isEmpty() ) throw RuntimeException( OUString(), *this ); - return VclPtr<AddConditionDialog>::Create( _pParent, m_sFacetName, m_xBinding ); + return svt::OGenericUnoDialog::Dialog(VclPtr<AddConditionDialog>::Create(_pParent, m_sFacetName, m_xBinding)); } - void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult ) { OAddConditionDialogBase::executedDialog( _nExecutionResult ); if ( _nExecutionResult == RET_OK ) - m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog.get() )->GetCondition(); + m_sConditionValue = static_cast< AddConditionDialog* >( m_aDialog.m_xVclDialog.get() )->GetCondition(); } - - } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/xfm_addcondition.hxx b/svx/source/inc/xfm_addcondition.hxx index d55e16bb8084..01f97fe8a064 100644 --- a/svx/source/inc/xfm_addcondition.hxx +++ b/svx/source/inc/xfm_addcondition.hxx @@ -56,7 +56,7 @@ namespace svxform virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; // OGenericUnoDialog overridables - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; + virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override; virtual void executedDialog(sal_Int16 _nExecutionResult) override; css::uno::Reference< css::beans::XPropertySet > |