xref: /aoo42x/main/cui/source/inc/dlgname.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_DLG_NAME_HXX
28 #define _SVX_DLG_NAME_HXX
29 
30 
31 #ifndef _EDIT_HXX //autogen
32 #include <vcl/edit.hxx>
33 #endif
34 #ifndef _BUTTON_HXX //autogen
35 #include <vcl/button.hxx>
36 #endif
37 #ifndef _FIXED_HXX //autogen
38 #include <vcl/fixed.hxx>
39 #endif
40 #ifndef _DIALOG_HXX //autogen
41 #include <vcl/dialog.hxx>
42 #endif
43 #include <vcl/fixed.hxx>
44 
45 // #i68101#
46 #include <svtools/svmedit.hxx>
47 
48 /*************************************************************************
49 |*
50 |* Dialog zum Editieren eines Namens
51 |*
52 \************************************************************************/
53 class SvxNameDialog : public ModalDialog
54 {
55 private:
56 	FixedText		aFtDescription;
57 	Edit			aEdtName;
58 	OKButton		aBtnOK;
59 	CancelButton	aBtnCancel;
60 	HelpButton		aBtnHelp;
61 
62     Link            aCheckNameHdl;
63 #if _SOLAR__PRIVATE
64     DECL_LINK(ModifyHdl, Edit*);
65 #endif
66 
67 public:
68 	SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc );
69 
70     void    GetName( String& rName ){rName = aEdtName.GetText();}
71 
72     /** add a callback Link that is called whenever the content of the edit
73         field is changed.  The Link result determines wether the OK
74         Button is enabled (> 0) or disabled (== 0).
75 
76         @param rLink a Callback declared with DECL_LINK and implemented with
77                IMPL_LINK, that is executed on modification.
78 
79         @param bCheckImmediately If true, the Link is called directly after
80                setting it. It is recommended to set this flag to true to avoid
81                an inconsistent state if the initial String (given in the CTOR)
82                does not satisfy the check condition.
83 
84         @todo Remove the parameter bCheckImmediately and incorporate the 'true'
85               behaviour as default.
86      */
87     void    SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
88     {
89         aCheckNameHdl = rLink;
90         if ( bCheckImmediately )
91             aBtnOK.Enable( rLink.Call( this ) > 0 );
92     }
93 
94     void    SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);}
95 };
96 
97 ///////////////////////////////////////////////////////////////////////////////////////////////
98 // #i68101#
99 // Dialog for editing Object Title and Description
100 // plus uniqueness-callback-linkHandler
101 
102 class SvxObjectNameDialog : public ModalDialog
103 {
104 private:
105 	// name
106 	FixedText		aFtName;
107 	Edit			aEdtName;
108 
109 	// separator
110 	FixedLine		aFlSeparator;
111 
112 	// buttons
113 	HelpButton		aBtnHelp;
114 	OKButton		aBtnOK;
115 	CancelButton	aBtnCancel;
116 
117 	// callback link for name uniqueness
118     Link            aCheckNameHdl;
119 #if _SOLAR__PRIVATE
120     DECL_LINK(ModifyHdl, Edit*);
121 #endif
122 
123 public:
124 	// constructor
125 	SvxObjectNameDialog(Window* pWindow, const String& rName);
126 
127 	// data access
128     void GetName(String& rName) {rName = aEdtName.GetText(); }
129 
130 	// set handler
131     void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
132     {
133         aCheckNameHdl = rLink;
134 
135 		if(bCheckImmediately)
136 		{
137             aBtnOK.Enable(rLink.Call(this) > 0);
138 		}
139     }
140 };
141 
142 ///////////////////////////////////////////////////////////////////////////////////////////////
143 // #i68101#
144 // Dialog for editing Object Title and Description
145 
146 class SvxObjectTitleDescDialog : public ModalDialog
147 {
148 private:
149 	// title
150 	FixedText		aFtTitle;
151 	Edit			aEdtTitle;
152 
153 	// description
154 	FixedText		aFtDescription;
155 	MultiLineEdit	aEdtDescription;
156 
157 	// separator
158 	FixedLine		aFlSeparator;
159 
160 	// buttons
161 	HelpButton		aBtnHelp;
162 	OKButton		aBtnOK;
163 	CancelButton	aBtnCancel;
164 
165 public:
166 	// constructor
167 	SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
168 
169 	// data access
170     void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); }
171     void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); }
172 };
173 
174 ///////////////////////////////////////////////////////////////////////////////////////////////
175 
176 /*************************************************************************
177 |*
178 |* Dialog zum Abbrechen, Speichern oder Hinzufuegen
179 |*
180 \************************************************************************/
181 class SvxMessDialog : public ModalDialog
182 {
183 private:
184 	FixedText		aFtDescription;
185 	PushButton		aBtn1;
186 	PushButton		aBtn2;
187 	CancelButton	aBtnCancel;
188 	FixedImage		aFtImage;
189 	Image*			pImage;
190 #if _SOLAR__PRIVATE
191 	DECL_LINK( Button1Hdl, Button * );
192 	DECL_LINK( Button2Hdl, Button * );
193 #endif
194 public:
195 	SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
196 	~SvxMessDialog();
197 
198 	void	SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt );
199 };
200 
201 
202 
203 #endif // _SVX_DLG_NAME_HXX
204 
205