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 <vector>
24 
25 #include <com/sun/star/uno/Reference.hxx>
29 #include <oox/dllapi.h>
30 #include <rtl/ref.hxx>
31 #include <rtl/ustring.hxx>
32 #include <sal/types.h>
33 
34 namespace com::sun::star {
35  namespace xml::sax { class XFastAttributeList; }
36  namespace xml::sax { class XFastContextHandler; }
37 }
38 
39 namespace oox {
40  class AttributeList;
41  class SequenceInputStream;
42 }
43 
44 namespace oox::core {
45 
46 class XmlFilterBase;
47 
49 {
50 public:
51  explicit FragmentHandler2(
52  XmlFilterBase& rFilter,
53  const OUString& rFragmentPath,
54  bool bEnableTrimSpace = true );
55  virtual ~FragmentHandler2() override;
56 
57  FragmentHandler2(FragmentHandler2 const &) = default;
58  FragmentHandler2(FragmentHandler2 &&) = default;
59  FragmentHandler2 & operator =(FragmentHandler2 const &) = delete; // due to FragmentHandler
60  FragmentHandler2 & operator =(FragmentHandler2 &&) = delete; // due to FragmentHandler
61 
62  // resolve ambiguity from base classes
63  virtual void SAL_CALL acquire() noexcept override { FragmentHandler::acquire(); }
64  virtual void SAL_CALL release() noexcept override { FragmentHandler::release(); }
65 
66  // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
67 
68  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
69  createFastChildContext(
70  sal_Int32 nElement,
71  const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
72 
73  virtual void SAL_CALL startFastElement(
74  sal_Int32 nElement,
75  const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs ) final override;
76 
77  virtual void SAL_CALL characters( const OUString& rChars ) final override;
78 
79  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) final override;
80 
81  // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
82 
83  virtual void SAL_CALL startDocument() override;
84 
85  virtual void SAL_CALL endDocument() override;
86 
87  // oox.core.ContextHandler interface --------------------------------------
88 
89  virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
90  virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
91  virtual void endRecord( sal_Int32 nRecId ) override;
92 
93  // oox.core.ContextHandler2Helper interface -------------------------------
94 
95  virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
96  virtual void onStartElement( const AttributeList& rAttribs ) override;
97  virtual void onCharacters( const OUString& rChars ) override;
98  virtual void onEndElement() override;
99 
100  virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
101  virtual void onStartRecord( SequenceInputStream& rStrm ) override;
102  virtual void onEndRecord() override;
103 
104  // oox.core.FragmentHandler2 interface ------------------------------------
105 
106  virtual void initializeImport();
107  virtual void finalizeImport();
108 };
109 
110 typedef ::rtl::Reference< FragmentHandler2 > FragmentHandler2Ref;
111 
112 
113 } // namespace oox::core
114 
115 #endif
116 
117 /* 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.