/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: XXMLDocumentWrapper.idl,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2005/09/08 10:33:35 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
 
//i20156 - new file for xmlsecurity module

/** -- idl definition -- **/

#ifndef __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_
#define __com_sun_star_xml_wrapper_xxmldocumentwrapper_idl_

#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/uno/Exception.idl>
#include <com/sun/star/xml/sax/XDocumentHandler.idl>

module com { module sun { module star { module xml { module wrapper {

interface XXMLElementWrapper;

/**
 * Interface of XML Document Wrapper.
 * <p>
 * When converting SAX events into a DOM tree, this interface is 
 * used to manipulate the DOM data in UNO perspective. 
 * <p>
 * Every lauguage has its own methods to manipulate its native DOM
 * data structure, this interface provides a common method set which
 * each lauguage have to implement. 
 * <p>
 * In another word, this interface wraps language dependant methods,
 * then other component can manipulate DOM data through UNO methods.
 */
interface XXMLDocumentWrapper : com::sun::star::uno::XInterface
{
	/**
	 * Gets the current element.
	 *
	 * @return   the current element in the SAX event stream
	 */
	XXMLElementWrapper getCurrentElement();
	
	/**
	 * Sets the current element.
	 * <p>
	 * When the current element is replaced outside of this interface, then 
	 * uses this method can update the current element pointer.
	 *
	 * @param element   the new current element
	 */
	void setCurrentElement([in] XXMLElementWrapper element);

	/**
	 * Removes the current element.
	 * <p>
	 * When the current element is removed, then its parent element becomes
	 * the new current element.
	 */
	void removeCurrentElement();
	
	/**
	 * Checks whether an element is the current element.
	 *
	 * @param node   the element to be checked
	 * @return       <code>true</code> if the node is the current element,
	 *               <code>false</code> otherwise
	 */
	boolean isCurrent([in] XXMLElementWrapper node);
	
	/**
	 * Checks whether the current element is empty.
	 *
	 * @return   <code>true</code> if the current element is empty, 
	 *           <code>false</code> otherwise
	 */
	boolean isCurrentElementEmpty();

	/**
	 * Gets the name of the element.
	 *
	 * @param node   the element whose name will be gotten
	 * @return       the name of the element
	 */
	string getNodeName([in] XXMLElementWrapper node);
	
	/**
	 * Clears all useless element in a branch of the DOM tree along the
	 * tree order.
	 *
	 * @param node                  the start point of the branch to clear
	 * @param reservedDescendants   an array including all elements that
	 *                              need to be reserved (along their
	 *                              ancestor path)
	 * @param stopAtNode            the stop element. The operation have
	 *                              to interrupt when this element is met
	 *                              during clearing
	 */
	void clearUselessData(
		[in] XXMLElementWrapper node,
		[in] sequence< XXMLElementWrapper > reservedDescendants,
		[in] XXMLElementWrapper stopAtNode);
		
	/**
	 * Collapses a tree path
	 * <p>
	 * Each element in the ancestor path of the node will be checked,
	 * if this element is empty, then deletes it.
	 *
	 * @param node   the start point of the path from where the tree
	 *               path will be collapsed
	 */
	void collapse([in] XXMLElementWrapper node);
		
	/**
	 * Converts a part of the DOM tree into SAX events.
	 *
	 * @param handler                 the document handler which will receive
	 *                                generated SAX events
	 * @param saxEventKeeperHandler   the SAXEventKeeper connecting with
	 *                                this XMLDocumentHandler
	 * @param startNode               the start point to generate SAX events
	 * @param endNode                 the end point where to stop generating
	 */
	void generateSAXEvents(
		[in] com::sun::star::xml::sax::XDocumentHandler handler, 
		[in] com::sun::star::xml::sax::XDocumentHandler saxEventKeeperHandler, 
		[in] XXMLElementWrapper startNode, 
		[in] XXMLElementWrapper endNode)
		raises(  com::sun::star::xml::sax::SAXException );
		
	/**
	 * Converts the whole DOM tree into a SAX event stream.
	 *
	 * @param handler   the document handelr which will receive the SAX event
	 *                  stream
	 */
	void getTree([in] com::sun::star::xml::sax::XDocumentHandler handler)
		raises(  com::sun::star::xml::sax::SAXException );

	/**
	 * Rebuild the ID attribute in the branch starting from the particular
	 * element.
	 *
	 * @param node   the root element of the branch whose ID link will be
	 *               built
	 */
	void rebuildIDLink([in] XXMLElementWrapper node);
};

} ; } ; } ; } ; } ;


#endif

