1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28//i20156 - new file for xmlsecurity module
29
30/** -- idl definition -- **/
31
32#ifndef __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
33#define __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
34
35#include <com/sun/star/uno/XInterface.idl>
36#include <com/sun/star/uno/Exception.idl>
37#include <com/sun/star/xml/sax/XDocumentHandler.idl>
38
39module com { module sun { module star { module xml { module wrapper {
40
41interface XXMLElementWrapper;
42
43/**
44 * Interface of XML Document Wrapper.
45 * <p>
46 * When converting SAX events into a DOM tree, this interface is
47 * used to manipulate the DOM data in UNO perspective.
48 * <p>
49 * Every lauguage has its own methods to manipulate its native DOM
50 * data structure, this interface provides a common method set which
51 * each lauguage have to implement.
52 * <p>
53 * In another word, this interface wraps language dependant methods,
54 * then other component can manipulate DOM data through UNO methods.
55 */
56interface XXMLDocumentWrapper : com::sun::star::uno::XInterface
57{
58	/**
59	 * Gets the current element.
60	 *
61	 * @return   the current element in the SAX event stream
62	 */
63	XXMLElementWrapper getCurrentElement();
64
65	/**
66	 * Sets the current element.
67	 * <p>
68	 * When the current element is replaced outside of this interface, then
69	 * uses this method can update the current element pointer.
70	 *
71	 * @param element   the new current element
72	 */
73	void setCurrentElement([in] XXMLElementWrapper element);
74
75	/**
76	 * Removes the current element.
77	 * <p>
78	 * When the current element is removed, then its parent element becomes
79	 * the new current element.
80	 */
81	void removeCurrentElement();
82
83	/**
84	 * Checks whether an element is the current element.
85	 *
86	 * @param node   the element to be checked
87	 * @return       <code>true</code> if the node is the current element,
88	 *               <code>false</code> otherwise
89	 */
90	boolean isCurrent([in] XXMLElementWrapper node);
91
92	/**
93	 * Checks whether the current element is empty.
94	 *
95	 * @return   <code>true</code> if the current element is empty,
96	 *           <code>false</code> otherwise
97	 */
98	boolean isCurrentElementEmpty();
99
100	/**
101	 * Gets the name of the element.
102	 *
103	 * @param node   the element whose name will be gotten
104	 * @return       the name of the element
105	 */
106	string getNodeName([in] XXMLElementWrapper node);
107
108	/**
109	 * Clears all useless element in a branch of the DOM tree along the
110	 * tree order.
111	 *
112	 * @param node                  the start point of the branch to clear
113	 * @param reservedDescendants   an array including all elements that
114	 *                              need to be reserved (along their
115	 *                              ancestor path)
116	 * @param stopAtNode            the stop element. The operation have
117	 *                              to interrupt when this element is met
118	 *                              during clearing
119	 */
120	void clearUselessData(
121		[in] XXMLElementWrapper node,
122		[in] sequence< XXMLElementWrapper > reservedDescendants,
123		[in] XXMLElementWrapper stopAtNode);
124
125	/**
126	 * Collapses a tree path
127	 * <p>
128	 * Each element in the ancestor path of the node will be checked,
129	 * if this element is empty, then deletes it.
130	 *
131	 * @param node   the start point of the path from where the tree
132	 *               path will be collapsed
133	 */
134	void collapse([in] XXMLElementWrapper node);
135
136	/**
137	 * Converts a part of the DOM tree into SAX events.
138	 *
139	 * @param handler                 the document handler which will receive
140	 *                                generated SAX events
141	 * @param saxEventKeeperHandler   the SAXEventKeeper connecting with
142	 *                                this XMLDocumentHandler
143	 * @param startNode               the start point to generate SAX events
144	 * @param endNode                 the end point where to stop generating
145	 */
146	void generateSAXEvents(
147		[in] com::sun::star::xml::sax::XDocumentHandler handler,
148		[in] com::sun::star::xml::sax::XDocumentHandler saxEventKeeperHandler,
149		[in] XXMLElementWrapper startNode,
150		[in] XXMLElementWrapper endNode)
151		raises(  com::sun::star::xml::sax::SAXException );
152
153	/**
154	 * Converts the whole DOM tree into a SAX event stream.
155	 *
156	 * @param handler   the document handelr which will receive the SAX event
157	 *                  stream
158	 */
159	void getTree([in] com::sun::star::xml::sax::XDocumentHandler handler)
160		raises(  com::sun::star::xml::sax::SAXException );
161
162	/**
163	 * Rebuild the ID attribute in the branch starting from the particular
164	 * element.
165	 *
166	 * @param node   the root element of the branch whose ID link will be
167	 *               built
168	 */
169	void rebuildIDLink([in] XXMLElementWrapper node);
170};
171
172} ; } ; } ; } ; } ;
173
174
175#endif
176
177