1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fragmenthandler.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/core/fragmenthandler.hxx"
32 #include "oox/core/xmlfilterbase.hxx"
34 using ::rtl::OUString
;
35 using ::com::sun::star::uno::Reference
;
36 using ::com::sun::star::uno::RuntimeException
;
37 using ::com::sun::star::io::XInputStream
;
38 using ::com::sun::star::xml::sax::SAXException
;
39 using ::com::sun::star::xml::sax::XFastAttributeList
;
40 using ::com::sun::star::xml::sax::XFastContextHandler
;
41 using ::com::sun::star::xml::sax::XLocator
;
46 // ============================================================================
48 FragmentBaseData::FragmentBaseData( XmlFilterBase
& rFilter
, const OUString
& rFragmentPath
, RelationsRef xRelations
) :
50 maFragmentPath( rFragmentPath
),
51 mxRelations( xRelations
)
55 // ============================================================================
57 FragmentHandler::FragmentHandler( XmlFilterBase
& rFilter
, const OUString
& rFragmentPath
) :
58 FragmentHandlerImplBase( FragmentBaseDataRef( new FragmentBaseData( rFilter
, rFragmentPath
, rFilter
.importRelations( rFragmentPath
) ) ) )
62 FragmentHandler::FragmentHandler( XmlFilterBase
& rFilter
, const OUString
& rFragmentPath
, RelationsRef xRelations
) :
63 FragmentHandlerImplBase( FragmentBaseDataRef( new FragmentBaseData( rFilter
, rFragmentPath
, xRelations
) ) )
67 FragmentHandler::~FragmentHandler()
71 // com.sun.star.xml.sax.XFastDocumentHandler interface ------------------------
73 void FragmentHandler::startDocument() throw( SAXException
, RuntimeException
)
77 void FragmentHandler::endDocument() throw( SAXException
, RuntimeException
)
81 void FragmentHandler::setDocumentLocator( const Reference
< XLocator
>& rxLocator
) throw( SAXException
, RuntimeException
)
83 implSetLocator( rxLocator
);
86 // com.sun.star.xml.sax.XFastContextHandler interface -------------------------
88 void FragmentHandler::startFastElement( sal_Int32
, const Reference
< XFastAttributeList
>& ) throw( SAXException
, RuntimeException
)
92 void FragmentHandler::startUnknownElement( const OUString
&, const OUString
&, const Reference
< XFastAttributeList
>& ) throw( SAXException
, RuntimeException
)
96 void FragmentHandler::endFastElement( sal_Int32
) throw( SAXException
, RuntimeException
)
100 void FragmentHandler::endUnknownElement( const OUString
&, const OUString
& ) throw( SAXException
, RuntimeException
)
104 Reference
< XFastContextHandler
> FragmentHandler::createFastChildContext( sal_Int32
, const Reference
< XFastAttributeList
>& ) throw( SAXException
, RuntimeException
)
109 Reference
< XFastContextHandler
> FragmentHandler::createUnknownChildContext( const OUString
&, const OUString
&, const Reference
< XFastAttributeList
>& ) throw( SAXException
, RuntimeException
)
114 void FragmentHandler::characters( const OUString
& ) throw( SAXException
, RuntimeException
)
118 void FragmentHandler::ignorableWhitespace( const OUString
& ) throw( SAXException
, RuntimeException
)
122 void FragmentHandler::processingInstruction( const OUString
&, const OUString
& ) throw( SAXException
, RuntimeException
)
126 // XML stream handling --------------------------------------------------------
128 Reference
< XInputStream
> FragmentHandler::openFragmentStream() const
130 return getFilter().openInputStream( getFragmentPath() );
133 // binary records -------------------------------------------------------------
135 const RecordInfo
* FragmentHandler::getRecordInfos() const
137 // default: no support for binary records
141 // ============================================================================