1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_OOX_CORE_FRAGMENTHANDLER2_HXX
21 #define INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <oox/core/contexthandler.hxx>
25 #include <oox/core/contexthandler2.hxx>
26 #include <oox/core/fragmenthandler.hxx>
27 #include <oox/dllapi.h>
28 #include <rtl/ref.hxx>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
32 namespace com::sun::star
{
33 namespace xml::sax
{ class XFastAttributeList
; }
34 namespace xml::sax
{ class XFastContextHandler
; }
39 class SequenceInputStream
;
46 class OOX_DLLPUBLIC FragmentHandler2
: public FragmentHandler
, public ContextHandler2Helper
49 explicit FragmentHandler2(
50 XmlFilterBase
& rFilter
,
51 const OUString
& rFragmentPath
,
52 bool bEnableTrimSpace
= true );
53 virtual ~FragmentHandler2() override
;
55 FragmentHandler2(FragmentHandler2
const &) = default;
56 FragmentHandler2(FragmentHandler2
&&) = default;
57 FragmentHandler2
& operator =(FragmentHandler2
const &) = delete; // due to FragmentHandler
58 FragmentHandler2
& operator =(FragmentHandler2
&&) = delete; // due to FragmentHandler
60 // resolve ambiguity from base classes
61 virtual void SAL_CALL
acquire() noexcept override
{ FragmentHandler::acquire(); }
62 virtual void SAL_CALL
release() noexcept override
{ FragmentHandler::release(); }
64 // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
66 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
67 createFastChildContext(
69 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& rxAttribs
) final override
;
71 virtual void SAL_CALL
startFastElement(
73 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& rxAttribs
) final override
;
75 virtual void SAL_CALL
characters( const OUString
& rChars
) final override
;
77 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) final override
;
79 // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
81 virtual void SAL_CALL
startDocument() override
;
83 virtual void SAL_CALL
endDocument() override
;
85 // oox.core.ContextHandler interface --------------------------------------
87 virtual ContextHandlerRef
createRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
88 virtual void startRecord( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
89 virtual void endRecord( sal_Int32 nRecId
) override
;
91 // oox.core.ContextHandler2Helper interface -------------------------------
93 virtual ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
94 virtual void onStartElement( const AttributeList
& rAttribs
) override
;
95 virtual void onCharacters( const OUString
& rChars
) override
;
96 virtual void onEndElement() override
;
98 virtual ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
99 virtual void onStartRecord( SequenceInputStream
& rStrm
) override
;
100 virtual void onEndRecord() override
;
102 // oox.core.FragmentHandler2 interface ------------------------------------
104 virtual void initializeImport();
105 virtual void finalizeImport();
108 typedef ::rtl::Reference
< FragmentHandler2
> FragmentHandler2Ref
;
111 } // namespace oox::core
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */