1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 // include ---------------------------------------------------------------
28 
29 #include <unotools/securityoptions.hxx>
30 #include <svtools/stdctrl.hxx>
31 #include <dialmgr.hxx>
32 #include <cuires.hrc>
33 #include "securityoptions.hxx"
34 #include "securityoptions.hrc"
35 
36 namespace
37 {
enableAndSet(const SvtSecurityOptions & rOptions,SvtSecurityOptions::EOption eOption,CheckBox & rCheckBox,FixedImage & rFixedImage)38     bool enableAndSet( const SvtSecurityOptions& rOptions,
39                        SvtSecurityOptions::EOption eOption,
40                        CheckBox& rCheckBox, FixedImage& rFixedImage )
41     {
42         bool bEnable = rOptions.IsOptionEnabled( eOption );
43         rCheckBox.Enable( bEnable );
44         rFixedImage.Show( !bEnable );
45         rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
46         return bEnable;
47     }
48 }
49 
50 //........................................................................
51 namespace svx
52 {
53 //........................................................................
54 
SecurityOptionsDialog(Window * pParent,SvtSecurityOptions * pOptions)55 SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) :
56      ModalDialog( pParent, CUI_RES( RID_SVXDLG_SECURITY_OPTIONS ) )
57     ,m_aWarningsFL      ( this, CUI_RES( FL_WARNINGS ) )
58     ,m_aWarningsFI      ( this, CUI_RES( FI_WARNINGS ) )
59     ,m_aSaveOrSendDocsFI( this, CUI_RES( FI_SAVESENDDOCS ) )
60     ,m_aSaveOrSendDocsCB( this, CUI_RES( CB_SAVESENDDOCS ) )
61     ,m_aSignDocsFI      ( this, CUI_RES( FI_SIGNDOCS ) )
62     ,m_aSignDocsCB      ( this, CUI_RES( CB_SIGNDOCS ) )
63     ,m_aPrintDocsFI     ( this, CUI_RES( FI_PRINTDOCS ) )
64     ,m_aPrintDocsCB     ( this, CUI_RES( CB_PRINTDOCS ) )
65     ,m_aCreatePdfFI     ( this, CUI_RES( FI_CREATEPDF ) )
66     ,m_aCreatePdfCB     ( this, CUI_RES( CB_CREATEPDF ) )
67     ,m_aOptionsFL       ( this, CUI_RES( FL_OPTIONS ) )
68     ,m_aRemovePersInfoFI( this, CUI_RES( FI_REMOVEINFO ) )
69     ,m_aRemovePersInfoCB( this, CUI_RES( CB_REMOVEINFO ) )
70     ,m_aRecommPasswdFI  ( this, CUI_RES( FI_RECOMMENDPWD ) )
71     ,m_aRecommPasswdCB  ( this, CUI_RES( CB_RECOMMENDPWD ) )
72     ,m_aCtrlHyperlinkFI ( this, CUI_RES( FI_CTRLHYPERLINK ) )
73     ,m_aCtrlHyperlinkCB ( this, CUI_RES( CB_CTRLHYPERLINK ) )
74 
75     ,m_aButtonsFL       ( this, CUI_RES( FL_BUTTONS ) )
76     ,m_aOKBtn           ( this, CUI_RES( PB_OK ) )
77     ,m_aCancelBtn       ( this, CUI_RES( PB_CANCEL ) )
78     ,m_aHelpBtn         ( this, CUI_RES( PB_HELP ) )
79 
80 {
81     FreeResource();
82 
83     DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
84     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI );
85     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI );
86     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI );
87     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI );
88     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI );
89     enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI );
90     enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI );
91 }
92 
~SecurityOptionsDialog()93 SecurityOptionsDialog::~SecurityOptionsDialog()
94 {
95 }
96 
97 //........................................................................
98 }   // namespace svx
99 //........................................................................
100 
101