bump product version to 4.1.6.2
[LibreOffice.git] / unoxml / source / dom / documentbuilder.hxx
blobf1c5daf2ae91440f0d35bef13c4ed7c7549732a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef DOM_DOCUMENTBUILDER_HXX
21 #define DOM_DOCUMENTBUILDER_HXX
23 #include <sal/types.h>
25 #include <cppuhelper/implbase2.hxx>
27 #include <com/sun/star/uno/Reference.h>
28 #include <com/sun/star/uno/Sequence.h>
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>
43 using namespace com::sun::star::uno;
44 using namespace com::sun::star::lang;
45 using namespace com::sun::star::xml::dom;
46 using namespace com::sun::star::xml::sax;
47 using namespace com::sun::star::io;
49 namespace DOM
51 typedef ::cppu::WeakImplHelper2
52 < XDocumentBuilder
53 , ::com::sun::star::lang::XServiceInfo
54 > CDocumentBuilder_Base;
56 class CDocumentBuilder
57 : public CDocumentBuilder_Base
59 private:
60 ::osl::Mutex m_Mutex;
61 Reference< ::com::sun::star::lang::XMultiServiceFactory > const
62 m_xFactory;
63 Reference< XEntityResolver > m_xEntityResolver;
64 Reference< XErrorHandler > m_xErrorHandler;
66 public:
68 // ctor
69 CDocumentBuilder(
70 Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
71 xFactory);
73 // call for factory
74 static Reference< XInterface > getInstance(
75 Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
76 xFactory);
78 // static helpers for service info and component management
79 static const char* aImplementationName;
80 static const char* aSupportedServiceNames[];
81 static OUString _getImplementationName();
82 static Sequence< OUString > _getSupportedServiceNames();
83 static Reference< XInterface > _getInstance(
84 Reference< ::com::sun::star::lang::XMultiServiceFactory > const&
85 rSMgr);
87 // XServiceInfo
88 virtual OUString SAL_CALL getImplementationName()
89 throw (RuntimeException);
90 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
91 throw (RuntimeException);
92 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
93 throw (RuntimeException);
95 /**
96 Obtain an instance of a DOMImplementation object.
98 virtual Reference< XDOMImplementation > SAL_CALL getDOMImplementation()
99 throw (RuntimeException);
102 Indicates whether or not this parser is configured to understand
103 namespaces.
105 virtual sal_Bool SAL_CALL isNamespaceAware()
106 throw (RuntimeException);
109 Indicates whether or not this parser is configured to validate XML
110 documents.
112 virtual sal_Bool SAL_CALL isValidating()
113 throw (RuntimeException);
116 Obtain a new instance of a DOM Document object to build a DOM tree
117 with.
119 virtual Reference< XDocument > SAL_CALL newDocument()
120 throw (RuntimeException);
123 Parse the content of the given InputStream as an XML document and
124 return a new DOM Document object.
126 virtual Reference< XDocument > SAL_CALL parse(const Reference< XInputStream >& is)
127 throw (RuntimeException, SAXParseException, IOException);
130 Parse the content of the given URI as an XML document and return
131 a new DOM Document object.
133 virtual Reference< XDocument > SAL_CALL parseURI(const OUString& uri)
134 throw (RuntimeException, SAXParseException, IOException);
137 Specify the EntityResolver to be used to resolve entities present
138 in the XML document to be parsed.
140 virtual void SAL_CALL setEntityResolver(const Reference< XEntityResolver >& er)
141 throw (RuntimeException);
143 virtual Reference< XEntityResolver > SAL_CALL getEntityResolver()
144 throw (RuntimeException);
148 Specify the ErrorHandler to be used to report errors present in
149 the XML document to be parsed.
151 virtual void SAL_CALL setErrorHandler(const Reference< XErrorHandler >& eh)
152 throw (RuntimeException);
156 #endif
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */