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