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 #ifndef INCLUDED_OOXML_STREAM_IMPL_HXX 24 #define INCLUDED_OOXML_STREAM_IMPL_HXX 25 26 #include <ooxml/OOXMLDocument.hxx> 27 #include <comphelper/storagehelper.hxx> 28 #include <com/sun/star/embed/XRelationshipAccess.hpp> 29 #include <com/sun/star/io/XStream.hpp> 30 31 namespace writerfilter { 32 namespace ooxml 33 { 34 35 using namespace com::sun::star; 36 37 class OOXMLStreamImpl : public OOXMLStream 38 { 39 void init(); 40 41 uno::Reference<uno::XComponentContext> mxContext; 42 uno::Reference<io::XInputStream> mxStorageStream; 43 uno::Reference<embed::XStorage> mxStorage; 44 uno::Reference<embed::XRelationshipAccess> mxRelationshipAccess; 45 uno::Reference<io::XStream> mxDocumentStream; 46 uno::Reference<xml::sax::XFastParser> mxFastParser; 47 uno::Reference<xml::sax::XFastTokenHandler> mxFastTokenHandler; 48 49 StreamType_t mnStreamType; 50 51 rtl::OUString msId; 52 rtl::OUString msPath; 53 rtl::OUString msTarget; 54 55 bool lcl_getTarget(uno::Reference<embed::XRelationshipAccess> 56 xRelationshipAccess, 57 StreamType_t nStreamType, 58 const ::rtl::OUString & rId, 59 ::rtl::OUString & rDocumentTarget); 60 public: 61 typedef boost::shared_ptr<OOXMLStreamImpl> Pointer_t; 62 63 OOXMLStreamImpl 64 (OOXMLStreamImpl & rStream, StreamType_t nType); 65 OOXMLStreamImpl 66 (uno::Reference<uno::XComponentContext> xContext, 67 uno::Reference<io::XInputStream> xStorageStream, 68 StreamType_t nType); 69 OOXMLStreamImpl(OOXMLStreamImpl & rStream, const rtl::OUString & rId); 70 71 virtual ~OOXMLStreamImpl(); 72 73 virtual uno::Reference<xml::sax::XParser> getParser(); 74 virtual uno::Reference<xml::sax::XFastParser> getFastParser(); 75 virtual uno::Reference<io::XInputStream> getDocumentStream(); 76 virtual uno::Reference<io::XInputStream> getStorageStream(); 77 virtual uno::Reference<uno::XComponentContext> getContext(); 78 virtual ::rtl::OUString getTargetForId(const ::rtl::OUString & rId); 79 virtual const ::rtl::OUString & getTarget() const; 80 81 virtual uno::Reference<xml::sax::XFastTokenHandler> 82 getFastTokenHandler(uno::Reference<uno::XComponentContext> rContext); 83 84 void setInputStream(uno::Reference<io::XInputStream> rxInputStream); 85 }; 86 }} 87 #endif // INCLUDED_OOXML_STREAM_IMPL_HXX 88