1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef XPATH_XPATHOBJECT_HXX
29 #define XPATH_XPATHOBJECT_HXX
30 
31 #include <boost/shared_ptr.hpp>
32 
33 #include <libxml/tree.h>
34 #include <libxml/xpath.h>
35 
36 #include <sal/types.h>
37 #include <rtl/ref.hxx>
38 
39 #include <cppuhelper/implbase1.hxx>
40 
41 #include <com/sun/star/uno/Reference.h>
42 #include <com/sun/star/xml/dom/XNodeList.hpp>
43 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
44 
45 
46 using ::rtl::OUString;
47 using namespace com::sun::star::uno;
48 using namespace com::sun::star::xml::dom;
49 using namespace com::sun::star::xml::xpath;
50 
51 
52 namespace DOM {
53     class CDocument;
54 }
55 
56 namespace XPath
57 {
58     class CXPathObject : public cppu::WeakImplHelper1< XXPathObject >
59     {
60     private:
61         ::rtl::Reference< DOM::CDocument > const m_pDocument;
62         ::osl::Mutex & m_rMutex;
63         boost::shared_ptr<xmlXPathObject> const m_pXPathObj;
64         XPathObjectType const m_XPathObjectType;
65 
66     public:
67         CXPathObject( ::rtl::Reference<DOM::CDocument> const& pDocument,
68             ::osl::Mutex & rMutex,
69             ::boost::shared_ptr<xmlXPathObject> const& pXPathObj);
70 
71     /**
72         get object type
73     */
74     virtual XPathObjectType SAL_CALL getObjectType() throw (RuntimeException);
75 
76     /**
77         get the nodes from a nodelist type object
78     */
79     virtual Reference< XNodeList > SAL_CALL getNodeList()
80         throw (RuntimeException);
81 
82      /**
83         get value of a boolean object
84      */
85      virtual sal_Bool SAL_CALL getBoolean() throw (RuntimeException);
86 
87     /**
88         get number as byte
89     */
90     virtual sal_Int8 SAL_CALL getByte() throw (RuntimeException);
91 
92     /**
93         get number as short
94     */
95     virtual sal_Int16 SAL_CALL getShort() throw (RuntimeException);
96 
97     /**
98         get number as long
99     */
100     virtual sal_Int32 SAL_CALL getLong() throw (RuntimeException);
101 
102     /**
103         get number as hyper
104     */
105     virtual sal_Int64 SAL_CALL getHyper() throw (RuntimeException);
106 
107     /**
108         get number as float
109     */
110     virtual float SAL_CALL getFloat() throw (RuntimeException);
111 
112     /**
113         get number as double
114     */
115     virtual double SAL_CALL getDouble() throw (RuntimeException);
116 
117     /**
118         get string value
119     */
120     virtual OUString SAL_CALL getString() throw (RuntimeException);
121 
122     };
123 }
124 
125 #endif
126