LibreOffice Module comphelper (master)  1
seekableinput.hxx
Go to the documentation of this file.
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_COMPHELPER_SEEKABLEINPUT_HXX
20 #define INCLUDED_COMPHELPER_SEEKABLEINPUT_HXX
21 
22 #include <osl/mutex.hxx>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/io/XInputStream.hpp>
25 #include <com/sun/star/io/XSeekable.hpp>
26 #include <cppuhelper/implbase.hxx>
28 
29 namespace com::sun::star::uno { class XComponentContext; }
30 
31 namespace comphelper
32 {
33 
34 class SAL_DLLPUBLIC_TEMPLATE OSeekableInputWrapper_BASE
35  : public ::cppu::WeakImplHelper< css::io::XInputStream,
36  css::io::XSeekable >
37 {};
38 
41 {
42  ::osl::Mutex m_aMutex;
43 
44  css::uno::Reference< css::uno::XComponentContext > m_xContext;
45 
46  css::uno::Reference< css::io::XInputStream > m_xOriginalStream;
47 
48  css::uno::Reference< css::io::XInputStream > m_xCopyInput;
49  css::uno::Reference< css::io::XSeekable > m_xCopySeek;
50 
51 private:
52  COMPHELPER_DLLPRIVATE void PrepareCopy_Impl();
53 
54 public:
56  const css::uno::Reference< css::io::XInputStream >& xInStream,
57  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
58 
59  virtual ~OSeekableInputWrapper() override;
60 
61  static css::uno::Reference< css::io::XInputStream > CheckSeekableCanWrap(
62  const css::uno::Reference< css::io::XInputStream >& xInStream,
63  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
64 
65 // XInputStream
66  virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
67  virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
68  virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
69  virtual sal_Int32 SAL_CALL available() override;
70  virtual void SAL_CALL closeInput() override;
71 
72 // XSeekable
73  virtual void SAL_CALL seek( sal_Int64 location ) override;
74  virtual sal_Int64 SAL_CALL getPosition() override;
75  virtual sal_Int64 SAL_CALL getLength() override;
76 
77 };
78 
79 } // namespace comphelper
80 
81 #endif
82 
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::io::XSeekable > m_xCopySeek
css::uno::Reference< css::io::XInputStream > m_xCopyInput
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define COMPHELPER_DLLPRIVATE
double getLength(const B2DPolygon &rCandidate)
css::uno::Reference< css::io::XInputStream > m_xOriginalStream
#define COMPHELPER_DLLPUBLIC