1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/weld.hxx>
25 #include <o3tl/typed_flags_set.hxx>
27 // defines ---------------------------------------------------------------
29 enum class SfxShowExtras
40 template<> struct typed_flags
<SfxShowExtras
> : is_typed_flags
<SfxShowExtras
, 0x0f> {};
43 // class SfxPasswordDialog -----------------------------------------------
45 class SFX2_DLLPUBLIC SfxPasswordDialog final
: public weld::GenericDialogController
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
;
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
;
62 std::unique_ptr
<weld::Label
> m_xMinLengthFT
;
64 std::unique_ptr
<weld::Button
> m_xOKBtn
;
66 OUString
const maMinLenPwdStr
;
67 OUString
const maMinLenPwdStr1
;
68 OUString
const maEmptyPwdStr
;
69 OUString maMainPwdStr
;
71 SfxShowExtras mnExtras
;
74 DECL_DLLPRIVATE_LINK(OKHdl
, weld::Button
&, void);
75 DECL_DLLPRIVATE_LINK(InsertTextHdl
, OUString
&, bool);
76 DECL_DLLPRIVATE_LINK(EditModifyHdl
, weld::Entry
&, void);
82 SfxPasswordDialog(weld::Widget
* pParent
, const OUString
* pGroupText
= nullptr);
84 OUString
GetUser() const
86 return m_xUserED
->get_text();
88 OUString
GetPassword() const
90 return m_xPassword1ED
->get_text();
92 OUString
GetConfirm() const
94 return m_xConfirm1ED
->get_text();
96 OUString
GetPassword2() const
98 return m_xPassword2ED
->get_text();
100 void SetGroup2Text(const OUString
& i_rText
)
102 m_xPassword2Box
->set_label(i_rText
);
104 void SetMinLen(sal_uInt16 Len
);
105 void SetEditHelpId(const OString
& rId
)
107 m_xPassword1ED
->set_help_id(rId
);
109 /* tdf#60874 we need a custom help ID for the Confirm
110 field of the Protect Document window */
111 void SetConfirmHelpId(const OString
& rId
)
113 m_xConfirm1ED
->set_help_id(rId
);
116 void ShowExtras(SfxShowExtras nExtras
)
120 void AllowAsciiOnly()
125 void ShowMinLengthText(bool bShow
);
127 virtual short run() override
;
130 #endif // INCLUDED_SFX2_PASSWD_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */