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 INCLUDED_SFX2_PASSWD_HXX
20 : #define INCLUDED_SFX2_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 : #include <o3tl/typed_flags_set.hxx>
31 :
32 : // defines ---------------------------------------------------------------
33 :
34 : enum class SfxShowExtras
35 : {
36 : NONE = 0x0000,
37 : USER = 0x0001,
38 : CONFIRM = 0x0002,
39 : PASSWORD2 = 0x0004,
40 : CONFIRM2 = 0x0008,
41 : ALL = USER | CONFIRM
42 : };
43 : namespace o3tl
44 : {
45 : template<> struct typed_flags<SfxShowExtras> : is_typed_flags<SfxShowExtras, 0x0f> {};
46 : }
47 :
48 : // class SfxPasswordDialog -----------------------------------------------
49 :
50 : class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
51 : {
52 : private:
53 : VclPtr<VclFrame> mpPassword1Box;
54 : VclPtr<FixedText> mpUserFT;
55 : VclPtr<Edit> mpUserED;
56 : VclPtr<FixedText> mpPassword1FT;
57 : VclPtr<Edit> mpPassword1ED;
58 : VclPtr<FixedText> mpConfirm1FT;
59 : VclPtr<Edit> mpConfirm1ED;
60 :
61 : VclPtr<VclFrame> mpPassword2Box;
62 : VclPtr<FixedText> mpPassword2FT;
63 : VclPtr<Edit> mpPassword2ED;
64 : VclPtr<FixedText> mpConfirm2FT;
65 : VclPtr<Edit> mpConfirm2ED;
66 :
67 : VclPtr<FixedText> mpMinLengthFT;
68 :
69 : VclPtr<OKButton> mpOKBtn;
70 :
71 : OUString maMinLenPwdStr;
72 : OUString maMinLenPwdStr1;
73 : OUString maEmptyPwdStr;
74 : OUString maMainPwdStr;
75 : sal_uInt16 mnMinLen;
76 : SfxShowExtras mnExtras;
77 :
78 : bool mbAsciiOnly;
79 : DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*);
80 : DECL_DLLPRIVATE_LINK(OKHdl, void *);
81 :
82 : void SetPasswdText();
83 :
84 : public:
85 : SfxPasswordDialog(vcl::Window* pParent, const OUString* pGroupText = NULL);
86 : virtual ~SfxPasswordDialog();
87 : virtual void dispose() SAL_OVERRIDE;
88 :
89 0 : OUString GetUser() const
90 : {
91 0 : return mpUserED->GetText();
92 : }
93 0 : OUString GetPassword() const
94 : {
95 0 : return mpPassword1ED->GetText();
96 : }
97 0 : OUString GetConfirm() const
98 : {
99 0 : return mpConfirm1ED->GetText();
100 : }
101 0 : OUString GetPassword2() const
102 : {
103 0 : return mpPassword2ED->GetText();
104 : }
105 0 : OUString GetConfirm2() const
106 : {
107 0 : return mpConfirm2ED->GetText();
108 : }
109 0 : void SetGroup2Text(const OUString& i_rText)
110 : {
111 0 : mpPassword2Box->set_label(i_rText);
112 0 : }
113 : void SetMinLen(sal_uInt16 Len);
114 0 : void SetEditHelpId(const OString& rId)
115 : {
116 0 : mpPassword1ED->SetHelpId( rId );
117 0 : }
118 0 : void ShowExtras(SfxShowExtras nExtras)
119 : {
120 0 : mnExtras = nExtras;
121 0 : }
122 0 : void AllowAsciiOnly(bool i_bAsciiOnly = true)
123 : {
124 0 : mbAsciiOnly = i_bAsciiOnly;
125 0 : }
126 :
127 : void ShowMinLengthText(bool bShow);
128 :
129 : virtual short Execute() SAL_OVERRIDE;
130 : };
131 :
132 : #endif // INCLUDED_SFX2_PASSWD_HXX
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|