Update ooo320-m1
[ooovba.git] / xmlsecurity / source / framework / securityengine.cxx
blobc5c6418de517516724de818a14bc0998a4c53059
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: securityengine.cxx,v $
10 * $Revision: 1.7 $
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 "securityengine.hxx"
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 namespace cssu = com::sun::star::uno;
38 namespace cssl = com::sun::star::lang;
39 namespace cssxc = com::sun::star::xml::crypto;
40 namespace cssxw = com::sun::star::xml::wrapper;
42 #define DECLARE_ASCII( SASCIIVALUE ) \
43 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
45 SecurityEngine::SecurityEngine( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF )
46 :mxMSF( rxMSF ),
47 m_nIdOfTemplateEC(-1),
48 m_nNumOfResolvedReferences(0),
49 m_nIdOfKeyEC(-1),
50 m_bMissionDone(false),
51 m_nSecurityId(-1),
52 m_nStatus(::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN)
56 /* XReferenceResolvedListener */
57 void SAL_CALL SecurityEngine::referenceResolved( sal_Int32 /*referenceId*/)
58 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
60 m_nNumOfResolvedReferences++;
61 tryToPerform();
64 /* XKeyCollector */
65 void SAL_CALL SecurityEngine::setKeyId( sal_Int32 id )
66 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
68 m_nIdOfKeyEC = id;
69 tryToPerform();
72 /* XMissionTaker */
73 sal_Bool SAL_CALL SecurityEngine::endMission( )
74 throw (com::sun::star::uno::RuntimeException)
76 sal_Bool rc = m_bMissionDone;
78 if (!rc)
80 clearUp( );
82 notifyResultListener();
83 m_bMissionDone = true;
86 m_xResultListener = NULL;
87 m_xSAXEventKeeper = NULL;
89 return rc;