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