1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmlsecurity.hxx"
31 #include "xmlelementwrapper_xmlsecimpl.hxx"
32 #include <cppuhelper/typeprovider.hxx>
34 namespace cssu
= com::sun::star::uno
;
35 namespace cssl
= com::sun::star::lang
;
37 #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper"
38 #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl"
40 XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode
)
45 /* XXMLElementWrapper */
49 cssu::Sequence
< sal_Int8
> XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
50 throw (cssu::RuntimeException
)
52 static ::cppu::OImplementationId
* pId
= 0;
55 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
58 static ::cppu::OImplementationId aId
;
62 return pId
->getImplementationId();
65 sal_Int64 SAL_CALL
XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Sequence
< sal_Int8
>& aIdentifier
)
66 throw (cssu::RuntimeException
)
68 if (aIdentifier
.getLength() == 16 &&
69 0 == rtl_compareMemory(
70 getUnoTunnelImplementationId().getConstArray(),
71 aIdentifier
.getConstArray(),
74 return reinterpret_cast < sal_Int64
> ( this );
83 rtl::OUString
XMLElementWrapper_XmlSecImpl_getImplementationName ()
84 throw (cssu::RuntimeException
)
86 return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME
) );
89 sal_Bool SAL_CALL
XMLElementWrapper_XmlSecImpl_supportsService( const rtl::OUString
& ServiceName
)
90 throw (cssu::RuntimeException
)
92 return ServiceName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME
));
95 cssu::Sequence
< rtl::OUString
> SAL_CALL
XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( )
96 throw (cssu::RuntimeException
)
98 cssu::Sequence
< rtl::OUString
> aRet(1);
99 rtl::OUString
* pArray
= aRet
.getArray();
100 pArray
[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME
) );
105 cssu::Reference
< cssu::XInterface
> SAL_CALL
106 XMLElementWrapper_XmlSecImpl_createInstance(
107 const cssu::Reference
< cssl::XMultiServiceFactory
> &)
108 throw( cssu::Exception
)
110 return (cppu::OWeakObject
*) new XMLElementWrapper_XmlSecImpl(NULL
);
114 rtl::OUString SAL_CALL
XMLElementWrapper_XmlSecImpl::getImplementationName( )
115 throw (cssu::RuntimeException
)
117 return XMLElementWrapper_XmlSecImpl_getImplementationName();
119 sal_Bool SAL_CALL
XMLElementWrapper_XmlSecImpl::supportsService( const rtl::OUString
& rServiceName
)
120 throw (cssu::RuntimeException
)
122 return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName
);
124 cssu::Sequence
< rtl::OUString
> SAL_CALL
XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( )
125 throw (cssu::RuntimeException
)
127 return XMLElementWrapper_XmlSecImpl_getSupportedServiceNames();
130 xmlNodePtr
XMLElementWrapper_XmlSecImpl::getNativeElement( ) const
131 /****** XMLElementWrapper_XmlSecImpl/getNativeElement *************************
134 * getNativeElement -- Retrieves the libxml2 node wrapped by this object
137 * pNode = getNativeElement();
146 * pNode - the libxml2 node wrapped by this object
149 * 05.01.2004 - implemented
153 * Email: michael.mi@sun.com
154 ******************************************************************************/
159 void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode
)
160 /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
163 * setNativeElement -- Configures the libxml2 node wrapped by this object
166 * setNativeElement( pNode );
172 * pNode - the new libxml2 node to be wrapped by this object
178 * 05.01.2004 - implemented
182 * Email: michael.mi@sun.com
183 ******************************************************************************/