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