1*ca5ec200SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ca5ec200SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ca5ec200SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ca5ec200SAndrew Rist * distributed with this work for additional information 6*ca5ec200SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ca5ec200SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ca5ec200SAndrew Rist * "License"); you may not use this file except in compliance 9*ca5ec200SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*ca5ec200SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*ca5ec200SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ca5ec200SAndrew Rist * software distributed under the License is distributed on an 15*ca5ec200SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ca5ec200SAndrew Rist * KIND, either express or implied. See the License for the 17*ca5ec200SAndrew Rist * specific language governing permissions and limitations 18*ca5ec200SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*ca5ec200SAndrew Rist *************************************************************/ 21*ca5ec200SAndrew Rist 22*ca5ec200SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "oox/core/fragmenthandler.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir namespace oox { 29cdf0e10cSrcweir namespace core { 30cdf0e10cSrcweir 31cdf0e10cSrcweir // ============================================================================ 32cdf0e10cSrcweir 33cdf0e10cSrcweir using namespace ::com::sun::star::io; 34cdf0e10cSrcweir using namespace ::com::sun::star::uno; 35cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax; 36cdf0e10cSrcweir 37cdf0e10cSrcweir using ::rtl::OUString; 38cdf0e10cSrcweir 39cdf0e10cSrcweir // ============================================================================ 40cdf0e10cSrcweir 41cdf0e10cSrcweir FragmentBaseData::FragmentBaseData( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) : 42cdf0e10cSrcweir mrFilter( rFilter ), 43cdf0e10cSrcweir maFragmentPath( rFragmentPath ), 44cdf0e10cSrcweir mxRelations( xRelations ) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir // ============================================================================ 49cdf0e10cSrcweir 50cdf0e10cSrcweir FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) : 51cdf0e10cSrcweir FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) ) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) : 56cdf0e10cSrcweir FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, xRelations ) ) ) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir FragmentHandler::~FragmentHandler() 61cdf0e10cSrcweir { 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir // com.sun.star.xml.sax.XFastDocumentHandler interface ------------------------ 65cdf0e10cSrcweir 66cdf0e10cSrcweir void FragmentHandler::startDocument() throw( SAXException, RuntimeException ) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir void FragmentHandler::endDocument() throw( SAXException, RuntimeException ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir void FragmentHandler::setDocumentLocator( const Reference< XLocator >& rxLocator ) throw( SAXException, RuntimeException ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir implSetLocator( rxLocator ); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir // com.sun.star.xml.sax.XFastContextHandler interface ------------------------- 80cdf0e10cSrcweir 81cdf0e10cSrcweir void FragmentHandler::startFastElement( sal_Int32, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir void FragmentHandler::startUnknownElement( const OUString&, const OUString&, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir void FragmentHandler::endFastElement( sal_Int32 ) throw( SAXException, RuntimeException ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir void FragmentHandler::endUnknownElement( const OUString&, const OUString& ) throw( SAXException, RuntimeException ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir Reference< XFastContextHandler > FragmentHandler::createFastChildContext( sal_Int32, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir return 0; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir Reference< XFastContextHandler > FragmentHandler::createUnknownChildContext( const OUString&, const OUString&, const Reference< XFastAttributeList >& ) throw( SAXException, RuntimeException ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir return 0; 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir void FragmentHandler::characters( const OUString& ) throw( SAXException, RuntimeException ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir void FragmentHandler::ignorableWhitespace( const OUString& ) throw( SAXException, RuntimeException ) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir void FragmentHandler::processingInstruction( const OUString&, const OUString& ) throw( SAXException, RuntimeException ) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir // XML stream handling -------------------------------------------------------- 120cdf0e10cSrcweir 121cdf0e10cSrcweir Reference< XInputStream > FragmentHandler::openFragmentStream() const 122cdf0e10cSrcweir { 123cdf0e10cSrcweir return getFilter().openInputStream( getFragmentPath() ); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir // binary records ------------------------------------------------------------- 127cdf0e10cSrcweir 128cdf0e10cSrcweir const RecordInfo* FragmentHandler::getRecordInfos() const 129cdf0e10cSrcweir { 130cdf0e10cSrcweir // default: no support for binary records 131cdf0e10cSrcweir return 0; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir // ============================================================================ 135cdf0e10cSrcweir 136cdf0e10cSrcweir } // namespace core 137cdf0e10cSrcweir } // namespace oox 138