1*06b3ce53SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06b3ce53SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06b3ce53SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06b3ce53SAndrew Rist * distributed with this work for additional information 6*06b3ce53SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06b3ce53SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06b3ce53SAndrew Rist * "License"); you may not use this file except in compliance 9*06b3ce53SAndrew Rist * with the License. You may obtain a copy of the License at 10*06b3ce53SAndrew Rist * 11*06b3ce53SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*06b3ce53SAndrew Rist * 13*06b3ce53SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06b3ce53SAndrew Rist * software distributed under the License is distributed on an 15*06b3ce53SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06b3ce53SAndrew Rist * KIND, either express or implied. See the License for the 17*06b3ce53SAndrew Rist * specific language governing permissions and limitations 18*06b3ce53SAndrew Rist * under the License. 19*06b3ce53SAndrew Rist * 20*06b3ce53SAndrew Rist *************************************************************/ 21*06b3ce53SAndrew Rist 22*06b3ce53SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "xmlelementwrapper_xmlsecimpl.hxx" 28cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace cssu = com::sun::star::uno; 31cdf0e10cSrcweir namespace cssl = com::sun::star::lang; 32cdf0e10cSrcweir 33cdf0e10cSrcweir #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper" 34cdf0e10cSrcweir #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl" 35cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode)36cdf0e10cSrcweirXMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode) 37cdf0e10cSrcweir : m_pElement( pNode ) 38cdf0e10cSrcweir { 39cdf0e10cSrcweir } 40cdf0e10cSrcweir 41cdf0e10cSrcweir /* XXMLElementWrapper */ 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir /* XUnoTunnel */ getUnoTunnelImplementationId(void)45cdf0e10cSrcweircssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void ) 46cdf0e10cSrcweir throw (cssu::RuntimeException) 47cdf0e10cSrcweir { 48cdf0e10cSrcweir static ::cppu::OImplementationId* pId = 0; 49cdf0e10cSrcweir if (! pId) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 52cdf0e10cSrcweir if (! pId) 53cdf0e10cSrcweir { 54cdf0e10cSrcweir static ::cppu::OImplementationId aId; 55cdf0e10cSrcweir pId = &aId; 56cdf0e10cSrcweir } 57cdf0e10cSrcweir } 58cdf0e10cSrcweir return pId->getImplementationId(); 59cdf0e10cSrcweir } 60cdf0e10cSrcweir getSomething(const cssu::Sequence<sal_Int8> & aIdentifier)61cdf0e10cSrcweirsal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Sequence< sal_Int8 >& aIdentifier ) 62cdf0e10cSrcweir throw (cssu::RuntimeException) 63cdf0e10cSrcweir { 64cdf0e10cSrcweir if (aIdentifier.getLength() == 16 && 65cdf0e10cSrcweir 0 == rtl_compareMemory( 66cdf0e10cSrcweir getUnoTunnelImplementationId().getConstArray(), 67cdf0e10cSrcweir aIdentifier.getConstArray(), 68cdf0e10cSrcweir 16 )) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir return reinterpret_cast < sal_Int64 > ( this ); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir else 73cdf0e10cSrcweir { 74cdf0e10cSrcweir return 0; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl_getImplementationName()79cdf0e10cSrcweirrtl::OUString XMLElementWrapper_XmlSecImpl_getImplementationName () 80cdf0e10cSrcweir throw (cssu::RuntimeException) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); 83cdf0e10cSrcweir } 84cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl_supportsService(const rtl::OUString & ServiceName)85cdf0e10cSrcweirsal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl_supportsService( const rtl::OUString& ServiceName ) 86cdf0e10cSrcweir throw (cssu::RuntimeException) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME )); 89cdf0e10cSrcweir } 90cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl_getSupportedServiceNames()91cdf0e10cSrcweircssu::Sequence< rtl::OUString > SAL_CALL XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( ) 92cdf0e10cSrcweir throw (cssu::RuntimeException) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir cssu::Sequence < rtl::OUString > aRet(1); 95cdf0e10cSrcweir rtl::OUString* pArray = aRet.getArray(); 96cdf0e10cSrcweir pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); 97cdf0e10cSrcweir return aRet; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir #undef SERVICE_NAME 100cdf0e10cSrcweir 101cdf0e10cSrcweir cssu::Reference< cssu::XInterface > SAL_CALL XMLElementWrapper_XmlSecImpl_createInstance(const cssu::Reference<cssl::XMultiServiceFactory> &)102cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl_createInstance( 103cdf0e10cSrcweir const cssu::Reference< cssl::XMultiServiceFactory > &) 104cdf0e10cSrcweir throw( cssu::Exception ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir return (cppu::OWeakObject*) new XMLElementWrapper_XmlSecImpl(NULL); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir /* XServiceInfo */ getImplementationName()110cdf0e10cSrcweirrtl::OUString SAL_CALL XMLElementWrapper_XmlSecImpl::getImplementationName( ) 111cdf0e10cSrcweir throw (cssu::RuntimeException) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir return XMLElementWrapper_XmlSecImpl_getImplementationName(); 114cdf0e10cSrcweir } supportsService(const rtl::OUString & rServiceName)115cdf0e10cSrcweirsal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const rtl::OUString& rServiceName ) 116cdf0e10cSrcweir throw (cssu::RuntimeException) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName ); 119cdf0e10cSrcweir } getSupportedServiceNames()120cdf0e10cSrcweircssu::Sequence< rtl::OUString > SAL_CALL XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( ) 121cdf0e10cSrcweir throw (cssu::RuntimeException) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir return XMLElementWrapper_XmlSecImpl_getSupportedServiceNames(); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir getNativeElement() const126cdf0e10cSrcweirxmlNodePtr XMLElementWrapper_XmlSecImpl::getNativeElement( ) const 127cdf0e10cSrcweir /****** XMLElementWrapper_XmlSecImpl/getNativeElement ************************* 128cdf0e10cSrcweir * 129cdf0e10cSrcweir * NAME 130cdf0e10cSrcweir * getNativeElement -- Retrieves the libxml2 node wrapped by this object 131cdf0e10cSrcweir * 132cdf0e10cSrcweir * SYNOPSIS 133cdf0e10cSrcweir * pNode = getNativeElement(); 134cdf0e10cSrcweir * 135cdf0e10cSrcweir * FUNCTION 136cdf0e10cSrcweir * see NAME 137cdf0e10cSrcweir * 138cdf0e10cSrcweir * INPUTS 139cdf0e10cSrcweir * empty 140cdf0e10cSrcweir * 141cdf0e10cSrcweir * RESULT 142cdf0e10cSrcweir * pNode - the libxml2 node wrapped by this object 143cdf0e10cSrcweir * 144cdf0e10cSrcweir * HISTORY 145cdf0e10cSrcweir * 05.01.2004 - implemented 146cdf0e10cSrcweir * 147cdf0e10cSrcweir * AUTHOR 148cdf0e10cSrcweir * Michael Mi 149cdf0e10cSrcweir * Email: michael.mi@sun.com 150cdf0e10cSrcweir ******************************************************************************/ 151cdf0e10cSrcweir { 152cdf0e10cSrcweir return m_pElement; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir setNativeElement(const xmlNodePtr pNode)155cdf0e10cSrcweirvoid XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode) 156cdf0e10cSrcweir /****** XMLElementWrapper_XmlSecImpl/setNativeElement ************************* 157cdf0e10cSrcweir * 158cdf0e10cSrcweir * NAME 159cdf0e10cSrcweir * setNativeElement -- Configures the libxml2 node wrapped by this object 160cdf0e10cSrcweir * 161cdf0e10cSrcweir * SYNOPSIS 162cdf0e10cSrcweir * setNativeElement( pNode ); 163cdf0e10cSrcweir * 164cdf0e10cSrcweir * FUNCTION 165cdf0e10cSrcweir * see NAME 166cdf0e10cSrcweir * 167cdf0e10cSrcweir * INPUTS 168cdf0e10cSrcweir * pNode - the new libxml2 node to be wrapped by this object 169cdf0e10cSrcweir * 170cdf0e10cSrcweir * RESULT 171cdf0e10cSrcweir * empty 172cdf0e10cSrcweir * 173cdf0e10cSrcweir * HISTORY 174cdf0e10cSrcweir * 05.01.2004 - implemented 175cdf0e10cSrcweir * 176cdf0e10cSrcweir * AUTHOR 177cdf0e10cSrcweir * Michael Mi 178cdf0e10cSrcweir * Email: michael.mi@sun.com 179cdf0e10cSrcweir ******************************************************************************/ 180cdf0e10cSrcweir { 181cdf0e10cSrcweir m_pElement = pNode; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184