1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _RETRIEVEINPUTSTREAMCONSUMER_HXX
24 #define _RETRIEVEINPUTSTREAMCONSUMER_HXX
25 
26 #include <com/sun/star/uno/Reference.hxx>
27 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_
28 #include <com/sun/star/io/XInputStream.hpp>
29 #endif
30 #include <osl/interlck.h>
31 #include <retrievedinputstreamdata.hxx>
32 
33 class SwGrfNode;
34 class String;
35 class SwAsyncRetrieveInputStreamThread;
36 
37 /** class to provide creation of a thread to retrieve an input stream given by
38     an URL and to consume the retrieved input stream.
39 
40     OD 2007-01-29 #i73788#
41 
42     @author OD
43 */
44 class SwAsyncRetrieveInputStreamThreadConsumer
45 {
46     public:
47 
48         SwAsyncRetrieveInputStreamThreadConsumer( SwGrfNode& rGrfNode );
49         ~SwAsyncRetrieveInputStreamThreadConsumer();
50 
51         /** method to create thread
52 
53             @author OD
54         */
55         void CreateThread( const String& rURL );
56 
57         /** method called to provide the retrieved input stream to the thread Consumer
58 
59             @author OD
60         */
61         void ApplyInputStream(
62             com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
63             const sal_Bool bIsStreamReadOnly );
64 
65     private:
66 
67         SwGrfNode& mrGrfNode;
68         oslInterlockedCount mnThreadID;
69 };
70 #endif
71