diff options
author | Robert Roth <robert.roth.off@gmail.com> | 2013-01-25 03:27:27 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-01-25 12:31:39 +0000 |
commit | 45dc5f7f4ef579c848a83f5679658977303527bb (patch) | |
tree | df6beaddf621ad1c691982390b080cda7831fc61 /cui/source/dialogs | |
parent | 71a8f79f4bdf567b6fce23091ca1663455cadba9 (diff) |
Object name, description dialog and messagebox ported to UI files
Change-Id: Iad23998c9ccde22abad9d894af3dd6df7c92564f
Reviewed-on: https://gerrit.libreoffice.org/1857
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r-- | cui/source/dialogs/dlgname.cxx | 117 | ||||
-rw-r--r-- | cui/source/dialogs/dlgname.hrc | 36 | ||||
-rw-r--r-- | cui/source/dialogs/dlgname.src | 239 |
3 files changed, 48 insertions, 344 deletions
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx index 66b465c9c428..a3af8bdd0f8e 100644 --- a/cui/source/dialogs/dlgname.cxx +++ b/cui/source/dialogs/dlgname.cxx @@ -24,7 +24,6 @@ #include "dlgname.hxx" #include "defdlgname.hxx" -#include "dlgname.hrc" #include <dialmgr.hxx> #define MAX_DESCRIPTION_LINES ((long)5) @@ -36,40 +35,37 @@ \************************************************************************/ SvxNameDialog::SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_NAME ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aEdtName ( this, CUI_RES( EDT_STRING ) ), - aBtnOK ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aBtnHelp ( this, CUI_RES( BTN_HELP ) ) + ModalDialog ( pWindow, "NameDialog", "cui/ui/namedialog.ui" ) { - FreeResource(); + get(pBtnOK, "ok"); + get(pFtDescription, "description_label"); + get(pEdtName, "name_entry"); - aFtDescription.SetText( rDesc ); - aEdtName.SetText( rName ); - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); + pFtDescription->SetText( rDesc ); + pEdtName->SetText( rName ); + pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); + ModifyHdl(&pEdtName); + pEdtName->SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); // dynamic height of the description field - Size aSize = aFtDescription.GetSizePixel(); - long nTxtWidth = aFtDescription.GetCtrlTextWidth( rDesc ); + Size aSize = pFtDescription->GetSizePixel(); + long nTxtWidth = pFtDescription->GetCtrlTextWidth( rDesc ); if ( nTxtWidth > aSize.Width() ) { - long nLines = Min( ( nTxtWidth / aSize.Width() + 1 ), MAX_DESCRIPTION_LINES ); + long nLines = Min( ( nTxtWidth / (aSize.Width()+1) + 1 ), MAX_DESCRIPTION_LINES ); long nHeight = aSize.Height(); aSize.Height() = nHeight * nLines; - aFtDescription.SetSizePixel( aSize ); - Point aPnt = aEdtName.GetPosPixel(); + pFtDescription->SetSizePixel( aSize ); + Point aPnt = pEdtName->GetPosPixel(); aPnt.Y() += ( aSize.Height() - nHeight ); - aEdtName.SetPosPixel( aPnt ); + pEdtName->SetPosPixel( aPnt ); } } IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl) { if(aCheckNameHdl.IsSet()) - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); + pBtnOK->Enable(aCheckNameHdl.Call(this) > 0); return 0; } @@ -80,31 +76,25 @@ IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl) SvxObjectNameDialog::SvxObjectNameDialog( Window* pWindow, - const String& rName) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_NAME)), - aFtName(this, CUI_RES(NTD_FT_NAME)), - aEdtName(this, CUI_RES(NTD_EDT_NAME)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_A)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) + const String& rName) : + ModalDialog ( pWindow, "ObjectNameDialog", "cui/ui/namedialog.ui" ) { - FreeResource(); - + get(pBtnOK, "object_name_ok"); + get(pEdtName, "object_name_entry"); // set name - aEdtName.SetText(rName); + pEdtName->SetText(rName); // activate name - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl)); + pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); + ModifyHdl(&pEdtName); + pEdtName->SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl)); } IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl) { if(aCheckNameHdl.IsSet()) { - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); + pBtnOK->Enable(aCheckNameHdl.Call(this) > 0); } return 0; @@ -117,25 +107,17 @@ IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl) SvxObjectTitleDescDialog::SvxObjectTitleDescDialog( Window* pWindow, const String& rTitle, - const String& rDescription) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_TITLE_DESC)), - aFtTitle(this, CUI_RES(NTD_FT_TITLE)), - aEdtTitle(this, CUI_RES(NTD_EDT_TITLE)), - aFtDescription(this, CUI_RES(NTD_FT_DESC)), - aEdtDescription(this, CUI_RES(NTD_EDT_DESC)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_B)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) + const String& rDescription) : + ModalDialog ( pWindow, "ObjectTitleDescDialog", "cui/ui/namedialog.ui" ) { - FreeResource(); - + get(pEdtTitle, "object_title_entry"); + get(pEdtDescription, "desc_entry"); // set title & desc - aEdtTitle.SetText(rTitle); - aEdtDescription.SetText(rDescription); + pEdtTitle->SetText(rTitle); + pEdtDescription->SetText(rDescription); // activate title - aEdtTitle.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); + pEdtTitle->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -147,30 +129,27 @@ SvxObjectTitleDescDialog::SvxObjectTitleDescDialog( \************************************************************************/ SvxMessDialog::SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_MESSBOX ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aBtn1 ( this, CUI_RES( BTN_1 ) ), - aBtn2 ( this, CUI_RES( BTN_2 ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aFtImage ( this ) + ModalDialog ( pWindow, "MessBox", "cui/ui/namedialog.ui" ) { - FreeResource(); - + get(pBtn1, "mess_box_btn1"); + get(pBtn2, "mess_box_btn2"); + get(pFtDescription, "mess_box_description"); + get(pFtImage, "mess_box_image"); if( pImg ) { pImage = new Image( *pImg ); - aFtImage.SetImage( *pImage ); - aFtImage.SetStyle( ( aFtImage.GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK ); - aFtImage.SetPosSizePixel( LogicToPixel( Point( 3, 6 ), MAP_APPFONT ), - aFtImage.GetImage().GetSizePixel() ); - aFtImage.Show(); + pFtImage->SetImage( *pImage ); + pFtImage->SetStyle( ( pFtImage->GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK ); + pFtImage->SetPosSizePixel( LogicToPixel( Point( 3, 6 ), MAP_APPFONT ), + pFtImage->GetImage().GetSizePixel() ); + pFtImage->Show(); } SetText( rText ); - aFtDescription.SetText( rDesc ); + pFtDescription->SetText( rDesc ); - aBtn1.SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) ); - aBtn2.SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) ); + pBtn1->SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) ); + pBtn2->SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) ); } SvxMessDialog::~SvxMessDialog() @@ -204,15 +183,15 @@ void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ) switch ( nBtnId ) { case MESS_BTN_1: - aBtn1.SetText( rNewTxt ); + pBtn1->SetText( rNewTxt ); break; case MESS_BTN_2: - aBtn2.SetText( rNewTxt ); + pBtn2->SetText( rNewTxt ); break; default: - OSL_FAIL( "Falsche Button-Nummer!!!" ); + OSL_FAIL( "Invalid button number!!!" ); } } diff --git a/cui/source/dialogs/dlgname.hrc b/cui/source/dialogs/dlgname.hrc deleted file mode 100644 index f034cd6db8f4..000000000000 --- a/cui/source/dialogs/dlgname.hrc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#define EDT_STRING 1 -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FT_DESCRIPTION 1 -#define BTN_1 1 -#define BTN_2 2 - -// #i68101# -#define NTD_FT_NAME 2 -#define NTD_EDT_NAME 2 -#define NTD_FT_TITLE 3 -#define NTD_EDT_TITLE 3 -#define NTD_FT_DESC 4 -#define NTD_EDT_DESC 4 -#define FL_SEPARATOR_A 1 -#define FL_SEPARATOR_B 2 - diff --git a/cui/source/dialogs/dlgname.src b/cui/source/dialogs/dlgname.src deleted file mode 100644 index 14c464c14510..000000000000 --- a/cui/source/dialogs/dlgname.src +++ /dev/null @@ -1,239 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cuires.hrc> -#include "helpid.hrc" -#include "dlgname.hrc" - -// RID_SVXDLG_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_NAME -{ - HelpId = HID_DLG_NAME ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 63 ) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - WordBreak = TRUE ; - }; - Edit EDT_STRING - { - HelpID = "cui:Edit:RID_SVXDLG_NAME:EDT_STRING"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 112 , 12 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 124 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 124 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 124 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECT_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_NAME -{ - HelpId = HID_DLG_OBJECT_NAME; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 54 + 2) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - - // name - FixedText NTD_FT_NAME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - Text [ en-US ] = "~Name"; - }; - Edit NTD_EDT_NAME - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_NAME:NTD_EDT_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // divider - FixedLine FL_SEPARATOR_A - { - Pos = MAP_APPFONT ( 0 , 39 - 6 - 2 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECTTITLE_DESC ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_TITLE_DESC -{ - HelpId = HID_DLG_OBJECT_TITLE_DESC; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 78 + 27 ) ; - Text [ en-US ] = "Description" ; - Moveable = TRUE ; - - // title - FixedText NTD_FT_TITLE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Title"; - }; - Edit NTD_EDT_TITLE - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_TITLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // description - FixedText NTD_FT_DESC - { - Pos = MAP_APPFONT ( 6 , 30 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Description"; - }; - MultiLineEdit NTD_EDT_DESC - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_DESC"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 41 ) ; - Size = MAP_APPFONT ( 168 , (12 * 3) - 2 ) ; - TabStop = TRUE ; - IgnoreTab = TRUE; - VScroll = TRUE; - }; - - // divider - FixedLine FL_SEPARATOR_B - { - Pos = MAP_APPFONT ( 0 , 41 + 39 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// RID_SVXDLG_MESSBOX ------------------------------------------------------- - -ModalDialog RID_SVXDLG_MESSBOX -{ - HelpId = HID_DLG_MESSBOX ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 212 , 64 ) ; - Text = "" ; - Moveable = TRUE ; - PushButton BTN_1 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_1"; - Pos = MAP_APPFONT ( 25 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_2 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_2"; - Pos = MAP_APPFONT ( 78 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 131 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 28 , 6 ) ; - Size = MAP_APPFONT ( 200 , 35 ) ; - WordBreak = TRUE ; - }; -}; - // ********************************************************************** EOF |