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