Update ooo320-m1
[ooovba.git] / svx / source / cui / securityoptions.cxx
blob8689d911ec0f95ad3fdba753ff7bb86ff47491ce
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: securityoptions.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 // include ---------------------------------------------------------------
40 #ifndef INCLUDED_SVTOOLS_SECURITIYOPTIONS_HXX
41 #include <svtools/securityoptions.hxx>
42 #endif
43 #include <svtools/stdctrl.hxx>
44 #include <svx/dialmgr.hxx>
45 #ifndef _SVX_DIALOGS_HRC
46 #include <svx/dialogs.hrc>
47 #endif
49 #include "securityoptions.hxx"
50 #include "securityoptions.hrc"
52 namespace
54 bool enableAndSet( const SvtSecurityOptions& rOptions,
55 SvtSecurityOptions::EOption eOption,
56 CheckBox& rCheckBox, FixedImage& rFixedImage )
58 bool bEnable = rOptions.IsOptionEnabled( eOption );
59 rCheckBox.Enable( bEnable );
60 rFixedImage.Show( !bEnable );
61 rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
62 return bEnable;
66 //........................................................................
67 namespace svx
69 //........................................................................
71 SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) :
72 ModalDialog( pParent, SVX_RES( RID_SVXDLG_SECURITY_OPTIONS ) )
73 ,m_aWarningsFL ( this, SVX_RES( FL_WARNINGS ) )
74 ,m_aWarningsFI ( this, SVX_RES( FI_WARNINGS ) )
75 ,m_aSaveOrSendDocsFI( this, SVX_RES( FI_SAVESENDDOCS ) )
76 ,m_aSaveOrSendDocsCB( this, SVX_RES( CB_SAVESENDDOCS ) )
77 ,m_aSignDocsFI ( this, SVX_RES( FI_SIGNDOCS ) )
78 ,m_aSignDocsCB ( this, SVX_RES( CB_SIGNDOCS ) )
79 ,m_aPrintDocsFI ( this, SVX_RES( FI_PRINTDOCS ) )
80 ,m_aPrintDocsCB ( this, SVX_RES( CB_PRINTDOCS ) )
81 ,m_aCreatePdfFI ( this, SVX_RES( FI_CREATEPDF ) )
82 ,m_aCreatePdfCB ( this, SVX_RES( CB_CREATEPDF ) )
83 ,m_aOptionsFL ( this, SVX_RES( FL_OPTIONS ) )
84 ,m_aRemovePersInfoFI( this, SVX_RES( FI_REMOVEINFO ) )
85 ,m_aRemovePersInfoCB( this, SVX_RES( CB_REMOVEINFO ) )
86 ,m_aRecommPasswdFI ( this, SVX_RES( FI_RECOMMENDPWD ) )
87 ,m_aRecommPasswdCB ( this, SVX_RES( CB_RECOMMENDPWD ) )
88 ,m_aCtrlHyperlinkFI ( this, SVX_RES( FI_CTRLHYPERLINK ) )
89 ,m_aCtrlHyperlinkCB ( this, SVX_RES( CB_CTRLHYPERLINK ) )
91 ,m_aButtonsFL ( this, SVX_RES( FL_BUTTONS ) )
92 ,m_aOKBtn ( this, SVX_RES( PB_OK ) )
93 ,m_aCancelBtn ( this, SVX_RES( PB_CANCEL ) )
94 ,m_aHelpBtn ( this, SVX_RES( PB_HELP ) )
97 FreeResource();
99 DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
100 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI );
101 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI );
102 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI );
103 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI );
104 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI );
105 enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI );
106 enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI );
109 SecurityOptionsDialog::~SecurityOptionsDialog()
113 //........................................................................
114 } // namespace svx
115 //........................................................................