1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <cppuhelper/interfacecontainer.h>
35 #include <osl/mutex.hxx>
37 class OFSStreamContainer
: public cppu::OWeakObject
,
38 public ::com::sun::star::lang::XTypeProvider
,
39 public ::com::sun::star::embed::XExtendedStorageStream
,
40 public ::com::sun::star::io::XSeekable
,
41 public ::com::sun::star::io::XInputStream
,
42 public ::com::sun::star::io::XOutputStream
,
43 public ::com::sun::star::io::XTruncate
,
44 public ::com::sun::star::io::XAsyncOutputMonitor
46 ::osl::Mutex m_aMutex
;
48 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
49 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XSeekable
> m_xSeekable
;
50 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xInputStream
;
51 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> m_xOutputStream
;
52 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XTruncate
> m_xTruncate
;
53 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XAsyncOutputMonitor
> m_xAsyncOutputMonitor
;
59 ::cppu::OInterfaceContainerHelper
* m_pListenersContainer
; // list of listeners
60 ::cppu::OTypeCollection
* m_pTypeCollection
;
63 OFSStreamContainer( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xStream
);
64 virtual ~OFSStreamContainer();
67 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
68 throw( ::com::sun::star::uno::RuntimeException
);
69 virtual void SAL_CALL
acquire() throw();
70 virtual void SAL_CALL
release() throw();
73 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
74 throw( ::com::sun::star::uno::RuntimeException
);
75 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
76 throw( ::com::sun::star::uno::RuntimeException
);
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
getInputStream( ) throw (::com::sun::star::uno::RuntimeException
);
80 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> SAL_CALL
getOutputStream( ) throw (::com::sun::star::uno::RuntimeException
);
83 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
84 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
85 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
88 virtual void SAL_CALL
seek( sal_Int64 location
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
89 virtual sal_Int64 SAL_CALL
getPosition() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
90 virtual sal_Int64 SAL_CALL
getLength() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
93 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nBytesToRead
)
94 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
95 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
);
96 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
97 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
98 virtual sal_Int32 SAL_CALL
available( )
99 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
closeInput( )
101 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
writeBytes( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
) throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
105 virtual void SAL_CALL
flush( ) throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
106 virtual void SAL_CALL
closeOutput( ) throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
truncate() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
111 // XAsyncOutputMonitor
112 virtual void SAL_CALL
waitForCompletion( ) throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */