Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_XMLSECURITY_INC_XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
21 : #define INCLUDED_XMLSECURITY_INC_XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
22 :
23 : #include <vcl/dialog.hxx>
24 : #include <vcl/fixed.hxx>
25 : #include <vcl/button.hxx>
26 : #include <svtools/simptabl.hxx>
27 : #include <svtools/stdctrl.hxx>
28 : #include <com/sun/star/beans/PropertyValue.hpp>
29 :
30 : #include <xmlsecurity/documentsignaturehelper.hxx>
31 : #include <xmlsecurity/xmlsignaturehelper.hxx>
32 :
33 : #include <vector>
34 :
35 : namespace com {
36 : namespace sun {
37 : namespace star {
38 : namespace lang {
39 : class XMultiServiceFactory; }
40 : namespace io {
41 : class XStream; }
42 : namespace embed {
43 : class XStorage; }
44 : namespace xml { namespace dom {
45 : class XDocumentBuilder; } }
46 : }}}
47 :
48 :
49 : class HeaderBar;
50 :
51 : class DigitalSignaturesDialog : public ModalDialog
52 : {
53 : private:
54 : css::uno::Reference< css::uno::XComponentContext >& mxCtx;
55 : XMLSignatureHelper maSignatureHelper;
56 :
57 : css::uno::Reference < css::embed::XStorage > mxStore;
58 : css::uno::Reference < css::io::XStream > mxSignatureStream;
59 : css::uno::Reference < css::io::XStream > mxTempSignatureStream;
60 : SignatureInformations maCurrentSignatureInformations;
61 : bool mbVerifySignatures;
62 : bool mbSignaturesChanged;
63 : DocumentSignatureMode meSignatureMode;
64 : css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > m_manifest;
65 :
66 : FixedText* m_pHintDocFT;
67 : FixedText* m_pHintBasicFT;
68 : FixedText* m_pHintPackageFT;
69 : SvSimpleTable* m_pSignaturesLB;
70 : FixedImage* m_pSigsValidImg;
71 : FixedText* m_pSigsValidFI;
72 : FixedImage* m_pSigsInvalidImg;
73 : FixedText* m_pSigsInvalidFI;
74 : FixedImage* m_pSigsNotvalidatedImg;
75 : FixedText* m_pSigsNotvalidatedFI;
76 : FixedImage* m_pSigsOldSignatureImg;
77 : FixedText* m_pSigsOldSignatureFI;
78 :
79 : PushButton* m_pViewBtn;
80 : PushButton* m_pAddBtn;
81 : PushButton* m_pRemoveBtn;
82 :
83 : CloseButton* m_pCloseBtn;
84 :
85 : OUString m_sODFVersion;
86 : //Signals if the document contains already a document signature. This is only
87 : //important when we are signing macros and if the value is true.
88 : bool m_bHasDocumentSignature;
89 : bool m_bWarningShowSignMacro;
90 :
91 : DECL_LINK(ViewButtonHdl, void *);
92 : DECL_LINK(AddButtonHdl, void *);
93 : DECL_LINK(RemoveButtonHdl, void *);
94 : DECL_LINK( SignatureHighlightHdl, void* );
95 : DECL_LINK( SignatureSelectHdl, void* );
96 : DECL_LINK( StartVerifySignatureHdl, void* );
97 : DECL_LINK( OKButtonHdl, void* );
98 :
99 : void ImplGetSignatureInformations(bool bUseTempStream);
100 : void ImplFillSignaturesBox();
101 : void ImplShowSignaturesDetails();
102 : SignatureStreamHelper ImplOpenSignatureStream( sal_Int32 eStreamMode, bool bTempStream );
103 :
104 : //Checks if adding is allowed.
105 : //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
106 : //(6.6.2)Behaviour with regard to ODF 1.2
107 : bool canAdd();
108 : bool canRemove();
109 :
110 : //Checks if a particular stream is a valid xml stream. Those are treated differently
111 : //when they are signed (c14n transformation)
112 : bool isXML(const OUString& rURI );
113 : bool canAddRemove();
114 :
115 : public:
116 : DigitalSignaturesDialog( vcl::Window* pParent, css::uno::Reference<
117 : css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
118 : bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature);
119 : virtual ~DigitalSignaturesDialog();
120 :
121 : // Initialize the dialog and the security environment, returns TRUE on success
122 : bool Init();
123 :
124 : // Set the storage which should be signed or verified
125 : void SetStorage( const css::uno::Reference < css::embed::XStorage >& rxStore );
126 : void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream );
127 :
128 : // Execute the dialog...
129 : short Execute() SAL_OVERRIDE;
130 :
131 : // Did signatures change?
132 0 : bool SignaturesChanged() const { return mbSignaturesChanged; }
133 : };
134 :
135 : #endif // INCLUDED_XMLSECURITY_INC_XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|