support both vcl and weld in genericunodialog for interim

Change-Id: Ife85dd7a4bd27260514b390ca3928152db0d688f
Reviewed-on: https://gerrit.libreoffice.org/51699
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-03-21 10:33:23 +00:00
parent 718c82d1de
commit 12efe34abb
45 changed files with 228 additions and 185 deletions

View File

@@ -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, // 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... // 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); ::osl::MutexGuard aGuard(m_aMutex);
if (m_pDialog) if (m_aDialog)
destroyDialog(); destroyDialog();
} }
} }
@@ -67,9 +67,9 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
else else
ChartTypeUnoDlg_BASE::implInitialize(_rValue); 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() uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo()
{ {

View File

@@ -41,7 +41,7 @@ private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual void implInitialize(const css::uno::Any& _rValue) override; 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 // XTypeProvider
virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override; virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;

View File

@@ -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, // 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... // 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 ); ::osl::MutexGuard aGuard( m_aMutex );
if ( m_pDialog ) if (m_aDialog)
destroyDialog(); destroyDialog();
} }
} }
@@ -45,9 +45,9 @@ namespace dbmm
return *(new MacroMigrationDialogService( _rxContext ) ); 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() Sequence< sal_Int8 > SAL_CALL MacroMigrationDialogService::getImplementationId()

View File

@@ -87,7 +87,7 @@ namespace dbmm
virtual ~MacroMigrationDialogService() override; virtual ~MacroMigrationDialogService() override;
protected: protected:
virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
private: private:
Reference< XOfficeDatabaseDocument > m_xDocument; Reference< XOfficeDatabaseDocument > m_xDocument;

View File

@@ -70,7 +70,7 @@ private:
virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue) override; 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 // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
} // namespace dbaui } // namespace dbaui

View File

@@ -65,7 +65,7 @@ namespace dbaui
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
protected: protected:
// OGenericUnoDialog overridables // 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) OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XComponentContext >& _rxORB)
@@ -120,9 +120,10 @@ namespace dbaui
describeProperties(aProps); describeProperties(aProps);
return new ::cppu::OPropertyArrayHelper(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 } // namespace dbaui

View File

@@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo()
return new ::cppu::OPropertyArrayHelper(aProps); 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 } // namespace dbaui

View File

@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
} // namespace dbaui } // namespace dbaui

View File

@@ -104,16 +104,16 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo(
return new ::cppu::OPropertyArrayHelper(aProps); 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) void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
{ {
if ( _nExecutionResult == RET_OK ) 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_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
m_bStartTableWizard = pDialog->IsTableWizardToBeStarted(); m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
} }

View File

@@ -57,7 +57,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
private: private:
// OGenericUnoDialog overridables // 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; virtual void executedDialog(sal_Int16 _nExecutionResult) override;
}; };

View File

@@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo()
return new ::cppu::OPropertyArrayHelper(aProps); 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 } // namespace dbaui

View File

@@ -56,7 +56,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
} // namespace dbaui } // namespace dbaui

View File

@@ -91,9 +91,9 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
return new ::cppu::OPropertyArrayHelper(aProps); 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 } // namespace dbaui

View File

@@ -56,7 +56,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
} // namespace dbaui } // namespace dbaui

View File

@@ -91,7 +91,7 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI
return new ::cppu::OPropertyArrayHelper(aProps); 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); VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems, m_aContext);
@@ -99,7 +99,7 @@ VclPtr<Dialog> ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent)
if ( m_aInitialSelection.hasValue() ) if ( m_aInitialSelection.hasValue() )
pDialog->selectDataSource(m_aInitialSelection); pDialog->selectDataSource(m_aInitialSelection);
return pDialog; return svt::OGenericUnoDialog::Dialog(pDialog);
} }
} // namespace dbaui } // namespace dbaui

View File

@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
} // namespace dbaui } // namespace dbaui

View File

@@ -76,7 +76,7 @@ namespace dbaui
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ComposerDialog ) 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 // obtain all the objects needed for the dialog
Reference< XConnection > xConnection; Reference< XConnection > xConnection;
@@ -117,10 +117,12 @@ namespace dbaui
} }
if ( !xConnection.is() || !xColumns.is() || !m_xComposer.is() ) if ( !xConnection.is() || !xColumns.is() || !m_xComposer.is() )
{
// can't create the dialog if I have improper settings // 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 // RowsetFilterDialog
@@ -167,8 +169,8 @@ namespace dbaui
{ {
ComposerDialog::executedDialog( _nExecutionResult ); ComposerDialog::executedDialog( _nExecutionResult );
if ( _nExecutionResult && m_pDialog ) if ( _nExecutionResult && m_aDialog )
static_cast< DlgFilterCrit* >( m_pDialog.get() )->BuildWherePart(); static_cast< DlgFilterCrit* >( m_aDialog.m_xVclDialog.get() )->BuildWherePart();
} }
// RowsetOrderDialog // RowsetOrderDialog
@@ -211,13 +213,13 @@ namespace dbaui
{ {
ComposerDialog::executedDialog( _nExecutionResult ); ComposerDialog::executedDialog( _nExecutionResult );
if ( !m_pDialog ) if ( !m_aDialog )
return; return;
if ( _nExecutionResult ) if ( _nExecutionResult )
static_cast< DlgOrderCrit* >( m_pDialog.get() )->BuildOrderPart(); static_cast< DlgOrderCrit* >( m_aDialog.m_xVclDialog.get() )->BuildOrderPart();
else if ( m_xComposer.is() ) 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 } // namespace dbaui

View File

@@ -60,7 +60,7 @@ namespace dbaui
protected: protected:
// own overridables // own overridables
virtual VclPtr<Dialog> createComposerDialog( virtual VclPtr<::Dialog> createComposerDialog(
vcl::Window* _pParent, vcl::Window* _pParent,
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const css::uno::Reference< css::container::XNameAccess >& _rxColumns const css::uno::Reference< css::container::XNameAccess >& _rxColumns
@@ -68,7 +68,7 @@ namespace dbaui
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };
// RowsetFilterDialog // RowsetFilterDialog
@@ -89,7 +89,7 @@ namespace dbaui
protected: protected:
// own overridables // own overridables
virtual VclPtr<Dialog> createComposerDialog( virtual VclPtr<::Dialog> createComposerDialog(
vcl::Window* _pParent, vcl::Window* _pParent,
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const css::uno::Reference< css::container::XNameAccess >& _rxColumns const css::uno::Reference< css::container::XNameAccess >& _rxColumns
@@ -119,7 +119,7 @@ namespace dbaui
protected: protected:
// own overridables // own overridables
virtual VclPtr<Dialog> createComposerDialog( virtual VclPtr<::Dialog> createComposerDialog(
vcl::Window* _pParent, vcl::Window* _pParent,
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const css::uno::Reference< css::container::XNameAccess >& _rxColumns const css::uno::Reference< css::container::XNameAccess >& _rxColumns

View File

@@ -192,7 +192,7 @@ namespace dbaui
virtual ~CopyTableWizard() override; virtual ~CopyTableWizard() override;
// OGenericUnoDialog overridables // 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; virtual void executedDialog( sal_Int16 _nExecutionResult ) override;
private: private:
@@ -546,7 +546,7 @@ void SAL_CALL CopyTableWizard::setTitle( const OUString& _rTitle )
OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() 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 ) if ( !pWizard )
throw DisposedException( OUString(), *this ); throw DisposedException( OUString(), *this );
return *pWizard; return *pWizard;
@@ -1508,7 +1508,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
return new ::cppu::OPropertyArrayHelper( aProps ); 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!" ); OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" );
// this should have been prevented in ::execute already // this should have been prevented in ::execute already
@@ -1526,7 +1526,7 @@ VclPtr<Dialog> CopyTableWizard::createDialog( vcl::Window* _pParent )
impl_attributesToDialog_nothrow( *pWizard ); impl_attributesToDialog_nothrow( *pWizard );
return pWizard; return svt::OGenericUnoDialog::Dialog(pWizard);
} }
void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult ) void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult )

View File

@@ -105,7 +105,7 @@ namespace dbaui
protected: protected:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
using OTextConnectionSettingsDialog_BASE::getFastPropertyValue; using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
}; };
@@ -202,9 +202,9 @@ namespace dbaui
return new ::cppu::OPropertyArrayHelper( aProps ); 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 ) void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )

View File

@@ -77,7 +77,7 @@ namespace dbaui
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog ) 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 // obtain all the objects needed for the dialog
Reference< XConnection > xConnection = m_xActiveConnection; Reference< XConnection > xConnection = m_xActiveConnection;
@@ -95,11 +95,14 @@ namespace dbaui
} }
} }
if (!xConnection.is()) if (!xConnection.is())
{
// can't create the dialog if I have improper settings // 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) void ODirectSQLDialog::implInitialize(const Any& _rValue)
{ {
PropertyValue aProperty; PropertyValue aProperty;

View File

@@ -61,7 +61,7 @@ namespace dbaui
protected: protected:
// OGenericUnoDialog overridables // 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; virtual void implInitialize(const css::uno::Any& _rValue) override;
}; };

View File

@@ -51,10 +51,10 @@ ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XC
ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
{ {
if (m_pDialog) if (m_aDialog)
{ {
::osl::MutexGuard aGuard(m_aMutex); ::osl::MutexGuard aGuard(m_aMutex);
if (m_pDialog) if (m_aDialog)
{ {
destroyDialog(); destroyDialog();
ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults); ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);

View File

@@ -143,13 +143,13 @@ Reference<XPropertySetInfo> SAL_CALL OSQLMessageDialog::getPropertySetInfo()
return new ::cppu::OPropertyArrayHelper(aProps); return new ::cppu::OPropertyArrayHelper(aProps);
} }
VclPtr<Dialog> OSQLMessageDialog::createDialog(vcl::Window* _pParent) svt::OGenericUnoDialog::Dialog OSQLMessageDialog::createDialog(vcl::Window* _pParent)
{ {
if ( m_aException.hasValue() ) 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!"); 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 } // namespace dbaui

View File

@@ -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 ) 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; m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName;
} }
} }

View File

@@ -71,7 +71,7 @@ namespace abp
using svt::OGenericUnoDialog::execute; using svt::OGenericUnoDialog::execute;
// OGenericUnoDialog overridables // 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; virtual void executedDialog(sal_Int16 _nExecutionResult) override;
}; };

View File

@@ -104,9 +104,9 @@ namespace dbp
private: private:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override 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 virtual void implInitialize(const css::uno::Any& _rValue) override

View File

@@ -97,11 +97,10 @@ namespace pcr
return new ::cppu::OPropertyArrayHelper(aProps); return new ::cppu::OPropertyArrayHelper(aProps);
} }
svt::OGenericUnoDialog::Dialog MasterDetailLinkDialog::createDialog(vcl::Window* _pParent)
VclPtr<Dialog> MasterDetailLinkDialog::createDialog(vcl::Window* _pParent)
{ {
return VclPtr<FormLinkDialog>::Create(_pParent,m_xDetail,m_xMaster, m_aContext return svt::OGenericUnoDialog::Dialog(VclPtr<FormLinkDialog>::Create(_pParent,m_xDetail,m_xMaster, m_aContext
,m_sExplanation,m_sDetailLabel,m_sMasterLabel); ,m_sExplanation,m_sDetailLabel,m_sMasterLabel));
} }
void MasterDetailLinkDialog::implInitialize(const Any& _rValue) void MasterDetailLinkDialog::implInitialize(const Any& _rValue)

View File

@@ -58,7 +58,7 @@ namespace pcr
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
// OGenericUnoDialog overridables // 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; virtual void implInitialize(const css::uno::Any& _rValue) override;
css::uno::Reference< css::beans::XPropertySet> m_xDetail; css::uno::Reference< css::beans::XPropertySet> m_xDetail;

View File

@@ -53,10 +53,10 @@ namespace pcr
OControlFontDialog::~OControlFontDialog() OControlFontDialog::~OControlFontDialog()
{ {
if (m_pDialog) if (m_aDialog)
{ {
::osl::MutexGuard aGuard(m_aMutex); ::osl::MutexGuard aGuard(m_aMutex);
if (m_pDialog) if (m_aDialog)
{ {
destroyDialog(); destroyDialog();
ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
@@ -138,8 +138,7 @@ namespace pcr
return new ::cppu::OPropertyArrayHelper(aProps); return new ::cppu::OPropertyArrayHelper(aProps);
} }
svt::OGenericUnoDialog::Dialog OControlFontDialog::createDialog(vcl::Window* _pParent)
VclPtr<Dialog> OControlFontDialog::createDialog(vcl::Window* _pParent)
{ {
ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); 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 // 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. // 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) void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult)
{ {
OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!"); OSL_ENSURE(m_aDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!");
if (m_pDialog && (RET_OK == _nExecutionResult) && m_xControlModel.is()) 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) if (pOutput)
ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel ); ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel );
} }

View File

@@ -80,7 +80,7 @@ namespace pcr
protected: protected:
// OGenericUnoDialog overridables // 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; virtual void executedDialog(sal_Int16 _nExecutionResult) override;
}; };

View File

@@ -58,18 +58,16 @@ namespace pcr
&m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() ); &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() );
} }
OTabOrderDialog::~OTabOrderDialog() OTabOrderDialog::~OTabOrderDialog()
{ {
if ( m_pDialog ) if (m_aDialog)
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
if ( m_pDialog ) if (m_aDialog)
destroyDialog(); destroyDialog();
} }
} }
Sequence<sal_Int8> SAL_CALL OTabOrderDialog::getImplementationId( ) Sequence<sal_Int8> SAL_CALL OTabOrderDialog::getImplementationId( )
{ {
return css::uno::Sequence<sal_Int8>(); return css::uno::Sequence<sal_Int8>();
@@ -129,10 +127,9 @@ namespace pcr
return new ::cppu::OPropertyArrayHelper( aProps ); return new ::cppu::OPropertyArrayHelper( aProps );
} }
svt::OGenericUnoDialog::Dialog OTabOrderDialog::createDialog( vcl::Window* _pParent )
VclPtr<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 ) void OTabOrderDialog::initialize( const Sequence< Any >& aArguments )

View File

@@ -78,7 +78,7 @@ namespace pcr
protected: protected:
// OGenericUnoDialog overridables // OGenericUnoDialog overridables
virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; virtual svt::OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
}; };

View File

@@ -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()) if (mxSrcDoc.is())
{ {
@@ -146,14 +146,14 @@ VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent )
pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) ); pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) );
} }
return pRet; return svt::OGenericUnoDialog::Dialog(pRet);
} }
void SWFDialog::executedDialog( sal_Int16 nExecutionResult ) void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
{ {
if( nExecutionResult && m_pDialog ) if (nExecutionResult && m_aDialog)
maFilterData = static_cast< ImpSWFDialog* >( m_pDialog.get() )->GetFilterData(); maFilterData = static_cast< ImpSWFDialog* >(m_aDialog.m_xVclDialog.get())->GetFilterData();
destroyDialog(); destroyDialog();
} }

View File

@@ -50,7 +50,7 @@ private:
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
virtual OUString SAL_CALL getImplementationName() override; virtual OUString SAL_CALL getImplementationName() override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 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 void executedDialog( sal_Int16 nExecutionResult ) override;
virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;

View File

@@ -83,19 +83,17 @@ Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
return PDFDialog_getSupportedServiceNames(); return PDFDialog_getSupportedServiceNames();
} }
svt::OGenericUnoDialog::Dialog PDFDialog::createDialog( vcl::Window* pParent )
VclPtr<Dialog> PDFDialog::createDialog( vcl::Window* pParent )
{ {
if( mxSrcDoc.is() ) if( mxSrcDoc.is() )
return VclPtr<ImpPDFTabDialog>::Create( pParent, maFilterData, mxSrcDoc ); return svt::OGenericUnoDialog::Dialog(VclPtr<ImpPDFTabDialog>::Create(pParent, maFilterData, mxSrcDoc));
return VclPtr<Dialog>(); return svt::OGenericUnoDialog::Dialog(VclPtr<::Dialog>());
} }
void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
{ {
if( nExecutionResult && m_pDialog ) if (nExecutionResult && m_aDialog)
maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog.get() )->GetFilterData(); maFilterData = static_cast< ImpPDFTabDialog* >( m_aDialog.m_xVclDialog.get() )->GetFilterData();
destroyDialog(); destroyDialog();
} }

View File

@@ -43,7 +43,7 @@ private:
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
virtual OUString SAL_CALL getImplementationName() override; virtual OUString SAL_CALL getImplementationName() override;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() 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 void executedDialog( sal_Int16 nExecutionResult ) override;
virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;

View File

@@ -115,20 +115,18 @@ Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
return SVGDialog_getSupportedServiceNames(); return SVGDialog_getSupportedServiceNames();
} }
svt::OGenericUnoDialog::Dialog SVGDialog::createDialog( vcl::Window* pParent )
VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent )
{ {
if( mxSrcDoc.is() ) if( mxSrcDoc.is() )
return VclPtr<ImpSVGDialog>::Create( pParent, maFilterData ); return svt::OGenericUnoDialog::Dialog(VclPtr<ImpSVGDialog>::Create( pParent, maFilterData ));
else else
return VclPtr<Dialog>(); return svt::OGenericUnoDialog::Dialog(VclPtr<::Dialog>());
} }
void SVGDialog::executedDialog( sal_Int16 nExecutionResult ) void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
{ {
if( nExecutionResult && m_pDialog ) if (nExecutionResult && m_aDialog)
maFilterData = static_cast< ImpSVGDialog* >( m_pDialog.get() )->GetFilterData(); maFilterData = static_cast< ImpSVGDialog* >(m_aDialog.m_xVclDialog.get())->GetFilterData();
destroyDialog(); destroyDialog();
} }

View File

@@ -49,7 +49,7 @@ private:
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
virtual OUString SAL_CALL getImplementationName() override; virtual OUString SAL_CALL getImplementationName() override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 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 void executedDialog( sal_Int16 nExecutionResult ) override;
virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;

View File

@@ -38,10 +38,10 @@
#include <comphelper/propertycontainer.hxx> #include <comphelper/propertycontainer.hxx>
#include <comphelper/broadcasthelper.hxx> #include <comphelper/broadcasthelper.hxx>
#include <tools/link.hxx> #include <tools/link.hxx>
#include <vcl/dialog.hxx>
#include <vcl/vclptr.hxx> #include <vcl/vclptr.hxx>
#include <vcl/weld.hxx>
class Dialog;
namespace vcl { class Window; }
class VclWindowEvent; class VclWindowEvent;
@@ -55,7 +55,6 @@ namespace svt
#define UNODIALOG_PROPERTY_TITLE "Title" #define UNODIALOG_PROPERTY_TITLE "Title"
#define UNODIALOG_PROPERTY_PARENT "ParentWindow" #define UNODIALOG_PROPERTY_PARENT "ParentWindow"
typedef cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, typedef cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog,
css::lang::XServiceInfo, css::lang::XServiceInfo,
css::lang::XInitialization > OGenericUnoDialogBase; css::lang::XInitialization > OGenericUnoDialogBase;
@@ -67,8 +66,58 @@ namespace svt
,public ::comphelper::OMutexAndBroadcastHelper ,public ::comphelper::OMutexAndBroadcastHelper
,public ::comphelper::OPropertyContainer ,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: 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_bExecuting : 1; /// we're currently executing the dialog
bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet
bool m_bInitialized : 1; /// has "initialize" been called? 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). 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 @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 /// called to destroy the dialog used. deletes m_pDialog and resets it to NULL
void destroyDialog(); void destroyDialog();

View File

@@ -71,7 +71,7 @@ namespace {
protected: protected:
// OGenericUnoDialog overridables // 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; virtual void implInitialize(const css::uno::Any& _rValue) override;
@@ -132,8 +132,8 @@ namespace {
OGenericUnoDialog::executedDialog(_nExecutionResult); OGenericUnoDialog::executedDialog(_nExecutionResult);
if ( _nExecutionResult ) if ( _nExecutionResult )
if ( m_pDialog ) if ( m_aDialog )
static_cast< AddressBookSourceDialog* >( m_pDialog.get() )->getFieldMapping( m_aAliases ); static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases );
} }
void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) 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() ) 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 else
return VclPtr<AddressBookSourceDialog>::Create( _pParent, m_aContext ); return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext));
} }
} }

View File

@@ -47,7 +47,6 @@ namespace svt
OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxContext) OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxContext)
:OPropertyContainer(GetBroadcastHelper()) :OPropertyContainer(GetBroadcastHelper())
,m_pDialog(nullptr)
,m_bExecuting(false) ,m_bExecuting(false)
,m_bTitleAmbiguous(true) ,m_bTitleAmbiguous(true)
,m_bInitialized( false ) ,m_bInitialized( false )
@@ -63,11 +62,11 @@ OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxCo
OGenericUnoDialog::~OGenericUnoDialog() OGenericUnoDialog::~OGenericUnoDialog()
{ {
if ( m_pDialog ) if (m_aDialog)
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
if ( m_pDialog ) if (m_aDialog)
destroyDialog(); destroyDialog();
} }
} }
@@ -113,8 +112,8 @@ void OGenericUnoDialog::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, con
// from now on m_sTitle is valid // from now on m_sTitle is valid
m_bTitleAmbiguous = false; m_bTitleAmbiguous = false;
if (m_pDialog) if (m_aDialog)
m_pDialog->SetText(m_sTitle); m_aDialog.set_title(m_sTitle);
} }
} }
@@ -162,7 +161,7 @@ void SAL_CALL OGenericUnoDialog::setTitle( const OUString& _rTitle )
bool OGenericUnoDialog::impl_ensureDialog_lck() bool OGenericUnoDialog::impl_ensureDialog_lck()
{ {
if ( m_pDialog ) if (m_aDialog)
return true; return true;
// get the parameters for the dialog from the current settings // get the parameters for the dialog from the current settings
@@ -176,30 +175,32 @@ bool OGenericUnoDialog::impl_ensureDialog_lck()
// the title // the title
OUString sTitle = m_sTitle; OUString sTitle = m_sTitle;
VclPtr<Dialog> pDialog = createDialog( pParent ); OGenericUnoDialog::Dialog aDialog(createDialog(pParent));
OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" ); OSL_ENSURE(aDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!");
if ( !pDialog ) if (!aDialog)
return false; return false;
// do some initialisations // do some initialisations
if (!m_bTitleAmbiguous) if (!m_bTitleAmbiguous)
pDialog->SetText( sTitle ); aDialog.set_title(sTitle);
if (aDialog.m_xVclDialog)
{
// be notified when the dialog is killed by somebody else #i65958# // be notified when the dialog is killed by somebody else #i65958#
pDialog->AddEventListener( LINK( this, OGenericUnoDialog, OnDialogDying ) ); aDialog.m_xVclDialog->AddEventListener(LINK(this, OGenericUnoDialog, OnDialogDying));
}
m_pDialog = pDialog; m_aDialog = std::move(aDialog);
return true; 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 // both creation and execution of the dialog must be guarded with the SolarMutex, so be generous here
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
Dialog* pDialogToExecute = nullptr; ::Dialog* pVclDialogToExecute = nullptr;
// create the dialog, if necessary // create the dialog, if necessary
{ {
UnoDialogEntryGuard aGuard( *this ); UnoDialogEntryGuard aGuard( *this );
@@ -215,13 +216,15 @@ sal_Int16 SAL_CALL OGenericUnoDialog::execute( )
if ( !impl_ensureDialog_lck() ) if ( !impl_ensureDialog_lck() )
return 0; return 0;
pDialogToExecute = m_pDialog; pVclDialogToExecute = m_aDialog.m_xVclDialog;
} }
// start execution // start execution
sal_Int16 nReturn(0); sal_Int16 nReturn(0);
if ( pDialogToExecute ) if (pVclDialogToExecute)
nReturn = pDialogToExecute->Execute(); nReturn = pVclDialogToExecute->Execute();
else if (m_aDialog.m_xWeldDialog)
nReturn = m_aDialog.m_xWeldDialog->run();
{ {
::osl::MutexGuard aGuard(m_aMutex); ::osl::MutexGuard aGuard(m_aMutex);
@@ -275,15 +278,16 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments )
void OGenericUnoDialog::destroyDialog() void OGenericUnoDialog::destroyDialog()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
m_pDialog.disposeAndClear(); m_aDialog.m_xVclDialog.disposeAndClear();
m_aDialog.m_xWeldDialog.reset();
} }
IMPL_LINK( OGenericUnoDialog, OnDialogDying, VclWindowEvent&, _rEvent, void ) 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 ) if ( _rEvent.GetId() == VclEventId::ObjectDying )
m_pDialog = nullptr; m_aDialog.m_xVclDialog = nullptr;
} }

View File

@@ -130,7 +130,7 @@ namespace {
virtual ~Wizard() override; virtual ~Wizard() override;
protected: protected:
virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; virtual OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) override;
private: private:
css::uno::Sequence< css::uno::Sequence< sal_Int16 > > m_aWizardSteps; css::uno::Sequence< css::uno::Sequence< sal_Int16 > > m_aWizardSteps;
@@ -157,12 +157,12 @@ namespace {
Wizard::~Wizard() Wizard::~Wizard()
{ {
if ( m_pDialog ) if (m_aDialog)
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::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(); destroyDialog();
} }
} }
@@ -251,12 +251,12 @@ namespace {
return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); 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 ); VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps );
pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) ); pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) );
pDialog->setTitleBase( m_sTitle ); pDialog->setTitleBase( m_sTitle );
return pDialog.get(); return OGenericUnoDialog::Dialog(pDialog);
} }
OUString SAL_CALL Wizard::getImplementationName() OUString SAL_CALL Wizard::getImplementationName()
@@ -297,10 +297,10 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
if ( !m_pDialog ) if (!m_aDialog)
return m_sHelpURL; return m_sHelpURL;
return lcl_getHelpURL( m_pDialog->GetHelpId() ); return lcl_getHelpURL(m_aDialog.get_help_id());
} }
@@ -309,10 +309,10 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
if ( !m_pDialog ) if (!m_aDialog)
m_sHelpURL = i_HelpURL; m_sHelpURL = i_HelpURL;
else else
m_pDialog->SetHelpId( lcl_getHelpId( i_HelpURL ) ); m_aDialog.set_help_id(lcl_getHelpId(i_HelpURL));
} }
@@ -321,8 +321,8 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr ); ENSURE_OR_RETURN( m_aDialog.m_xVclDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr );
return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY ); return Reference< XWindow >( m_aDialog.m_xVclDialog->GetComponentInterface(), UNO_QUERY );
} }
@@ -331,7 +331,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
@@ -343,7 +343,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
@@ -355,7 +355,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
return pWizardImpl->travelNext(); return pWizardImpl->travelNext();
@@ -367,7 +367,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
return pWizardImpl->travelPrevious(); return pWizardImpl->travelPrevious();
@@ -379,7 +379,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
if ( !pWizardImpl->knowsPage( i_PageID ) ) if ( !pWizardImpl->knowsPage( i_PageID ) )
@@ -397,7 +397,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
pWizardImpl->updateTravelUI(); pWizardImpl->updateTravelUI();
@@ -409,7 +409,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
return pWizardImpl->advanceTo( i_PageId ); return pWizardImpl->advanceTo( i_PageId );
@@ -421,7 +421,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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!" ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
return pWizardImpl->goBackTo( i_PageId ); return pWizardImpl->goBackTo( i_PageId );
@@ -433,7 +433,7 @@ namespace {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex ); ::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 >() ); ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() );
return pWizardImpl->getCurrentWizardPage(); return pWizardImpl->getCurrentWizardPage();
@@ -448,7 +448,7 @@ namespace {
if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
throw NoSuchElementException( OUString(), *this ); 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!" ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
pWizardImpl->activatePath( i_PathIndex, i_Final ); pWizardImpl->activatePath( i_PathIndex, i_Final );

View File

@@ -125,13 +125,11 @@ namespace svxform
return createPropertySetInfo( getInfoHelper() ); return createPropertySetInfo( getInfoHelper() );
} }
::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper() ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
{ {
return *getArrayHelper(); return *getArrayHelper();
} }
::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
{ {
Sequence< Property > aProperties; Sequence< Property > aProperties;
@@ -139,25 +137,20 @@ namespace svxform
return new ::cppu::OPropertyArrayHelper( aProperties ); return new ::cppu::OPropertyArrayHelper( aProperties );
} }
svt::OGenericUnoDialog::Dialog OAddConditionDialog::createDialog(vcl::Window* _pParent)
VclPtr<Dialog> OAddConditionDialog::createDialog(vcl::Window* _pParent)
{ {
if ( !m_xBinding.is() || m_sFacetName.isEmpty() ) if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
throw RuntimeException( OUString(), *this ); 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 ) void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
{ {
OAddConditionDialogBase::executedDialog( _nExecutionResult ); OAddConditionDialogBase::executedDialog( _nExecutionResult );
if ( _nExecutionResult == RET_OK ) 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -56,7 +56,7 @@ namespace svxform
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
// OGenericUnoDialog overridables // 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; virtual void executedDialog(sal_Int16 _nExecutionResult) override;
css::uno::Reference< css::beans::XPropertySet > css::uno::Reference< css::beans::XPropertySet >