xref: /aoo42x/main/uui/source/sslwarndlg.cxx (revision 859212d1)
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 <vcl/msgbox.hxx>
25 
26 #ifndef UUI_IDS_HRC
27 #include <ids.hrc>
28 #endif
29 #ifndef UUI_UNKNOWNAUTHDLG_HRC
30 #include <sslwarndlg.hrc>
31 #endif
32 #ifndef UUI_UNKNOWNAUTHDLG_HXX
33 #include <sslwarndlg.hxx>
34 #endif
35 
36 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
37 
38 // -----------------------------------------------------------------------
39 
IMPL_LINK(SSLWarnDialog,OKHdl_Impl,PushButton *,EMPTYARG)40 IMPL_LINK( SSLWarnDialog, OKHdl_Impl, PushButton *, EMPTYARG )
41 {
42 	EndDialog( RET_OK );
43 	return 1;
44 }
45 
46 // -----------------------------------------------------------------------
47 
IMPL_LINK(SSLWarnDialog,ViewCertHdl_Impl,PushButton *,EMPTYARG)48 IMPL_LINK( SSLWarnDialog, ViewCertHdl_Impl, PushButton *, EMPTYARG )
49 {
50 	uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
51 
52     xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
53                     getServiceFactory().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
54 
55 	xDocumentDigitalSignatures.get()->showCertificate(getCert());
56 
57 	return 0;
58 }
59 
60 // -----------------------------------------------------------------------
61 
SSLWarnDialog(Window * pParent,const cssu::Reference<dcss::security::XCertificate> & rXCert,const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> & xServiceFactory,ResMgr * pResMgr)62 SSLWarnDialog::SSLWarnDialog
63 (
64 	Window*										pParent,
65 	const cssu::Reference< dcss::security::XCertificate >& rXCert,
66 	const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
67 	ResMgr*										pResMgr
68 ) :
69 
70 	ModalDialog( pParent, ResId( DLG_UUI_SSLWARN, *pResMgr ) ),
71 	m_aLabel1 ( this, ResId( FT_LABEL_1, *pResMgr ) ),
72 	m_aOkButton ( this, ResId( PB_OK, *pResMgr ) ),
73 	m_aCancelButton ( this, ResId( PB_CANCEL, *pResMgr ) ),
74     m_aCommandButtonViewCert ( this, ResId( PB_VIEW__CERTIFICATE, *pResMgr ) ),
75 	m_aLine ( this, ResId( FL_LINE, *pResMgr ) ),
76 	m_aWarnImage ( this, ResId( IMG_WARN, *pResMgr ) ),
77 	m_xServiceFactory ( xServiceFactory ),
78 	m_rXCert ( rXCert ),
79 	pResourceMgr	( pResMgr )
80 {
81 	FreeResource();
82 	m_aWarnImage.SetImage( WarningBox::GetStandardImage() );
83 	m_pParent = pParent;
84 	m_aCommandButtonViewCert.SetClickHdl( LINK( this, SSLWarnDialog, ViewCertHdl_Impl ) );
85 	m_aOkButton.SetClickHdl( LINK( this, SSLWarnDialog, OKHdl_Impl ) );
86 };
87 
88 
89 
90