LibreOffice Module oox (master) 1
fragmenthandler2.cxx
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#include <sal/config.h>
21
22#include <com/sun/star/frame/XModel.hpp>
26#include <oox/token/namespaces.hxx>
27
28namespace oox::core {
29
30using namespace ::com::sun::star;
31using namespace ::com::sun::star::uno;
32using namespace ::com::sun::star::xml::sax;
33
34FragmentHandler2::FragmentHandler2( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEnableTrimSpace ) :
35 FragmentHandler( rFilter, rFragmentPath ),
36 ContextHandler2Helper( bEnableTrimSpace, rFilter )
37{
38}
39
41{
42}
43
44// com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
45
47{
49}
50
52{
54}
55
56// com.sun.star.xml.sax.XFastContextHandler interface -------------------------
57
58Reference< XFastContextHandler > SAL_CALL FragmentHandler2::createFastChildContext(
59 sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
60{
61 if( getNamespace( nElement ) == NMSP_mce ) // TODO for checking 'Ignorable'
62 {
63 if( prepareMceContext( nElement, AttributeList( rxAttribs ) ) )
64 return getFastContextHandler();
65 return nullptr;
66 }
67 return implCreateChildContext( nElement, rxAttribs );
68}
69
71 sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
72{
73 implStartElement( nElement, rxAttribs );
74}
75
76void SAL_CALL FragmentHandler2::characters( const OUString& rChars )
77{
78 implCharacters( rChars );
79}
80
81void SAL_CALL FragmentHandler2::endFastElement( sal_Int32 nElement )
82{
83 /* If MCE */
84 switch( nElement )
85 {
86 case MCE_TOKEN( AlternateContent ):
87 removeMCEState();
88 break;
89 }
90
91 implEndElement( nElement );
92}
93
94// oox.core.ContextHandler interface ------------------------------------------
95
97{
98 return implCreateRecordContext( nRecId, rStrm );
99}
100
102{
103 implStartRecord( nRecId, rStrm );
104}
105
106void FragmentHandler2::endRecord( sal_Int32 nRecId )
107{
108 implEndRecord( nRecId );
109}
110
111// oox.core.ContextHandler2Helper interface -----------------------------------
112
114{
115 return nullptr;
116}
117
119{
120}
121
122void FragmentHandler2::onCharacters( const OUString& )
123{
124}
125
127{
128}
129
131{
132 return nullptr;
133}
134
136{
137}
138
140{
141}
142
143// oox.core.FragmentHandler2 interface ----------------------------------------
144
146{
147}
148
150{
151}
152
153} // namespace oox::core
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides access to attribute values of an element.
Wraps a StreamDataSequence and provides convenient access functions.
virtual void onStartElement(const AttributeList &rAttribs) override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &rxAttribs) final override
virtual void startRecord(sal_Int32 nRecId, SequenceInputStream &rStrm) override
virtual void SAL_CALL characters(const OUString &rChars) final override
virtual void SAL_CALL endFastElement(sal_Int32 nElement) final override
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &rxAttribs) final override
FragmentHandler2(XmlFilterBase &rFilter, const OUString &rFragmentPath, bool bEnableTrimSpace=true)
virtual void onEndRecord() override
virtual void SAL_CALL endDocument() override
virtual ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
virtual ContextHandlerRef createRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
virtual ~FragmentHandler2() override
virtual void endRecord(sal_Int32 nRecId) override
virtual ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
virtual void onStartRecord(SequenceInputStream &rStrm) override
virtual void onEndElement() override
virtual void onCharacters(const OUString &rChars) override
virtual void SAL_CALL startDocument() override
css::uno::Reference< css::xml::sax::XFastContextHandler > getFastContextHandler()
Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context.
void SvStream & rStrm