diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-26 12:40:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-28 22:02:53 +0200 |
commit | 4dbce627d3643babaf90a93c70b365ff08abfca6 (patch) | |
tree | daf5b62ad5a5c8d99ec721b22b22733800d2a3a4 /sw/source/ui/envelp | |
parent | 5fa446204e1e686412d84562750d9802bf1b9468 (diff) |
weld SwEnvDlg
Change-Id: Ib92f790030ca6fbf64273cf45c710b2f698f45a4
Reviewed-on: https://gerrit.libreoffice.org/53569
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/envelp')
-rw-r--r-- | sw/source/ui/envelp/envfmt.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/envelp/envfmt.hxx | 7 | ||||
-rw-r--r-- | sw/source/ui/envelp/envlop1.cxx | 36 | ||||
-rw-r--r-- | sw/source/ui/envelp/envprt.hxx | 2 |
4 files changed, 21 insertions, 34 deletions
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index a7aaaf4cbd8c..4d264417f664 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -241,7 +241,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) bSender ? RES_POOLCOLL_SENDADRESS : RES_POOLCOLL_JAKETADRESS)); OSL_ENSURE(pColl, "Text collection missing"); - if (rIdent == "character") + if (rIdent.startsWith("character")) { SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender); @@ -253,7 +253,8 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); const OUString sFormatStr = pColl->GetName(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(nullptr /*TODO*/, pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); + //ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); OSL_ENSURE(pDlg, "Dialog creation failed!"); if (pDlg->Execute() == RET_OK) { @@ -262,7 +263,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) pCollSet->Put(aOutputSet); } } - else if (rIdent == "paragraph") + else if (rIdent.startsWith("paragraph")) { SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender); @@ -290,7 +291,8 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) ::PrepareBoxInfo( aTmpSet, *pSh ); const OUString sFormatStr = pColl->GetName(); - VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); + VclPtrInstance< SwParaDlg > pDlg(nullptr /*TODO*/, pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); + //VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); if ( pDlg->Execute() == RET_OK ) { diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx index d5aec6713fe5..20d445f14c61 100644 --- a/sw/source/ui/envelp/envfmt.hxx +++ b/sw/source/ui/envelp/envfmt.hxx @@ -26,7 +26,7 @@ class SwTextFormatColl; class SwEnvFormatPage : public SfxTabPage { - VclPtr<SwEnvDlg> m_pDialog; + SwEnvDlg* m_pDialog; std::vector<sal_uInt16> m_aIDs; std::unique_ptr<weld::MetricSpinButton> m_xAddrLeftField; @@ -59,11 +59,6 @@ class SwEnvFormatPage : public SfxTabPage public: SwEnvFormatPage(TabPageParent pParent, const SfxItemSet& rSet); void Init(SwEnvDlg* pDialog); - virtual void dispose() override - { - m_pDialog.clear(); - SfxTabPage::dispose(); - } virtual ~SwEnvFormatPage() override; static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet); diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 28926fb9b2dd..e7ae5d3a4ea1 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -63,8 +63,6 @@ IMPL_LINK(SwEnvPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, void) { vcl::RenderContext& rRenderContext = aPayload.first; - //SetMapMode(MapMode(MapUnit::MapPixel)); - const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); rRenderContext.SetBackground(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor()); rRenderContext.Erase(); @@ -124,51 +122,43 @@ IMPL_LINK(SwEnvPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, void) rRenderContext.DrawRect(tools::Rectangle(Point(nStmpX, nStmpY), Size(nStmpW, nStmpH))); } -SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, +SwEnvDlg::SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) - : SfxTabDialog(pParent, "EnvDialog", - "modules/swriter/ui/envdialog.ui", &rSet) + : SfxTabDialogController(pParent, "modules/swriter/ui/envdialog.ui", "EnvDialog", &rSet) , aEnvItem(static_cast<const SwEnvItem&>( rSet.Get(FN_ENVELOP))) , pSh(pWrtSh) , pPrinter(pPrt) , pAddresseeSet(nullptr) , pSenderSet(nullptr) - , m_nEnvPrintId(0) + , m_xModify(m_xBuilder->weld_button("modify")) { if (!bInsert) { - GetUserButton()->SetText(get<PushButton>("modify")->GetText()); + GetUserButton()->set_label(m_xModify->get_label()); } - m_nEnvAddressId = AddTabPage("envelope", SwEnvPage ::Create, nullptr); - m_nEnvFormatId = AddTabPage("format", SwEnvFormatPage::Create, nullptr); - m_nEnvPrintId = AddTabPage("printer", SwEnvPrtPage::Create, nullptr); + AddTabPage("envelope", SwEnvPage::Create, nullptr); + AddTabPage("format", SwEnvFormatPage::Create, nullptr); + AddTabPage("printer", SwEnvPrtPage::Create, nullptr); } SwEnvDlg::~SwEnvDlg() { - disposeOnce(); -} - -void SwEnvDlg::dispose() -{ delete pAddresseeSet; delete pSenderSet; - pPrinter.clear(); - SfxTabDialog::dispose(); } -void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) +void SwEnvDlg::PageCreated(const OString& rId, SfxTabPage &rPage) { - if (nId == m_nEnvPrintId) + if (rId == "printer") { static_cast<SwEnvPrtPage*>(&rPage)->SetPrt(pPrinter); } - else if (nId == m_nEnvAddressId) + else if (rId == "envelope") { static_cast<SwEnvPage*>(&rPage)->Init(this); } - else if (nId == m_nEnvFormatId) + else if (rId == "format") { static_cast<SwEnvFormatPage*>(&rPage)->Init(this); } @@ -176,7 +166,7 @@ void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) short SwEnvDlg::Ok() { - short nRet = SfxTabDialog::Ok(); + short nRet = SfxTabDialogController::Ok(); if (nRet == RET_OK || nRet == RET_USER) { @@ -209,7 +199,7 @@ SwEnvPage::SwEnvPage(TabPageParent pParent, const SfxItemSet& rSet) , m_xPreview(new SwEnvPreview(m_xBuilder->weld_drawing_area("preview"))) { auto nTextBoxHeight(m_xAddrEdit->get_height_rows(10)); - auto nTextBoxWidth(m_xAddrEdit->get_approximate_digit_width() * 20); + auto nTextBoxWidth(m_xAddrEdit->get_approximate_digit_width() * 25); m_xAddrEdit->set_size_request(nTextBoxWidth, nTextBoxHeight); m_xSenderEdit->set_size_request(nTextBoxWidth, nTextBoxHeight); diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx index 94b7d0886eef..a8c093c381fe 100644 --- a/sw/source/ui/envelp/envprt.hxx +++ b/sw/source/ui/envelp/envprt.hxx @@ -50,7 +50,7 @@ class SwEnvPrtPage : public SfxTabPage DECL_LINK(AlignHdl, weld::ToggleButton&, void); DECL_LINK(ButtonHdl, weld::Button&, void ); - SwEnvDlg* GetParentSwEnvDlg() {return static_cast<SwEnvDlg*>(GetTabDialog()); } + SwEnvDlg* GetParentSwEnvDlg() {return static_cast<SwEnvDlg*>(GetDialogController()); } using TabPage::ActivatePage; using TabPage::DeactivatePage; |