Branch data Line data Source code
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 OOX_CORE_FRAGMENTHANDLER2_HXX
21 : : #define OOX_CORE_FRAGMENTHANDLER2_HXX
22 : :
23 : : #include "oox/core/contexthandler2.hxx"
24 : : #include "oox/core/fragmenthandler.hxx"
25 : : #include <vector>
26 : : #include "oox/dllapi.h"
27 : :
28 : : namespace oox {
29 : : namespace core {
30 : :
31 : : // ============================================================================
32 : :
33 [ + - ][ + - ]: 18 : class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
34 : : {
35 : : protected:
36 : : enum MCE_STATE
37 : : {
38 : : MCE_UNUSED,
39 : : MCE_STARTED,
40 : : MCE_FOUND_CHOICE
41 : : };
42 : : ::std::vector<MCE_STATE> aMceState;
43 : :
44 : : bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
45 : :
46 : :
47 : : public:
48 : : explicit FragmentHandler2(
49 : : XmlFilterBase& rFilter,
50 : : const ::rtl::OUString& rFragmentPath,
51 : : bool bEnableTrimSpace = true );
52 : : virtual ~FragmentHandler2();
53 : :
54 : : // resolve ambiguity from base classes
55 : 10710 : virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
56 : 10710 : virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
57 : :
58 : : // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
59 : :
60 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
61 : : createFastChildContext(
62 : : sal_Int32 nElement,
63 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
64 : : throw( ::com::sun::star::xml::sax::SAXException,
65 : : ::com::sun::star::uno::RuntimeException );
66 : :
67 : : virtual void SAL_CALL startFastElement(
68 : : sal_Int32 nElement,
69 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
70 : : throw( ::com::sun::star::xml::sax::SAXException,
71 : : ::com::sun::star::uno::RuntimeException );
72 : :
73 : : virtual void SAL_CALL characters( const ::rtl::OUString& rChars )
74 : : throw( ::com::sun::star::xml::sax::SAXException,
75 : : ::com::sun::star::uno::RuntimeException );
76 : :
77 : : virtual void SAL_CALL endFastElement( sal_Int32 nElement )
78 : : throw( ::com::sun::star::xml::sax::SAXException,
79 : : ::com::sun::star::uno::RuntimeException );
80 : :
81 : : // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
82 : :
83 : : virtual void SAL_CALL startDocument()
84 : : throw( ::com::sun::star::xml::sax::SAXException,
85 : : ::com::sun::star::uno::RuntimeException );
86 : :
87 : : virtual void SAL_CALL endDocument()
88 : : throw( ::com::sun::star::xml::sax::SAXException,
89 : : ::com::sun::star::uno::RuntimeException );
90 : :
91 : : // oox.core.ContextHandler interface --------------------------------------
92 : :
93 : : virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
94 : : virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
95 : : virtual void endRecord( sal_Int32 nRecId );
96 : :
97 : : // oox.core.ContextHandler2Helper interface -------------------------------
98 : :
99 : : virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
100 : : virtual void onStartElement( const AttributeList& rAttribs );
101 : : virtual void onCharacters( const ::rtl::OUString& rChars );
102 : : virtual void onEndElement();
103 : :
104 : : virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
105 : : virtual void onStartRecord( SequenceInputStream& rStrm );
106 : : virtual void onEndRecord();
107 : :
108 : : // oox.core.FragmentHandler2 interface ------------------------------------
109 : :
110 : : virtual void initializeImport();
111 : : virtual void finalizeImport();
112 : : };
113 : :
114 : : // ============================================================================
115 : :
116 : : } // namespace core
117 : : } // namespace oox
118 : :
119 : : #endif
120 : :
121 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|