1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
21 #define __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
23 #include
<com
/sun
/star
/uno
/XInterface.idl
>
24 #include
<com
/sun
/star
/uno
/Exception.idl
>
25 #include
<com
/sun
/star
/xml
/sax
/XDocumentHandler.idl
>
27 module com
{ module sun
{ module star
{ module xml
{ module wrapper
{
29 interface XXMLElementWrapper
;
32 * Interface of XML Document Wrapper.
34 * When converting SAX events into a DOM tree, this interface is
35 * used to manipulate the DOM data in UNO perspective.
37 * Every language has its own methods to manipulate its native DOM
38 * data structure, this interface provides a common method set which
39 * each language have to implement.
41 * In another word, this interface wraps language dependent methods,
42 * then other component can manipulate DOM data through UNO methods.
44 interface XXMLDocumentWrapper
: com
::sun
::star
::uno
::XInterface
47 * Gets the current element.
49 * @return the current element in the SAX event stream
51 XXMLElementWrapper getCurrentElement
();
54 * Sets the current element.
56 * When the current element is replaced outside of this interface, then
57 * uses this method can update the current element pointer.
59 * @param element the new current element
61 void setCurrentElement
([in] XXMLElementWrapper element
);
64 * Removes the current element.
66 * When the current element is removed, then its parent element becomes
67 * the new current element.
69 void removeCurrentElement
();
72 * Checks whether an element is the current element.
74 * @param node the element to be checked
75 * @return <code>true</code> if the node is the current element,
76 * <code>false</code> otherwise
78 boolean isCurrent
([in] XXMLElementWrapper node
);
81 * Checks whether the current element is empty.
83 * @return <code>true</code> if the current element is empty,
84 * <code>false</code> otherwise
86 boolean isCurrentElementEmpty
();
89 * Gets the name of the element.
91 * @param node the element whose name will be gotten
92 * @return the name of the element
94 string getNodeName
([in] XXMLElementWrapper node
);
97 * Clears all useless element in a branch of the DOM tree along the
100 * @param node the start point of the branch to clear
101 * @param reservedDescendants an array including all elements that
102 * need to be reserved (along their
104 * @param stopAtNode the stop element. The operation have
105 * to interrupt when this element is met
108 void clearUselessData
(
109 [in] XXMLElementWrapper node
,
110 [in] sequence
< XXMLElementWrapper
> reservedDescendants
,
111 [in] XXMLElementWrapper stopAtNode
);
114 * Collapses a tree path
116 * Each element in the ancestor path of the node will be checked,
117 * if this element is empty, then deletes it.
119 * @param node the start point of the path from where the tree
120 * path will be collapsed
122 void collapse
([in] XXMLElementWrapper node
);
125 * Converts a part of the DOM tree into SAX events.
127 * @param handler the document handler which will receive
128 * generated SAX events
129 * @param saxEventKeeperHandler the SAXEventKeeper connecting with
130 * this XMLDocumentHandler
131 * @param startNode the start point to generate SAX events
132 * @param endNode the end point where to stop generating
134 void generateSAXEvents
(
135 [in] com
::sun
::star
::xml
::sax
::XDocumentHandler handler
,
136 [in] com
::sun
::star
::xml
::sax
::XDocumentHandler saxEventKeeperHandler
,
137 [in] XXMLElementWrapper startNode
,
138 [in] XXMLElementWrapper endNode
)
139 raises
( com
::sun
::star
::xml
::sax
::SAXException
);
142 * Converts the whole DOM tree into a SAX event stream.
144 * @param handler the document handler which will receive the SAX event
147 void getTree
([in] com
::sun
::star
::xml
::sax
::XDocumentHandler handler
)
148 raises
( com
::sun
::star
::xml
::sax
::SAXException
);
151 * Rebuild the ID attribute in the branch starting from the particular
154 * @param node the root element of the branch whose ID link will be
157 void rebuildIDLink
([in] XXMLElementWrapper node
);
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */