1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: digitalsignaturesdialog.hxx,v $
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>
53 class XMultiServiceFactory
; }
58 namespace xml
{ namespace dom
{
59 class XDocumentBuilder
; } }
62 namespace css
= com::sun::star
;
63 namespace cssu
= com::sun::star::uno
;
67 class DigitalSignaturesDialog
: public ModalDialog
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
;
96 PushButton maRemoveBtn
;
98 FixedLine maBottomSepFL
;
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
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
);
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...
149 // Did signatures change?
150 sal_Bool
SignaturesChanged() const { return mbSignaturesChanged
; }
153 #endif // _XMLSECURITY_DIGITALSIGNATURESDIALOG_HXX