From 7b763893e4c2571f1d8c8afef5491e0e73bff3ea Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 13 Aug 2013 14:51:54 +0100 Subject: convert label dialog to .ui Change-Id: I77ce740b1ca7178d8c5f5f2d4ce55920cf18a85b --- sw/UIConfig_swriter.mk | 1 + sw/inc/envelp.hrc | 8 -- sw/inc/globals.hrc | 3 - sw/inc/helpid.h | 1 - sw/inc/swabstdlg.hxx | 6 +- sw/source/ui/app/applab.cxx | 2 +- sw/source/ui/dialog/swdlgfact.cxx | 23 +--- sw/source/ui/dialog/swdlgfact.hxx | 8 +- sw/source/ui/envelp/envelp.src | 4 - sw/source/ui/envelp/envlop.hrc | 11 -- sw/source/ui/envelp/envlop.src | 5 - sw/source/ui/envelp/label.hrc | 5 - sw/source/ui/envelp/label.src | 69 ------------ sw/source/ui/envelp/label1.cxx | 62 ++++++----- sw/source/ui/inc/label.hxx | 18 +-- sw/uiconfig/swriter/ui/labeldialog.ui | 203 ++++++++++++++++++++++++++++++++++ 16 files changed, 260 insertions(+), 169 deletions(-) create mode 100644 sw/uiconfig/swriter/ui/labeldialog.ui (limited to 'sw') diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 05f118a9ff5d..96447e489df3 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -105,6 +105,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/insertsectiondialog \ sw/uiconfig/swriter/ui/insertscript \ sw/uiconfig/swriter/ui/inserttable \ + sw/uiconfig/swriter/ui/labeldialog \ sw/uiconfig/swriter/ui/labelformatpage \ sw/uiconfig/swriter/ui/labeloptionspage \ sw/uiconfig/swriter/ui/linenumbering \ diff --git a/sw/inc/envelp.hrc b/sw/inc/envelp.hrc index 6fb5624582bd..ae75783448f3 100644 --- a/sw/inc/envelp.hrc +++ b/sw/inc/envelp.hrc @@ -33,10 +33,6 @@ #define TP_ENV_FMT (RC_ENVELP_BEGIN + 3) #define TP_ENV_PRT (RC_ENVELP_BEGIN + 4) -#define TP_LAB_LAB (RC_ENVELP_BEGIN + 5) -#define TP_LAB_FMT (RC_ENVELP_BEGIN + 6) -#define TP_LAB_PRT (RC_ENVELP_BEGIN + 7) - #define DLG_MAILMERGE (RC_ENVELP_BEGIN + 8) #define DLG_SYNC_BTN (RC_ENVELP_BEGIN + 9) @@ -58,9 +54,6 @@ #define RC_LABFMT_BEGIN (RC_ENVELP_BEGIN + 50) #define RC_LABFMT_END (RC_ENVELP_BEGIN + 62) -// RC_LABPRT_BEGIN (RC_ENVELP_BEGIN + 63) -#define RC_LABPRT_END (RC_ENVELP_BEGIN + 72) - // Strings -------------------------------------------------------------------- #define STR_DATABASE_NOT_OPENED (RC_ENVLOP_BEGIN + 63) @@ -68,7 +61,6 @@ #define DLG_MERGE_FIELD_CONNECTIONS (RC_ENVLOP_BEGIN + 66) -#define STR_BTN_NEW_DOC (RC_ENVLOP_BEGIN + 67) #define STR_BTN_NEWDOC (RC_ENVLOP_BEGIN + 68) #define STR_SENDER_TOKENS (RC_ENVLOP_BEGIN + 69) // Ueberlaufpruefung ---------------------------------------------------------- diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index 1d117977127c..2eb00203000a 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -176,10 +176,7 @@ #define TP_TOX_SELECT (RC_GLOBALS_BEGIN + 90) #define TP_TOX_ENTRY (RC_GLOBALS_BEGIN + 91) #define TP_TOX_STYLES (RC_GLOBALS_BEGIN + 92) -#define TP_VISITING_CARDS (RC_GLOBALS_BEGIN + 93) #define DLG_ADD_IDX_STYLES (RC_GLOBALS_BEGIN + 94) -#define TP_PRIVATE_DATA (RC_GLOBALS_BEGIN + 95) -#define TP_BUSINESS_DATA (RC_GLOBALS_BEGIN + 96) #define TP_OPTCOMPATIBILITY_PAGE (RC_GLOBALS_BEGIN + 103) #define TP_MAILCONFIG (RC_GLOBALS_BEGIN + 104) //maximum: RC_GLOBALS_BEGIN + 120 diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 751430fcde2c..918bba2f74a7 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -330,7 +330,6 @@ #define HID_DRAW_TEXT_TOOLBOX "SW_HID_DRAW_TEXT_TOOLBOX" #define HID_NUM_TOOLBOX "SW_HID_NUM_TOOLBOX" -#define HID_LABEL_INSERT "SW_HID_LABEL_INSERT" #define HID_CALC_TOOLBOX "SW_HID_CALC_TOOLBOX" #define HID_PVIEW_TOOLBOX "SW_HID_PVIEW_TOOLBOX" diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 1d372b2027de..b0578c1f444f 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -247,7 +247,7 @@ public: class AbstractSwLabDlg : public SfxAbstractTabDialog //add for SwLabDlg { public: - virtual const String& GetBusinessCardStr() const = 0; + virtual const OUString& GetBusinessCardStr() const = 0; virtual Printer *GetPrt() =0; }; @@ -356,8 +356,8 @@ public: virtual SfxAbstractTabDialog* CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert,int nResId ) = 0; //add for SwEnvDlg - virtual AbstractSwLabDlg* CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg - SwNewDBMgr* pNewDBMgr, sal_Bool bLabel,int nResId ) = 0; + virtual AbstractSwLabDlg* CreateSwLabDlg(Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg + SwNewDBMgr* pNewDBMgr, bool bLabel) = 0; virtual SwLabDlgMethod GetSwLabDlgStaticMethod () =0;//add for SwLabDlg diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index ded62a81dc49..b74374d63801 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -168,7 +168,7 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel) SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create(); OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!"); - AbstractSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB ); + AbstractSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg(0, aSet, pNewDBMgr, bLabel); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if ( RET_OK == pDlg->Execute() ) diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 5192ddb8b333..bf4e6b33d938 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -282,7 +282,7 @@ OUString AbstractSwLabDlg_Impl::GetText() const return pDlg->GetText(); } -const String& AbstractSwLabDlg_Impl::GetBusinessCardStr() const +const OUString& AbstractSwLabDlg_Impl::GetBusinessCardStr() const { return pDlg->GetBusinessCardStr(); } @@ -791,23 +791,11 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( Window* pPa return 0; } -AbstractSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg - SwNewDBMgr* pNewDBMgr, sal_Bool bLabel,int nResId ) +AbstractSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg(Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg + SwNewDBMgr* pNewDBMgr, bool bLabel) { - SwLabDlg* pDlg=NULL; - switch ( nResId ) - { - case DLG_LAB : - pDlg = new SwLabDlg( pParent, rSet, pNewDBMgr,bLabel ); - break; - - default: - break; - } - - if ( pDlg ) - return new AbstractSwLabDlg_Impl( pDlg ); - return 0; + SwLabDlg* pDlg = new SwLabDlg(pParent, rSet, pNewDBMgr, bLabel); + return new AbstractSwLabDlg_Impl(pDlg); } SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod () @@ -815,7 +803,6 @@ SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod () return SwLabDlg::UpdateFieldInformation; } - SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( Window *pParent, SwView& rVw, const SfxItemSet& rCoreSet , sal_uInt8 nDialogMode, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 3d2c25a7e89a..34d8a8a4339f 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -197,8 +197,8 @@ class AbstractSwLabDlg_Impl : public AbstractSwLabDlg //From class Window. virtual void SetText( const OUString& rStr ); virtual OUString GetText() const; - virtual const String& GetBusinessCardStr() const; - virtual Printer *GetPrt(); + virtual const OUString& GetBusinessCardStr() const; + virtual Printer *GetPrt(); }; //add for SwLabDlg end @@ -458,8 +458,8 @@ public: virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog (Window *pParent, SwWrtShell &rSh, SwField* pField, sal_Bool bNextButton = sal_False); virtual SfxAbstractTabDialog* CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert,int nResId ); //add for SwEnvDlg - virtual AbstractSwLabDlg* CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg - SwNewDBMgr* pNewDBMgr, sal_Bool bLabel,int nResId ); + virtual AbstractSwLabDlg* CreateSwLabDlg(Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg + SwNewDBMgr* pNewDBMgr, bool bLabel); virtual SwLabDlgMethod GetSwLabDlgStaticMethod (); //add for SwLabDlg virtual SfxAbstractTabDialog* CreateSwParaDlg ( Window *pParent, //add for SwParaDlg diff --git a/sw/source/ui/envelp/envelp.src b/sw/source/ui/envelp/envelp.src index 621eb6ba33bd..9ad5ed2d821b 100644 --- a/sw/source/ui/envelp/envelp.src +++ b/sw/source/ui/envelp/envelp.src @@ -28,10 +28,6 @@ String STR_NO_DRIVERS { Text [ en-US ] = "No database drivers installed." ; }; -String STR_BTN_NEW_DOC -{ - Text [ en-US ] = "~New Document" ; -}; String STR_BTN_NEWDOC { diff --git a/sw/source/ui/envelp/envlop.hrc b/sw/source/ui/envelp/envlop.hrc index 261d35b17cc7..166f55b4e430 100644 --- a/sw/source/ui/envelp/envlop.hrc +++ b/sw/source/ui/envelp/envlop.hrc @@ -38,17 +38,6 @@ #define WIN_PREVIEW 12 #define ST_INSERT 13 #define ST_CHANGE 14 -// global resources ******************************************************** - -#define STR_DOC_TITLE (RC_ENVLOP_BEGIN) - -// overflow check ******************************************************** - -#define ENVLOP_ACT_END STR_DOC_TITLE - -#if ENVLOP_ACT_END > RC_ENVLOP_END -#error Resource-Ueberlauf in #file, #line -#endif #endif diff --git a/sw/source/ui/envelp/envlop.src b/sw/source/ui/envelp/envlop.src index 0786b999f502..82ca4dcd8195 100644 --- a/sw/source/ui/envelp/envlop.src +++ b/sw/source/ui/envelp/envlop.src @@ -166,10 +166,5 @@ TabPage TP_ENV_ENV Size = MAP_APPFONT ( 84 , 63 ) ; }; }; - // Strings ****************************************************************** -String STR_DOC_TITLE -{ - Text [ en-US ] = "Envelope" ; -}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/envelp/label.hrc b/sw/source/ui/envelp/label.hrc index dee382d8fc2b..702c3db94e2a 100644 --- a/sw/source/ui/envelp/label.hrc +++ b/sw/source/ui/envelp/label.hrc @@ -26,12 +26,7 @@ #define BTN_SYNC 20 -#define ST_BUSINESSCARDDLG 62 -#define ST_FIRSTPAGE_LAB 63 -#define ST_FIRSTPAGE_BC 64 - // global resources ******************************************************** -#define STR_DOC_TITLE (RC_LABEL_BEGIN) #define STR_CUSTOM (RC_LABEL_BEGIN + 1) // overflow check ******************************************************** diff --git a/sw/source/ui/envelp/label.src b/sw/source/ui/envelp/label.src index debe3e1697e4..b0ff5f02151d 100644 --- a/sw/source/ui/envelp/label.src +++ b/sw/source/ui/envelp/label.src @@ -20,70 +20,6 @@ #include "label.hrc" #include "globals.hrc" #include "helpid.h" -// ----- defined strings ----------------------------------------------------- -#define LABEL_STRING \ - Text [ en-US ] = "Labels" ; \ - -#define BUSINESS_CARD_STRING \ - Text [ en-US ] = "Business Cards"; \ - - // DLG_LAB ------------------------------------------------------------------ -TabDialog DLG_LAB -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - LABEL_STRING - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = TP_VISITING_CARDS; - PageResID = TP_VISITING_CARDS; - BUSINESS_CARD_STRING - }; - PageItem - { - Identifier = TP_PRIVATE_DATA; - PageResID = TP_PRIVATE_DATA; - Text [ en-US ] = "Private"; - }; - PageItem - { - Identifier = TP_BUSINESS_DATA; - PageResID = TP_BUSINESS_DATA; - Text [ en-US ] = "Business"; - }; - PageItem - { - Identifier = TP_LAB_FMT ; - PageResID = TP_LAB_FMT ; - Text [ en-US ] = "Format" ; - }; - PageItem - { - Identifier = TP_LAB_PRT ; - PageResID = TP_LAB_PRT ; - Text [ en-US ] = "Options" ; - }; - }; - }; - String ST_BUSINESSCARDDLG - { - BUSINESS_CARD_STRING - }; - String ST_FIRSTPAGE_LAB - { - LABEL_STRING - }; - String ST_FIRSTPAGE_BC - { - Text [ en-US ] = "Medium"; - }; -}; #define WIDTH 100 #define HEIGHT 16 @@ -105,11 +41,6 @@ FloatingWindow DLG_SYNC_BTN Size = MAP_APPFONT ( WIDTH - 1 , HEIGHT - 1 ) ; Text [ en-US ] = "Synchronize Labels" ; }; -}; - // String ******************************************************************* -String STR_DOC_TITLE -{ - Text [ en-US ] = "Labels" ; }; String STR_CUSTOM { diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 0d0c03021910..ef4f774f35a8 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -78,7 +78,7 @@ void SwLabDlg::_ReplaceGroup( const String &rMake ) void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) { - if (nId == TP_LAB_LAB) + if (nId == m_nLabelId) { if(m_bLabel) { @@ -88,47 +88,49 @@ void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) else ((SwLabPage*)&rPage)->SetToBusinessCard(); } - else if (nId == TP_LAB_PRT) + else if (nId == m_nOptionsId) pPrtPage = (SwLabPrtPage*)&rPage; } SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, - SwNewDBMgr* pDBMgr, sal_Bool bLabel) : - SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ), - pNewDBMgr(pDBMgr), - pPrtPage(0), - aTypeIds( 50, 10 ), - pRecs ( new SwLabRecs() ), - sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)), - sFormat(SW_RES(ST_FIRSTPAGE_LAB)), - sMedium(SW_RES(ST_FIRSTPAGE_BC)), - m_bLabel(bLabel) + SwNewDBMgr* pDBMgr, sal_Bool bLabel) + : SfxTabDialog(pParent, "LabelDialog", + "modules/swriter/ui/labeldialog.ui", &rSet, false) + , pNewDBMgr(pDBMgr) + , pPrtPage(0) + , aTypeIds(50, 10) + , pRecs(new SwLabRecs()) + , m_bLabel(bLabel) + , m_nFormatId(0) + , m_nOptionsId(0) + , m_nLabelId(0) + , m_nCardsId(0) + , m_nBusinessId(0) + , m_nPrivateId(0) { WaitObject aWait( pParent ); - FreeResource(); + m_nFormatId = AddTabPage("format", SwLabFmtPage::Create, 0); + m_nOptionsId = AddTabPage("options", SwLabPrtPage::Create, 0); + m_nCardsId = AddTabPage("cards", SwVisitingCardPage::Create, 0); + m_sBusinessCardDlg = GetPageText(m_nCardsId); - GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC))); - GetOKButton().SetHelpId(HID_LABEL_INSERT); - GetOKButton().SetHelpText(aEmptyStr); // in order for generated help text to get used - - AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage ::Create, 0, sal_False, 0); - AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0); - AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0); - AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0); - AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 ); - AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0); - - - if(m_bLabel) + if (m_bLabel) { - RemoveTabPage(TP_BUSINESS_DATA); - RemoveTabPage(TP_PRIVATE_DATA); - RemoveTabPage(TP_VISITING_CARDS); + RemoveTabPage("business"); + RemoveTabPage("private"); + RemoveTabPage("cards"); + RemoveTabPage("medium"); + m_nLabelId = AddTabPage("labels", SwLabPage::Create, 0); } else { - SetText(sBusinessCardDlg); + RemoveTabPage("labels"); + RemoveTabPage("cards"); + m_nLabelId = AddTabPage("medium", SwLabPage::Create, 0); + m_nBusinessId = AddTabPage("business", SwBusinessDataPage::Create, 0 ); + m_nPrivateId = AddTabPage("private", SwPrivateDataPage::Create, 0); + SetText(m_sBusinessCardDlg); } // Read user label from writer.cfg SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL )); diff --git a/sw/source/ui/inc/label.hxx b/sw/source/ui/inc/label.hxx index 65cd0a4d6e28..a3e5060003e3 100644 --- a/sw/source/ui/inc/label.hxx +++ b/sw/source/ui/inc/label.hxx @@ -40,12 +40,16 @@ class SwLabDlg : public SfxTabDialog std::vector aTypeIds; std::vector aMakes; - SwLabRecs* pRecs; - String aLstGroup; - String sBusinessCardDlg; - String sFormat; - String sMedium; - sal_Bool m_bLabel; + SwLabRecs* pRecs; + String aLstGroup; + OUString m_sBusinessCardDlg; + bool m_bLabel; + sal_uInt16 m_nFormatId; + sal_uInt16 m_nOptionsId; + sal_uInt16 m_nLabelId; + sal_uInt16 m_nCardsId; + sal_uInt16 m_nBusinessId; + sal_uInt16 m_nPrivateId; void _ReplaceGroup( const String &rMake ); virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); @@ -72,7 +76,7 @@ public: void UpdateGroup( const String &rMake ) {_ReplaceGroup( rMake );} static void UpdateFieldInformation(::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel, const SwLabItem& rItem); - const String& GetBusinessCardStr() const {return sBusinessCardDlg;} + const OUString& GetBusinessCardStr() const {return m_sBusinessCardDlg;} SwLabelConfig& GetLabelsConfig() {return aLabelsCfg;} diff --git a/sw/uiconfig/swriter/ui/labeldialog.ui b/sw/uiconfig/swriter/ui/labeldialog.ui new file mode 100644 index 000000000000..cdca04e3e193 --- /dev/null +++ b/sw/uiconfig/swriter/ui/labeldialog.ui @@ -0,0 +1,203 @@ + + + + + False + 6 + Labels + dialog + + + False + vertical + 12 + + + False + end + + + _New Document + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + gtk-revert-to-saved + True + True + True + True + + + False + True + 3 + + + + + False + True + end + 0 + + + + + True + True + True + True + + + + + + True + False + Medium + + + False + + + + + + + + True + False + Labels + + + 1 + False + + + + + + + + True + False + Business Cards + + + 2 + False + + + + + + + + True + False + Private + + + 3 + False + + + + + + + + True + False + Business + + + 4 + False + + + + + + + + True + False + Format + + + 5 + False + + + + + + + + True + False + Options + + + 6 + False + + + + + False + True + 1 + + + + + + ok + cancel + help + reset + + + -- cgit