xref: /aoo42x/main/cui/source/inc/dlgname.hxx (revision 940681c7)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_DLG_NAME_HXX
24 #define _SVX_DLG_NAME_HXX
25 
26 
27 #ifndef _EDIT_HXX //autogen
28 #include <vcl/edit.hxx>
29 #endif
30 #ifndef _BUTTON_HXX //autogen
31 #include <vcl/button.hxx>
32 #endif
33 #ifndef _FIXED_HXX //autogen
34 #include <vcl/fixed.hxx>
35 #endif
36 #ifndef _DIALOG_HXX //autogen
37 #include <vcl/dialog.hxx>
38 #endif
39 #include <vcl/fixed.hxx>
40 
41 // #i68101#
42 #include <svtools/svmedit.hxx>
43 
44 /*************************************************************************
45 |*
46 |* Dialog zum Editieren eines Namens
47 |*
48 \************************************************************************/
49 class SvxNameDialog : public ModalDialog
50 {
51 private:
52 	FixedText		aFtDescription;
53 	Edit			aEdtName;
54 	OKButton		aBtnOK;
55 	CancelButton	aBtnCancel;
56 	HelpButton		aBtnHelp;
57 
58     Link            aCheckNameHdl;
59 #if _SOLAR__PRIVATE
60     DECL_LINK(ModifyHdl, Edit*);
61 #endif
62 
63 public:
64 	SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc );
65 
GetName(String & rName)66     void    GetName( String& rName ){rName = aEdtName.GetText();}
67 
68     /** add a callback Link that is called whenever the content of the edit
69         field is changed.  The Link result determines whether the OK
70         Button is enabled (> 0) or disabled (== 0).
71 
72         @param rLink a Callback declared with DECL_LINK and implemented with
73                IMPL_LINK, that is executed on modification.
74 
75         @param bCheckImmediately If true, the Link is called directly after
76                setting it. It is recommended to set this flag to true to avoid
77                an inconsistent state if the initial String (given in the CTOR)
78                does not satisfy the check condition.
79 
80         @todo Remove the parameter bCheckImmediately and incorporate the 'true'
81               behaviour as default.
82      */
SetCheckNameHdl(const Link & rLink,bool bCheckImmediately=false)83     void    SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
84     {
85         aCheckNameHdl = rLink;
86         if ( bCheckImmediately )
87             aBtnOK.Enable( rLink.Call( this ) > 0 );
88     }
89 
SetEditHelpId(const rtl::OString & aHelpId)90     void    SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);}
91 };
92 
93 ///////////////////////////////////////////////////////////////////////////////////////////////
94 // #i68101#
95 // Dialog for editing Object Title and Description
96 // plus uniqueness-callback-linkHandler
97 
98 class SvxObjectNameDialog : public ModalDialog
99 {
100 private:
101 	// name
102 	FixedText		aFtName;
103 	Edit			aEdtName;
104 
105 	// separator
106 	FixedLine		aFlSeparator;
107 
108 	// buttons
109 	HelpButton		aBtnHelp;
110 	OKButton		aBtnOK;
111 	CancelButton	aBtnCancel;
112 
113 	// callback link for name uniqueness
114     Link            aCheckNameHdl;
115 #if _SOLAR__PRIVATE
116     DECL_LINK(ModifyHdl, Edit*);
117 #endif
118 
119 public:
120 	// constructor
121 	SvxObjectNameDialog(Window* pWindow, const String& rName);
122 
123 	// data access
GetName(String & rName)124     void GetName(String& rName) {rName = aEdtName.GetText(); }
125 
126 	// set handler
SetCheckNameHdl(const Link & rLink,bool bCheckImmediately=false)127     void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
128     {
129         aCheckNameHdl = rLink;
130 
131 		if(bCheckImmediately)
132 		{
133             aBtnOK.Enable(rLink.Call(this) > 0);
134 		}
135     }
136 };
137 
138 ///////////////////////////////////////////////////////////////////////////////////////////////
139 // #i68101#
140 // Dialog for editing Object Title and Description
141 
142 class SvxObjectTitleDescDialog : public ModalDialog
143 {
144 private:
145 	// title
146 	FixedText		aFtTitle;
147 	Edit			aEdtTitle;
148 
149 	// description
150 	FixedText		aFtDescription;
151 	MultiLineEdit	aEdtDescription;
152 
153 	// separator
154 	FixedLine		aFlSeparator;
155 
156 	// buttons
157 	HelpButton		aBtnHelp;
158 	OKButton		aBtnOK;
159 	CancelButton	aBtnCancel;
160 
161 public:
162 	// constructor
163 	SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
164 
165 	// data access
GetTitle(String & rTitle)166     void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); }
GetDescription(String & rDescription)167     void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); }
168 };
169 
170 ///////////////////////////////////////////////////////////////////////////////////////////////
171 
172 /*************************************************************************
173 |*
174 |* Dialog zum Abbrechen, Speichern oder Hinzufuegen
175 |*
176 \************************************************************************/
177 class SvxMessDialog : public ModalDialog
178 {
179 private:
180 	FixedText		aFtDescription;
181 	PushButton		aBtn1;
182 	PushButton		aBtn2;
183 	CancelButton	aBtnCancel;
184 	FixedImage		aFtImage;
185 	Image*			pImage;
186 #if _SOLAR__PRIVATE
187 	DECL_LINK( Button1Hdl, Button * );
188 	DECL_LINK( Button2Hdl, Button * );
189 #endif
190 public:
191 	SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
192 	~SvxMessDialog();
193 
194 	void	SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt );
195 };
196 
197 
198 
199 #endif // _SVX_DLG_NAME_HXX
200 
201