Don't search for old (<= 2.0) .NET SDK anymore
[LibreOffice.git] / include / sfx2 / passwd.hxx
bloba09364cf69182c4fac6e6913b280971a33749d72
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX2_PASSWD_HXX
20 #define INCLUDED_SFX2_PASSWD_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sfx2/app.hxx>
25 #include <vcl/weld.hxx>
26 #include <o3tl/typed_flags_set.hxx>
28 // defines ---------------------------------------------------------------
30 enum class SfxShowExtras
32 NONE = 0x0000,
33 USER = 0x0001,
34 CONFIRM = 0x0002,
35 PASSWORD2 = 0x0004,
36 CONFIRM2 = 0x0008,
37 ALL = USER | CONFIRM
39 namespace o3tl
41 template<> struct typed_flags<SfxShowExtras> : is_typed_flags<SfxShowExtras, 0x0f> {};
44 // class SfxPasswordDialog -----------------------------------------------
46 class SFX2_DLLPUBLIC SfxPasswordDialog : public weld::GenericDialogController
48 private:
49 std::unique_ptr<weld::Frame> m_xPassword1Box;
50 std::unique_ptr<weld::Label> m_xUserFT;
51 std::unique_ptr<weld::Entry> m_xUserED;
52 std::unique_ptr<weld::Label> m_xPassword1FT;
53 std::unique_ptr<weld::Entry> m_xPassword1ED;
54 std::unique_ptr<weld::Label> m_xConfirm1FT;
55 std::unique_ptr<weld::Entry> m_xConfirm1ED;
57 std::unique_ptr<weld::Frame> m_xPassword2Box;
58 std::unique_ptr<weld::Label> m_xPassword2FT;
59 std::unique_ptr<weld::Entry> m_xPassword2ED;
60 std::unique_ptr<weld::Label> m_xConfirm2FT;
61 std::unique_ptr<weld::Entry> m_xConfirm2ED;
63 std::unique_ptr<weld::Label> m_xMinLengthFT;
65 std::unique_ptr<weld::Button> m_xOKBtn;
67 OUString maMinLenPwdStr;
68 OUString maMinLenPwdStr1;
69 OUString maEmptyPwdStr;
70 OUString maMainPwdStr;
71 sal_uInt16 mnMinLen;
72 SfxShowExtras mnExtras;
74 bool mbAsciiOnly;
75 DECL_DLLPRIVATE_LINK(OKHdl, weld::Button&, void);
76 DECL_DLLPRIVATE_LINK(InsertTextHdl, OUString&, bool);
77 DECL_DLLPRIVATE_LINK(EditModifyHdl, weld::Entry&, void);
78 void ModifyHdl();
80 void SetPasswdText();
82 public:
83 SfxPasswordDialog(weld::Widget* pParent, const OUString* pGroupText = nullptr);
85 OUString GetUser() const
87 return m_xUserED->get_text();
89 OUString GetPassword() const
91 return m_xPassword1ED->get_text();
93 OUString GetConfirm() const
95 return m_xConfirm1ED->get_text();
97 OUString GetPassword2() const
99 return m_xPassword2ED->get_text();
101 void SetGroup2Text(const OUString& i_rText)
103 m_xPassword2Box->set_label(i_rText);
105 void SetMinLen(sal_uInt16 Len);
106 void SetEditHelpId(const OString& rId)
108 m_xPassword1ED->set_help_id(rId);
110 /* tdf#60874 we need a custom help ID for the Confirm
111 field of the Protect Document window */
112 void SetConfirmHelpId(const OString& rId)
114 m_xConfirm1ED->set_help_id(rId);
117 void ShowExtras(SfxShowExtras nExtras)
119 mnExtras = nExtras;
121 void AllowAsciiOnly()
123 mbAsciiOnly = true;
126 void ShowMinLengthText(bool bShow);
128 short execute();
131 #endif // INCLUDED_SFX2_PASSWD_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */