/************************************************************************* * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dlgname.cxx,v $ * * $Revision: 1.6 $ * * last change: $Author: rt $ $Date: 2005-09-08 20:59:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. * * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2005 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * ************************************************************************/ #ifdef SVX_DLLIMPLEMENTATION #undef SVX_DLLIMPLEMENTATION #endif #include #include #ifndef _SHL_HXX #include #endif #ifndef _TOOLS_DEBUG_HXX #include #endif #ifndef _SV_MSGBOX_HXX #include #endif #pragma hdrstop #include "dialogs.hrc" #include "dlgname.hxx" #include "defdlgname.hxx" //CHINA001 #include "dlgname.hrc" #include "dialmgr.hxx" /************************************************************************* |* |* Dialog zum Editieren eines Namens |* \************************************************************************/ SvxNameDialog::SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ) : ModalDialog ( pWindow, ResId( RID_SVXDLG_NAME, DIALOG_MGR() ) ), aFtDescription ( this, ResId( FT_DESCRIPTION ) ), aEdtName ( this, ResId( EDT_STRING ) ), aBtnOK ( this, ResId( BTN_OK ) ), aBtnCancel ( this, ResId( BTN_CANCEL ) ), aBtnHelp ( this, ResId( BTN_HELP ) ) { FreeResource(); aFtDescription.SetText( rDesc ); aEdtName.SetText( rName ); aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); ModifyHdl(&aEdtName); aEdtName.SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); } /* -----------------------------27.02.2002 15:22------------------------------ ---------------------------------------------------------------------------*/ IMPL_LINK(SvxNameDialog, ModifyHdl, Edit*, pEdit) { if(aCheckNameHdl.IsSet()) aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); return 0; } /************************************************************************* |* |* Dialog zum Abbrechen, Speichern oder Hinzufuegen |* \************************************************************************/ SvxMessDialog::SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg ) : ModalDialog ( pWindow, ResId( RID_SVXDLG_MESSBOX, DIALOG_MGR() ) ), aFtDescription ( this, ResId( FT_DESCRIPTION ) ), aBtn1 ( this, ResId( BTN_1 ) ), aBtn2 ( this, ResId( BTN_2 ) ), aBtnCancel ( this, ResId( BTN_CANCEL ) ), aFtImage ( this ) { FreeResource(); 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(); } SetText( rText ); aFtDescription.SetText( rDesc ); aBtn1.SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) ); aBtn2.SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) ); } SvxMessDialog::~SvxMessDialog() { if( pImage ) delete pImage; } /*************************************************************************/ IMPL_LINK_INLINE_START( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) { EndDialog( RET_BTN_1 ); return 0; } IMPL_LINK_INLINE_END( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) /*************************************************************************/ IMPL_LINK_INLINE_START( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) { EndDialog( RET_BTN_2 ); return 0; } IMPL_LINK_INLINE_END( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) /*************************************************************************/ void SvxMessDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt ) { switch ( nBtnId ) { case MESS_BTN_1: aBtn1.SetText( rNewTxt ); break; case MESS_BTN_2: aBtn2.SetText( rNewTxt ); break; default: DBG_ERROR( "Falsche Button-Nummer!!!" ); } }