Update ooo320-m1
[ooovba.git] / xmlsecurity / source / xmlsec / xmlelementwrapper_xmlsecimpl.cxx
blob43be2409bf8d6d8cb96272599251c47881a9d95d
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: xmlelementwrapper_xmlsecimpl.cxx,v $
10 * $Revision: 1.5 $
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)
44 : m_pElement( pNode )
48 /* XXMLElementWrapper */
51 /* XUnoTunnel */
52 cssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
53 throw (cssu::RuntimeException)
55 static ::cppu::OImplementationId* pId = 0;
56 if (! pId)
58 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
59 if (! pId)
61 static ::cppu::OImplementationId aId;
62 pId = &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(),
75 16 ))
77 return reinterpret_cast < sal_Int64 > ( this );
79 else
81 return 0;
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 ) );
104 return aRet;
106 #undef 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);
116 /* XServiceInfo */
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 *************************
136 * NAME
137 * getNativeElement -- Retrieves the libxml2 node wrapped by this object
139 * SYNOPSIS
140 * pNode = getNativeElement();
142 * FUNCTION
143 * see NAME
145 * INPUTS
146 * empty
148 * RESULT
149 * pNode - the libxml2 node wrapped by this object
151 * HISTORY
152 * 05.01.2004 - implemented
154 * AUTHOR
155 * Michael Mi
156 * Email: michael.mi@sun.com
157 ******************************************************************************/
159 return m_pElement;
162 void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode)
163 /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
165 * NAME
166 * setNativeElement -- Configures the libxml2 node wrapped by this object
168 * SYNOPSIS
169 * setNativeElement( pNode );
171 * FUNCTION
172 * see NAME
174 * INPUTS
175 * pNode - the new libxml2 node to be wrapped by this object
177 * RESULT
178 * empty
180 * HISTORY
181 * 05.01.2004 - implemented
183 * AUTHOR
184 * Michael Mi
185 * Email: michael.mi@sun.com
186 ******************************************************************************/
188 m_pElement = pNode;