Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_FILINPSTR_HXX
20 : #define INCLUDED_UCB_SOURCE_UCP_FILE_FILINPSTR_HXX
21 :
22 : #include <rtl/ustring.hxx>
23 : #include <cppuhelper/weak.hxx>
24 : #include <ucbhelper/macros.hxx>
25 : #include <com/sun/star/uno/XInterface.hpp>
26 : #include <com/sun/star/lang/XTypeProvider.hpp>
27 : #include <com/sun/star/io/XSeekable.hpp>
28 : #include <com/sun/star/io/XInputStream.hpp>
29 : #include <com/sun/star/ucb/XContentProvider.hpp>
30 :
31 : #include "filrec.hxx"
32 :
33 : namespace fileaccess {
34 :
35 : class shell;
36 :
37 : class XInputStream_impl
38 : : public cppu::OWeakObject,
39 : public com::sun::star::lang::XTypeProvider,
40 : public com::sun::star::io::XInputStream,
41 : public com::sun::star::io::XSeekable
42 : {
43 : public:
44 :
45 : XInputStream_impl( shell* pMyShell,const OUString& aUncPath, bool bLock );
46 :
47 : virtual ~XInputStream_impl();
48 :
49 : /**
50 : * Returns an error code as given by filerror.hxx
51 : */
52 :
53 9689 : sal_Int32 SAL_CALL CtorSuccess() { return m_nErrorCode;}
54 26 : sal_Int32 SAL_CALL getMinorError() { return m_nMinorErrorCode;}
55 :
56 :
57 : // XTypeProvider
58 :
59 : virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
60 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
61 : virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
62 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
63 :
64 : virtual com::sun::star::uno::Any SAL_CALL
65 : queryInterface(
66 : const com::sun::star::uno::Type& rType )
67 : throw( com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 :
69 : virtual void SAL_CALL
70 : acquire(
71 : void )
72 : throw() SAL_OVERRIDE;
73 :
74 : virtual void SAL_CALL
75 : release(
76 : void )
77 : throw() SAL_OVERRIDE;
78 :
79 : virtual sal_Int32 SAL_CALL
80 : readBytes(
81 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
82 : sal_Int32 nBytesToRead )
83 : throw( com::sun::star::io::NotConnectedException,
84 : com::sun::star::io::BufferSizeExceededException,
85 : com::sun::star::io::IOException,
86 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 :
88 : virtual sal_Int32 SAL_CALL
89 : readSomeBytes(
90 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
91 : sal_Int32 nMaxBytesToRead )
92 : throw( com::sun::star::io::NotConnectedException,
93 : com::sun::star::io::BufferSizeExceededException,
94 : com::sun::star::io::IOException,
95 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 :
97 : virtual void SAL_CALL
98 : skipBytes(
99 : sal_Int32 nBytesToSkip )
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, std::exception ) SAL_OVERRIDE;
104 :
105 : virtual sal_Int32 SAL_CALL
106 : available(
107 : void )
108 : throw( com::sun::star::io::NotConnectedException,
109 : com::sun::star::io::IOException,
110 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
111 :
112 : virtual void SAL_CALL
113 : closeInput(
114 : void )
115 : throw( com::sun::star::io::NotConnectedException,
116 : com::sun::star::io::IOException,
117 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
118 :
119 : virtual void SAL_CALL
120 : seek(
121 : sal_Int64 location )
122 : throw( com::sun::star::lang::IllegalArgumentException,
123 : com::sun::star::io::IOException,
124 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
125 :
126 : virtual sal_Int64 SAL_CALL
127 : getPosition(
128 : void )
129 : throw( com::sun::star::io::IOException,
130 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
131 :
132 : virtual sal_Int64 SAL_CALL
133 : getLength(
134 : void )
135 : throw( com::sun::star::io::IOException,
136 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
137 :
138 : private:
139 :
140 : com::sun::star::uno::Reference<
141 : com::sun::star::ucb::XContentProvider > m_xProvider;
142 : bool m_nIsOpen;
143 :
144 : ReconnectingFile m_aFile;
145 :
146 : sal_Int32 m_nErrorCode;
147 : sal_Int32 m_nMinorErrorCode;
148 : };
149 : } // end namespace XInputStream_impl
150 :
151 : #endif
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|