bump product version to 6.3.0.0.beta1
[LibreOffice.git] / svl / source / fsstor / ostreamcontainer.hxx
blob5d255f44aab31dbd7db0f9005e104fb24b38916f
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 .
20 #ifndef INCLUDED_SVL_SOURCE_FSSTOR_OSTREAMCONTAINER_HXX
21 #define INCLUDED_SVL_SOURCE_FSSTOR_OSTREAMCONTAINER_HXX
23 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/lang/XTypeProvider.hpp>
25 #include <com/sun/star/embed/XExtendedStorageStream.hpp>
26 #include <com/sun/star/io/XSeekable.hpp>
27 #include <com/sun/star/io/XTruncate.hpp>
28 #include <com/sun/star/io/XInputStream.hpp>
29 #include <com/sun/star/io/XOutputStream.hpp>
30 #include <com/sun/star/io/XStream.hpp>
31 #include <com/sun/star/io/XAsyncOutputMonitor.hpp>
32 #include <cppuhelper/weak.hxx>
33 #include <cppuhelper/typeprovider.hxx>
34 #include <comphelper/interfacecontainer2.hxx>
35 #include <osl/mutex.hxx>
36 #include <memory>
38 class OFSStreamContainer : public cppu::OWeakObject,
39 public css::lang::XTypeProvider,
40 public css::embed::XExtendedStorageStream,
41 public css::io::XSeekable,
42 public css::io::XInputStream,
43 public css::io::XOutputStream,
44 public css::io::XTruncate,
45 public css::io::XAsyncOutputMonitor
47 ::osl::Mutex m_aMutex;
49 css::uno::Reference< css::io::XStream > m_xStream;
50 css::uno::Reference< css::io::XSeekable > m_xSeekable;
51 css::uno::Reference< css::io::XInputStream > m_xInputStream;
52 css::uno::Reference< css::io::XOutputStream > m_xOutputStream;
53 css::uno::Reference< css::io::XTruncate > m_xTruncate;
54 css::uno::Reference< css::io::XAsyncOutputMonitor > m_xAsyncOutputMonitor;
56 bool m_bDisposed;
57 bool m_bInputClosed;
58 bool m_bOutputClosed;
60 std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners
61 css::uno::Sequence<css::uno::Type> m_aTypes;
63 public:
64 explicit OFSStreamContainer( const css::uno::Reference < css::io::XStream >& xStream );
65 virtual ~OFSStreamContainer() override;
67 // XInterface
68 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
69 virtual void SAL_CALL acquire() throw() override;
70 virtual void SAL_CALL release() throw() override;
72 // XTypeProvider
73 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
74 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
76 // XStream
77 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( ) override;
78 virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream( ) override;
80 // XComponent
81 virtual void SAL_CALL dispose() override;
82 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
83 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
85 // XSeekable
86 virtual void SAL_CALL seek( sal_Int64 location ) override;
87 virtual sal_Int64 SAL_CALL getPosition() override;
88 virtual sal_Int64 SAL_CALL getLength() override;
90 // XInputStream
91 virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
92 virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
93 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
94 virtual sal_Int32 SAL_CALL available( ) override;
95 virtual void SAL_CALL closeInput( ) override;
97 // XOutputStream
98 virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
99 virtual void SAL_CALL flush( ) override;
100 virtual void SAL_CALL closeOutput( ) override;
102 // XTruncate
103 virtual void SAL_CALL truncate() override;
105 // XAsyncOutputMonitor
106 virtual void SAL_CALL waitForCompletion( ) override;
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */