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 : #include <unotools/securityoptions.hxx>
21 : #include <svtools/stdctrl.hxx>
22 : #include <dialmgr.hxx>
23 : #include <cuires.hrc>
24 : #include "securityoptions.hxx"
25 :
26 : namespace
27 : {
28 0 : bool enableAndSet( const SvtSecurityOptions& rOptions,
29 : SvtSecurityOptions::EOption eOption,
30 : CheckBox& rCheckBox, FixedImage& rFixedImage )
31 : {
32 0 : bool bEnable = rOptions.IsOptionEnabled( eOption );
33 0 : rCheckBox.Enable( bEnable );
34 0 : rFixedImage.Show( !bEnable );
35 0 : rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
36 0 : return bEnable;
37 : }
38 : }
39 :
40 :
41 : namespace svx
42 : {
43 :
44 :
45 0 : SecurityOptionsDialog::SecurityOptionsDialog(vcl::Window* pParent, SvtSecurityOptions* pOptions)
46 0 : : ModalDialog(pParent, "SecurityOptionsDialog", "cui/ui/securityoptionsdialog.ui")
47 : {
48 : DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
49 0 : get(m_pSaveOrSendDocsCB, "savesenddocs");
50 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, *m_pSaveOrSendDocsCB,
51 0 : *get<FixedImage>("locksavesenddocs"));
52 0 : get(m_pSignDocsCB, "whensigning");
53 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, *m_pSignDocsCB,
54 0 : *get<FixedImage>("lockwhensigning"));
55 0 : get(m_pPrintDocsCB, "whenprinting");
56 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, *m_pPrintDocsCB,
57 0 : *get<FixedImage>("lockwhenprinting"));
58 0 : get(m_pCreatePdfCB, "whenpdf");
59 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, *m_pCreatePdfCB,
60 0 : *get<FixedImage>("lockwhenpdf"));
61 0 : get(m_pRemovePersInfoCB, "removepersonal");
62 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, *m_pRemovePersInfoCB,
63 0 : *get<FixedImage>("lockremovepersonal"));
64 0 : get(m_pRecommPasswdCB, "password");
65 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, *m_pRecommPasswdCB,
66 0 : *get<FixedImage>("lockpassword"));
67 0 : get(m_pCtrlHyperlinkCB, "ctrlclick");
68 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, *m_pCtrlHyperlinkCB,
69 0 : *get<FixedImage>("lockctrlclick"));
70 0 : get(m_pBlockUntrustedRefererLinksCB, "blockuntrusted");
71 0 : enableAndSet(*pOptions, SvtSecurityOptions::E_BLOCKUNTRUSTEDREFERERLINKS, *m_pBlockUntrustedRefererLinksCB,
72 0 : *get<FixedImage>("lockblockuntrusted"));
73 0 : }
74 :
75 0 : SecurityOptionsDialog::~SecurityOptionsDialog()
76 : {
77 0 : disposeOnce();
78 0 : }
79 :
80 0 : void SecurityOptionsDialog::dispose()
81 : {
82 0 : m_pSaveOrSendDocsCB.clear();
83 0 : m_pSignDocsCB.clear();
84 0 : m_pPrintDocsCB.clear();
85 0 : m_pCreatePdfCB.clear();
86 0 : m_pRemovePersInfoCB.clear();
87 0 : m_pRecommPasswdCB.clear();
88 0 : m_pCtrlHyperlinkCB.clear();
89 0 : m_pBlockUntrustedRefererLinksCB.clear();
90 0 : ModalDialog::dispose();
91 0 : }
92 :
93 0 : }
94 :
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|