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