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 INCLUDED_OOX_CORE_FRAGMENTHANDLER2_HXX
21 : #define INCLUDED_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 584 : 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 OUString& rFragmentPath,
51 : bool bEnableTrimSpace = true );
52 : virtual ~FragmentHandler2();
53 :
54 : // resolve ambiguity from base classes
55 133626 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { FragmentHandler::acquire(); }
56 133626 : virtual void SAL_CALL release() throw() SAL_OVERRIDE { 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, std::exception ) SAL_FINAL SAL_OVERRIDE;
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, std::exception ) SAL_FINAL SAL_OVERRIDE;
72 :
73 : virtual void SAL_CALL characters( const OUString& rChars )
74 : throw( ::com::sun::star::xml::sax::SAXException,
75 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_FINAL SAL_OVERRIDE;
76 :
77 : virtual void SAL_CALL endFastElement( sal_Int32 nElement )
78 : throw( ::com::sun::star::xml::sax::SAXException,
79 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_FINAL SAL_OVERRIDE;
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, std::exception ) SAL_OVERRIDE;
86 :
87 : virtual void SAL_CALL endDocument()
88 : throw( ::com::sun::star::xml::sax::SAXException,
89 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
90 :
91 : // oox.core.ContextHandler interface --------------------------------------
92 :
93 : virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
94 : virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
95 : virtual void endRecord( sal_Int32 nRecId ) SAL_OVERRIDE;
96 :
97 : // oox.core.ContextHandler2Helper interface -------------------------------
98 :
99 : virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
100 : virtual void onStartElement( const AttributeList& rAttribs ) SAL_OVERRIDE;
101 : virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
102 : virtual void onEndElement() SAL_OVERRIDE;
103 :
104 : virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
105 : virtual void onStartRecord( SequenceInputStream& rStrm ) SAL_OVERRIDE;
106 : virtual void onEndRecord() SAL_OVERRIDE;
107 :
108 : // oox.core.FragmentHandler2 interface ------------------------------------
109 :
110 : virtual void initializeImport();
111 : virtual void finalizeImport();
112 : };
113 :
114 : typedef ::rtl::Reference< FragmentHandler2 > FragmentHandler2Ref;
115 :
116 :
117 :
118 : } // namespace core
119 : } // namespace oox
120 :
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|