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_MACROSECURITY_HXX
21 : #define _XMLSECURITY_MACROSECURITY_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 <unotools/securityoptions.hxx>
32 :
33 : #include <com/sun/star/uno/XComponentContext.hpp>
34 :
35 : namespace com {
36 : namespace sun {
37 : namespace star {
38 : namespace xml { namespace crypto {
39 : class XSecurityEnvironment; }}
40 : }}}
41 :
42 : class MacroSecurityTP;
43 :
44 : class MacroSecurity : public TabDialog
45 : {
46 : private:
47 : friend class MacroSecurityLevelTP;
48 : friend class MacroSecurityTrustedSourcesTP;
49 :
50 : TabControl* m_pTabCtrl;
51 : OKButton* m_pOkBtn;
52 : PushButton* m_pResetBtn;
53 :
54 : css::uno::Reference< css::uno::XComponentContext > mxCtx;
55 : css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
56 : SvtSecurityOptions maSecOptions;
57 :
58 : sal_uInt16 m_nSecLevelId;
59 : sal_uInt16 m_nSecTrustId;
60 :
61 : MacroSecurityTP* mpLevelTP;
62 : MacroSecurityTP* mpTrustSrcTP;
63 :
64 : DECL_LINK( OkBtnHdl, void* );
65 : public:
66 : MacroSecurity(Window* pParent,
67 : const css::uno::Reference< css::uno::XComponentContext>& rxCtx,
68 : const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment);
69 : virtual ~MacroSecurity();
70 :
71 0 : inline void EnableReset(bool _bEnable = true)
72 : {
73 0 : m_pResetBtn->Enable ( _bEnable );
74 0 : }
75 : };
76 :
77 0 : class MacroSecurityTP : public TabPage
78 : {
79 : protected:
80 : MacroSecurity* mpDlg;
81 : public:
82 : MacroSecurityTP(Window* _pParent, const OString& rID,
83 : const OUString& rUIXMLDescription, MacroSecurity* _pDlg);
84 :
85 : void SetTabDlg(MacroSecurity* pTabDlg)
86 : {
87 : mpDlg = pTabDlg;
88 : }
89 :
90 : virtual void ClosePage( void ) = 0;
91 : };
92 :
93 0 : class MacroSecurityLevelTP : public MacroSecurityTP
94 : {
95 : private:
96 : RadioButton* m_pVeryHighRB;
97 : RadioButton* m_pHighRB;
98 : RadioButton* m_pMediumRB;
99 : RadioButton* m_pLowRB;
100 :
101 : sal_uInt16 mnCurLevel;
102 :
103 : protected:
104 : DECL_LINK(RadioButtonHdl, void *);
105 :
106 : public:
107 : MacroSecurityLevelTP( Window* pParent, MacroSecurity* _pDlg );
108 :
109 : virtual void ClosePage( void ) SAL_OVERRIDE;
110 : };
111 :
112 :
113 : class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
114 : {
115 : private:
116 : FixedImage* m_pTrustCertROFI;
117 : SvSimpleTable* m_pTrustCertLB;
118 : PushButton* m_pViewCertPB;
119 : PushButton* m_pRemoveCertPB;
120 : FixedImage* m_pTrustFileROFI;
121 : ListBox* m_pTrustFileLocLB;
122 : PushButton* m_pAddLocPB;
123 : PushButton* m_pRemoveLocPB;
124 :
125 : css::uno::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors;
126 :
127 : bool mbAuthorsReadonly;
128 : bool mbURLsReadonly;
129 :
130 : DECL_LINK( ViewCertPBHdl, void* );
131 : DECL_LINK( RemoveCertPBHdl, void* );
132 : DECL_LINK( AddLocPBHdl, void* );
133 : DECL_LINK( RemoveLocPBHdl, void* );
134 : DECL_LINK( TrustCertLBSelectHdl, void* );
135 : DECL_LINK( TrustFileLocLBSelectHdl, void* );
136 :
137 : void FillCertLB( void );
138 : void ImplCheckButtons();
139 :
140 : public:
141 : MacroSecurityTrustedSourcesTP(Window* pParent, MacroSecurity* _pDlg);
142 : virtual ~MacroSecurityTrustedSourcesTP();
143 :
144 : virtual void ActivatePage() SAL_OVERRIDE;
145 : virtual void ClosePage( void ) SAL_OVERRIDE;
146 : };
147 :
148 :
149 : #endif // _XMLSECURITY_MACROSECURITY_HXX
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|