1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <oox/core/fragmenthandler2.hxx>
24 #include <oox/core/xmlfilterbase.hxx>
25 #include <oox/helper/attributelist.hxx>
26 #include <oox/token/namespaces.hxx>
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::xml::sax
;
34 FragmentHandler2::FragmentHandler2( XmlFilterBase
& rFilter
, const OUString
& rFragmentPath
, bool bEnableTrimSpace
) :
35 FragmentHandler( rFilter
, rFragmentPath
),
36 ContextHandler2Helper( bEnableTrimSpace
)
40 FragmentHandler2::~FragmentHandler2()
44 // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
46 void SAL_CALL
FragmentHandler2::startDocument()
51 void SAL_CALL
FragmentHandler2::endDocument()
56 // com.sun.star.xml.sax.XFastContextHandler interface -------------------------
58 Reference
< XFastContextHandler
> SAL_CALL
FragmentHandler2::createFastChildContext(
59 sal_Int32 nElement
, const Reference
< XFastAttributeList
>& rxAttribs
)
61 if( getNamespace( nElement
) == NMSP_mce
) // TODO for checking 'Ignorable'
63 if( prepareMceContext( nElement
, AttributeList( rxAttribs
) ) )
64 return getFastContextHandler();
67 return implCreateChildContext( nElement
, rxAttribs
);
70 void SAL_CALL
FragmentHandler2::startFastElement(
71 sal_Int32 nElement
, const Reference
< XFastAttributeList
>& rxAttribs
)
73 implStartElement( nElement
, rxAttribs
);
76 void SAL_CALL
FragmentHandler2::characters( const OUString
& rChars
)
78 implCharacters( rChars
);
81 void SAL_CALL
FragmentHandler2::endFastElement( sal_Int32 nElement
)
86 case MCE_TOKEN( AlternateContent
):
91 implEndElement( nElement
);
94 // oox.core.ContextHandler interface ------------------------------------------
96 ContextHandlerRef
FragmentHandler2::createRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
)
98 return implCreateRecordContext( nRecId
, rStrm
);
101 void FragmentHandler2::startRecord( sal_Int32 nRecId
, SequenceInputStream
& rStrm
)
103 implStartRecord( nRecId
, rStrm
);
106 void FragmentHandler2::endRecord( sal_Int32 nRecId
)
108 implEndRecord( nRecId
);
111 // oox.core.ContextHandler2Helper interface -----------------------------------
113 ContextHandlerRef
FragmentHandler2::onCreateContext( sal_Int32
, const AttributeList
& )
118 void FragmentHandler2::onStartElement( const AttributeList
& )
122 void FragmentHandler2::onCharacters( const OUString
& )
126 void FragmentHandler2::onEndElement()
130 ContextHandlerRef
FragmentHandler2::onCreateRecordContext( sal_Int32
, SequenceInputStream
& )
135 void FragmentHandler2::onStartRecord( SequenceInputStream
& )
139 void FragmentHandler2::onEndRecord()
143 // oox.core.FragmentHandler2 interface ----------------------------------------
145 void FragmentHandler2::initializeImport()
149 void FragmentHandler2::finalizeImport()
153 } // namespace oox::core
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */