xref: /trunk/main/sfx2/inc/sfx2/passwd.hxx (revision 353d8f4d)
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 _SFX_PASSWD_HXX
24 #define _SFX_PASSWD_HXX
25 
26 #include "sal/config.h"
27 #include <sfx2/dllapi.h>
28 #include <vcl/button.hxx>
29 #include <vcl/dialog.hxx>
30 #include <vcl/edit.hxx>
31 #include <vcl/fixed.hxx>
32 #include <sfx2/app.hxx>
33 
34 // defines ---------------------------------------------------------------
35 
36 #define SHOWEXTRAS_NONE		 ((sal_uInt16)0x0000)
37 #define SHOWEXTRAS_USER		 ((sal_uInt16)0x0001)
38 #define SHOWEXTRAS_CONFIRM	 ((sal_uInt16)0x0002)
39 #define SHOWEXTRAS_PASSWORD2 ((sal_uInt16)0x0004)
40 #define SHOWEXTRAS_CONFIRM2  ((sal_uInt16)0x0008)
41 #define SHOWEXTRAS_ALL		 ((sal_uInt16)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM))
42 
43 // class SfxPasswordDialog -----------------------------------------------
44 
45 class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
46 {
47 private:
48 	FixedLine       maPasswordBox;
49 	FixedText		maUserFT;
50 	Edit			maUserED;
51 	FixedText		maPasswordFT;
52 	Edit			maPasswordED;
53 	FixedText		maConfirmFT;
54 	Edit			maConfirmED;
55     FixedLine       maPassword2Box;
56 	FixedText		maPassword2FT;
57 	Edit			maPassword2ED;
58 	FixedText		maConfirm2FT;
59 	Edit			maConfirm2ED;
60 
61 	OKButton		maOKBtn;
62 	CancelButton	maCancelBtn;
63 	HelpButton		maHelpBtn;
64 
65 	sal_uInt16			mnMinLen;
66 	sal_uInt16			mnExtras;
67 
68     bool            mbAsciiOnly;
69 	DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* );
70 	DECL_DLLPRIVATE_LINK( OKHdl, OKButton* );
71 
72 public:
73 	SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL );
74 
GetUser() const75 	String			GetUser() const	{ return maUserED.GetText(); }
GetPassword() const76 	String			GetPassword() const { return maPasswordED.GetText(); }
GetConfirm() const77 	String			GetConfirm() const { return maConfirmED.GetText(); }
78 
GetPassword2() const79 	String          GetPassword2() const { return maPassword2ED.GetText(); }
GetConfirm2() const80 	String          GetConfirm2() const { return maConfirm2ED.GetText(); }
SetGroup2Text(const String & i_rText)81 	void            SetGroup2Text( const String& i_rText ) { maPassword2Box.SetText( i_rText ); }
82 
83 	void 			SetMinLen( sal_uInt16 Len );
84     void            SetMaxLen( sal_uInt16 Len );
SetEditHelpId(const rtl::OString & rId)85 	void			SetEditHelpId( const rtl::OString& rId ) { maPasswordED.SetHelpId( rId ); }
ShowExtras(sal_uInt16 nExtras)86 	void			ShowExtras( sal_uInt16 nExtras ) { mnExtras = nExtras; }
AllowAsciiOnly(bool i_bAsciiOnly=true)87     void            AllowAsciiOnly( bool i_bAsciiOnly = true ) { mbAsciiOnly = i_bAsciiOnly; }
88 
89 	virtual short	Execute();
90 };
91 
92 #endif // #ifndef _SFX_PASSWD_HXX
93 
94