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 INCLUDED_XMLSECURITY_INC_XMLSECURITY_MACROSECURITY_HXX
21 : #define INCLUDED_XMLSECURITY_INC_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 : VclPtr<TabControl> m_pTabCtrl;
51 : VclPtr<OKButton> m_pOkBtn;
52 : VclPtr<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 : VclPtr<MacroSecurityTP> mpLevelTP;
62 : VclPtr<MacroSecurityTP> mpTrustSrcTP;
63 :
64 : DECL_LINK( OkBtnHdl, void* );
65 : public:
66 : MacroSecurity(vcl::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 : virtual void dispose() SAL_OVERRIDE;
71 :
72 0 : inline void EnableReset(bool _bEnable = true)
73 : {
74 0 : m_pResetBtn->Enable ( _bEnable );
75 0 : }
76 : };
77 :
78 : class MacroSecurityTP : public TabPage
79 : {
80 : protected:
81 : VclPtr<MacroSecurity> mpDlg;
82 : public:
83 : MacroSecurityTP(vcl::Window* _pParent, const OString& rID,
84 : const OUString& rUIXMLDescription, MacroSecurity* _pDlg);
85 : virtual ~MacroSecurityTP();
86 : virtual void dispose() SAL_OVERRIDE;
87 :
88 : void SetTabDlg(MacroSecurity* pTabDlg)
89 : {
90 : mpDlg = pTabDlg;
91 : }
92 :
93 : virtual void ClosePage() = 0;
94 : };
95 :
96 : class MacroSecurityLevelTP : public MacroSecurityTP
97 : {
98 : private:
99 : VclPtr<RadioButton> m_pVeryHighRB;
100 : VclPtr<RadioButton> m_pHighRB;
101 : VclPtr<RadioButton> m_pMediumRB;
102 : VclPtr<RadioButton> m_pLowRB;
103 :
104 : sal_uInt16 mnCurLevel;
105 :
106 : protected:
107 : DECL_LINK(RadioButtonHdl, void *);
108 :
109 : public:
110 : MacroSecurityLevelTP( vcl::Window* pParent, MacroSecurity* _pDlg );
111 : virtual ~MacroSecurityLevelTP();
112 : virtual void dispose() SAL_OVERRIDE;
113 :
114 : virtual void ClosePage() SAL_OVERRIDE;
115 : };
116 :
117 :
118 : class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
119 : {
120 : private:
121 : VclPtr<FixedImage> m_pTrustCertROFI;
122 : VclPtr<SvSimpleTable> m_pTrustCertLB;
123 : VclPtr<PushButton> m_pViewCertPB;
124 : VclPtr<PushButton> m_pRemoveCertPB;
125 : VclPtr<FixedImage> m_pTrustFileROFI;
126 : VclPtr<ListBox> m_pTrustFileLocLB;
127 : VclPtr<PushButton> m_pAddLocPB;
128 : VclPtr<PushButton> m_pRemoveLocPB;
129 :
130 : css::uno::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors;
131 :
132 : bool mbAuthorsReadonly;
133 : bool mbURLsReadonly;
134 :
135 : DECL_LINK( ViewCertPBHdl, void* );
136 : DECL_LINK( RemoveCertPBHdl, void* );
137 : DECL_LINK( AddLocPBHdl, void* );
138 : DECL_LINK( RemoveLocPBHdl, void* );
139 : DECL_LINK( TrustCertLBSelectHdl, void* );
140 : DECL_LINK( TrustFileLocLBSelectHdl, void* );
141 :
142 : void FillCertLB();
143 : void ImplCheckButtons();
144 :
145 : public:
146 : MacroSecurityTrustedSourcesTP(vcl::Window* pParent, MacroSecurity* _pDlg);
147 : virtual ~MacroSecurityTrustedSourcesTP();
148 : virtual void dispose() SAL_OVERRIDE;
149 :
150 : virtual void ActivatePage() SAL_OVERRIDE;
151 : virtual void ClosePage() SAL_OVERRIDE;
152 : };
153 :
154 :
155 : #endif // INCLUDED_XMLSECURITY_INC_XMLSECURITY_MACROSECURITY_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|