1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgname.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_DLG_NAME_HXX
31 #define _SVX_DLG_NAME_HXX
34 #ifndef _EDIT_HXX //autogen
35 #include <vcl/edit.hxx>
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
40 #ifndef _FIXED_HXX //autogen
41 #include <vcl/fixed.hxx>
43 #ifndef _DIALOG_HXX //autogen
44 #include <vcl/dialog.hxx>
46 #include <vcl/fixed.hxx>
49 #include <svtools/svmedit.hxx>
51 /*************************************************************************
53 |* Dialog zum Editieren eines Namens
55 \************************************************************************/
56 class SvxNameDialog
: public ModalDialog
59 FixedText aFtDescription
;
62 CancelButton aBtnCancel
;
67 DECL_LINK(ModifyHdl
, Edit
*);
71 SvxNameDialog( Window
* pWindow
, const String
& rName
, const String
& rDesc
);
73 void GetName( String
& rName
){rName
= aEdtName
.GetText();}
75 /** add a callback Link that is called whenever the content of the edit
76 field is changed. The Link result determines wether the OK
77 Button is enabled (> 0) or disabled (== 0).
79 @param rLink a Callback declared with DECL_LINK and implemented with
80 IMPL_LINK, that is executed on modification.
82 @param bCheckImmediately If true, the Link is called directly after
83 setting it. It is recommended to set this flag to true to avoid
84 an inconsistent state if the initial String (given in the CTOR)
85 does not satisfy the check condition.
87 @todo Remove the parameter bCheckImmediately and incorporate the 'true'
90 void SetCheckNameHdl( const Link
& rLink
, bool bCheckImmediately
= false )
92 aCheckNameHdl
= rLink
;
93 if ( bCheckImmediately
)
94 aBtnOK
.Enable( rLink
.Call( this ) > 0 );
97 void SetEditHelpId(ULONG nHelpId
) {aEdtName
.SetHelpId(nHelpId
);}
100 ///////////////////////////////////////////////////////////////////////////////////////////////
102 // Dialog for editing Object Title and Description
103 // plus uniqueness-callback-linkHandler
105 class SvxObjectNameDialog
: public ModalDialog
113 FixedLine aFlSeparator
;
118 CancelButton aBtnCancel
;
120 // callback link for name uniqueness
123 DECL_LINK(ModifyHdl
, Edit
*);
128 SvxObjectNameDialog(Window
* pWindow
, const String
& rName
);
131 void GetName(String
& rName
) {rName
= aEdtName
.GetText(); }
134 void SetCheckNameHdl(const Link
& rLink
, bool bCheckImmediately
= false)
136 aCheckNameHdl
= rLink
;
138 if(bCheckImmediately
)
140 aBtnOK
.Enable(rLink
.Call(this) > 0);
145 ///////////////////////////////////////////////////////////////////////////////////////////////
147 // Dialog for editing Object Title and Description
149 class SvxObjectTitleDescDialog
: public ModalDialog
157 FixedText aFtDescription
;
158 MultiLineEdit aEdtDescription
;
161 FixedLine aFlSeparator
;
166 CancelButton aBtnCancel
;
170 SvxObjectTitleDescDialog(Window
* pWindow
, const String
& rTitle
, const String
& rDesc
);
173 void GetTitle(String
& rTitle
) {rTitle
= aEdtTitle
.GetText(); }
174 void GetDescription(String
& rDescription
) {rDescription
= aEdtDescription
.GetText(); }
177 ///////////////////////////////////////////////////////////////////////////////////////////////
179 /*************************************************************************
181 |* Dialog zum Abbrechen, Speichern oder Hinzufuegen
183 \************************************************************************/
184 class SvxMessDialog
: public ModalDialog
187 FixedText aFtDescription
;
190 CancelButton aBtnCancel
;
194 DECL_LINK( Button1Hdl
, Button
* );
195 DECL_LINK( Button2Hdl
, Button
* );
198 SvxMessDialog( Window
* pWindow
, const String
& rText
, const String
& rDesc
, Image
* pImg
= NULL
);
201 void SetButtonText( USHORT nBtnId
, const String
& rNewTxt
);
206 #endif // _SVX_DLG_NAME_HXX