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 maHintDocFT;
71 : FixedText maHintBasicFT;
72 : FixedText maHintPackageFT;
73 : SvxSimpleTableContainer maSignaturesLBContainer;
74 : SvxSimpleTable maSignaturesLB;
75 : FixedImage maSigsValidImg;
76 : FixedInfo maSigsValidFI;
77 : FixedImage maSigsInvalidImg;
78 : FixedInfo maSigsInvalidFI;
79 : FixedImage maSigsNotvalidatedImg;
80 : FixedInfo maSigsNotvalidatedFI;
81 : FixedInfo maSigsOldSignatureFI;
82 :
83 : PushButton maViewBtn;
84 : PushButton maAddBtn;
85 : PushButton maRemoveBtn;
86 :
87 : FixedLine maBottomSepFL;
88 : OKButton maOKBtn;
89 : HelpButton maHelpBtn;
90 :
91 : ::rtl::OUString m_sODFVersion;
92 : //Signals if the document contains already a document signature. This is only
93 : //importent when we are signing macros and if the value is true.
94 : bool m_bHasDocumentSignature;
95 : bool m_bWarningShowSignMacro;
96 :
97 : DECL_LINK(ViewButtonHdl, void *);
98 : DECL_LINK(AddButtonHdl, void *);
99 : DECL_LINK(RemoveButtonHdl, void *);
100 : DECL_LINK( SignatureHighlightHdl, void* );
101 : DECL_LINK( SignatureSelectHdl, void* );
102 : DECL_LINK( StartVerifySignatureHdl, void* );
103 : DECL_LINK( OKButtonHdl, void* );
104 :
105 : void ImplGetSignatureInformations(bool bUseTempStream);
106 : void ImplFillSignaturesBox();
107 : void ImplShowSignaturesDetails();
108 : SignatureStreamHelper ImplOpenSignatureStream( sal_Int32 eStreamMode, bool bTempStream );
109 :
110 : //Checks if adding is allowed.
111 : //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
112 : //(6.6.2)Behaviour with regard to ODF 1.2
113 : bool canAdd();
114 : bool canRemove();
115 :
116 : //Checks if a particular stream is a valid xml stream. Those are treated differently
117 : //when they are signed (c14n transformation)
118 : bool isXML(const ::rtl::OUString& rURI );
119 : bool canAddRemove();
120 :
121 : public:
122 : DigitalSignaturesDialog( Window* pParent, cssu::Reference<
123 : cssu::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
124 : sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature);
125 : ~DigitalSignaturesDialog();
126 :
127 : // Initialize the dialog and the security environment, returns TRUE on success
128 : sal_Bool Init();
129 :
130 : // Set the storage which should be signed or verified
131 : void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore );
132 : void SetSignatureStream( const cssu::Reference < css::io::XStream >& rxStream );
133 :
134 : // Execute the dialog...
135 : short Execute();
136 :
137 : // Did signatures change?
138 0 : sal_Bool SignaturesChanged() const { return mbSignaturesChanged; }
139 : };
140 :
141 : #endif // _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|