xref: /trunk/main/oox/source/core/fragmenthandler.cxx (revision cdf0e10c)
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 #include "oox/core/fragmenthandler.hxx"
29 
30 #include "oox/core/xmlfilterbase.hxx"
31 
32 namespace oox {
33 namespace core {
34 
35 // ============================================================================
36 
37 using namespace ::com::sun::star::io;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::xml::sax;
40 
41 using ::rtl::OUString;
42 
43 // ============================================================================
44 
45 FragmentBaseData::FragmentBaseData( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) :
46     mrFilter( rFilter ),
47     maFragmentPath( rFragmentPath ),
48     mxRelations( xRelations )
49 {
50 }
51 
52 // ============================================================================
53 
54 FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) :
55     FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) )
56 {
57 }
58 
59 FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) :
60     FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, xRelations ) ) )
61 {
62 }
63 
64 FragmentHandler::~FragmentHandler()
65 {
66 }
67 
68 // com.sun.star.xml.sax.XFastDocumentHandler interface ------------------------
69 
70 void FragmentHandler::startDocument() throw( SAXException, RuntimeException )
71 {
72 }
73 
74 void FragmentHandler::endDocument() throw( SAXException, RuntimeException )
75 {
76 }
77 
78 void FragmentHandler::setDocumentLocator( const Reference< XLocator >& rxLocator ) throw( SAXException, RuntimeException )
79 {
80     implSetLocator( rxLocator );
81 }
82 
83 // com.sun.star.xml.sax.XFastContextHandler interface -------------------------
84 
85 void FragmentHandler::startFastElement( sal_Int32, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException )
86 {
87 }
88 
89 void FragmentHandler::startUnknownElement( const OUString&, const OUString&, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException )
90 {
91 }
92 
93 void FragmentHandler::endFastElement( sal_Int32 ) throw( SAXException, RuntimeException )
94 {
95 }
96 
97 void FragmentHandler::endUnknownElement( const OUString&, const OUString& ) throw( SAXException, RuntimeException )
98 {
99 }
100 
101 Reference< XFastContextHandler > FragmentHandler::createFastChildContext( sal_Int32, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException )
102 {
103     return 0;
104 }
105 
106 Reference< XFastContextHandler > FragmentHandler::createUnknownChildContext( const OUString&, const OUString&, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException )
107 {
108     return 0;
109 }
110 
111 void FragmentHandler::characters( const OUString& ) throw( SAXException, RuntimeException )
112 {
113 }
114 
115 void FragmentHandler::ignorableWhitespace( const OUString& ) throw( SAXException, RuntimeException )
116 {
117 }
118 
119 void FragmentHandler::processingInstruction( const OUString&, const OUString& ) throw( SAXException, RuntimeException )
120 {
121 }
122 
123 // XML stream handling --------------------------------------------------------
124 
125 Reference< XInputStream > FragmentHandler::openFragmentStream() const
126 {
127     return getFilter().openInputStream( getFragmentPath() );
128 }
129 
130 // binary records -------------------------------------------------------------
131 
132 const RecordInfo* FragmentHandler::getRecordInfos() const
133 {
134     // default: no support for binary records
135     return 0;
136 }
137 
138 // ============================================================================
139 
140 } // namespace core
141 } // namespace oox
142