1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir//i20156 - new file for xmlsecurity module
25cdf0e10cSrcweir
26cdf0e10cSrcweir/** -- idl definition -- **/
27cdf0e10cSrcweir
28cdf0e10cSrcweir#ifndef __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
29cdf0e10cSrcweir#define __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
30cdf0e10cSrcweir
31cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
32cdf0e10cSrcweir#include <com/sun/star/uno/Exception.idl>
33cdf0e10cSrcweir#include <com/sun/star/xml/sax/XDocumentHandler.idl>
34cdf0e10cSrcweir
35cdf0e10cSrcweirmodule com { module sun { module star { module xml { module wrapper {
36cdf0e10cSrcweir
37cdf0e10cSrcweirinterface XXMLElementWrapper;
38cdf0e10cSrcweir
39cdf0e10cSrcweir/**
40cdf0e10cSrcweir * Interface of XML Document Wrapper.
41cdf0e10cSrcweir * <p>
42cdf0e10cSrcweir * When converting SAX events into a DOM tree, this interface is
43cdf0e10cSrcweir * used to manipulate the DOM data in UNO perspective.
44cdf0e10cSrcweir * <p>
45cdf0e10cSrcweir * Every lauguage has its own methods to manipulate its native DOM
46cdf0e10cSrcweir * data structure, this interface provides a common method set which
47cdf0e10cSrcweir * each lauguage have to implement.
48cdf0e10cSrcweir * <p>
49*a893be29SPedro Giffuni * In another word, this interface wraps language dependent methods,
50cdf0e10cSrcweir * then other component can manipulate DOM data through UNO methods.
51cdf0e10cSrcweir */
52cdf0e10cSrcweirinterface XXMLDocumentWrapper : com::sun::star::uno::XInterface
53cdf0e10cSrcweir{
54cdf0e10cSrcweir	/**
55cdf0e10cSrcweir	 * Gets the current element.
56cdf0e10cSrcweir	 *
57cdf0e10cSrcweir	 * @return   the current element in the SAX event stream
58cdf0e10cSrcweir	 */
59cdf0e10cSrcweir	XXMLElementWrapper getCurrentElement();
60cdf0e10cSrcweir
61cdf0e10cSrcweir	/**
62cdf0e10cSrcweir	 * Sets the current element.
63cdf0e10cSrcweir	 * <p>
64cdf0e10cSrcweir	 * When the current element is replaced outside of this interface, then
65cdf0e10cSrcweir	 * uses this method can update the current element pointer.
66cdf0e10cSrcweir	 *
67cdf0e10cSrcweir	 * @param element   the new current element
68cdf0e10cSrcweir	 */
69cdf0e10cSrcweir	void setCurrentElement([in] XXMLElementWrapper element);
70cdf0e10cSrcweir
71cdf0e10cSrcweir	/**
72cdf0e10cSrcweir	 * Removes the current element.
73cdf0e10cSrcweir	 * <p>
74cdf0e10cSrcweir	 * When the current element is removed, then its parent element becomes
75cdf0e10cSrcweir	 * the new current element.
76cdf0e10cSrcweir	 */
77cdf0e10cSrcweir	void removeCurrentElement();
78cdf0e10cSrcweir
79cdf0e10cSrcweir	/**
80cdf0e10cSrcweir	 * Checks whether an element is the current element.
81cdf0e10cSrcweir	 *
82cdf0e10cSrcweir	 * @param node   the element to be checked
83cdf0e10cSrcweir	 * @return       <code>true</code> if the node is the current element,
84cdf0e10cSrcweir	 *               <code>false</code> otherwise
85cdf0e10cSrcweir	 */
86cdf0e10cSrcweir	boolean isCurrent([in] XXMLElementWrapper node);
87cdf0e10cSrcweir
88cdf0e10cSrcweir	/**
89cdf0e10cSrcweir	 * Checks whether the current element is empty.
90cdf0e10cSrcweir	 *
91cdf0e10cSrcweir	 * @return   <code>true</code> if the current element is empty,
92cdf0e10cSrcweir	 *           <code>false</code> otherwise
93cdf0e10cSrcweir	 */
94cdf0e10cSrcweir	boolean isCurrentElementEmpty();
95cdf0e10cSrcweir
96cdf0e10cSrcweir	/**
97cdf0e10cSrcweir	 * Gets the name of the element.
98cdf0e10cSrcweir	 *
99cdf0e10cSrcweir	 * @param node   the element whose name will be gotten
100cdf0e10cSrcweir	 * @return       the name of the element
101cdf0e10cSrcweir	 */
102cdf0e10cSrcweir	string getNodeName([in] XXMLElementWrapper node);
103cdf0e10cSrcweir
104cdf0e10cSrcweir	/**
105cdf0e10cSrcweir	 * Clears all useless element in a branch of the DOM tree along the
106cdf0e10cSrcweir	 * tree order.
107cdf0e10cSrcweir	 *
108cdf0e10cSrcweir	 * @param node                  the start point of the branch to clear
109cdf0e10cSrcweir	 * @param reservedDescendants   an array including all elements that
110cdf0e10cSrcweir	 *                              need to be reserved (along their
111cdf0e10cSrcweir	 *                              ancestor path)
112cdf0e10cSrcweir	 * @param stopAtNode            the stop element. The operation have
113cdf0e10cSrcweir	 *                              to interrupt when this element is met
114cdf0e10cSrcweir	 *                              during clearing
115cdf0e10cSrcweir	 */
116cdf0e10cSrcweir	void clearUselessData(
117cdf0e10cSrcweir		[in] XXMLElementWrapper node,
118cdf0e10cSrcweir		[in] sequence< XXMLElementWrapper > reservedDescendants,
119cdf0e10cSrcweir		[in] XXMLElementWrapper stopAtNode);
120cdf0e10cSrcweir
121cdf0e10cSrcweir	/**
122cdf0e10cSrcweir	 * Collapses a tree path
123cdf0e10cSrcweir	 * <p>
124cdf0e10cSrcweir	 * Each element in the ancestor path of the node will be checked,
125cdf0e10cSrcweir	 * if this element is empty, then deletes it.
126cdf0e10cSrcweir	 *
127cdf0e10cSrcweir	 * @param node   the start point of the path from where the tree
128cdf0e10cSrcweir	 *               path will be collapsed
129cdf0e10cSrcweir	 */
130cdf0e10cSrcweir	void collapse([in] XXMLElementWrapper node);
131cdf0e10cSrcweir
132cdf0e10cSrcweir	/**
133cdf0e10cSrcweir	 * Converts a part of the DOM tree into SAX events.
134cdf0e10cSrcweir	 *
135cdf0e10cSrcweir	 * @param handler                 the document handler which will receive
136cdf0e10cSrcweir	 *                                generated SAX events
137cdf0e10cSrcweir	 * @param saxEventKeeperHandler   the SAXEventKeeper connecting with
138cdf0e10cSrcweir	 *                                this XMLDocumentHandler
139cdf0e10cSrcweir	 * @param startNode               the start point to generate SAX events
140cdf0e10cSrcweir	 * @param endNode                 the end point where to stop generating
141cdf0e10cSrcweir	 */
142cdf0e10cSrcweir	void generateSAXEvents(
143cdf0e10cSrcweir		[in] com::sun::star::xml::sax::XDocumentHandler handler,
144cdf0e10cSrcweir		[in] com::sun::star::xml::sax::XDocumentHandler saxEventKeeperHandler,
145cdf0e10cSrcweir		[in] XXMLElementWrapper startNode,
146cdf0e10cSrcweir		[in] XXMLElementWrapper endNode)
147cdf0e10cSrcweir		raises(  com::sun::star::xml::sax::SAXException );
148cdf0e10cSrcweir
149cdf0e10cSrcweir	/**
150cdf0e10cSrcweir	 * Converts the whole DOM tree into a SAX event stream.
151cdf0e10cSrcweir	 *
152cdf0e10cSrcweir	 * @param handler   the document handelr which will receive the SAX event
153cdf0e10cSrcweir	 *                  stream
154cdf0e10cSrcweir	 */
155cdf0e10cSrcweir	void getTree([in] com::sun::star::xml::sax::XDocumentHandler handler)
156cdf0e10cSrcweir		raises(  com::sun::star::xml::sax::SAXException );
157cdf0e10cSrcweir
158cdf0e10cSrcweir	/**
159cdf0e10cSrcweir	 * Rebuild the ID attribute in the branch starting from the particular
160cdf0e10cSrcweir	 * element.
161cdf0e10cSrcweir	 *
162cdf0e10cSrcweir	 * @param node   the root element of the branch whose ID link will be
163cdf0e10cSrcweir	 *               built
164cdf0e10cSrcweir	 */
165cdf0e10cSrcweir	void rebuildIDLink([in] XXMLElementWrapper node);
166cdf0e10cSrcweir};
167cdf0e10cSrcweir
168cdf0e10cSrcweir} ; } ; } ; } ; } ;
169cdf0e10cSrcweir
170cdf0e10cSrcweir
171cdf0e10cSrcweir#endif
172cdf0e10cSrcweir
173