Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / options / securityoptions.cxx
blob4b00176ab4905bfe48606eeff8ffe913350f801a
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 <unotools/securityoptions.hxx>
21 #include "securityoptions.hxx"
23 namespace
25 bool enableAndSet(SvtSecurityOptions::EOption eOption,
26 weld::CheckButton& rCheckBox, weld::Widget& rFixedImage)
28 bool bEnable = !SvtSecurityOptions::IsReadOnly(eOption);
29 rCheckBox.set_sensitive(bEnable);
30 rFixedImage.set_visible(!bEnable);
31 rCheckBox.set_active(SvtSecurityOptions::IsOptionSet(eOption));
32 return bEnable;
36 namespace svx
39 SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent)
40 : GenericDialogController(pParent, "cui/ui/securityoptionsdialog.ui", "SecurityOptionsDialog")
41 , m_xSaveOrSendDocsCB(m_xBuilder->weld_check_button("savesenddocs"))
42 , m_xSaveOrSendDocsImg(m_xBuilder->weld_widget("locksavesenddocs"))
43 , m_xSignDocsCB(m_xBuilder->weld_check_button("whensigning"))
44 , m_xSignDocsImg(m_xBuilder->weld_widget("lockwhensigning"))
45 , m_xPrintDocsCB(m_xBuilder->weld_check_button("whenprinting"))
46 , m_xPrintDocsImg(m_xBuilder->weld_widget("lockwhenprinting"))
47 , m_xCreatePdfCB(m_xBuilder->weld_check_button("whenpdf"))
48 , m_xCreatePdfImg(m_xBuilder->weld_widget("lockwhenpdf"))
49 , m_xRemovePersInfoCB(m_xBuilder->weld_check_button("removepersonal"))
50 , m_xRemovePersInfoImg(m_xBuilder->weld_widget("lockremovepersonal"))
51 , m_xRecommPasswdCB(m_xBuilder->weld_check_button("password"))
52 , m_xRecommPasswdImg(m_xBuilder->weld_widget("lockpassword"))
53 , m_xCtrlHyperlinkCB(m_xBuilder->weld_check_button("ctrlclick"))
54 , m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick"))
55 , m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted"))
56 , m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted"))
58 enableAndSet(SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB,
59 *m_xSaveOrSendDocsImg);
60 enableAndSet(SvtSecurityOptions::EOption::DocWarnSigning, *m_xSignDocsCB,
61 *m_xSignDocsImg);
62 enableAndSet(SvtSecurityOptions::EOption::DocWarnPrint, *m_xPrintDocsCB,
63 *m_xPrintDocsImg);
64 enableAndSet(SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_xCreatePdfCB,
65 *m_xCreatePdfImg);
66 enableAndSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB,
67 *m_xRemovePersInfoImg);
68 enableAndSet(SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB,
69 *m_xRecommPasswdImg);
70 enableAndSet(SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB,
71 *m_xCtrlHyperlinkImg);
72 enableAndSet(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB,
73 *m_xBlockUntrustedRefererLinksImg);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */