xref: /aoo41x/main/uui/source/unknownauthdlg.cxx (revision cdf0e10c)
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 #include <vcl/msgbox.hxx>
29 
30 #ifndef UUI_IDS_HRC
31 #include <ids.hrc>
32 #endif
33 #ifndef UUI_UNKNOWNAUTHDLG_HRC
34 #include <unknownauthdlg.hrc>
35 #endif
36 #ifndef UUI_UNKNOWNAUTHDLG_HXX
37 #include <unknownauthdlg.hxx>
38 #endif
39 
40 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
41 
42 // -----------------------------------------------------------------------
43 
44 IMPL_LINK( UnknownAuthDialog, OKHdl_Impl, PushButton *, EMPTYARG )
45 {
46 	if ( m_aOptionButtonAccept.IsChecked() )
47 	{
48 		EndDialog( RET_OK );
49 	} else
50 	{
51 		EndDialog( RET_CANCEL );
52 	}
53 
54 	return 1;
55 }
56 
57 // -----------------------------------------------------------------------
58 
59 IMPL_LINK( UnknownAuthDialog, ViewCertHdl_Impl, PushButton *, EMPTYARG )
60 {
61 	uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
62 
63     xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
64                     getServiceFactory().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
65 
66 	xDocumentDigitalSignatures.get()->showCertificate(getCert());
67 
68 	return 0;
69 }
70 
71 // -----------------------------------------------------------------------
72 
73 UnknownAuthDialog::UnknownAuthDialog
74 (
75 	Window*										pParent,
76 	const cssu::Reference< dcss::security::XCertificate >& rXCert,
77 	const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
78 	ResMgr*										pResMgr
79 ) :
80 	ModalDialog( pParent, ResId( DLG_UUI_UNKNOWNAUTH, *pResMgr ) ),
81 
82     m_aCommandButtonOK ( this, ResId( PB_OK, *pResMgr ) ),
83 	m_aCommandButtonCancel ( this, ResId( PB_CANCEL, *pResMgr ) ),
84 	m_aCommandButtonHelp ( this, ResId( PB_HELP, *pResMgr ) ),
85     m_aView_Certificate ( this, ResId( PB_VIEW__CERTIFICATE, *pResMgr ) ),
86 	m_aOptionButtonAccept ( this, ResId( RB_ACCEPT_1, *pResMgr ) ),
87 	m_aOptionButtonDontAccept ( this, ResId( RB_DONTACCEPT_2, *pResMgr ) ),
88 	m_aLine ( this, ResId( FL_LINE, *pResMgr ) ),
89 	m_aLabel1 ( this, ResId( FT_LABEL_1, *pResMgr ) ),
90 	m_aWarnImage ( this, ResId( IMG_WARN, *pResMgr ) ),
91 	m_xServiceFactory ( xServiceFactory ),
92 	m_rXCert ( rXCert ),
93 	pResourceMgr ( pResMgr )
94 {
95 	//SetMapMode( MapMode( MAP_APPFONT ) );
96 	FreeResource();
97 
98 	m_aWarnImage.SetImage( WarningBox::GetStandardImage() );
99 	m_pParent = pParent;
100 	m_aView_Certificate.SetClickHdl( LINK( this, UnknownAuthDialog, ViewCertHdl_Impl ) );
101 	m_aCommandButtonOK.SetClickHdl( LINK( this, UnknownAuthDialog, OKHdl_Impl ) );
102 };
103 
104