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