diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-21 15:05:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-21 20:11:08 +0100 |
commit | 962c5052eec48774255f3115f88170c3ebb246b0 (patch) | |
tree | def774c5b57d39a45767dd3b4aecc956aa41612d /sw/source/ui/fldui | |
parent | c5639cd7d6e8b8966a19b83b68313db8f3ecd037 (diff) |
convert edit fields singletab dialog to layout .ui
Change-Id: I3d58d93ac2686ea16fde4118b7133176d3713af7
Diffstat (limited to 'sw/source/ui/fldui')
-rw-r--r-- | sw/source/ui/fldui/fldedt.cxx | 77 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldui.src | 32 |
3 files changed, 26 insertions, 87 deletions
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index b376360a1fdf..a9b907af3c17 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -52,13 +52,15 @@ namespace swui SwAbstractDialogFactory * GetFactory(); } -SwFldEditDlg::SwFldEditDlg(SwView& rVw) : - SfxNoLayoutSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0, 0), - pSh (rVw.GetWrtShellPtr()), - aPrevBT (this, SW_RES(BTN_FLDEDT_PREV)), - aNextBT (this, SW_RES(BTN_FLDEDT_NEXT)), - aAddressBT (this, SW_RES(PB_FLDEDT_ADDRESS)) +SwFldEditDlg::SwFldEditDlg(SwView& rVw) + : SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0, + "EditFieldDialog", "modules/swriter/ui/editfielddialog.ui") + , pSh(rVw.GetWrtShellPtr()) { + get(m_pPrevBT, "prev"); + get(m_pNextBT, "next"); + get(m_pAddressBT, "edit"); + SwFldMgr aMgr(pSh); SwField *pCurFld = aMgr.GetCurFld(); @@ -70,38 +72,20 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw) : /* #108536# Only create selection if there is none already. Normalize PaM instead of swapping. */ if ( ! pSh->HasSelection() ) - pSh->Right(CRSR_SKIP_CHARS, sal_True, 1, sal_False ); + pSh->Right(CRSR_SKIP_CHARS, true, 1, false); pSh->NormalizePam(); - sal_uInt16 nGroup = aMgr.GetGroup(sal_False, pCurFld->GetTypeId(), pCurFld->GetSubType()); + sal_uInt16 nGroup = aMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType()); CreatePage(nGroup); GetOKButton()->SetClickHdl(LINK(this, SwFldEditDlg, OKHdl)); - // position buttons ourselves because otherwise when font sizes are - // varying, they are in the woods, and because PB uses fixed pixel sizes - // for its buttons and dialog width in SingleTabDlg. - aPrevBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aPrevBT.GetPosPixel().Y())); - sal_uInt16 nWidth = static_cast< sal_uInt16 >(GetOKButton()->GetOutputSize().Width() / 2 - 3); - Size aNewSize(LogicToPixel(Size(nWidth, GetOKButton()->GetOutputSize().Height()))); - aPrevBT.SetSizePixel(aNewSize); - - aNextBT.SetSizePixel(aPrevBT.GetSizePixel()); - - long nXPos = GetOKButton()->GetPosPixel().X() + GetOKButton()->GetSizePixel().Width() - - aNextBT.GetSizePixel().Width() - 1; - aNextBT.SetPosPixel(Point(nXPos, aNextBT.GetPosPixel().Y())); + m_pPrevBT->SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl)); + m_pNextBT->SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl)); - aAddressBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aAddressBT.GetPosPixel().Y())); - aAddressBT.SetSizePixel(GetOKButton()->GetSizePixel()); - - aPrevBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl)); - aNextBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl)); - - aAddressBT.SetClickHdl(LINK(this, SwFldEditDlg, AddressHdl)); - aAddressBT.SetHelpId(HID_FLDEDT_ADDRESS); + m_pAddressBT->SetClickHdl(LINK(this, SwFldEditDlg, AddressHdl)); Init(); } @@ -129,14 +113,14 @@ void SwFldEditDlg::Init() sal_Bool bMove = rMgr.GoNext(); if( bMove ) rMgr.GoPrev(); - aNextBT.Enable(bMove); + m_pNextBT->Enable(bMove); if( 0 != ( bMove = rMgr.GoPrev() ) ) rMgr.GoNext(); - aPrevBT.Enable( bMove ); + m_pPrevBT->Enable( bMove ); if (pCurFld->GetTypeId() == TYP_EXTUSERFLD) - aAddressBT.Show(); + m_pAddressBT->Show(); pSh->DestroyCrsr(); pSh->EndAction(); @@ -150,21 +134,17 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) { // create TabPage SfxTabPage* pTabPage = 0; - const char* pHelpId = 0; switch (nGroup) { case GRP_DOC: - pTabPage = SwFldDokPage::Create(this, *(SfxItemSet*)0); - pHelpId = HID_EDIT_FLD_DOK; + pTabPage = SwFldDokPage::Create(get_content_area(), *(SfxItemSet*)0); break; case GRP_FKT: - pTabPage = SwFldFuncPage::Create(this, *(SfxItemSet*)0); - pHelpId = HID_EDIT_FLD_FUNC; + pTabPage = SwFldFuncPage::Create(get_content_area(), *(SfxItemSet*)0); break; case GRP_REF: - pTabPage = SwFldRefPage::Create(this, *(SfxItemSet*)0); - pHelpId = HID_EDIT_FLD_REF; + pTabPage = SwFldRefPage::Create(get_content_area(), *(SfxItemSet*)0); break; case GRP_REG: { @@ -179,31 +159,22 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); - pTabPage = SwFldDokInfPage::Create(this, *pSet); - pHelpId = HID_EDIT_FLD_DOKINF; + pTabPage = SwFldDokInfPage::Create(get_content_area(), *pSet); break; } case GRP_DB: - pTabPage = SwFldDBPage::Create(this, *(SfxItemSet*)0); + pTabPage = SwFldDBPage::Create(get_content_area(), *(SfxItemSet*)0); static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh); - pHelpId = HID_EDIT_FLD_DB; break; case GRP_VAR: - pTabPage = SwFldVarPage::Create(this, *(SfxItemSet*)0); - pHelpId = HID_EDIT_FLD_VAR; + pTabPage = SwFldVarPage::Create(get_content_area(), *(SfxItemSet*)0); break; } - pTabPage->SetHelpId(pHelpId); static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh); - SetTabPage(pTabPage); - - String sTitle(GetText()); - sTitle.Insert(OUString(": "), 0); - sTitle.Insert(SW_RESSTR(STR_FLD_EDIT_DLG), 0); - SetText(sTitle); + setTabPage(pTabPage); return pTabPage; } @@ -256,7 +227,7 @@ short SwFldEditDlg::Execute() --------------------------------------------------------------------*/ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) { - sal_Bool bNext = pButton == &aNextBT; + bool bNext = pButton == m_pNextBT; pSh->EnterStdMode(); diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index d36c309aaee0..0096bc5d6fc6 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -351,7 +351,7 @@ IMPL_LINK( SwFldPage, InsertHdl, Button *, pBtn ) } else { - SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent(); + SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParentDialog(); pEditDlg->InsertHdl(); } @@ -373,7 +373,7 @@ void SwFldPage::EnableInsert(sal_Bool bEnable) } else { - SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent(); + SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParentDialog(); pEditDlg->EnableInsert(bEnable); } diff --git a/sw/source/ui/fldui/fldui.src b/sw/source/ui/fldui/fldui.src index 8b139716613a..788a018e28f6 100644 --- a/sw/source/ui/fldui/fldui.src +++ b/sw/source/ui/fldui/fldui.src @@ -24,13 +24,6 @@ /*-------------------------------------------------------------------- Description: strings for the types --------------------------------------------------------------------*/ -String STR_FLD_EDIT_DLG -{ - Text [ en-US ] = "Edit Fields" ; -}; -/*-------------------------------------------------------------------- - Description: strings for the types - --------------------------------------------------------------------*/ // // range document // @@ -638,31 +631,6 @@ String STR_ALL_DATABASE { Text [ en-US ] = "<All>" ; }; -ImageButton BTN_FLDEDT_PREV -{ - Pos = MAP_APPFONT ( 263 , 115 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - TabStop = TRUE ; - SYMBOL = IMAGEBUTTON_PREV ; - Helpid = HID_DLG_FLDEDT_PREV ; -}; -ImageButton BTN_FLDEDT_NEXT -{ - Pos = MAP_APPFONT ( 294 , 115 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - TabStop = TRUE ; - SYMBOL = IMAGEBUTTON_NEXT ; - Helpid = HID_DLG_FLDEDT_NEXT ; -}; -PushButton PB_FLDEDT_ADDRESS -{ - Pos = MAP_APPFONT ( 294 , 100 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - TabStop = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Edit" ; - Helpid = HID_DLG_FLDEDT_ADDRESS ; -}; String STR_CUSTOM { Text [ en-US ] = "Custom" ; |