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 INCLUDED_XMLSECURITY_INC_XMLSECURITY_CERTIFICATEVIEWER_HXX
21 : #define INCLUDED_XMLSECURITY_INC_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( vcl::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( vcl::Window* _pParent, const OString& rID,
70 : const OUString& rUIXMLDescription, CertificateViewer* _pDlg );
71 : void SetTabDlg( CertificateViewer* _pTabDlg )
72 : {
73 : mpDlg = _pTabDlg;
74 : }
75 : };
76 :
77 0 : class CertificateViewerGeneralTP : public CertificateViewerTP
78 : {
79 : private:
80 : FixedImage* m_pCertImg;
81 : FixedText* m_pHintNotTrustedFI;
82 : FixedText* m_pIssuedToFI;
83 : FixedText* m_pIssuedByFI;
84 : FixedText* m_pValidFromDateFI;
85 : FixedText* m_pValidToDateFI;
86 : FixedImage* m_pKeyImg;
87 : FixedText* m_pHintCorrespPrivKeyFI;
88 : public:
89 : CertificateViewerGeneralTP( vcl::Window* pParent, CertificateViewer* _pDlg );
90 :
91 : virtual void ActivatePage() SAL_OVERRIDE;
92 : };
93 :
94 :
95 : class CertificateViewerDetailsTP : public CertificateViewerTP
96 : {
97 : private:
98 : SvSimpleTableContainer* m_pElementsLBContainer;
99 : SvSimpleTable* m_pElementsLB;
100 : MultiLineEdit* m_pValueDetails;
101 : vcl::Font m_aStdFont;
102 : vcl::Font m_aFixedWidthFont;
103 :
104 : DECL_LINK( ElementSelectHdl, void* );
105 : void Clear( void );
106 : void InsertElement( const OUString& _rField, const OUString& _rValue,
107 : const OUString& _rDetails, bool _bFixedWidthFont = false );
108 : public:
109 : CertificateViewerDetailsTP( vcl::Window* pParent, CertificateViewer* _pDlg );
110 : virtual ~CertificateViewerDetailsTP();
111 :
112 : virtual void ActivatePage() SAL_OVERRIDE;
113 : };
114 :
115 :
116 : class CertificateViewerCertPathTP : public CertificateViewerTP
117 : {
118 : private:
119 : SvTreeListBox* mpCertPathLB;
120 : PushButton* mpViewCertPB;
121 : VclMultiLineEdit* mpCertStatusML;
122 :
123 : CertificateViewer* mpParent;
124 : bool mbFirstActivateDone;
125 : Image maCertImage;
126 : Image maCertNotValidatedImage;
127 : OUString msCertOK;
128 : OUString msCertNotValidated;
129 :
130 : DECL_LINK( ViewCertHdl, void* );
131 : DECL_LINK( CertSelectHdl, void* );
132 : void Clear( void );
133 : SvTreeListEntry* InsertCert( SvTreeListEntry* _pParent, const OUString& _rName,
134 : css::uno::Reference< css::security::XCertificate > rxCert,
135 : bool bValid);
136 :
137 : public:
138 : CertificateViewerCertPathTP( vcl::Window* pParent, CertificateViewer* _pDlg );
139 : virtual ~CertificateViewerCertPathTP();
140 :
141 : virtual void ActivatePage() SAL_OVERRIDE;
142 : };
143 :
144 :
145 : #endif // INCLUDED_XMLSECURITY_INC_XMLSECURITY_CERTIFICATEVIEWER_HXX
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|