/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #pragma once #include namespace com::sun::star { namespace security { class XCertificate; } namespace xml::crypto { class XSecurityEnvironment; } } class CertificateViewerGeneralTP; class CertificateViewerDetailsTP; class CertificateViewerCertPathTP; class CertificateChooser; class CertificateViewer final : public weld::GenericDialogController { private: friend class CertificateViewerGeneralTP; friend class CertificateViewerDetailsTP; friend class CertificateViewerCertPathTP; bool const mbCheckForPrivateKey; css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment; css::uno::Reference< css::security::XCertificate > mxCert; CertificateChooser* mpParentChooser; std::unique_ptr mxTabCtrl; std::unique_ptr mxGeneralPage; std::unique_ptr mxDetailsPage; std::unique_ptr mxPathId; DECL_LINK(ActivatePageHdl, const OString&, void); public: CertificateViewer(weld::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey, CertificateChooser* pParentChooser); CertificateChooser* GetParentChooser() { return mpParentChooser; } }; class CertificateViewerTP { protected: std::unique_ptr mxBuilder; std::unique_ptr mxContainer; CertificateViewer* mpDlg; public: CertificateViewerTP(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID, CertificateViewer* pDlg); }; class CertificateViewerGeneralTP : public CertificateViewerTP { private: std::unique_ptr m_xCertImg; std::unique_ptr m_xHintNotTrustedFT; std::unique_ptr m_xIssuedToLabelFT; std::unique_ptr m_xIssuedToFT; std::unique_ptr m_xIssuedByLabelFT; std::unique_ptr m_xIssuedByFT; std::unique_ptr m_xValidFromDateFT; std::unique_ptr m_xValidToDateFT; std::unique_ptr m_xKeyImg; std::unique_ptr m_xHintCorrespPrivKeyFT; public: CertificateViewerGeneralTP(weld::Container* pParent, CertificateViewer* pDlg); }; struct Details_UserDatat { OUString const maTxt; bool const mbFixedWidthFont; Details_UserDatat(const OUString& rTxt, bool bFixedWidthFont) : maTxt(rTxt) , mbFixedWidthFont(bFixedWidthFont) { } }; class CertificateViewerDetailsTP : public CertificateViewerTP { private: std::vector> m_aUserData; std::unique_ptr m_xElementsLB; std::unique_ptr m_xValueDetails; DECL_LINK(ElementSelectHdl, weld::TreeView&, void); void InsertElement(const OUString& rField, const OUString& rValue, const OUString& rDetails, bool bFixedWidthFont = false); public: CertificateViewerDetailsTP(weld::Container* pParent, CertificateViewer* pDlg); }; struct CertPath_UserData { css::uno::Reference< css::security::XCertificate > mxCert; bool const mbValid; CertPath_UserData(css::uno::Reference const & xCert, bool bValid) : mxCert(xCert) , mbValid(bValid) { } }; class CertificateViewerCertPathTP : public CertificateViewerTP { private: CertificateViewer* mpParent; bool mbFirstActivateDone; std::vector> maUserData; std::unique_ptr mxCertPathLB; std::unique_ptr mxScratchIter; std::unique_ptr mxViewCertPB; std::unique_ptr mxCertStatusML; std::unique_ptr mxCertOK; std::unique_ptr mxCertNotValidated; DECL_LINK(ViewCertHdl, weld::Button&, void); DECL_LINK(CertSelectHdl, weld::TreeView&, void); void InsertCert(const weld::TreeIter* pParent, const OUString& _rName, const css::uno::Reference< css::security::XCertificate >& rxCert, bool bValid); public: CertificateViewerCertPathTP(weld::Container* pParent, CertificateViewer* pDlg); void ActivatePage(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */