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