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
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <oox/core/contexthandler.hxx>
27 #include <oox/core/contexthandler2.hxx>
28 #include <oox/core/fragmenthandler.hxx>
29 #include <oox/dllapi.h>
30 #include <rtl/ref.hxx>
31 #include <rtl/ustring.hxx>
32 #include <sal/types.h>
34 namespace com::sun::star
{
35 namespace xml::sax
{ class XFastAttributeList
; }
36 namespace xml::sax
{ class XFastContextHandler
; }
41 class SequenceInputStream
;
48 class OOX_DLLPUBLIC FragmentHandler2
: public FragmentHandler
, public ContextHandler2Helper
56 ::std::vector
<MCE_STATE
> aMceState
;
58 bool prepareMceContext( sal_Int32 nElement
, const AttributeList
& rAttribs
);
62 explicit FragmentHandler2(
63 XmlFilterBase
& rFilter
,
64 const OUString
& rFragmentPath
,
65 bool bEnableTrimSpace
= true );
66 virtual ~FragmentHandler2() override
;
68 FragmentHandler2(FragmentHandler2
const &) = default;
69 FragmentHandler2(FragmentHandler2
&&) = default;
70 FragmentHandler2
& operator =(FragmentHandler2
const &) = delete; // due to FragmentHandler
71 FragmentHandler2
& operator =(FragmentHandler2
&&) = delete; // due to FragmentHandler
73 // resolve ambiguity from base classes
74 virtual void SAL_CALL
acquire() noexcept override
{ FragmentHandler::acquire(); }
75 virtual void SAL_CALL
release() noexcept override
{ FragmentHandler::release(); }
77 // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
79 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
80 createFastChildContext(
82 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& rxAttribs
) final override
;
84 virtual void SAL_CALL
startFastElement(
86 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& rxAttribs
) final override
;
88 virtual void SAL_CALL
characters( const OUString
& rChars
) final override
;
90 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) final override
;
92 // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
94 virtual void SAL_CALL
startDocument() override
;
96 virtual void SAL_CALL
endDocument() override
;
98 // oox.core.ContextHandler interface --------------------------------------
100 virtual ContextHandlerRef
createRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
101 virtual void startRecord( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
102 virtual void endRecord( sal_Int32 nRecId
) override
;
104 // oox.core.ContextHandler2Helper interface -------------------------------
106 virtual ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
107 virtual void onStartElement( const AttributeList
& rAttribs
) override
;
108 virtual void onCharacters( const OUString
& rChars
) override
;
109 virtual void onEndElement() override
;
111 virtual ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
112 virtual void onStartRecord( SequenceInputStream
& rStrm
) override
;
113 virtual void onEndRecord() override
;
115 // oox.core.FragmentHandler2 interface ------------------------------------
117 virtual void initializeImport();
118 virtual void finalizeImport();
121 typedef ::rtl::Reference
< FragmentHandler2
> FragmentHandler2Ref
;
124 } // namespace oox::core
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */