diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-12 15:52:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-14 14:16:11 +0200 |
commit | a4503017dfcf0c919b8f81bd8cdbc44bade3f774 (patch) | |
tree | 341dd5abb9f51392d73d6a1251c8cb1c08f8a30a /sw/source/ui | |
parent | dd1db430fe8009250253756573a1a19a45830c5f (diff) |
weld SwCharDlg
Change-Id: Ice7c211b10d59ab9d166da6e09662b602debb09d
Reviewed-on: https://gerrit.libreoffice.org/60417
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/chardlg.cxx | 59 | ||||
-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/envelp/envfmt.cxx | 3 |
4 files changed, 35 insertions, 34 deletions
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 9dfa7dd920c8..eb31be2c98ae 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -58,38 +58,41 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::sfx2; -SwCharDlg::SwCharDlg(vcl::Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet, +SwCharDlg::SwCharDlg(weld::Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet, SwCharDlgMode nDialogMode, const OUString* pStr) - : SfxTabDialog(pParent, "CharacterPropertiesDialog", - "modules/swriter/ui/characterproperties.ui", &rCoreSet, pStr != nullptr) + : SfxTabDialogController(pParent, "modules/swriter/ui/characterproperties.ui", + "CharacterPropertiesDialog", &rCoreSet, pStr != nullptr) , m_rView(rVw) , m_nDialogMode(nDialogMode) { - if(pStr) + if (pStr) { - SetText(GetText() + SwResId(STR_TEXTCOLL_HEADER) + *pStr + ")"); + m_xDialog->set_title(m_xDialog->get_title() + SwResId(STR_TEXTCOLL_HEADER) + *pStr + ")"); } SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - m_nCharStdId = AddTabPage("font", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), nullptr); - m_nCharExtId = AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), nullptr); - m_nCharPosId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), nullptr ); - m_nCharTwoId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), nullptr ); - m_nCharUrlId = AddTabPage("hyperlink", SwCharURLPage::Create, nullptr); - m_nCharBgdId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), nullptr ); - m_nCharBrdId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr ); - - SvtCJKOptions aCJKOptions; - if(m_nDialogMode == SwCharDlgMode::Draw || m_nDialogMode == SwCharDlgMode::Ann) + AddTabPage("font", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), nullptr); + AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), nullptr); + AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), nullptr ); + AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), nullptr ); + AddTabPage("hyperlink", SwCharURLPage::Create, nullptr); + AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), nullptr ); + AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr ); + + if (m_nDialogMode == SwCharDlgMode::Draw || m_nDialogMode == SwCharDlgMode::Ann) { - RemoveTabPage(m_nCharUrlId); - RemoveTabPage(m_nCharBgdId); - RemoveTabPage(m_nCharTwoId); + RemoveTabPage("hyperlink"); + RemoveTabPage("background"); + RemoveTabPage("asianlayout"); + } + else + { + SvtCJKOptions aCJKOptions; + if (!aCJKOptions.IsDoubleLinesEnabled()) + RemoveTabPage("asianlayout"); } - else if(!aCJKOptions.IsDoubleLinesEnabled()) - RemoveTabPage(m_nCharTwoId); - if(m_nDialogMode != SwCharDlgMode::Std) - RemoveTabPage(m_nCharBrdId); + if (m_nDialogMode != SwCharDlgMode::Std) + RemoveTabPage("borders"); } SwCharDlg::~SwCharDlg() @@ -97,10 +100,10 @@ SwCharDlg::~SwCharDlg() } // set FontList -void SwCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +void SwCharDlg::PageCreated(const OString& rId, SfxTabPage &rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - if (nId == m_nCharStdId) + if (rId == "font") { SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>( ( m_rView.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) ) ); @@ -109,22 +112,22 @@ void SwCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); rPage.PageCreated(aSet); } - else if (nId == m_nCharExtId) + else if (rId == "fonteffects") { aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER|SVX_ENABLE_FLASH)); rPage.PageCreated(aSet); } - else if (nId == m_nCharPosId) + else if (rId == "position") { aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); rPage.PageCreated(aSet); } - else if (nId == m_nCharTwoId) + else if (rId == "asianlayout") { aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); rPage.PageCreated(aSet); } - else if (nId == m_nCharBgdId) + else if (rId == "background") { aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING))); rPage.PageCreated(aSet); diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 65969975b8e6..011f2cb86164 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -770,11 +770,10 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwVi return VclPtr<VclAbstractDialog_Impl>::Create(pDlg); } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, SwCharDlgMode nDialogMode, const OUString* pFormatStr) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwCharDlg>::Create(pParent, pVw, rCoreSet, nDialogMode, pFormatStr); - return VclPtr<AbstractTabDialog_Impl>::Create(pDlg); + return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwCharDlg>(pParent, pVw, rCoreSet, nDialogMode, pFormatStr)); } VclPtr<AbstractSwConvertTableDlg> SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg(SwView& rView, bool bToTable) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index eb1fb9993bc6..8f23f1d3d70b 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -571,7 +571,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateSwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq ) override; virtual VclPtr<AbstractSwBreakDlg> CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwChangeDBDlg(SwView& rVw) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, + virtual VclPtr<SfxAbstractTabDialog> CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) override; virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) override; virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV) override; diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 40e8cfaf4967..2ba47edbf3d2 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -254,8 +254,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender) OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); const OUString sFormatStr = pColl->GetName(); - 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)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetDialogFrameWeld(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); if (pDlg->Execute() == RET_OK) { SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() ); |