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/source | |
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/source')
-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 |
5 files changed, 36 insertions, 41 deletions
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; |