Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef DOM_ELEMENTLIST_HXX
21 : : #define DOM_ELEMENTLIST_HXX
22 : :
23 : : #include <vector>
24 : :
25 : : #include <boost/scoped_array.hpp>
26 : :
27 : : #include <libxml/tree.h>
28 : :
29 : : #include <sal/types.h>
30 : : #include <rtl/ref.hxx>
31 : :
32 : : #include <com/sun/star/uno/Reference.h>
33 : : #include <com/sun/star/uno/Exception.hpp>
34 : : #include <com/sun/star/xml/dom/XNode.hpp>
35 : : #include <com/sun/star/xml/dom/XNodeList.hpp>
36 : : #include <com/sun/star/xml/dom/events/XEvent.hpp>
37 : : #include <com/sun/star/xml/dom/events/XEventListener.hpp>
38 : :
39 : : #include <cppuhelper/implbase2.hxx>
40 : :
41 : :
42 : : using ::rtl::OUString;
43 : : using namespace com::sun::star::uno;
44 : : using namespace com::sun::star::xml::dom;
45 : : using namespace com::sun::star::xml::dom::events;
46 : :
47 : : namespace DOM
48 : : {
49 : : class CElement;
50 : :
51 : : typedef std::vector< xmlNodePtr > nodevector_t;
52 : :
53 [ + - ][ + - ]: 8 : class CElementList
[ - + ]
54 : : : public cppu::WeakImplHelper2< XNodeList,
55 : : com::sun::star::xml::dom::events::XEventListener >
56 : : {
57 : : private:
58 : : ::rtl::Reference<CElement> const m_pElement;
59 : : ::osl::Mutex & m_rMutex;
60 : : ::boost::scoped_array<xmlChar> const m_pName;
61 : : ::boost::scoped_array<xmlChar> const m_pURI;
62 : : bool m_bRebuild;
63 : : nodevector_t m_nodevector;
64 : :
65 : : void buildlist(xmlNodePtr pNode, sal_Bool start=sal_True);
66 : : void registerListener(CElement & rElement);
67 : :
68 : : public:
69 : : CElementList(::rtl::Reference<CElement> const& pElement,
70 : : ::osl::Mutex & rMutex,
71 : : OUString const& rName, OUString const*const pURI = 0);
72 : :
73 : : /**
74 : : The number of nodes in the list.
75 : : */
76 : : virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
77 : : /**
78 : : Returns the indexth item in the collection.
79 : : */
80 : : virtual Reference< XNode > SAL_CALL item(sal_Int32 index)
81 : : throw (RuntimeException);
82 : :
83 : : // XEventListener
84 : : virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt)
85 : : throw (RuntimeException);
86 : : };
87 : : }
88 : :
89 : : #endif
90 : :
91 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|