nss: upgrade to release 3.73
[LibreOffice.git] / xmlsecurity / inc / digitalsignaturesdialog.hxx
blobf062c7da9d8ea28b92eeb2024f831ee4e7ab71f7
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 <com/sun/star/beans/PropertyValue.hpp>
25 #include "documentsignaturehelper.hxx"
26 #include "xmlsignaturehelper.hxx"
27 #include "documentsignaturemanager.hxx"
29 #include <vector>
31 namespace com::sun::star {
32 namespace lang { class XMultiServiceFactory; }
33 namespace io { class XStream; }
34 namespace embed { class XStorage; }
35 namespace xml::dom { class XDocumentBuilder; }
39 class HeaderBar;
41 class DigitalSignaturesDialog final : public weld::GenericDialogController
43 private:
44 DocumentSignatureManager maSignatureManager;
45 bool mbVerifySignatures;
46 bool mbSignaturesChanged;
48 OUString const m_sODFVersion;
49 //Signals if the document contains already a document signature. This is only
50 //important when we are signing macros and if the value is true.
51 bool const m_bHasDocumentSignature;
52 bool m_bWarningShowSignMacro;
54 bool m_bAdESCompliant;
56 std::unique_ptr<weld::Label> m_xHintDocFT;
57 std::unique_ptr<weld::Label> m_xHintBasicFT;
58 std::unique_ptr<weld::Label> m_xHintPackageFT;
59 std::unique_ptr<weld::TreeView> m_xSignaturesLB;
60 std::unique_ptr<weld::Image> m_xSigsValidImg;
61 std::unique_ptr<weld::Label> m_xSigsValidFI;
62 std::unique_ptr<weld::Image> m_xSigsInvalidImg;
63 std::unique_ptr<weld::Label> m_xSigsInvalidFI;
64 std::unique_ptr<weld::Image> m_xSigsNotvalidatedImg;
65 std::unique_ptr<weld::Label> m_xSigsNotvalidatedFI;
66 std::unique_ptr<weld::Image> m_xSigsOldSignatureImg;
67 std::unique_ptr<weld::Label> m_xSigsOldSignatureFI;
68 std::unique_ptr<weld::CheckButton> m_xAdESCompliantCB;
69 std::unique_ptr<weld::Button> m_xViewBtn;
70 std::unique_ptr<weld::Button> m_xAddBtn;
71 std::unique_ptr<weld::Button> m_xRemoveBtn;
72 std::unique_ptr<weld::Button> m_xStartCertMgrBtn;
73 std::unique_ptr<weld::Button> m_xCloseBtn;
75 DECL_LINK(AdESCompliantCheckBoxHdl, weld::ToggleButton&, void);
76 DECL_LINK(ViewButtonHdl, weld::Button&, void);
77 DECL_LINK(AddButtonHdl, weld::Button&, void);
78 DECL_LINK(RemoveButtonHdl, weld::Button&, void);
79 DECL_LINK(SignatureHighlightHdl, weld::TreeView&, void);
80 DECL_LINK(SignatureSelectHdl, weld::TreeView&, bool);
81 DECL_LINK(StartVerifySignatureHdl, LinkParamNone*, bool);
82 DECL_LINK(OKButtonHdl, weld::Button&, void);
83 DECL_LINK(CertMgrButtonHdl, weld::Button&, void);
85 void ImplGetSignatureInformations(bool bUseTempStream, bool bCacheLastSignature);
86 void ImplFillSignaturesBox();
87 void ImplShowSignaturesDetails();
89 css::uno::Reference<css::security::XCertificate> getCertificate(const SignatureInformation& rInfo);
90 css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironmentForCertificate(
91 const css::uno::Reference<css::security::XCertificate>& xCert);
93 //Checks if adding is allowed.
94 //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
95 //(6.6.2)Behaviour with regard to ODF 1.2
96 bool canAdd();
97 bool canRemove();
99 bool canAddRemove();
101 public:
102 DigitalSignaturesDialog(weld::Window* pParent, const css::uno::Reference<
103 css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
104 bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature);
105 virtual ~DigitalSignaturesDialog() override;
107 // Initialize the dialog and the security environment, returns TRUE on success
108 bool Init();
110 // Set the storage which should be signed or verified
111 void SetStorage( const css::uno::Reference < css::embed::XStorage >& rxStore );
112 void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream );
114 // Execute the dialog...
115 short run() override;
117 // Did signatures change?
118 bool SignaturesChanged() const { return mbSignaturesChanged; }
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */