diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-02 12:15:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-03 09:50:45 +0200 |
commit | ea7b290a691f33caa3327bd1cb57b97a92c94dc7 (patch) | |
tree | 8c8ebddc42674caac4b9cdef431306cccc0618d8 /sw | |
parent | 2b402bbd34624c4759fa411c98bb60da1dd11e76 (diff) |
weld SwSvxNumBulletTabDialog
Change-Id: I8ea74dc15bba04c0615e61c069407160a7b95c4c
Reviewed-on: https://gerrit.libreoffice.org/61242
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/swdlgfact.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/num.cxx | 50 | ||||
-rw-r--r-- | sw/source/uibase/inc/num.hxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/txtnum.cxx | 6 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/bulletsandnumbering.ui | 193 |
7 files changed, 213 insertions, 59 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index da2486e48b71..6673fdef64ac 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -465,7 +465,7 @@ public: virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) = 0; virtual VclPtr<AbstractMultiTOXTabDialog> CreateMultiTOXTabDialog( diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 5e1c01acdacc..4ad47f91a41b 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1049,12 +1049,11 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(we return VclPtr<AbstractMultiTOXMarkDlg_Impl>::Create(o3tl::make_unique<SwMultiTOXMarkDlg>(pParent, rTOXMgr)); } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSvxNumBulletTabDialog(vcl::Window* pParent, +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwSvxNumBulletTabDialog>::Create(pParent, pSwItemSet, rWrtSh); - return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwSvxNumBulletTabDialog>(pParent, pSwItemSet, rWrtSh)); } VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateOutlineTabDialog(weld::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 2ad87e1986dc..208d423fc3c7 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -667,7 +667,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) override; virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) override; virtual VclPtr<AbstractMultiTOXTabDialog> CreateMultiTOXTabDialog( diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index be703641970b..35e763f326d6 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -876,63 +876,63 @@ void SwNumPositionTabPage::SetModified() } #endif -SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(vcl::Window* pParent, +SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rSh) - : SfxTabDialog(pParent, "BulletsAndNumberingDialog", - "modules/swriter/ui/bulletsandnumbering.ui", + : SfxTabDialogController(pParent, "modules/swriter/ui/bulletsandnumbering.ui", "BulletsAndNumberingDialog", pSwItemSet) , rWrtSh(rSh) + , m_xDummyCombo(m_xBuilder->weld_combo_box("dummycombo")) { - GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl)); - GetUserButton()->Enable(rWrtSh.GetNumRuleAtCurrCursorPos() != nullptr); - m_nSingleNumPageId = AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM ); - m_nBulletPageId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET ); + weld::Button* pButton = GetUserButton(); + pButton->connect_clicked(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl)); + pButton->set_sensitive(rWrtSh.GetNumRuleAtCurrCursorPos() != nullptr); + AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM ); + AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET ); AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM ); AddTabPage("graphics", RID_SVXPAGE_PICK_BMP ); - m_nOptionsPageId = AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS ); - m_nPositionPageId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION ); + AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS ); + AddTabPage("position", RID_SVXPAGE_NUM_POSITION ); } SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog() { } -void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) +void SwSvxNumBulletTabDialog::PageCreated(const OString& rPageId, SfxTabPage& rPage) { // set styles' names and metric OUString sNumCharFormat, sBulletCharFormat; SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat ); SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFormat ); - if (nPageId == m_nSingleNumPageId) + if (rPageId == "singlenum") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); rPage.PageCreated(aSet); } - else if (nPageId == m_nBulletPageId) + else if (rPageId == "bullets") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); rPage.PageCreated(aSet); } - else if (nPageId == m_nOptionsPageId) + else if (rPageId == "customize") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); // collect char styles - ScopedVclPtrInstance< ListBox > rCharFormatLB(this); - rCharFormatLB->Clear(); - rCharFormatLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + m_xDummyCombo->clear(); + m_xDummyCombo->append_text(SwViewShell::GetShellRes()->aStrNone); SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); + ::FillCharStyleListBox(*m_xDummyCombo, pDocShell); std::vector<OUString> aList; - aList.reserve(rCharFormatLB->GetEntryCount()); - for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back(rCharFormatLB->GetEntry(j)); + aList.reserve(m_xDummyCombo->get_count()); + for (sal_Int32 j = 0; j < m_xDummyCombo->get_count(); j++) + aList.push_back(m_xDummyCombo->get_text(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; @@ -940,7 +940,7 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) ); rPage.PageCreated(aSet); } - else if (nPageId == m_nPositionPageId) + else if (rPageId == "position") { SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); @@ -952,14 +952,14 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) short SwSvxNumBulletTabDialog::Ok() { - short nRet = SfxTabDialog::Ok(); - m_pExampleSet->ClearItem(SID_PARAM_NUM_PRESET); + short nRet = SfxTabDialogController::Ok(); + m_xExampleSet->ClearItem(SID_PARAM_NUM_PRESET); return nRet; } -IMPL_LINK_NOARG(SwSvxNumBulletTabDialog, RemoveNumberingHdl, Button*, void) +IMPL_LINK_NOARG(SwSvxNumBulletTabDialog, RemoveNumberingHdl, weld::Button&, void) { - EndDialog(RET_USER); + m_xDialog->response(RET_USER); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index b4aa9f79cdc4..5554cdf2f4a6 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -129,20 +129,18 @@ public: #endif }; -class SwSvxNumBulletTabDialog final : public SfxTabDialog +class SwSvxNumBulletTabDialog final : public SfxTabDialogController { SwWrtShell& rWrtSh; - sal_uInt16 m_nSingleNumPageId; - sal_uInt16 m_nBulletPageId; - sal_uInt16 m_nOptionsPageId; - sal_uInt16 m_nPositionPageId; virtual short Ok() override; - virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) override; - DECL_LINK(RemoveNumberingHdl, Button*, void); + virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; + DECL_LINK(RemoveNumberingHdl, weld::Button&, void); + + std::unique_ptr<weld::ComboBox> m_xDummyCombo; public: - SwSvxNumBulletTabDialog(vcl::Window* pParent, + SwSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); virtual ~SwSvxNumBulletTabDialog() override; diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 0fedafa0f7c3..daaab629bcd9 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -182,10 +182,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - vcl::Window *pParent = rReq.GetFrameWindow(); - if (!pParent) - pParent = GetView().GetWindow(); - + weld::Window *pParent = rReq.GetFrameWeld(); VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxNumBulletTabDialog(pParent, &aSet, GetShell())); const SfxStringItem* pPageItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1); if ( pPageItem ) @@ -234,6 +231,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) } else if (RET_USER == nResult) GetShell().DelNumRules(); + pDlg->disposeOnce(); }); } break; diff --git a/sw/uiconfig/swriter/ui/bulletsandnumbering.ui b/sw/uiconfig/swriter/ui/bulletsandnumbering.ui index b5434b3bf36b..05886850315a 100644 --- a/sw/uiconfig/swriter/ui/bulletsandnumbering.ui +++ b/sw/uiconfig/swriter/ui/bulletsandnumbering.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="BulletsAndNumberingDialog"> @@ -7,8 +7,12 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="bulletsandnumbering|BulletsAndNumberingDialog">Bullets and Numbering</property> <property name="resizable">False</property> + <property name="modal">True</property> <property name="window_position">mouse</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> @@ -19,14 +23,12 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="user"> + <property name="label" translatable="yes" context="bulletsandnumbering|user">_Remove</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> @@ -35,8 +37,8 @@ </packing> </child> <child> - <object class="GtkButton" id="user"> - <property name="label" translatable="yes" context="bulletsandnumbering|user">_Remove</property> + <object class="GtkButton" id="reset"> + <property name="label" translatable="yes" context="bulletsandnumbering|reset">Reset</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -49,10 +51,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -63,8 +67,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -74,20 +78,31 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label" translatable="yes" context="bulletsandnumbering|reset">Reset</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="position">4</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="dummycombo"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">5</property> </packing> </child> </object> @@ -113,6 +128,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -132,6 +171,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -155,6 +218,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">2</property> @@ -178,6 +265,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">3</property> @@ -201,6 +312,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">4</property> @@ -224,6 +359,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">5</property> @@ -250,11 +409,11 @@ </object> </child> <action-widgets> - <action-widget response="-5">ok</action-widget> <action-widget response="0">user</action-widget> + <action-widget response="0">reset</action-widget> + <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="0">reset</action-widget> </action-widgets> </object> </interface> |