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 : :
21 : : #include "xmldocumentwrapper_xmlsecimpl.hxx"
22 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 : :
24 : : #include <xmloff/attrlist.hxx>
25 : : #include "xmlelementwrapper_xmlsecimpl.hxx"
26 : :
27 : : #include <stdio.h>
28 : : #include <stdlib.h>
29 : : #include <string.h>
30 : :
31 : : #include <sys/types.h>
32 : : #include <sys/stat.h>
33 : :
34 : : #include <vector>
35 : :
36 : : #ifdef UNX
37 : : #define stricmp strcasecmp
38 : : #endif
39 : :
40 : : namespace cssu = com::sun::star::uno;
41 : : namespace cssl = com::sun::star::lang;
42 : : namespace cssxc = com::sun::star::xml::crypto;
43 : : namespace cssxcsax = com::sun::star::xml::csax;
44 : : namespace cssxs = com::sun::star::xml::sax;
45 : : namespace cssxw = com::sun::star::xml::wrapper;
46 : :
47 : : #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLDocumentWrapper"
48 : : #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLDocumentWrapper_XmlSecImpl"
49 : :
50 : : #define STRXMLNS "xmlns"
51 : :
52 : : #define RTL_ASCII_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_ASCII_US
53 : : #define RTL_UTF8_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_UTF8
54 : :
55 : : /* used by the recursiveDelete method */
56 : : #define NODE_REMOVED 0
57 : : #define NODE_NOTREMOVED 1
58 : : #define NODE_STOPED 2
59 : :
60 [ # # ][ # # ]: 0 : XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl( )
61 : : {
62 [ # # ]: 0 : saxHelper.startDocument();
63 [ # # ]: 0 : m_pDocument = saxHelper.getDocument();
64 : :
65 : : /*
66 : : * creates the virtual root element
67 : : */
68 [ # # ][ # # ]: 0 : saxHelper.startElement(rtl::OUString(RTL_UTF8_USTRINGPARAM( "root" )), cssu::Sequence<cssxcsax::XMLAttribute>());
[ # # ][ # # ]
69 : :
70 [ # # ]: 0 : m_pRootElement = saxHelper.getCurrentNode();
71 : 0 : m_pCurrentElement = m_pRootElement;
72 : 0 : }
73 : :
74 [ # # ][ # # ]: 0 : XMLDocumentWrapper_XmlSecImpl::~XMLDocumentWrapper_XmlSecImpl()
75 : : {
76 [ # # ]: 0 : saxHelper.endDocument();
77 [ # # ]: 0 : xmlFreeDoc(m_pDocument);
78 [ # # ]: 0 : }
79 : :
80 : 0 : void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent()
81 : : /****** XMLDocumentWrapper_XmlSecImpl/getNextSAXEvent *************************
82 : : *
83 : : * NAME
84 : : * getNextSAXEvent -- Prepares the next SAX event to be manipulate
85 : : *
86 : : * SYNOPSIS
87 : : * getNextSAXEvent();
88 : : *
89 : : * FUNCTION
90 : : * When converting the document into SAX events, this method is used to
91 : : * decide the next SAX event to be generated.
92 : : * Two member variables are checked to make the decision, the
93 : : * m_pCurrentElement and the m_nCurrentPosition.
94 : : * The m_pCurrentElement represents the node which have been covered, and
95 : : * the m_nCurrentPosition represents the event which have been sent.
96 : : * For example, suppose that the m_pCurrentElement
97 : : * points to element A, and the m_nCurrentPosition equals to
98 : : * NODEPOSITION_STARTELEMENT, then the next SAX event should be the
99 : : * endElement for element A if A has no child, or startElement for the
100 : : * first child element of element A otherwise.
101 : : * The m_nCurrentPosition can be one of following values:
102 : : * NODEPOSITION_STARTELEMENT for startElement;
103 : : * NODEPOSITION_ENDELEMENT for endElement;
104 : : * NODEPOSITION_NORMAL for other SAX events;
105 : : *
106 : : * INPUTS
107 : : * empty
108 : : *
109 : : * RESULT
110 : : * empty
111 : : *
112 : : * AUTHOR
113 : : * Michael Mi
114 : : * Email: michael.mi@sun.com
115 : : ******************************************************************************/
116 : : {
117 : : OSL_ASSERT( m_pCurrentElement != NULL );
118 : :
119 : : /*
120 : : * Get the next event through tree order.
121 : : *
122 : : * if the current event is a startElement, then the next
123 : : * event depends on whether or not the current node has
124 : : * children.
125 : : */
126 [ # # ]: 0 : if (m_nCurrentPosition == NODEPOSITION_STARTELEMENT)
127 : : {
128 : : /*
129 : : * If the current node has children, then its first child
130 : : * should be next current node, and the next event will be
131 : : * startElement or charaters(PI) based on that child's node
132 : : * type. Otherwise, the endElement of current node is the
133 : : * next event.
134 : : */
135 [ # # ]: 0 : if (m_pCurrentElement->children != NULL)
136 : : {
137 : 0 : m_pCurrentElement = m_pCurrentElement->children;
138 : : m_nCurrentPosition
139 : : = (m_pCurrentElement->type == XML_ELEMENT_NODE)?
140 [ # # ]: 0 : NODEPOSITION_STARTELEMENT:NODEPOSITION_NORMAL;
141 : : }
142 : : else
143 : : {
144 : 0 : m_nCurrentPosition = NODEPOSITION_ENDELEMENT;
145 : : }
146 : : }
147 : : /*
148 : : * if the current event is a not startElement, then the next
149 : : * event depends on whether or not the current node has
150 : : * following sibling.
151 : : */
152 [ # # ][ # # ]: 0 : else if (m_nCurrentPosition == NODEPOSITION_ENDELEMENT || m_nCurrentPosition == NODEPOSITION_NORMAL)
153 : : {
154 : 0 : xmlNodePtr pNextSibling = m_pCurrentElement->next;
155 : :
156 : : /*
157 : : * If the current node has following sibling, that sibling
158 : : * should be next current node, and the next event will be
159 : : * startElement or charaters(PI) based on that sibling's node
160 : : * type. Otherwise, the endElement of current node's parent
161 : : * becomes the next event.
162 : : */
163 [ # # ]: 0 : if (pNextSibling != NULL)
164 : : {
165 : 0 : m_pCurrentElement = pNextSibling;
166 : : m_nCurrentPosition
167 : : = (m_pCurrentElement->type == XML_ELEMENT_NODE)?
168 [ # # ]: 0 : NODEPOSITION_STARTELEMENT:NODEPOSITION_NORMAL;
169 : : }
170 : : else
171 : : {
172 : 0 : m_pCurrentElement = m_pCurrentElement->parent;
173 : 0 : m_nCurrentPosition = NODEPOSITION_ENDELEMENT;
174 : : }
175 : : }
176 : 0 : }
177 : :
178 : 0 : void XMLDocumentWrapper_XmlSecImpl::sendStartElement(
179 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
180 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
181 : : const xmlNodePtr pNode) const
182 : : throw (cssxs::SAXException)
183 : : /****** XMLDocumentWrapper_XmlSecImpl/sendStartElement ************************
184 : : *
185 : : * NAME
186 : : * sendStartElement -- Constructs a startElement SAX event
187 : : *
188 : : * SYNOPSIS
189 : : * sendStartElement(xHandler, xHandler2, pNode);
190 : : *
191 : : * FUNCTION
192 : : * Used when converting the document into SAX event stream.
193 : : * This method constructs a startElement SAX event for a particular
194 : : * element, then calls the startElement methods of the XDocumentHandlers.
195 : : *
196 : : * INPUTS
197 : : * xHandler - the first XDocumentHandler interface to receive the
198 : : * startElement SAX event. It can be NULL.
199 : : * xHandler2 - the second XDocumentHandler interface to receive the
200 : : * startElement SAX event. It can't be NULL.
201 : : * pNode - the node on which the startElement should be generated.
202 : : * This node must be a element type.
203 : : *
204 : : * RESULT
205 : : * empty
206 : : *
207 : : * AUTHOR
208 : : * Michael Mi
209 : : * Email: michael.mi@sun.com
210 : : ******************************************************************************/
211 : : {
212 [ # # ]: 0 : SvXMLAttributeList* pAttributeList = new SvXMLAttributeList();
213 [ # # ][ # # ]: 0 : cssu::Reference < cssxs::XAttributeList > xAttrList = cssu::Reference< cssxs::XAttributeList > (pAttributeList);
214 : :
215 : 0 : xmlNsPtr pNsDef = pNode->nsDef;
216 : :
217 [ # # ]: 0 : while (pNsDef != NULL)
218 : : {
219 : 0 : const xmlChar* pNsPrefix = pNsDef->prefix;
220 : 0 : const xmlChar* pNsHref = pNsDef->href;
221 : :
222 [ # # ]: 0 : if (pNsDef->prefix == NULL)
223 : : {
224 : : pAttributeList->AddAttribute(
225 : : rtl::OUString(RTL_UTF8_USTRINGPARAM( STRXMLNS )),
226 [ # # ][ # # ]: 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsHref )));
[ # # ]
227 : : }
228 : : else
229 : : {
230 : : pAttributeList->AddAttribute(
231 : : rtl::OUString(RTL_UTF8_USTRINGPARAM( STRXMLNS ))
232 : : +rtl::OUString(RTL_UTF8_USTRINGPARAM( ":" ))
233 : 0 : +rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsPrefix )),
234 [ # # ][ # # ]: 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsHref )));
[ # # ][ # # ]
[ # # ]
235 : : }
236 : :
237 : 0 : pNsDef = pNsDef->next;
238 : : }
239 : :
240 : 0 : xmlAttrPtr pAttr = pNode->properties;
241 : :
242 [ # # ]: 0 : while (pAttr != NULL)
243 : : {
244 : 0 : const xmlChar* pAttrName = pAttr->name;
245 : 0 : xmlNsPtr pAttrNs = pAttr->ns;
246 : :
247 : 0 : rtl::OUString ouAttrName;
248 [ # # ]: 0 : if (pAttrNs == NULL)
249 : : {
250 [ # # ]: 0 : ouAttrName = rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrName ));
251 : : }
252 : : else
253 : : {
254 : 0 : ouAttrName = rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrNs->prefix))
255 : : +rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)":" ))
256 [ # # ][ # # ]: 0 : +rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrName ));
[ # # ]
257 : : }
258 : :
259 : : pAttributeList->AddAttribute(
260 : : ouAttrName,
261 [ # # ][ # # ]: 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)(pAttr->children->content))));
262 : 0 : pAttr = pAttr->next;
263 : 0 : }
264 : :
265 [ # # ]: 0 : rtl::OString sNodeName = getNodeQName(pNode);
266 : :
267 [ # # ]: 0 : if (xHandler.is())
268 : : {
269 [ # # ]: 0 : xHandler->startElement(
270 : 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )),
271 [ # # ][ # # ]: 0 : xAttrList);
272 : : }
273 : :
274 [ # # ]: 0 : xHandler2->startElement(
275 : 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )),
276 [ # # ][ # # ]: 0 : xAttrList);
277 : 0 : }
278 : :
279 : 0 : void XMLDocumentWrapper_XmlSecImpl::sendEndElement(
280 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
281 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
282 : : const xmlNodePtr pNode) const
283 : : throw (cssxs::SAXException)
284 : : /****** XMLDocumentWrapper_XmlSecImpl/sendEndElement **************************
285 : : *
286 : : * NAME
287 : : * sendEndElement -- Constructs a endElement SAX event
288 : : *
289 : : * SYNOPSIS
290 : : * sendEndElement(xHandler, xHandler2, pNode);
291 : : *
292 : : * FUNCTION
293 : : * Used when converting the document into SAX event stream.
294 : : * This method constructs a endElement SAX event for a particular
295 : : * element, then calls the endElement methods of the XDocumentHandlers.
296 : : *
297 : : * INPUTS
298 : : * xHandler - the first XDocumentHandler interface to receive the
299 : : * endElement SAX event. It can be NULL.
300 : : * xHandler2 - the second XDocumentHandler interface to receive the
301 : : * endElement SAX event. It can't be NULL.
302 : : * pNode - the node on which the endElement should be generated.
303 : : * This node must be a element type.
304 : : *
305 : : * RESULT
306 : : * empty
307 : : *
308 : : * AUTHOR
309 : : * Michael Mi
310 : : * Email: michael.mi@sun.com
311 : : ******************************************************************************/
312 : : {
313 [ # # ]: 0 : rtl::OString sNodeName = getNodeQName(pNode);
314 : :
315 [ # # ]: 0 : if (xHandler.is())
316 : : {
317 [ # # ][ # # ]: 0 : xHandler->endElement(rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )));
[ # # ]
318 : : }
319 : :
320 [ # # ][ # # ]: 0 : xHandler2->endElement(rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )));
[ # # ]
321 : 0 : }
322 : :
323 : 0 : void XMLDocumentWrapper_XmlSecImpl::sendNode(
324 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler,
325 : : const cssu::Reference< cssxs::XDocumentHandler >& xHandler2,
326 : : const xmlNodePtr pNode) const
327 : : throw (cssxs::SAXException)
328 : : /****** XMLDocumentWrapper_XmlSecImpl/sendNode ********************************
329 : : *
330 : : * NAME
331 : : * sendNode -- Constructs a characters SAX event or a
332 : : * processingInstruction SAX event
333 : : *
334 : : * SYNOPSIS
335 : : * sendNode(xHandler, xHandler2, pNode);
336 : : *
337 : : * FUNCTION
338 : : * Used when converting the document into SAX event stream.
339 : : * This method constructs a characters SAX event or a
340 : : * processingInstructionfor SAX event based on the type of a particular
341 : : * element, then calls the corresponding methods of the XDocumentHandlers.
342 : : *
343 : : * INPUTS
344 : : * xHandler - the first XDocumentHandler interface to receive the
345 : : * SAX event. It can be NULL.
346 : : * xHandler2 - the second XDocumentHandler interface to receive the
347 : : * SAX event. It can't be NULL.
348 : : * pNode - the node on which the endElement should be generated.
349 : : * If it is a text node, then a characters SAX event is
350 : : * generated; if it is a PI node, then a
351 : : * processingInstructionfor SAX event is generated.
352 : : *
353 : : * RESULT
354 : : * empty
355 : : *
356 : : * AUTHOR
357 : : * Michael Mi
358 : : * Email: michael.mi@sun.com
359 : : ******************************************************************************/
360 : : {
361 : 0 : xmlElementType type = pNode->type;
362 : :
363 [ # # ]: 0 : if (type == XML_TEXT_NODE)
364 : : {
365 [ # # ]: 0 : if (xHandler.is())
366 : : {
367 [ # # ]: 0 : xHandler->characters(rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) )));
368 : : }
369 : :
370 [ # # ]: 0 : xHandler2->characters(rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) )));
371 : : }
372 [ # # ]: 0 : else if (type == XML_PI_NODE)
373 : : {
374 [ # # ]: 0 : if (xHandler.is())
375 : : {
376 : 0 : xHandler->processingInstruction(
377 : 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->name)) )),
378 [ # # ][ # # ]: 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) )));
379 : : }
380 : :
381 : 0 : xHandler2->processingInstruction(
382 : 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->name)) )),
383 [ # # ][ # # ]: 0 : rtl::OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) )));
384 : : }
385 : 0 : }
386 : :
387 : 0 : rtl::OString XMLDocumentWrapper_XmlSecImpl::getNodeQName(const xmlNodePtr pNode) const
388 : : /****** XMLDocumentWrapper_XmlSecImpl/getNodeQName ****************************
389 : : *
390 : : * NAME
391 : : * getNodeQName -- Retrives the qualified name of a node
392 : : *
393 : : * SYNOPSIS
394 : : * name = getNodeQName(pNode);
395 : : *
396 : : * FUNCTION
397 : : * see NAME
398 : : *
399 : : * INPUTS
400 : : * pNode - the node whose name will be retrived
401 : : *
402 : : * RESULT
403 : : * name - the node's qualified name
404 : : *
405 : : * AUTHOR
406 : : * Michael Mi
407 : : * Email: michael.mi@sun.com
408 : : ******************************************************************************/
409 : : {
410 : 0 : rtl::OString sNodeName((const sal_Char*)pNode->name);
411 [ # # ]: 0 : if (pNode->ns != NULL)
412 : : {
413 : 0 : xmlNsPtr pNs = pNode->ns;
414 : :
415 [ # # ]: 0 : if (pNs->prefix != NULL)
416 : : {
417 : 0 : rtl::OString sPrefix((const sal_Char*)pNs->prefix);
418 : 0 : sNodeName = sPrefix+rtl::OString(":")+sNodeName;
419 : : }
420 : : }
421 : :
422 : 0 : return sNodeName;
423 : : }
424 : :
425 : 0 : xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement) const
426 : : /****** XMLDocumentWrapper_XmlSecImpl/checkElement ****************************
427 : : *
428 : : * NAME
429 : : * checkElement -- Retrives the node wrapped by an XXMLElementWrapper
430 : : * interface
431 : : *
432 : : * SYNOPSIS
433 : : * node = checkElement(xXMLElement);
434 : : *
435 : : * FUNCTION
436 : : * see NAME
437 : : *
438 : : * INPUTS
439 : : * xXMLElement - the XXMLElementWrapper interface wraping a node
440 : : *
441 : : * RESULT
442 : : * node - the node wrapped in the XXMLElementWrapper interface
443 : : *
444 : : * AUTHOR
445 : : * Michael Mi
446 : : * Email: michael.mi@sun.com
447 : : ******************************************************************************/
448 : : {
449 : 0 : xmlNodePtr rc = NULL;
450 : :
451 [ # # ]: 0 : if (xXMLElement.is())
452 : : {
453 [ # # ]: 0 : cssu::Reference< cssl::XUnoTunnel > xNodTunnel( xXMLElement, cssu::UNO_QUERY ) ;
454 [ # # ]: 0 : if( !xNodTunnel.is() )
455 : : {
456 [ # # ]: 0 : throw cssu::RuntimeException() ;
457 : : }
458 : :
459 : : XMLElementWrapper_XmlSecImpl* pElement
460 : : = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(
461 : : sal::static_int_cast<sal_uIntPtr>(
462 [ # # ]: 0 : xNodTunnel->getSomething(
463 [ # # ][ # # ]: 0 : XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))) ;
[ # # ]
464 : :
465 [ # # ]: 0 : if( pElement == NULL ) {
466 [ # # ]: 0 : throw cssu::RuntimeException() ;
467 : : }
468 : :
469 [ # # ]: 0 : rc = pElement->getNativeElement();
470 : : }
471 : :
472 : 0 : return rc;
473 : : }
474 : :
475 : 0 : sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete(
476 : : const xmlNodePtr pNode)
477 : : /****** XMLDocumentWrapper_XmlSecImpl/recursiveDelete *************************
478 : : *
479 : : * NAME
480 : : * recursiveDelete -- Deletes a paticular node with its branch.
481 : : *
482 : : * SYNOPSIS
483 : : * result = recursiveDelete(pNode);
484 : : *
485 : : * FUNCTION
486 : : * Deletes a paticular node with its branch, while reserving the nodes
487 : : * (and their brance) listed in the m_aReservedNodes.
488 : : * The deletion process is preformed in the tree order, that is, a node
489 : : * is deleted after its previous sibling node is deleted, a parent node
490 : : * is deleted after its branch is deleted.
491 : : * During the deletion process when the m_pStopAtNode is reached, the
492 : : * progress is interrupted at once.
493 : : *
494 : : * INPUTS
495 : : * pNode - the node to be deleted
496 : : *
497 : : * RESULT
498 : : * result - the result of the deletion process, can be one of following
499 : : * values:
500 : : * NODE_STOPED - the process is interrupted by meeting the
501 : : * m_pStopAtNode
502 : : * NODE_NOTREMOVED - the pNode is not completely removed
503 : : * because there is its descendant in the
504 : : * m_aReservedNodes list
505 : : * NODE_REMOVED - the pNode and its branch are completely
506 : : * removed
507 : : *
508 : : * NOTES
509 : : * The node in the m_aReservedNodes list must be in the tree order, otherwise
510 : : * the result is unpredictable.
511 : : *
512 : : * AUTHOR
513 : : * Michael Mi
514 : : * Email: michael.mi@sun.com
515 : : ******************************************************************************/
516 : : {
517 [ # # ]: 0 : if (pNode == m_pStopAtNode)
518 : : {
519 : 0 : return NODE_STOPED;
520 : : }
521 : :
522 [ # # ]: 0 : if (pNode != m_pCurrentReservedNode)
523 : : {
524 : 0 : xmlNodePtr pChild = pNode->children;
525 : :
526 : : xmlNodePtr pNextSibling;
527 : 0 : bool bIsRemoved = true;
528 : : sal_Int32 nResult;
529 : :
530 [ # # ]: 0 : while( pChild != NULL )
531 : : {
532 : 0 : pNextSibling = pChild->next;
533 : 0 : nResult = recursiveDelete(pChild);
534 : :
535 [ # # # # ]: 0 : switch (nResult)
536 : : {
537 : : case NODE_STOPED:
538 : 0 : return NODE_STOPED;
539 : : case NODE_NOTREMOVED:
540 : 0 : bIsRemoved = false;
541 : 0 : break;
542 : : case NODE_REMOVED:
543 : 0 : removeNode(pChild);
544 : 0 : break;
545 : : default:
546 [ # # ]: 0 : throw cssu::RuntimeException();
547 : : }
548 : :
549 : 0 : pChild = pNextSibling;
550 : : }
551 : :
552 [ # # ]: 0 : if (pNode == m_pCurrentElement)
553 : : {
554 : 0 : bIsRemoved = false;
555 : : }
556 : :
557 [ # # ]: 0 : return bIsRemoved?NODE_REMOVED:NODE_NOTREMOVED;
558 : : }
559 : : else
560 : : {
561 : 0 : getNextReservedNode();
562 : 0 : return NODE_NOTREMOVED;
563 : : }
564 : : }
565 : :
566 : 0 : void XMLDocumentWrapper_XmlSecImpl::getNextReservedNode()
567 : : /****** XMLDocumentWrapper_XmlSecImpl/getNextReservedNode *********************
568 : : *
569 : : * NAME
570 : : * getNextReservedNode -- Highlights the next reserved node in the
571 : : * reserved node list
572 : : *
573 : : * SYNOPSIS
574 : : * getNextReservedNode();
575 : : *
576 : : * FUNCTION
577 : : * The m_aReservedNodes array holds a node list, while the
578 : : * m_pCurrentReservedNode points to the one currently highlighted.
579 : : * This method is used to highlight the next node in the node list.
580 : : * This method is called at the time when the current highlighted node
581 : : * has been already processed, and the next node should be ready.
582 : : *
583 : : * INPUTS
584 : : * empty
585 : : *
586 : : * RESULT
587 : : * empty
588 : : *
589 : : * AUTHOR
590 : : * Michael Mi
591 : : * Email: michael.mi@sun.com
592 : : ******************************************************************************/
593 : : {
594 [ # # ]: 0 : if (m_nReservedNodeIndex < m_aReservedNodes.getLength())
595 : : {
596 : 0 : m_pCurrentReservedNode = checkElement( m_aReservedNodes[m_nReservedNodeIndex] );
597 : 0 : m_nReservedNodeIndex ++;
598 : : }
599 : : else
600 : : {
601 : 0 : m_pCurrentReservedNode = NULL;
602 : : }
603 : 0 : }
604 : :
605 : 0 : void XMLDocumentWrapper_XmlSecImpl::removeNode(const xmlNodePtr pNode) const
606 : : /****** XMLDocumentWrapper_XmlSecImpl/removeNode ******************************
607 : : *
608 : : * NAME
609 : : * removeNode -- Deletes a node with its branch unconditionaly
610 : : *
611 : : * SYNOPSIS
612 : : * removeNode( pNode );
613 : : *
614 : : * FUNCTION
615 : : * Delete the node along with its branch from the document.
616 : : *
617 : : * INPUTS
618 : : * pNode - the node to be deleted
619 : : *
620 : : * RESULT
621 : : * empty
622 : : *
623 : : * AUTHOR
624 : : * Michael Mi
625 : : * Email: michael.mi@sun.com
626 : : ******************************************************************************/
627 : : {
628 : : /* you can't remove the current node */
629 : : OSL_ASSERT( m_pCurrentElement != pNode );
630 : :
631 : 0 : xmlAttrPtr pAttr = pNode->properties;
632 : :
633 [ # # ]: 0 : while (pAttr != NULL)
634 : : {
635 [ # # ]: 0 : if (!stricmp((sal_Char*)pAttr->name,"id"))
636 : : {
637 : 0 : xmlRemoveID(m_pDocument, pAttr);
638 : : }
639 : :
640 : 0 : pAttr = pAttr->next;
641 : : }
642 : :
643 : 0 : xmlUnlinkNode(pNode);
644 : 0 : xmlFreeNode(pNode);
645 : 0 : }
646 : :
647 : 0 : void XMLDocumentWrapper_XmlSecImpl::buildIDAttr(xmlNodePtr pNode) const
648 : : /****** XMLDocumentWrapper_XmlSecImpl/buildIDAttr *****************************
649 : : *
650 : : * NAME
651 : : * buildIDAttr -- build the ID attribute of a node
652 : : *
653 : : * SYNOPSIS
654 : : * buildIDAttr( pNode );
655 : : *
656 : : * FUNCTION
657 : : * see NAME
658 : : *
659 : : * INPUTS
660 : : * pNode - the node whose id attribute will be built
661 : : *
662 : : * RESULT
663 : : * empty
664 : : *
665 : : * AUTHOR
666 : : * Michael Mi
667 : : * Email: michael.mi@sun.com
668 : : ******************************************************************************/
669 : : {
670 : 0 : xmlAttrPtr idAttr = xmlHasProp( pNode, (const unsigned char *)"id" );
671 [ # # ]: 0 : if (idAttr == NULL)
672 : : {
673 : 0 : idAttr = xmlHasProp( pNode, (const unsigned char *)"Id" );
674 : : }
675 : :
676 [ # # ]: 0 : if (idAttr != NULL)
677 : : {
678 : 0 : xmlChar* idValue = xmlNodeListGetString( m_pDocument, idAttr->children, 1 ) ;
679 : 0 : xmlAddID( NULL, m_pDocument, idValue, idAttr );
680 : : }
681 : 0 : }
682 : :
683 : 0 : void XMLDocumentWrapper_XmlSecImpl::rebuildIDLink(xmlNodePtr pNode) const
684 : : /****** XMLDocumentWrapper_XmlSecImpl/rebuildIDLink ***************************
685 : : *
686 : : * NAME
687 : : * rebuildIDLink -- rebuild the ID link for the branch
688 : : *
689 : : * SYNOPSIS
690 : : * rebuildIDLink( pNode );
691 : : *
692 : : * FUNCTION
693 : : * see NAME
694 : : *
695 : : * INPUTS
696 : : * pNode - the node, from which the branch will be rebuilt
697 : : *
698 : : * RESULT
699 : : * empty
700 : : *
701 : : * AUTHOR
702 : : * Michael Mi
703 : : * Email: michael.mi@sun.com
704 : : ******************************************************************************/
705 : : {
706 [ # # ][ # # ]: 0 : if (pNode != NULL && pNode->type == XML_ELEMENT_NODE)
707 : : {
708 : 0 : buildIDAttr( pNode );
709 : :
710 : 0 : xmlNodePtr child = pNode->children;
711 [ # # ]: 0 : while (child != NULL)
712 : : {
713 : 0 : rebuildIDLink(child);
714 : 0 : child = child->next;
715 : : }
716 : : }
717 : 0 : }
718 : :
719 : : /* XXMLDocumentWrapper */
720 : 0 : cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getCurrentElement( )
721 : : throw (cssu::RuntimeException)
722 : : {
723 [ # # ]: 0 : XMLElementWrapper_XmlSecImpl* pElement = new XMLElementWrapper_XmlSecImpl(m_pCurrentElement);
724 [ # # ]: 0 : return (cssu::Reference< cssxw::XXMLElementWrapper >)pElement;
725 : : }
726 : :
727 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setCurrentElement( const cssu::Reference< cssxw::XXMLElementWrapper >& element )
728 : : throw (cssu::RuntimeException)
729 : : {
730 : 0 : m_pCurrentElement = checkElement( element );
731 : 0 : saxHelper.setCurrentNode( m_pCurrentElement );
732 : 0 : }
733 : :
734 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::removeCurrentElement( )
735 : : throw (cssu::RuntimeException)
736 : : {
737 : : OSL_ASSERT( m_pCurrentElement != NULL );
738 : :
739 : 0 : xmlNodePtr pOldCurrentElement = m_pCurrentElement;
740 : :
741 : : /*
742 : : * pop the top node in the parser context's
743 : : * nodeTab stack, then the parent of that node will
744 : : * automatically become the new stack top, and
745 : : * the current node as well.
746 : : */
747 : : saxHelper.endElement(
748 : : rtl::OUString(
749 : 0 : RTL_UTF8_USTRINGPARAM (
750 : : (sal_Char*)(pOldCurrentElement->name)
751 [ # # ]: 0 : )));
752 : 0 : m_pCurrentElement = saxHelper.getCurrentNode();
753 : :
754 : : /*
755 : : * remove the node
756 : : */
757 : 0 : removeNode(pOldCurrentElement);
758 : 0 : }
759 : :
760 : 0 : sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrent( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
761 : : throw (cssu::RuntimeException)
762 : : {
763 : 0 : xmlNodePtr pNode = checkElement(node);
764 : 0 : return (pNode == m_pCurrentElement);
765 : : }
766 : :
767 : 0 : sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrentElementEmpty( )
768 : : throw (cssu::RuntimeException)
769 : : {
770 : 0 : sal_Bool rc = sal_False;
771 : :
772 [ # # ]: 0 : if (m_pCurrentElement->children == NULL)
773 : : {
774 : 0 : rc = sal_True;
775 : : }
776 : :
777 : 0 : return rc;
778 : : }
779 : :
780 : 0 : rtl::OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getNodeName( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
781 : : throw (cssu::RuntimeException)
782 : : {
783 : 0 : xmlNodePtr pNode = checkElement(node);
784 : 0 : return rtl::OUString(RTL_UTF8_USTRINGPARAM ( (sal_Char*)pNode->name ));
785 : : }
786 : :
787 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::clearUselessData(
788 : : const cssu::Reference< cssxw::XXMLElementWrapper >& node,
789 : : const cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >& reservedDescendants,
790 : : const cssu::Reference< cssxw::XXMLElementWrapper >& stopAtNode )
791 : : throw (cssu::RuntimeException)
792 : : {
793 : 0 : xmlNodePtr pTargetNode = checkElement(node);
794 : :
795 : 0 : m_pStopAtNode = checkElement(stopAtNode);
796 : 0 : m_aReservedNodes = reservedDescendants;
797 : 0 : m_nReservedNodeIndex = 0;
798 : :
799 : 0 : getNextReservedNode();
800 : :
801 : 0 : recursiveDelete(pTargetNode);
802 : 0 : }
803 : :
804 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const cssu::Reference< cssxw::XXMLElementWrapper >& node )
805 : : throw (cssu::RuntimeException)
806 : : {
807 : 0 : xmlNodePtr pTargetNode = checkElement(node);
808 : : xmlNodePtr pParent;
809 : :
810 [ # # ]: 0 : while (pTargetNode != NULL)
811 : : {
812 [ # # ][ # # ]: 0 : if (pTargetNode->children != NULL || pTargetNode == m_pCurrentElement)
813 : : {
814 : 0 : break;
815 : : }
816 : :
817 : 0 : pParent = pTargetNode->parent;
818 : 0 : removeNode(pTargetNode);
819 : 0 : pTargetNode = pParent;
820 : : }
821 : 0 : }
822 : :
823 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const cssu::Reference< cssxs::XDocumentHandler >& handler )
824 : : throw (cssxs::SAXException, cssu::RuntimeException)
825 : : {
826 [ # # ]: 0 : if (m_pRootElement != NULL)
827 : : {
828 : 0 : xmlNodePtr pTempCurrentElement = m_pCurrentElement;
829 : 0 : sal_Int32 nTempCurrentPosition = m_nCurrentPosition;
830 : :
831 : 0 : m_pCurrentElement = m_pRootElement;
832 : :
833 : 0 : m_nCurrentPosition = NODEPOSITION_STARTELEMENT;
834 : 0 : cssu::Reference< cssxs::XDocumentHandler > xHandler = handler;
835 : :
836 : 0 : while(true)
837 : : {
838 [ # # # # ]: 0 : switch (m_nCurrentPosition)
839 : : {
840 : : case NODEPOSITION_STARTELEMENT:
841 [ # # ][ # # ]: 0 : sendStartElement(NULL, xHandler, m_pCurrentElement);
842 : 0 : break;
843 : : case NODEPOSITION_ENDELEMENT:
844 [ # # ][ # # ]: 0 : sendEndElement(NULL, xHandler, m_pCurrentElement);
845 : 0 : break;
846 : : case NODEPOSITION_NORMAL:
847 [ # # ][ # # ]: 0 : sendNode(NULL, xHandler, m_pCurrentElement);
848 : 0 : break;
849 : : }
850 : :
851 [ # # ][ # # ]: 0 : if ( (m_pCurrentElement == m_pRootElement) && (m_nCurrentPosition == NODEPOSITION_ENDELEMENT ))
852 : : {
853 : 0 : break;
854 : : }
855 : :
856 : 0 : getNextSAXEvent();
857 : : }
858 : :
859 : 0 : m_pCurrentElement = pTempCurrentElement;
860 : 0 : m_nCurrentPosition = nTempCurrentPosition;
861 : : }
862 : 0 : }
863 : :
864 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents(
865 : : const cssu::Reference< cssxs::XDocumentHandler >& handler,
866 : : const cssu::Reference< cssxs::XDocumentHandler >& xEventKeeperHandler,
867 : : const cssu::Reference< cssxw::XXMLElementWrapper >& startNode,
868 : : const cssu::Reference< cssxw::XXMLElementWrapper >& endNode )
869 : : throw (cssxs::SAXException, cssu::RuntimeException)
870 : : {
871 : : /*
872 : : * The first SAX event is the startElement of the startNode
873 : : * element.
874 : : */
875 : 0 : bool bHasCurrentElementChild = (m_pCurrentElement->children != NULL);
876 : :
877 : 0 : xmlNodePtr pTempCurrentElement = m_pCurrentElement;
878 : :
879 [ # # ]: 0 : m_pCurrentElement = checkElement(startNode);
880 : :
881 [ # # ]: 0 : if (m_pCurrentElement->type == XML_ELEMENT_NODE)
882 : : {
883 : 0 : m_nCurrentPosition = NODEPOSITION_STARTELEMENT;
884 : : }
885 : : else
886 : : {
887 : 0 : m_nCurrentPosition = NODEPOSITION_NORMAL;
888 : : }
889 : :
890 [ # # ]: 0 : xmlNodePtr pEndNode = checkElement(endNode);
891 : :
892 [ # # ]: 0 : cssu::Reference < cssxc::sax::XSAXEventKeeper > xSAXEventKeeper( xEventKeeperHandler, cssu::UNO_QUERY );
893 : :
894 : 0 : cssu::Reference< cssxs::XDocumentHandler > xHandler = handler;
895 : :
896 : 0 : while(true)
897 : : {
898 [ # # # # ]: 0 : switch (m_nCurrentPosition)
899 : : {
900 : : case NODEPOSITION_STARTELEMENT:
901 [ # # ]: 0 : sendStartElement(xHandler, xEventKeeperHandler, m_pCurrentElement);
902 : 0 : break;
903 : : case NODEPOSITION_ENDELEMENT:
904 [ # # ]: 0 : sendEndElement(xHandler, xEventKeeperHandler, m_pCurrentElement);
905 : 0 : break;
906 : : case NODEPOSITION_NORMAL:
907 [ # # ]: 0 : sendNode(xHandler, xEventKeeperHandler, m_pCurrentElement);
908 : 0 : break;
909 : : default:
910 [ # # ]: 0 : throw cssu::RuntimeException();
911 : : }
912 : :
913 [ # # ][ # # ]: 0 : if (xSAXEventKeeper->isBlocking())
[ # # ]
914 : : {
915 [ # # ]: 0 : xHandler = NULL;
916 : : }
917 : :
918 [ # # ][ # # ]: 0 : if (pEndNode == NULL &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
919 [ # # ]: 0 : ((bHasCurrentElementChild && m_pCurrentElement == xmlGetLastChild(pTempCurrentElement) && m_nCurrentPosition != NODEPOSITION_STARTELEMENT) ||
920 : 0 : (!bHasCurrentElementChild && m_pCurrentElement == pTempCurrentElement && m_nCurrentPosition == NODEPOSITION_STARTELEMENT)))
921 : : {
922 : 0 : break;
923 : : }
924 : :
925 : 0 : getNextSAXEvent();
926 : :
927 : : /*
928 : : * If there is an end point specified, then check whether
929 : : * the current node equals to the end point. If so, stop
930 : : * generating.
931 : : */
932 [ # # ][ # # ]: 0 : if (pEndNode != NULL && m_pCurrentElement == pEndNode)
933 : : {
934 : 0 : break;
935 : : }
936 : : }
937 : :
938 : 0 : m_pCurrentElement = pTempCurrentElement;
939 : 0 : }
940 : :
941 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::rebuildIDLink(
942 : : const com::sun::star::uno::Reference< com::sun::star::xml::wrapper::XXMLElementWrapper >& node )
943 : : throw (com::sun::star::uno::RuntimeException)
944 : : {
945 : 0 : xmlNodePtr pNode = checkElement( node );
946 : 0 : rebuildIDLink(pNode);
947 : 0 : }
948 : :
949 : :
950 : : /* cssxs::XDocumentHandler */
951 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startDocument( )
952 : : throw (cssxs::SAXException, cssu::RuntimeException)
953 : : {
954 : 0 : }
955 : :
956 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::endDocument( )
957 : : throw (cssxs::SAXException, cssu::RuntimeException)
958 : : {
959 : 0 : }
960 : :
961 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const rtl::OUString& aName, const cssu::Reference< cssxs::XAttributeList >& xAttribs )
962 : : throw (cssxs::SAXException, cssu::RuntimeException)
963 : : {
964 [ # # ][ # # ]: 0 : sal_Int32 nLength = xAttribs->getLength();
965 [ # # ]: 0 : cssu::Sequence< cssxcsax::XMLAttribute > aAttributes (nLength);
966 : :
967 [ # # ]: 0 : for (int i = 0; i < nLength; ++i)
968 : : {
969 [ # # ][ # # ]: 0 : aAttributes[i].sName = xAttribs->getNameByIndex((short)i);
[ # # ]
970 [ # # ][ # # ]: 0 : aAttributes[i].sValue =xAttribs->getValueByIndex((short)i);
[ # # ]
971 : : }
972 : :
973 [ # # ][ # # ]: 0 : _startElement(aName, aAttributes);
974 : 0 : }
975 : :
976 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::endElement( const rtl::OUString& aName )
977 : : throw (cssxs::SAXException, cssu::RuntimeException)
978 : : {
979 : 0 : saxHelper.endElement(aName);
980 : 0 : m_pCurrentElement = saxHelper.getCurrentNode();
981 : 0 : }
982 : :
983 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::characters( const rtl::OUString& aChars )
984 : : throw (cssxs::SAXException, cssu::RuntimeException)
985 : : {
986 : 0 : saxHelper.characters(aChars);
987 : 0 : }
988 : :
989 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::ignorableWhitespace( const rtl::OUString& aWhitespaces )
990 : : throw (cssxs::SAXException, cssu::RuntimeException)
991 : : {
992 : 0 : saxHelper.ignorableWhitespace(aWhitespaces);
993 : 0 : }
994 : :
995 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData )
996 : : throw (cssxs::SAXException, cssu::RuntimeException)
997 : : {
998 : 0 : saxHelper.processingInstruction(aTarget, aData);
999 : 0 : }
1000 : :
1001 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setDocumentLocator( const cssu::Reference< cssxs::XLocator >& xLocator )
1002 : : throw (cssxs::SAXException, cssu::RuntimeException)
1003 : : {
1004 : 0 : saxHelper.setDocumentLocator(xLocator);
1005 : 0 : }
1006 : :
1007 : : /* XCompressedDocumentHandler */
1008 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_startDocument( )
1009 : : throw (cssxs::SAXException, cssu::RuntimeException)
1010 : : {
1011 : 0 : }
1012 : :
1013 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_endDocument( )
1014 : : throw (cssxs::SAXException, cssu::RuntimeException)
1015 : : {
1016 : 0 : }
1017 : :
1018 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_startElement( const rtl::OUString& aName, const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
1019 : : throw (cssxs::SAXException, cssu::RuntimeException)
1020 : : {
1021 : 0 : saxHelper.startElement(aName, aAttributes);
1022 : 0 : m_pCurrentElement = saxHelper.getCurrentNode();
1023 : :
1024 : 0 : buildIDAttr( m_pCurrentElement );
1025 : 0 : }
1026 : :
1027 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_endElement( const rtl::OUString& aName )
1028 : : throw (cssxs::SAXException, cssu::RuntimeException)
1029 : : {
1030 : 0 : endElement( aName );
1031 : 0 : }
1032 : :
1033 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_characters( const rtl::OUString& aChars )
1034 : : throw (cssxs::SAXException, cssu::RuntimeException)
1035 : : {
1036 : 0 : characters( aChars );
1037 : 0 : }
1038 : :
1039 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_ignorableWhitespace( const rtl::OUString& aWhitespaces )
1040 : : throw (cssxs::SAXException, cssu::RuntimeException)
1041 : : {
1042 : 0 : ignorableWhitespace( aWhitespaces );
1043 : 0 : }
1044 : :
1045 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData )
1046 : : throw (cssxs::SAXException, cssu::RuntimeException)
1047 : : {
1048 : 0 : processingInstruction( aTarget, aData );
1049 : 0 : }
1050 : :
1051 : 0 : void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_setDocumentLocator( sal_Int32 /*columnNumber*/, sal_Int32 /*lineNumber*/, const rtl::OUString& /*publicId*/, const rtl::OUString& /*systemId*/ )
1052 : : throw (cssxs::SAXException, cssu::RuntimeException)
1053 : : {
1054 : 0 : }
1055 : :
1056 : 3 : rtl::OUString XMLDocumentWrapper_XmlSecImpl_getImplementationName ()
1057 : : throw (cssu::RuntimeException)
1058 : : {
1059 : 3 : return rtl::OUString ( RTL_ASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
1060 : : }
1061 : :
1062 : 0 : sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl_supportsService( const rtl::OUString& ServiceName )
1063 : : throw (cssu::RuntimeException)
1064 : : {
1065 : 0 : return ServiceName == SERVICE_NAME;
1066 : : }
1067 : :
1068 : 0 : cssu::Sequence< rtl::OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames( )
1069 : : throw (cssu::RuntimeException)
1070 : : {
1071 : 0 : cssu::Sequence < rtl::OUString > aRet(1);
1072 [ # # ]: 0 : rtl::OUString* pArray = aRet.getArray();
1073 [ # # ]: 0 : pArray[0] = rtl::OUString ( RTL_ASCII_USTRINGPARAM ( SERVICE_NAME ) );
1074 : 0 : return aRet;
1075 : : }
1076 : : #undef SERVICE_NAME
1077 : :
1078 : 0 : cssu::Reference< cssu::XInterface > SAL_CALL XMLDocumentWrapper_XmlSecImpl_createInstance(
1079 : : const cssu::Reference< cssl::XMultiServiceFactory > &)
1080 : : throw( cssu::Exception )
1081 : : {
1082 [ # # ]: 0 : return (cppu::OWeakObject*) new XMLDocumentWrapper_XmlSecImpl( );
1083 : : }
1084 : :
1085 : : /* XServiceInfo */
1086 : 0 : rtl::OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getImplementationName( )
1087 : : throw (cssu::RuntimeException)
1088 : : {
1089 : 0 : return XMLDocumentWrapper_XmlSecImpl_getImplementationName();
1090 : : }
1091 : 0 : sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const rtl::OUString& rServiceName )
1092 : : throw (cssu::RuntimeException)
1093 : : {
1094 : 0 : return XMLDocumentWrapper_XmlSecImpl_supportsService( rServiceName );
1095 : : }
1096 : 0 : cssu::Sequence< rtl::OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getSupportedServiceNames( )
1097 : : throw (cssu::RuntimeException)
1098 : : {
1099 : 0 : return XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames();
1100 : : }
1101 : :
1102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|