1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #ifndef _XMLSECURITY_MACROSECURITY_HXX
25 #define _XMLSECURITY_MACROSECURITY_HXX
26
27 #include <vcl/fixed.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/tabdlg.hxx>
31 #include <vcl/tabctrl.hxx>
32 #include <vcl/tabpage.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <svx/simptabl.hxx>
35 #include <unotools/securityoptions.hxx>
36
37 namespace com {
38 namespace sun {
39 namespace star {
40 namespace xml { namespace crypto {
41 class XSecurityEnvironment; }}
42 }}}
43
44 namespace css = com::sun::star;
45 namespace cssu = com::sun::star::uno;
46 namespace dcss = ::com::sun::star;
47
48 class MacroSecurityTP;
49
50 class ReadOnlyImage : public FixedImage
51 {
52 public:
53 ReadOnlyImage(Window* pParent, const ResId rResId);
54 ~ReadOnlyImage();
55
56 virtual void RequestHelp( const HelpEvent& rHEvt );
57 static const String& GetHelpTip();
58 };
59
60 class MacroSecurity : public TabDialog
61 {
62 private:
63 friend class MacroSecurityLevelTP;
64 friend class MacroSecurityTrustedSourcesTP;
65
66 TabControl maTabCtrl;
67 OKButton maOkBtn;
68 CancelButton maCancelBtn;
69 HelpButton maHelpBtn;
70 PushButton maResetBtn;
71
72 cssu::Reference< cssu::XComponentContext > mxCtx;
73 cssu::Reference< dcss::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
74 SvtSecurityOptions maSecOptions;
75
76 MacroSecurityTP* mpLevelTP;
77 MacroSecurityTP* mpTrustSrcTP;
78
79 DECL_LINK( OkBtnHdl, void* );
80 public:
81 MacroSecurity( Window* pParent, const cssu::Reference< cssu::XComponentContext>& rxCtx, const cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment );
82 virtual ~MacroSecurity();
83
84 inline void EnableReset( bool _bEnable = true );
85 };
86
EnableReset(bool _bEnable)87 inline void MacroSecurity::EnableReset( bool _bEnable )
88 {
89 maResetBtn.Enable ( _bEnable );
90 }
91
92 class MacroSecurityTP : public TabPage
93 {
94 protected:
95 MacroSecurity* mpDlg;
96 public:
97 MacroSecurityTP( Window* _pParent, const ResId& _rResId, MacroSecurity* _pDlg );
98 inline void SetTabDlg( MacroSecurity* pTabDlg );
99
100 virtual void ClosePage( void ) = 0;
101 };
102
SetTabDlg(MacroSecurity * _pTabDlg)103 inline void MacroSecurityTP::SetTabDlg( MacroSecurity* _pTabDlg )
104 {
105 mpDlg = _pTabDlg;
106 }
107
108
109 class MacroSecurityLevelTP : public MacroSecurityTP
110 {
111 private:
112 FixedLine maSecLevelFL;
113 ReadOnlyImage maSecReadonlyFI;
114 RadioButton maVeryHighRB;
115 RadioButton maHighRB;
116 RadioButton maMediumRB;
117 RadioButton maLowRB;
118
119 sal_uInt16 mnCurLevel;
120
121 protected:
122 DECL_LINK( RadioButtonHdl, RadioButton* );
123
124 public:
125 MacroSecurityLevelTP( Window* pParent, MacroSecurity* _pDlg );
126
127 virtual void ClosePage( void );
128 };
129
130
131 class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
132 {
133 private:
134 FixedLine maTrustCertFL;
135 ReadOnlyImage maTrustCertROFI;
136 SvxSimpleTable maTrustCertLB; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
137 PushButton maAddCertPB;
138 PushButton maViewCertPB;
139 PushButton maRemoveCertPB;
140 FixedLine maTrustFileLocFL;
141 ReadOnlyImage maTrustFileROFI;
142 FixedInfo maTrustFileLocFI;
143 ListBox maTrustFileLocLB;
144 PushButton maAddLocPB;
145 PushButton maRemoveLocPB;
146
147 cssu::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors;
148
149 sal_Bool mbAuthorsReadonly;
150 sal_Bool mbURLsReadonly;
151
152 DECL_LINK( ViewCertPBHdl, void* );
153 DECL_LINK( RemoveCertPBHdl, void* );
154 DECL_LINK( AddLocPBHdl, void* );
155 DECL_LINK( RemoveLocPBHdl, void* );
156 DECL_LINK( TrustCertLBSelectHdl, void* );
157 DECL_LINK( TrustFileLocLBSelectHdl, void* );
158
159 void FillCertLB( void );
160 void ImplCheckButtons();
161
162 public:
163 MacroSecurityTrustedSourcesTP( Window* pParent, MacroSecurity* _pDlg );
164
165 virtual void ActivatePage();
166 virtual void ClosePage( void );
167 };
168
169
170 #endif // _XMLSECURITY_MACROSECURITY_HXX
171
172