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 .
19 #ifndef INCLUDED_UNOTOOLS_SOURCE_UCBHELPER_XTEMPFILE_HXX
20 #define INCLUDED_UNOTOOLS_SOURCE_UCBHELPER_XTEMPFILE_HXX
23 #include <com/sun/star/io/XInputStream.hpp>
24 #include <com/sun/star/io/XOutputStream.hpp>
25 #include <com/sun/star/io/XTempFile.hpp>
26 #include <com/sun/star/io/XTruncate.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyAccess.hpp>
29 #include <com/sun/star/beans/XFastPropertySet.hpp>
30 #include <cppuhelper/implbase.hxx>
31 #include <osl/mutex.hxx>
33 namespace com::sun::star::uno
{ class XComponentContext
; }
36 namespace utl
{ class TempFile
; }
39 typedef ::cppu::WeakImplHelper
< css::io::XTempFile
40 , css::io::XInputStream
41 , css::io::XOutputStream
43 , css::beans::XPropertySet
44 , css::beans::XFastPropertySet
45 , css::beans::XPropertyAccess
> OTempFileBase
;
47 class OTempFileService
: public OTempFileBase
50 std::unique_ptr
<utl::TempFile
> mpTempFile
;
57 sal_Int64 mnCachedPos
;
60 void checkError () const;
61 void checkConnected ();
64 explicit OTempFileService (css::uno::Reference
< css::uno::XComponentContext
> const & context
);
68 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
71 virtual sal_Bool SAL_CALL
getRemoveFile() override
;
72 virtual void SAL_CALL
setRemoveFile( sal_Bool _removefile
) override
;
73 virtual OUString SAL_CALL
getUri() override
;
74 virtual OUString SAL_CALL
getResourceName() override
;
77 virtual ::sal_Int32 SAL_CALL
readBytes( css::uno::Sequence
< ::sal_Int8
>& aData
, ::sal_Int32 nBytesToRead
) override
;
78 virtual ::sal_Int32 SAL_CALL
readSomeBytes( css::uno::Sequence
< ::sal_Int8
>& aData
, ::sal_Int32 nMaxBytesToRead
) override
;
79 virtual void SAL_CALL
skipBytes( ::sal_Int32 nBytesToSkip
) override
;
80 virtual ::sal_Int32 SAL_CALL
available( ) override
;
81 virtual void SAL_CALL
closeInput( ) override
;
83 virtual void SAL_CALL
writeBytes( const css::uno::Sequence
< ::sal_Int8
>& aData
) override
;
84 virtual void SAL_CALL
flush( ) override
;
85 virtual void SAL_CALL
closeOutput( ) override
;
87 virtual void SAL_CALL
seek( sal_Int64 location
) override
;
88 virtual sal_Int64 SAL_CALL
getPosition( ) override
;
89 virtual sal_Int64 SAL_CALL
getLength( ) override
;
91 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
getInputStream( ) override
;
92 virtual css::uno::Reference
< css::io::XOutputStream
> SAL_CALL
getOutputStream( ) override
;
94 virtual void SAL_CALL
truncate() override
;
97 virtual ::css::uno::Reference
< ::css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
98 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
, const ::css::uno::Any
& aValue
) override
;
99 virtual ::css::uno::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& PropertyName
) override
;
100 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::css::uno::Reference
< ::css::beans::XPropertyChangeListener
>& xListener
) override
;
101 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::css::uno::Reference
< ::css::beans::XPropertyChangeListener
>& aListener
) override
;
102 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::css::uno::Reference
< ::css::beans::XVetoableChangeListener
>& aListener
) override
;
103 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::css::uno::Reference
< ::css::beans::XVetoableChangeListener
>& aListener
) override
;
105 virtual void SAL_CALL
setFastPropertyValue( ::sal_Int32 nHandle
, const ::css::uno::Any
& aValue
) override
;
106 virtual ::css::uno::Any SAL_CALL
getFastPropertyValue( ::sal_Int32 nHandle
) override
;
108 virtual ::css::uno::Sequence
< ::css::beans::PropertyValue
> SAL_CALL
getPropertyValues() override
;
109 virtual void SAL_CALL
setPropertyValues( const ::css::uno::Sequence
< ::css::beans::PropertyValue
>& aProps
) override
;
112 virtual ~OTempFileService () override
;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */