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 .
22 #include <vcl/weld.hxx>
23 #include <unotools/securityoptions.hxx>
25 namespace com::sun::star::xml::crypto
{ class XSecurityEnvironment
; }
26 class MacroSecurityTP
;
28 class MacroSecurity final
: public weld::GenericDialogController
31 friend class MacroSecurityLevelTP
;
32 friend class MacroSecurityTrustedSourcesTP
;
34 css::uno::Reference
<css::xml::crypto::XSecurityEnvironment
> m_xSecurityEnvironment
;
35 SvtSecurityOptions m_aSecOptions
;
37 std::unique_ptr
<weld::Notebook
> m_xTabCtrl
;
38 std::unique_ptr
<weld::Button
> m_xOkBtn
;
39 std::unique_ptr
<weld::Button
> m_xResetBtn
;
41 std::unique_ptr
<MacroSecurityTP
> m_xLevelTP
;
42 std::unique_ptr
<MacroSecurityTP
> m_xTrustSrcTP
;
44 DECL_LINK(ActivatePageHdl
, const OString
&, void);
45 DECL_LINK(OkBtnHdl
, weld::Button
&, void);
47 MacroSecurity(weld::Window
* pParent
,
48 const css::uno::Reference
<css::xml::crypto::XSecurityEnvironment
>& rxSecurityEnvironment
);
50 void EnableReset(bool bEnable
= true)
52 m_xResetBtn
->set_sensitive(bEnable
);
59 std::unique_ptr
<weld::Builder
> m_xBuilder
;
60 std::unique_ptr
<weld::Container
> m_xContainer
;
62 MacroSecurity
* m_pDlg
;
64 MacroSecurityTP(weld::Container
* pParent
, const OUString
& rUIXMLDescription
,
65 const OString
& rID
, MacroSecurity
* pDlg
);
66 virtual ~MacroSecurityTP();
68 virtual void ActivatePage();
69 virtual void ClosePage() = 0;
72 class MacroSecurityLevelTP
: public MacroSecurityTP
75 sal_uInt16 mnCurLevel
;
77 std::unique_ptr
<weld::RadioButton
> m_xVeryHighRB
;
78 std::unique_ptr
<weld::RadioButton
> m_xHighRB
;
79 std::unique_ptr
<weld::RadioButton
> m_xMediumRB
;
80 std::unique_ptr
<weld::RadioButton
> m_xLowRB
;
81 std::unique_ptr
<weld::Widget
> m_xVHighImg
;
82 std::unique_ptr
<weld::Widget
> m_xHighImg
;
83 std::unique_ptr
<weld::Widget
> m_xMedImg
;
84 std::unique_ptr
<weld::Widget
> m_xLowImg
;
86 DECL_LINK(RadioButtonHdl
, weld::ToggleButton
&, void);
88 MacroSecurityLevelTP(weld::Container
* pParent
, MacroSecurity
* pDlg
);
89 virtual void ClosePage() override
;
92 class MacroSecurityTrustedSourcesTP
: public MacroSecurityTP
95 css::uno::Sequence
< SvtSecurityOptions::Certificate
> m_aTrustedAuthors
;
97 bool mbAuthorsReadonly
;
100 std::unique_ptr
<weld::Image
> m_xTrustCertROFI
;
101 std::unique_ptr
<weld::TreeView
> m_xTrustCertLB
;
102 std::unique_ptr
<weld::Button
> m_xViewCertPB
;
103 std::unique_ptr
<weld::Button
> m_xRemoveCertPB
;
104 std::unique_ptr
<weld::Image
> m_xTrustFileROFI
;
105 std::unique_ptr
<weld::TreeView
> m_xTrustFileLocLB
;
106 std::unique_ptr
<weld::Button
> m_xAddLocPB
;
107 std::unique_ptr
<weld::Button
> m_xRemoveLocPB
;
109 DECL_LINK(ViewCertPBHdl
, weld::Button
&, void);
110 DECL_LINK(RemoveCertPBHdl
, weld::Button
&, void);
111 DECL_LINK(AddLocPBHdl
, weld::Button
&, void);
112 DECL_LINK(RemoveLocPBHdl
, weld::Button
&, void);
113 DECL_LINK(TrustCertLBSelectHdl
, weld::TreeView
&, void);
114 DECL_LINK(TrustFileLocLBSelectHdl
, weld::TreeView
&, void);
116 void FillCertLB(const bool bShowWarnings
= false);
117 void ImplCheckButtons();
118 void ShowBrokenCertificateError(std::u16string_view rData
);
121 MacroSecurityTrustedSourcesTP(weld::Container
* pParent
, MacroSecurity
* pDlg
);
123 virtual void ActivatePage() override
;
124 virtual void ClosePage() override
;
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */