LibreOffice Module sfx2 (master) 1
passwd.hxx
Go to the documentation of this file.
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/weld.hxx>
26
27// defines ---------------------------------------------------------------
28
29enum class SfxShowExtras
30{
31 NONE = 0x0000,
32 USER = 0x0001,
33 CONFIRM = 0x0002,
34 PASSWORD2 = 0x0004,
35 CONFIRM2 = 0x0008,
36 ALL = USER | CONFIRM
37};
38namespace o3tl
39{
40 template<> struct typed_flags<SfxShowExtras> : is_typed_flags<SfxShowExtras, 0x0f> {};
41}
42
43// class SfxPasswordDialog -----------------------------------------------
44
46{
47private:
48 std::unique_ptr<weld::Frame> m_xPassword1Box;
49 std::unique_ptr<weld::Label> m_xUserFT;
50 std::unique_ptr<weld::Entry> m_xUserED;
51 std::unique_ptr<weld::Label> m_xPassword1FT;
52 std::unique_ptr<weld::Entry> m_xPassword1ED;
53 std::unique_ptr<weld::Label> m_xConfirm1FT;
54 std::unique_ptr<weld::Entry> m_xConfirm1ED;
55
56 std::unique_ptr<weld::Frame> m_xPassword2Box;
57 std::unique_ptr<weld::Label> m_xPassword2FT;
58 std::unique_ptr<weld::Entry> m_xPassword2ED;
59 std::unique_ptr<weld::Label> m_xConfirm2FT;
60 std::unique_ptr<weld::Entry> m_xConfirm2ED;
61
62 std::unique_ptr<weld::Label> m_xMinLengthFT;
63 std::unique_ptr<weld::Label> m_xOnlyAsciiFT;
64
65 std::unique_ptr<weld::Button> m_xOKBtn;
66
67 std::shared_ptr<weld::MessageDialog> m_xConfirmFailedDialog;
68
71 OUString maEmptyPwdStr;
72 OUString maMainPwdStr;
73 sal_uInt16 mnMinLen;
75
78 DECL_DLLPRIVATE_LINK(InsertTextHdl, OUString&, bool);
79 DECL_DLLPRIVATE_LINK(EditModifyHdl, weld::Entry&, void);
80 void ModifyHdl();
81
82 void SetPasswdText();
83
84public:
85 SfxPasswordDialog(weld::Widget* pParent, const OUString* pGroupText = nullptr);
86
87 OUString GetUser() const
88 {
89 return m_xUserED->get_text();
90 }
91 OUString GetPassword() const
92 {
93 return m_xPassword1ED->get_text();
94 }
95 OUString GetConfirm() const
96 {
97 return m_xConfirm1ED->get_text();
98 }
99 OUString GetPassword2() const
100 {
101 return m_xPassword2ED->get_text();
102 }
103 void SetGroup2Text(const OUString& i_rText)
104 {
105 m_xPassword2Box->set_label(i_rText);
106 }
107 void SetMinLen(sal_uInt16 Len);
108 void SetEditHelpId(const OUString& rId)
109 {
110 m_xPassword1ED->set_help_id(rId);
111 }
112 /* tdf#60874 we need a custom help ID for the Confirm
113 field of the Protect Document window */
114 void SetConfirmHelpId(const OUString& rId)
115 {
116 m_xConfirm1ED->set_help_id(rId);
117 }
118
120 {
121 mnExtras = nExtras;
122 }
123
124 void AllowAsciiOnly();
125 void ShowMinLengthText(bool bShow);
126
127 void PreRun();
128
129 virtual short run() override;
130
132};
133
134#endif // INCLUDED_SFX2_PASSWD_HXX
135
136/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Frame > m_xPassword1Box
Definition: passwd.hxx:48
void SetEditHelpId(const OUString &rId)
Definition: passwd.hxx:108
std::unique_ptr< weld::Entry > m_xUserED
Definition: passwd.hxx:50
std::unique_ptr< weld::Entry > m_xConfirm1ED
Definition: passwd.hxx:54
OUString GetPassword() const
Definition: passwd.hxx:91
OUString GetPassword2() const
Definition: passwd.hxx:99
OUString maEmptyPwdStr
Definition: passwd.hxx:71
sal_uInt16 mnMinLen
Definition: passwd.hxx:73
std::unique_ptr< weld::Label > m_xPassword2FT
Definition: passwd.hxx:57
DECL_DLLPRIVATE_LINK(InsertTextHdl, OUString &, bool)
DECL_DLLPRIVATE_LINK(OKHdl, weld::Button &, void)
std::shared_ptr< weld::MessageDialog > m_xConfirmFailedDialog
Definition: passwd.hxx:67
void SetConfirmHelpId(const OUString &rId)
Definition: passwd.hxx:114
SfxShowExtras mnExtras
Definition: passwd.hxx:74
std::unique_ptr< weld::Label > m_xConfirm2FT
Definition: passwd.hxx:59
std::unique_ptr< weld::Button > m_xOKBtn
Definition: passwd.hxx:65
OUString maMinLenPwdStr
Definition: passwd.hxx:69
DECL_DLLPRIVATE_LINK(EditModifyHdl, weld::Entry &, void)
OUString GetConfirm() const
Definition: passwd.hxx:95
std::unique_ptr< weld::Entry > m_xConfirm2ED
Definition: passwd.hxx:60
OUString GetUser() const
Definition: passwd.hxx:87
std::unique_ptr< weld::Label > m_xPassword1FT
Definition: passwd.hxx:51
std::unique_ptr< weld::Frame > m_xPassword2Box
Definition: passwd.hxx:56
void SetGroup2Text(const OUString &i_rText)
Definition: passwd.hxx:103
void ShowExtras(SfxShowExtras nExtras)
Definition: passwd.hxx:119
std::unique_ptr< weld::Label > m_xConfirm1FT
Definition: passwd.hxx:53
OUString maMainPwdStr
Definition: passwd.hxx:72
std::unique_ptr< weld::Label > m_xUserFT
Definition: passwd.hxx:49
OUString maMinLenPwdStr1
Definition: passwd.hxx:70
std::unique_ptr< weld::Entry > m_xPassword1ED
Definition: passwd.hxx:52
std::unique_ptr< weld::Label > m_xMinLengthFT
Definition: passwd.hxx:62
std::unique_ptr< weld::Entry > m_xPassword2ED
Definition: passwd.hxx:58
std::unique_ptr< weld::Label > m_xOnlyAsciiFT
Definition: passwd.hxx:63
virtual short run()
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
NONE
constexpr OUStringLiteral USER
SfxShowExtras
Definition: passwd.hxx:30