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 #include <svtools/filedlg.hxx>
25 #include <vcl/msgbox.hxx>
26 
27 #ifndef UUI_IDS_HRC
28 #include <ids.hrc>
29 #endif
30 #ifndef UUI_MASTERPASSWORDDLG_HRC
31 #include <masterpassworddlg.hrc>
32 #endif
33 #include <masterpassworddlg.hxx>
34 
35 // MasterPasswordDialog---------------------------------------------------
36 
37 // -----------------------------------------------------------------------
38 
IMPL_LINK(MasterPasswordDialog,OKHdl_Impl,OKButton *,EMPTYARG)39 IMPL_LINK( MasterPasswordDialog, OKHdl_Impl, OKButton *, EMPTYARG )
40 {
41 	EndDialog( RET_OK );
42 	return 1;
43 }
44 
45 // -----------------------------------------------------------------------
46 
MasterPasswordDialog(Window * pParent,::com::sun::star::task::PasswordRequestMode aDialogMode,ResMgr * pResMgr)47 MasterPasswordDialog::MasterPasswordDialog
48 (
49 	Window*										pParent,
50 	::com::sun::star::task::PasswordRequestMode	aDialogMode,
51 	ResMgr*										pResMgr
52 ) :
53 
54 	ModalDialog( pParent, ResId( DLG_UUI_MASTERPASSWORD, *pResMgr ) ),
55 
56 	aFTMasterPassword		( this, ResId( FT_MASTERPASSWORD, *pResMgr ) ),
57     aEDMasterPassword		( this, ResId( ED_MASTERPASSWORD, *pResMgr ) ),
58     aFL ( this, ResId( FL_FIXED_LINE, *pResMgr ) ),
59 	aOKBtn					( this, ResId( BTN_MASTERPASSWORD_OK, *pResMgr ) ),
60 	aCancelBtn				( this, ResId( BTN_MASTERPASSWORD_CANCEL, *pResMgr ) ),
61 	aHelpBtn				( this, ResId( BTN_MASTERPASSWORD_HELP, *pResMgr ) ),
62 	nDialogMode				( aDialogMode ),
63 	pResourceMgr			( pResMgr )
64 {
65 	if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER )
66 	{
67 		String aErrorMsg( ResId( STR_ERROR_MASTERPASSWORD_WRONG, *pResourceMgr ));
68 		ErrorBox aErrorBox( pParent, WB_OK, aErrorMsg );
69 		aErrorBox.Execute();
70 	}
71 
72 	FreeResource();
73 
74 	aOKBtn.SetClickHdl( LINK( this, MasterPasswordDialog, OKHdl_Impl ) );
75 };
76 
77