summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-16 09:29:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-16 13:18:25 +0100
commitfc86c38e4424f1e098c4422ee28fb0f106ce8558 (patch)
tree7cbb199cf57ec050147ad75eeaca721354195389 /cui
parent04caeef4fdb84d792f967e661073c8ba81d931b2 (diff)
weld SvxObjectTitleDescDialog
Change-Id: Id08c201ee4377fe84618906725e7699d29dc1160 Reviewed-on: https://gerrit.libreoffice.org/51395 Tested-by: Jenkins <ci@libreoffice.org> 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/dlgname.cxx33
-rw-r--r--cui/source/factory/dlgfact.cxx13
-rw-r--r--cui/source/factory/dlgfact.hxx11
-rw-r--r--cui/source/inc/dlgname.hxx14
-rw-r--r--cui/uiconfig/ui/objecttitledescdialog.ui15
5 files changed, 43 insertions, 43 deletions
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 3e9eb3d0d78b..148c7374df95 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -79,37 +79,22 @@ IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, weld::Entry&, void)
// #i68101#
// Dialog for editing Object Title and Description
-SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(
- vcl::Window* pWindow,
- const OUString& rTitle,
- const OUString& rDescription) :
- ModalDialog ( pWindow, "ObjectTitleDescDialog", "cui/ui/objecttitledescdialog.ui" )
+SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle,
+ const OUString& rDescription)
+ : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
+ , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
+ , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
{
- get(pEdtTitle, "object_title_entry");
- get(pEdtDescription, "desc_entry");
//lock height to initial height
- pEdtDescription->set_height_request(pEdtDescription->get_preferred_size().Height());
+ m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5);
// set title & desc
- pEdtTitle->SetText(rTitle);
- pEdtDescription->SetText(rDescription);
+ m_xEdtTitle->set_text(rTitle);
+ m_xEdtDescription->set_text(rDescription);
// activate title
- pEdtTitle->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+ m_xEdtTitle->select_region(0, -1);
}
-SvxObjectTitleDescDialog::~SvxObjectTitleDescDialog()
-{
- disposeOnce();
-}
-
-void SvxObjectTitleDescDialog::dispose()
-{
- pEdtTitle.clear();
- pEdtDescription.clear();
- ModalDialog::dispose();
-}
-
-
/*************************************************************************
|*
|* dialog for cancelling, saving or adding
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 33abcf354fea..2683c93264b3 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -127,7 +127,10 @@ short AbstractSvxObjectNameDialog_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl);
+short AbstractSvxObjectTitleDescDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
IMPL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSvxPathSelectDialog_Impl);
@@ -621,12 +624,12 @@ IMPL_LINK_NOARG(AbstractSvxObjectNameDialog_Impl, CheckNameHdl, SvxObjectNameDia
void AbstractSvxObjectTitleDescDialog_Impl::GetTitle(OUString& rTitle)
{
- pDlg->GetTitle(rTitle);
+ rTitle = m_xDlg->GetTitle();
}
void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(OUString& rDescription)
{
- pDlg->GetDescription(rDescription);
+ rDescription = m_xDlg->GetDescription();
}
OUString AbstractSvxMultiPathDialog_Impl::GetPath() const
@@ -1112,9 +1115,9 @@ VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectN
return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(new SvxObjectNameDialog(pParent, rName));
}
-VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription)
+VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription)
{
- return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(VclPtr<SvxObjectTitleDescDialog>::Create(nullptr, rTitle, rDescription));
+ return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription));
}
VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(vcl::Window* pParent)
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index e21a3d895d1c..b0c22bb2f0b5 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -344,7 +344,14 @@ private:
class AbstractSvxObjectTitleDescDialog_Impl :public AbstractSvxObjectTitleDescDialog
{
- DECL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl, SvxObjectTitleDescDialog)
+protected:
+ std::unique_ptr<SvxObjectTitleDescDialog> m_xDlg;
+public:
+ explicit AbstractSvxObjectTitleDescDialog_Impl(SvxObjectTitleDescDialog* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
virtual void GetTitle(OUString& rName) override;
virtual void GetDescription(OUString& rName) override;
};
@@ -574,7 +581,7 @@ public:
const OUString& rName, const OUString& rDesc) override;
// #i68101#
virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) override;
- virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription) override;
+ virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(vcl::Window* pParent) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(vcl::Window* pParent) override;
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index 73f66be6854b..bed7fa68b850 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -102,23 +102,21 @@ public:
/** #i68101#
Dialog for editing Object Title and Description */
-class SvxObjectTitleDescDialog : public ModalDialog
+class SvxObjectTitleDescDialog : public weld::GenericDialogController
{
private:
// title
- VclPtr<Edit> pEdtTitle;
+ std::unique_ptr<weld::Entry> m_xEdtTitle;
// description
- VclPtr<VclMultiLineEdit> pEdtDescription;
+ std::unique_ptr<weld::TextView> m_xEdtDescription;
public:
// constructor
- SvxObjectTitleDescDialog(vcl::Window* pWindow, const OUString& rTitle, const OUString& rDesc);
- virtual ~SvxObjectTitleDescDialog() override;
- virtual void dispose() override;
+ SvxObjectTitleDescDialog(weld::Window* pWindow, const OUString& rTitle, const OUString& rDesc);
// data access
- void GetTitle(OUString& rTitle) {rTitle = pEdtTitle->GetText(); }
- void GetDescription(OUString& rDescription) {rDescription = pEdtDescription->GetText(); }
+ OUString GetTitle() const { return m_xEdtTitle->get_text(); }
+ OUString GetDescription() const { return m_xEdtDescription->get_text(); }
};
enum class SvxMessDialogButton {
diff --git a/cui/uiconfig/ui/objecttitledescdialog.ui b/cui/uiconfig/ui/objecttitledescdialog.ui
index 94f63b591fa2..0c08dcec8370 100644
--- a/cui/uiconfig/ui/objecttitledescdialog.ui
+++ b/cui/uiconfig/ui/objecttitledescdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkTextBuffer" id="textbuffer1">
@@ -13,6 +13,9 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="objecttitledescdialog|ObjectTitleDescDialog">Description</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox5">
@@ -86,10 +89,10 @@
<object class="GtkLabel" id="object_title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="objecttitledescdialog|object_title_label">_Title:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">object_title_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -102,6 +105,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
<property name="width_chars">55</property>
</object>
<packing>
@@ -114,9 +118,9 @@
<object class="GtkLabel" id="desc_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="objecttitledescdialog|desc_label">_Description:</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -130,7 +134,7 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="desc_entry:border">
+ <object class="GtkTextView" id="desc_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
@@ -158,5 +162,8 @@
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>