diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-08-18 12:15:35 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-08-18 12:15:35 +0000 |
commit | c39975215580685f648480b4559f8df282e26983 (patch) | |
tree | 693f54f534fb2c8dcec546026fa8242e0f296ac2 /xmlsecurity | |
parent | f84645a5bafa92bc7e6d85694288b149d10abfb6 (diff) |
INTEGRATION: CWS cmcfixes48 (1.5.22); FILE MERGED
2008/08/01 13:54:32 cmc 1.5.22.1: #i92247# remove duplication of object code, link only the single library to libxmlsec1, and update some stuff to new api
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx index e3e0e04b94bf..067c3d37ef0c 100644 --- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx +++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xsec_xmlsec.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.6 $ * * This file is part of OpenOffice.org. * @@ -37,10 +37,13 @@ #include <osl/mutex.hxx> #include <osl/thread.h> #include <cppuhelper/factory.hxx> +#include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/security/XSerialNumberAdapter.hpp> #include "xmlelementwrapper_xmlsecimpl.hxx" #include "xmldocumentwrapper_xmlsecimpl.hxx" +#include "xmlsecurity/biginteger.hxx" using namespace ::rtl; using namespace ::cppu; @@ -48,6 +51,48 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; +namespace +{ +class SerialNumberAdapterImpl : public WeakImplHelper1< + ::com::sun::star::security::XSerialNumberAdapter > +{ + virtual OUString SAL_CALL toString( const Sequence< sal_Int8 >& rSerialNumber ) + throw (RuntimeException) + { + return bigIntegerToNumericString(rSerialNumber); + } + virtual Sequence< sal_Int8 > SAL_CALL toSequence( const OUString& rSerialNumber ) + throw (RuntimeException) + { + return numericStringToBigInteger(rSerialNumber); + } +}; + +OUString SerialNumberAdapterImpl_getImplementationName() + throw (RuntimeException) +{ + return OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.security.SerialNumberAdapter")); +} + +Sequence< OUString > SerialNumberAdapterImpl_getSupportedServiceNames() + throw (RuntimeException) +{ + Sequence < OUString > aRet(1); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.security.SerialNumberAdapter" ) ); + return aRet; +} + +Reference< XInterface > SerialNumberAdapterImpl_createInstance( + const Reference< XComponentContext > &) throw( Exception ) +{ + return Reference< XInterface >( *new SerialNumberAdapterImpl() ); +} + +} + extern "C" { @@ -103,6 +148,18 @@ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager , void* pRegistryKe xNewKey->createKey( seqServices.getConstArray()[i] ) ; } + // SerialNumberAdapterImpl + sKeyName = OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ; + sKeyName += SerialNumberAdapterImpl_getImplementationName() ; + sKeyName += OUString::createFromAscii( "/UNO/SERVICES" ) ; + + xNewKey = xKey->createKey( sKeyName ) ; + if( xNewKey.is() ) { + seqServices = SerialNumberAdapterImpl_getSupportedServiceNames() ; + for( i = seqServices.getLength() ; i -- ; ) + xNewKey->createKey( seqServices.getConstArray()[i] ) ; + } + #if defined( XMLSEC_CRYPTO_NSS ) result = nss_component_writeInfo( pServiceManager, pRegistryKey ) ; if( !result ) @@ -127,7 +184,7 @@ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager , void* pRegistryKe void* SAL_CALL component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* pRegistryKey ) { void* pRet = 0; - Reference< XSingleServiceFactory > xFactory ; + Reference< XInterface > xFactory ; if( pImplName != NULL && pServiceManager != NULL ) { if( XMLElementWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) @@ -144,6 +201,13 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplName , void* pServiceM OUString::createFromAscii( pImplName ), XMLDocumentWrapper_XmlSecImpl_createInstance, XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames() ) ); } + else if( SerialNumberAdapterImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) + { + xFactory = ::cppu::createSingleComponentFactory( + SerialNumberAdapterImpl_createInstance, + OUString::createFromAscii( pImplName ), + SerialNumberAdapterImpl_getSupportedServiceNames() ); + } } if( xFactory.is() ) { |