diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-15 15:42:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-18 18:12:10 +0200 |
commit | 6d184e2e23b319128f94649f4e15c2f7bcbffca9 (patch) | |
tree | 23541a6cccacb3a315196ed89c39a7e4a577cc9b /sw/source/ui | |
parent | 03cecc2985c10ecfb2efab28f5b03e451e82c777 (diff) |
weld SwParaDlg
Change-Id: Idb330d63480c0b973190d5f7696aac8f232a16c3
Reviewed-on: https://gerrit.libreoffice.org/60529
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/chrdlg/pardlg.cxx | 56 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 11 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 4 | ||||
-rw-r--r-- | sw/source/ui/envelp/envfmt.cxx | 7 |
4 files changed, 34 insertions, 44 deletions
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index 2f5b5329ed81..f3df6a32e9f2 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -43,55 +43,47 @@ #include <svx/dialogs.hrc> #include <svx/flagsdef.hxx> -SwParaDlg::SwParaDlg(vcl::Window *pParent, +SwParaDlg::SwParaDlg(weld::Window *pParent, SwView& rVw, const SfxItemSet& rCoreSet, sal_uInt8 nDialogMode, const OUString *pTitle, bool bDraw, const OString& sDefPage) - : SfxTabDialog(pParent, - "ParagraphPropertiesDialog", + : SfxTabDialogController(pParent, "modules/swriter/ui/paradialog.ui", + "ParagraphPropertiesDialog", &rCoreSet, nullptr != pTitle) , rView(rVw) , bDrawParaDlg(bDraw) - , m_nParaStd(0) - , m_nParaAlign(0) - , m_nParaExt(0) - , m_nParaNumPara(0) - , m_nParaDrpCps(0) - , m_nParaBorder(0) - , m_nAreaId(0) - , m_nTransparenceId(0) { nHtmlMode = ::GetHtmlMode(rVw.GetDocShell()); bool bHtmlMode = (nHtmlMode & HTMLMODE_ON) == HTMLMODE_ON; if(pTitle) { // Update title - SetText(GetText() + SwResId(STR_TEXTCOLL_HEADER) + *pTitle + ")"); + m_xDialog->set_title(m_xDialog->get_title() + SwResId(STR_TEXTCOLL_HEADER) + *pTitle + ")"); } // tabs common to paragraph and draw paragraphs (paragraphs inside a text box) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!"); - m_nParaStd = AddTabPage("labelTP_PARA_STD", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), - pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) ); + AddTabPage("labelTP_PARA_STD", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), + pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) ); OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!"); - m_nParaAlign = AddTabPage( "labelTP_PARA_ALIGN", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), - pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) ); + AddTabPage("labelTP_PARA_ALIGN", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), + pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH)); SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); if (!bDrawParaDlg && (!bHtmlMode || rHtmlOpt.IsPrintLayoutExtension())) { OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!"); - m_nParaExt = AddTabPage( "textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), - pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) ); + AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), + pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH)); } else @@ -132,17 +124,17 @@ SwParaDlg::SwParaDlg(vcl::Window *pParent, else { if(!(nDialogMode & DLG_ENVELOP)) - m_nParaNumPara = AddTabPage("labelTP_NUMPARA", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges); + AddTabPage("labelTP_NUMPARA", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges); else RemoveTabPage("labelTP_NUMPARA"); - m_nParaDrpCps = AddTabPage("labelTP_DROPCAPS", SwDropCapsPage::Create, SwDropCapsPage::GetRanges); + AddTabPage("labelTP_DROPCAPS", SwDropCapsPage::Create, SwDropCapsPage::GetRanges); if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES))) { // add Area and Transparence TabPages - m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); - m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); + AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); } else { @@ -152,7 +144,7 @@ SwParaDlg::SwParaDlg(vcl::Window *pParent, OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!"); - m_nParaBorder = AddTabPage("labelTP_BORDER", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); + AddTabPage("labelTP_BORDER", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); } if (!sDefPage.isEmpty()) @@ -163,18 +155,18 @@ SwParaDlg::~SwParaDlg() { } -void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) +void SwParaDlg::PageCreated(const OString& rId, SfxTabPage& rPage) { SwWrtShell& rSh = rView.GetWrtShell(); SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); // Table borders cannot get any shade in Writer - if (nId == m_nParaBorder) + if (rId == "labelTP_BORDER") { aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA))); rPage.PageCreated(aSet); } - else if( nId == m_nParaStd ) + else if (rId == "labelTP_PARA_STD") { aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, static_cast< sal_uInt16 >(rSh.GetAnyCurRect(CurRectType::PagePrt).Width()) )); @@ -188,7 +180,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) } rPage.PageCreated(aSet); } - else if( m_nParaAlign == nId) + else if (rId == "labelTP_PARA_ALIGN") { if (!bDrawParaDlg) { @@ -196,7 +188,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) rPage.PageCreated(aSet); } } - else if( m_nParaExt == nId ) + else if (rId == "textflow") { // pagebreak only when the cursor is in the body-area and not in a table const FrameTypeFlags eType = rSh.GetFrameType(nullptr,true); @@ -207,11 +199,11 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) rPage.PageCreated(aSet); } } - else if( m_nParaDrpCps == nId ) + else if (rId == "labelTP_DROPCAPS") { static_cast<SwDropCapsPage&>(rPage).SetFormat(false); } - else if( m_nParaNumPara == nId) + else if (rId == "labelTP_NUMPARA") { SwTextFormatColl* pTmpColl = rSh.GetCurTextFormatColl(); if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() ) @@ -239,7 +231,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) // these pages find the needed attributes for fill style suggestions. // These are added in SwDocStyleSheet::GetItemSet() for the SfxStyleFamily::Para on // demand, but could also be directly added from the DrawModel. - else if (m_nAreaId == nId) + else if (rId == "area") { SfxItemSet aNew(*aSet.GetPool(), svl::Items<SID_COLOR_TABLE, SID_PATTERN_LIST, @@ -252,7 +244,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) rPage.PageCreated(aNew); } - else if (m_nTransparenceId == nId) + else if (rId == "transparence") { rPage.PageCreated(*GetInputSetImpl()); } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 011f2cb86164..d61bb53c4f90 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -825,13 +825,12 @@ SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod () return SwLabDlg::UpdateFieldInformation; } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwParaDlg ( vcl::Window *pParent, SwView& rVw, - const SfxItemSet& rCoreSet , - bool bDraw , - const OString& sDefPage) +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwParaDlg(weld::Window *pParent, SwView& rVw, + const SfxItemSet& rCoreSet, + bool bDraw , + const OString& sDefPage) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwParaDlg>::Create( pParent, rVw, rCoreSet, DLG_STD, nullptr, bDraw, sDefPage ); - return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwParaDlg>(pParent, rVw, rCoreSet, DLG_STD, nullptr, bDraw, sDefPage)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 8f23f1d3d70b..5c8fad67722e 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -588,11 +588,11 @@ public: SwDBManager* pDBManager, bool bLabel) override; virtual SwLabDlgMethod GetSwLabDlgStaticMethod () override; - virtual VclPtr<SfxAbstractTabDialog> CreateSwParaDlg ( vcl::Window *pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateSwParaDlg(weld::Window *pParent, SwView& rVw, const SfxItemSet& rCoreSet, bool bDraw, - const OString& sDefPage = OString() ) override; + const OString& sDefPage = OString()) override; virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const OUString &rShortName) override; diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index a79e88eb14ef..d18b62b97dd3 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -290,14 +290,13 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) ::PrepareBoxInfo( aTmpSet, *pSh ); const OUString sFormatStr = pColl->GetName(); - VclPtrInstance< SwParaDlg > pDlg(nullptr /*TODO*/, pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); - //VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); + SwParaDlg aDlg(GetDialogFrameWeld(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr); - if ( pDlg->Execute() == RET_OK ) + if (aDlg.execute() == RET_OK) { // maybe relocate defaults const SfxPoolItem* pItem = nullptr; - SfxItemSet* pOutputSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet()); + SfxItemSet* pOutputSet = const_cast<SfxItemSet*>(aDlg.GetOutputItemSet()); sal_uInt16 nNewDist; if( SfxItemState::SET == pOutputSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, |