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