1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: warnings.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlsecurity.hxx"
34 #include <xmlsecurity/warnings.hxx>
35 #include <xmlsecurity/certificateviewer.hxx>
36 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
37 #include <comphelper/sequence.hxx>
39 // MM : added for password exception
40 #include <vcl/msgbox.hxx>
41 #include <com/sun/star/security/NoPasswordException.hpp>
42 using namespace ::com::sun::star::security
;
45 #include "dialogs.hrc"
46 #include "resourcemanager.hxx"
48 /* HACK: disable some warnings for MS-C */
50 #pragma warning (disable : 4355) // 4355: this used in initializer-list
53 using namespace ::com::sun::star
;
54 using namespace ::com::sun::star
;
57 MacroWarning::MacroWarning( Window
* _pParent
, uno::Reference
< dcss::xml::crypto::XSecurityEnvironment
>& _rxSecurityEnvironment
, cssu::Reference
< dcss::security::XCertificate
>& _rxCert
)
58 :ModalDialog ( _pParent
, XMLSEC_RES( RID_XMLSECTP_MACROWARN
) )
59 ,maDocNameFI ( this, ResId( FI_DOCNAME
) )
60 ,maDescr1aFI ( this, ResId( FI_DESCR1A
) )
61 ,maDescr1bFI ( this, ResId( FI_DESCR1B
) )
62 ,maSignsFI ( this, ResId( FI_SIGNS
) )
63 ,maViewSignsBtn ( this, ResId( PB_VIEWSIGNS
) )
64 ,maDescr2FI ( this, ResId( FI_DESCR2
) )
65 ,maAlwaysTrustCB ( this, ResId( CB_ALWAYSTRUST
) )
66 ,maBottomSepFL ( this, ResId( FL_BOTTOM_SEP
) )
67 ,maEnableBtn ( this, ResId( PB_DISABLE
) )
68 ,maDisableBtn ( this, ResId( PB_DISABLE
) )
69 ,maHelpBtn ( this, ResId( BTN_HELP
) )
70 ,mbSignedMode ( true )
74 mxSecurityEnvironment
= _rxSecurityEnvironment
;
80 maViewSignsBtn
.SetClickHdl( LINK( this, MacroWarning
, ViewSignsBtnHdl
) );
81 maEnableBtn
.SetClickHdl( LINK( this, MacroWarning
, EnableBtnHdl
) );
82 // maDisableBtn.SetClickHdl( LINK( this, MacroWarning, DisableBtnHdl ) );
85 maSignsFI
.SetText( XmlSec::GetContentPart( mxCert
->getSubjectName() ) );
88 maViewSignsBtn
.Disable();
91 MacroWarning::MacroWarning( Window
* _pParent
)
92 :ModalDialog ( _pParent
, XMLSEC_RES( RID_XMLSECTP_MACROWARN
) )
93 ,maDocNameFI ( this, ResId( FI_DOCNAME
) )
94 ,maDescr1aFI ( this, ResId( FI_DESCR1A
) )
95 ,maDescr1bFI ( this, ResId( FI_DESCR1B
) )
96 ,maSignsFI ( this, ResId( FI_SIGNS
) )
97 ,maViewSignsBtn ( this, ResId( PB_VIEWSIGNS
) )
98 ,maDescr2FI ( this, ResId( FI_DESCR2
) )
99 ,maAlwaysTrustCB ( this, ResId( CB_ALWAYSTRUST
) )
100 ,maBottomSepFL ( this, ResId( FL_BOTTOM_SEP
) )
101 ,maEnableBtn ( this, ResId( PB_DISABLE
) )
102 ,maDisableBtn ( this, ResId( PB_DISABLE
) )
103 ,maHelpBtn ( this, ResId( BTN_HELP
) )
104 ,mbSignedMode ( false )
111 maViewSignsBtn
.Hide();
112 maAlwaysTrustCB
.Hide();
115 // move hint up to position of signer list
116 maDescr1bFI
.SetPosPixel( maSignsFI
.GetPosPixel() );
119 MacroWarning::~MacroWarning()
123 IMPL_LINK( MacroWarning
, ViewSignsBtnHdl
, void*, EMPTYARG
)
125 DBG_ASSERT( mxCert
.is(), "*MacroWarning::ViewSignsBtnHdl(): no certificate set!" );
127 CertificateViewer
aViewer( this, mxSecurityEnvironment
, mxCert
);
133 IMPL_LINK( MacroWarning
, EnableBtnHdl
, void*, EMPTYARG
)
135 if( mbSignedMode
&& maAlwaysTrustCB
.IsChecked() )
136 { // insert path into trusted path list
144 /*IMPL_LINK( MacroWarning, DisableBtnHdl, void*, EMPTYARG )