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_DOCUMENTBUILDER_HXX
21 : : #define DOM_DOCUMENTBUILDER_HXX
22 : :
23 : : #include <sal/types.h>
24 : :
25 : : #include <cppuhelper/implbase2.hxx>
26 : :
27 : : #include <com/sun/star/uno/Reference.h>
28 : : #include <com/sun/star/uno/Sequence.h>
29 : :
30 : : #include <com/sun/star/uno/XInterface.hpp>
31 : : #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
32 : : #include <com/sun/star/xml/dom/XDocument.hpp>
33 : : #include <com/sun/star/xml/dom/XDOMImplementation.hpp>
34 : : #include <com/sun/star/xml/sax/XEntityResolver.hpp>
35 : : #include <com/sun/star/xml/sax/XErrorHandler.hpp>
36 : : #include <com/sun/star/xml/sax/SAXParseException.hpp>
37 : : #include <com/sun/star/io/XInputStream.hpp>
38 : : #include <com/sun/star/io/IOException.hpp>
39 : : #include <com/sun/star/lang/XServiceInfo.hpp>
40 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 : :
42 : :
43 : : using ::rtl::OUString;
44 : : using namespace com::sun::star::uno;
45 : : using namespace com::sun::star::lang;
46 : : using namespace com::sun::star::xml::dom;
47 : : using namespace com::sun::star::xml::sax;
48 : : using namespace com::sun::star::io;
49 : :
50 : : namespace DOM
51 : : {
52 : : typedef ::cppu::WeakImplHelper2
53 : : < XDocumentBuilder
54 : : , ::com::sun::star::lang::XServiceInfo
55 : : > CDocumentBuilder_Base;
56 : :
57 [ + - ][ - + ]: 382 : class CDocumentBuilder
58 : : : public CDocumentBuilder_Base
59 : : {
60 : : private:
61 : : ::osl::Mutex m_Mutex;
62 : : Reference< ::com::sun::star::lang::XMultiServiceFactory > const
63 : : m_xFactory;
64 : : Reference< XEntityResolver > m_xEntityResolver;
65 : : Reference< XErrorHandler > m_xErrorHandler;
66 : :
67 : : public:
68 : :
69 : : // ctor
70 : : CDocumentBuilder(
71 : : Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
72 : : xFactory);
73 : :
74 : : // call for factory
75 : : static Reference< XInterface > getInstance(
76 : : Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
77 : : xFactory);
78 : :
79 : : // static helpers for service info and component management
80 : : static const char* aImplementationName;
81 : : static const char* aSupportedServiceNames[];
82 : : static OUString _getImplementationName();
83 : : static Sequence< OUString > _getSupportedServiceNames();
84 : : static Reference< XInterface > _getInstance(
85 : : Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
86 : : rSMgr);
87 : :
88 : : // XServiceInfo
89 : : virtual OUString SAL_CALL getImplementationName()
90 : : throw (RuntimeException);
91 : : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
92 : : throw (RuntimeException);
93 : : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
94 : : throw (RuntimeException);
95 : :
96 : : /**
97 : : Obtain an instance of a DOMImplementation object.
98 : : */
99 : : virtual Reference< XDOMImplementation > SAL_CALL getDOMImplementation()
100 : : throw (RuntimeException);
101 : :
102 : : /**
103 : : Indicates whether or not this parser is configured to understand
104 : : namespaces.
105 : : */
106 : : virtual sal_Bool SAL_CALL isNamespaceAware()
107 : : throw (RuntimeException);
108 : :
109 : : /**
110 : : Indicates whether or not this parser is configured to validate XML
111 : : documents.
112 : : */
113 : : virtual sal_Bool SAL_CALL isValidating()
114 : : throw (RuntimeException);
115 : :
116 : : /**
117 : : Obtain a new instance of a DOM Document object to build a DOM tree
118 : : with.
119 : : */
120 : : virtual Reference< XDocument > SAL_CALL newDocument()
121 : : throw (RuntimeException);
122 : :
123 : : /**
124 : : Parse the content of the given InputStream as an XML document and
125 : : return a new DOM Document object.
126 : : */
127 : : virtual Reference< XDocument > SAL_CALL parse(const Reference< XInputStream >& is)
128 : : throw (RuntimeException, SAXParseException, IOException);
129 : :
130 : : /**
131 : : Parse the content of the given URI as an XML document and return
132 : : a new DOM Document object.
133 : : */
134 : : virtual Reference< XDocument > SAL_CALL parseURI(const OUString& uri)
135 : : throw (RuntimeException, SAXParseException, IOException);
136 : :
137 : : /**
138 : : Specify the EntityResolver to be used to resolve entities present
139 : : in the XML document to be parsed.
140 : : */
141 : : virtual void SAL_CALL setEntityResolver(const Reference< XEntityResolver >& er)
142 : : throw (RuntimeException);
143 : :
144 : : virtual Reference< XEntityResolver > SAL_CALL getEntityResolver()
145 : : throw (RuntimeException);
146 : :
147 : :
148 : : /**
149 : : Specify the ErrorHandler to be used to report errors present in
150 : : the XML document to be parsed.
151 : : */
152 : : virtual void SAL_CALL setErrorHandler(const Reference< XErrorHandler >& eh)
153 : : throw (RuntimeException);
154 : : };
155 : : }
156 : :
157 : : #endif
158 : :
159 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|