cui/source/customize/macropg.cxx | 34 ++--- cui/source/customize/macropg_impl.hxx | 16 +- cui/source/options/optjava.cxx | 165 ++++++++++++--------------- cui/source/options/optjava.hxx | 82 ++++++------- cui/uiconfig/ui/assigncomponentdialog.ui | 14 +- cui/uiconfig/ui/javastartparametersdialog.ui | 48 ++++++- 6 files changed, 184 insertions(+), 175 deletions(-)
New commits: commit 10bf9023791dae0a11c96e0e8fd05ccee3bc304f Author: Caolán McNamara <[email protected]> Date: Wed May 16 15:42:05 2018 +0100 weld SvxJavaParameterDlg Change-Id: Ibcd19071aae42e07d9411d9c4ac4fbbb566aec45 Reviewed-on: https://gerrit.libreoffice.org/54441 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 36d33c6116f5..4d847ebaa9eb 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -111,7 +111,6 @@ public: SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptAdvancedPage", "cui/ui/optadvancedpage.ui", &rSet) - , m_pParamDlg(nullptr) , m_pPathDlg(nullptr) , m_aResetIdle("cui options SvxJavaOptionsPage Reset") , xDialogListener(new ::svt::DialogClosedListener()) @@ -184,7 +183,7 @@ SvxJavaOptionsPage::~SvxJavaOptionsPage() void SvxJavaOptionsPage::dispose() { m_pJavaList.disposeAndClear(); - m_pParamDlg.disposeAndClear(); + m_xParamDlg.reset(); m_pPathDlg.disposeAndClear(); ClearJavaInfo(); #if HAVE_FEATURE_JAVA @@ -265,27 +264,27 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void) { #if HAVE_FEATURE_JAVA std::vector< OUString > aParameterList; - if ( !m_pParamDlg ) + if (!m_xParamDlg) { - m_pParamDlg = VclPtr<SvxJavaParameterDlg>::Create( this ); + m_xParamDlg.reset(new SvxJavaParameterDlg(GetFrameWeld())); javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters ); if ( JFW_E_NONE == eErr && !m_parParameters.empty() ) { aParameterList = m_parParameters; - m_pParamDlg->SetParameters( aParameterList ); + m_xParamDlg->SetParameters( aParameterList ); } } else { - aParameterList = m_pParamDlg->GetParameters(); - m_pParamDlg->DisableButtons(); //disable add, edit and remove button when dialog is reopened + aParameterList = m_xParamDlg->GetParameters(); + m_xParamDlg->DisableButtons(); //disable add, edit and remove button when dialog is reopened } - if ( m_pParamDlg->Execute() == RET_OK ) + if (m_xParamDlg->execute() == RET_OK) { - if ( aParameterList != m_pParamDlg->GetParameters() ) + if ( aParameterList != m_xParamDlg->GetParameters() ) { - aParameterList = m_pParamDlg->GetParameters(); + aParameterList = m_xParamDlg->GetParameters(); if ( jfw_isVMRunning() ) { RequestRestart( svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS ); @@ -293,7 +292,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void) } } else - m_pParamDlg->SetParameters( aParameterList ); + m_xParamDlg->SetParameters( aParameterList ); #else (void) this; // Silence loplugin:staticmethods #endif @@ -596,9 +595,9 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ ) #if HAVE_FEATURE_JAVA javaFrameworkError eErr = JFW_E_NONE; - if ( m_pParamDlg ) + if (m_xParamDlg) { - eErr = jfw_setVMParameters( m_pParamDlg->GetParameters() ); + eErr = jfw_setVMParameters(m_xParamDlg->GetParameters()); SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters"); bModified = true; } @@ -698,101 +697,87 @@ void SvxJavaOptionsPage::FillUserData() // class SvxJavaParameterDlg --------------------------------------------- -SvxJavaParameterDlg::SvxJavaParameterDlg( vcl::Window* pParent ) : - - ModalDialog( pParent, "JavaStartParameters", - "cui/ui/javastartparametersdialog.ui" ) +SvxJavaParameterDlg::SvxJavaParameterDlg(weld::Window* pParent) + : GenericDialogController(pParent, "cui/ui/javastartparametersdialog.ui", + "JavaStartParameters") + , m_xParameterEdit(m_xBuilder->weld_entry("parameterfield")) + , m_xAssignBtn(m_xBuilder->weld_button("assignbtn")) + , m_xAssignedList(m_xBuilder->weld_tree_view("assignlist")) + , m_xRemoveBtn(m_xBuilder->weld_button("removebtn")) + , m_xEditBtn(m_xBuilder->weld_button("editbtn")) { - get( m_pParameterEdit, "parameterfield"); - get( m_pAssignBtn, "assignbtn"); - get( m_pAssignedList, "assignlist"); - m_pAssignedList->SetDropDownLineCount(6); - m_pAssignedList->set_width_request(m_pAssignedList->approximate_char_width() * 54); - get( m_pRemoveBtn, "removebtn"); - get( m_pEditBtn, "editbtn"); - - m_pParameterEdit->SetModifyHdl( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) ); - m_pAssignBtn->SetClickHdl( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) ); - m_pRemoveBtn->SetClickHdl( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) ); - m_pEditBtn->SetClickHdl( LINK( this, SvxJavaParameterDlg, EditHdl_Impl ) ); - m_pAssignedList->SetSelectHdl( LINK( this, SvxJavaParameterDlg, SelectHdl_Impl ) ); - m_pAssignedList->SetDoubleClickHdl( LINK( this, SvxJavaParameterDlg, DblClickHdl_Impl ) ); - - ModifyHdl_Impl( *m_pParameterEdit ); + m_xAssignedList->set_size_request(m_xAssignedList->get_approximate_digit_width() * 54, + m_xAssignedList->get_height_rows(6)); + m_xParameterEdit->connect_changed( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) ); + m_xAssignBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) ); + m_xRemoveBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) ); + m_xEditBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, EditHdl_Impl ) ); + m_xAssignedList->connect_changed( LINK( this, SvxJavaParameterDlg, SelectHdl_Impl ) ); + m_xAssignedList->connect_row_activated( LINK( this, SvxJavaParameterDlg, DblClickHdl_Impl ) ); + + ModifyHdl_Impl(*m_xParameterEdit); EnableEditButton(); EnableRemoveButton(); } SvxJavaParameterDlg::~SvxJavaParameterDlg() { - disposeOnce(); } -void SvxJavaParameterDlg::dispose() +IMPL_LINK_NOARG(SvxJavaParameterDlg, ModifyHdl_Impl, weld::Entry&, void) { - m_pParameterEdit.clear(); - m_pAssignBtn.clear(); - m_pAssignedList.clear(); - m_pRemoveBtn.clear(); - m_pEditBtn.clear(); - ModalDialog::dispose(); + OUString sParam = comphelper::string::strip(m_xParameterEdit->get_text(), ' '); + m_xAssignBtn->set_sensitive(!sParam.isEmpty()); } - -IMPL_LINK_NOARG(SvxJavaParameterDlg, ModifyHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxJavaParameterDlg, AssignHdl_Impl, weld::Button&, void) { - OUString sParam = comphelper::string::strip(m_pParameterEdit->GetText(), ' '); - m_pAssignBtn->Enable(!sParam.isEmpty()); -} - - -IMPL_LINK_NOARG(SvxJavaParameterDlg, AssignHdl_Impl, Button*, void) -{ - OUString sParam = comphelper::string::strip(m_pParameterEdit->GetText(), ' '); + OUString sParam = comphelper::string::strip(m_xParameterEdit->get_text(), ' '); if (!sParam.isEmpty()) { - sal_Int32 nPos = m_pAssignedList->GetEntryPos( sParam ); - if ( LISTBOX_ENTRY_NOTFOUND == nPos ) - nPos = m_pAssignedList->InsertEntry( sParam ); - m_pAssignedList->SelectEntryPos( nPos ); - m_pParameterEdit->SetText( OUString() ); - ModifyHdl_Impl( *m_pParameterEdit ); + int nPos = m_xAssignedList->find_text(sParam); + if (nPos == -1) + { + m_xAssignedList->append_text(sParam); + m_xAssignedList->select(m_xAssignedList->n_children() - 1); + } + else + m_xAssignedList->select(nPos); + m_xParameterEdit->set_text(OUString()); + ModifyHdl_Impl(*m_xParameterEdit); EnableEditButton(); EnableRemoveButton(); } } -IMPL_LINK_NOARG(SvxJavaParameterDlg, EditHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxJavaParameterDlg, EditHdl_Impl, weld::Button&, void) { EditParameter(); } - -IMPL_LINK_NOARG(SvxJavaParameterDlg, SelectHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxJavaParameterDlg, SelectHdl_Impl, weld::TreeView&, void) { EnableEditButton(); EnableRemoveButton(); } - -IMPL_LINK_NOARG(SvxJavaParameterDlg, DblClickHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxJavaParameterDlg, DblClickHdl_Impl, weld::TreeView&, void) { EditParameter(); } - -IMPL_LINK_NOARG(SvxJavaParameterDlg, RemoveHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxJavaParameterDlg, RemoveHdl_Impl, weld::Button&, void) { - sal_Int32 nPos = m_pAssignedList->GetSelectedEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + int nPos = m_xAssignedList->get_selected_index(); + if (nPos != -1) { - m_pAssignedList->RemoveEntry( nPos ); - sal_Int32 nCount = m_pAssignedList->GetEntryCount(); - if ( nCount ) + m_xAssignedList->remove(nPos); + int nCount = m_xAssignedList->n_children(); + if (nCount) { - if ( nPos >= nCount ) - nPos = ( nCount - 1 ); - m_pAssignedList->SelectEntryPos( nPos ); + if (nPos >= nCount) + nPos = nCount - 1; + m_xAssignedList->select(nPos); } else { @@ -804,13 +789,13 @@ IMPL_LINK_NOARG(SvxJavaParameterDlg, RemoveHdl_Impl, Button*, void) void SvxJavaParameterDlg::EditParameter() { - sal_Int32 nPos = m_pAssignedList->GetSelectedEntryPos(); - m_pParameterEdit->SetText( OUString() ); + int nPos = m_xAssignedList->get_selected_index(); + m_xParameterEdit->set_text(OUString()); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + if (nPos != -1) { - InputDialog aParamEditDlg(GetFrameWeld(), CuiResId(RID_SVXSTR_JAVA_START_PARAM)); - OUString editableClassPath = m_pAssignedList->GetSelectedEntry(); + InputDialog aParamEditDlg(m_xDialog.get(), CuiResId(RID_SVXSTR_JAVA_START_PARAM)); + OUString editableClassPath = m_xAssignedList->get_selected_text(); aParamEditDlg.SetEntryText(editableClassPath); aParamEditDlg.HideHelpBtn(); @@ -820,31 +805,29 @@ void SvxJavaParameterDlg::EditParameter() if ( !editedClassPath.isEmpty() && editableClassPath != editedClassPath ) { - m_pAssignedList->RemoveEntry( nPos ); - m_pAssignedList->InsertEntry( editedClassPath, nPos ); - m_pAssignedList->SelectEntryPos( nPos ); + m_xAssignedList->remove(nPos); + m_xAssignedList->insert_text(editedClassPath, nPos); + m_xAssignedList->select(nPos); } } } -short SvxJavaParameterDlg::Execute() +short SvxJavaParameterDlg::execute() { - m_pParameterEdit->GrabFocus(); - m_pAssignedList->SetNoSelection(); - return ModalDialog::Execute(); + m_xParameterEdit->grab_focus(); + m_xAssignedList->select(-1); + return m_xDialog->run(); } - std::vector< OUString > SvxJavaParameterDlg::GetParameters() const { - sal_Int32 nCount = m_pAssignedList->GetEntryCount(); + int nCount = m_xAssignedList->n_children(); std::vector< OUString > aParamList; - for ( sal_Int32 i = 0; i < nCount; ++i ) - aParamList.push_back( m_pAssignedList->GetEntry(i) ); + for (int i = 0; i < nCount; ++i) + aParamList.push_back(m_xAssignedList->get_text(i)); return aParamList; } - void SvxJavaParameterDlg::DisableButtons() { DisableAssignButton(); @@ -854,10 +837,10 @@ void SvxJavaParameterDlg::DisableButtons() void SvxJavaParameterDlg::SetParameters( std::vector< OUString > const & rParams ) { - m_pAssignedList->Clear(); + m_xAssignedList->clear(); for (auto const & sParam: rParams) { - m_pAssignedList->InsertEntry( sParam ); + m_xAssignedList->append_text(sParam); } DisableEditButton(); DisableRemoveButton(); diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index ebc6ed2be45b..96e2b89a58fc 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -63,7 +63,7 @@ private: VclPtr<PushButton> m_pClassPathBtn; VclPtr<PushButton> m_pExpertConfigBtn; - VclPtr<SvxJavaParameterDlg> m_pParamDlg; + std::unique_ptr<SvxJavaParameterDlg> m_xParamDlg; VclPtr<SvxJavaClassPathDlg> m_pPathDlg; VclPtr<OfaTreeOptionsDialog> m_pParentDlg; @@ -121,52 +121,52 @@ public: // class SvxJavaParameterDlg --------------------------------------------- -class SvxJavaParameterDlg : public ModalDialog +class SvxJavaParameterDlg : public weld::GenericDialogController { private: - VclPtr<Edit> m_pParameterEdit; - VclPtr<PushButton> m_pAssignBtn; - - VclPtr<ListBox> m_pAssignedList; - VclPtr<PushButton> m_pRemoveBtn; - - VclPtr<PushButton> m_pEditBtn; - - DECL_LINK(ModifyHdl_Impl, Edit&, void); - DECL_LINK(AssignHdl_Impl, Button*, void); - DECL_LINK(SelectHdl_Impl, ListBox&, void); - DECL_LINK(DblClickHdl_Impl, ListBox&, void); - DECL_LINK(RemoveHdl_Impl, Button*, void); - - DECL_LINK(EditHdl_Impl, Button*, void); - - void EnableRemoveButton() - { m_pRemoveBtn->Enable( - m_pAssignedList->GetSelectedEntryPos() - != LISTBOX_ENTRY_NOTFOUND ); } - - - void EnableEditButton() - { m_pEditBtn->Enable( - m_pAssignedList->GetSelectedEntryPos() - != LISTBOX_ENTRY_NOTFOUND ); } - - void DisableAssignButton() - { m_pAssignBtn->Disable(); } - - void DisableRemoveButton() - { m_pRemoveBtn->Disable(); } - - void DisableEditButton() - { m_pEditBtn->Disable(); } - + std::unique_ptr<weld::Entry> m_xParameterEdit; + std::unique_ptr<weld::Button> m_xAssignBtn; + std::unique_ptr<weld::TreeView> m_xAssignedList; + std::unique_ptr<weld::Button> m_xRemoveBtn; + std::unique_ptr<weld::Button> m_xEditBtn; + + DECL_LINK(ModifyHdl_Impl, weld::Entry&, void); + DECL_LINK(AssignHdl_Impl, weld::Button&, void); + DECL_LINK(SelectHdl_Impl, weld::TreeView&, void); + DECL_LINK(DblClickHdl_Impl, weld::TreeView&, void); + DECL_LINK(RemoveHdl_Impl, weld::Button&, void); + DECL_LINK(EditHdl_Impl, weld::Button&, void); + + void EnableRemoveButton() + { + m_xRemoveBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1); + } + + void EnableEditButton() + { + m_xEditBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1); + } + + void DisableAssignButton() + { + m_xAssignBtn->set_sensitive(false); + } + + void DisableRemoveButton() + { + m_xRemoveBtn->set_sensitive(false); + } + + void DisableEditButton() + { + m_xEditBtn->set_sensitive(false); + } public: - explicit SvxJavaParameterDlg( vcl::Window* pParent ); + explicit SvxJavaParameterDlg(weld::Window* pParent); virtual ~SvxJavaParameterDlg() override; - virtual void dispose() override; - virtual short Execute() override; + short execute(); std::vector< OUString > GetParameters() const; void SetParameters( std::vector< OUString > const & rParams ); diff --git a/cui/uiconfig/ui/javastartparametersdialog.ui b/cui/uiconfig/ui/javastartparametersdialog.ui index 0d17a03a2e35..14bdff1a45b9 100644 --- a/cui/uiconfig/ui/javastartparametersdialog.ui +++ b/cui/uiconfig/ui/javastartparametersdialog.ui @@ -1,12 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> + <object class="GtkListStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkDialog" id="JavaStartParameters"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="javastartparametersdialog|JavaStartParameters">Java Start Parameters</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -90,10 +104,10 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="javastartparametersdialog|label4">Java start _parameter</property> <property name="use_underline">True</property> <property name="mnemonic_widget">parameterfield</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -115,10 +129,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="javastartparametersdialog|label5">Assig_ned start parameters</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">assignlist:border</property> + <property name="mnemonic_widget">assignlist</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -126,21 +140,34 @@ </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="width_request">1</property> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTreeView" id="assignlist:border"> + <object class="GtkTreeView" id="assignlist"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection3"/> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> </child> </object> </child> @@ -154,8 +181,8 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="javastartparametersdialog|label6">For example: -Dmyprop=c:\\program files\\java</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -182,6 +209,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> <object class="GtkButton" id="editbtn"> <property name="label" translatable="yes" context="javastartparametersdialog|editbtn">_Edit</property> commit 6b703887165a89b5a9003a3925985ec92292884e Author: Caolán McNamara <[email protected]> Date: Wed May 16 15:12:48 2018 +0100 weld AssignComponentDialog Change-Id: I09fac24b81248bc27128d9142487301d4dc8ea6a Reviewed-on: https://gerrit.libreoffice.org/54440 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index ac57cdd86611..345438a23cb3 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -622,13 +622,13 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* ) ) { - ScopedVclPtrInstance< AssignComponentDialog > pAssignDlg( pThis, sEventURL ); + AssignComponentDialog aAssignDlg(pThis->GetFrameWeld(), sEventURL); - short ret = pAssignDlg->Execute(); + short ret = aAssignDlg.run(); if( ret ) { sEventType = "UNO"; - sEventURL = pAssignDlg->getURL(); + sEventURL = aAssignDlg.getURL(); if(!pThis->bAppEvents) pThis->bDocModified = true; } @@ -821,45 +821,37 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex)); } - -IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, Button*, void) +IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, weld::Button&, void) { - OUString aMethodName = mpMethodEdit->GetText(); + OUString aMethodName = mxMethodEdit->get_text(); maURL.clear(); if( !aMethodName.isEmpty() ) { maURL = aVndSunStarUNO; maURL += aMethodName; } - EndDialog(1); + m_xDialog->response(RET_OK); } -AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUString& rURL ) - : ModalDialog( pParent, "AssignComponent", "cui/ui/assigncomponentdialog.ui" ) +AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUString& rURL) + : GenericDialogController(pParent, "cui/ui/assigncomponentdialog.ui", "AssignComponent") , maURL( rURL ) + , mxMethodEdit(m_xBuilder->weld_entry("methodEntry")) + , mxOKButton(m_xBuilder->weld_button("ok")) { - get(mpMethodEdit, "methodEntry"); - get(mpOKButton, "ok"); - mpOKButton->SetClickHdl(LINK(this, AssignComponentDialog, ButtonHandler)); + mxOKButton->connect_clicked(LINK(this, AssignComponentDialog, ButtonHandler)); OUString aMethodName; if( maURL.startsWith( aVndSunStarUNO ) ) { aMethodName = maURL.copy( strlen(aVndSunStarUNO) ); } - mpMethodEdit->SetText( aMethodName, Selection( 0, SELECTION_MAX ) ); + mxMethodEdit->set_text(aMethodName); + mxMethodEdit->select_region(0, -1); } AssignComponentDialog::~AssignComponentDialog() { - disposeOnce(); -} - -void AssignComponentDialog::dispose() -{ - mpMethodEdit.clear(); - mpOKButton.clear(); - ModalDialog::dispose(); } IMPL_LINK_NOARG( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, void ) diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx index b3d9d3842bf0..61f7fe3ac73c 100644 --- a/cui/source/customize/macropg_impl.hxx +++ b/cui/source/customize/macropg_impl.hxx @@ -37,23 +37,21 @@ public: bool bIDEDialogMode; }; -class AssignComponentDialog : public ModalDialog +class AssignComponentDialog : public weld::GenericDialogController { private: - VclPtr<Edit> mpMethodEdit; - VclPtr<OKButton> mpOKButton; - OUString maURL; - DECL_LINK(ButtonHandler, Button*, void); + std::unique_ptr<weld::Entry> mxMethodEdit; + std::unique_ptr<weld::Button> mxOKButton; + + DECL_LINK(ButtonHandler, weld::Button&, void); public: - AssignComponentDialog( vcl::Window * pParent, const OUString& rURL ); + AssignComponentDialog(weld::Window* pParent, const OUString& rURL); virtual ~AssignComponentDialog() override; - virtual void dispose() override; - const OUString& getURL() const - { return maURL; } + const OUString& getURL() const { return maURL; } }; #endif diff --git a/cui/uiconfig/ui/assigncomponentdialog.ui b/cui/uiconfig/ui/assigncomponentdialog.ui index 5bf22b704a07..3f02c19ec996 100644 --- a/cui/uiconfig/ui/assigncomponentdialog.ui +++ b/cui/uiconfig/ui/assigncomponentdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="AssignComponent"> @@ -8,18 +8,24 @@ <property name="vexpand">True</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="assigncomponentdialog|AssignComponent">Assign Component</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="layout_style">start</property> + <property name="layout_style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> @@ -65,6 +71,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -101,6 +108,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="expand">False</property> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
