xref: /aoo41x/main/ucb/source/ucp/file/filinpstr.hxx (revision 6df1ea1f)
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 			throw( com::sun::star::uno::RuntimeException);
72 
73 		virtual void SAL_CALL
74 		acquire(
75 			void )
76 			throw();
77 
78 		virtual void SAL_CALL
79 		release(
80 			void )
81 			throw();
82 
83 		virtual sal_Int32 SAL_CALL
84 		readBytes(
85 			com::sun::star::uno::Sequence< sal_Int8 >& aData,
86 			sal_Int32 nBytesToRead )
87 			throw( com::sun::star::io::NotConnectedException,
88 				   com::sun::star::io::BufferSizeExceededException,
89 				   com::sun::star::io::IOException,
90 				   com::sun::star::uno::RuntimeException);
91 
92 		virtual sal_Int32 SAL_CALL
93 		readSomeBytes(
94 			com::sun::star::uno::Sequence< sal_Int8 >& aData,
95 			sal_Int32 nMaxBytesToRead )
96 			throw( com::sun::star::io::NotConnectedException,
97 				   com::sun::star::io::BufferSizeExceededException,
98 				   com::sun::star::io::IOException,
99 				   com::sun::star::uno::RuntimeException);
100 
101 		virtual void SAL_CALL
102 		skipBytes(
103 			sal_Int32 nBytesToSkip )
104 			throw( com::sun::star::io::NotConnectedException,
105 				   com::sun::star::io::BufferSizeExceededException,
106 				   com::sun::star::io::IOException,
107 				   com::sun::star::uno::RuntimeException );
108 
109 		virtual sal_Int32 SAL_CALL
110 		available(
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 		closeInput(
118 			void )
119 			throw( com::sun::star::io::NotConnectedException,
120 				   com::sun::star::io::IOException,
121 				   com::sun::star::uno::RuntimeException );
122 
123 		virtual void SAL_CALL
124 		seek(
125 			sal_Int64 location )
126 			throw( com::sun::star::lang::IllegalArgumentException,
127 				   com::sun::star::io::IOException,
128 				   com::sun::star::uno::RuntimeException );
129 
130 		virtual sal_Int64 SAL_CALL
131 		getPosition(
132 			void )
133 			throw( com::sun::star::io::IOException,
134 				   com::sun::star::uno::RuntimeException );
135 
136 		virtual sal_Int64 SAL_CALL
137 		getLength(
138 			void )
139 			throw( com::sun::star::io::IOException,
140 				   com::sun::star::uno::RuntimeException );
141 
142 	private:
143 
144 		shell*                                             m_pMyShell;
145 		com::sun::star::uno::Reference<
146 		com::sun::star::ucb::XContentProvider >            m_xProvider;
147 		sal_Bool                                           m_nIsOpen;
148 
149         sal_Bool                                           m_bLock;
150 
151 		ReconnectingFile                                   m_aFile;
152 
153 		sal_Int32                                          m_nErrorCode;
154 		sal_Int32                                          m_nMinorErrorCode;
155 	};
156 
157 
158 } // end namespace XInputStream_impl
159 
160 #endif
161