xref: /trunk/main/ucb/source/ucp/file/filinpstr.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 #ifndef _FILINPSTR_HXX_
28 #define _FILINPSTR_HXX_
29 
30 #include <rtl/ustring.hxx>
31 #include <cppuhelper/weak.hxx>
32 #include <ucbhelper/macros.hxx>
33 #include <com/sun/star/uno/XInterface.hpp>
34 #include <com/sun/star/lang/XTypeProvider.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 #include "filrec.hxx"
40 
41 namespace fileaccess {
42 
43     // forward declaration
44 
45     class shell;
46 
47 
48     class XInputStream_impl
49         : public cppu::OWeakObject,
50           public com::sun::star::lang::XTypeProvider,
51           public com::sun::star::io::XInputStream,
52           public com::sun::star::io::XSeekable
53     {
54     public:
55 
56         XInputStream_impl( shell* pMyShell,const rtl::OUString& aUncPath, sal_Bool bLock );
57 
58         virtual ~XInputStream_impl();
59 
60         /**
61          *  Returns an error code as given by filerror.hxx
62          */
63 
64         sal_Int32 SAL_CALL CtorSuccess();
65         sal_Int32 SAL_CALL getMinorError();
66 
67 
68         // XTypeProvider
69 
70         XTYPEPROVIDER_DECL()
71 
72         virtual com::sun::star::uno::Any SAL_CALL
73         queryInterface(
74             const com::sun::star::uno::Type& rType )
75             throw( com::sun::star::uno::RuntimeException);
76 
77         virtual void SAL_CALL
78         acquire(
79             void )
80             throw();
81 
82         virtual void SAL_CALL
83         release(
84             void )
85             throw();
86 
87         virtual sal_Int32 SAL_CALL
88         readBytes(
89             com::sun::star::uno::Sequence< sal_Int8 >& aData,
90             sal_Int32 nBytesToRead )
91             throw( com::sun::star::io::NotConnectedException,
92                    com::sun::star::io::BufferSizeExceededException,
93                    com::sun::star::io::IOException,
94                    com::sun::star::uno::RuntimeException);
95 
96         virtual sal_Int32 SAL_CALL
97         readSomeBytes(
98             com::sun::star::uno::Sequence< sal_Int8 >& aData,
99             sal_Int32 nMaxBytesToRead )
100             throw( com::sun::star::io::NotConnectedException,
101                    com::sun::star::io::BufferSizeExceededException,
102                    com::sun::star::io::IOException,
103                    com::sun::star::uno::RuntimeException);
104 
105         virtual void SAL_CALL
106         skipBytes(
107             sal_Int32 nBytesToSkip )
108             throw( com::sun::star::io::NotConnectedException,
109                    com::sun::star::io::BufferSizeExceededException,
110                    com::sun::star::io::IOException,
111                    com::sun::star::uno::RuntimeException );
112 
113         virtual sal_Int32 SAL_CALL
114         available(
115             void )
116             throw( com::sun::star::io::NotConnectedException,
117                    com::sun::star::io::IOException,
118                    com::sun::star::uno::RuntimeException );
119 
120         virtual void SAL_CALL
121         closeInput(
122             void )
123             throw( com::sun::star::io::NotConnectedException,
124                    com::sun::star::io::IOException,
125                    com::sun::star::uno::RuntimeException );
126 
127         virtual void SAL_CALL
128         seek(
129             sal_Int64 location )
130             throw( com::sun::star::lang::IllegalArgumentException,
131                    com::sun::star::io::IOException,
132                    com::sun::star::uno::RuntimeException );
133 
134         virtual sal_Int64 SAL_CALL
135         getPosition(
136             void )
137             throw( com::sun::star::io::IOException,
138                    com::sun::star::uno::RuntimeException );
139 
140         virtual sal_Int64 SAL_CALL
141         getLength(
142             void )
143             throw( com::sun::star::io::IOException,
144                    com::sun::star::uno::RuntimeException );
145 
146     private:
147 
148         shell*                                             m_pMyShell;
149         com::sun::star::uno::Reference<
150         com::sun::star::ucb::XContentProvider >            m_xProvider;
151         sal_Bool                                           m_nIsOpen;
152 
153         sal_Bool                                           m_bLock;
154 
155         ReconnectingFile                                   m_aFile;
156 
157         sal_Int32                                          m_nErrorCode;
158         sal_Int32                                          m_nMinorErrorCode;
159     };
160 
161 
162 } // end namespace XInputStream_impl
163 
164 #endif
165