calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / xmlsecurity / inc / digitalsignaturesdialog.hxx
blob218c3e99c8b310cc6375f9c9303a1c4421086faa
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;
40 class CertificateViewer;
42 class DigitalSignaturesDialog final : public weld::GenericDialogController
44 private:
45 DocumentSignatureManager maSignatureManager;
46 bool mbVerifySignatures;
47 bool mbSignaturesChanged;
49 OUString const m_sODFVersion;
50 //Signals if the document contains already a document signature. This is only
51 //important when we are signing macros and if the value is true.
52 bool const m_bHasDocumentSignature;
53 bool m_bWarningShowSignMacro;
55 bool m_bAdESCompliant;
57 std::unique_ptr<weld::Label> m_xHintDocFT;
58 std::unique_ptr<weld::Label> m_xHintBasicFT;
59 std::unique_ptr<weld::Label> m_xHintPackageFT;
60 std::unique_ptr<weld::TreeView> m_xSignaturesLB;
61 std::unique_ptr<weld::Image> m_xSigsValidImg;
62 std::unique_ptr<weld::Label> m_xSigsValidFI;
63 std::unique_ptr<weld::Image> m_xSigsInvalidImg;
64 std::unique_ptr<weld::Label> m_xSigsInvalidFI;
65 std::unique_ptr<weld::Image> m_xSigsNotvalidatedImg;
66 std::unique_ptr<weld::Label> m_xSigsNotvalidatedFI;
67 std::unique_ptr<weld::Image> m_xSigsOldSignatureImg;
68 std::unique_ptr<weld::Label> m_xSigsOldSignatureFI;
69 std::unique_ptr<weld::CheckButton> m_xAdESCompliantCB;
70 std::unique_ptr<weld::Button> m_xViewBtn;
71 std::unique_ptr<weld::Button> m_xAddBtn;
72 std::unique_ptr<weld::Button> m_xRemoveBtn;
73 std::unique_ptr<weld::Button> m_xStartCertMgrBtn;
74 std::unique_ptr<weld::Button> m_xCloseBtn;
76 std::shared_ptr<CertificateViewer> m_xViewer;
77 std::shared_ptr<weld::MessageDialog> m_xInfoBox;
79 DECL_LINK(AdESCompliantCheckBoxHdl, weld::Toggleable&, void);
80 DECL_LINK(ViewButtonHdl, weld::Button&, void);
81 DECL_LINK(AddButtonHdl, weld::Button&, void);
82 DECL_LINK(RemoveButtonHdl, weld::Button&, void);
83 DECL_LINK(SignatureHighlightHdl, weld::TreeView&, void);
84 DECL_LINK(SignatureSelectHdl, weld::TreeView&, bool);
85 DECL_LINK(StartVerifySignatureHdl, LinkParamNone*, bool);
86 DECL_LINK(OKButtonHdl, weld::Button&, void);
87 DECL_LINK(CertMgrButtonHdl, weld::Button&, void);
89 void ImplGetSignatureInformations(bool bUseTempStream, bool bCacheLastSignature);
90 void ImplFillSignaturesBox();
91 void ImplShowSignaturesDetails();
93 css::uno::Reference<css::security::XCertificate> getCertificate(const SignatureInformation& rInfo);
94 css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironmentForCertificate(
95 const css::uno::Reference<css::security::XCertificate>& xCert);
97 //Checks if adding is allowed.
98 //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
99 //(6.6.2)Behaviour with regard to ODF 1.2
100 bool canAdd();
101 bool canRemove();
103 bool canAddRemove();
105 public:
106 DigitalSignaturesDialog(weld::Window* pParent, const css::uno::Reference<
107 css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
108 bool bReadOnly, OUString sODFVersion, bool bHasDocumentSignature);
109 virtual ~DigitalSignaturesDialog() override;
111 // Initialize the dialog and the security environment, returns TRUE on success
112 bool Init();
114 // Set the storage which should be signed or verified
115 void SetStorage( const css::uno::Reference < css::embed::XStorage >& rxStore );
116 void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream );
118 // Execute the dialog...
119 void beforeRun();
120 short run() override;
122 // Did signatures change?
123 bool SignaturesChanged() const { return mbSignaturesChanged; }
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */