1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: retrievedinputstreamdata.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _RETRIEVEDINPUTSTREAMDATA_HXX
31 #define _RETRIEVEDINPUTSTREAMDATA_HXX
33 #include <tools/link.hxx>
34 #include <sal/types.h>
35 #include <osl/mutex.hxx>
36 #include <com/sun/star/uno/Reference.hxx>
37 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_
38 #include <com/sun/star/io/XInputStream.hpp>
43 #include <boost/weak_ptr.hpp>
44 class SwAsyncRetrieveInputStreamThreadConsumer
;
45 //#ifndef _RETRIEVEINPUTSTREAMCONSUMER_HXX
46 //#include <retrieveinputstreamconsumer.hxx>
49 /** Singleton class to manage retrieved input stream data in Writer
51 OD 2007-01-29 #i73788#
52 The instance of this class provides data container for retrieved input
53 stream data. The data container is accessed via a key, which the data
54 manager provides on creation of the data container.
55 When a certain data container is filled with data, an user event is submitted
56 to trigger the processing of with data.
60 class SwRetrievedInputStreamDataManager
64 typedef sal_uInt64 tDataKey
;
68 boost::weak_ptr
< SwAsyncRetrieveInputStreamThreadConsumer
> mpThreadConsumer
;
69 com::sun::star::uno::Reference
<com::sun::star::io::XInputStream
> mxInputStream
;
70 sal_Bool mbIsStreamReadOnly
;
74 mbIsStreamReadOnly( sal_False
)
77 tData( boost::weak_ptr
< SwAsyncRetrieveInputStreamThreadConsumer
> pThreadConsumer
)
78 : mpThreadConsumer( pThreadConsumer
),
79 mbIsStreamReadOnly( sal_False
)
83 static SwRetrievedInputStreamDataManager
& GetManager();
85 ~SwRetrievedInputStreamDataManager()
89 tDataKey
ReserveData( boost::weak_ptr
< SwAsyncRetrieveInputStreamThreadConsumer
> pThreadConsumer
);
91 void PushData( const tDataKey nDataKey
,
92 com::sun::star::uno::Reference
<com::sun::star::io::XInputStream
> xInputStream
,
93 const sal_Bool bIsStreamReadOnly
);
95 bool PopData( const tDataKey nDataKey
,
98 DECL_LINK( LinkedInputStreamReady
, SwRetrievedInputStreamDataManager::tDataKey
* );
102 static SwRetrievedInputStreamDataManager
* mpManager
;
103 static tDataKey mnNextKeyValue
;
104 static osl::Mutex maGetManagerMutex
;
108 std::map
< tDataKey
, tData
> maInputStreamData
;
110 SwRetrievedInputStreamDataManager()