merge the formfield patch from ooo-build
[ooovba.git] / xmlsecurity / inc / xmlsecurity / digitalsignaturesdialog.hxx
blob6ab36a8b48e0abb8f92a80d4ab09665d32d9d331
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: digitalsignaturesdialog.hxx,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
32 #define _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX
34 #include <vcl/dialog.hxx>
35 #include <vcl/fixed.hxx>
36 #include <vcl/button.hxx>
37 #include <svtools/stdctrl.hxx>
38 #include <svx/simptabl.hxx>
39 #include <com/sun/star/beans/PropertyValue.hpp>
41 #include <xmlsecurity/documentsignaturehelper.hxx>
42 #include <xmlsecurity/xmlsignaturehelper.hxx>
45 #ifndef _STLP_VECTOR
46 #include <vector>
47 #endif
49 namespace com {
50 namespace sun {
51 namespace star {
52 namespace lang {
53 class XMultiServiceFactory; }
54 namespace io {
55 class XStream; }
56 namespace embed {
57 class XStorage; }
58 namespace xml { namespace dom {
59 class XDocumentBuilder; } }
60 }}}
62 namespace css = com::sun::star;
63 namespace cssu = com::sun::star::uno;
65 class HeaderBar;
67 class DigitalSignaturesDialog : public ModalDialog
69 private:
70 cssu::Reference< cssu::XComponentContext >& mxCtx;
71 XMLSignatureHelper maSignatureHelper;
73 css::uno::Reference < css::embed::XStorage > mxStore;
74 css::uno::Reference < css::io::XStream > mxSignatureStream;
75 css::uno::Reference < css::io::XStream > mxTempSignatureStream;
76 SignatureInformations maCurrentSignatureInformations;
77 bool mbVerifySignatures;
78 bool mbSignaturesChanged;
79 DocumentSignatureMode meSignatureMode;
80 css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > m_manifest;
82 FixedText maHintDocFT;
83 FixedText maHintBasicFT;
84 FixedText maHintPackageFT;
85 SvxSimpleTable maSignaturesLB; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
86 FixedImage maSigsValidImg;
87 FixedInfo maSigsValidFI;
88 FixedImage maSigsInvalidImg;
89 FixedInfo maSigsInvalidFI;
90 FixedImage maSigsNotvalidatedImg;
91 FixedInfo maSigsNotvalidatedFI;
92 FixedInfo maSigsOldSignatureFI;
94 PushButton maViewBtn;
95 PushButton maAddBtn;
96 PushButton maRemoveBtn;
98 FixedLine maBottomSepFL;
99 OKButton maOKBtn;
100 CancelButton maCancelBtn;
101 HelpButton maHelpBtn;
103 ::rtl::OUString m_sODFVersion;
104 //Signals if the document contains already a document signature. This is only
105 //importent when we are signing macros and if the value is true.
106 bool m_bHasDocumentSignature;
107 bool m_bWarningShowSignMacro;
109 DECL_LINK( ViewButtonHdl, Button* );
110 DECL_LINK( AddButtonHdl, Button* );
111 DECL_LINK( RemoveButtonHdl, Button* );
112 DECL_LINK( SignatureHighlightHdl, void* );
113 DECL_LINK( SignatureSelectHdl, void* );
114 DECL_LINK( StartVerifySignatureHdl, void* );
115 DECL_LINK( OKButtonHdl, void* );
117 void ImplGetSignatureInformations(bool bUseTempStream);
118 void ImplFillSignaturesBox();
119 void ImplShowSignaturesDetails();
120 SignatureStreamHelper ImplOpenSignatureStream( sal_Int32 eStreamMode, bool bTempStream );
122 //Checks if adding is allowed.
123 //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
124 //(6.6.2)Behaviour with regard to ODF 1.2
125 bool canAdd();
126 bool canRemove();
128 //Checks if a particular stream is a valid xml stream. Those are treated differently
129 //when they are signed (c14n transformation)
130 bool isXML(const ::rtl::OUString& rURI );
131 bool canAddRemove();
133 public:
134 DigitalSignaturesDialog( Window* pParent, cssu::Reference<
135 cssu::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
136 sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature);
137 ~DigitalSignaturesDialog();
139 // Initialize the dialog and the security environment, returns TRUE on success
140 BOOL Init( const rtl::OUString& rTokenName );
142 // Set the storage which should be signed or verified
143 void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore );
144 void SetSignatureStream( const cssu::Reference < css::io::XStream >& rxStream );
146 // Execute the dialog...
147 short Execute();
149 // Did signatures change?
150 sal_Bool SignaturesChanged() const { return mbSignaturesChanged; }
153 #endif // _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX