1*39a19a47SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*39a19a47SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*39a19a47SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*39a19a47SAndrew Rist * distributed with this work for additional information 6*39a19a47SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*39a19a47SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*39a19a47SAndrew Rist * "License"); you may not use this file except in compliance 9*39a19a47SAndrew Rist * with the License. You may obtain a copy of the License at 10*39a19a47SAndrew Rist * 11*39a19a47SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*39a19a47SAndrew Rist * 13*39a19a47SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*39a19a47SAndrew Rist * software distributed under the License is distributed on an 15*39a19a47SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*39a19a47SAndrew Rist * KIND, either express or implied. See the License for the 17*39a19a47SAndrew Rist * specific language governing permissions and limitations 18*39a19a47SAndrew Rist * under the License. 19*39a19a47SAndrew Rist * 20*39a19a47SAndrew Rist *************************************************************/ 21*39a19a47SAndrew Rist 22*39a19a47SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _OINPUTSTREAMCONTAINER_HXX_ 25cdf0e10cSrcweir #define _OINPUTSTREAMCONTAINER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 28cdf0e10cSrcweir #include <com/sun/star/embed/XExtendedStorageStream.hpp> 29cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 33cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <osl/mutex.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir class OFSInputStreamContainer : public cppu::WeakImplHelper2 < ::com::sun::star::io::XInputStream 38cdf0e10cSrcweir ,::com::sun::star::embed::XExtendedStorageStream > 39cdf0e10cSrcweir , public ::com::sun::star::io::XSeekable 40cdf0e10cSrcweir { 41cdf0e10cSrcweir protected: 42cdf0e10cSrcweir ::osl::Mutex m_aMutex; 43cdf0e10cSrcweir 44cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInputStream; 45cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; 46cdf0e10cSrcweir 47cdf0e10cSrcweir sal_Bool m_bSeekable; 48cdf0e10cSrcweir 49cdf0e10cSrcweir sal_Bool m_bDisposed; 50cdf0e10cSrcweir 51cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners 52cdf0e10cSrcweir 53cdf0e10cSrcweir public: 54cdf0e10cSrcweir OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir virtual ~OFSInputStreamContainer(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); 59cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException ); 60cdf0e10cSrcweir virtual void SAL_CALL acquire() throw(); 61cdf0e10cSrcweir virtual void SAL_CALL release() throw(); 62cdf0e10cSrcweir 63cdf0e10cSrcweir // XInputStream 64cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) 65cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 66cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) 67cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 69cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 70cdf0e10cSrcweir virtual sal_Int32 SAL_CALL available( ) 71cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir virtual void SAL_CALL closeInput( ) 73cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir 75cdf0e10cSrcweir //XStream 76cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir 79cdf0e10cSrcweir //XSeekable 80cdf0e10cSrcweir virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 83cdf0e10cSrcweir 84cdf0e10cSrcweir //XComponent 85cdf0e10cSrcweir virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 88cdf0e10cSrcweir 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir #endif 92cdf0e10cSrcweir 93