diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 7d97015284b4..2446606e373d 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1485,15 +1485,15 @@ namespace svxform OString sIdent(pBtn->GetCurItemIdent()); if (sIdent == "modelsadd") { - ScopedVclPtrInstance< AddModelDialog > aDlg( this, false ); + AddModelDialog aDlg(GetFrameWeld(), false); bool bShowDialog = true; while ( bShowDialog ) { bShowDialog = false; - if ( aDlg->Execute() == RET_OK ) + if (aDlg.run() == RET_OK) { - OUString sNewName = aDlg->GetName(); - bool bDocumentData = aDlg->GetModifyDoc(); + OUString sNewName = aDlg.GetName(); + bool bDocumentData = aDlg.GetModifyDoc(); if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND ) { @@ -1531,8 +1531,8 @@ namespace svxform } else if (sIdent == "modelsedit") { - ScopedVclPtrInstance< AddModelDialog > aDlg( this, true ); - aDlg->SetName( sSelectedModel ); + AddModelDialog aDlg(GetFrameWeld(), true); + aDlg.SetName( sSelectedModel ); bool bDocumentData( false ); try @@ -1548,13 +1548,13 @@ namespace svxform { DBG_UNHANDLED_EXCEPTION("svx"); } - aDlg->SetModifyDoc( bDocumentData ); + aDlg.SetModifyDoc( bDocumentData ); - if ( aDlg->Execute() == RET_OK ) + if (aDlg.run() == RET_OK) { - if ( aDlg->GetModifyDoc() != bDocumentData ) + if ( aDlg.GetModifyDoc() != bDocumentData ) { - bDocumentData = aDlg->GetModifyDoc(); + bDocumentData = aDlg.GetModifyDoc(); try { Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW ); @@ -1569,7 +1569,7 @@ namespace svxform } } - OUString sNewName = aDlg->GetName(); + OUString sNewName = aDlg.GetName(); if ( !sNewName.isEmpty() && ( sNewName != sSelectedModel ) ) { try @@ -3317,26 +3317,18 @@ namespace svxform m_pRefBtn->Enable( m_xTempBinding.is() ); } - AddModelDialog::AddModelDialog(vcl::Window* pParent, bool bIsEdit) - : ModalDialog(pParent, "AddModelDialog", "svx/ui/addmodeldialog.ui") + AddModelDialog::AddModelDialog(weld::Window* pParent, bool bIsEdit) + : GenericDialogController(pParent, "svx/ui/addmodeldialog.ui", "AddModelDialog") + , m_xNameED(m_xBuilder->weld_entry("name")) + , m_xModifyCB(m_xBuilder->weld_check_button("modify")) + , m_xAltTitle(m_xBuilder->weld_label("alttitle")) { - get(m_pNameED, "name"); - get(m_pModifyCB, "modify"); - if (bIsEdit) - SetText(get("alttitle")->GetText()); + m_xDialog->set_title(m_xAltTitle->get_label()); } AddModelDialog::~AddModelDialog() { - disposeOnce(); - } - - void AddModelDialog::dispose() - { - m_pNameED.clear(); - m_pModifyCB.clear(); - ModalDialog::dispose(); } AddInstanceDialog::AddInstanceDialog(weld::Window* pParent, bool _bEdit) diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx index cc66523361aa..786d4f767d81 100644 --- a/svx/source/inc/datanavi.hxx +++ b/svx/source/inc/datanavi.hxx @@ -583,26 +583,24 @@ namespace svxform const css::uno::Reference< css::xforms::XSubmission >& GetNewSubmission() const { return m_xNewSubmission; } }; - - class AddModelDialog : public ModalDialog + class AddModelDialog : public weld::GenericDialogController { private: - VclPtr m_pNameED; - VclPtr m_pModifyCB; + std::unique_ptr m_xNameED; + std::unique_ptr m_xModifyCB; + std::unique_ptr m_xAltTitle; public: - AddModelDialog( vcl::Window* pParent, bool _bEdit ); + AddModelDialog(weld::Window* pParent, bool _bEdit); virtual ~AddModelDialog() override; - virtual void dispose() override; - OUString GetName() const { return m_pNameED->GetText(); } - void SetName( const OUString& _rName ) { m_pNameED->SetText( _rName );} + OUString GetName() const { return m_xNameED->get_text(); } + void SetName( const OUString& _rName ) { m_xNameED->set_text( _rName );} - bool GetModifyDoc() const { return m_pModifyCB->IsChecked(); } - void SetModifyDoc( const bool bModify ) { m_pModifyCB->Check( bModify ); } + bool GetModifyDoc() const { return m_xModifyCB->get_active(); } + void SetModifyDoc( const bool bModify ) { m_xModifyCB->set_active(bModify); } }; - class AddInstanceDialog : public weld::GenericDialogController { private: diff --git a/svx/uiconfig/ui/addmodeldialog.ui b/svx/uiconfig/ui/addmodeldialog.ui index 73fd66811171..a03647704edf 100644 --- a/svx/uiconfig/ui/addmodeldialog.ui +++ b/svx/uiconfig/ui/addmodeldialog.ui @@ -1,12 +1,18 @@ - + False 6 Add Model + True + 0 + 0 dialog + + + False @@ -97,6 +103,7 @@ True True True + True 1 @@ -107,10 +114,10 @@ True False - 0 _Name: True name + 0 0