1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef OOX_CORE_FRAGMENTHANDLER2_HXX
29 #define OOX_CORE_FRAGMENTHANDLER2_HXX
30 
31 #include "oox/core/contexthandler2.hxx"
32 #include "oox/core/fragmenthandler.hxx"
33 
34 namespace oox {
35 namespace core {
36 
37 // ============================================================================
38 
39 class FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
40 {
41 public:
42     explicit            FragmentHandler2(
43                             XmlFilterBase& rFilter,
44                             const ::rtl::OUString& rFragmentPath,
45                             bool bEnableTrimSpace = true );
46     virtual             ~FragmentHandler2();
47 
48     // resolve ambiguity from base classes
49     virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
50     virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
51 
52     // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
53 
54     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
55                         createFastChildContext(
56                             sal_Int32 nElement,
57                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
58                             throw(  ::com::sun::star::xml::sax::SAXException,
59                                     ::com::sun::star::uno::RuntimeException );
60 
61     virtual void SAL_CALL startFastElement(
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 characters( const ::rtl::OUString& rChars )
68                             throw(  ::com::sun::star::xml::sax::SAXException,
69                                     ::com::sun::star::uno::RuntimeException );
70 
71     virtual void SAL_CALL endFastElement( sal_Int32 nElement )
72                             throw(  ::com::sun::star::xml::sax::SAXException,
73                                     ::com::sun::star::uno::RuntimeException );
74 
75     // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
76 
77     virtual void SAL_CALL startDocument()
78                             throw(  ::com::sun::star::xml::sax::SAXException,
79                                     ::com::sun::star::uno::RuntimeException );
80 
81     virtual void SAL_CALL endDocument()
82                             throw(  ::com::sun::star::xml::sax::SAXException,
83                                     ::com::sun::star::uno::RuntimeException );
84 
85     // oox.core.ContextHandler interface --------------------------------------
86 
87     virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
88     virtual void        startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
89     virtual void        endRecord( sal_Int32 nRecId );
90 
91     // oox.core.ContextHandler2Helper interface -------------------------------
92 
93     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
94     virtual void        onStartElement( const AttributeList& rAttribs );
95     virtual void        onCharacters( const ::rtl::OUString& rChars );
96     virtual void        onEndElement();
97 
98     virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
99     virtual void        onStartRecord( SequenceInputStream& rStrm );
100     virtual void        onEndRecord();
101 
102     // oox.core.FragmentHandler2 interface ------------------------------------
103 
104     virtual void        initializeImport();
105     virtual void        finalizeImport();
106 };
107 
108 // ============================================================================
109 
110 } // namespace core
111 } // namespace oox
112 
113 #endif
114