1*ec61c6edSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ec61c6edSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ec61c6edSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ec61c6edSAndrew Rist  * distributed with this work for additional information
6*ec61c6edSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ec61c6edSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ec61c6edSAndrew Rist  * "License"); you may not use this file except in compliance
9*ec61c6edSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ec61c6edSAndrew Rist  *
11*ec61c6edSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ec61c6edSAndrew Rist  *
13*ec61c6edSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ec61c6edSAndrew Rist  * software distributed under the License is distributed on an
15*ec61c6edSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ec61c6edSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ec61c6edSAndrew Rist  * specific language governing permissions and limitations
18*ec61c6edSAndrew Rist  * under the License.
19*ec61c6edSAndrew Rist  *
20*ec61c6edSAndrew Rist  *************************************************************/
21*ec61c6edSAndrew Rist 
22*ec61c6edSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _XMLSECURITY_CERTIFICATEVIEWER_HXX
25cdf0e10cSrcweir #define _XMLSECURITY_CERTIFICATEVIEWER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/fixed.hxx>
28cdf0e10cSrcweir #include <vcl/button.hxx>
29cdf0e10cSrcweir #include <vcl/lstbox.hxx>
30cdf0e10cSrcweir #include <vcl/tabdlg.hxx>
31cdf0e10cSrcweir #include <vcl/tabctrl.hxx>
32cdf0e10cSrcweir #include <vcl/tabpage.hxx>
33cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
34cdf0e10cSrcweir #include <svx/simptabl.hxx>
35cdf0e10cSrcweir #include <svtools/svmedit.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com {
38cdf0e10cSrcweir namespace sun {
39cdf0e10cSrcweir namespace star {
40cdf0e10cSrcweir namespace security {
41cdf0e10cSrcweir     class XCertificate; }
42cdf0e10cSrcweir namespace xml { namespace crypto {
43cdf0e10cSrcweir     class XSecurityEnvironment; }}
44cdf0e10cSrcweir }}}
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace css = com::sun::star;
47cdf0e10cSrcweir namespace cssu = com::sun::star::uno;
48cdf0e10cSrcweir namespace dcss = ::com::sun::star;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class CertificateViewer : public TabDialog
51cdf0e10cSrcweir {
52cdf0e10cSrcweir private:
53cdf0e10cSrcweir 	friend class CertificateViewerGeneralTP;
54cdf0e10cSrcweir 	friend class CertificateViewerDetailsTP;
55cdf0e10cSrcweir 	friend class CertificateViewerCertPathTP;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	TabControl			maTabCtrl;
58cdf0e10cSrcweir 	OKButton			maOkBtn;
59cdf0e10cSrcweir 	HelpButton			maHelpBtn;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	sal_Bool				mbCheckForPrivateKey;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	cssu::Reference< dcss::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
64cdf0e10cSrcweir 	cssu::Reference< dcss::security::XCertificate > mxCert;
65cdf0e10cSrcweir public:
66cdf0e10cSrcweir 		CertificateViewer( Window* pParent, const cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const cssu::Reference< dcss::security::XCertificate >& rXCert, sal_Bool bCheckForPrivateKey );
67cdf0e10cSrcweir 	virtual				~CertificateViewer();
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class CertificateViewerTP : public TabPage
72cdf0e10cSrcweir {
73cdf0e10cSrcweir protected:
74cdf0e10cSrcweir 	CertificateViewer*	mpDlg;
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir 	CertificateViewerTP( Window* _pParent, const ResId& _rResId, CertificateViewer* _pDlg );
77cdf0e10cSrcweir 	inline void			SetTabDlg( CertificateViewer* pTabDlg );
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
SetTabDlg(CertificateViewer * _pTabDlg)80cdf0e10cSrcweir inline void CertificateViewerTP::SetTabDlg( CertificateViewer* _pTabDlg )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	mpDlg = _pTabDlg;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir class CertificateViewerGeneralTP : public CertificateViewerTP
87cdf0e10cSrcweir {
88cdf0e10cSrcweir private:
89cdf0e10cSrcweir 	Window				maFrameWin;
90cdf0e10cSrcweir 	FixedImage			maCertImg;
91cdf0e10cSrcweir 	FixedInfo			maCertInfoFI;
92cdf0e10cSrcweir 	FixedLine			maSep1FL;
93cdf0e10cSrcweir 	FixedInfo			maHintNotTrustedFI;
94cdf0e10cSrcweir 	FixedLine			maSep2FL;
95cdf0e10cSrcweir 	FixedInfo			maIssuedToLabelFI;
96cdf0e10cSrcweir 	FixedInfo			maIssuedToFI;
97cdf0e10cSrcweir 	FixedInfo			maIssuedByLabelFI;
98cdf0e10cSrcweir 	FixedInfo			maIssuedByFI;
99cdf0e10cSrcweir     FixedInfo           maValidDateFI;
100cdf0e10cSrcweir 	FixedImage			maKeyImg;
101cdf0e10cSrcweir 	FixedInfo			maHintCorrespPrivKeyFI;
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir 						CertificateViewerGeneralTP( Window* pParent, CertificateViewer* _pDlg );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	virtual void		ActivatePage();
106cdf0e10cSrcweir };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class CertificateViewerDetailsTP : public CertificateViewerTP
110cdf0e10cSrcweir {
111cdf0e10cSrcweir private:
112cdf0e10cSrcweir     SvxSimpleTable      maElementsLB;   // PB 2006/02/02 #i48648 now SvHeaderTabListBox
113cdf0e10cSrcweir 	MultiLineEdit		maElementML;
114cdf0e10cSrcweir 	Font				maStdFont;
115cdf0e10cSrcweir 	Font				maFixedWidthFont;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	DECL_LINK(			ElementSelectHdl, void* );
118cdf0e10cSrcweir 	void				Clear( void );
119cdf0e10cSrcweir 	void				InsertElement( const String& _rField, const String& _rValue,
120cdf0e10cSrcweir 										const String& _rDetails, bool _bFixedWidthFont = false );
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir 						CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg );
123cdf0e10cSrcweir 	virtual				~CertificateViewerDetailsTP();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	virtual void		ActivatePage();
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir class CertificateViewerCertPathTP : public CertificateViewerTP
130cdf0e10cSrcweir {
131cdf0e10cSrcweir private:
132cdf0e10cSrcweir 	FixedText			maCertPathFT;
133cdf0e10cSrcweir 	SvTreeListBox		maCertPathLB;
134cdf0e10cSrcweir     PushButton          maViewCertPB;
135cdf0e10cSrcweir 	FixedText			maCertStatusFT;
136cdf0e10cSrcweir 	MultiLineEdit		maCertStatusML;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     CertificateViewer*  mpParent;
139cdf0e10cSrcweir     bool                mbFirstActivateDone;
140cdf0e10cSrcweir     Image               maCertImage;
141cdf0e10cSrcweir     Image               maCertNotValidatedImage;
142cdf0e10cSrcweir     String              msCertOK;
143cdf0e10cSrcweir     String              msCertNotValidated;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	DECL_LINK(			ViewCertHdl, void* );
146cdf0e10cSrcweir 	DECL_LINK(			CertSelectHdl, void* );
147cdf0e10cSrcweir 	void				Clear( void );
148cdf0e10cSrcweir 	SvLBoxEntry*		InsertCert( SvLBoxEntry* _pParent, const String& _rName,
149cdf0e10cSrcweir                                     cssu::Reference< dcss::security::XCertificate > rxCert,
150cdf0e10cSrcweir                                     bool bValid);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir public:
153cdf0e10cSrcweir 						CertificateViewerCertPathTP( Window* pParent, CertificateViewer* _pDlg );
154cdf0e10cSrcweir 	virtual				~CertificateViewerCertPathTP();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	virtual void		ActivatePage();
157cdf0e10cSrcweir };
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 
160cdf0e10cSrcweir #endif // _XMLSECURITY_CERTIFICATEVIEWER_HXX
161cdf0e10cSrcweir 
162