weld AddModelDialog
Change-Id: Ia12069f966c93ad7700b7a068dd7660284a40130 Reviewed-on: https://gerrit.libreoffice.org/54314 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:
@@ -1485,15 +1485,15 @@ namespace svxform
|
|||||||
OString sIdent(pBtn->GetCurItemIdent());
|
OString sIdent(pBtn->GetCurItemIdent());
|
||||||
if (sIdent == "modelsadd")
|
if (sIdent == "modelsadd")
|
||||||
{
|
{
|
||||||
ScopedVclPtrInstance< AddModelDialog > aDlg( this, false );
|
AddModelDialog aDlg(GetFrameWeld(), false);
|
||||||
bool bShowDialog = true;
|
bool bShowDialog = true;
|
||||||
while ( bShowDialog )
|
while ( bShowDialog )
|
||||||
{
|
{
|
||||||
bShowDialog = false;
|
bShowDialog = false;
|
||||||
if ( aDlg->Execute() == RET_OK )
|
if (aDlg.run() == RET_OK)
|
||||||
{
|
{
|
||||||
OUString sNewName = aDlg->GetName();
|
OUString sNewName = aDlg.GetName();
|
||||||
bool bDocumentData = aDlg->GetModifyDoc();
|
bool bDocumentData = aDlg.GetModifyDoc();
|
||||||
|
|
||||||
if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND )
|
if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND )
|
||||||
{
|
{
|
||||||
@@ -1531,8 +1531,8 @@ namespace svxform
|
|||||||
}
|
}
|
||||||
else if (sIdent == "modelsedit")
|
else if (sIdent == "modelsedit")
|
||||||
{
|
{
|
||||||
ScopedVclPtrInstance< AddModelDialog > aDlg( this, true );
|
AddModelDialog aDlg(GetFrameWeld(), true);
|
||||||
aDlg->SetName( sSelectedModel );
|
aDlg.SetName( sSelectedModel );
|
||||||
|
|
||||||
bool bDocumentData( false );
|
bool bDocumentData( false );
|
||||||
try
|
try
|
||||||
@@ -1548,13 +1548,13 @@ namespace svxform
|
|||||||
{
|
{
|
||||||
DBG_UNHANDLED_EXCEPTION("svx");
|
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
|
try
|
||||||
{
|
{
|
||||||
Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
|
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 ) )
|
if ( !sNewName.isEmpty() && ( sNewName != sSelectedModel ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -3317,26 +3317,18 @@ namespace svxform
|
|||||||
m_pRefBtn->Enable( m_xTempBinding.is() );
|
m_pRefBtn->Enable( m_xTempBinding.is() );
|
||||||
}
|
}
|
||||||
|
|
||||||
AddModelDialog::AddModelDialog(vcl::Window* pParent, bool bIsEdit)
|
AddModelDialog::AddModelDialog(weld::Window* pParent, bool bIsEdit)
|
||||||
: ModalDialog(pParent, "AddModelDialog", "svx/ui/addmodeldialog.ui")
|
: 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)
|
if (bIsEdit)
|
||||||
SetText(get<FixedText>("alttitle")->GetText());
|
m_xDialog->set_title(m_xAltTitle->get_label());
|
||||||
}
|
}
|
||||||
|
|
||||||
AddModelDialog::~AddModelDialog()
|
AddModelDialog::~AddModelDialog()
|
||||||
{
|
{
|
||||||
disposeOnce();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddModelDialog::dispose()
|
|
||||||
{
|
|
||||||
m_pNameED.clear();
|
|
||||||
m_pModifyCB.clear();
|
|
||||||
ModalDialog::dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddInstanceDialog::AddInstanceDialog(weld::Window* pParent, bool _bEdit)
|
AddInstanceDialog::AddInstanceDialog(weld::Window* pParent, bool _bEdit)
|
||||||
|
@@ -583,26 +583,24 @@ namespace svxform
|
|||||||
const css::uno::Reference< css::xforms::XSubmission >& GetNewSubmission() const { return m_xNewSubmission; }
|
const css::uno::Reference< css::xforms::XSubmission >& GetNewSubmission() const { return m_xNewSubmission; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AddModelDialog : public weld::GenericDialogController
|
||||||
class AddModelDialog : public ModalDialog
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
VclPtr<Edit> m_pNameED;
|
std::unique_ptr<weld::Entry> m_xNameED;
|
||||||
VclPtr<CheckBox> m_pModifyCB;
|
std::unique_ptr<weld::CheckButton> m_xModifyCB;
|
||||||
|
std::unique_ptr<weld::Label> m_xAltTitle;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddModelDialog( vcl::Window* pParent, bool _bEdit );
|
AddModelDialog(weld::Window* pParent, bool _bEdit);
|
||||||
virtual ~AddModelDialog() override;
|
virtual ~AddModelDialog() override;
|
||||||
virtual void dispose() override;
|
|
||||||
|
|
||||||
OUString GetName() const { return m_pNameED->GetText(); }
|
OUString GetName() const { return m_xNameED->get_text(); }
|
||||||
void SetName( const OUString& _rName ) { m_pNameED->SetText( _rName );}
|
void SetName( const OUString& _rName ) { m_xNameED->set_text( _rName );}
|
||||||
|
|
||||||
bool GetModifyDoc() const { return m_pModifyCB->IsChecked(); }
|
bool GetModifyDoc() const { return m_xModifyCB->get_active(); }
|
||||||
void SetModifyDoc( const bool bModify ) { m_pModifyCB->Check( bModify ); }
|
void SetModifyDoc( const bool bModify ) { m_xModifyCB->set_active(bModify); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AddInstanceDialog : public weld::GenericDialogController
|
class AddInstanceDialog : public weld::GenericDialogController
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface domain="svx">
|
<interface domain="svx">
|
||||||
<requires lib="gtk+" version="3.18"/>
|
<requires lib="gtk+" version="3.18"/>
|
||||||
<object class="GtkDialog" id="AddModelDialog">
|
<object class="GtkDialog" id="AddModelDialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="title" translatable="yes" context="addmodeldialog|AddModelDialog">Add Model</property>
|
<property name="title" translatable="yes" context="addmodeldialog|AddModelDialog">Add Model</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="default_width">0</property>
|
||||||
|
<property name="default_height">0</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox" id="dialog-vbox1">
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@@ -97,6 +103,7 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
|
<property name="activates_default">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
@@ -107,10 +114,10 @@
|
|||||||
<object class="GtkLabel" id="label2">
|
<object class="GtkLabel" id="label2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="addmodeldialog|label2">_Name:</property>
|
<property name="label" translatable="yes" context="addmodeldialog|label2">_Name:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="mnemonic_widget">name</property>
|
<property name="mnemonic_widget">name</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
|
Reference in New Issue
Block a user