diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-01 16:20:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-02 14:05:35 +0100 |
commit | 0887551123df339cb6e5a2fdad470963c6dc1229 (patch) | |
tree | 6092e6ceb2ef1a5f5ab6b5da6ff3bc20e2318dd6 /sw | |
parent | bb6f5dc046966b7295dc199ea07008098757f0ef (diff) |
weld SwInsertAbstractDlg
Change-Id: Ib3e9d0a7ff7e0fd3b0cf7bf492ca2bf59788fa2a
Reviewed-on: https://gerrit.libreoffice.org/68594
Tested-by: Jenkins
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/abstract.cxx | 21 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 15 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/abstract.hxx | 11 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/abstractdialog.ui | 26 |
7 files changed, 43 insertions, 44 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 0eac3d69da38..bba0b4be2359 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -369,7 +369,7 @@ public: virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0; - virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0; + virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) = 0; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0; virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream) = 0; diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx index 07818448f870..a10ca895c2c8 100644 --- a/sw/source/ui/dialog/abstract.cxx +++ b/sw/source/ui/dialog/abstract.cxx @@ -22,34 +22,25 @@ #include <abstract.hxx> -SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent) - : SfxModalDialog(pParent, "AbstractDialog", - "modules/swriter/ui/abstractdialog.ui") +SwInsertAbstractDlg::SwInsertAbstractDlg(weld::Window* pParent) + : SfxDialogController(pParent, "modules/swriter/ui/abstractdialog.ui", "AbstractDialog") + , m_xLevelNF(m_xBuilder->weld_spin_button("outlines")) + , m_xParaNF(m_xBuilder->weld_spin_button("paras")) { - get(m_pLevelNF, "outlines"); - get(m_pParaNF, "paras"); } SwInsertAbstractDlg::~SwInsertAbstractDlg() { - disposeOnce(); -} - -void SwInsertAbstractDlg::dispose() -{ - m_pLevelNF.clear(); - m_pParaNF.clear(); - SfxModalDialog::dispose(); } sal_uInt8 SwInsertAbstractDlg::GetLevel() const { - return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1); + return static_cast<sal_uInt8>(m_xLevelNF->get_value() - 1); } sal_uInt8 SwInsertAbstractDlg::GetPara() const { - return static_cast<sal_uInt8>(m_pParaNF->GetValue()); + return static_cast<sal_uInt8>(m_xParaNF->get_value()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 378850eec989..042136c460e1 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -96,7 +96,11 @@ short AbstractSwWordCountFloatDlg_Impl::Execute() return m_xDlg->run(); } -IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); +short AbstractSwInsertAbstractDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl); short SwAbstractSfxController_Impl::Execute() @@ -297,12 +301,12 @@ void AbstractApplyTabController_Impl::SetApplyHdl( const Link<LinkParamNone*,voi sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetLevel() const { - return pDlg->GetLevel(); + return m_xDlg->GetLevel(); } sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetPara() const { - return pDlg->GetPara(); + return m_xDlg->GetPara(); } const SfxItemSet* SwAbstractSfxDialog_Impl::GetOutputItemSet() const @@ -740,10 +744,9 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const return pDlg->GetRestartPage(); } -VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg() +VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(weld::Window* pParent) { - VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create(nullptr); - return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(pDlg); + return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(std::make_unique<SwInsertAbstractDlg>(pParent)); } VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAddressAbstractDlg(vcl::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index ee6e32ccb306..1e67b9b00189 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -89,7 +89,13 @@ public: class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg { - DECL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl,SwInsertAbstractDlg) + std::unique_ptr<SwInsertAbstractDlg> m_xDlg; +public: + explicit AbstractSwInsertAbstractDlg_Impl(std::unique_ptr<SwInsertAbstractDlg> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; virtual sal_uInt8 GetLevel() const override ; virtual sal_uInt8 GetPara() const override ; }; @@ -587,7 +593,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) override; - virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override; + virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) override; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream) override; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 5f4f72a7da8c..8a1d56fe7dfd 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -768,7 +768,7 @@ void SwDocShell::Execute(SfxRequest& rReq) case FN_ABSTRACT_NEWDOC: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg()); + ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg(GetView()->GetViewFrame()->GetWindow().GetFrameWeld())); if(RET_OK == pDlg->Execute()) { sal_uInt8 nLevel = pDlg->GetLevel(); diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx index 1fc899b2b604..6d6f6ba60d03 100644 --- a/sw/source/uibase/inc/abstract.hxx +++ b/sw/source/uibase/inc/abstract.hxx @@ -21,17 +21,14 @@ #include <sfx2/basedlgs.hxx> -#include <vcl/field.hxx> - -class SwInsertAbstractDlg : public SfxModalDialog +class SwInsertAbstractDlg : public SfxDialogController { - VclPtr<NumericField> m_pLevelNF; - VclPtr<NumericField> m_pParaNF; + std::unique_ptr<weld::SpinButton> m_xLevelNF; + std::unique_ptr<weld::SpinButton> m_xParaNF; public: - SwInsertAbstractDlg( vcl::Window* pParent ); + SwInsertAbstractDlg(weld::Window* pParent); virtual ~SwInsertAbstractDlg() override; - virtual void dispose() override; sal_uInt8 GetLevel() const; sal_uInt8 GetPara() const; diff --git a/sw/uiconfig/swriter/ui/abstractdialog.ui b/sw/uiconfig/swriter/ui/abstractdialog.ui index c332b6ee0fef..bdf26fda47c1 100644 --- a/sw/uiconfig/swriter/ui/abstractdialog.ui +++ b/sw/uiconfig/swriter/ui/abstractdialog.ui @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -19,7 +20,13 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="abstractdialog|AbstractDialog">Create AutoAbstract</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> @@ -71,6 +78,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -110,15 +118,14 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="abstractdialog|label2">Included outline levels</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">outlines</property> + <property name="xalign">0</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> @@ -126,15 +133,14 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="abstractdialog|label3">Paragraphs per level</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">paras</property> + <property name="xalign">0</property> </object> <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> <child> @@ -142,17 +148,17 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="abstractdialog|label4">The abstract contains the selected number of paragraphs from the included outline levels.</property> <property name="use_underline">True</property> <property name="wrap">True</property> + <property name="width_chars">52</property> <property name="max_width_chars">52</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> <property name="width">2</property> - <property name="height">1</property> </packing> </child> <child> @@ -165,8 +171,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -179,8 +183,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> |