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