Bump version to 6.4.0.12
[LibreOffice.git] / unoxml / source / dom / saxbuilder.hxx
blobe20b5ccb95a5d318f9f82431dd4a41a8380a2e17
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 INCLUDED_UNOXML_SOURCE_DOM_SAXBUILDER_HXX
21 #define INCLUDED_UNOXML_SOURCE_DOM_SAXBUILDER_HXX
23 #include <stack>
24 #include <map>
26 #include <sal/types.h>
27 #include <osl/mutex.hxx>
28 #include <cppuhelper/implbase.hxx>
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/uno/Sequence.h>
32 #include <com/sun/star/uno/XInterface.hpp>
33 #include <com/sun/star/uno/Exception.hpp>
34 #include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
35 #include <com/sun/star/xml/dom/SAXDocumentBuilderState.hpp>
36 #include <com/sun/star/xml/dom/XDocument.hpp>
37 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
38 #include <com/sun/star/xml/sax/XLocator.hpp>
39 #include <com/sun/star/xml/sax/XAttributeList.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 namespace DOM
46 class CSAXDocumentBuilder
47 : public ::cppu::WeakImplHelper< css::xml::dom::XSAXDocumentBuilder2, css::lang::XServiceInfo >
50 private:
51 ::osl::Mutex m_Mutex;
52 const css::uno::Reference< css::lang::XMultiServiceFactory > m_aServiceManager;
54 css::xml::dom::SAXDocumentBuilderState m_aState;
55 std::stack< css::uno::Reference< css::xml::dom::XNode > > m_aNodeStack;
57 css::uno::Reference< css::xml::dom::XDocument > m_aDocument;
58 css::uno::Reference< css::xml::dom::XDocumentFragment > m_aFragment;
61 public:
62 // static helpers for service info and component management
63 static OUString _getImplementationName();
64 static css::uno::Sequence< OUString > _getSupportedServiceNames();
65 static css::uno::Reference< XInterface > _getInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr);
67 explicit CSAXDocumentBuilder(const css::uno::Reference< css::lang::XMultiServiceFactory >& mgr);
68 static void setElementFastAttributes(const css::uno::Reference< css::xml::dom::XElement >& aElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs);
71 // XServiceInfo
72 virtual OUString SAL_CALL getImplementationName() override;
73 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
74 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
76 // XFastDocumentHandler
77 virtual void SAL_CALL startDocument() override;
78 virtual void SAL_CALL endDocument() override;
79 virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
80 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override;
82 // XFastContextHandler
83 virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
84 virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
85 virtual void SAL_CALL endFastElement( sal_Int32 Element ) override;
86 virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
87 virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
88 virtual css::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
89 virtual void SAL_CALL characters( const OUString& aChars ) override;
91 // XSAXDocumentBuilder
92 virtual css::xml::dom::SAXDocumentBuilderState SAL_CALL getState() override;
93 virtual void SAL_CALL reset() override;
94 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getDocument() override;
95 virtual css::uno::Reference< css::xml::dom::XDocumentFragment > SAL_CALL getDocumentFragment() override;
96 virtual void SAL_CALL startDocumentFragment(const css::uno::Reference< css::xml::dom::XDocument >& ownerDoc) override;
97 virtual void SAL_CALL endDocumentFragment() override;
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */