merged tag ooo/OOO330_m14
[LibreOffice.git] / xmlsecurity / source / xmlsec / xmlelementwrapper_xmlsecimpl.cxx
blobf9de04c16d5fed75a68331f2edaa990d12f0a262
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)
41 : m_pElement( pNode )
45 /* XXMLElementWrapper */
48 /* XUnoTunnel */
49 cssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
50 throw (cssu::RuntimeException)
52 static ::cppu::OImplementationId* pId = 0;
53 if (! pId)
55 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
56 if (! pId)
58 static ::cppu::OImplementationId aId;
59 pId = &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(),
72 16 ))
74 return reinterpret_cast < sal_Int64 > ( this );
76 else
78 return 0;
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 ) );
101 return aRet;
103 #undef 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);
113 /* XServiceInfo */
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 *************************
133 * NAME
134 * getNativeElement -- Retrieves the libxml2 node wrapped by this object
136 * SYNOPSIS
137 * pNode = getNativeElement();
139 * FUNCTION
140 * see NAME
142 * INPUTS
143 * empty
145 * RESULT
146 * pNode - the libxml2 node wrapped by this object
148 * HISTORY
149 * 05.01.2004 - implemented
151 * AUTHOR
152 * Michael Mi
153 * Email: michael.mi@sun.com
154 ******************************************************************************/
156 return m_pElement;
159 void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode)
160 /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
162 * NAME
163 * setNativeElement -- Configures the libxml2 node wrapped by this object
165 * SYNOPSIS
166 * setNativeElement( pNode );
168 * FUNCTION
169 * see NAME
171 * INPUTS
172 * pNode - the new libxml2 node to be wrapped by this object
174 * RESULT
175 * empty
177 * HISTORY
178 * 05.01.2004 - implemented
180 * AUTHOR
181 * Michael Mi
182 * Email: michael.mi@sun.com
183 ******************************************************************************/
185 m_pElement = pNode;