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 _FILINPSTR_HXX_ 24 #define _FILINPSTR_HXX_ 25 26 #include <rtl/ustring.hxx> 27 #include <cppuhelper/weak.hxx> 28 #include <ucbhelper/macros.hxx> 29 #include <com/sun/star/uno/XInterface.hpp> 30 #include <com/sun/star/lang/XTypeProvider.hpp> 31 #include <com/sun/star/io/XSeekable.hpp> 32 #include <com/sun/star/io/XInputStream.hpp> 33 #include <com/sun/star/ucb/XContentProvider.hpp> 34 35 #include "filrec.hxx" 36 37 namespace fileaccess { 38 39 // forward declaration 40 41 class shell; 42 43 44 class XInputStream_impl 45 : public cppu::OWeakObject, 46 public com::sun::star::lang::XTypeProvider, 47 public com::sun::star::io::XInputStream, 48 public com::sun::star::io::XSeekable 49 { 50 public: 51 52 XInputStream_impl( shell* pMyShell,const rtl::OUString& aUncPath, sal_Bool bLock ); 53 54 virtual ~XInputStream_impl(); 55 56 /** 57 * Returns an error code as given by filerror.hxx 58 */ 59 60 sal_Int32 SAL_CALL CtorSuccess(); 61 sal_Int32 SAL_CALL getMinorError(); 62 63 64 // XTypeProvider 65 66 XTYPEPROVIDER_DECL() 67 68 virtual com::sun::star::uno::Any SAL_CALL 69 queryInterface( 70 const com::sun::star::uno::Type& rType ); 71 72 virtual void SAL_CALL 73 acquire( 74 void ) 75 throw(); 76 77 virtual void SAL_CALL 78 release( 79 void ) 80 throw(); 81 82 virtual sal_Int32 SAL_CALL 83 readBytes( 84 com::sun::star::uno::Sequence< sal_Int8 >& aData, 85 sal_Int32 nBytesToRead ); 86 87 virtual sal_Int32 SAL_CALL 88 readSomeBytes( 89 com::sun::star::uno::Sequence< sal_Int8 >& aData, 90 sal_Int32 nMaxBytesToRead ); 91 92 virtual void SAL_CALL 93 skipBytes( 94 sal_Int32 nBytesToSkip ); 95 96 virtual sal_Int32 SAL_CALL 97 available( 98 void ); 99 100 virtual void SAL_CALL 101 closeInput( 102 void ); 103 104 virtual void SAL_CALL 105 seek( 106 sal_Int64 location ); 107 108 virtual sal_Int64 SAL_CALL 109 getPosition( 110 void ); 111 112 virtual sal_Int64 SAL_CALL 113 getLength( 114 void ); 115 116 private: 117 118 shell* m_pMyShell; 119 com::sun::star::uno::Reference< 120 com::sun::star::ucb::XContentProvider > m_xProvider; 121 sal_Bool m_nIsOpen; 122 123 sal_Bool m_bLock; 124 125 ReconnectingFile m_aFile; 126 127 sal_Int32 m_nErrorCode; 128 sal_Int32 m_nMinorErrorCode; 129 }; 130 131 132 } // end namespace XInputStream_impl 133 134 #endif 135