LibreOffice Module unoxml (master) 1
documentbuilder.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/types.h>
23
25
26#include <com/sun/star/uno/Reference.h>
27#include <com/sun/star/uno/Sequence.h>
28
29#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
30#include <com/sun/star/xml/dom/XDocument.hpp>
31#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
32#include <com/sun/star/xml/sax/XEntityResolver.hpp>
33#include <com/sun/star/xml/sax/XErrorHandler.hpp>
34#include <com/sun/star/io/XInputStream.hpp>
35#include <com/sun/star/lang/XServiceInfo.hpp>
36#include <mutex>
37
38namespace DOM
39{
40 typedef ::cppu::WeakImplHelper
41 < css::xml::dom::XDocumentBuilder
42 , css::lang::XServiceInfo
44
47 {
48 private:
49 std::recursive_mutex m_Mutex;
50 css::uno::Reference< css::xml::sax::XEntityResolver > m_xEntityResolver;
51 css::uno::Reference< css::xml::sax::XErrorHandler > m_xErrorHandler;
52
53 public:
54
55 // ctor
56 explicit CDocumentBuilder();
57
58 // XServiceInfo
59 virtual OUString SAL_CALL getImplementationName() override;
60 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
61 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
62
66 virtual css::uno::Reference< css::xml::dom::XDOMImplementation > SAL_CALL getDOMImplementation() override;
67
72 virtual sal_Bool SAL_CALL isNamespaceAware() override;
73
78 virtual sal_Bool SAL_CALL isValidating() override;
79
84 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL newDocument() override;
85
90 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL parse(const css::uno::Reference< css::io::XInputStream >& is) override;
91
96 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL parseURI(const OUString& uri) override;
97
102 virtual void SAL_CALL setEntityResolver(const css::uno::Reference< css::xml::sax::XEntityResolver >& er) override;
103
105 css::uno::Reference< css::xml::sax::XEntityResolver > getEntityResolver();
106
107
112 virtual void SAL_CALL setErrorHandler(const css::uno::Reference< css::xml::sax::XErrorHandler >& eh) override;
113
114 /*
115 Get the ErrorHandler to be used to report errors present in
116 the XML document to be parsed.
117 */
118
119 const css::uno::Reference< css::xml::sax::XErrorHandler >& getErrorHandler() const
120 {
121 return m_xErrorHandler;
122 }
123
124 };
125}
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const css::uno::Reference< css::xml::sax::XErrorHandler > & getErrorHandler() const
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL isNamespaceAware() override
Indicates whether or not this parser is configured to understand namespaces.
virtual void SAL_CALL setErrorHandler(const css::uno::Reference< css::xml::sax::XErrorHandler > &eh) override
Specify the ErrorHandler to be used to report errors present in the XML document to be parsed.
std::recursive_mutex m_Mutex
css::uno::Reference< css::xml::sax::XEntityResolver > getEntityResolver()
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL parseURI(const OUString &uri) override
Parse the content of the given URI as an XML document and return a new DOM Document object.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setEntityResolver(const css::uno::Reference< css::xml::sax::XEntityResolver > &er) override
Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed.
virtual sal_Bool SAL_CALL isValidating() override
Indicates whether or not this parser is configured to validate XML documents.
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL newDocument() override
Obtain a new instance of a DOM Document object to build a DOM tree with.
css::uno::Reference< css::xml::sax::XErrorHandler > m_xErrorHandler
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL parse(const css::uno::Reference< css::io::XInputStream > &is) override
Parse the content of the given InputStream as an XML document and return a new DOM Document object.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::xml::sax::XEntityResolver > m_xEntityResolver
virtual css::uno::Reference< css::xml::dom::XDOMImplementation > SAL_CALL getDOMImplementation() override
Obtain an instance of a DOMImplementation object.
Definition: attr.cxx:38
::cppu::WeakImplHelper< css::xml::dom::XDocumentBuilder, css::lang::XServiceInfo > CDocumentBuilder_Base
unsigned char sal_Bool