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 module com
{ module sun
{ module star
{ module xml
{ module wrapper
{
22 interface XXMLElementWrapper
;
25 * Interface of XML Document Wrapper.
27 * When converting SAX events into a DOM tree, this interface is
28 * used to manipulate the DOM data in UNO perspective.
30 * Every language has its own methods to manipulate its native DOM
31 * data structure, this interface provides a common method set which
32 * each language have to implement.
34 * In another word, this interface wraps language dependent methods,
35 * then other component can manipulate DOM data through UNO methods.
37 interface XXMLDocumentWrapper
: com
::sun
::star
::uno
::XInterface
40 * Gets the current element.
42 * @return the current element in the SAX event stream
44 XXMLElementWrapper getCurrentElement
();
47 * Sets the current element.
49 * When the current element is replaced outside of this interface, then
50 * uses this method can update the current element pointer.
52 * @param element the new current element
54 void setCurrentElement
([in] XXMLElementWrapper element
);
57 * Removes the current element.
59 * When the current element is removed, then its parent element becomes
60 * the new current element.
62 void removeCurrentElement
();
65 * Checks whether an element is the current element.
67 * @param node the element to be checked
68 * @return <code>true</code> if the node is the current element,
69 * <code>false</code> otherwise
71 boolean isCurrent
([in] XXMLElementWrapper node
);
74 * Checks whether the current element is empty.
76 * @return <code>true</code> if the current element is empty,
77 * <code>false</code> otherwise
79 boolean isCurrentElementEmpty
();
82 * Gets the name of the element.
84 * @param node the element whose name will be gotten
85 * @return the name of the element
87 string getNodeName
([in] XXMLElementWrapper node
);
90 * Clears all useless element in a branch of the DOM tree along the
93 * @param node the start point of the branch to clear
94 * @param reservedDescendants an array including all elements that
95 * need to be reserved (along their
97 * @param stopAtNode the stop element. The operation have
98 * to interrupt when this element is met
101 void clearUselessData
(
102 [in] XXMLElementWrapper node
,
103 [in] sequence
< XXMLElementWrapper
> reservedDescendants
,
104 [in] XXMLElementWrapper stopAtNode
);
107 * Collapses a tree path
109 * Each element in the ancestor path of the node will be checked,
110 * if this element is empty, then deletes it.
112 * @param node the start point of the path from where the tree
113 * path will be collapsed
115 void collapse
([in] XXMLElementWrapper node
);
118 * Converts a part of the DOM tree into SAX events.
120 * @param handler the document handler which will receive
121 * generated SAX events
122 * @param saxEventKeeperHandler the SAXEventKeeper connecting with
123 * this XMLDocumentHandler
124 * @param startNode the start point to generate SAX events
125 * @param endNode the end point where to stop generating
127 void generateSAXEvents
(
128 [in] com
::sun
::star
::xml
::sax
::XDocumentHandler handler
,
129 [in] com
::sun
::star
::xml
::sax
::XDocumentHandler saxEventKeeperHandler
,
130 [in] XXMLElementWrapper startNode
,
131 [in] XXMLElementWrapper endNode
)
132 raises
( com
::sun
::star
::xml
::sax
::SAXException
);
135 * Converts the whole DOM tree into a SAX event stream.
137 * @param handler the document handler which will receive the SAX event
140 void getTree
([in] com
::sun
::star
::xml
::sax
::XDocumentHandler handler
)
141 raises
( com
::sun
::star
::xml
::sax
::SAXException
);
144 * Rebuild the ID attribute in the branch starting from the particular
147 * @param node the root element of the branch whose ID link will be
150 void rebuildIDLink
([in] XXMLElementWrapper node
);
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */