LibreOffice Module oox (master) 1
contexthandler.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_CONTEXTHANDLER_HXX
21#define INCLUDED_OOX_CORE_CONTEXTHANDLER_HXX
22
23#include <memory>
24#include <string_view>
25
26#include <com/sun/star/uno/Any.hxx>
27#include <com/sun/star/uno/Reference.hxx>
28#include <com/sun/star/uno/Sequence.hxx>
29#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
31#include <oox/dllapi.h>
32#include <rtl/ref.hxx>
33#include <rtl/ustring.hxx>
34#include <sal/types.h>
35
36namespace com::sun::star {
37 namespace xml::sax { class XFastAttributeList; }
38 namespace xml::sax { class XLocator; }
39}
40
41namespace oox { class SequenceInputStream; }
42
43namespace oox::core {
44
45class XmlFilterBase;
46struct Relation;
47class Relations;
48
49class ContextHandler;
50typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
51
52struct FragmentBaseData;
53typedef std::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
54
55typedef ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler > ContextHandler_BASE;
56
58{
59public:
60 explicit ContextHandler( const ContextHandler& rParent );
61 virtual ~ContextHandler() override;
62
64 XmlFilterBase& getFilter() const;
66 const Relations& getRelations() const;
68 const OUString& getFragmentPath() const;
69
71 OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
73 OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
75 OUString getFragmentPathFromFirstType( std::u16string_view rType ) const;
76 OUString getFragmentPathFromFirstTypeFromOfficeDoc( std::u16string_view rType ) const;
77
78 // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
79
80 virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
81 virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
82 virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
83 virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
84 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
85 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;
86 virtual void SAL_CALL characters( const OUString& aChars ) override;
87
88 // record context interface -----------------------------------------------
89
90 virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
91 virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
92 virtual void endRecord( sal_Int32 nRecId );
93
94protected:
96 explicit ContextHandler( FragmentBaseDataRef rxBaseData );
97
98 void implSetLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator );
99
100#ifdef _MSC_VER
101 ContextHandler() {} // workaround
102#endif
103
104private:
106
107private:
109};
110
111} // namespace oox::core
112
113#endif
114
115/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Wraps a StreamDataSequence and provides convenient access functions.
FragmentBaseDataRef mxBaseData
Base data of the fragment.
ContextHandler & operator=(const ContextHandler &)=delete
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
void SvStream & rStrm
::rtl::Reference< ContextHandler > ContextHandlerRef
std::shared_ptr< FragmentBaseData > FragmentBaseDataRef
::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler > ContextHandler_BASE
Base data of a fragment.
@ Relation
OUString Name