1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLSECURITY_INC_CERTIFICATEVIEWER_HXX
21 #define INCLUDED_XMLSECURITY_INC_CERTIFICATEVIEWER_HXX
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/svmedit.hxx>
37 namespace xml
{ namespace crypto
{
38 class XSecurityEnvironment
; }}
41 class CertificateViewer
: public TabDialog
44 friend class CertificateViewerGeneralTP
;
45 friend class CertificateViewerDetailsTP
;
46 friend class CertificateViewerCertPathTP
;
48 VclPtr
<TabControl
> mpTabCtrl
;
49 sal_uInt16 mnGeneralId
;
50 sal_uInt16 mnDetailsId
;
53 bool mbCheckForPrivateKey
;
55 css::uno::Reference
< css::xml::crypto::XSecurityEnvironment
> mxSecurityEnvironment
;
56 css::uno::Reference
< css::security::XCertificate
> mxCert
;
58 CertificateViewer( vcl::Window
* pParent
, const css::uno::Reference
< css::xml::crypto::XSecurityEnvironment
>& rxSecurityEnvironment
, const css::uno::Reference
< css::security::XCertificate
>& rXCert
, bool bCheckForPrivateKey
);
59 virtual ~CertificateViewer() override
;
60 virtual void dispose() override
;
64 class CertificateViewerTP
: public TabPage
67 VclPtr
<CertificateViewer
> mpDlg
;
69 CertificateViewerTP( vcl::Window
* _pParent
, const OString
& rID
,
70 const OUString
& rUIXMLDescription
, CertificateViewer
* _pDlg
);
71 virtual ~CertificateViewerTP() override
;
72 virtual void dispose() override
;
75 class CertificateViewerGeneralTP
: public CertificateViewerTP
78 VclPtr
<FixedImage
> m_pCertImg
;
79 VclPtr
<FixedText
> m_pHintNotTrustedFT
;
80 VclPtr
<FixedText
> m_pIssuedToLabelFT
;
81 VclPtr
<FixedText
> m_pIssuedToFT
;
82 VclPtr
<FixedText
> m_pIssuedByLabelFT
;
83 VclPtr
<FixedText
> m_pIssuedByFT
;
84 VclPtr
<FixedText
> m_pValidFromDateFT
;
85 VclPtr
<FixedText
> m_pValidToDateFT
;
86 VclPtr
<FixedImage
> m_pKeyImg
;
87 VclPtr
<FixedText
> m_pHintCorrespPrivKeyFT
;
89 CertificateViewerGeneralTP( vcl::Window
* pParent
, CertificateViewer
* _pDlg
);
90 virtual ~CertificateViewerGeneralTP() override
;
91 virtual void dispose() override
;
93 virtual void ActivatePage() override
;
97 class CertificateViewerDetailsTP
: public CertificateViewerTP
100 VclPtr
<SvSimpleTableContainer
> m_pElementsLBContainer
;
101 VclPtr
<SvSimpleTable
> m_pElementsLB
;
102 VclPtr
<VclMultiLineEdit
> m_pValueDetails
;
103 vcl::Font m_aStdFont
;
104 vcl::Font m_aFixedWidthFont
;
106 DECL_LINK( ElementSelectHdl
, SvTreeListBox
*, void );
108 void InsertElement( const OUString
& _rField
, const OUString
& _rValue
,
109 const OUString
& _rDetails
, bool _bFixedWidthFont
= false );
111 CertificateViewerDetailsTP( vcl::Window
* pParent
, CertificateViewer
* _pDlg
);
112 virtual ~CertificateViewerDetailsTP() override
;
113 virtual void dispose() override
;
115 virtual void ActivatePage() override
;
119 class CertificateViewerCertPathTP
: public CertificateViewerTP
122 VclPtr
<SvTreeListBox
> mpCertPathLB
;
123 VclPtr
<PushButton
> mpViewCertPB
;
124 VclPtr
<VclMultiLineEdit
> mpCertStatusML
;
126 VclPtr
<CertificateViewer
> mpParent
;
127 bool mbFirstActivateDone
;
129 Image maCertNotValidatedImage
;
131 OUString msCertNotValidated
;
133 DECL_LINK( ViewCertHdl
, Button
*, void );
134 DECL_LINK( CertSelectHdl
, SvTreeListBox
*, void );
136 SvTreeListEntry
* InsertCert( SvTreeListEntry
* _pParent
, const OUString
& _rName
,
137 const css::uno::Reference
< css::security::XCertificate
>& rxCert
,
141 CertificateViewerCertPathTP( vcl::Window
* pParent
, CertificateViewer
* _pDlg
);
142 virtual ~CertificateViewerCertPathTP() override
;
143 virtual void dispose() override
;
145 virtual void ActivatePage() override
;
149 #endif // INCLUDED_XMLSECURITY_INC_CERTIFICATEVIEWER_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */