diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-16 09:29:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-16 13:18:25 +0100 |
commit | fc86c38e4424f1e098c4422ee28fb0f106ce8558 (patch) | |
tree | 7cbb199cf57ec050147ad75eeaca721354195389 /cui/source | |
parent | 04caeef4fdb84d792f967e661073c8ba81d931b2 (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/source')
-rw-r--r-- | cui/source/dialogs/dlgname.cxx | 33 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 13 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 11 | ||||
-rw-r--r-- | cui/source/inc/dlgname.hxx | 14 |
4 files changed, 32 insertions, 39 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 { |