Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SFX_PASSWD_HXX
20 : #define _SFX_PASSWD_HXX
21 :
22 : #include "sal/config.h"
23 : #include <sfx2/dllapi.h>
24 : #include <vcl/button.hxx>
25 : #include <vcl/dialog.hxx>
26 : #include <vcl/edit.hxx>
27 : #include <vcl/fixed.hxx>
28 : #include <vcl/layout.hxx>
29 : #include <sfx2/app.hxx>
30 :
31 : // defines ---------------------------------------------------------------
32 :
33 : #define SHOWEXTRAS_NONE ((sal_uInt16)0x0000)
34 : #define SHOWEXTRAS_USER ((sal_uInt16)0x0001)
35 : #define SHOWEXTRAS_CONFIRM ((sal_uInt16)0x0002)
36 : #define SHOWEXTRAS_PASSWORD2 ((sal_uInt16)0x0004)
37 : #define SHOWEXTRAS_CONFIRM2 ((sal_uInt16)0x0008)
38 : #define SHOWEXTRAS_ALL ((sal_uInt16)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM))
39 :
40 : // class SfxPasswordDialog -----------------------------------------------
41 :
42 0 : class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
43 : {
44 : private:
45 : VclFrame* mpPassword1Box;
46 : FixedText* mpUserFT;
47 : Edit* mpUserED;
48 : FixedText* mpPassword1FT;
49 : Edit* mpPassword1ED;
50 : FixedText* mpConfirm1FT;
51 : Edit* mpConfirm1ED;
52 :
53 : VclFrame* mpPassword2Box;
54 : FixedText* mpPassword2FT;
55 : Edit* mpPassword2ED;
56 : FixedText* mpConfirm2FT;
57 : Edit* mpConfirm2ED;
58 :
59 : FixedText* mpMinLengthFT;
60 :
61 : OKButton* mpOKBtn;
62 :
63 : String maMinLenPwdStr;
64 : String maEmptyPwdStr;
65 : String maMainPwdStr;
66 : sal_uInt16 mnMinLen;
67 : sal_uInt16 mnExtras;
68 :
69 : bool mbAsciiOnly;
70 : DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*);
71 : DECL_DLLPRIVATE_LINK(OKHdl, void *);
72 :
73 : void SetPasswdText();
74 :
75 : public:
76 : SfxPasswordDialog(Window* pParent, const String* pGroupText = NULL);
77 :
78 0 : String GetUser() const
79 : {
80 0 : return mpUserED->GetText();
81 : }
82 0 : String GetPassword() const
83 : {
84 0 : return mpPassword1ED->GetText();
85 : }
86 0 : String GetConfirm() const
87 : {
88 0 : return mpConfirm1ED->GetText();
89 : }
90 0 : String GetPassword2() const
91 : {
92 0 : return mpPassword2ED->GetText();
93 : }
94 : String GetConfirm2() const
95 : {
96 : return mpConfirm2ED->GetText();
97 : }
98 0 : void SetGroup2Text(const String& i_rText)
99 : {
100 0 : mpPassword2Box->set_label(i_rText);
101 0 : }
102 : void SetMinLen(sal_uInt16 Len);
103 0 : void SetEditHelpId(const OString& rId)
104 : {
105 0 : mpPassword1ED->SetHelpId( rId );
106 0 : }
107 0 : void ShowExtras(sal_uInt16 nExtras)
108 : {
109 0 : mnExtras = nExtras;
110 0 : }
111 0 : void AllowAsciiOnly(bool i_bAsciiOnly = true)
112 : {
113 0 : mbAsciiOnly = i_bAsciiOnly;
114 0 : }
115 : virtual short Execute();
116 : };
117 :
118 : #endif // #ifndef _SFX_PASSWD_HXX
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|