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: xmlelementwrapper_xmlsecimpl.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 "xmlelementwrapper_xmlsecimpl.hxx"
35 #include <cppuhelper/typeprovider.hxx>
37 namespace cssu
= com::sun::star::uno
;
38 namespace cssl
= com::sun::star::lang
;
40 #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper"
41 #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl"
43 XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode
)
48 /* XXMLElementWrapper */
52 cssu::Sequence
< sal_Int8
> XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
53 throw (cssu::RuntimeException
)
55 static ::cppu::OImplementationId
* pId
= 0;
58 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
61 static ::cppu::OImplementationId aId
;
65 return pId
->getImplementationId();
68 sal_Int64 SAL_CALL
XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Sequence
< sal_Int8
>& aIdentifier
)
69 throw (cssu::RuntimeException
)
71 if (aIdentifier
.getLength() == 16 &&
72 0 == rtl_compareMemory(
73 getUnoTunnelImplementationId().getConstArray(),
74 aIdentifier
.getConstArray(),
77 return reinterpret_cast < sal_Int64
> ( this );
86 rtl::OUString
XMLElementWrapper_XmlSecImpl_getImplementationName ()
87 throw (cssu::RuntimeException
)
89 return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME
) );
92 sal_Bool SAL_CALL
XMLElementWrapper_XmlSecImpl_supportsService( const rtl::OUString
& ServiceName
)
93 throw (cssu::RuntimeException
)
95 return ServiceName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME
));
98 cssu::Sequence
< rtl::OUString
> SAL_CALL
XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( )
99 throw (cssu::RuntimeException
)
101 cssu::Sequence
< rtl::OUString
> aRet(1);
102 rtl::OUString
* pArray
= aRet
.getArray();
103 pArray
[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME
) );
108 cssu::Reference
< cssu::XInterface
> SAL_CALL
109 XMLElementWrapper_XmlSecImpl_createInstance(
110 const cssu::Reference
< cssl::XMultiServiceFactory
> &)
111 throw( cssu::Exception
)
113 return (cppu::OWeakObject
*) new XMLElementWrapper_XmlSecImpl(NULL
);
117 rtl::OUString SAL_CALL
XMLElementWrapper_XmlSecImpl::getImplementationName( )
118 throw (cssu::RuntimeException
)
120 return XMLElementWrapper_XmlSecImpl_getImplementationName();
122 sal_Bool SAL_CALL
XMLElementWrapper_XmlSecImpl::supportsService( const rtl::OUString
& rServiceName
)
123 throw (cssu::RuntimeException
)
125 return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName
);
127 cssu::Sequence
< rtl::OUString
> SAL_CALL
XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( )
128 throw (cssu::RuntimeException
)
130 return XMLElementWrapper_XmlSecImpl_getSupportedServiceNames();
133 xmlNodePtr
XMLElementWrapper_XmlSecImpl::getNativeElement( ) const
134 /****** XMLElementWrapper_XmlSecImpl/getNativeElement *************************
137 * getNativeElement -- Retrieves the libxml2 node wrapped by this object
140 * pNode = getNativeElement();
149 * pNode - the libxml2 node wrapped by this object
152 * 05.01.2004 - implemented
156 * Email: michael.mi@sun.com
157 ******************************************************************************/
162 void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode
)
163 /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
166 * setNativeElement -- Configures the libxml2 node wrapped by this object
169 * setNativeElement( pNode );
175 * pNode - the new libxml2 node to be wrapped by this object
181 * 05.01.2004 - implemented
185 * Email: michael.mi@sun.com
186 ******************************************************************************/