1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef OOX_CORE_FRAGMENTHANDLER2_HXX
25 #define OOX_CORE_FRAGMENTHANDLER2_HXX
26 
27 #include "oox/core/contexthandler2.hxx"
28 #include "oox/core/fragmenthandler.hxx"
29 
30 namespace oox {
31 namespace core {
32 
33 // ============================================================================
34 
35 class FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
36 {
37 public:
38     explicit            FragmentHandler2(
39                             XmlFilterBase& rFilter,
40                             const ::rtl::OUString& rFragmentPath,
41                             bool bEnableTrimSpace = true );
42     virtual             ~FragmentHandler2();
43 
44     // resolve ambiguity from base classes
acquire()45     virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
release()46     virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
47 
48     // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
49 
50     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
51                         createFastChildContext(
52                             sal_Int32 nElement,
53                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
54                             throw(  ::com::sun::star::xml::sax::SAXException,
55                                     ::com::sun::star::uno::RuntimeException );
56 
57     virtual void SAL_CALL startFastElement(
58                             sal_Int32 nElement,
59                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
60                             throw(  ::com::sun::star::xml::sax::SAXException,
61                                     ::com::sun::star::uno::RuntimeException );
62 
63     virtual void SAL_CALL characters( const ::rtl::OUString& rChars )
64                             throw(  ::com::sun::star::xml::sax::SAXException,
65                                     ::com::sun::star::uno::RuntimeException );
66 
67     virtual void SAL_CALL endFastElement( sal_Int32 nElement )
68                             throw(  ::com::sun::star::xml::sax::SAXException,
69                                     ::com::sun::star::uno::RuntimeException );
70 
71     // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
72 
73     virtual void SAL_CALL startDocument()
74                             throw(  ::com::sun::star::xml::sax::SAXException,
75                                     ::com::sun::star::uno::RuntimeException );
76 
77     virtual void SAL_CALL endDocument()
78                             throw(  ::com::sun::star::xml::sax::SAXException,
79                                     ::com::sun::star::uno::RuntimeException );
80 
81     // oox.core.ContextHandler interface --------------------------------------
82 
83     virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
84     virtual void        startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
85     virtual void        endRecord( sal_Int32 nRecId );
86 
87     // oox.core.ContextHandler2Helper interface -------------------------------
88 
89     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
90     virtual void        onStartElement( const AttributeList& rAttribs );
91     virtual void        onCharacters( const ::rtl::OUString& rChars );
92     virtual void        onEndElement();
93 
94     virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
95     virtual void        onStartRecord( SequenceInputStream& rStrm );
96     virtual void        onEndRecord();
97 
98     // oox.core.FragmentHandler2 interface ------------------------------------
99 
100     virtual void        initializeImport();
101     virtual void        finalizeImport();
102 };
103 
104 // ============================================================================
105 
106 } // namespace core
107 } // namespace oox
108 
109 #endif
110