From a4660b78efba2de2e0d4ce85f955a751038e416e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 26 Apr 2013 14:07:48 +0100 Subject: convert rename object dialog to .ui format Change-Id: I76b5c2d190b268de93973083f1f6ca41804008cf --- sw/UIConfig_swriter.mk | 1 + sw/inc/globals.hrc | 2 +- sw/inc/helpid.h | 1 - sw/inc/swabstdlg.hxx | 6 +- sw/source/ui/dialog/swdlgfact.cxx | 21 +--- sw/source/ui/dialog/swdlgfact.hxx | 6 +- sw/source/ui/inc/swrenamexnameddlg.hxx | 16 ++- sw/source/ui/utlui/content.cxx | 2 +- sw/source/ui/utlui/swrenamexnameddlg.cxx | 36 +++---- sw/source/ui/utlui/unotools.src | 51 +-------- sw/uiconfig/swriter/ui/renameobjectdialog.ui | 153 +++++++++++++++++++++++++++ 11 files changed, 191 insertions(+), 104 deletions(-) create mode 100644 sw/uiconfig/swriter/ui/renameobjectdialog.ui diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 1e58060782cb..775a88c3810e 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -96,6 +96,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/previewzoomdialog \ sw/uiconfig/swriter/ui/printoptionspage \ sw/uiconfig/swriter/ui/printeroptions \ + sw/uiconfig/swriter/ui/renameobjectdialog \ sw/uiconfig/swriter/ui/rowheight \ sw/uiconfig/swriter/ui/sortdialog \ sw/uiconfig/swriter/ui/splittable \ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index f12de51376e8..22b5f54c19a0 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -190,7 +190,7 @@ #define TP_INSERT_SECTION (RC_GLOBALS_BEGIN + 85) #define DLG_INSERT_SECTION (RC_GLOBALS_BEGIN + 86) #define DLG_SECTION_PROPERTIES (RC_GLOBALS_BEGIN + 87) -#define DLG_RENAME_XNAMED (RC_GLOBALS_BEGIN + 88) + #define DLG_MULTI_TOX (RC_GLOBALS_BEGIN + 89) #define TP_TOX_SELECT (RC_GLOBALS_BEGIN + 90) #define TP_TOX_ENTRY (RC_GLOBALS_BEGIN + 91) diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index a0b69b996ddf..92784ba51dd5 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -181,7 +181,6 @@ #define HID_INSERT_SECTION_PAGE "SW_HID_INSERT_SECTION_PAGE" #define HID_INSERT_SECTION_DLG "SW_HID_INSERT_SECTION_DLG" #define HID_SECTION_PROPERTIES_DLG "SW_HID_SECTION_PROPERTIES_DLG" -#define HID_RENAME_XNAMED "SW_HID_RENAME_XNAMED" #define HID_TP_TOX_SELECT "SW_HID_TP_TOX_SELECT" #define HID_TP_TOX_ENTRY "SW_HID_TP_TOX_ENTRY" #define HID_TOX_STYLES_PAGE "SW_HID_TOX_STYLES_PAGE" diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 17ed47c08139..d8d214895c2c 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -386,9 +386,9 @@ public: virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ) = 0; //add for SwFldDlg virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ) = 0; //add for SwFldEditDlg - virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess, int nResId ) = 0; + virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg(Window* pParent, //add for SwRenameXNamedDlg + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess) = 0; virtual AbstractSwModalRedlineAcceptDlg * CreateSwModalRedlineAcceptDlg(Window *pParent) = 0; virtual VclAbstractDialog* CreateTblMergeDialog( Window* pParent, sal_Bool& rWithPrev ) = 0; //add for SwMergeTblDlg diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 3a4e0c8cc5b1..6d766bff79ff 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1003,23 +1003,12 @@ SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& return 0; } -AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg( Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess,int nResId ) +AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg(Window* pParent, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess) { - SwRenameXNamedDlg* pDlg=NULL; - switch ( nResId ) - { - case DLG_RENAME_XNAMED : - pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSwRenameXNamedDlg_Impl( pDlg ); - return 0; + SwRenameXNamedDlg* pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess); + return new AbstractSwRenameXNamedDlg_Impl( pDlg ); } AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(Window *pParent) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 115e926a540c..da283f2e4481 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -485,9 +485,9 @@ public: const SfxItemSet* pItemSet, SwWrtShell* pSh); //add for SwTableTabDlg virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ); //add for SwFldDlg virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ); //add for SwFldEditDlg - virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess, int nResId ); + virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg(Window* pParent, //add for SwRenameXNamedDlg + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess); virtual AbstractSwModalRedlineAcceptDlg * CreateSwModalRedlineAcceptDlg(Window *pParent); //add for SwModalRedlineAcceptDlg virtual VclAbstractDialog* CreateTblMergeDialog(Window* pParent, sal_Bool& rWithPrev); //add for SwMergeTblDlg diff --git a/sw/source/ui/inc/swrenamexnameddlg.hxx b/sw/source/ui/inc/swrenamexnameddlg.hxx index a4e4a6e18554..968c89f69a14 100644 --- a/sw/source/ui/inc/swrenamexnameddlg.hxx +++ b/sw/source/ui/inc/swrenamexnameddlg.hxx @@ -33,14 +33,10 @@ class SwRenameXNamedDlg : public ModalDialog { - FixedLine aNameFL; - FixedText aNewNameFT; - NoSpaceEdit aNewNameED; - OKButton aOk; - CancelButton aCancel; - HelpButton aHelp; + NoSpaceEdit* m_pNewNameED; + OKButton* m_pOk; - String sRemoveWarning; + OUString m_sRemoveWarning; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess; @@ -55,8 +51,10 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess ); - void SetForbiddenChars( const String& rSet ) - { aNewNameED.SetForbiddenChars( rSet ); } + void SetForbiddenChars(const OUString& rSet) + { + m_pNewNameED->SetForbiddenChars(rSet); + } void SetAlternativeAccess( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xSecond, diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index dfd6aebeba78..0d995dd55694 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -2889,7 +2889,7 @@ void SwContentTree::EditEntry(SvTreeListEntry* pEntry, sal_uInt8 nMode) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwRenameXNamedDlg* pDlg = pFact->CreateSwRenameXNamedDlg( this, xNamed, xNameAccess, DLG_RENAME_XNAMED ); + AbstractSwRenameXNamedDlg* pDlg = pFact->CreateSwRenameXNamedDlg(this, xNamed, xNameAccess); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if(xSecond.is()) pDlg->SetAlternativeAccess( xSecond, xThird); diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 31979e3ddf6b..1da76d3e4094 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -54,36 +54,32 @@ using namespace ::com::sun::star; SwRenameXNamedDlg::SwRenameXNamedDlg( Window* pWin, uno::Reference< container::XNamed > & xN, - uno::Reference< container::XNameAccess > & xNA ) : - ModalDialog(pWin, SW_RES(DLG_RENAME_XNAMED)), - aNameFL(this, SW_RES(FL_NAME)), - aNewNameFT(this, SW_RES(FT_NEW_NAME)), - aNewNameED(this, SW_RES(ED_NEW_NAME)), - aOk(this, SW_RES(PB_OK)), - aCancel(this, SW_RES(PB_CANCEL)), - aHelp(this, SW_RES(PB_HELP)), - xNamed(xN), - xNameAccess(xNA) + uno::Reference< container::XNameAccess > & xNA ) + : ModalDialog(pWin, "RenameObjectDialog", + "modules/swriter/ui/renameobjectdialog.ui") + , m_sRemoveWarning(SW_RESSTR(STR_REMOVE_WARNING)) + , xNamed(xN) + , xNameAccess(xNA) { - FreeResource(); - sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING)); + get(m_pNewNameED, "entry"); + get(m_pOk, "ok"); String sTmp(GetText()); - aNewNameED.SetText(xNamed->getName()); - aNewNameED.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); + m_pNewNameED->SetText(xNamed->getName()); + m_pNewNameED->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); sTmp += String(xNamed->getName()); SetText(sTmp); - aOk.SetClickHdl(LINK(this, SwRenameXNamedDlg, OkHdl)); - aNewNameED.SetModifyHdl(LINK(this, SwRenameXNamedDlg, ModifyHdl)); - aOk.Enable(sal_False); + m_pOk->SetClickHdl(LINK(this, SwRenameXNamedDlg, OkHdl)); + m_pNewNameED->SetModifyHdl(LINK(this, SwRenameXNamedDlg, ModifyHdl)); + m_pOk->Enable(sal_False); } IMPL_LINK_NOARG(SwRenameXNamedDlg, OkHdl) { try { - xNamed->setName(aNewNameED.GetText()); + xNamed->setName(m_pNewNameED->GetText()); } catch (const uno::RuntimeException&) { @@ -110,12 +106,12 @@ IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit) if(sTmp.Len() != nLen) { pEdit->SetText(sTmp); - String sWarning(sRemoveWarning); + String sWarning(m_sRemoveWarning); sWarning += sMsg; InfoBox(this, sWarning).Execute(); } - aOk.Enable(sTmp.Len() && !xNameAccess->hasByName(sTmp) + m_pOk->Enable(sTmp.Len() && !xNameAccess->hasByName(sTmp) && (!xSecondAccess.is() || !xSecondAccess->hasByName(sTmp)) && (!xThirdAccess.is() || !xThirdAccess->hasByName(sTmp)) ); diff --git a/sw/source/ui/utlui/unotools.src b/sw/source/ui/utlui/unotools.src index c7425d6fb800..7ee442ed1589 100644 --- a/sw/source/ui/utlui/unotools.src +++ b/sw/source/ui/utlui/unotools.src @@ -21,60 +21,11 @@ #include #include -ModalDialog DLG_RENAME_XNAMED -{ - HelpID = HID_RENAME_XNAMED ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 220 , 60 ) ; - Moveable = TRUE ; - FixedText FT_NEW_NAME - { - Pos = MAP_APPFONT ( 12 , 15 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "New name"; - }; - Edit ED_NEW_NAME - { - HelpID = "sw:Edit:DLG_RENAME_XNAMED:ED_NEW_NAME"; - Pos = MAP_APPFONT ( 65 , 13 ) ; - Size = MAP_APPFONT ( 87 , 12 ) ; - Border = TRUE; - }; - FixedLine FL_NAME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 152 , 8 ) ; - Text [ en-US ] = "Change name"; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 164 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 164 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 164 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - Text [ en-US ] = "Rename object: "; -}; String STR_SERVICE_UNAVAILABLE { Text [ en-US ] = "The following service is not available: "; }; + Resource RES_FRMEX_MENU { StringArray 1 diff --git a/sw/uiconfig/swriter/ui/renameobjectdialog.ui b/sw/uiconfig/swriter/ui/renameobjectdialog.ui new file mode 100644 index 000000000000..8e98a39a984b --- /dev/null +++ b/sw/uiconfig/swriter/ui/renameobjectdialog.ui @@ -0,0 +1,153 @@ + + + + + + False + 6 + Rename object: + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + 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 + + + + + False + True + end + 0 + + + + + True + False + True + True + 0 + none + + + True + False + True + True + 6 + 12 + + + True + False + True + True + 6 + 12 + + + True + False + 0 + New name + True + entry + + + 0 + 0 + 1 + 1 + + + + + True + True + True + + + 1 + 0 + 1 + 1 + + + + + + + + + True + False + Change name + + + + + + + + False + True + 1 + + + + + + ok + cancel + help + + + -- cgit