Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include <string.h>
21 : :
22 : : #include "xmlelementwrapper_xmlsecimpl.hxx"
23 : : #include <cppuhelper/typeprovider.hxx>
24 : :
25 : : namespace cssu = com::sun::star::uno;
26 : : namespace cssl = com::sun::star::lang;
27 : :
28 : : #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper"
29 : : #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl"
30 : :
31 : 0 : XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode)
32 : 0 : : m_pElement( pNode )
33 : : {
34 : 0 : }
35 : :
36 : : /* XXMLElementWrapper */
37 : :
38 : :
39 : : /* XUnoTunnel */
40 : 0 : cssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
41 : : throw (cssu::RuntimeException)
42 : : {
43 : : static ::cppu::OImplementationId* pId = 0;
44 [ # # ]: 0 : if (! pId)
45 : : {
46 [ # # ][ # # ]: 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
47 [ # # ]: 0 : if (! pId)
48 : : {
49 [ # # ][ # # ]: 0 : static ::cppu::OImplementationId aId;
50 : 0 : pId = &aId;
51 [ # # ]: 0 : }
52 : : }
53 : 0 : return pId->getImplementationId();
54 : : }
55 : :
56 : 0 : sal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Sequence< sal_Int8 >& aIdentifier )
57 : : throw (cssu::RuntimeException)
58 : : {
59 [ # # # # ]: 0 : if (aIdentifier.getLength() == 16 &&
[ # # ]
60 : : 0 == memcmp(
61 [ # # ][ # # ]: 0 : getUnoTunnelImplementationId().getConstArray(),
[ # # ]
62 : 0 : aIdentifier.getConstArray(),
63 : 0 : 16 ))
64 : : {
65 : 0 : return reinterpret_cast < sal_Int64 > ( this );
66 : : }
67 : : else
68 : : {
69 : 0 : return 0;
70 : : }
71 : : }
72 : :
73 : :
74 : 3 : rtl::OUString XMLElementWrapper_XmlSecImpl_getImplementationName ()
75 : : throw (cssu::RuntimeException)
76 : : {
77 : 3 : return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
78 : : }
79 : :
80 : 0 : sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl_supportsService( const rtl::OUString& ServiceName )
81 : : throw (cssu::RuntimeException)
82 : : {
83 : 0 : return ServiceName == SERVICE_NAME;
84 : : }
85 : :
86 : 0 : cssu::Sequence< rtl::OUString > SAL_CALL XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( )
87 : : throw (cssu::RuntimeException)
88 : : {
89 : 0 : cssu::Sequence < rtl::OUString > aRet(1);
90 [ # # ]: 0 : rtl::OUString* pArray = aRet.getArray();
91 [ # # ]: 0 : pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
92 : 0 : return aRet;
93 : : }
94 : : #undef SERVICE_NAME
95 : :
96 : : cssu::Reference< cssu::XInterface > SAL_CALL
97 : 0 : XMLElementWrapper_XmlSecImpl_createInstance(
98 : : const cssu::Reference< cssl::XMultiServiceFactory > &)
99 : : throw( cssu::Exception )
100 : : {
101 [ # # ]: 0 : return (cppu::OWeakObject*) new XMLElementWrapper_XmlSecImpl(NULL);
102 : : }
103 : :
104 : : /* XServiceInfo */
105 : 0 : rtl::OUString SAL_CALL XMLElementWrapper_XmlSecImpl::getImplementationName( )
106 : : throw (cssu::RuntimeException)
107 : : {
108 : 0 : return XMLElementWrapper_XmlSecImpl_getImplementationName();
109 : : }
110 : 0 : sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const rtl::OUString& rServiceName )
111 : : throw (cssu::RuntimeException)
112 : : {
113 : 0 : return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName );
114 : : }
115 : 0 : cssu::Sequence< rtl::OUString > SAL_CALL XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( )
116 : : throw (cssu::RuntimeException)
117 : : {
118 : 0 : return XMLElementWrapper_XmlSecImpl_getSupportedServiceNames();
119 : : }
120 : :
121 : 0 : xmlNodePtr XMLElementWrapper_XmlSecImpl::getNativeElement( ) const
122 : : /****** XMLElementWrapper_XmlSecImpl/getNativeElement *************************
123 : : *
124 : : * NAME
125 : : * getNativeElement -- Retrieves the libxml2 node wrapped by this object
126 : : *
127 : : * SYNOPSIS
128 : : * pNode = getNativeElement();
129 : : *
130 : : * FUNCTION
131 : : * see NAME
132 : : *
133 : : * INPUTS
134 : : * empty
135 : : *
136 : : * RESULT
137 : : * pNode - the libxml2 node wrapped by this object
138 : : *
139 : : * AUTHOR
140 : : * Michael Mi
141 : : * Email: michael.mi@sun.com
142 : : ******************************************************************************/
143 : : {
144 : 0 : return m_pElement;
145 : : }
146 : :
147 : 0 : void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode)
148 : : /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
149 : : *
150 : : * NAME
151 : : * setNativeElement -- Configures the libxml2 node wrapped by this object
152 : : *
153 : : * SYNOPSIS
154 : : * setNativeElement( pNode );
155 : : *
156 : : * FUNCTION
157 : : * see NAME
158 : : *
159 : : * INPUTS
160 : : * pNode - the new libxml2 node to be wrapped by this object
161 : : *
162 : : * RESULT
163 : : * empty
164 : : *
165 : : * AUTHOR
166 : : * Michael Mi
167 : : * Email: michael.mi@sun.com
168 : : ******************************************************************************/
169 : : {
170 : 0 : m_pElement = pNode;
171 : 0 : }
172 : :
173 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|