LibreOffice Module oox (master)  1
fragmenthandler2.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 #ifndef INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
21 #define INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
22 
23 #include <com/sun/star/uno/Reference.hxx>
27 #include <oox/dllapi.h>
28 #include <rtl/ref.hxx>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
31 
32 namespace com::sun::star {
33  namespace xml::sax { class XFastAttributeList; }
34  namespace xml::sax { class XFastContextHandler; }
35 }
36 
37 namespace oox {
38  class AttributeList;
39  class SequenceInputStream;
40 }
41 
42 namespace oox::core {
43 
44 class XmlFilterBase;
45 
47 {
48 public:
49  explicit FragmentHandler2(
50  XmlFilterBase& rFilter,
51  const OUString& rFragmentPath,
52  bool bEnableTrimSpace = true );
53  virtual ~FragmentHandler2() override;
54 
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
59 
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(); }
63 
64  // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
65 
66  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
67  createFastChildContext(
68  sal_Int32 nElement,
69  const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
70 
71  virtual void SAL_CALL startFastElement(
72  sal_Int32 nElement,
73  const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
74 
75  virtual void SAL_CALL characters( const OUString& rChars ) final override;
76 
77  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) final override;
78 
79  // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
80 
81  virtual void SAL_CALL startDocument() override;
82 
83  virtual void SAL_CALL endDocument() override;
84 
85  // oox.core.ContextHandler interface --------------------------------------
86 
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;
90 
91  // oox.core.ContextHandler2Helper interface -------------------------------
92 
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;
97 
98  virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
99  virtual void onStartRecord( SequenceInputStream& rStrm ) override;
100  virtual void onEndRecord() override;
101 
102  // oox.core.FragmentHandler2 interface ------------------------------------
103 
104  virtual void initializeImport();
105  virtual void finalizeImport();
106 };
107 
108 typedef ::rtl::Reference< FragmentHandler2 > FragmentHandler2Ref;
109 
110 
111 } // namespace oox::core
112 
113 #endif
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::rtl::Reference< FragmentHandler2 > FragmentHandler2Ref
Provides access to attribute values of an element.
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL acquire() noexcept override
Wraps a StreamDataSequence and provides convenient access functions.
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
Helper class that provides a context stack.