Update ooo320-m1
[ooovba.git] / unoxml / source / dom / elementlist.hxx
blob847d7967489f4401dff8c2543a46f2bad68aae3a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: elementlist.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _ELEMENTLIST_HXX
32 #define _ELEMENTLIST_HXX
34 #include <vector>
35 #include <sal/types.h>
36 #include <cppuhelper/implbase1.hxx>
37 #include <cppuhelper/implbase2.hxx>
38 #include <com/sun/star/uno/Reference.h>
39 #include <com/sun/star/uno/Exception.hpp>
40 #include <com/sun/star/xml/dom/XNode.hpp>
41 #include <com/sun/star/xml/dom/XNodeList.hpp>
42 #include <com/sun/star/xml/dom/events/XEvent.hpp>
43 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
44 #include "element.hxx"
45 #include "document.hxx"
46 #include "libxml/tree.h"
48 using ::rtl::OUString;
49 using namespace com::sun::star::uno;
50 using namespace com::sun::star::xml::dom;
51 using namespace com::sun::star::xml::dom::events;
53 namespace DOM
55 typedef std::vector< xmlNodePtr > nodevector;
57 class CElementList : public cppu::WeakImplHelper2< XNodeList, com::sun::star::xml::dom::events::XEventListener >
59 private:
60 const CElement* m_pElement;
61 const OUString m_aName;
62 const OUString m_aURI;
63 xmlChar *xName;
64 xmlChar *xURI;
65 sal_Bool m_bRebuild;
66 nodevector m_nodevector;
69 void buildlist(xmlNodePtr pNode, sal_Bool start=sal_True);
70 void registerListener(const CElement* pElement);
72 public:
73 CElementList(const CElement* aDoc, const OUString& aName);
74 CElementList(const CElement* aDoc, const OUString& aName, const OUString& aURI);
75 /**
76 The number of nodes in the list.
78 virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
79 /**
80 Returns the indexth item in the collection.
82 virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
84 // XEventListener
85 virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException);
89 #endif