diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 12:41:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 16:28:38 +0200 |
commit | 38fa68b90ae50d9bf25cf22fef36e030282b44a3 (patch) | |
tree | 9ef976d7d9cc121c9e90bf669169793b0211bfd7 /cui | |
parent | 76f30450577bcecf0423833884e3e5215decdd07 (diff) |
weld TitleDialog
Change-Id: I009da829e2b866844e67f976582e2a9d99bd22c0
Reviewed-on: https://gerrit.libreoffice.org/54316
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/cuigaldlg.cxx | 20 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 13 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 12 | ||||
-rw-r--r-- | cui/source/inc/cuigaldlg.hxx | 9 | ||||
-rw-r--r-- | cui/uiconfig/ui/gallerytitledialog.ui | 91 |
5 files changed, 75 insertions, 70 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 972dbc0f5399..1e39d5b1055b 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -491,28 +491,18 @@ IMPL_LINK( ActualizeProgress, ActualizeHdl, const INetURLObject&, rURL, void ) } -TitleDialog::TitleDialog(vcl::Window* pParent, const OUString& rOldTitle) - : ModalDialog(pParent, "GalleryTitleDialog", "cui/ui/gallerytitledialog.ui") +TitleDialog::TitleDialog(weld::Window* pParent, const OUString& rOldTitle) + : GenericDialogController(pParent, "cui/ui/gallerytitledialog.ui", "GalleryTitleDialog") + , m_xEdit(m_xBuilder->weld_entry("entry")) { - get(m_pEdit, "entry"); - m_pEdit->SetText( rOldTitle ); - m_pEdit->GrabFocus(); + m_xEdit->set_text(rOldTitle); + m_xEdit->grab_focus(); } - TitleDialog::~TitleDialog() { - disposeOnce(); -} - - -void TitleDialog::dispose() -{ - m_pEdit.clear(); - ModalDialog::dispose(); } - GalleryIdDialog::GalleryIdDialog( vcl::Window* pParent, GalleryTheme* _pThm ) : ModalDialog(pParent, "GalleryThemeIDDialog", "cui/ui/gallerythemeiddialog.ui") , pThm(_pThm ) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 0bf6ea154642..283bd1a651d1 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -111,7 +111,11 @@ short AbstractSvxZoomDialog_Impl::Execute() return m_xDlg->run(); } -IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl); +short AbstractTitleDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl); IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl); IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl); @@ -509,7 +513,7 @@ SfxBindings& AbstractSpellDialog_Impl::GetBindings() OUString AbstractTitleDialog_Impl::GetTitle() const { - return pDlg->GetTitle(); + return m_xDlg->GetTitle(); } sal_uInt32 AbstractGalleryIdDialog_Impl::GetId() const @@ -1074,11 +1078,10 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog( vcl::Window* pParent, +VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) { - VclPtrInstance<TitleDialog> pDlg( pParent, rOldText); - return VclPtr<AbstractTitleDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTitleDialog_Impl>::Create(new TitleDialog(pParent, rOldText)); } VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog( vcl::Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index e5be4de5f999..7d75a69b9d98 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -230,7 +230,14 @@ class AbstractSpellDialog_Impl : public AbstractSpellDialog class TitleDialog; class AbstractTitleDialog_Impl : public AbstractTitleDialog { - DECL_ABSTDLG_BASE(AbstractTitleDialog_Impl,TitleDialog) +protected: + std::unique_ptr<TitleDialog> m_xDlg; +public: + explicit AbstractTitleDialog_Impl(TitleDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual OUString GetTitle() const override ; }; @@ -666,8 +673,7 @@ public: svx::SpellDialogChildWindow* pSpellChildWindow ) override; virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm ) override; - virtual VclPtr<AbstractTitleDialog> CreateTitleDialog( vcl::Window* pParent, - const OUString& rOldText) override; + virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override; virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog( vcl::Window* pParent, GalleryTheme* pThm) override; virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx index e9c96b561b0a..c316fb6b7e95 100644 --- a/cui/source/inc/cuigaldlg.hxx +++ b/cui/source/inc/cuigaldlg.hxx @@ -168,15 +168,14 @@ public: virtual short Execute() override; }; -class TitleDialog : public ModalDialog +class TitleDialog : public weld::GenericDialogController { private: - VclPtr<Edit> m_pEdit; + std::unique_ptr<weld::Entry> m_xEdit; public: - TitleDialog(vcl::Window* pParent, const OUString& rOldText); + TitleDialog(weld::Window* pParent, const OUString& rOldText); virtual ~TitleDialog() override; - virtual void dispose() override; - OUString GetTitle() const { return m_pEdit->GetText(); } + OUString GetTitle() const { return m_xEdit->get_text(); } }; class GalleryIdDialog : public ModalDialog diff --git a/cui/uiconfig/ui/gallerytitledialog.ui b/cui/uiconfig/ui/gallerytitledialog.ui index 4ec04553f283..1352b8180ca7 100644 --- a/cui/uiconfig/ui/gallerytitledialog.ui +++ b/cui/uiconfig/ui/gallerytitledialog.ui @@ -1,58 +1,23 @@ <?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="GalleryTitleDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="gallerytitledialog|GalleryTitleDialog">Enter Title</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="orientation">vertical</property> <property name="spacing">12</property> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="gallerytitledialog|label2">Title:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="width_chars">32</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> @@ -110,6 +75,48 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="gallerytitledialog|label2">Title:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entry</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="activates_default">True</property> + <property name="width_chars">32</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> </object> </child> <action-widgets> |