1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _WRAPSTREAMFORSHARE_HXX_ 29 #define _WRAPSTREAMFORSHARE_HXX_ 30 31 #include <com/sun/star/io/XInputStream.hpp> 32 #include <com/sun/star/io/XSeekable.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 35 #include <mutexholder.hxx> 36 37 class WrapStreamForShare : public cppu::WeakImplHelper2 < ::com::sun::star::io::XInputStream 38 , ::com::sun::star::io::XSeekable > 39 { 40 protected: 41 SotMutexHolderRef m_rMutexRef; 42 ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInStream; 43 ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; 44 45 sal_Int64 m_nCurPos; 46 47 public: 48 WrapStreamForShare( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, 49 const SotMutexHolderRef& rMutexRef ); 50 virtual ~WrapStreamForShare(); 51 52 // XInputStream 53 virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) 54 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 55 virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) 56 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 57 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 58 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 59 virtual sal_Int32 SAL_CALL available( ) 60 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 61 virtual void SAL_CALL closeInput( ) 62 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 63 64 65 //XSeekable 66 virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 67 virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 68 virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 69 70 }; 71 72 #endif 73 74