tdf#122471 xlsx import: pivottable error OUString, not uInt8
[LibreOffice.git] / xmlsecurity / inc / macrosecurity.hxx
blob233ef2c1dca1d4c6e1666e088508aa23bda9a1c5
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 .
20 #pragma once
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
30 private:
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);
45 public:
46 MacroSecurity(weld::Window* pParent,
47 const css::uno::Reference<css::xml::crypto::XSecurityEnvironment>& rxSecurityEnvironment);
49 void EnableReset(bool bEnable = true)
51 m_xResetBtn->set_sensitive(bEnable);
55 class MacroSecurityTP
57 protected:
58 std::unique_ptr<weld::Builder> m_xBuilder;
59 std::unique_ptr<weld::Container> m_xContainer;
61 MacroSecurity* m_pDlg;
62 public:
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
73 private:
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);
86 public:
87 MacroSecurityLevelTP(weld::Container* pParent, MacroSecurity* pDlg);
88 virtual void ClosePage() override;
91 class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
93 private:
94 std::vector< SvtSecurityOptions::Certificate > m_aTrustedAuthors;
96 bool mbAuthorsReadonly;
97 bool mbURLsReadonly;
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);
119 public:
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: */