bump product version to 4.2.0.1
[LibreOffice.git] / include / comphelper / seekableinput.hxx
blob11dd6685353badd95c3d5fd83018bfb96d27eb86
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_COMPHELPER_SEEKABLEINPUT_HXX
20 #define INCLUDED_COMPHELPER_SEEKABLEINPUT_HXX
22 #include <osl/mutex.hxx>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/io/XSeekable.hpp>
27 #include <cppuhelper/implbase2.hxx>
28 #include <comphelper/comphelperdllapi.h>
30 namespace comphelper
33 class COMPHELPER_DLLPUBLIC OSeekableInputWrapper : public ::cppu::WeakImplHelper2< ::com::sun::star::io::XInputStream,
34 ::com::sun::star::io::XSeekable >
36 ::osl::Mutex m_aMutex;
38 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
40 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOriginalStream;
42 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xCopyInput;
43 ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xCopySeek;
45 private:
46 COMPHELPER_DLLPRIVATE void PrepareCopy_Impl();
48 public:
49 OSeekableInputWrapper(
50 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
51 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
53 virtual ~OSeekableInputWrapper();
55 static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > CheckSeekableCanWrap(
56 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
57 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
59 // XInputStream
60 virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
61 virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
62 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
63 virtual sal_Int32 SAL_CALL available() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL closeInput() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
66 // XSeekable
67 virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
68 virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
69 virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
73 } // namespace comphelper
75 #endif
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */