Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / options / securityoptions.cxx
blobf36f863497332341c3d83189c41c33f1bd050964
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 <svtools/stdctrl.hxx>
22 #include <dialmgr.hxx>
23 #include <cuires.hrc>
24 #include "securityoptions.hxx"
25 #include "securityoptions.hrc"
27 namespace
29 bool enableAndSet( const SvtSecurityOptions& rOptions,
30 SvtSecurityOptions::EOption eOption,
31 CheckBox& rCheckBox, FixedImage& rFixedImage )
33 bool bEnable = rOptions.IsOptionEnabled( eOption );
34 rCheckBox.Enable( bEnable );
35 rFixedImage.Show( !bEnable );
36 rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
37 return bEnable;
41 //........................................................................
42 namespace svx
44 //........................................................................
46 SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) :
47 ModalDialog( pParent, CUI_RES( RID_SVXDLG_SECURITY_OPTIONS ) )
48 ,m_aWarningsFL ( this, CUI_RES( FL_WARNINGS ) )
49 ,m_aWarningsFI ( this, CUI_RES( FI_WARNINGS ) )
50 ,m_aSaveOrSendDocsFI( this, CUI_RES( FI_SAVESENDDOCS ) )
51 ,m_aSaveOrSendDocsCB( this, CUI_RES( CB_SAVESENDDOCS ) )
52 ,m_aSignDocsFI ( this, CUI_RES( FI_SIGNDOCS ) )
53 ,m_aSignDocsCB ( this, CUI_RES( CB_SIGNDOCS ) )
54 ,m_aPrintDocsFI ( this, CUI_RES( FI_PRINTDOCS ) )
55 ,m_aPrintDocsCB ( this, CUI_RES( CB_PRINTDOCS ) )
56 ,m_aCreatePdfFI ( this, CUI_RES( FI_CREATEPDF ) )
57 ,m_aCreatePdfCB ( this, CUI_RES( CB_CREATEPDF ) )
58 ,m_aOptionsFL ( this, CUI_RES( FL_OPTIONS ) )
59 ,m_aRemovePersInfoFI( this, CUI_RES( FI_REMOVEINFO ) )
60 ,m_aRemovePersInfoCB( this, CUI_RES( CB_REMOVEINFO ) )
61 ,m_aRecommPasswdFI ( this, CUI_RES( FI_RECOMMENDPWD ) )
62 ,m_aRecommPasswdCB ( this, CUI_RES( CB_RECOMMENDPWD ) )
63 ,m_aCtrlHyperlinkFI ( this, CUI_RES( FI_CTRLHYPERLINK ) )
64 ,m_aCtrlHyperlinkCB ( this, CUI_RES( CB_CTRLHYPERLINK ) )
66 ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) )
67 ,m_aOKBtn ( this, CUI_RES( PB_OK ) )
68 ,m_aCancelBtn ( this, CUI_RES( PB_CANCEL ) )
69 ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) )
72 FreeResource();
74 DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
75 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI );
76 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI );
77 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI );
78 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI );
79 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI );
80 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI );
81 enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI );
84 SecurityOptionsDialog::~SecurityOptionsDialog()
88 //........................................................................
89 } // namespace svx
90 //........................................................................
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */