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
;
36 std::unique_ptr
<weld::Notebook
> m_xTabCtrl
;
37 std::unique_ptr
<weld::Button
> m_xOkBtn
;
38 std::unique_ptr
<weld::Button
> m_xResetBtn
;
40 std::unique_ptr
<MacroSecurityTP
> m_xLevelTP
;
41 std::unique_ptr
<MacroSecurityTP
> m_xTrustSrcTP
;
43 DECL_LINK(ActivatePageHdl
, const OString
&, void);
44 DECL_LINK(OkBtnHdl
, weld::Button
&, void);
46 MacroSecurity(weld::Window
* pParent
,
47 css::uno::Reference
<css::xml::crypto::XSecurityEnvironment
> xSecurityEnvironment
);
49 void EnableReset(bool bEnable
= true)
51 m_xResetBtn
->set_sensitive(bEnable
);
58 std::unique_ptr
<weld::Builder
> m_xBuilder
;
59 std::unique_ptr
<weld::Container
> m_xContainer
;
61 MacroSecurity
* m_pDlg
;
63 MacroSecurityTP(weld::Container
* pParent
, const OUString
& rUIXMLDescription
,
64 const OString
& rID
, MacroSecurity
* pDlg
);
65 virtual ~MacroSecurityTP();
67 virtual void ActivatePage();
68 virtual void ClosePage() = 0;
71 class MacroSecurityLevelTP
: public MacroSecurityTP
74 sal_uInt16 mnCurLevel
;
76 std::unique_ptr
<weld::RadioButton
> m_xVeryHighRB
;
77 std::unique_ptr
<weld::RadioButton
> m_xHighRB
;
78 std::unique_ptr
<weld::RadioButton
> m_xMediumRB
;
79 std::unique_ptr
<weld::RadioButton
> m_xLowRB
;
80 std::unique_ptr
<weld::Widget
> m_xVHighImg
;
81 std::unique_ptr
<weld::Widget
> m_xHighImg
;
82 std::unique_ptr
<weld::Widget
> m_xMedImg
;
83 std::unique_ptr
<weld::Widget
> m_xLowImg
;
85 DECL_LINK(RadioButtonHdl
, weld::Toggleable
&, void);
87 MacroSecurityLevelTP(weld::Container
* pParent
, MacroSecurity
* pDlg
);
88 virtual void ClosePage() override
;
91 class MacroSecurityTrustedSourcesTP
: public MacroSecurityTP
94 std::vector
< SvtSecurityOptions::Certificate
> m_aTrustedAuthors
;
96 bool mbAuthorsReadonly
;
99 std::unique_ptr
<weld::Image
> m_xTrustCertROFI
;
100 std::unique_ptr
<weld::TreeView
> m_xTrustCertLB
;
101 std::unique_ptr
<weld::Button
> m_xViewCertPB
;
102 std::unique_ptr
<weld::Button
> m_xRemoveCertPB
;
103 std::unique_ptr
<weld::Image
> m_xTrustFileROFI
;
104 std::unique_ptr
<weld::TreeView
> m_xTrustFileLocLB
;
105 std::unique_ptr
<weld::Button
> m_xAddLocPB
;
106 std::unique_ptr
<weld::Button
> m_xRemoveLocPB
;
108 DECL_LINK(ViewCertPBHdl
, weld::Button
&, void);
109 DECL_LINK(RemoveCertPBHdl
, weld::Button
&, void);
110 DECL_LINK(AddLocPBHdl
, weld::Button
&, void);
111 DECL_LINK(RemoveLocPBHdl
, weld::Button
&, void);
112 DECL_LINK(TrustCertLBSelectHdl
, weld::TreeView
&, void);
113 DECL_LINK(TrustFileLocLBSelectHdl
, weld::TreeView
&, void);
115 void FillCertLB(const bool bShowWarnings
= false);
116 void ImplCheckButtons();
117 void ShowBrokenCertificateError(std::u16string_view rData
);
120 MacroSecurityTrustedSourcesTP(weld::Container
* pParent
, MacroSecurity
* pDlg
);
122 virtual void ActivatePage() override
;
123 virtual void ClosePage() override
;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */