Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / cui / source / options / securityoptions.cxx
blob202128b99860c339cc5fd27d28501874383d3424
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/debug.hxx>
21 #include <unotools/securityoptions.hxx>
22 #include "securityoptions.hxx"
24 namespace
26 bool enableAndSet(const SvtSecurityOptions& rOptions,
27 SvtSecurityOptions::EOption eOption,
28 weld::CheckButton& rCheckBox, weld::Widget& rFixedImage)
30 bool bEnable = rOptions.IsOptionEnabled(eOption);
31 rCheckBox.set_sensitive(bEnable);
32 rFixedImage.set_visible(!bEnable);
33 rCheckBox.set_active(rOptions.IsOptionSet(eOption));
34 return bEnable;
38 namespace svx
41 SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions)
42 : GenericDialogController(pParent, "cui/ui/securityoptionsdialog.ui", "SecurityOptionsDialog")
43 , m_xSaveOrSendDocsCB(m_xBuilder->weld_check_button("savesenddocs"))
44 , m_xSaveOrSendDocsImg(m_xBuilder->weld_widget("locksavesenddocs"))
45 , m_xSignDocsCB(m_xBuilder->weld_check_button("whensigning"))
46 , m_xSignDocsImg(m_xBuilder->weld_widget("lockwhensigning"))
47 , m_xPrintDocsCB(m_xBuilder->weld_check_button("whenprinting"))
48 , m_xPrintDocsImg(m_xBuilder->weld_widget("lockwhenprinting"))
49 , m_xCreatePdfCB(m_xBuilder->weld_check_button("whenpdf"))
50 , m_xCreatePdfImg(m_xBuilder->weld_widget("lockwhenpdf"))
51 , m_xRemovePersInfoCB(m_xBuilder->weld_check_button("removepersonal"))
52 , m_xRemovePersInfoImg(m_xBuilder->weld_widget("lockremovepersonal"))
53 , m_xRecommPasswdCB(m_xBuilder->weld_check_button("password"))
54 , m_xRecommPasswdImg(m_xBuilder->weld_widget("lockpassword"))
55 , m_xCtrlHyperlinkCB(m_xBuilder->weld_check_button("ctrlclick"))
56 , m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick"))
57 , m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted"))
58 , m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted"))
60 DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
61 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB,
62 *m_xSaveOrSendDocsImg);
63 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSigning, *m_xSignDocsCB,
64 *m_xSignDocsImg);
65 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnPrint, *m_xPrintDocsCB,
66 *m_xPrintDocsImg);
67 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_xCreatePdfCB,
68 *m_xCreatePdfImg);
69 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB,
70 *m_xRemovePersInfoImg);
71 enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB,
72 *m_xRecommPasswdImg);
73 enableAndSet(*pOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB,
74 *m_xCtrlHyperlinkImg);
75 enableAndSet(*pOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB,
76 *m_xBlockUntrustedRefererLinksImg);
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */