LibreOffice Module oox (master)  1
fragmenthandler.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_FRAGMENTHANDLER_HXX
21 #define INCLUDED_OOX_CORE_FRAGMENTHANDLER_HXX
22 
23 #include <com/sun/star/uno/Any.hxx>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
27 #include <cppuhelper/implbase.hxx>
29 #include <oox/core/relations.hxx>
30 #include <oox/dllapi.h>
31 #include <rtl/ref.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
34 
35 namespace com::sun::star {
36  namespace io { class XInputStream; }
37  namespace xml::sax { class XFastAttributeList; }
38  namespace xml::sax { class XFastContextHandler; }
39  namespace xml::sax { class XLocator; }
40 }
41 
42 namespace oox::core {
43 
44 class XmlFilterBase;
45 
52 {
54  const OUString maFragmentPath;
55  css::uno::Reference< css::xml::sax::XLocator >
58 
59  explicit FragmentBaseData(
60  XmlFilterBase& rFilter,
61  const OUString& rFragmentPath,
62  RelationsRef const & xRelations );
63 };
64 
65 
76 struct RecordInfo
77 {
78  sal_Int32 mnStartRecId;
79  sal_Int32 mnEndRecId;
80 };
81 
82 
83 typedef ::cppu::ImplInheritanceHelper< ContextHandler, css::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
84 
85 class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
86 {
87 public:
88  explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
89  virtual ~FragmentHandler() override;
90 
91  FragmentHandler(FragmentHandler const &) = default;
92  FragmentHandler(FragmentHandler &&) = default;
93  FragmentHandler & operator =(FragmentHandler const &) = delete; // due to ContextHandler
94  FragmentHandler & operator =(FragmentHandler &&) = delete; // due to ContextHandler
95 
97  css::uno::Reference< css::xml::sax::XFastContextHandler >
98  getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
99 
100  // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
101 
102  virtual void SAL_CALL startDocument() override;
103  virtual void SAL_CALL endDocument() override;
104  virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
105  virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator ) override;
106 
107  // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
108 
109  virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
110  virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
111  virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
112  virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
113  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
114  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
115  virtual void SAL_CALL characters( const OUString& aChars ) override;
116 
117  // XML stream handling ----------------------------------------------------
118 
121  virtual css::uno::Reference< css::io::XInputStream >
122  openFragmentStream() const;
123 
124  // binary records ---------------------------------------------------------
125 
126  virtual const RecordInfo* getRecordInfos() const;
127 
128 protected:
129  explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
130 };
131 
132 typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
133 
134 
135 } // namespace oox::core
136 
137 #endif
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Relations > RelationsRef
Definition: relations.hxx:63
Describes record identifiers used to create contexts in a binary stream.
exports com.sun.star. io
sal_Int32 mnEndRecId
Record identifier for context end, -1 = no record.
css::uno::Reference< css::xml::sax::XFastContextHandler > getFastContextHandler()
Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context.
sal_Int32 mnStartRecId
Record identifier for context start.
::cppu::ImplInheritanceHelper< ContextHandler, css::xml::sax::XFastDocumentHandler > FragmentHandler_BASE
FragmentBaseData(XmlFilterBase &rFilter, const OUString &rFragmentPath, RelationsRef const &xRelations)
css::uno::Reference< css::xml::sax::XLocator > mxLocator
Base data of a fragment.
::rtl::Reference< FragmentHandler > FragmentHandlerRef
#define OOX_DLLPUBLIC
Definition: dllapi.h:28