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