diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-20 11:18:47 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-20 14:22:32 +0100 |
commit | 9f5cf96bd8b0d33a4505e941025f93af776159a9 (patch) | |
tree | 191b7c02828ff72d45dafe4b49980f09f0762036 /sw/source | |
parent | bfa7db29bd5077c4c8be6ccd9dfd80f974c1e148 (diff) |
weld SwFieldEditDlg
Change-Id: I786944a4bf8979526f0ccae5b00fb42ad5016a66
Reviewed-on: https://gerrit.libreoffice.org/69463
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/chrdlg/drpcps.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/tblnumfm.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/config/mailconfigpage.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/config/optload.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/addrdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldedt.cxx | 82 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/pattern.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/uiborder.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/wrap.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/fldedt.hxx | 17 |
12 files changed, 57 insertions, 67 deletions
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index da6500ddd642..55b159b3ca2b 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -449,7 +449,7 @@ void SwDropCapsPict::InitPrinter_() } SwDropCapsDlg::SwDropCapsDlg(weld::Window *pParent, const SfxItemSet &rSet) - : SfxSingleTabDialogController(pParent, rSet) + : SfxSingleTabDialogController(pParent, &rSet) { TabPageParent pPageParent(get_content_area(), this); VclPtr<SwDropCapsPage> xNewPage(static_cast<SwDropCapsPage*>(SwDropCapsPage::Create(pPageParent, &rSet).get())); diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx index 4ac2af9e7883..e6722617176e 100644 --- a/sw/source/ui/chrdlg/tblnumfm.cxx +++ b/sw/source/ui/chrdlg/tblnumfm.cxx @@ -28,7 +28,7 @@ #include <sfx2/tabdlg.hxx> SwNumFormatDlg::SwNumFormatDlg(weld::Widget* pParent, const SfxItemSet& rSet) - : SfxSingleTabDialogController(pParent, rSet, "cui/ui/formatnumberdialog.ui", "FormatNumberDialog") + : SfxSingleTabDialogController(pParent, &rSet, "cui/ui/formatnumberdialog.ui", "FormatNumberDialog") { // Create TabPage SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 7b1131fbfc5c..f0656f6ad481 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -363,7 +363,7 @@ void SwTestAccountSettingsDialog::Test() } SwMailConfigDlg::SwMailConfigDlg(weld::Window* pParent, SfxItemSet& rSet) - : SfxSingleTabDialogController(pParent, rSet) + : SfxSingleTabDialogController(pParent, &rSet) { TabPageParent pPageParent(get_content_area(), this); // create TabPage diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 7844dc95b3aa..97833bf3d64b 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -394,7 +394,7 @@ IMPL_LINK_NOARG(SwLoadOptPage, MetricHdl, ListBox&, void) } SwCaptionOptDlg::SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet) - : SfxSingleTabDialogController(pParent, rSet, "modules/swriter/ui/captiondialog.ui", + : SfxSingleTabDialogController(pParent, &rSet, "modules/swriter/ui/captiondialog.ui", "CaptionDialog") { // create TabPage diff --git a/sw/source/ui/dialog/addrdlg.cxx b/sw/source/ui/dialog/addrdlg.cxx index 81ea6d9d0806..940f7f5d2646 100644 --- a/sw/source/ui/dialog/addrdlg.cxx +++ b/sw/source/ui/dialog/addrdlg.cxx @@ -22,7 +22,7 @@ #include <svx/svxdlg.hxx> SwAddrDlg::SwAddrDlg(weld::Window* pParent, const SfxItemSet& rSet) - : SfxSingleTabDialogController(pParent, rSet) + : SfxSingleTabDialogController(pParent, &rSet) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SFXPAGE_GENERAL ); diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 1ac4adaadfcb..8a3171c6d198 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -951,10 +951,9 @@ VclPtr<AbstractSwFieldDlg> SwAbstractDialogFactory_Impl::CreateSwFieldDlg(SfxBin return VclPtr<AbstractSwFieldDlg_Impl>::Create(pDlg); } -VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwFieldEditDlg ( SwView& rVw ) +VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwFieldEditDlg(SwView& rVw) { - VclPtr<SfxModalDialog> pDlg = VclPtr<SwFieldEditDlg>::Create( rVw ); - return VclPtr<SwAbstractSfxDialog_Impl>::Create( pDlg ); + return VclPtr<SwAbstractSfxController_Impl>::Create(std::make_unique<SwFieldEditDlg>(rVw)); } VclPtr<AbstractSwRenameXNamedDlg> SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg(weld::Window* pParent, diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index b13742cb15bc..373c787e4da5 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -86,21 +86,20 @@ void SwFieldEditDlg::EnsureSelection(SwField *pCurField, SwFieldMgr &rMgr) } SwFieldEditDlg::SwFieldEditDlg(SwView const & rVw) - : SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), nullptr, - "EditFieldDialog", "modules/swriter/ui/editfielddialog.ui") + : SfxSingleTabDialogController(rVw.GetViewFrame()->GetWindow().GetFrameWeld(), nullptr, + "modules/swriter/ui/editfielddialog.ui", "EditFieldDialog") , pSh(rVw.GetWrtShellPtr()) + , m_xPrevBT(m_xBuilder->weld_button("prev")) + , m_xNextBT(m_xBuilder->weld_button("next")) + , m_xAddressBT(m_xBuilder->weld_button("edit")) { - get(m_pPrevBT, "prev"); - get(m_pNextBT, "next"); - get(m_pAddressBT, "edit"); - SwFieldMgr aMgr(pSh); SwField *pCurField = aMgr.GetCurField(); if (!pCurField) return; - SwViewShell::SetCareWin(this); + SwViewShell::SetCareDialog(m_xDialog); EnsureSelection(pCurField, aMgr); @@ -108,12 +107,12 @@ SwFieldEditDlg::SwFieldEditDlg(SwView const & rVw) CreatePage(nGroup); - GetOKButton()->SetClickHdl(LINK(this, SwFieldEditDlg, OKHdl)); + GetOKButton().connect_clicked(LINK(this, SwFieldEditDlg, OKHdl)); - m_pPrevBT->SetClickHdl(LINK(this, SwFieldEditDlg, NextPrevHdl)); - m_pNextBT->SetClickHdl(LINK(this, SwFieldEditDlg, NextPrevHdl)); + m_xPrevBT->connect_clicked(LINK(this, SwFieldEditDlg, NextPrevHdl)); + m_xNextBT->connect_clicked(LINK(this, SwFieldEditDlg, NextPrevHdl)); - m_pAddressBT->SetClickHdl(LINK(this, SwFieldEditDlg, AddressHdl)); + m_xAddressBT->connect_clicked(LINK(this, SwFieldEditDlg, AddressHdl)); Init(); } @@ -140,41 +139,43 @@ void SwFieldEditDlg::Init() bool bMove = rMgr.GoNext(); if( bMove ) rMgr.GoPrev(); - m_pNextBT->Enable(bMove); + m_xNextBT->set_sensitive(bMove); bMove = rMgr.GoPrev(); if( bMove ) rMgr.GoNext(); - m_pPrevBT->Enable( bMove ); + m_xPrevBT->set_sensitive( bMove ); if (pCurField->GetTypeId() == TYP_EXTUSERFLD) - m_pAddressBT->Enable(); + m_xAddressBT->set_sensitive(true); else - m_pAddressBT->Disable(); + m_xAddressBT->set_sensitive(false); pSh->DestroyCursor(); pSh->EndAction(); } - GetOKButton()->Enable( !pSh->IsReadOnlyAvailable() || - !pSh->HasReadonlySel() ); + GetOKButton().set_sensitive(!pSh->IsReadOnlyAvailable() || + !pSh->HasReadonlySel()); } VclPtr<SfxTabPage> SwFieldEditDlg::CreatePage(sal_uInt16 nGroup) { + TabPageParent pPageParent(get_content_area(), this); + // create TabPage VclPtr<SfxTabPage> pTabPage; switch (nGroup) { case GRP_DOC: - pTabPage = SwFieldDokPage::Create(get_content_area(), nullptr); + pTabPage = SwFieldDokPage::Create(pPageParent, nullptr); break; case GRP_FKT: - pTabPage = SwFieldFuncPage::Create(get_content_area(), nullptr); + pTabPage = SwFieldFuncPage::Create(pPageParent, nullptr); break; case GRP_REF: - pTabPage = SwFieldRefPage::Create(get_content_area(), nullptr); + pTabPage = SwFieldRefPage::Create(pPageParent, nullptr); break; case GRP_REG: { @@ -189,17 +190,17 @@ VclPtr<SfxTabPage> SwFieldEditDlg::CreatePage(sal_uInt16 nGroup) xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); - pTabPage = SwFieldDokInfPage::Create(get_content_area(), pSet); + pTabPage = SwFieldDokInfPage::Create(pPageParent, pSet); break; } #if HAVE_FEATURE_DBCONNECTIVITY case GRP_DB: - pTabPage = SwFieldDBPage::Create(get_content_area(), nullptr); + pTabPage = SwFieldDBPage::Create(pPageParent, nullptr); static_cast<SwFieldDBPage*>(pTabPage.get())->SetWrtShell(*pSh); break; #endif case GRP_VAR: - pTabPage = SwFieldVarPage::Create(get_content_area(), nullptr); + pTabPage = SwFieldVarPage::Create(pPageParent, nullptr); break; } @@ -217,53 +218,44 @@ VclPtr<SfxTabPage> SwFieldEditDlg::CreatePage(sal_uInt16 nGroup) SwFieldEditDlg::~SwFieldEditDlg() { - disposeOnce(); -} - -void SwFieldEditDlg::dispose() -{ - SwViewShell::SetCareWin(nullptr); + SwViewShell::SetCareDialog(nullptr); pSh->EnterStdMode(); - m_pPrevBT.clear(); - m_pNextBT.clear(); - m_pAddressBT.clear(); - SfxSingleTabDialog::dispose(); } void SwFieldEditDlg::EnableInsert(bool bEnable) { if( bEnable && pSh->IsReadOnlyAvailable() && pSh->HasReadonlySel() ) bEnable = false; - GetOKButton()->Enable( bEnable ); + GetOKButton().set_sensitive(bEnable); } void SwFieldEditDlg::InsertHdl() { - GetOKButton()->Click(); + GetOKButton().clicked(); } // kick off changing of the field -IMPL_LINK_NOARG(SwFieldEditDlg, OKHdl, Button*, void) +IMPL_LINK_NOARG(SwFieldEditDlg, OKHdl, weld::Button&, void) { - if (GetOKButton()->IsEnabled()) + if (GetOKButton().get_sensitive()) { VclPtr<SfxTabPage> pTabPage = GetTabPage(); if (pTabPage) pTabPage->FillItemSet(nullptr); - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } } -short SwFieldEditDlg::Execute() +short SwFieldEditDlg::run() { // without TabPage no dialog - return GetTabPage() ? Dialog::Execute() : static_cast<short>(RET_CANCEL); + return GetTabPage() ? SfxSingleTabDialogController::run() : static_cast<short>(RET_CANCEL); } // Traveling between fields of the same type -IMPL_LINK( SwFieldEditDlg, NextPrevHdl, Button *, pButton, void ) +IMPL_LINK(SwFieldEditDlg, NextPrevHdl, weld::Button&, rButton, void) { - bool bNext = pButton == m_pNextBT; + bool bNext = &rButton == m_xNextBT.get(); pSh->EnterStdMode(); @@ -272,7 +264,7 @@ IMPL_LINK( SwFieldEditDlg, NextPrevHdl, Button *, pButton, void ) //#112462# FillItemSet may delete the current field //that's why it has to be called before accessing the current field - if( GetOKButton()->IsEnabled() ) + if (GetOKButton().get_sensitive()) pTabPage->FillItemSet(nullptr); SwFieldMgr& rMgr = pTabPage->GetFieldMgr(); @@ -295,7 +287,7 @@ IMPL_LINK( SwFieldEditDlg, NextPrevHdl, Button *, pButton, void ) Init(); } -IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, Button*, void) +IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, weld::Button&, void) { SwFieldPage* pTabPage = static_cast<SwFieldPage*>(GetTabPage()); SwFieldMgr& rMgr = pTabPage->GetFieldMgr(); @@ -330,7 +322,7 @@ IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, Button*, void) aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, static_cast<sal_uInt16>(nEditPos))); SwAbstractDialogFactory& rFact = swui::GetFactory(); - ScopedVclPtr<SfxAbstractDialog> pDlg(rFact.CreateSwAddressAbstractDlg(GetFrameWeld(), aSet)); + ScopedVclPtr<SfxAbstractDialog> pDlg(rFact.CreateSwAddressAbstractDlg(m_xDialog.get(), aSet)); if (RET_OK == pDlg->Execute()) { pSh->UpdateOneField(*pCurField); diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 76155a46fba0..365df5c361a4 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -317,7 +317,7 @@ void SwFieldPage::InsertHdl(weld::Widget* pBtn) } else { - SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg *>(GetParentDialog()); + SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg*>(GetDialogController()); pEditDlg->InsertHdl(); } } @@ -333,7 +333,7 @@ void SwFieldPage::EnableInsert(bool bEnable) } else { - SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg *>(GetParentDialog()); + SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg*>(GetDialogController()); pEditDlg->EnableInsert(bEnable); } diff --git a/sw/source/ui/frmdlg/pattern.cxx b/sw/source/ui/frmdlg/pattern.cxx index 390166828dd4..5459ff96b1ca 100644 --- a/sw/source/ui/frmdlg/pattern.cxx +++ b/sw/source/ui/frmdlg/pattern.cxx @@ -24,7 +24,7 @@ #include <strings.hrc> SwBackgroundDlg::SwBackgroundDlg(weld::Window* pParent, const SfxItemSet& rSet) - : SfxSingleTabDialogController(pParent, rSet) + : SfxSingleTabDialogController(pParent, &rSet) { m_xDialog->set_title(SwResId(STR_FRMUI_PATTERN)); diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx index 412bddd4144d..9db98fd2e483 100644 --- a/sw/source/ui/frmdlg/uiborder.cxx +++ b/sw/source/ui/frmdlg/uiborder.cxx @@ -30,7 +30,7 @@ #include <strings.hrc> SwBorderDlg::SwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType) - : SfxSingleTabDialogController(pParent, rSet) + : SfxSingleTabDialogController(pParent, &rSet) { m_xDialog->set_title(SwResId(STR_FRMUI_BORDER)); diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 32c16bdac9ab..1ca392a35e07 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -53,7 +53,7 @@ const sal_uInt16 SwWrapTabPage::m_aWrapPageRg[] = { }; SwWrapDlg::SwWrapDlg(weld::Window* pParent, SfxItemSet& rSet, SwWrtShell* pWrtShell, bool bDrawMode) - : SfxSingleTabDialogController(pParent, rSet, "modules/swriter/ui/wrapdialog.ui", "WrapDialog") + : SfxSingleTabDialogController(pParent, &rSet, "modules/swriter/ui/wrapdialog.ui", "WrapDialog") { // create TabPage TabPageParent pPageParent(get_content_area(), this); diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx index c6ddf545cea1..c14a4a171d1f 100644 --- a/sw/source/uibase/inc/fldedt.hxx +++ b/sw/source/uibase/inc/fldedt.hxx @@ -25,15 +25,15 @@ class SwView; class SwWrtShell; class SwFieldMgr; -class SwFieldEditDlg : public SfxSingleTabDialog +class SwFieldEditDlg : public SfxSingleTabDialogController { SwWrtShell* pSh; - VclPtr<PushButton> m_pPrevBT; - VclPtr<PushButton> m_pNextBT; - VclPtr<PushButton> m_pAddressBT; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; + std::unique_ptr<weld::Button> m_xAddressBT; - DECL_LINK(AddressHdl, Button *, void); - DECL_LINK(NextPrevHdl, Button *, void); + DECL_LINK(AddressHdl, weld::Button&, void); + DECL_LINK(NextPrevHdl, weld::Button&, void); void Init(); VclPtr<SfxTabPage> CreatePage(sal_uInt16 nGroup); @@ -43,11 +43,10 @@ public: SwFieldEditDlg(SwView const & rVw); virtual ~SwFieldEditDlg() override; - virtual void dispose() override; - DECL_LINK(OKHdl, Button*, void); + DECL_LINK(OKHdl, weld::Button&, void); - virtual short Execute() override; + virtual short run() override; void EnableInsert(bool bEnable); void InsertHdl(); |