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