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_CERTIFICATEVIEWER_HXX
21 : #define _XMLSECURITY_CERTIFICATEVIEWER_HXX
22 :
23 : #include <vcl/fixed.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/lstbox.hxx>
26 : #include <vcl/tabdlg.hxx>
27 : #include <vcl/tabctrl.hxx>
28 : #include <vcl/tabpage.hxx>
29 : #include <svtools/simptabl.hxx>
30 : #include <svtools/stdctrl.hxx>
31 : #include <svtools/svmedit.hxx>
32 :
33 : namespace com {
34 : namespace sun {
35 : namespace star {
36 : namespace security {
37 : class XCertificate; }
38 : namespace xml { namespace crypto {
39 : class XSecurityEnvironment; }}
40 : }}}
41 :
42 : class CertificateViewer : public TabDialog
43 : {
44 : private:
45 : friend class CertificateViewerGeneralTP;
46 : friend class CertificateViewerDetailsTP;
47 : friend class CertificateViewerCertPathTP;
48 :
49 : TabControl* mpTabCtrl;
50 : sal_uInt16 mnGeneralId;
51 : sal_uInt16 mnDetailsId;
52 : sal_uInt16 mnPathId;
53 :
54 : bool mbCheckForPrivateKey;
55 :
56 : css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
57 : css::uno::Reference< css::security::XCertificate > mxCert;
58 : public:
59 : CertificateViewer( Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey );
60 : virtual ~CertificateViewer();
61 : };
62 :
63 :
64 0 : class CertificateViewerTP : public TabPage
65 : {
66 : protected:
67 : CertificateViewer* mpDlg;
68 : public:
69 : CertificateViewerTP( Window* _pParent, const ResId& _rResId, CertificateViewer* _pDlg );
70 : CertificateViewerTP( Window* _pParent, const OString& rID,
71 : const OUString& rUIXMLDescription, CertificateViewer* _pDlg );
72 : void SetTabDlg( CertificateViewer* _pTabDlg )
73 : {
74 : mpDlg = _pTabDlg;
75 : }
76 : };
77 :
78 0 : class CertificateViewerGeneralTP : public CertificateViewerTP
79 : {
80 : private:
81 : Window maFrameWin;
82 : FixedImage maCertImg;
83 : FixedInfo maCertInfoFI;
84 : FixedLine maSep1FL;
85 : FixedInfo maHintNotTrustedFI;
86 : FixedLine maSep2FL;
87 : FixedInfo maIssuedToLabelFI;
88 : FixedInfo maIssuedToFI;
89 : FixedInfo maIssuedByLabelFI;
90 : FixedInfo maIssuedByFI;
91 : FixedInfo maValidDateFI;
92 : FixedImage maKeyImg;
93 : FixedInfo maHintCorrespPrivKeyFI;
94 : public:
95 : CertificateViewerGeneralTP( Window* pParent, CertificateViewer* _pDlg );
96 :
97 : virtual void ActivatePage() SAL_OVERRIDE;
98 : };
99 :
100 :
101 : class CertificateViewerDetailsTP : public CertificateViewerTP
102 : {
103 : private:
104 : SvSimpleTableContainer m_aElementsLBContainer;
105 : SvSimpleTable maElementsLB;
106 : MultiLineEdit maElementML;
107 : Font maStdFont;
108 : Font maFixedWidthFont;
109 :
110 : DECL_LINK( ElementSelectHdl, void* );
111 : void Clear( void );
112 : void InsertElement( const OUString& _rField, const OUString& _rValue,
113 : const OUString& _rDetails, bool _bFixedWidthFont = false );
114 : public:
115 : CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg );
116 : virtual ~CertificateViewerDetailsTP();
117 :
118 : virtual void ActivatePage() SAL_OVERRIDE;
119 : };
120 :
121 :
122 : class CertificateViewerCertPathTP : public CertificateViewerTP
123 : {
124 : private:
125 : SvTreeListBox* mpCertPathLB;
126 : PushButton* mpViewCertPB;
127 : VclMultiLineEdit* mpCertStatusML;
128 :
129 : CertificateViewer* mpParent;
130 : bool mbFirstActivateDone;
131 : Image maCertImage;
132 : Image maCertNotValidatedImage;
133 : OUString msCertOK;
134 : OUString msCertNotValidated;
135 :
136 : DECL_LINK( ViewCertHdl, void* );
137 : DECL_LINK( CertSelectHdl, void* );
138 : void Clear( void );
139 : SvTreeListEntry* InsertCert( SvTreeListEntry* _pParent, const OUString& _rName,
140 : css::uno::Reference< css::security::XCertificate > rxCert,
141 : bool bValid);
142 :
143 : public:
144 : CertificateViewerCertPathTP( Window* pParent, CertificateViewer* _pDlg );
145 : virtual ~CertificateViewerCertPathTP();
146 :
147 : virtual void ActivatePage() SAL_OVERRIDE;
148 : };
149 :
150 :
151 : #endif // _XMLSECURITY_CERTIFICATEVIEWER_HXX
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|