office-gobmx/unoxml/source/dom/elementlist.hxx

86 lines
2.7 KiB
C++
Raw Normal View History

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: elementlist.hxx,v $
*
* $Revision: 1.3 $
*
* last change: $Author: rt $ $Date: 2005-09-09 10:01:25 $
*
* 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
*
************************************************************************/
#ifndef _ELEMENTLIST_HXX
#define _ELEMENTLIST_HXX
#include <vector>
#include <sal/types.h>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/xml/dom/XNode.hpp>
#include <com/sun/star/xml/dom/XNodeList.hpp>
#include "element.hxx"
#include "document.hxx"
#include "libxml/tree.h"
using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::xml::dom;
namespace DOM
{
typedef std::vector< xmlNodePtr > nodevector;
class CElementList : public cppu::WeakImplHelper1< XNodeList >
{
private:
const CElement* m_pElement;
const OUString m_aURI;
const OUString m_aName;
xmlChar *xName;
xmlChar *xURI;
void buildlist(nodevector& v, xmlNodePtr pNode, sal_Bool start=sal_True);
public:
CElementList(const CElement* aDoc, const OUString& aName);
CElementList(const CElement* aDoc, const OUString& aName, const OUString& aURI);
/**
The number of nodes in the list.
*/
virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
/**
Returns the indexth item in the collection.
*/
virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
};
}
#endif