diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-18 09:58:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-18 15:08:37 +0200 |
commit | 9c6a4d1f542ad687e72037ac55547241f519097b (patch) | |
tree | c255adc53b51efb895c8569691ef065bd103843d /sw | |
parent | de09774238831ad43ec6e7ec7778db4d6a88fe3e (diff) |
weld SwMailMergeCreateFromDlg
Change-Id: I9885881bfc6baffe1184d52c207d8f5d81a4a3b4
Reviewed-on: https://gerrit.libreoffice.org/61919
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 13 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 11 | ||||
-rw-r--r-- | sw/source/ui/envelp/mailmrge.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/inc/mailmrge.hxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 4 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/mailmergedialog.ui | 14 |
7 files changed, 35 insertions, 32 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index fdd6a431544f..ea8a27fdfcae 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -459,7 +459,7 @@ public: const OUString& rTableName, sal_Int32 nCommandType, const css::uno::Reference< css::sdbc::XConnection>& xConnection ) = 0; - virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(vcl::Window* pParent) = 0; + virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(weld::Window* pParent) = 0; virtual VclPtr<AbstractMailMergeFieldConnectionsDlg> CreateMailMergeFieldConnectionsDlg(weld::Window* pParent) = 0; virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 6dca63b32f43..963343952275 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -213,7 +213,11 @@ short AbstractJavaEditDialog_Impl::Execute() } IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl); + +short AbstractMailMergeCreateFromDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractMailMergeFieldConnectionsDlg_Impl::Execute() { @@ -637,7 +641,7 @@ OUString AbstractMailMergeDlg_Impl::GetTargetURL() const bool AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const { - return pDlg->IsThisDocument(); + return m_xDlg->IsThisDocument(); } bool AbstractMailMergeFieldConnectionsDlg_Impl::IsUseExistingConnections() const @@ -1039,10 +1043,9 @@ VclPtr<AbstractMailMergeDlg> SwAbstractDialogFactory_Impl::CreateMailMergeDlg( return VclPtr<AbstractMailMergeDlg_Impl>::Create( pDlg ); } -VclPtr<AbstractMailMergeCreateFromDlg> SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(vcl::Window* pParent) +VclPtr<AbstractMailMergeCreateFromDlg> SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(weld::Window* pParent) { - VclPtr<SwMailMergeCreateFromDlg> pDlg = VclPtr<SwMailMergeCreateFromDlg>::Create(pParent); - return VclPtr<AbstractMailMergeCreateFromDlg_Impl>::Create(pDlg); + return VclPtr<AbstractMailMergeCreateFromDlg_Impl>::Create(o3tl::make_unique<SwMailMergeCreateFromDlg>(pParent)); } VclPtr<AbstractMailMergeFieldConnectionsDlg> SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg(weld::Window* pParent) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 07953242d358..993d0aa7cb8f 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -501,7 +501,14 @@ class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg class SwMailMergeCreateFromDlg; class AbstractMailMergeCreateFromDlg_Impl : public AbstractMailMergeCreateFromDlg { - DECL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl,SwMailMergeCreateFromDlg) +protected: + std::unique_ptr<SwMailMergeCreateFromDlg> m_xDlg; +public: + explicit AbstractMailMergeCreateFromDlg_Impl(std::unique_ptr<SwMailMergeCreateFromDlg> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; virtual bool IsThisDocument() const override ; }; @@ -676,7 +683,7 @@ public: const OUString& rTableName, sal_Int32 nCommandType, const css::uno::Reference< css::sdbc::XConnection>& xConnection ) override; - virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(vcl::Window* pParent) override; + virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(weld::Window* pParent) override; virtual VclPtr<AbstractMailMergeFieldConnectionsDlg> CreateMailMergeFieldConnectionsDlg(weld::Window* pParent) override; virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) override; virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 9bcd53d6c206..f896e3b52f73 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -616,22 +616,14 @@ uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const return xResSetClone; } -SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent) - : ModalDialog(pParent, "MailMergeDialog", - "modules/swriter/ui/mailmergedialog.ui") +SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(weld::Window* pParent) + : GenericDialogController(pParent, "modules/swriter/ui/mailmergedialog.ui", "MailMergeDialog") + , m_xThisDocRB(m_xBuilder->weld_radio_button("document")) { - get(m_pThisDocRB, "document"); } SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg() { - disposeOnce(); -} - -void SwMailMergeCreateFromDlg::dispose() -{ - m_pThisDocRB.clear(); - ModalDialog::dispose(); } SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(weld::Window* pParent) diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx index 23f51e363d8d..cbb9a9465936 100644 --- a/sw/source/uibase/inc/mailmrge.hxx +++ b/sw/source/uibase/inc/mailmrge.hxx @@ -139,16 +139,15 @@ public: }; -class SwMailMergeCreateFromDlg : public ModalDialog +class SwMailMergeCreateFromDlg : public weld::GenericDialogController { - VclPtr<RadioButton> m_pThisDocRB; + std::unique_ptr<weld::RadioButton> m_xThisDocRB; public: - SwMailMergeCreateFromDlg(vcl::Window* pParent); + SwMailMergeCreateFromDlg(weld::Window* pParent); virtual ~SwMailMergeCreateFromDlg() override; - virtual void dispose() override; bool IsThisDocument() const { - return m_pThisDocRB->IsChecked(); + return m_xThisDocRB->get_active(); } }; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 93bc535e9b31..f54eb93a897a 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1116,8 +1116,8 @@ void SwView::Execute(SfxRequest &rReq) { SfxViewFrame* pTmpFrame = GetViewFrame(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractMailMergeCreateFromDlg> pDlg( pFact->CreateMailMergeCreateFromDlg(&pTmpFrame->GetWindow()) ); - if(RET_OK == pDlg->Execute()) + ScopedVclPtr<AbstractMailMergeCreateFromDlg> pDlg(pFact->CreateMailMergeCreateFromDlg(pTmpFrame->GetWindow().GetFrameWeld())); + if (RET_OK == pDlg->Execute()) bUseCurrentDocument = pDlg->IsThisDocument(); else break; diff --git a/sw/uiconfig/swriter/ui/mailmergedialog.ui b/sw/uiconfig/swriter/ui/mailmergedialog.ui index 4120cb8b4620..dfef7d97303e 100644 --- a/sw/uiconfig/swriter/ui/mailmergedialog.ui +++ b/sw/uiconfig/swriter/ui/mailmergedialog.ui @@ -1,11 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="MailMergeDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="mailmergedialog|MailMergeDialog">Mail Merge</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> @@ -98,13 +105,10 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">template</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -121,8 +125,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> |